3.24_433_RX版本:封装RF433模块,完成开机进入TX/RX模式并在开发板验证成功
This commit is contained in:
133
Driver_RF433/Inc/rf433_config.h
Normal file
133
Driver_RF433/Inc/rf433_config.h
Normal file
@ -0,0 +1,133 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file rf433_config.h
|
||||
* @brief RF433模块配置文件
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef __RF433_CONFIG_H__
|
||||
#define __RF433_CONFIG_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* ============================================================================
|
||||
* 编译模式选择
|
||||
* ============================================================================ */
|
||||
|
||||
/**
|
||||
* @brief 编译模式选择
|
||||
* @note 必须在包含此头文件之前定义
|
||||
* RF433_MODE_TX - 仅编译TX功能
|
||||
* RF433_MODE_RX - 仅编译RX功能
|
||||
* RF433_MODE_BOTH - 编译TX和RX功能(默认)
|
||||
*/
|
||||
#define RF433_MODE_TX 1
|
||||
#define RF433_MODE_RX 2
|
||||
#define RF433_MODE_BOTH 3
|
||||
|
||||
#ifndef RF433_MODE
|
||||
#define RF433_MODE RF433_MODE_RX
|
||||
#endif
|
||||
|
||||
/* ============================================================================
|
||||
* 默认配置参数
|
||||
* ============================================================================ */
|
||||
|
||||
/**
|
||||
* @brief 默认工作模式(运行时选择)
|
||||
* @note 1: TX模式
|
||||
* 2: RX模式
|
||||
* 3: 双模模式
|
||||
*/
|
||||
#ifndef RF433_DEFAULT_WORK_MODE
|
||||
#define RF433_DEFAULT_WORK_MODE RF433_MODE_TX
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief 默认发送间隔(ms)
|
||||
*/
|
||||
#ifndef RF433_DEFAULT_TX_INTERVAL
|
||||
#define RF433_DEFAULT_TX_INTERVAL 1000
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief 默认发送次数
|
||||
*/
|
||||
#ifndef RF433_DEFAULT_TX_COUNT
|
||||
#define RF433_DEFAULT_TX_COUNT 100
|
||||
#endif
|
||||
|
||||
/* ============================================================================
|
||||
* 缓冲区大小配置
|
||||
* ============================================================================ */
|
||||
|
||||
/**
|
||||
* @brief FIFO缓冲区大小
|
||||
*/
|
||||
#ifndef RF433_FIFO_SIZE
|
||||
#define RF433_FIFO_SIZE 1024
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief 最大数据包长度
|
||||
*/
|
||||
#ifndef RF433_MAX_PACKET_SIZE
|
||||
#define RF433_MAX_PACKET_SIZE 237
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief 默认超时时间(ms)
|
||||
*/
|
||||
#ifndef RF433_DEFAULT_TIMEOUT
|
||||
#define RF433_DEFAULT_TIMEOUT 100
|
||||
#endif
|
||||
|
||||
/* ============================================================================
|
||||
* 硬件配置
|
||||
* ============================================================================ */
|
||||
|
||||
/**
|
||||
* @brief 是否使用AUX引脚检测忙状态
|
||||
* @note 1: 使用AUX引脚(推荐)
|
||||
* 0: 使用延时(不推荐)
|
||||
*/
|
||||
#ifndef RF433_USE_GPIO_AUX
|
||||
#define RF433_USE_GPIO_AUX 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief AUX引脚忙等待超时时间(ms)
|
||||
*/
|
||||
#ifndef RF433_AUX_TIMEOUT
|
||||
#define RF433_AUX_TIMEOUT 100
|
||||
#endif
|
||||
|
||||
/* ============================================================================
|
||||
* 调试配置
|
||||
* ============================================================================ */
|
||||
|
||||
/**
|
||||
* @brief 是否启用调试输出
|
||||
*/
|
||||
#ifndef RF433_DEBUG_ENABLE
|
||||
#define RF433_DEBUG_ENABLE 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief 调试输出函数
|
||||
*/
|
||||
#if RF433_DEBUG_ENABLE
|
||||
#ifndef RF433_DEBUG_PRINTF
|
||||
#define RF433_DEBUG_PRINTF(fmt, ...) printf("[RF433] " fmt "\r\n", ##__VA_ARGS__)
|
||||
#endif
|
||||
#else
|
||||
#define RF433_DEBUG_PRINTF(fmt, ...)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __RF433_CONFIG_H__ */
|
||||
Reference in New Issue
Block a user