1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

sys: adapted to GPIO changes

This commit is contained in:
Hauke Petersen 2016-02-20 17:22:39 +01:00
parent cf3a40dc5f
commit 013eed7fa0
2 changed files with 11 additions and 12 deletions

View File

@ -25,19 +25,18 @@ extern "C" {
#include "arduino.hpp"
static inline gpio_dir_t _dir(int mode)
{
return (mode == OUTPUT) ? GPIO_DIR_OUT : GPIO_DIR_IN;
}
static inline gpio_pp_t _pr(int mode)
{
return (mode == INPUT_PULLUP) ? GPIO_PULLUP : GPIO_NOPULL;
}
void pinMode(int pin, int mode)
{
gpio_init(arduino_pinmap[pin], _dir(mode), _pr(mode));
gpio_mode_t m = GPIO_OUT;
if (mode == INPUT) {
m = GPIO_IN;
}
else if (mode == INPUT_PULLUP) {
m = GPIO_IN_PU;
}
gpio_init(arduino_pinmap[pin], m);
}
void digitalWrite(int pin, int state)

View File

@ -62,7 +62,7 @@ void auto_init_gpio(void)
saul_reg_entries[i].name = p->name;
saul_reg_entries[i].driver = &gpio_saul_driver;
/* initialize the GPIO pin */
gpio_init(p->pin, p->dir, p->pull);
gpio_init(p->pin, p->mode);
/* add to registry */
saul_reg_add(&(saul_reg_entries[i]));
}