lpc176x: Add support for GPIO pins

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor
2018-05-08 12:20:10 -04:00
parent 970831ee0d
commit c78b90767f
4 changed files with 120 additions and 1 deletions

22
src/lpc176x/gpio.h Normal file
View File

@@ -0,0 +1,22 @@
#ifndef __LPC176X_GPIO_H
#define __LPC176X_GPIO_H
#include <stdint.h>
struct gpio_out {
void *regs;
uint32_t bit;
};
struct gpio_out gpio_out_setup(uint8_t pin, uint8_t val);
void gpio_out_toggle_noirq(struct gpio_out g);
void gpio_out_toggle(struct gpio_out g);
void gpio_out_write(struct gpio_out g, uint8_t val);
struct gpio_in {
void *regs;
uint32_t bit;
};
struct gpio_in gpio_in_setup(uint8_t pin, int8_t pull_up);
uint8_t gpio_in_read(struct gpio_in g);
#endif // gpio.h