Basic MAC data interface for LoRa transceiver
Dependents: LoRaBaseStation LoRaTerminal
Diff: AlohaTransceiver.cpp
- Revision:
- 6:f545f5aa7de3
- Parent:
- 5:c3741633dc6f
- Child:
- 7:bc08d51535b6
--- a/AlohaTransceiver.cpp Fri Jul 15 02:01:57 2016 +0000 +++ b/AlohaTransceiver.cpp Sun Jul 17 04:52:29 2016 +0000 @@ -85,7 +85,7 @@ } -void AlohaTransceiver::BoardInit() +void AlohaTransceiver::boardInit() { // configure callback functions RadioEvents.TxDone = OnTxDone; @@ -102,19 +102,11 @@ wait( 1 ); } printf("RadioRegVersion: %d\r\n", Radio.Read( REG_VERSION )); - - // select operating channel - Radio.SetChannel( RF_FREQUENCY ); - - // configure radio tx and rx properties - updateSettings(); - - // entering passive receiver mode by default - Radio.Rx( RX_TIMEOUT_VALUE ); } void AlohaTransceiver::updateSettings() { + Radio.SetChannel( RF_FREQUENCY ); #if USE_MODEM_LORA == 1 Radio.SetTxConfig( MODEM_LORA, Settings.Power, 0, Settings.Bandwidth, @@ -136,6 +128,12 @@ #endif } +void AlohaTransceiver::enable() +{ + // entering passive receiver mode + Radio.Rx( RX_TIMEOUT_VALUE ); +} + void AlohaTransceiver::poll() { switch( State ) @@ -198,6 +196,11 @@ Radio.Rx( RX_TIMEOUT_VALUE ); } +void AlohaTransceiver::reset() +{ + Radio.Reset(); +} + void AlohaTransceiver::registerType(AlohaFrame::AlohaType_t type, aloha_callback_func f) { AlohaTypeCallbackTable[type] = f;