starting bcd conversion
This commit is contained in:
@@ -2,6 +2,26 @@
|
||||
User Extensions
|
||||
*/
|
||||
|
||||
// Utility functions
|
||||
uint8_t
|
||||
dec_to_bcd(uint8_t n)
|
||||
{
|
||||
uint8_t bcd = 0;
|
||||
uint8_t tens = n / 10;
|
||||
|
||||
bcd = tens << 4;
|
||||
tens *= 10;
|
||||
bcd += (n - tens) & 0x0f;
|
||||
return bcd;
|
||||
}
|
||||
|
||||
|
||||
uint8_t
|
||||
bcd_to_dec(uint8_t n)
|
||||
{
|
||||
return ((n>>4) * 10) + (n&0x0f);
|
||||
}
|
||||
|
||||
// Definitions
|
||||
object *
|
||||
fn_now(object *args, object *env)
|
||||
|
||||
Reference in New Issue
Block a user