Skip to content

Commit

Permalink
Deinit previous bus first (#8180)
Browse files Browse the repository at this point in the history
  • Loading branch information
P-R-O-C-H-Y authored May 11, 2023
1 parent 06a52fd commit 10ab130
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cores/esp32/esp32-hal-dac.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ bool __dacWrite(uint8_t pin, uint8_t value)
dac_oneshot_handle_t bus = (dac_oneshot_handle_t)perimanGetPinBus(pin, ESP32_BUS_TYPE_DAC_ONESHOT);
if(bus == NULL){
perimanSetBusDeinit(ESP32_BUS_TYPE_DAC_ONESHOT, dacDetachBus);
if(!perimanSetPinBus(pin, ESP32_BUS_TYPE_INIT, NULL)){
return false;
}
dac_channel_t channel = (pin == DAC_CHAN0_GPIO_NUM)?DAC_CHAN_0:DAC_CHAN_1;
dac_oneshot_config_t config = {
.chan_id = channel
Expand Down

0 comments on commit 10ab130

Please sign in to comment.