108 lines
2.8 KiB
C
108 lines
2.8 KiB
C
#ifndef __BSP_H__
|
|
#define __BSP_H__
|
|
|
|
#include "VoiletTypeDef.h"
|
|
|
|
/* Extra Library Enable */
|
|
#define USE_SHELL //系统使用Shell
|
|
|
|
#ifdef USE_SHELL
|
|
#include "LetterShell.h"
|
|
#endif
|
|
|
|
#define ARRAY_LEN(arr) (sizeof(arr) / sizeof((arr)[0]))
|
|
|
|
/* BOOL类型定义 */
|
|
typedef enum {
|
|
false = 0,
|
|
true = 1,
|
|
} bool_t;
|
|
|
|
//GPIO
|
|
//数组信号输入/出开关
|
|
#define DI_ON 1
|
|
#define DI_OFF 0
|
|
#define DO_ON 1
|
|
#define DO_OFF 0
|
|
//LED灯开关
|
|
#define LED_ON 0
|
|
#define LED_OFF 1
|
|
|
|
/* Voilet */
|
|
void VoiletBspInit(void);
|
|
|
|
/* BSP */
|
|
void LedOn(uint8_t Chnl);
|
|
void LedOff(uint8_t Chnl);
|
|
void LedSet(uint8_t Chnl,uint8_t Value);
|
|
void LedToggle(uint8_t Chnl);
|
|
|
|
//Interrupt
|
|
void IrqInit(void);
|
|
void IrqRegister(unsigned int Irq, void(*Func)(void *Param));
|
|
void IrqConfig(uint32_t Irq, uint8_t NvicPrePriority, uint8_t NvicSubPriority);
|
|
void IrqDisable(uint32_t Irq);
|
|
|
|
//System Delay
|
|
void DelayConfig(void);
|
|
unsigned int DwtCntGet(void);
|
|
void DelayUs(unsigned int Us);
|
|
void DelayMs(unsigned int Ms);
|
|
|
|
/* GPIO */
|
|
void GpioConfig(const GPIO_MAP_T *GpioX, GPIOMode_TypeDef GpioMode, GPIOSpeed_TypeDef GpioSpeed);
|
|
void GpioSet(const GPIO_MAP_T *GpioX, uint8_t Value);
|
|
unsigned char GpioGet(const GPIO_MAP_T *GpioX);
|
|
|
|
/* UART */
|
|
void ComSendChar(const COM_MAP_T *ComX,uint8_t Data);
|
|
void ComSendStr(const COM_MAP_T *ComX,uint8_t* Data, uint64_t Len);
|
|
uint8_t ComReceiveChar(const COM_MAP_T *ComX);
|
|
void ComStdConfig(const COM_MAP_T *ComX, uint32_t Baud);
|
|
void ComAdvConfig(const COM_MAP_T *ComX, uint32_t Baud, uint8_t DataBits, uint8_t StopBits, uint8_t Parity);
|
|
|
|
// /* 板级BSP头文件 */
|
|
// #include "Board.h"
|
|
//
|
|
// /* SHELL头文件 */
|
|
// #include "LetterShell.h"
|
|
//
|
|
// /* BSP版本 */
|
|
// #define VERSION_0 0
|
|
// #define VERSION_1 1
|
|
// #define VERSION_2 2
|
|
//
|
|
// /* RTOS宏开关 */
|
|
// #ifdef USE_RTOS
|
|
// #ifdef USE_THREADX
|
|
// #include "tx_api.h"
|
|
// #endif
|
|
// #endif
|
|
//
|
|
//
|
|
// //System
|
|
// void BspInit(void);
|
|
// void BspExtraInit(void);
|
|
// void SystemStart(void);
|
|
// void BspSystemReboot(void);
|
|
//
|
|
// void SystemGpioInit(void);
|
|
// void GpioConfig(GPIO_TypeDef *GpioX, uint16_t GpioPinX,GPIOMode_TypeDef GpioMode, GPIOSpeed_TypeDef GpioSpeed);
|
|
// void GpioSetSts(GPIO_TypeDef *GpioX, uint16_t GpioPinX, uint8_t Status);
|
|
// uint8_t GpioGetSts(GPIO_TypeDef *GpioX, uint16_t GpioPinX);
|
|
// void LedToggle(uint8_t Chnl);
|
|
// void LedOff(uint8_t Chnl);
|
|
// void LedOn(uint8_t Chnl);
|
|
//
|
|
//
|
|
//
|
|
// //Usart
|
|
// void SystemUsartInit(void);
|
|
// void UsartSendChar(uint32_t ComId,uint8_t Data);
|
|
// void UsartSendStr(uint32_t ComId,uint8_t* Data, uint64_t Len);
|
|
// uint8_t UsartReceiveChar(uint32_t ComId);
|
|
// void UsartStdConfig(uint32_t ComId, uint32_t baud);
|
|
// void UsartAdvConfig(uint32_t ComId, uint32_t baud, uint8_t DataBits, uint8_t StopBits, uint8_t Parity);
|
|
|
|
#endif
|