Remaining style fixes

pull/7191/head
Hasnain Virk 2018-06-12 15:11:09 +03:00
parent 27290bb12f
commit d335f82440
4 changed files with 172 additions and 172 deletions

View File

@ -1362,8 +1362,10 @@ void LoRaWANStack::compliance_test_handler(loramac_mcps_indication_t *mcps_indic
} else if (mcps_indication->buffer_size == 7) { } else if (mcps_indication->buffer_size == 7) {
loramac_mlme_req_t mlme_req; loramac_mlme_req_t mlme_req;
mlme_req.type = MLME_TXCW_1; mlme_req.type = MLME_TXCW_1;
mlme_req.cw_tx_mode.timeout = (uint16_t)((mcps_indication->buffer[1] << 8) | mcps_indication->buffer[2]); mlme_req.cw_tx_mode.timeout = (uint16_t)((mcps_indication->buffer[1] << 8)
mlme_req.cw_tx_mode.frequency = (uint32_t)((mcps_indication->buffer[3] << 16) | (mcps_indication->buffer[4] << 8) | mcps_indication->buffer[2]);
mlme_req.cw_tx_mode.frequency = (uint32_t)((mcps_indication->buffer[3] << 16)
| (mcps_indication->buffer[4] << 8)
| mcps_indication->buffer[5]) * 100; | mcps_indication->buffer[5]) * 100;
mlme_req.cw_tx_mode.power = mcps_indication->buffer[6]; mlme_req.cw_tx_mode.power = mcps_indication->buffer[6];
_loramac.mlme_request(&mlme_req); _loramac.mlme_request(&mlme_req);

View File

@ -800,8 +800,8 @@ lorawan_status_t LoRaMac::send_join_request()
loramac_mhdr_t mac_hdr; loramac_mhdr_t mac_hdr;
loramac_frame_ctrl_t fctrl; loramac_frame_ctrl_t fctrl;
_params.sys_params.channel_data_rate = _lora_phy.get_alternate_DR( _params.sys_params.channel_data_rate =
_params.join_request_trial_counter + 1); _lora_phy.get_alternate_DR(_params.join_request_trial_counter + 1);
mac_hdr.value = 0; mac_hdr.value = 0;
mac_hdr.bits.mtype = FRAME_TYPE_JOIN_REQ; mac_hdr.bits.mtype = FRAME_TYPE_JOIN_REQ;
@ -1551,8 +1551,7 @@ lorawan_status_t LoRaMac::prepare_frame(loramac_mhdr_t *machdr,
// Update FCtrl field with new value of OptionsLength // Update FCtrl field with new value of OptionsLength
_params.tx_buffer[0x05] = fctrl->value; _params.tx_buffer[0x05] = fctrl->value;
const uint8_t *buffer = const uint8_t *buffer = _mac_commands.get_mac_commands_buffer();
_mac_commands.get_mac_commands_buffer();
for (i = 0; i < mac_commands_len; i++) { for (i = 0; i < mac_commands_len; i++) {
_params.tx_buffer[pkt_header_len++] = buffer[i]; _params.tx_buffer[pkt_header_len++] = buffer[i];
} }
@ -2030,8 +2029,7 @@ void LoRaMac::LoRaMacTestSetMic( uint16_t txPacketCounter )
void LoRaMac::LoRaMacTestSetDutyCycleOn(bool enable) void LoRaMac::LoRaMacTestSetDutyCycleOn(bool enable)
{ {
if(_lora_phy.verify_duty_cycle(enable) == true) if (_lora_phy.verify_duty_cycle(enable) == true) {
{
_params.is_dutycycle_on = enable; _params.is_dutycycle_on = enable;
} }
} }

View File

@ -47,15 +47,18 @@ LoRaPHY::~LoRaPHY()
_radio = NULL; _radio = NULL;
} }
bool LoRaPHY::mask_bit_test(const uint16_t *mask, unsigned bit) { bool LoRaPHY::mask_bit_test(const uint16_t *mask, unsigned bit)
{
return mask[bit / 16] & (1U << (bit % 16)); return mask[bit / 16] & (1U << (bit % 16));
} }
void LoRaPHY::mask_bit_set(uint16_t *mask, unsigned bit) { void LoRaPHY::mask_bit_set(uint16_t *mask, unsigned bit)
{
mask[bit / 16] |= (1U << (bit % 16)); mask[bit / 16] |= (1U << (bit % 16));
} }
void LoRaPHY::mask_bit_clear(uint16_t *mask, unsigned bit) { void LoRaPHY::mask_bit_clear(uint16_t *mask, unsigned bit)
{
mask[bit / 16] &= ~(1U << (bit % 16)); mask[bit / 16] &= ~(1U << (bit % 16));
} }
@ -64,13 +67,15 @@ void LoRaPHY::set_radio_instance(LoRaRadio& radio)
_radio = &radio; _radio = &radio;
} }
void LoRaPHY::put_radio_to_sleep() { void LoRaPHY::put_radio_to_sleep()
{
_radio->lock(); _radio->lock();
_radio->sleep(); _radio->sleep();
_radio->unlock(); _radio->unlock();
} }
void LoRaPHY::put_radio_to_standby() { void LoRaPHY::put_radio_to_standby()
{
_radio->lock(); _radio->lock();
_radio->standby(); _radio->standby();
_radio->unlock(); _radio->unlock();
@ -129,27 +134,22 @@ uint8_t LoRaPHY::request_new_channel(int8_t channel_id, channel_params_t* new_ch
} else { } else {
new_channel->band = lookup_band_for_frequency(new_channel->frequency); new_channel->band = lookup_band_for_frequency(new_channel->frequency);
switch (add_channel(new_channel, channel_id)) { switch (add_channel(new_channel, channel_id)) {
case LORAWAN_STATUS_OK: case LORAWAN_STATUS_OK: {
{
break; break;
} }
case LORAWAN_STATUS_FREQUENCY_INVALID: case LORAWAN_STATUS_FREQUENCY_INVALID: {
{
status &= 0xFE; status &= 0xFE;
break; break;
} }
case LORAWAN_STATUS_DATARATE_INVALID: case LORAWAN_STATUS_DATARATE_INVALID: {
{
status &= 0xFD; status &= 0xFD;
break; break;
} }
case LORAWAN_STATUS_FREQ_AND_DR_INVALID: case LORAWAN_STATUS_FREQ_AND_DR_INVALID: {
{
status &= 0xFC; status &= 0xFC;
break; break;
} }
default: default: {
{
status &= 0xFC; status &= 0xFC;
break; break;
} }
@ -307,7 +307,8 @@ lorawan_time_t LoRaPHY::update_band_timeoff(bool joined, bool duty_cycle,
return next_tx_delay; return next_tx_delay;
} }
uint8_t LoRaPHY::parse_link_ADR_req(const uint8_t* payload, link_adr_params_t* params) uint8_t LoRaPHY::parse_link_ADR_req(const uint8_t *payload,
link_adr_params_t *params)
{ {
uint8_t ret_index = 0; uint8_t ret_index = 0;
@ -700,8 +701,8 @@ void LoRaPHY::apply_cf_list(const uint8_t* payload, uint8_t size)
channel_params_t new_channel; channel_params_t new_channel;
// Setup default datarate range // Setup default datarate range
new_channel.dr_range.value = (phy_params.default_max_datarate << 4) new_channel.dr_range.value = (phy_params.default_max_datarate << 4) |
| phy_params.default_datarate; phy_params.default_datarate;
// Size of the optional CF list // Size of the optional CF list
if (size != 16) { if (size != 16) {
@ -960,8 +961,7 @@ uint8_t LoRaPHY::link_ADR_request(adr_req_params_t* link_adr_req,
} }
// channel mask applies to first 16 channels // channel mask applies to first 16 channels
if (adr_settings.ch_mask_ctrl == 0 || if (adr_settings.ch_mask_ctrl == 0 || adr_settings.ch_mask_ctrl == 6) {
adr_settings.ch_mask_ctrl == 6) {
for (uint8_t i = 0; i < phy_params.max_channel_cnt; i++) { for (uint8_t i = 0; i < phy_params.max_channel_cnt; i++) {
@ -1198,8 +1198,7 @@ void LoRaPHY::calculate_backoff(bool joined, bool last_tx_was_join_req, bool dc_
// No back-off if the last frame was not a join request and when the // No back-off if the last frame was not a join request and when the
// duty cycle is not enabled // duty cycle is not enabled
if (dc_enabled == false && if (dc_enabled == false && last_tx_was_join_req == false) {
last_tx_was_join_req == false) {
band_table[band_idx].off_time = 0; band_table[band_idx].off_time = 0;
} else { } else {
// Apply band time-off. // Apply band time-off.
@ -1251,8 +1250,8 @@ lorawan_status_t LoRaPHY::set_next_channel(channel_selection_params_t* params,
enabled_channels, &delay_tx); enabled_channels, &delay_tx);
} else { } else {
delay_tx++; delay_tx++;
next_tx_delay = params->aggregate_timeoff next_tx_delay = params->aggregate_timeoff -
- _lora_time.get_elapsed_time(params->last_aggregate_tx_time); _lora_time.get_elapsed_time(params->last_aggregate_tx_time);
} }
if (channel_count > 0) { if (channel_count > 0) {
@ -1276,7 +1275,8 @@ lorawan_status_t LoRaPHY::set_next_channel(channel_selection_params_t* params,
return LORAWAN_STATUS_NO_CHANNEL_FOUND; return LORAWAN_STATUS_NO_CHANNEL_FOUND;
} }
lorawan_status_t LoRaPHY::add_channel(const channel_params_t* new_channel, uint8_t id) lorawan_status_t LoRaPHY::add_channel(const channel_params_t *new_channel,
uint8_t id)
{ {
bool dr_invalid = false; bool dr_invalid = false;
bool freq_invalid = false; bool freq_invalid = false;