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" ) ); }
History
Updated some documentation
2013-03-27, by sam_grove [Wed, 27 Mar 2013 15:17:57 +0000] rev 1
Updated some documentation
Cleaned up documentation and updated example
2013-03-07, by sam_grove [Thu, 07 Mar 2013 21:38:29 +0000] rev 0
Cleaned up documentation and updated example