@@ -80,9 +80,8 @@ static bool rmt_uart_process_level(uint8_t level, uint32_t duration, int bit_tic
8080{
8181 int bit_count = ROUND_CLOSEST (duration , bit_ticks );
8282 uint8_t data_bits = uart_device -> data_bits ;
83- uint8_t has_parity = (uart_device -> parity != RMT_UART_PARITY_DISABLE );
8483 uint8_t stop_bits = (uart_device -> stop_bits == RMT_UART_STOP_BITS_1 ) ? 1 : 2 ;
85- uint8_t total_bits = 1 + data_bits + has_parity + stop_bits ;
84+ uint8_t total_bits = 1 + data_bits + stop_bits ;
8685
8786 for (int i = 0 ; i < bit_count ; i ++ ) {
8887 // if the current bit is not a start bit, stop the decoding
@@ -104,23 +103,6 @@ static bool rmt_uart_process_level(uint8_t level, uint32_t duration, int bit_tic
104103 // extract the data byte
105104 uint8_t data_byte = (decode_context -> raw_data >> 1 ) & ((1 << data_bits ) - 1 );
106105
107- // check the parity
108- if (has_parity ) {
109- uint8_t parity_bit = (decode_context -> raw_data >> (1 + data_bits )) & 0x01 ;
110- uint8_t parity_calc = __builtin_parity (data_byte );
111- bool parity_ok = (uart_device -> parity == RMT_UART_PARITY_EVEN )
112- ? parity_calc == parity_bit
113- : parity_calc != parity_bit ;
114-
115- // if the parity is wrong, stop the decoding
116- if (!parity_ok ) {
117- ESP_LOGE (TAG , "Parity error @ byte %d" , decode_context -> byte_pos );
118- decode_context -> bit_pos = 0 ;
119- decode_context -> raw_data = 0 ;
120- return decode_context -> continue_on_error ;
121- }
122- }
123-
124106 // if the stop bit is wrong, stop the decoding
125107 if ((decode_context -> raw_data >> (total_bits - 1 )) != 1 ) {
126108 ESP_LOGE (TAG , "Invalid stop bit @ byte %d" , decode_context -> byte_pos );
@@ -215,7 +197,6 @@ esp_err_t rmt_new_uart_device(const rmt_uart_config_t *uart_config, rmt_uart_dev
215197 rmt_uart_device_t * uart_device = heap_caps_calloc (1 , sizeof (rmt_uart_device_t ), MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT );
216198 ESP_RETURN_ON_FALSE (uart_device , ESP_ERR_NO_MEM , TAG , "no mem for rmt_uart_device" );
217199 ESP_RETURN_ON_FALSE (uart_config -> data_bits == RMT_UART_DATA_8_BITS , ESP_ERR_INVALID_ARG , TAG , "Invalid data bits" );
218- ESP_RETURN_ON_FALSE (uart_config -> parity == RMT_UART_PARITY_DISABLE , ESP_ERR_INVALID_ARG , TAG , "Invalid parity" );
219200 uart_device -> baud_rate = uart_config -> baud_rate ;
220201 uart_device -> data_bits = uart_config -> data_bits ;
221202 uart_device -> stop_bits = uart_config -> stop_bits ;
0 commit comments