Utility to convert hex formatted ascii to binary system types.
Dependents: Nucleo_read_hyperterminale
Homepage
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" ) ); }