mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
drivers/pulse_counter: make gpio_mode configurable
This commit is contained in:
parent
d49e0d2f79
commit
1b7345535c
@ -38,7 +38,15 @@ static void pulse_counter_trigger(void *arg)
|
||||
/* Initialize pulse counter */
|
||||
int pulse_counter_init(pulse_counter_t *dev, const pulse_counter_params_t *params)
|
||||
{
|
||||
if (gpio_init_int(params->gpio, GPIO_IN_PU, params->gpio_flank, pulse_counter_trigger, dev)) {
|
||||
gpio_mode_t gpio_mode;
|
||||
if (params->gpio_flank == GPIO_FALLING) {
|
||||
gpio_mode = GPIO_IN_PU;
|
||||
}
|
||||
else {
|
||||
gpio_mode = GPIO_IN_PD;
|
||||
}
|
||||
|
||||
if (gpio_init_int(params->gpio, gpio_mode, params->gpio_flank, pulse_counter_trigger, dev)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user