本帖最后由 Qinluoyao 于 2024-6-14 17:54 编辑
STC官方的软件函数库每次编译后只能使用一个IO口,在部分情况下不是特别灵活,因此我修改了一下官方的函数库,将IO口以函数的方式调用能够更加灵活实现相关功能。
- #ifndef __SOFT_PIN_H
- #define __SOFT_PIN_H
-
- #include "config.h"
-
- typedef enum{
- PIN_LOW,
- PIN_HIGH,
- PIN_TOGGLE,
- PIN_READ
- }sPin_State_t;
-
- typedef sPin_State_t (*sPin_t)(sPin_State_t);
-
- typedef struct
- {
- sPin_t sP00, sP01, sP02, sP03, sP04, sP05, sP06, sP07;
- sPin_t sP10, sP11, sP12, sP13, sP14, sP15, sP16, sP17;
- sPin_t sP20, sP21, sP22, sP23, sP24, sP25, sP26, sP27;
- sPin_t sP30, sP31, sP32, sP33, sP34, sP35, sP36, sP37;
- sPin_t sP40, sP41, sP42, sP43, sP44, sP45, sP46, sP47;
- sPin_t sP50, sP51, sP52, sP53, sP54, sP55, sP56, sP57;
- sPin_t sP60, sP61, sP62, sP63, sP64, sP65, sP66, sP67;
- sPin_t sP70, sP71, sP72, sP73, sP74;
- }sPin_Group_t;
-
- extern sPin_Group_t xdata sPin;
-
- void sPin_Group_init(void);
-
-
- #endif // !__SOFT_PIN_H
复制代码
|