2121#define OW_SLOT_RECOVERY 5
2222#define OW_TIMEOUT 50
2323
24+ static IRAM_ATTR bool owrxdone (rmt_channel_handle_t ch, const rmt_rx_done_event_data_t *edata, void *udata);
25+
2426
2527static rmt_symbol_word_t ow_bit0 = {
2628 .duration0 = OW_SLOT_START + OW_SLOT_BIT,
@@ -50,7 +52,7 @@ const rmt_receive_config_t owrxconf = {
5052
5153OneWire32::OneWire32 (uint8_t pin){
5254 owpin = static_cast <gpio_num_t >(pin);
53-
55+
5456 rmt_bytes_encoder_config_t bnc = {
5557 .bit0 = ow_bit0,
5658 .bit1 = ow_bit1,
@@ -68,7 +70,7 @@ OneWire32::OneWire32(uint8_t pin){
6870 if (rmt_new_copy_encoder (&cnc, &(owcenc)) != ESP_OK) {
6971 return ;
7072 }
71-
73+
7274 const rmt_rx_channel_config_t rxconf = {
7375 .gpio_num = owpin,
7476 .clk_src = RMT_CLK_SRC_DEFAULT,
@@ -112,7 +114,7 @@ OneWire32::OneWire32(uint8_t pin){
112114 if (rmt_enable (owrx) != ESP_OK) {
113115 return ;
114116 }
115-
117+
116118 if (rmt_enable (owtx) != ESP_OK) {
117119 return ;
118120 }
@@ -126,7 +128,7 @@ OneWire32::OneWire32(uint8_t pin){
126128 rmt_transmit (owtx, owcenc, &release_symbol, sizeof (rmt_symbol_word_t ), &owtxconf);
127129
128130 drv = 1 ;
129-
131+
130132}
131133
132134
@@ -160,7 +162,7 @@ bool owrxdone(rmt_channel_handle_t ch, const rmt_rx_done_event_data_t *edata, vo
160162
161163
162164bool OneWire32::reset (){
163-
165+
164166 rmt_symbol_word_t symbol_reset = {
165167 .duration0 = OW_RESET_PULSE,
166168 .level0 = 0 ,
@@ -186,13 +188,13 @@ bool OneWire32::reset(){
186188 found = true ;
187189 }
188190 }
189- }
191+ }
190192 if (rmt_tx_wait_all_done (owtx, OW_TIMEOUT) != ESP_OK) {
191193 found = false ;
192194 }
193-
195+
194196 }
195- return found;
197+ return found;
196198
197199}
198200
@@ -221,7 +223,7 @@ bool OneWire32::read(uint8_t &data, uint8_t len){
221223
222224
223225bool OneWire32::write (const uint8_t data, uint8_t len){
224-
226+
225227 if (len < 8 ){
226228 const rmt_symbol_word_t *sb;
227229 for (uint8_t i = 0 ; i < len; i++){
0 commit comments