Skip to content
Snippets Groups Projects
Unverified Commit 48c1c052 authored by Alexandre Abadie's avatar Alexandre Abadie Committed by GitHub
Browse files

Merge pull request #9375 from Hyungsin/forupstream_pulse_counter

drivers/pulse_counter: make gpio_mode configurable
parents 6fd4009b 1b734553
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment