I trying to write some bytes (>127) but uart_write_bytes() only accept const char (<128). Like this:
Code: Select all
uint8_t SS[44];
for (int16_t i = 0; i < 44; i++)
{
uart_write_bytes(UART_NUM_0, (const char*)SS[i], 1);
}
Code: Select all
uint8_t SS[44];
for (int16_t i = 0; i < 44; i++)
{
uart_write_bytes(UART_NUM_0, (const char*)SS[i], 1);
}
Code: Select all
uart_driver_install(UART, RX_BUF_SIZE, TX_BUF_SIZE, QUEUE_SIZE, &uart_queue, FLAGS);
I not understanding, This not use any parameter with const char...?chegewara wrote: ↑Wed Feb 27, 2019 7:34 pmHow did you init uart with:Code: Select all
uart_driver_install(UART, RX_BUF_SIZE, TX_BUF_SIZE, QUEUE_SIZE, &uart_queue, FLAGS);
Code: Select all
uart_driver_install(UART_NUM_0, 1024, 0, 0, NULL, 0);
Well, no logic, but workedESP_Sprite wrote: ↑Thu Feb 28, 2019 1:53 amForce-casting them to a char* should work. No specific need to add the const here, the const in this case is a promise from the function that it won't change the data a caller passes onto it.
Code: Select all
for (int16_t i = 0; i < 44; i++)
{
const char x = (int8_t)SS[i];
uart_write_bytes(UART_NUM_0, &x, 1);
}
Users browsing this forum: No registered users and 91 guests