diff --git a/inc/MicroBitConfig.h b/inc/MicroBitConfig.h index 95f4ac45..1ad177f7 100644 --- a/inc/MicroBitConfig.h +++ b/inc/MicroBitConfig.h @@ -273,7 +273,14 @@ // Set to '1' to enable #ifndef MICROBIT_BLE_NORDIC_STYLE_UART #define MICROBIT_BLE_NORDIC_STYLE_UART 0 -#endif +#endif + +// Configure the radio maximum packet size +// TODO: Update the range here once issue codal-microbit-v2#383 has been resolved +// https://github.com/lancaster-university/codal-microbit-v2/issues/383 +#ifndef MICROBIT_RADIO_MAX_PACKET_SIZE + #define MICROBIT_RADIO_MAX_PACKET_SIZE 32 +#endif // Versioning options. // We use semantic versioning (http://semver.org/) to identify differnet versions of the micro:bit runtime. diff --git a/inc/MicroBitRadio.h b/inc/MicroBitRadio.h index 9244b7f9..5e7a30a2 100644 --- a/inc/MicroBitRadio.h +++ b/inc/MicroBitRadio.h @@ -76,6 +76,13 @@ namespace codal #define MICROBIT_RADIO_MAXIMUM_RX_BUFFERS 4 #define MICROBIT_RADIO_POWER_LEVELS 8 +// Max packet size is configurable, so ensure maximum value is not exceeded +// TODO: Update this value once issue codal-microbit-v2#383 is resolved +// https://github.com/lancaster-university/codal-microbit-v2/issues/383 +#if MICROBIT_RADIO_MAX_PACKET_SIZE > 250 + #error "MICROBIT_RADIO_MAX_PACKET_SIZE cannot be larger than 250 bytes" +#endif + // Known Protocol Numbers #define MICROBIT_RADIO_PROTOCOL_DATAGRAM 1 // A simple, single frame datagram. a little like UDP but with smaller packets. :-) #define MICROBIT_RADIO_PROTOCOL_EVENTBUS 2 // Transparent propogation of events from one micro:bit to another.