ST-DEVKIT-LRWAN
Dependents: DISCO-L072CZ-LRWAN1-base
Fork of SX1276GenericLib by
Diff: sx1276/sx1276-hal.cpp
- Revision:
- 21:2e496deb7858
- Parent:
- 20:e05596ba4166
- Child:
- 22:7f3aab69cca9
--- a/sx1276/sx1276-hal.cpp Tue Oct 20 12:58:58 2015 +0000 +++ b/sx1276/sx1276-hal.cpp Thu Nov 26 10:39:03 2015 +0000 @@ -33,12 +33,11 @@ { MODEM_LORA, REG_LR_PAYLOADMAXLENGTH, 0x40 }, }; -SX1276MB1xAS::SX1276MB1xAS( void ( *txDone )( ), void ( *txTimeout ) ( ), void ( *rxDone ) ( uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr ), - void ( *rxTimeout ) ( ), void ( *rxError ) ( ), void ( *fhssChangeChannel ) ( uint8_t channelIndex ), void ( *cadDone ) ( bool ChannelActivityDetected ), +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, PinName antSwitch ) - : SX1276( txDone, txTimeout, rxDone, rxTimeout, rxError, fhssChangeChannel, cadDone, mosi, miso, sclk, nss, reset, dio0, dio1, dio2, dio3, dio4, dio5), + : SX1276( events, mosi, miso, sclk, nss, reset, dio0, dio1, dio2, dio3, dio4, dio5 ), antSwitch( antSwitch ), #if( defined ( TARGET_NUCLEO_L152RE ) ) fake( D8 ) @@ -46,6 +45,8 @@ fake( A3 ) #endif { + this->RadioEvents = events; + Reset( ); RxChainCalibration( ); @@ -60,25 +61,26 @@ SetModem( MODEM_FSK ); - this->settings.State = IDLE ; + this->settings.State = RF_IDLE ; } -SX1276MB1xAS::SX1276MB1xAS( void ( *txDone )( ), void ( *txTimeout ) ( ), void ( *rxDone ) ( uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr ), - void ( *rxTimeout ) ( ), void ( *rxError ) ( ), void ( *fhssChangeChannel ) ( uint8_t channelIndex ), void ( *cadDone ) ( bool ChannelActivityDetected ) ) +SX1276MB1xAS::SX1276MB1xAS( RadioEvents_t *events ) #if defined ( TARGET_NUCLEO_L152RE ) - : SX1276( txDone, txTimeout, rxDone, rxTimeout, rxError, fhssChangeChannel, cadDone, D11, D12, D13, D10, A0, D2, D3, D4, D5, A3, D9 ), // For NUCLEO L152RE dio4 is on port A3 + : SX1276( events, D11, D12, D13, D10, A0, D2, D3, D4, D5, A3, D9 ), // For NUCLEO L152RE dio4 is on port A3 antSwitch( A4 ), fake( D8 ) #elif defined( TARGET_LPC11U6X ) - : SX1276( txDone, txTimeout, rxDone, rxTimeout, rxError, fhssChangeChannel, cadDone, D11, D12, D13, D10, A0, D2, D3, D4, D5, D8, D9 ), + : SX1276( events, D11, D12, D13, D10, A0, D2, D3, D4, D5, D8, D9 ), antSwitch( P0_23 ), fake( A3 ) #else - : SX1276( txDone, txTimeout, rxDone, rxTimeout, rxError, fhssChangeChannel, cadDone, D11, D12, D13, D10, A0, D2, D3, D4, D5, D8, D9 ), + : SX1276( events, D11, D12, D13, D10, A0, D2, D3, D4, D5, D8, D9 ), antSwitch( A4 ), fake( A3 ) #endif { + this->RadioEvents = events; + Reset( ); boardConnected = UNKNOWN; @@ -96,7 +98,7 @@ SetModem( MODEM_FSK ); - this->settings.State = IDLE ; + this->settings.State = RF_IDLE ; } //-------------------------------------------------------------------------