mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-25 06:23:53 +01:00
added one-time-initialization guard to transceiver
This commit is contained in:
parent
79ff4f1cfc
commit
5bae4f841d
@ -16,10 +16,10 @@
|
||||
#ifndef _FLAGS_H
|
||||
#define _FLAGS_H
|
||||
|
||||
#define CREATE_SLEEPING 1
|
||||
#define AUTO_FREE 2
|
||||
#define CREATE_WOUT_YIELD 4
|
||||
#define CREATE_STACKTEST 8
|
||||
#define CREATE_SLEEPING (1)
|
||||
#define AUTO_FREE (2)
|
||||
#define CREATE_WOUT_YIELD (4)
|
||||
#define CREATE_STACKTEST (8)
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
||||
@ -62,7 +62,7 @@ msg_t msg_buffer[TRANSCEIVER_MSG_BUFFER_SIZE];
|
||||
|
||||
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 transceiver_buffer_pos = 0;
|
||||
@ -107,6 +107,11 @@ void transceiver_init(transceiver_type_t t)
|
||||
{
|
||||
uint8_t i;
|
||||
|
||||
if (transceiver_pid >= 0) {
|
||||
/* do not re-initialize an already running transceiver */
|
||||
return;
|
||||
}
|
||||
|
||||
/* Initializing transceiver buffer and data buffer */
|
||||
memset(transceiver_buffer, 0, TRANSCEIVER_BUFFER_SIZE);
|
||||
memset(data_buffer, 0, TRANSCEIVER_BUFFER_SIZE * PAYLOAD_SIZE);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user