whitecatboard / Lua-RTOS-ESP32

Lua RTOS for ESP32
Other
1.2k stars 221 forks source link

Setting UART to 9 bits #185

Closed andyrbarrow closed 5 years ago

andyrbarrow commented 6 years ago

I see that you provide a means to set the UART to 9 bit data. Has this been tested?

It appears to contradict the IDE documentation which does not provide a means of setting the UART for 9 bits.

the0ne commented 5 years ago

Hi @andyrbarrow Lua-RTOS is meant as a multi-platform OS, hence the option to set different UART options.

ESP32 doesn't support 9 data bits. That's why the corresponding source code shows:

    switch (databits) {
        case 5: esp_databits = FIVE_BITS ; break;
        case 6: esp_databits = SIX_BITS  ; break;
        case 7: esp_databits = SEVEN_BITS; break;
        case 8: esp_databits = EIGHT_BITS; break;
        default:
            return driver_error(UART_DRIVER, UART_ERR_INVALID_DATA_BITS, NULL);
    }

This means that 9 data bits is not supported on the ESP32 platform and Lua-RTOS correctly throws an exception "INVALID_DATA_BITS".

the0ne commented 5 years ago

@andyrbarrow feel free to re-open in case of questions