Files
new_f_3/User/bsp/inc/bsp_digital_tube.h
刘正航 609eb878d1 New
2026-04-16 16:55:01 +08:00

77 lines
2.0 KiB
C
Raw Permalink 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.
//------------------------------------------------------------------------------
// 模块名称:数码管驱动模块
// 文件名称bsp_digital_tube
// 版本名称V1.0
// 文件说明:头文件
// 日期时间2018年8月15日20点02分
// 文件作者Jackie Chan
// 修改记录:
// 版本号 日期 作者 说明
// V1.0 2018.08.15 J.C 正式发布
//
// 公司名称:多场低温科技有限公司
//
//------------------------------------------------------------------------------
#ifndef __BSP_DIGITAL_TUBE__H__
#define __BSP_DIGITAL_TUBE__H__
#include <stdint.h>
typedef enum
{
NO_0 = 0,
NO_1,
NO_2,
NO_3,
NO_4,
NO_5,
NO_6,
NO_7,
NO_8,
NO_9,
NO__,
NO_NULL,
}SEG_NUM_E;
typedef enum
{
IDLE, // 空闲模式
WORK, // 工作模式
SEARCH, // 搜索模式
}STATE_E;
typedef enum
{
MODE_PULSE, // 脉冲显示模式
MODE_ANGLE, // 角度显示模式
}MODE_E;
typedef enum
{
DIR_CW, // 样品杆从上往下看,顺时针旋转(+
DIR_CCW, // 样品杆从上往下看,逆时针旋转(-
}DIR_E;
typedef struct
{
char buf[9]; // 8个数码管的刷新缓冲区
uint8_t disp_mode; // 显示模式,角度显示和脉冲数量显示
uint8_t cnt; // 数码管轮询显示计数
uint8_t state; // 工作状态,空闲模式、工作模式
uint8_t dir; // 电机旋转方向,样品杆从上往下看,顺时针(+)还是逆时针(-
int32_t pulse; // 电机转动过的脉冲数量,+表示顺时针累积脉冲,-表示逆时针累积
int32_t tim_pulse_cnt; // 定时器计数的脉冲数量每1ms更新到上面pluse中
int32_t angle; // 电机转动过的角度
}DIGITIAL_TUBE_T;
void bsp_InitDigitalTube(void);
void bsp_DigitalTubeMainLoop(void);
void bsp_TubeTest(uint8_t _com, uint8_t _seg);
void bsp_UpdateDisplayBuf(void);
void bsp_ToogleDispMode(void);
void bsp_ToogleStateMode(void);
#endif
//-------------------------------- End of file ---------------------------------