From b460c9b32ab71634f73caacaf9ee633934009b90 Mon Sep 17 00:00:00 2001 From: Florent Duchon Date: Tue, 23 Apr 2013 17:07:20 +0200 Subject: digital/beacon: add serial over zigbit feature --- digital/beacon/src/debug_avr.c | 17 ++++++++++++++++- digital/beacon/src/debug_avr.h | 6 ++++++ 2 files changed, 22 insertions(+), 1 deletion(-) (limited to 'digital/beacon') diff --git a/digital/beacon/src/debug_avr.c b/digital/beacon/src/debug_avr.c index 022af2d9..a4805157 100644 --- a/digital/beacon/src/debug_avr.c +++ b/digital/beacon/src/debug_avr.c @@ -33,9 +33,13 @@ #include "codewheel.h" #include "laser.h" #include "network_specific.h" +#include "network_send_commands.h" +#include "serial_ota.h" #include "motor.h" #include "position.h" #include "reset.h" +#include "uid.h" +#include "misc.h" HAL_UsartDescriptor_t appUsartDescriptor; // USART descriptor (required by stack) static HAL_AppTimer_t debugTimer; // TIMER descripor used by the DEBUG task @@ -68,13 +72,24 @@ uint8_t rxBuffer[40]; OPEN_USART(&appUsartDescriptor); } + /* RX USART Callback */ void usartRXCallback(uint16_t bytesToRead) { + uint16_t dest = 0; /* Read RX buffer from HAL */ READ_USART(&appUsartDescriptor,rxBuffer,bytesToRead); + if(get_serial_ota_mode() == 1) + { + if(get_uid() == 0) + dest = get_serial_ota_EDaddr(); + else + dest = 0; + network_send_buffer_over_zb(dest,rxBuffer,bytesToRead); + } + else { switch(rxBuffer[0]) { @@ -193,4 +208,4 @@ void debug_task(void) uprintf("## Motor\r\n"); uprintf("State : %d ---- speed = %d\r\n",motor_get_state(),OCR0A); #endif -} +} \ No newline at end of file diff --git a/digital/beacon/src/debug_avr.h b/digital/beacon/src/debug_avr.h index 488d8b16..cdba61c5 100644 --- a/digital/beacon/src/debug_avr.h +++ b/digital/beacon/src/debug_avr.h @@ -43,4 +43,10 @@ void debug_start_stop_task(void); /* Debug task callback */ void debug_task(void); +/* This function stops the uart over zb mode */ +void serial_over_zigbit_stop(void); + +/* This function starts the uart over zb mode */ +void serial_over_zigbit_start(uint16_t addr); + #endif -- cgit v1.2.3