/* * Ping_pong.h * * Created on: 2024年4月19日 * Author: tang */ #ifndef MY_TEXT_PING_PONG_H_ #define MY_TEXT_PING_PONG_H_ #include "../StdPeriphDriver/sx1280_divce/radio.h" #include "../StdPeriphDriver/sx1280_divce/sx1280.h" /*! * \brief Used to display firmware version UART flow */ #define FIRMWARE_VERSION ( ( char* )"Firmware Version: 5709de2d" ) /*! * Select mode of operation for the Ping Ping application //发送模式 */ //#define MODE_BLE #define MODE_LORA //#define MODE_GFSK //#define MODE_FLRC #define RF_BL_ADV_CHANNEL_38 2478000000 // Hz #define RF_BL_ADV_CHANNEL_0 2478000000 // Hz 4700000000 /*! 470000000 * \brief Defines the nominal frequency */ #define RF_FREQUENCY RF_BL_ADV_CHANNEL_0 // Hz /*! * \brief Defines the output power in dBm 输出 功率 * * \remark The range of the output power is [-18..+13] dBm */ #define TX_OUTPUT_POWER 13 /*! * \brief Defines the buffer size, i.e. the payload size 有效载荷大小 */ #define BUFFER_SIZE 20 /*! * \brief Number of tick size steps for tx timeout 发送超时时间 */ #define TX_TIMEOUT_VALUE 3000 // ms /*! * \brief Number of tick size steps for rx timeout 接收超时时间 */ #define RX_TIMEOUT_VALUE 3000 // ms /*! * \brief Size of ticks (used for Tx and Rx timeout) rx/tx超时 */ #define RX_TIMEOUT_TICK_SIZE RADIO_TICK_SIZE_1000_US /*! * \brief Defines the size of the token defining message type in the payload 定义有效负载中定义消息类型的指令的大小 */ #define PINGPONGSIZE 4 /* * \brief Defines the states of the application */ typedef enum { APP_LOWPOWER, APP_RX, APP_RX_TIMEOUT, APP_RX_ERROR, APP_TX, APP_TX_TIMEOUT, }AppStates_t; /*! * \brief Function to be executed on Radio Tx Done event */ void OnTxDone( void ); /*! * \brief Function to be executed on Radio Rx Done event */ void OnRxDone( void ); /*! * \brief Function executed on Radio Tx Timeout event */ void OnTxTimeout( void ); /*! * \brief Function executed on Radio Rx Timeout event */ void OnRxTimeout( void ); /*! * \brief Function executed on Radio Rx Error event */ void OnRxError( IrqErrorCode_t ); /*! * \brief Define the possible message type for this application */ const uint8_t PingMsg[] = "PING"; const uint8_t PongMsg[] = "PONG"; /*! * \brief All the callbacks are stored in a structure */ RadioCallbacks_t Callbacks = { &OnTxDone, // txDone &OnRxDone, // rxDone NULL, // syncWordDone NULL, // headerDone &OnTxTimeout, // txTimeout &OnRxTimeout, // rxTimeout &OnRxError, // rxError NULL, // rangingDone NULL, // cadDone }; /*! * \brief The size of the buffer */ uint8_t BufferSize = BUFFER_SIZE; /*! * \brief The buffer */ uint8_t Buffer[BUFFER_SIZE]; /*! * \brief Mask of IRQs to listen to in rx mode 在rx模式下要监听的IRQ掩码 */ uint16_t RxIrqMask = IRQ_RX_DONE | IRQ_RX_TX_TIMEOUT| IRQ_CRC_ERROR; ; /*! * \brief Mask of IRQs to listen to in tx mode */ uint16_t TxIrqMask = IRQ_TX_DONE | IRQ_RX_TX_TIMEOUT| IRQ_CRC_ERROR; ; /*! * \brief The State of the application */ AppStates_t AppState = APP_LOWPOWER; #endif /* MY_TEXT_PING_PONG_H_ */