Fork with intent to refactor and add support for American 902-928(915) Frequency Bands
Diff: sx1276/sx1276-mbed-hal.h
- Revision:
- 38:d9189d958db8
- Parent:
- 36:f2b885b6f33e
- Child:
- 39:706c32eda7e7
--- a/sx1276/sx1276-mbed-hal.h Sat May 06 12:12:29 2017 +0000 +++ b/sx1276/sx1276-mbed-hal.h Sun May 07 18:09:10 2017 +0200 @@ -14,7 +14,7 @@ */ /* - * additional development to make it more generic across multiple os versions + * additional development to make it more generic across multiple OS versions * (c) 2017 Helmut Tschemernjak * 30826 Garbsen (Hannover) Germany */ @@ -23,32 +23,15 @@ #define __SX1276_HAL_H__ #include "sx1276.h" + /*! - * @brief Radio hardware registers initialization definition - * - * @remark Can be automatically generated by the SX1276 GUI (not yet implemented) + * triggers definition */ -#define RADIO_INIT_REGISTERS_VALUE \ -{ \ - { MODEM_FSK , REG_LNA , 0x23 },\ - { MODEM_FSK , REG_RXCONFIG , 0x1E },\ - { MODEM_FSK , REG_RSSICONFIG , 0xD2 },\ - { MODEM_FSK , REG_AFCFEI , 0x01 },\ - { MODEM_FSK , REG_PREAMBLEDETECT , 0xAA },\ - { MODEM_FSK , REG_OSC , 0x07 },\ - { MODEM_FSK , REG_SYNCCONFIG , 0x12 },\ - { MODEM_FSK , REG_SYNCVALUE1 , 0xC1 },\ - { MODEM_FSK , REG_SYNCVALUE2 , 0x94 },\ - { MODEM_FSK , REG_SYNCVALUE3 , 0xC1 },\ - { MODEM_FSK , REG_PACKETCONFIG1 , 0xD8 },\ - { MODEM_FSK , REG_FIFOTHRESH , 0x8F },\ - { MODEM_FSK , REG_IMAGECAL , 0x02 },\ - { MODEM_FSK , REG_DIOMAPPING1 , 0x00 },\ - { MODEM_FSK , REG_DIOMAPPING2 , 0x30 },\ - { MODEM_LORA, REG_LR_PAYLOADMAXLENGTH, 0x40 },\ -} \ +typedef void ( SX1276::*Trigger )( void ); +typedef void ( SX1276Generic::*TriggerMB1xAS )( void ); -/*! + +/*! * Actual implementation of a SX1276 radio, includes some modifications to make it compatible with the MB1 LAS board */ class SX1276Generic : public SX1276 @@ -87,8 +70,10 @@ InterruptIn *_dio4; DigitalIn *_dio5; + Timeout txTimeoutTimer; + + private: - static const RadioRegisters_t RadioRegsInit[]; public: SX1276Generic( RadioEvents_t *events, BoardType_t board, @@ -108,11 +93,6 @@ virtual void IoInit( void ); /*! - * @brief Initializes the radio registers - */ - virtual void RadioRegistersInit( ); - - /*! * @brief Initializes the radio SPI */ virtual void SpiInit( void ); @@ -173,8 +153,14 @@ * @param [IN] opMode Current radio operating mode */ virtual void SetAntSw( uint8_t opMode ); + + /* + * The the Timeout for a given Timer. + */ + virtual void SetTimeout(Timeout_t timer, int timeout_ms); public: + /*! * @brief Detect the board connected by reading the value of the antenna switch pin */