尝试新架构
This commit is contained in:
parent
c17f41b267
commit
8eb661c513
33
User/bsp/bsp_api.c
Normal file
33
User/bsp/bsp_api.c
Normal file
@ -0,0 +1,33 @@
|
||||
|
||||
#include "bsp_api.h"
|
||||
|
||||
/* USER INCLUDE BEGIN */
|
||||
|
||||
/* USER INCLUDE END */
|
||||
|
||||
/* USER DEFINE BEGIN */
|
||||
|
||||
/* USER DEFINE END */
|
||||
|
||||
/* USER STRUCT BEGIN */
|
||||
|
||||
/* USER STRUCT END */
|
||||
|
||||
/* USER FUNCTION BEGIN */
|
||||
|
||||
/* USER FUNCTION END */
|
||||
|
||||
/* bsp层外设API实体 */
|
||||
const struct Bsp_s Bsp = {
|
||||
.gpio = {
|
||||
.WritePin = BSP_GPIO_WritePin,
|
||||
},
|
||||
.timer_t = {
|
||||
.Init = NULL,
|
||||
},
|
||||
.spi = {
|
||||
.Init = NULL,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
45
User/bsp/bsp_api.h
Normal file
45
User/bsp/bsp_api.h
Normal file
@ -0,0 +1,45 @@
|
||||
#pragma once
|
||||
|
||||
#include <sys/types.h>
|
||||
#include "bsp/gpio.h"
|
||||
#include "bsp/time.h"
|
||||
#include "bsp/spi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* USER INCLUDE BEGIN */
|
||||
|
||||
/* USER INCLUDE END */
|
||||
|
||||
/* USER DEFINE BEGIN */
|
||||
|
||||
/* USER DEFINE END */
|
||||
/* bsp层外设API结构体 */
|
||||
struct Bsp_s {
|
||||
struct {
|
||||
|
||||
int8_t ( *WritePin )( BSP_GPIO_t gpio, bool value );
|
||||
}gpio;
|
||||
|
||||
struct {
|
||||
void ( *Init )( );
|
||||
}timer_t;
|
||||
|
||||
struct {
|
||||
void ( *Init )( );
|
||||
}spi;
|
||||
};
|
||||
|
||||
extern const struct Bsp_s Bsp;
|
||||
|
||||
/* USER FUNCTION BEGIN */
|
||||
|
||||
/* USER FUNCTION END */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
Loading…
Reference in New Issue
Block a user