New
This commit is contained in:
39
User/bsp/inc/bsp_beep.h
Normal file
39
User/bsp/inc/bsp_beep.h
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
*********************************************************************************************************
|
||||
*
|
||||
* 模块名称 : 蜂鸣器模块
|
||||
* 文件名称 : bsp_beep.h
|
||||
* 版 本 : V1.0
|
||||
* 说 明 : 头文件
|
||||
*
|
||||
* Copyright (C), 2012-2013, 安富莱电子 www.armfly.com
|
||||
*
|
||||
*********************************************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef __BSP_BEEP_H
|
||||
#define __BSP_BEEP_H
|
||||
#include <stdint.h>
|
||||
|
||||
typedef struct _BEEP_T
|
||||
{
|
||||
uint8_t ucEnalbe;
|
||||
uint8_t ucState;
|
||||
uint16_t usBeepTime;
|
||||
uint16_t usStopTime;
|
||||
uint16_t usCycle;
|
||||
uint16_t usCount;
|
||||
uint16_t usCycleCount;
|
||||
uint32_t uiFreq;
|
||||
}BEEP_T;
|
||||
|
||||
/* 供外部调用的函数声明 */
|
||||
void BEEP_InitHard(void);
|
||||
void BEEP_Start(uint32_t _uiFreq, uint16_t _usBeepTime, uint16_t _usStopTime, uint16_t _usCycle);
|
||||
void BEEP_Stop(void);
|
||||
void BEEP_KeyTone(void);
|
||||
void BEEP_Pro(void);
|
||||
|
||||
#endif
|
||||
|
||||
/***************************** 安富莱电子 www.armfly.com (END OF FILE) *********************************/
|
||||
29
User/bsp/inc/bsp_channel_realy.h
Normal file
29
User/bsp/inc/bsp_channel_realy.h
Normal file
@@ -0,0 +1,29 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// 模块名称:通道继电器选择模块
|
||||
// 文件名称:bsp_channel_relay
|
||||
// 版本名称:V1.0
|
||||
// 文件说明:头文件
|
||||
// 日期时间:2018年8月8日19点52分
|
||||
// 文件作者:Jackie Chan
|
||||
// 修改记录:
|
||||
// 版本号 日期 作者 说明
|
||||
// V1.0 2018.08.08 J.C 正式发布
|
||||
//
|
||||
// 公司名称:多场低温科技有限公司
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifndef __BSP_CHANNEL_RELAY_H__
|
||||
#define __BSP_CHANNEL_RELAY_H__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
// 供外面调用的函数声明
|
||||
void bsp_InitChannelRelay(void);
|
||||
void bsp_RealyAllOff(void);
|
||||
void bsp_RelayOn(uint8_t _ch);
|
||||
|
||||
#endif
|
||||
|
||||
//-------------------------------- End of file ---------------------------------
|
||||
|
||||
76
User/bsp/inc/bsp_digital_tube.h
Normal file
76
User/bsp/inc/bsp_digital_tube.h
Normal file
@@ -0,0 +1,76 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// 模块名称:数码管驱动模块
|
||||
// 文件名称: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 ---------------------------------
|
||||
45
User/bsp/inc/bsp_drv8880.h
Normal file
45
User/bsp/inc/bsp_drv8880.h
Normal file
@@ -0,0 +1,45 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// 模块名称:步进电机芯片DRV8880驱动模块
|
||||
// 文件名称:bsp_drv8880
|
||||
// 版本名称:V1.0
|
||||
// 文件说明:头文件
|
||||
// 日期时间:2018年8月17日16点23分
|
||||
// 文件作者:Jackie Chan
|
||||
// 修改记录:
|
||||
// 版本号 日期 作者 说明
|
||||
// V1.0 2018.08.17 J.C 正式发布
|
||||
//
|
||||
// 公司名称:多场低温科技有限公司
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifndef __BSP_DRV8880_H__
|
||||
#define __BSP_DRV8880_H__
|
||||
|
||||
#include "bsp.h"
|
||||
|
||||
// typedef enum
|
||||
// {
|
||||
// DISABLE = 0,
|
||||
// ENABLE = !DISABLE
|
||||
// }BoolState;
|
||||
|
||||
// 细分入口参数
|
||||
typedef enum
|
||||
{
|
||||
STEP_FULL = 0, // Full step with 71% current
|
||||
STEP_1_2_NC, // Non-circular 1/2 step
|
||||
STEP_1_2, // 1/2 step
|
||||
STEP_1_4, // 1/4 step
|
||||
STEP_1_8, // 1/8 step
|
||||
STEP_1_16 // 1/16 step
|
||||
}MICRO_STEPPING_E;
|
||||
|
||||
void bsp_Init_Drv8880_Hard(void);
|
||||
void bsp_drv8880_enable_config(FunctionalState en);
|
||||
void bsp_drv8880_microstep_config(MICRO_STEPPING_E step);
|
||||
void bsp_drv8880_config_dir(DIR_E dir);
|
||||
|
||||
#endif
|
||||
|
||||
//-------------------------------- End of file ---------------------------------
|
||||
56
User/bsp/inc/bsp_eeprom_24xx.h
Normal file
56
User/bsp/inc/bsp_eeprom_24xx.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
*********************************************************************************************************
|
||||
*
|
||||
* 模块名称 : 串行EEPROM 24xx02驱动模块
|
||||
* 文件名称 : bsp_eeprom_24xx.h
|
||||
* 版 本 : V1.0
|
||||
* 说 明 : 头文件
|
||||
*
|
||||
* 修改记录 :
|
||||
* 版本号 日期 作者 说明
|
||||
* v1.0 2012-10-12 armfly ST固件库版本 V2.1.0
|
||||
*
|
||||
* Copyright (C), 2012-2013, 安富莱电子 www.armfly.com
|
||||
*
|
||||
*********************************************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef _BSP_EEPROM_24XX_H
|
||||
#define _BSP_EEPROM_24XX_H
|
||||
#include <stdint.h>
|
||||
|
||||
//#define AT24C02
|
||||
#define AT24C128
|
||||
//#define AT24C256
|
||||
|
||||
#ifdef AT24C02
|
||||
#define EE_MODEL_NAME "AT24C02"
|
||||
#define EE_DEV_ADDR 0xA0 /* 设备地址 */
|
||||
#define EE_PAGE_SIZE 8 /* 页面大小(字节) */
|
||||
#define EE_SIZE 256 /* 总容量(字节) */
|
||||
#define EE_ADDR_BYTES 1 /* 地址字节个数 */
|
||||
#endif
|
||||
|
||||
#ifdef AT24C128
|
||||
#define EE_MODEL_NAME "AT24C128"
|
||||
#define EE_DEV_ADDR 0xA0 /* 设备地址 */
|
||||
#define EE_PAGE_SIZE 64 /* 页面大小(字节) */
|
||||
#define EE_SIZE (16*1024) /* 总容量(字节) */
|
||||
#define EE_ADDR_BYTES 2 /* 地址字节个数 */
|
||||
#endif
|
||||
|
||||
#ifdef AT24C256
|
||||
#define EE_MODEL_NAME "AT24C256"
|
||||
#define EE_DEV_ADDR 0xA0 /* 设备地址 */
|
||||
#define EE_PAGE_SIZE 64 /* 页面大小(字节) */
|
||||
#define EE_SIZE (32*1024) /* 总容量(字节) */
|
||||
#define EE_ADDR_BYTES 2 /* 地址字节个数 */
|
||||
#endif
|
||||
|
||||
uint8_t ee_CheckOk(void);
|
||||
uint8_t ee_ReadBytes(uint8_t *_pReadBuf, uint16_t _usAddress, uint16_t _usSize);
|
||||
uint8_t ee_WriteBytes(uint8_t *_pWriteBuf, uint16_t _usAddress, uint16_t _usSize);
|
||||
|
||||
#endif
|
||||
|
||||
/***************************** 安富莱电子 www.armfly.com (END OF FILE) *********************************/
|
||||
29
User/bsp/inc/bsp_fpga_power.h
Normal file
29
User/bsp/inc/bsp_fpga_power.h
Normal file
@@ -0,0 +1,29 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// 模块名称:FPGA供电控制驱动模块
|
||||
// 文件名称:bsp_fpag_power.h
|
||||
// 版本名称:V1.0
|
||||
// 文件说明:头文件
|
||||
// 日期时间:2018年8月8日17点52分
|
||||
// 文件作者:Jackie Chan
|
||||
// 修改记录:
|
||||
// 版本号 日期 作者 说明
|
||||
// V1.0 2018.08.08 J.C 正式发布
|
||||
//
|
||||
// 公司名称:多场低温科技有限公司
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifndef __BSP_FPGA_POWER_H__
|
||||
#define __BSP_FPGA_POWER_H__
|
||||
|
||||
#include "bsp.h"
|
||||
|
||||
// 供外面调用的函数声明
|
||||
void bsp_InitFpgaPower(void);
|
||||
void bsp_FpgaPowerCmd(FunctionalState _NewState);
|
||||
void bsp_FpgaPowerMainLoop(uint16_t _delay_n_10ms);
|
||||
|
||||
#endif
|
||||
|
||||
//-------------------------------- End of file ---------------------------------
|
||||
|
||||
30
User/bsp/inc/bsp_i2c_gpio.h
Normal file
30
User/bsp/inc/bsp_i2c_gpio.h
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
*********************************************************************************************************
|
||||
*
|
||||
* 模块名称 : I2C总线驱动模块
|
||||
* 文件名称 : bsp_i2c_gpio.h
|
||||
* 版 本 : V1.0
|
||||
* 说 明 : 头文件。
|
||||
*
|
||||
* Copyright (C), 2012-2013, 安富莱电子 www.armfly.com
|
||||
*
|
||||
*********************************************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef _BSP_I2C_GPIO_H
|
||||
#define _BSP_I2C_GPIO_H
|
||||
|
||||
#define I2C_WR 0 /* 写控制bit */
|
||||
#define I2C_RD 1 /* 读控制bit */
|
||||
|
||||
void bsp_InitI2C(void);
|
||||
void i2c_Start(void);
|
||||
void i2c_Stop(void);
|
||||
void i2c_SendByte(uint8_t _ucByte);
|
||||
uint8_t i2c_ReadByte(void);
|
||||
uint8_t i2c_WaitAck(void);
|
||||
void i2c_Ack(void);
|
||||
void i2c_NAck(void);
|
||||
uint8_t i2c_CheckDevice(uint8_t _Address);
|
||||
|
||||
#endif
|
||||
177
User/bsp/inc/bsp_key.h
Normal file
177
User/bsp/inc/bsp_key.h
Normal file
@@ -0,0 +1,177 @@
|
||||
/*
|
||||
*********************************************************************************************************
|
||||
*
|
||||
* 模块名称 : 按键驱动模块
|
||||
* 文件名称 : bsp_key.h
|
||||
* 版 本 : V1.0
|
||||
* 说 明 : 头文件
|
||||
*
|
||||
* Copyright (C), 2013-2014, 安富莱电子 www.armfly.com
|
||||
*
|
||||
*********************************************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef __BSP_KEY_H
|
||||
#define __BSP_KEY_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define KEY_COUNT 3
|
||||
|
||||
/* 根据应用程序的功能重命名按键宏 */
|
||||
#define KEY_DOWN_K6 KEY_1_DOWN
|
||||
#define KEY_UP_K6 KEY_1_UP
|
||||
#define KEY_LONG_K6 KEY_1_LONG
|
||||
|
||||
#define KEY_DOWN_K1 KEY_2_DOWN
|
||||
#define KEY_UP_K1 KEY_2_UP
|
||||
#define KEY_LONG_K1 KEY_2_LONG
|
||||
|
||||
#define KEY_DOWN_K2 KEY_3_DOWN
|
||||
#define KEY_UP_K2 KEY_3_UP
|
||||
#define KEY_LONG_K2 KEY_3_LONG
|
||||
|
||||
#define KEY_DOWN_K4 KEY_4_DOWN /* 上 */
|
||||
#define KEY_UP_K4 KEY_4_UP
|
||||
#define KEY_LONG_K4 KEY_4_LONG
|
||||
|
||||
#define KEY_DOWN_K5 KEY_5_DOWN /* 下 */
|
||||
#define KEY_UP_K5 KEY_5_UP
|
||||
#define KEY_LONG_K5 KEY_5_LONG
|
||||
|
||||
#define KEY_DOWN_K3 KEY_6_DOWN /* 左 */
|
||||
#define KEY_UP_K3 KEY_6_UP
|
||||
#define KEY_LONG_K3 KEY_6_LONG
|
||||
|
||||
#define KEY_DOWN_K7 KEY_7_DOWN /* 右 */
|
||||
#define KEY_UP_K7 KEY_7_UP
|
||||
#define KEY_LONG_K7 KEY_7_LONG
|
||||
|
||||
#define KEY_DOWN_K8 KEY_8_DOWN /* ok */
|
||||
#define KEY_UP_K8 KEY_8_UP
|
||||
#define KEY_LONG_K8 KEY_8_LONG
|
||||
|
||||
#define SYS_DOWN_K1K2 KEY_9_DOWN /* K1 K2 组合键 */
|
||||
#define SYS_UP_K1K2 KEY_9_UP
|
||||
#define SYS_LONG_K1K2 KEY_9_LONG
|
||||
|
||||
#define SYS_DOWN_K2K3 KEY_10_DOWN /* K2 K3 组合键 */
|
||||
#define SYS_UP_K2K3 KEY_10_UP
|
||||
#define SYS_LONG_K2K3 KEY_10_LONG
|
||||
|
||||
/* 按键ID, 主要用于bsp_KeyState()函数的入口参数 */
|
||||
typedef enum
|
||||
{
|
||||
KID_K1 = 0,
|
||||
KID_K2,
|
||||
KID_K3,
|
||||
KID_K4,
|
||||
KID_K5,
|
||||
KID_K6,
|
||||
KID_K7,
|
||||
KID_K8
|
||||
}KEY_ID_E;
|
||||
|
||||
/*
|
||||
按键滤波时间50ms, 单位10ms。
|
||||
只有连续检测到50ms状态不变才认为有效,包括弹起和按下两种事件
|
||||
即使按键电路不做硬件滤波,该滤波机制也可以保证可靠地检测到按键事件
|
||||
*/
|
||||
#define KEY_FILTER_TIME 1
|
||||
#define KEY_LONG_TIME 100 /* 单位10ms, 持续1秒,认为长按事件 */
|
||||
|
||||
/*
|
||||
每个按键对应1个全局的结构体变量。
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/* 下面是一个函数指针,指向判断按键手否按下的函数 */
|
||||
uint8_t (*IsKeyDownFunc)(void); /* 按键按下的判断函数,1表示按下 */
|
||||
|
||||
uint8_t Count; /* 滤波器计数器 */
|
||||
uint16_t LongCount; /* 长按计数器 */
|
||||
uint16_t LongTime; /* 按键按下持续时间, 0表示不检测长按 */
|
||||
uint8_t State; /* 按键当前状态(按下还是弹起) */
|
||||
uint8_t RepeatSpeed; /* 连续按键周期 */
|
||||
uint8_t RepeatCount; /* 连续按键计数器 */
|
||||
}KEY_T;
|
||||
|
||||
/*
|
||||
定义键值代码, 必须按如下次序定时每个键的按下、弹起和长按事件
|
||||
|
||||
推荐使用enum, 不用#define,原因:
|
||||
(1) 便于新增键值,方便调整顺序,使代码看起来舒服点
|
||||
(2) 编译器可帮我们避免键值重复。
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
KEY_NONE = 0, /* 0 表示按键事件 */
|
||||
|
||||
KEY_1_DOWN, /* 1键按下 */
|
||||
KEY_1_UP, /* 1键弹起 */
|
||||
KEY_1_LONG, /* 1键长按 */ //3
|
||||
|
||||
KEY_2_DOWN, /* 2键按下 */
|
||||
KEY_2_UP, /* 2键弹起 */
|
||||
KEY_2_LONG, /* 2键长按 *///6
|
||||
|
||||
KEY_3_DOWN, /* 3键按下 */
|
||||
KEY_3_UP, /* 3键弹起 */
|
||||
KEY_3_LONG, /* 3键长按 */
|
||||
|
||||
KEY_4_DOWN, /* 4键按下 */
|
||||
KEY_4_UP, /* 4键弹起 */
|
||||
KEY_4_LONG, /* 4键长按 */
|
||||
|
||||
KEY_5_DOWN, /* 5键按下 */
|
||||
KEY_5_UP, /* 5键弹起 */
|
||||
KEY_5_LONG, /* 5键长按 */
|
||||
|
||||
KEY_6_DOWN, /* 6键按下 */
|
||||
KEY_6_UP, /* 6键弹起 */
|
||||
KEY_6_LONG, /* 6键长按 */
|
||||
|
||||
KEY_7_DOWN, /* 7键按下 */
|
||||
KEY_7_UP, /* 7键弹起 */
|
||||
KEY_7_LONG, /* 7键长按 */
|
||||
|
||||
KEY_8_DOWN, /* 8键按下 */
|
||||
KEY_8_UP, /* 8键弹起 */
|
||||
KEY_8_LONG, /* 8键长按 */
|
||||
|
||||
/* 组合键 */
|
||||
KEY_9_DOWN, /* 9键按下 */
|
||||
KEY_9_UP, /* 9键弹起 */
|
||||
KEY_9_LONG, /* 9键长按 */
|
||||
|
||||
KEY_10_DOWN, /* 10键按下 */
|
||||
KEY_10_UP, /* 10键弹起 */
|
||||
KEY_10_LONG, /* 10键长按 */
|
||||
}KEY_ENUM;
|
||||
|
||||
/* 按键FIFO用到变量 */
|
||||
#define KEY_FIFO_SIZE 10
|
||||
typedef struct
|
||||
{
|
||||
uint8_t Buf[KEY_FIFO_SIZE]; /* 键值缓冲区 */
|
||||
uint8_t Read; /* 缓冲区读指针1 */
|
||||
uint8_t Write; /* 缓冲区写指针 */
|
||||
uint8_t Read2; /* 缓冲区读指针2 */
|
||||
}KEY_FIFO_T;
|
||||
|
||||
/* 供外部调用的函数声明 */
|
||||
void bsp_InitKey(void);
|
||||
void bsp_KeyScan(void);
|
||||
void bsp_PutKey(uint8_t _KeyCode);
|
||||
uint8_t bsp_GetKey(void);
|
||||
uint8_t bsp_GetKey2(void);
|
||||
uint8_t bsp_GetKeyState(KEY_ID_E _ucKeyID);
|
||||
void bsp_SetKeyParam(uint8_t _ucKeyID, uint16_t _LongTime, uint8_t _RepeatSpeed);
|
||||
void bsp_ClearKey(void);
|
||||
|
||||
uint8_t IsKeyDown2(void);
|
||||
uint8_t IsKeyDown3(void);
|
||||
|
||||
#endif
|
||||
|
||||
/***************************** 安富莱电子 www.armfly.com (END OF FILE) *********************************/
|
||||
31
User/bsp/inc/bsp_led.h
Normal file
31
User/bsp/inc/bsp_led.h
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
*********************************************************************************************************
|
||||
*
|
||||
* 模块名称 : LED指示灯驱动模块
|
||||
* 文件名称 : bsp_led.h
|
||||
* 版 本 : V1.0
|
||||
* 说 明 : 头文件
|
||||
*
|
||||
* Copyright (C), 2013-2014, 安富莱电子 www.armfly.com
|
||||
*
|
||||
*********************************************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef __BSP_LED_H
|
||||
#define __BSP_LED_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/* 供外部调用的函数声明 */
|
||||
void bsp_InitLed(void);
|
||||
void bsp_LedOn(uint8_t _no);
|
||||
void bsp_LedOff(uint8_t _no);
|
||||
void bsp_LedToggle(uint8_t _no);
|
||||
uint8_t bsp_IsLedOn(uint8_t _no);
|
||||
void bsp_LedAllOff(void);
|
||||
void bsp_ChannelSelect(uint8_t _ch);
|
||||
void bsp_ResSelect(uint8_t _res);
|
||||
|
||||
#endif
|
||||
|
||||
/***************************** 安富莱电子 www.armfly.com (END OF FILE) *********************************/
|
||||
41
User/bsp/inc/bsp_res.h
Normal file
41
User/bsp/inc/bsp_res.h
Normal file
@@ -0,0 +1,41 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// 模块名称:压电位移控制器串联电阻驱动模块
|
||||
// 文件名称:bsp_res.h
|
||||
// 版本名称:V1.0
|
||||
// 文件说明:头文件
|
||||
// 日期时间:2018年8月8日15点14分
|
||||
// 文件作者:Jackie Chan
|
||||
// 修改记录:
|
||||
// 版本号 日期 作者 说明
|
||||
// V1.0 2018.08.08 J.C 正式发布
|
||||
//
|
||||
// 公司名称:多场低温科技有限公司
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifndef __BSP_RES_H__
|
||||
#define __BSP_RES_H__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
// 串联电阻参数选择,主要用于bsp_KeyState()函数的入口参数
|
||||
typedef enum
|
||||
{
|
||||
RES_0 = 7,
|
||||
RES_10,
|
||||
RES_61,
|
||||
RES_100,
|
||||
RES_110,
|
||||
RES_151,
|
||||
RES_202,
|
||||
RES_212
|
||||
}RES_E;
|
||||
|
||||
// 供外面调用的函数声明
|
||||
void bsp_InitRes(void);
|
||||
void bsp_SelectRes(uint8_t _res);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
//-------------------------------- End of file ---------------------------------
|
||||
50
User/bsp/inc/bsp_step_moto.h
Normal file
50
User/bsp/inc/bsp_step_moto.h
Normal file
@@ -0,0 +1,50 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// 模块名称:步进电机脉冲驱动模块
|
||||
// 文件名称:bsp_step_moto
|
||||
// 版本名称:V1.0
|
||||
// 文件说明:头文件
|
||||
// 日期时间:2018年8月23日20点37分
|
||||
// 文件作者:Jackie Chan
|
||||
// 修改记录:
|
||||
// 版本号 日期 作者 说明
|
||||
// V1.0 2018.08.23 J.C 正式发布
|
||||
//
|
||||
// 公司名称:多场低温科技有限公司
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifndef _BSP_STEMP_MOTO_H
|
||||
#define _BSP_STEMP_MOTO_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t Dir; /* 0 表示正转 1 表示反转 */
|
||||
uint32_t StepFreq; /* 步进频率 */
|
||||
uint32_t StepCount; /* 剩余步数 */
|
||||
uint32_t AllStep; /* 一次转动命令所要走的脉冲总数 */
|
||||
uint32_t CurrentStep; /* 已经走过的步数 */
|
||||
uint32_t DispStep; /* 显示走过的步数,零点搜索时候不计数 */
|
||||
uint8_t Running; /* 1表示正在旋转 0 表示停机 */
|
||||
uint8_t Pos; /* 线圈通电的相序,0-7 */
|
||||
int64_t pv_pulse; // 当前的脉冲值
|
||||
int64_t sv_pulse; // 电脑端的设定脉冲值
|
||||
int64_t prev_pv_pulse;// 上一次脉冲值,用于检测过零点
|
||||
} MOTO_T;
|
||||
|
||||
extern MOTO_T g_tMoto;
|
||||
|
||||
void bsp_InitStepMoto(void);
|
||||
void MOTO_Start(uint32_t _speed, uint8_t _dir, int32_t _stpes);
|
||||
void MOTO_ZorePos(void);
|
||||
void MOTO_Stop(void);
|
||||
void MOTO_Pause(void);
|
||||
void MOTO_ShangeSpeed(uint32_t _speed);
|
||||
uint32_t MOTO_RoudToStep(void);
|
||||
|
||||
extern MOTO_T g_tMoto;
|
||||
|
||||
#endif
|
||||
|
||||
/***************************** 安富莱电子 www.armfly.com (END OF FILE) *********************************/
|
||||
29
User/bsp/inc/bsp_tim_pwm.h
Normal file
29
User/bsp/inc/bsp_tim_pwm.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
*********************************************************************************************************
|
||||
*
|
||||
* 模块名称 : 利用STM32F4内部TIM输出PWM信号,顺便实现
|
||||
* 文件名称 : bsp_tim_pwm.h
|
||||
* 版 本 : V1.0
|
||||
* 说 明 : 头文件
|
||||
*
|
||||
* Copyright (C), 2012-2013, 安富莱电子 www.armfly.com
|
||||
*
|
||||
*********************************************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef __BSP_TIM_PWM_H
|
||||
#define __BSP_TIM_PWM_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
void bsp_SetTIMOutPWM(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin, TIM_TypeDef* TIMx, uint8_t _ucChannel,
|
||||
uint32_t _ulFreq, uint32_t _ulDutyCycle);
|
||||
|
||||
void bsp_SetTIMOutPWM_N(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin, TIM_TypeDef* TIMx, uint8_t _ucChannel,
|
||||
uint32_t _ulFreq, uint32_t _ulDutyCycle);
|
||||
|
||||
void bsp_SetTIMforInt(TIM_TypeDef* TIMx, uint32_t _ulFreq, uint8_t _PreemptionPriority, uint8_t _SubPriority);
|
||||
|
||||
#endif
|
||||
|
||||
/***************************** 安富莱电子 www.armfly.com (END OF FILE) *********************************/
|
||||
55
User/bsp/inc/bsp_timer.h
Normal file
55
User/bsp/inc/bsp_timer.h
Normal file
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
*********************************************************************************************************
|
||||
*
|
||||
* 模块名称 : 定时器模块
|
||||
* 文件名称 : bsp_timer.h
|
||||
* 版 本 : V1.3
|
||||
* 说 明 : 头文件
|
||||
*
|
||||
* Copyright (C), 2015-2016, 安富莱电子 www.armfly.com
|
||||
*
|
||||
*********************************************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef __BSP_TIMER_H
|
||||
#define __BSP_TIMER_H
|
||||
|
||||
/*
|
||||
在此定义若干个软件定时器全局变量
|
||||
注意,必须增加__IO 即 volatile,因为这个变量在中断和主程序中同时被访问,有可能造成编译器错误优化。
|
||||
*/
|
||||
#define TMR_COUNT 4 /* 软件定时器的个数 (定时器ID范围 0 - 3) */
|
||||
|
||||
/* 定时器结构体,成员变量必须是 volatile, 否则C编译器优化时可能有问题 */
|
||||
typedef enum
|
||||
{
|
||||
TMR_ONCE_MODE = 0, /* 一次工作模式 */
|
||||
TMR_AUTO_MODE = 1 /* 自动定时工作模式 */
|
||||
}TMR_MODE_E;
|
||||
|
||||
/* 定时器结构体,成员变量必须是 volatile, 否则C编译器优化时可能有问题 */
|
||||
typedef struct
|
||||
{
|
||||
volatile uint8_t Mode; /* 计数器模式,1次性 */
|
||||
volatile uint8_t Flag; /* 定时到达标志 */
|
||||
volatile uint32_t Count; /* 计数器 */
|
||||
volatile uint32_t PreLoad; /* 计数器预装值 */
|
||||
}SOFT_TMR;
|
||||
|
||||
/* 提供给其他C文件调用的函数 */
|
||||
void bsp_InitTimer(void);
|
||||
void bsp_DelayMS(uint32_t n);
|
||||
void bsp_DelayUS(uint32_t n);
|
||||
void bsp_StartTimer(uint8_t _id, uint32_t _period);
|
||||
void bsp_StartAutoTimer(uint8_t _id, uint32_t _period);
|
||||
void bsp_StopTimer(uint8_t _id);
|
||||
uint8_t bsp_CheckTimer(uint8_t _id);
|
||||
int32_t bsp_GetRunTime(void);
|
||||
int32_t bsp_CheckRunTime(int32_t _LastTime);
|
||||
|
||||
void bsp_InitHardTimer(void);
|
||||
void bsp_StartHardTimer(uint8_t _CC, uint32_t _uiTimeOut, void * _pCallBack);
|
||||
|
||||
#endif
|
||||
|
||||
/***************************** 安富莱电子 www.armfly.com (END OF FILE) *********************************/
|
||||
47
User/bsp/inc/bsp_usart_dma.h
Normal file
47
User/bsp/inc/bsp_usart_dma.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* @Author: Memory 1619005172@qq.com
|
||||
* @Date: 2026-04-15 18:00:45
|
||||
* @LastEditors: Memory 1619005172@qq.com
|
||||
* @LastEditTime: 2026-04-15 19:25:36
|
||||
* @FilePath: \MDK-ARMd:\Project\MFT\Motor\User\bsp\inc\bsp_usart_dma.h
|
||||
* @Description:
|
||||
*/
|
||||
#ifndef __USARTDMA_H
|
||||
#define __USARTDMA_H
|
||||
|
||||
#include "stm32f10x.h"
|
||||
#include <stdio.h>
|
||||
|
||||
// 串口工作参数宏定义
|
||||
#define DEBUG_USARTx USART1
|
||||
#define DEBUG_USART_CLK RCC_APB2Periph_USART1
|
||||
#define DEBUG_USART_APBxClkCmd RCC_APB2PeriphClockCmd
|
||||
#define DEBUG_USART_BAUDRATE 115200
|
||||
|
||||
// USART GPIO 引脚宏定义
|
||||
#define DEBUG_USART_GPIO_CLK (RCC_APB2Periph_GPIOA)
|
||||
#define DEBUG_USART_GPIO_APBxClkCmd RCC_APB2PeriphClockCmd
|
||||
|
||||
#define DEBUG_USART_TX_GPIO_PORT GPIOA
|
||||
#define DEBUG_USART_TX_GPIO_PIN GPIO_Pin_9
|
||||
#define DEBUG_USART_RX_GPIO_PORT GPIOA
|
||||
#define DEBUG_USART_RX_GPIO_PIN GPIO_Pin_10
|
||||
|
||||
#define DEBUG_USART_IRQ USART1_IRQn
|
||||
#define DEBUG_USART_IRQHandler USART1_IRQHandler
|
||||
|
||||
// 串口对应的DMA请求通道
|
||||
#define USART_RX_DMA_CHANNEL DMA1_Channel5
|
||||
// 外设寄存器地址
|
||||
#define USART_DR_ADDRESS (USART1_BASE + 0x04)
|
||||
// 一次发送的数据量
|
||||
#define RECEIVEBUFF_SIZE 64
|
||||
|
||||
void USART_Config(void);
|
||||
void USARTx_DMA_Config(void);
|
||||
void Usart_SendArray(USART_TypeDef *pUSARTx, uint8_t *array, uint16_t num);
|
||||
|
||||
extern uint8_t g_ucRxRcvNewFlag;
|
||||
extern uint8_t g_RxBuf[64];
|
||||
|
||||
#endif /* __USARTDMA_H */
|
||||
Reference in New Issue
Block a user