| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- /* pindef.h — 由 pindef.json 生成 (html_tools/pindef 编辑器)。勿手改, 改 pindef.json 后重新生成。
- * 引脚定义为 hal_pin_t 单值 (PA()/PB(), 见 hal_gpio_port.h)。 */
- #ifndef INCLUDE_PINDEF_H_
- #define INCLUDE_PINDEF_H_
- #include "CH58x_common.h"
- #include "hal_gpio_port.h" /* PA()/PB()/hal_pin_t */
- /* GPIOB 辅助宏 (SDK 只提供 GPIOB_PinOutput/Input) */
- #define GPIOB_PinOutput(pin) (R32_PB_DIR |= pin)
- #define GPIOB_PinInput(pin) (R32_PB_DIR &= ~pin)
- /* 引脚定义 (hal_pin_t) */
- #define LED_PIN PB(GPIO_Pin_14) // PB14
- #define LED_SW PB(GPIO_Pin_11) // PB11 (LED开关 - 备用)
- #define SOUND_PIN PB(GPIO_Pin_9) // PB9
- #define SOUND_SW PA(GPIO_Pin_10) // PA10
- #define SW_KEY PA(GPIO_Pin_4) // PA4
- #define ZZZ PB(GPIO_Pin_12)
- /* PWM 通道 */
- #define PWM_LED_CHANNEL CH_PWM10
- /* 按键检测位 (从 SW_KEY 派生, 原始寄存器快速读, 不走 hal_gpio 抽象) */
- #define KEY10_BV BV(4)
- #define KEY10_IN (ACTIVE_LOW(R32_PA_PIN & KEY10_BV))
- /* ==================== RF 构建变体 ====================
- * SI24R1 5字节通信地址 + 信道。build 脚本按设备重写 (通过 -D 覆盖, #ifndef 守卫)。
- * 【重要】中控与从机两端必须完全一致, 否则无法通信。修改后两端同步重新编译部署。 */
- #ifndef INIT_ADDR
- #define INIT_ADDR 0x34,0x43,0x10,0x10,0x02 /* SI24R1 5字节地址 */
- #endif
- #ifndef SI24R1_CH
- #define SI24R1_CH 16 /* SI24R1 信道 (0-127, 1MHz步进) */
- #endif
- /* ==================== 跳频信道池 ====================
- * 跳频信道池: 避开 WiFi ch1/6/11/13。
- * 用法: static const uint8_t pool[HOP_POOL_SIZE] = HOP_POOL;
- * HOP_POOL_SIZE 自动 = 元素数 (生成器计算, 无需手工同步)。 */
- #ifndef HOP_POOL
- #define HOP_POOL {16,84,98,112}
- #endif
- #ifndef HOP_POOL_SIZE
- #define HOP_POOL_SIZE 4 /* 自动 = HOP_POOL 元素数 */
- #endif
- /* LED 节能亮度曲线数据 (struct eco_s 聚合初始化值, 见 hw_config.h)。
- * 字段顺序: { pwm_start, sec, pwm_end, is_loop, loop_max_sec }
- * pwm 单位 1/100 (10000=满亮度), sec 单位秒。
- * 展开为 hw_config.c: struct eco_s eco_plan[] = { MLED_ECO_PLAN_DATA };
- * 阶段数由 hw_config.c 用 sizeof 自动计算, 无需手动维护 ECO_PLAN_LEN。 */
- #define MLED_ECO_PLAN_DATA \
- { 6500, 300, 6000, 0, 0 }, \
- { 6000, 1200, 6000, 0, 0 }, \
- { 6000, 300, 5500, 0, 0 }, \
- { 5500, 600, 5500, 0, 0 }, \
- { 5500, 600, 5000, 0, 0 }, \
- { 5000, 60, 5000, 0, 0 }
- #endif /* INCLUDE_PINDEF_H_ */
|