From 8eb661c513e5a68e342f4be5be373e8537a72ab9 Mon Sep 17 00:00:00 2001 From: yxming66 <2389287465@qq.com> Date: Mon, 15 Dec 2025 23:26:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=9D=E8=AF=95=E6=96=B0=E6=9E=B6=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- User/bsp/bsp_api.c | 33 +++++++++++++++++++++++++++++++++ User/bsp/bsp_api.h | 45 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 User/bsp/bsp_api.c create mode 100644 User/bsp/bsp_api.h diff --git a/User/bsp/bsp_api.c b/User/bsp/bsp_api.c new file mode 100644 index 0000000..e799acf --- /dev/null +++ b/User/bsp/bsp_api.c @@ -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, + }, +}; + + diff --git a/User/bsp/bsp_api.h b/User/bsp/bsp_api.h new file mode 100644 index 0000000..3ae4516 --- /dev/null +++ b/User/bsp/bsp_api.h @@ -0,0 +1,45 @@ +#pragma once + +#include +#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 \ No newline at end of file