mirror of
https://github.com/olikraus/U8g2_Arduino.git
synced 2026-07-27 20:06:05 +00:00
consistency update
This commit is contained in:
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
|
||||
u8g2_u16toa.c
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "u8g2.h"
|
||||
|
||||
const char *u8g2_u16toap(char * dest, uint16_t v)
|
||||
{
|
||||
uint8_t pos;
|
||||
uint8_t d;
|
||||
uint16_t c;
|
||||
c = 10000;
|
||||
for( pos = 0; pos < 5; pos++ )
|
||||
{
|
||||
d = '0';
|
||||
while( v >= c )
|
||||
{
|
||||
v -= c;
|
||||
d++;
|
||||
}
|
||||
dest[pos] = d;
|
||||
c /= 10;
|
||||
}
|
||||
dest[5] = '\0';
|
||||
return dest;
|
||||
}
|
||||
|
||||
/* v = value, d = number of digits */
|
||||
const char *u8g2_u16toa(uint16_t v, uint8_t d)
|
||||
{
|
||||
static char buf[6];
|
||||
d = 5-d;
|
||||
return u8g2_u16toap(buf, v) + d;
|
||||
}
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
|
||||
u8g_u8toa.c
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "u8g2.h"
|
||||
|
||||
static const unsigned char u8g2_u8toa_tab[3] = { 100, 10, 1 } ;
|
||||
const char *u8g2_u8toap(char * dest, uint8_t v)
|
||||
{
|
||||
uint8_t pos;
|
||||
uint8_t d;
|
||||
uint8_t c;
|
||||
for( pos = 0; pos < 3; pos++ )
|
||||
{
|
||||
d = '0';
|
||||
c = *(u8g2_u8toa_tab+pos);
|
||||
while( v >= c )
|
||||
{
|
||||
v -= c;
|
||||
d++;
|
||||
}
|
||||
dest[pos] = d;
|
||||
}
|
||||
dest[3] = '\0';
|
||||
return dest;
|
||||
}
|
||||
|
||||
/* v = value, d = number of digits */
|
||||
const char *u8g2_u8toa(uint8_t v, uint8_t d)
|
||||
{
|
||||
static char buf[4];
|
||||
d = 3-d;
|
||||
return u8g2_u8toap(buf, v) + d;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user