Skip to content
Snippets Groups Projects
Commit 5bae4f84 authored by Oleg Hahm's avatar Oleg Hahm
Browse files

added one-time-initialization guard to transceiver

parent 79ff4f1c
No related branches found
No related tags found
No related merge requests found
...@@ -16,10 +16,10 @@ ...@@ -16,10 +16,10 @@
#ifndef _FLAGS_H #ifndef _FLAGS_H
#define _FLAGS_H #define _FLAGS_H
#define CREATE_SLEEPING 1 #define CREATE_SLEEPING (1)
#define AUTO_FREE 2 #define AUTO_FREE (2)
#define CREATE_WOUT_YIELD 4 #define CREATE_WOUT_YIELD (4)
#define CREATE_STACKTEST 8 #define CREATE_STACKTEST (8)
/** /**
* @} * @}
......
...@@ -62,7 +62,7 @@ msg_t msg_buffer[TRANSCEIVER_MSG_BUFFER_SIZE]; ...@@ -62,7 +62,7 @@ msg_t msg_buffer[TRANSCEIVER_MSG_BUFFER_SIZE];
uint32_t response; ///< response bytes for messages to upper layer threads uint32_t response; ///< response bytes for messages to upper layer threads
int transceiver_pid; ///< the transceiver thread's pid int transceiver_pid = -1; ///< the transceiver thread's pid
static volatile uint8_t rx_buffer_pos = 0; static volatile uint8_t rx_buffer_pos = 0;
static volatile uint8_t transceiver_buffer_pos = 0; static volatile uint8_t transceiver_buffer_pos = 0;
...@@ -107,6 +107,11 @@ void transceiver_init(transceiver_type_t t) ...@@ -107,6 +107,11 @@ void transceiver_init(transceiver_type_t t)
{ {
uint8_t i; uint8_t i;
if (transceiver_pid >= 0) {
/* do not re-initialize an already running transceiver */
return;
}
/* Initializing transceiver buffer and data buffer */ /* Initializing transceiver buffer and data buffer */
memset(transceiver_buffer, 0, TRANSCEIVER_BUFFER_SIZE); memset(transceiver_buffer, 0, TRANSCEIVER_BUFFER_SIZE);
memset(data_buffer, 0, TRANSCEIVER_BUFFER_SIZE * PAYLOAD_SIZE); memset(data_buffer, 0, TRANSCEIVER_BUFFER_SIZE * PAYLOAD_SIZE);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment