Skip to content

Commit

Permalink
Set MICROBIT_RADIO_MAX_PACKET_SIZE as a configurable value.
Browse files Browse the repository at this point in the history
  • Loading branch information
microbit-carlos committed Oct 30, 2023
1 parent 1370026 commit 52ebb80
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
9 changes: 8 additions & 1 deletion inc/MicroBitConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
7 changes: 7 additions & 0 deletions inc/MicroBitRadio.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 52ebb80

Please sign in to comment.