samples: drivers: CAN: Switch to new GPIO API
Switched from deprecated gpio_pin_write to gpio_pin_set and also add the LED GPIO flags to the gpio configuration. Signed-off-by: Karsten Koenig <karsten.koenig.030@gmail.com>
This commit is contained in:
parent
4897c95462
commit
f8988808ff
1 changed files with 3 additions and 3 deletions
|
@ -90,10 +90,10 @@ void change_led(struct zcan_frame *msg, void *led_dev_param)
|
|||
|
||||
switch (msg->data[0]) {
|
||||
case SET_LED:
|
||||
gpio_pin_write(led_dev, DT_ALIAS_LED0_GPIOS_PIN, 1);
|
||||
gpio_pin_set(led_dev, DT_ALIAS_LED0_GPIOS_PIN, 1);
|
||||
break;
|
||||
case RESET_LED:
|
||||
gpio_pin_write(led_dev, DT_ALIAS_LED0_GPIOS_PIN, 0);
|
||||
gpio_pin_set(led_dev, DT_ALIAS_LED0_GPIOS_PIN, 0);
|
||||
break;
|
||||
}
|
||||
#else
|
||||
|
@ -214,7 +214,7 @@ void main(void)
|
|||
}
|
||||
|
||||
ret = gpio_pin_configure(led_gpio_dev, DT_ALIAS_LED0_GPIOS_PIN,
|
||||
GPIO_DIR_OUT);
|
||||
GPIO_OUTPUT_HIGH | DT_ALIAS_LED0_GPIOS_FLAGS);
|
||||
if (ret < 0) {
|
||||
printk("Error setting LED pin to output mode [%d]", ret);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue