#ifndef __SAM3X8E_GPIO_H #define __SAM3X8E_GPIO_H #include struct gpio_out { void *regs; uint32_t bit; }; struct gpio_out gpio_out_setup(uint8_t pin, uint8_t val); void gpio_out_reset(struct gpio_out g, 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); void gpio_in_reset(struct gpio_in g, int8_t pull_up); uint8_t gpio_in_read(struct gpio_in g); struct i2c_config { uint8_t addr; }; struct i2c_config i2c_setup(uint32_t bus, uint32_t rate, uint8_t addr); void i2c_write(struct i2c_config config, uint8_t write_len, uint8_t *write); void i2c_read(struct i2c_config config, uint8_t reg_len, uint8_t *reg , uint8_t read_len, uint8_t *read); #endif // gpio.h