Files

23 lines
548 B
C

#include <gpio_if.h>
static const gpio_ops_t* g_gpio_ops = 0;
void gpio_register_ops(const gpio_ops_t *ops) {
g_gpio_ops = ops;
}
int gpio_if_init(int ch) {
if (!g_gpio_ops || !g_gpio_ops->init)
return -1;
return g_gpio_ops->init(ch);
}
int gpio_if_write(int ch, int val) {
if (!g_gpio_ops || !g_gpio_ops->write)
return -1;
return g_gpio_ops->write(ch, val);
}
int gpio_if_read(int ch) {
if (!g_gpio_ops || !g_gpio_ops->read)
return -1;
return g_gpio_ops->read(ch);
}