Prusa MINI Firmware overview
printhex.h File Reference

Go to the source code of this file.

Functions

void E_Notifyc (char c, int lvl)
 
template<class T >
void PrintHex (T val, int lvl)
 
template<class T >
void PrintBin (T val, int lvl)
 
template<class T >
void SerialPrintHex (T val)
 
template<class T >
void PrintHex2 (Print *prn, T val)
 
template<class T >
void D_PrintHex (T val __attribute__((unused)), int lvl __attribute__((unused)))
 
template<class T >
void D_PrintBin (T val, int lvl)
 

Function Documentation

◆ E_Notifyc()

void E_Notifyc ( char  c,
int  lvl 
)

Copyright (C) 2011 Circuits At Home, LTD. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

Contact information

Circuits At Home, LTD Web : http://www.circuitsathome.com e-mail : suppo.nosp@m.rt@c.nosp@m.ircui.nosp@m.tsat.nosp@m.home..nosp@m.com

Here is the caller graph for this function:

◆ PrintHex()

template<class T >
void PrintHex ( val,
int  lvl 
)
34  {
35  int num_nibbles = sizeof (T) * 2;
36  do {
37  char v = 48 + (((val >> (num_nibbles - 1) * 4)) & 0x0f);
38  if (v > 57) v += 7;
39  E_Notifyc(v, lvl);
40  } while (--num_nibbles);
41 }
Here is the call graph for this function:

◆ PrintBin()

template<class T >
void PrintBin ( val,
int  lvl 
)
44  {
45  for (T mask = (((T)1) << ((sizeof (T) << 3) - 1)); mask; mask >>= 1)
46  E_Notifyc(val & mask ? '1' : '0', lvl);
47 }
Here is the call graph for this function:

◆ SerialPrintHex()

template<class T >
void SerialPrintHex ( val)
50  {
51  int num_nibbles = sizeof (T) * 2;
52  do {
53  char v = 48 + (((val >> (num_nibbles - 1) * 4)) & 0x0f);
54  if (v > 57) v += 7;
55  USB_HOST_SERIAL.print(v);
56  } while (--num_nibbles);
57 }

◆ PrintHex2()

template<class T >
void PrintHex2 ( Print prn,
val 
)
60  {
61  T mask = (((T)1) << (((sizeof (T) << 1) - 1) << 2));
62  while (mask > 1) {
63  if (val < mask) prn->print("0");
64  mask >>= 4;
65  }
66  prn->print((T)val, HEX);
67 }
Here is the call graph for this function:

◆ D_PrintHex()

template<class T >
void D_PrintHex ( T val   __attribute__(unused),
int lvl   __attribute__(unused) 
)
69  {
70  #ifdef DEBUG_USB_HOST
71  PrintHex<T > (val, lvl);
72  #endif
73 }

◆ D_PrintBin()

template<class T >
void D_PrintBin ( val,
int  lvl 
)
76  {
77  #ifdef DEBUG_USB_HOST
78  PrintBin<T > (val, lvl);
79  #endif
80 }
HEX
#define HEX
Definition: Print.h:30
USB_HOST_SERIAL
#define USB_HOST_SERIAL
Definition: settings.h:73
Print::print
size_t print(const __FlashStringHelper *)
Definition: Print.cpp:46
E_Notifyc
void E_Notifyc(char c, int lvl)