2017-05-07 04:47:04 +03:00
|
|
|
#ifndef __PRU_GPIO_H
|
|
|
|
#define __PRU_GPIO_H
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
|
|
|
struct gpio_out {
|
|
|
|
volatile uint32_t *reg;
|
|
|
|
uint32_t bit;
|
|
|
|
};
|
|
|
|
struct gpio_out gpio_out_setup(uint8_t pin, uint8_t val);
|
2018-05-16 00:04:30 +03:00
|
|
|
void gpio_out_toggle_noirq(struct gpio_out g);
|
2017-05-07 04:47:04 +03:00
|
|
|
void gpio_out_toggle(struct gpio_out g);
|
|
|
|
void gpio_out_write(struct gpio_out g, uint8_t val);
|
|
|
|
|
|
|
|
struct gpio_in {
|
|
|
|
volatile uint32_t *reg;
|
|
|
|
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);
|
|
|
|
|
2017-05-11 21:53:00 +03:00
|
|
|
struct gpio_adc {
|
|
|
|
uint8_t chan;
|
|
|
|
};
|
|
|
|
struct gpio_adc gpio_adc_setup(uint8_t pin);
|
|
|
|
uint32_t gpio_adc_sample(struct gpio_adc g);
|
|
|
|
uint16_t gpio_adc_read(struct gpio_adc g);
|
|
|
|
void gpio_adc_cancel_sample(struct gpio_adc g);
|
|
|
|
|
2017-05-07 04:47:04 +03:00
|
|
|
#endif // gpio.h
|