Add nrf52 gpio driver abstraction
This commit is contained in:
34
include/gpio.h
Normal file
34
include/gpio.h
Normal file
@@ -0,0 +1,34 @@
|
||||
#ifndef __GPIO_H__
|
||||
#define __GPIO_H__
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "driver.h"
|
||||
|
||||
#define IOCTL_CMD_SET_DIRECTION 0
|
||||
|
||||
int gpio_open(const struct driver *drv);
|
||||
int gpio_close(const struct driver *drv);
|
||||
|
||||
int gpio_read(const struct driver *drv, char *buffer, unsigned int len);
|
||||
int gpio_write(const struct driver *drv, const char *buffer, unsigned int len);
|
||||
|
||||
enum direction {
|
||||
IN = 0,
|
||||
OUT
|
||||
};
|
||||
|
||||
struct gpio {
|
||||
int pin;
|
||||
enum direction dir;
|
||||
};
|
||||
|
||||
static const struct driver_fp gpio_fp = {
|
||||
.open = gpio_open,
|
||||
.close = gpio_close,
|
||||
.read = gpio_read,
|
||||
.write = gpio_write,
|
||||
.ioctl = NULL
|
||||
};
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user