usb_dc_stm32: Convert usb disconnect gpio to new gpio api
Convert usb disconnect gpio to new gpio api. Updates device tree for the olimexino_stm32. Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
This commit is contained in:
parent
7134f76079
commit
ee351328a4
2 changed files with 5 additions and 12 deletions
|
@ -92,7 +92,7 @@ uext_serial: &usart1 {};
|
|||
|
||||
&usb {
|
||||
status = "okay";
|
||||
disconnect-gpios = <&gpioc 12 0>;
|
||||
disconnect-gpios = <&gpioc 12 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
|
||||
&timers1 {
|
||||
|
|
|
@ -990,17 +990,10 @@ void HAL_PCDEx_SetConnectionState(PCD_HandleTypeDef *hpcd, uint8_t state)
|
|||
|
||||
usb_disconnect = device_get_binding(
|
||||
DT_INST_0_ST_STM32_USB_DISCONNECT_GPIOS_CONTROLLER);
|
||||
gpio_pin_configure(usb_disconnect,
|
||||
DT_INST_0_ST_STM32_USB_DISCONNECT_GPIOS_PIN, GPIO_DIR_OUT);
|
||||
|
||||
if (state) {
|
||||
gpio_pin_write(usb_disconnect,
|
||||
DT_INST_0_ST_STM32_USB_DISCONNECT_GPIOS_PIN,
|
||||
DT_INST_0_ST_STM32_USB_DISCONNECT_GPIOS_FLAGS);
|
||||
} else {
|
||||
gpio_pin_write(usb_disconnect,
|
||||
DT_INST_0_ST_STM32_USB_DISCONNECT_GPIOS_PIN,
|
||||
!DT_INST_0_ST_STM32_USB_DISCONNECT_GPIOS_FLAGS);
|
||||
}
|
||||
gpio_pin_configure(usb_disconnect,
|
||||
DT_INST_0_ST_STM32_USB_DISCONNECT_GPIOS_PIN,
|
||||
DT_INST_0_ST_STM32_USB_DISCONNECT_GPIOS_FLAGS |
|
||||
(state ? GPIO_OUTPUT_ACTIVE : GPIO_OUTPUT_INACTIVE));
|
||||
}
|
||||
#endif /* USB && CONFIG_USB_DC_STM32_DISCONN_ENABLE */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue