Add defines for radio upper/lower freq

This commit is contained in:
Sam Kent 2018-09-24 18:26:48 +01:00
parent 54a99d6361
commit 7aedfab59a
3 changed files with 20 additions and 2 deletions

View file

@ -311,6 +311,25 @@ extern uint32_t __etext;
#define MICROBIT_BLE_PARTIAL_FLASHING 0
#endif
//
// Radio options
//
// Sets the default radio channel
#ifndef MICROBIT_RADIO_DEFAULT_FREQUENCY
#define MICROBIT_RADIO_DEFAULT_FREQUENCY 7
#endif
// Sets the minimum frequency band permissable for the device
#ifndef MICROBIT_RADIO_LOWER_FREQ_BAND
#define MICROBIT_RADIO_LOWER_FREQ_BAND 0
#endif
// Sets the maximum frequency band permissable for the device
#ifndef MICROBIT_RADIO_UPPER_FREQ_BAND
#define MICROBIT_RADIO_UPPER_FREQ_BAND 83
#endif
//
// Accelerometer options
//

View file

@ -65,7 +65,6 @@ struct FrameBuffer;
#define MICROBIT_RADIO_BASE_ADDRESS 0x75626974
#define MICROBIT_RADIO_DEFAULT_GROUP 0
#define MICROBIT_RADIO_DEFAULT_TX_POWER 6
#define MICROBIT_RADIO_DEFAULT_FREQUENCY 7
#define MICROBIT_RADIO_MAX_PACKET_SIZE 32
#define MICROBIT_RADIO_HEADER_SIZE 4
#define MICROBIT_RADIO_MAXIMUM_RX_BUFFERS 4

View file

@ -146,7 +146,7 @@ int MicroBitRadio::setFrequencyBand(int band)
if (ble_running())
return MICROBIT_NOT_SUPPORTED;
if (band < 0 || band > 83)
if (band < MICROBIT_RADIO_LOWER_FREQ_BAND || band > MICROBIT_RADIO_UPPER_FREQ_BAND)
return MICROBIT_INVALID_PARAMETER;
// We need to disable the radio before setting the frequency