Printing 32 bit data using ESP_LOG or printf
Posted: Sun May 21, 2023 1:35 pm
I am reading a data from a device, the data is 32bit long and i want to print it using ESP_LOG.
Here is my code
It gives an error that "format '%X' expects argument of type 'unsigned int', but argument 6 has type 'uint32_t' {aka 'long unsigned int'} [-Werror=format=]"
How can i print it correctly, i dont want to split it and then print
Here is my code
Code: Untitled.cpp Select all
void app_main(void)
{
esp_err_t ret = nvs_flash_init();
if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
ESP_ERROR_CHECK(nvs_flash_erase());
ret = nvs_flash_init();
}
ESP_ERROR_CHECK(ret);
ESP_LOGI(TAG, "Starting up!");
//vSetGPIOlevel(GPIO_NUM_18,1);
//vSetGPIOlevel(GPIO_NUM_19,1);
spi_transaction_t spitHandler = init_spi();
while(1){
sleep(1);
uint32_t dataOut = readEMregister(0xc001,spitHandler );
ESP_LOGI(TAG, "Register is %04X " ,dataOut );
}
}
How can i print it correctly, i dont want to split it and then print