gpio driver
This commit is contained in:
@@ -1,6 +0,0 @@
|
||||
#ifndef __INC_DEF_H__
|
||||
#define __INC_DEF_H__
|
||||
|
||||
#define HELLO "Hello world!"
|
||||
|
||||
#endif // __INC_DEF_H__
|
15
inc/ftdi_dev.h
Normal file
15
inc/ftdi_dev.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#ifndef __FTDI_DEV_H__
|
||||
#define __FTDI_DEV_H__
|
||||
|
||||
#include <ftdi.h>
|
||||
|
||||
struct ftdi_dev {
|
||||
struct ftdi_context *ftdi;
|
||||
bool is_open;
|
||||
unsigned int vendor_id;
|
||||
unsigned int product_id;
|
||||
unsigned char bit_mask; /* Mask of used bits */
|
||||
unsigned char status_mask; /* Mask of current status of used bits */
|
||||
};
|
||||
|
||||
#endif
|
15
inc/gpio.h
Normal file
15
inc/gpio.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#ifndef __GPIO_H__
|
||||
#define __GPIO_H__
|
||||
|
||||
struct gpio {
|
||||
unsigned int pin;
|
||||
struct ftdi_dev *ftdi_dev;
|
||||
};
|
||||
|
||||
int gpio_open(const struct gpio *gpio);
|
||||
int gpio_close(const struct gpio *gpio);
|
||||
int gpio_read(const struct gpio *gpio, unsigned int *value);
|
||||
int gpio_write(const struct gpio *gpio, unsigned int value);
|
||||
int gpio_toggle(const struct gpio *gpio);
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user