BLDC control on ATAVRMC303 with ATxMega128A1
ascii.c File Reference
#include "config.h"
#include "ascii.h"
Include dependency graph for ascii.c:

Go to the source code of this file.

Functions

U8 ascii_to_bin (U8 c)
 This function returns the binary value of an ascii digit. More...
 
U8 bin_to_ascii (U8 c)
 This function returns the ascii value of a quartet. More...
 

Function Documentation

◆ ascii_to_bin()

U8 ascii_to_bin ( U8  c)

This function returns the binary value of an ascii digit.

Parameters
none
Returns
none

/

Definition at line 32 of file ascii.c.

Referenced by convert_param1(), and convert_param2().

33 {
34  if (c>='a') return(c-('a'-0x0A));
35  if (c>='A') return(c-('A'-0x0A));
36  return(c-'0');
37 }

◆ bin_to_ascii()

U8 bin_to_ascii ( U8  c)

This function returns the ascii value of a quartet.

Parameters
none
Returns
none

/

Definition at line 47 of file ascii.c.

Referenced by print_hex16().

48 {
49  if (c>=0x0A) return (c+('A'-0x0A));
50  return (c+'0');
51 }