Compare commits

...

1 Commits

Author SHA1 Message Date
8eb661c513 尝试新架构 2025-12-15 23:26:34 +08:00
2 changed files with 78 additions and 0 deletions

33
User/bsp/bsp_api.c Normal file
View 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
View 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