Files
JBao_Temp_Humi_Fan_FW/apps/usr_periph/bsp_ct1642.h
T
2026-09-04 17:17:14 +08:00

46 lines
1.8 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/******************************************************************************
* @file bsp_ct1642.h
* @brief CBR3 CT1642 类数码管驱动:18bit 移位、锁存、送出
* @author cyWu <1917507415@qq.com>
* @date 2026.09.04
* @version V1.1.0,转机 180° 段码补偿(见 BOARD_DISP_ROTATE_180
* @history
* - V1.1.0, 2026.09.04, cyWu, send_frame 内按宏做 A↔D/B↔E/C↔F
* - V1.0.1, 2026.08.29, cyWu, IO 分离:CT1642 独立 PG0=CLK/PG1=DATA(飞线),AHT20
* 独占 PC4/PC5,无总线共享机制
*
* @note PG0=CLKPG1=DATA,独立引脚、无总线锁,可随时调用。
* 协议:一帧 18bitC1-C4 位选 + 6 位保留 + Q2-Q9 段码),CLK 上升沿采样
* DATADATA 只在 CLK=低时改变);发完 CLK=高 时 DATA 上升沿=锁存,
* CLK=低 时 DATA 上升沿=输出刷新。
******************************************************************************/
#ifndef __BSP_CT1642_H__
#define __BSP_CT1642_H__
#include <stdint.h>
/**
* @brief 初始化 PG0/PG1 为推挽输出(CLK/DATA 初始 0
* @note app_disp_init() 内调用;被 BOARD_DISP_ENABLE 编译开关保护
* @return 无
*/
void bsp_ct1642_init(void);
/**
* @brief 7 段数码管数字转段码(共阴,A=bit0 ... G=bit6DP=bit7
* @param digit 0~910='-'G 段);11=全灭
* @return 段码
*/
uint8_t bsp_ct1642_seg(uint8_t digit);
/**
* @brief 发一帧刷新一位:18bitC1-C4 位选 + 6 保留 + Q2-Q9 段码,LSB 先)
* @param seg 段码(bit7=DP ... bit0=A,先发 bit0→Q2
* @param com COM 位选掩码(bit3=C4 ... bit0=C1,仅 1 位置位;硬件低有效内部取反)
* @return 无
*/
void bsp_ct1642_send_frame(uint8_t seg, uint8_t com);
#endif /* __BSP_CT1642_H__ */