diff --git a/conf/settings/superbitrf.xml b/conf/settings/superbitrf.xml index 0d172ebc8d..1b49501b34 100644 --- a/conf/settings/superbitrf.xml +++ b/conf/settings/superbitrf.xml @@ -3,8 +3,10 @@ - + + + diff --git a/sw/airborne/subsystems/datalink/superbitrf.c b/sw/airborne/subsystems/datalink/superbitrf.c index d3d18ec976..dcc700b2a5 100644 --- a/sw/airborne/subsystems/datalink/superbitrf.c +++ b/sw/airborne/subsystems/datalink/superbitrf.c @@ -240,6 +240,11 @@ void superbitrf_set_mfg_id(uint32_t id) { superbitrf.data_col = 7 - superbitrf.sop_col; } +void superbitrf_set_protocol(uint8_t protocol) { + superbitrf.protocol = protocol; + superbitrf.resolution = (superbitrf.protocol & 0x10)>>4; +} + /** * The superbitrf on event call */ @@ -405,8 +410,7 @@ void superbitrf_event(void) { #endif #ifdef RADIO_TRANSMITTER_PROTOCOL PRINT_CONFIG_VAR(RADIO_TRANSMITTER_PROTOCOL); - superbitrf.protocol = RADIO_TRANSMITTER_PROTOCOL; - superbitrf.resolution = (superbitrf.protocol & 0x10)>>4; + superbitrf_set_protocol(RADIO_TRANSMITTER_PROTOCOL); #endif // Start transfer @@ -724,8 +728,7 @@ static inline void superbitrf_receive_packet_cb(bool_t error, uint8_t status, ui superbitrf_set_mfg_id(mfg_id); superbitrf.num_channels = packet[11]; - superbitrf.protocol = packet[12]; - superbitrf.resolution = (superbitrf.protocol & 0x10)>>4; + superbitrf_set_protocol(packet[12]); // Update the status of the receiver superbitrf.state = 0; diff --git a/sw/airborne/subsystems/datalink/superbitrf.h b/sw/airborne/subsystems/datalink/superbitrf.h index af2d0af42f..1a4dfa524b 100644 --- a/sw/airborne/subsystems/datalink/superbitrf.h +++ b/sw/airborne/subsystems/datalink/superbitrf.h @@ -117,6 +117,7 @@ extern struct SuperbitRF superbitrf; void superbitrf_init(void); void superbitrf_event(void); void superbitrf_set_mfg_id(uint32_t id); +void superbitrf_set_protocol(uint8_t protocol); /* The datalink defines */ #define SuperbitRFInit() { }//superbitrf_init(); }