Driver for the SX1272 RF Transceiver
Dependents: LORA-SX1272MB2xAS-PP mDot_Semtech_LoRaWAN_Stack LoRaWAN-demo-72_mdotIKS01A1 lora-project ... more
Diff: sx1272/sx1272-hal.cpp
- Revision:
- 1:b0372ef620d0
- Parent:
- 0:45c4f0364ca4
- Child:
- 2:cd1093b6676f
--- a/sx1272/sx1272-hal.cpp Tue Jan 05 16:43:48 2016 +0000 +++ b/sx1272/sx1272-hal.cpp Tue Jan 26 22:04:33 2016 +0000 @@ -21,6 +21,8 @@ PinName dio0, PinName dio1, PinName dio2, PinName dio3, PinName dio4, PinName dio5, #if defined ( TARGET_MOTE_L152RC ) PinName rfSwitchCntr1, PinName rfSwitchCntr2 ) +#elif defined ( TARGET_MTS_MDOT_F411RE ) + PinName txctl, PinName rxctl ) #else PinName antSwitch ) #endif @@ -28,11 +30,14 @@ #if defined ( TARGET_MOTE_L152RC ) RfSwitchCntr1( rfSwitchCntr1 ), RfSwitchCntr2( rfSwitchCntr2 ), - PwrAmpCntr( PD_2 ) + PwrAmpCntr( PD_2 ) +#elif defined ( TARGET_MTS_MDOT_F411RE ) + TxCtl ( txctl ), + RxCtl ( rxctl ) #else AntSwitch( antSwitch ), #if( defined ( TARGET_NUCLEO_L152RE ) ) - Fake( D8 ) + Fake( D8 ) #else Fake( A3 ) #endif @@ -65,6 +70,10 @@ RfSwitchCntr1( PC_4 ), RfSwitchCntr2( PC_13 ), PwrAmpCntr( PD_2 ) + #elif defined ( TARGET_MTS_MDOT_F411RE ) + : SX1272( events, LORA_MOSI, LORA_MISO, LORA_SCK, LORA_NSS, LORA_RESET, LORA_DIO0, LORA_DIO1, LORA_DIO2, LORA_DIO3, LORA_DIO4, LORA_DIO5 ), + TxCtl( LORA_TXCTL ), + RxCtl( LORA_RXCTL ) #else : SX1272( events, D11, D12, D13, D10, A0, D2, D3, D4, D5, D8, D9 ), AntSwitch( A4 ), @@ -100,6 +109,8 @@ { #if defined ( TARGET_MOTE_L152RC ) boardConnected = NA_MOTE_72; +#elif defined ( TARGET_MTS_MDOT_F411RE ) + boardConnected = MDOT_F411RE; #else this->AntSwitch.input( ); wait_ms( 1 ); @@ -139,7 +150,7 @@ nss = 1; spi.format( 8,0 ); uint32_t frequencyToSet = 8000000; - #if( defined ( TARGET_NUCLEO_L152RE ) || defined ( TARGET_MOTE_L152RC ) || defined ( TARGET_LPC11U6X ) ) + #if( defined ( TARGET_NUCLEO_L152RE ) || defined ( TARGET_MOTE_L152RC ) || defined ( TARGET_LPC11U6X ) || defined ( TARGET_MTS_MDOT_F411RE ) ) spi.frequency( frequencyToSet ); #elif( defined ( TARGET_KL25Z ) ) //busclock frequency is halved -> double the spi frequency to compensate spi.frequency( frequencyToSet * 2 ); @@ -172,7 +183,7 @@ uint8_t SX1272MB1DxS::GetPaSelect( uint32_t channel ) { - if( boardConnected == SX1272MB1DCS ) + if( boardConnected == SX1272MB1DCS || boardConnected == MDOT_F411RE ) { return RF_PACONFIG_PASELECT_PABOOST; } @@ -205,6 +216,9 @@ this->RfSwitchCntr1 = 0; this->RfSwitchCntr2 = 0; this->PwrAmpCntr = 0; +#elif defined ( TARGET_MTS_MDOT_F411RE ) + this->TxCtl = 0; + this->RxCtl = 0; #else this->AntSwitch = 0; #endif @@ -216,6 +230,9 @@ this->RfSwitchCntr1 = 0; this->RfSwitchCntr2 = 0; this->PwrAmpCntr = 0; +#elif defined ( TARGET_MTS_MDOT_F411RE ) + this->TxCtl = 0; + this->RxCtl = 0; #else this->AntSwitch = 0; #endif @@ -250,6 +267,27 @@ this->PwrAmpCntr = 0; break; } +#elif defined ( TARGET_MTS_MDOT_F411RE ) + if( this->rxTx == rxTx ) + { + //no need to go further + return; + } + + /* SKY13350 */ + this->rxTx = rxTx; + + // 1: Tx, 0: Rx + if( rxTx != 0 ) + { + this->TxCtl = 1; + this->RxCtl = 0; + } + else + { + this->TxCtl = 0; + this->RxCtl = 1; + } #else if( this->rxTx == rxTx ) {