test
Dependents: Telemetria_RX_SD_GPS_copy Telemetria_RX_SD_GPS Telemetria_TX Telemetria_TX ... more
Diff: sx1276/sx1276-hal.cpp
- Revision:
- 26:87796ee62589
- Parent:
- 25:3778e6204cc1
- Child:
- 28:6d83af9f8563
diff -r 3778e6204cc1 -r 87796ee62589 sx1276/sx1276-hal.cpp --- a/sx1276/sx1276-hal.cpp Fri May 13 15:09:10 2016 +0000 +++ b/sx1276/sx1276-hal.cpp Fri Mar 24 15:06:46 2017 +0000 @@ -19,14 +19,22 @@ SX1276MB1xAS::SX1276MB1xAS( RadioEvents_t *events, PinName mosi, PinName miso, PinName sclk, PinName nss, PinName reset, PinName dio0, PinName dio1, PinName dio2, PinName dio3, PinName dio4, PinName dio5, +#ifdef MURTA_ANT_SWITCH + PinName antSwitch, PinName antSwitchTX, PinName antSwitchTXBoost ) +#else PinName antSwitch ) +#endif : SX1276( events, mosi, miso, sclk, nss, reset, dio0, dio1, dio2, dio3, dio4, dio5 ), +#ifdef MURTA_ANT_SWITCH + antSwitch(antSwitch), antSwitchTX(antSwitchTX), antSwitchTXBoost(antSwitchTXBoost), +#else antSwitch( antSwitch ), - #if( defined ( TARGET_NUCLEO_L152RE ) ) +#endif +#if( defined ( TARGET_NUCLEO_L152RE ) ) fake( D8 ) - #else +#else fake( A3 ) - #endif +#endif { this->RadioEvents = events; @@ -58,7 +66,11 @@ fake( A3 ) #else : SX1276( events, D11, D12, D13, D10, A0, D2, D3, D4, D5, D8, D9 ), +#ifdef MURTA_ANT_SWITCH + antSwitch(A4), antSwitchTX(NC), antSwitchTXBoost(NC), +#else antSwitch( A4 ), +#endif fake( A3 ) #endif { @@ -128,7 +140,7 @@ nss = 1; spi.format( 8,0 ); uint32_t frequencyToSet = 8000000; - #if( defined ( TARGET_NUCLEO_L152RE ) || defined ( TARGET_LPC11U6X ) ) + #if( defined ( TARGET_NUCLEO_L152RE ) || defined ( TARGET_LPC11U6X ) || defined(TARGET_STM) ) spi.frequency( frequencyToSet ); #elif( defined ( TARGET_KL25Z ) ) //busclock frequency is halved -> double the spi frequency to compensate spi.frequency( frequencyToSet * 2 ); @@ -198,11 +210,19 @@ void SX1276MB1xAS::AntSwInit( void ) { antSwitch = 0; +#ifdef MURTA_ANT_SWITCH + antSwitchTX = 0; + antSwitchTXBoost = 0; +#endif } void SX1276MB1xAS::AntSwDeInit( void ) { antSwitch = 0; +#ifdef MURTA_ANT_SWITCH + antSwitchTX = 0; + antSwitchTXBoost = 0; +#endif } void SX1276MB1xAS::SetAntSw( uint8_t rxTx ) @@ -213,11 +233,20 @@ // 1: Tx, 0: Rx if( rxTx != 0 ) { +#ifdef MURTA_ANT_SWITCH + antSwitch = 0; // RX + antSwitchTX = 1; // alternate: antSwitchTXBoost = 1 +#else antSwitch = 1; - } - else - { +#endif + } else { +#ifdef MURTA_ANT_SWITCH + antSwitch = 1; // RX + antSwitchTX = 0; + antSwitchTXBoost = 0; +#else antSwitch = 0; +#endif } }