I successfully got characters writing to a Kentec boosterpack display from the TivaLaunchpad. However, when the values I'm writing drop by an order of magnitude I'm getting lingering digits. For example, I'll write 1546 just fine. But if that value changes to 63 then the value read on the screen is: 6346 because it did not write over the '46' portion of the 1546 number. I tried changing "%" to "%+" but it didn't work and I get errors.
If you have a better idea on how I should be clearing my value's before writing new ones please suggest something. However, I will still need to right justify the new values so that the 1's place always lines up in my displayed values. Whether or not the prepend part is blank or 0's doesn't make much of a difference to me at the moment.
As a secondary follow up: I'll eventually have to write decimal values and the way I'm converting only applies to integers. If you could suggest a way to write integers to the screen that would be great. Or if you can point me towards a resource that would be wonderful as well.
Here's how I'm writing to the screen currently:
#include <stdio.h> #include <inttypes.h> extern uint32_t Reference; extern tContext sContext; extern tRectangle sRect; char ref_buf[5]; char sample_buf[5]; void screen_update(void){ TimerIntClear(TIMER5_BASE, TIMER_TIMA_TIMEOUT); //from website: stackoverflow.com/.../how-to-convert-uint64-t-value-in-const-char-string snprintf(ref_buf,5,"%"PRIu32,Reference); //convert the integer ADC value to a const char* snprintf(sample_buf,5,"%"PRIu32,VelocityFB); //convert the integer ADC value to a const char* //Clear last displayed value by writing in black GrContextForegroundSet(&sContext, ClrBlack); GrStringDraw(&sContext, ref_buf, 6, 150, 2, 1); GrStringDraw(&sContext, sample_buf, 6, 150, 40, 1); //Write the new displayed values on the screen GrContextForegroundSet(&sContext, ClrRed); GrStringDraw(&sContext, ref_buf, 5, 150, 2, 0); GrStringDraw(&sContext, sample_buf, 5, 150, 40, 0); GrFlush(&sContext); }