From 37082aba8175e02e86271010ee372d2f34fc6413 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Wed, 26 Feb 2020 22:50:12 +0100 Subject: [PATCH] BSB: Cleanup --- bsb/README | 4 ++++ bsb/firmware/interface.h | 18 +++++++++--------- bsb/firmware/main.c | 2 +- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/bsb/README b/bsb/README index 1c6fcce..aaf8bbd 100644 --- a/bsb/README +++ b/bsb/README @@ -28,3 +28,7 @@ RXD3 - BSB | PB11 PA8 | | GND PB13 | | GND PB12 | +--------------------+ + +The green LED flashes when we receive a packet. +The yellow LED shines when a transmit is in progress (including waiting +for idle bus and for the reply). diff --git a/bsb/firmware/interface.h b/bsb/firmware/interface.h index c2abf05..3f8b42b 100644 --- a/bsb/firmware/interface.h +++ b/bsb/firmware/interface.h @@ -77,15 +77,6 @@ struct bsb_stats { * 16-bit CRC */ -enum bsb_address { - BSB_ADDR_BOILER = 0, - BSB_ADDR_EXT_BOARD = 3, - BSB_ADDR_ROOM1 = 6, - BSB_ADDR_ROOM2 = 7, - BSB_ADDR_GATEWAY = 0x42, - BSB_ADDR_BROADCAST = 0x7f, -}; - // Positions of fields in a frame enum bsb_frame { BF_SOF, @@ -95,6 +86,15 @@ enum bsb_frame { BF_OP, }; +enum bsb_address { + BSB_ADDR_BOILER = 0, + BSB_ADDR_EXT_BOARD = 3, + BSB_ADDR_ROOM1 = 6, + BSB_ADDR_ROOM2 = 7, + BSB_ADDR_GATEWAY = 0x42, // That's us + BSB_ADDR_BROADCAST = 0x7f, +}; + enum bsb_op { BSB_OP_REQUEST_INFO = 1, BSB_OP_INFO = 2, diff --git a/bsb/firmware/main.c b/bsb/firmware/main.c index 84fce54..bb0c48e 100644 --- a/bsb/firmware/main.c +++ b/bsb/firmware/main.c @@ -432,7 +432,7 @@ static void bsb_send(byte *buf, uint len) static void bsb_check_reply(void) { // Match received frame in bsb_rx_status_and_frame to expected replies - // and set the status byte in byte 0. + // and set the status in byte 0. byte *frame = bsb_rx_status_and_frame + 1; // XXX: This might be executed too fast, so we can still be in TX_STATE_SENT -- 2.39.2