Skip to content

Commit 10ab130

Browse files
authored
Deinit previous bus first (#8180)
1 parent 06a52fd commit 10ab130

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Diff for: cores/esp32/esp32-hal-dac.c

+3
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ bool __dacWrite(uint8_t pin, uint8_t value)
3232
dac_oneshot_handle_t bus = (dac_oneshot_handle_t)perimanGetPinBus(pin, ESP32_BUS_TYPE_DAC_ONESHOT);
3333
if(bus == NULL){
3434
perimanSetBusDeinit(ESP32_BUS_TYPE_DAC_ONESHOT, dacDetachBus);
35+
if(!perimanSetPinBus(pin, ESP32_BUS_TYPE_INIT, NULL)){
36+
return false;
37+
}
3538
dac_channel_t channel = (pin == DAC_CHAN0_GPIO_NUM)?DAC_CHAN_0:DAC_CHAN_1;
3639
dac_oneshot_config_t config = {
3740
.chan_id = channel

0 commit comments

Comments
 (0)