Skip to content

Commit fa6255f

Browse files
authored
Fix UART config at OneWire init (#3035)
***NO_CI***
1 parent c3300b1 commit fa6255f

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

targets/ESP32/_nanoCLR/nanoFramework.Device.OneWire/nf_dev_onewire_nanoFramework_Device_OneWire_OneWireHost.cpp

+10-11
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ static uint8_t SerialNum[8];
1919
// Driver state.
2020
static oneWireState DriverState = ONEWIRE_UNINIT;
2121

22-
void IRAM_ATTR oneWireStop()
22+
void oneWireStop()
2323
{
2424
// stop UART
2525
uart_driver_delete(NF_ONEWIRE_ESP32_UART_NUM);
@@ -28,19 +28,18 @@ void IRAM_ATTR oneWireStop()
2828
DriverState = ONEWIRE_STOP;
2929
}
3030

31-
HRESULT IRAM_ATTR oneWireInit()
31+
HRESULT oneWireInit()
3232
{
3333
DriverState = ONEWIRE_STOP;
3434

35-
uart_config_t uart_config = {
36-
.baud_rate = 115200,
37-
.data_bits = UART_DATA_8_BITS,
38-
.parity = UART_PARITY_DISABLE,
39-
.stop_bits = UART_STOP_BITS_1,
40-
.flow_ctrl = UART_HW_FLOWCTRL_DISABLE,
41-
.rx_flow_ctrl_thresh = 0,
42-
.source_clk = UART_SCLK_DEFAULT
43-
};
35+
uart_config_t uart_config;
36+
uart_config.baud_rate = 115200;
37+
uart_config.data_bits = UART_DATA_8_BITS;
38+
uart_config.parity = UART_PARITY_DISABLE;
39+
uart_config.stop_bits = UART_STOP_BITS_1;
40+
uart_config.flow_ctrl = UART_HW_FLOWCTRL_DISABLE;
41+
uart_config.rx_flow_ctrl_thresh = 0;
42+
uart_config.source_clk = UART_SCLK_DEFAULT;
4443

4544
// get GPIO pins configured for UART assigned to 1-Wire
4645
// need to subtract one to get the correct index of UART in mapped device pins

0 commit comments

Comments
 (0)