SX1276 library for modtronix inair9. Edited for use with NRF51DK board.

Dependents:   InAir9_PingPong

Fork of SX1276Lib_modtronix by modtronix H

enums/enums.h

Committer:
AMNoll
Date:
2017-11-19
Revision:
26:ad32782125eb
Parent:
25:72381be1b0ce

File content as of revision 26:ad32782125eb:

/*
 / _____)             _              | |
( (____  _____ ____ _| |_ _____  ____| |__
 \____ \| ___ |    (_   _) ___ |/ ___)  _ \
 _____) ) ____| | | || |_| ____( (___| | | |
(______/|_____)_|_|_| \__)_____)\____)_| |_|
    ( C )2014 Semtech

Description: -

License: Revised BSD License, see LICENSE.TXT file include in the project

Maintainers: Miguel Luis, Gregory Cristian and Nicolas Huguenin
*/
#ifndef __ENUMS_H__
#define __ENUMS_H__

/*!
 *    State of the radio:
 *    [IDLE,
 *     RX_RUNNING, RX_TIMEOUT, RX_ERROR,
 *     TX_RUNNING, TX_TIMEOUT,
       CAD]
 */
enum RadioState
{
    LOWPOWER = 0,
    IDLE,
    
    INIT,

    RX_DONE,
    RX_TIMEOUT,
    RX_ERROR,
    
    TX_DONE,
    TX_TIMEOUT,
    TX_MESSAGE,
    
    CAD,
    CAD_DONE
};

/*!
 *    Type of the modem. [LORA / FSK]
 */
enum ModemType
{
    MODEM_FSK = 0,
    MODEM_LORA
};

/*!
 *    Type of the supported board. [SX1276MB1MAS / SX1276MB1LAS]
 */
enum BoardType
{
    SX1276MB1MAS = 0,
    SX1276MB1LAS,
    UNKNOWN
};

/*!
 *    Type of the supported board. [BOARD_INAIR4 / BOARD_INAIR9]
 */
enum BoardTypeInAir
{
    BOARD_INAIR4 = 0,
    BOARD_INAIR9,
    BOARD_INAIR9B,
    BOARD_UNKNOWN
};
/*!
 * Radio FSK modem parameters
 */
typedef struct
{
    int8_t   Power;
    uint32_t Fdev;
    uint32_t Bandwidth;
    uint32_t BandwidthAfc;
    uint32_t Datarate;
    uint16_t PreambleLen;
    bool     FixLen;
    uint8_t  PayloadLen;
    bool     CrcOn;
    bool     IqInverted;
    bool     RxContinuous;
    uint32_t TxTimeout;
}RadioFskSettings_t;

/*!
 * Radio FSK packet handler state
 */
typedef struct
{
    uint8_t  PreambleDetected;
    uint8_t  SyncWordDetected;
    int8_t   RssiValue;
    int32_t  AfcValue;
    uint8_t  RxGain;
    uint16_t Size;
    uint16_t NbBytes;
    uint8_t  FifoThresh;
    uint8_t  ChunkSize;
}RadioFskPacketHandler_t;

/*!
 * Radio LoRa modem parameters
 */
typedef struct
{
    int8_t   Power;
    uint32_t Bandwidth;
    uint32_t Datarate;
    bool     LowDatarateOptimize;
    uint8_t  Coderate;
    uint16_t PreambleLen;
    bool     FixLen;
    uint8_t  PayloadLen;
    bool     CrcOn;
    bool     FreqHopOn;
    uint8_t  HopPeriod;
    bool     IqInverted;
    bool     RxContinuous;
    uint32_t TxTimeout;
}RadioLoRaSettings_t;

/*!
 * Radio LoRa packet handler state
 */
typedef struct
{
    int8_t SnrValue;
    int8_t RssiValue;
    uint8_t Size;
}RadioLoRaPacketHandler_t;

/*!
 * Radio Settings
 */
typedef struct
{
    RadioState               State;
    ModemType                Modem;
    uint32_t                 Channel;
    RadioFskSettings_t       Fsk;
    RadioFskPacketHandler_t  FskPacketHandler;
    RadioLoRaSettings_t      LoRa;
    RadioLoRaPacketHandler_t LoRaPacketHandler;
}RadioSettings_t;


#endif //__ENUMS_H__