BLDC control on ATAVRMC303 with ATxMega128A1
ascii.c
Go to the documentation of this file.
1 
11 //_____ I N C L U D E S ___________________________________________________
12 
13 #include "config.h"
14 #include "ascii.h"
15 
16 //_____ M A C R O S ________________________________________________________
17 
18 //_____ D E F I N I T I O N S ______________________________________________
19 
20 //_____ D E C L A R A T I O N S ____________________________________________
21 
22 
23 
32 U8 ascii_to_bin (U8 c)
33 {
34  if (c>='a') return(c-('a'-0x0A));
35  if (c>='A') return(c-('A'-0x0A));
36  return(c-'0');
37 }
38 
47 U8 bin_to_ascii (U8 c)
48 {
49  if (c>=0x0A) return (c+('A'-0x0A));
50  return (c+'0');
51 }
U8 bin_to_ascii(U8 c)
This function returns the ascii value of a quartet.
Definition: ascii.c:47
U8 ascii_to_bin(U8 c)
This function returns the binary value of an ascii digit.
Definition: ascii.c:32