Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/codal_port/drv_radio.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ void microbit_radio_enable(microbit_radio_config_t *config) {
while (NRF_CLOCK->EVENTS_HFCLKSTARTED == 0) {
}

// power should be one of: -30, -20, -16, -12, -8, -4, 0, 4
// power should be one of: -30, -20, -16, -12, -8, -4, 0, 4, 8
NRF_RADIO->TXPOWER = config->power_dbm;

// should be between 0 and 100 inclusive (actual physical freq is 2400MHz + this register)
Expand Down
2 changes: 1 addition & 1 deletion src/codal_port/drv_radio.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ typedef struct _microbit_radio_config_t {
uint8_t max_payload; // 1-251 inclusive
uint8_t queue_len; // 1-254 inclusive
uint8_t channel; // 0-100 inclusive
int8_t power_dbm; // one of: -30, -20, -16, -12, -8, -4, 0, 4
int8_t power_dbm; // one of: -30, -20, -16, -12, -8, -4, 0, 4, 8
uint32_t base0; // for BASE0 register
uint8_t prefix0; // for PREFIX0 register (lower 8 bits only)
uint8_t data_rate; // one of: RADIO_MODE_MODE_Nrf_{250Kbit,1Mbit,2Mbit}
Expand Down
4 changes: 2 additions & 2 deletions src/codal_port/modradio.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ STATIC mp_obj_t mod_radio_config(size_t n_args, const mp_obj_t *pos_args, mp_map
break;

case MP_QSTR_power: {
if (!(0 <= value && value <= 7)) {
if (!(0 <= value && value <= 8)) {
goto value_error;
}
static int8_t power_dbm_table[8] = {-30, -20, -16, -12, -8, -4, 0, 4};
static int8_t power_dbm_table[9] = {-30, -20, -16, -12, -8, -4, 0, 4, 8};
new_config.power_dbm = power_dbm_table[value];
break;
}
Expand Down