串口ok
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* drv_dio.h
|
||||
*
|
||||
* Created on: Apr 28, 2024
|
||||
* Author: gxms0
|
||||
*/
|
||||
|
||||
#ifndef DRV_DRV_DIO_H_
|
||||
#define DRV_DRV_DIO_H_
|
||||
|
||||
#include "gpio.h"
|
||||
|
||||
|
||||
//#define DIO_INPUT 0x00
|
||||
//#define DIO_OUTPUT 0x01
|
||||
|
||||
typedef enum
|
||||
{
|
||||
DIO_INPUT = 0,
|
||||
DIO_OUTPUT
|
||||
}DIO_Type;
|
||||
|
||||
|
||||
typedef struct _diodef{
|
||||
|
||||
char *name;
|
||||
uint16_t channel;
|
||||
DIO_Type type;
|
||||
|
||||
uint8_t state;
|
||||
|
||||
GPIO_TypeDef* GPIOx;
|
||||
uint16_t GPIO_Pin;
|
||||
|
||||
void (*event)(void *,...);
|
||||
|
||||
|
||||
struct _diodef *next_ptr;
|
||||
|
||||
}diodef;
|
||||
|
||||
|
||||
|
||||
void dio_init(void);
|
||||
|
||||
void dio_config(diodef *e,char *name,GPIO_TypeDef* GPIOx,uint16_t GPIO_Pin,uint8_t type,uint8_t state);
|
||||
|
||||
void dio_set(uint16_t channel,uint8_t state);
|
||||
|
||||
uint8_t dio_get(uint16_t channel);
|
||||
|
||||
void dio_toggle();
|
||||
//´¥·¢Ê¼þ Ò»°ãÓÃÓÚ
|
||||
void dio_event();
|
||||
|
||||
|
||||
|
||||
#endif /* DRV_DRV_DIO_H_ */
|
||||
Reference in New Issue
Block a user