You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
156 lines
3.4 KiB
156 lines
3.4 KiB
3 months ago
|
/*
|
||
|
* 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_ */
|