1
0
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:
Oliver Hahm 2013-06-24 22:12:57 +02:00
parent 79ff4f1cfc
commit 5bae4f841d
2 changed files with 10 additions and 5 deletions

View File

@ -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)
/**
* @}

View File

@ -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);