Utility to convert hex formatted ascii to binary system types.

Dependents:   Nucleo_read_hyperterminale

Helper for parsing ASCII communications

Example

#include "mbed.h"
#include "atoh.h"

int main()
{
    uint64_t result = atoh <uint64_t> ("0123456789abcdef" );
    uint32_t lo = result & 0x00000000ffffffff;
    uint32_t hi = (result >> 32);
    printf( "0x%08X%08X\n", hi, lo );
    printf( "0x%08X\n", atoh <uint32_t> ( "12345678" ) );
    printf( "0x%04X\n", atoh <uint16_t> ( "1234" ) );
    printf( "0x%02X\n", atoh <uint8_t> ( "12" ) );
}
Revision:
1:c590c304b2fa
Parent:
0:fbac423fa3d4
--- a/atoh.h	Thu Mar 07 21:38:29 2013 +0000
+++ b/atoh.h	Wed Mar 27 15:17:57 2013 +0000
@@ -1,6 +1,6 @@
 /**
  * @file   atoh.h
- * @brief  Convert an ASCII hex string to hexadecimal - seems like the 
+ * @brief  Convert a hex formatted ASCII hex string to hex. Seems like the 
  *  std library should include this... maybe it does. Just couldn't find it
  * @author  sam grove
  * @version 1.0
@@ -25,7 +25,7 @@
 
 #include <stdint.h>
 
-/** Convert a ASCII string to it's binary equivenent
+/** Convert a hex formatted ASCII string to it's binary equivenent
  *
  * Example:
  * @code