mirror of
https://github.com/esp-rs/esp-hal.git
synced 2025-09-27 20:30:35 +00:00
Disable USB pads before connecting a function (#3795)
This commit is contained in:
parent
496aeb864b
commit
9e5e643bb0
@ -42,6 +42,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Prevent bootloops when DRAM is close to being full. (#3635)
|
||||
- Fix PSRAM mapping on ESP32-S3 when the bootloader used the last page to access flash (#3637)
|
||||
- `ESP_HAL_CONFIG_STACK_GUARD_OFFSET` and `ESP_HAL_CONFIG_STACK_GUARD_VALUE` are now unstable config options (#3711)
|
||||
- Fixed MCPWM output when using USB pins (#3795)
|
||||
|
||||
### Removed
|
||||
|
||||
|
@ -417,6 +417,7 @@ impl Signal<'_> {
|
||||
.map(|(af, _)| *af)
|
||||
.unwrap_or(AlternateFunction::GPIO)
|
||||
};
|
||||
pin.disable_usb_pads();
|
||||
pin.set_alternate_function(af);
|
||||
af == AlternateFunction::GPIO
|
||||
}
|
||||
@ -466,6 +467,7 @@ impl Signal<'_> {
|
||||
.map(|(af, _)| *af)
|
||||
.unwrap_or(AlternateFunction::GPIO)
|
||||
};
|
||||
pin.disable_usb_pads();
|
||||
pin.set_alternate_function(af);
|
||||
|
||||
let use_gpio_matrix = af == AlternateFunction::GPIO;
|
||||
|
@ -1642,13 +1642,7 @@ impl<'lt> AnyPin<'lt> {
|
||||
GpioBank::_0
|
||||
}
|
||||
|
||||
#[inline]
|
||||
/// Resets the GPIO to a known state.
|
||||
///
|
||||
/// This function needs to be called before using the GPIO pin:
|
||||
/// - Before converting it into signals
|
||||
/// - Before using it as an input or output
|
||||
pub(crate) fn init_gpio(&self) {
|
||||
pub(crate) fn disable_usb_pads(&self) {
|
||||
#[cfg(soc_has_usb_device)]
|
||||
{
|
||||
/// Workaround to make D+ and D- work when the pin is assigned to
|
||||
@ -1678,8 +1672,17 @@ impl<'lt> AnyPin<'lt> {
|
||||
(USB_DP, $gpio:ident) => { disable_usb_pads!($gpio) };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
/// Resets the GPIO to a known state.
|
||||
///
|
||||
/// This function needs to be called before using the GPIO pin:
|
||||
/// - Before converting it into signals
|
||||
/// - Before using it as an input or output
|
||||
pub(crate) fn init_gpio(&self) {
|
||||
self.set_output_enable(false);
|
||||
self.disable_usb_pads();
|
||||
|
||||
GPIO::regs()
|
||||
.func_out_sel_cfg(self.number() as usize)
|
||||
|
Loading…
x
Reference in New Issue
Block a user