Reputation: 79
I am trying to display a uint32_t value on an LCD display (Waveshare 3.2inch TFT) connected to a STM32F407 evaluation board. The library provided by Waveshare includes a function BSP_LCD_DisplayStringAtLine. I have got this working fine for string output but when I try to send it a uint32_t value it just displays corrupt data on the LCD on the line where the value should print.
I have tried using
BSP_LCD_DisplayStringAtLine (3, (uint8_t*) Difference);
and also
BSP_LCD_DisplayStringAtLine (3, (uint8_t*) &Difference);
but generate nonsense. I think I am probably passing the variable to the function incorrectly but the documentation provided by the manufacturer is not exactly comprehensive and I'm not finding much help on Google.
Upvotes: 1
Views: 1322
Reputation: 11
You need to convert the uint32_t to a string first.
Pseudocode:
uint32_t value = 7;
uint8_t buf[16]; // pick a large enough size
u32_to_u8str(value, buf); // assuming this null terminates the string
BSP_LCD_DisplayStringAtLine(3, &buf);
This question may have useful answers.
Upvotes: 1