X-Git-Url: http://cloudbase.mooo.com/gitweb/irmp.git/blobdiff_plain/f07dac6bedf59a1b5358827813252e1e011b73aa..ad4d3d4157a9781b6ff3f83ac72b42f8bc3db0b5:/main.c diff --git a/main.c b/main.c index ed0c2f7..1c3050b 100644 --- a/main.c +++ b/main.c @@ -1,9 +1,9 @@ /*--------------------------------------------------------------------------------------------------------------------------------------------------- * main.c - demo main module to test irmp decoder * - * Copyright (c) 2009-2014 Frank Meyer - frank(at)fli4l.de + * Copyright (c) 2009-2015 Frank Meyer - frank(at)fli4l.de * - * $Id: main.c,v 1.21 2014/09/17 09:44:47 fm Exp $ + * $Id: main.c,v 1.27 2015/02/27 10:19:20 fm Exp $ * * This demo module is runnable on AVRs and LM4F120 Launchpad (ARM Cortex M4) * @@ -20,7 +20,7 @@ #include "irmp.h" #ifndef F_CPU -#error F_CPU unkown +#error F_CPU unknown #endif /*--------------------------------------------------------------------------------------------------------------------------------------------------- @@ -51,7 +51,7 @@ #define UART0_TXEN_BIT_VALUE (1<>= 4) { - rtc = val - 10 + 'A'; + buf[digits] = "0123456789ABCDEF"[number & 0x0F]; } - return (rtc); -} - -static void -itoxx (char * xx, unsigned char i) -{ - *xx++ = itox (i >> 4); - *xx++ = itox (i & 0x0F); - *xx = '\0'; + return buf; } static void @@ -202,7 +186,7 @@ main (void) if (irmp_get_data (&irmp_data)) { uart_puts_P (PSTR("protocol: 0x")); - itoxx (buf, irmp_data.protocol); + itoh (buf, 2, irmp_data.protocol); uart_puts (buf); #if IRMP_PROTOCOL_NAMES == 1 @@ -211,19 +195,15 @@ main (void) #endif uart_puts_P (PSTR(" address: 0x")); - itoxx (buf, irmp_data.address >> 8); - uart_puts (buf); - itoxx (buf, irmp_data.address & 0xFF); + itoh (buf, 4, irmp_data.address); uart_puts (buf); uart_puts_P (PSTR(" command: 0x")); - itoxx (buf, irmp_data.command >> 8); - uart_puts (buf); - itoxx (buf, irmp_data.command & 0xFF); + itoh (buf, 4, irmp_data.command); uart_puts (buf); uart_puts_P (PSTR(" flags: 0x")); - itoxx (buf, irmp_data.flags); + itoh (buf, 2, irmp_data.flags); uart_puts (buf); uart_puts_P (PSTR("\r\n"));