aboutsummaryrefslogtreecommitdiff
path: root/sys/gpio.h
blob: dd9ee3cb5148f7d23b7f38f401662dd32902c589 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#ifndef GPIO_H
#define GPIO_H

#include <stdbool.h>
#include <stdint.h>

#define INPUT 0
#define OUTPUT 1

typedef struct {
	volatile uint8_t * const ddr;
	volatile uint8_t * const port;
	volatile uint8_t * const pin;
	uint8_t num;
} pinspec;

void pin_mode(pinspec spec, bool out);
void pin_write(pinspec spec, bool value);
bool pin_read(pinspec spec);

#endif