DeBugPrint (dbprint)
Homebrew minimal low-level println/printf replacement
dbprint.c File Reference

Homebrew println/printf replacement "DeBugPrint". More...

#include "debug_dbprint.h"
#include <stdint.h>
#include <stdbool.h>
#include "em_cmu.h"
#include "em_gpio.h"
#include "em_usart.h"

Go to the source code of this file.

Macros

#define TO_HEX(i)   (i <= 9 ? '0' + i : 'A' - 10 + i) /* "?:" = ternary operator (return ['0' + i] if [i <= 9] = true, ['A' - 10 + i] if false) */
 
#define TO_DEC(i)   (i <= 9 ? '0' + i : '?') /* return "?" if out of range */
 
#define COLOR_RED   "\x1b[31m"
 
#define COLOR_GREEN   "\x1b[32m"
 
#define COLOR_BLUE   "\x1b[34m"
 
#define COLOR_CYAN   "\x1b[36m"
 
#define COLOR_MAGENTA   "\x1b[35m"
 
#define COLOR_YELLOW   "\x1b[33m"
 
#define COLOR_RESET   "\x1b[0m"
 

Functions

static void uint32_to_charHex (char *buf, uint32_t value, bool spacing)
 Convert a uint32_t value to a hexadecimal char array (string). More...
 
static void uint32_to_charDec (char *buf, uint32_t value)
 Convert a uint32_t value to a decimal char array (string). More...
 
static uint32_t charDec_to_uint32 (char *buf)
 Convert a string (char array) in decimal notation to a uint32_t value. More...
 
void dbprint_INIT (USART_TypeDef *pointer, uint8_t location, bool vcom, bool interrupts)
 Initialize USARTx. More...
 
void dbAlert (void)
 Sound an alert in the terminal. More...
 
void dbClear (void)
 Clear the terminal. More...
 
void dbprint (char *message)
 Print a string (char array) to USARTx. More...
 
void dbprintln (char *message)
 Print a string (char array) to USARTx and go to the next line. More...
 
void dbprint_color (char *message, dbprint_color_t color)
 Print a string (char array) to USARTx in a given color. More...
 
void dbprintln_color (char *message, dbprint_color_t color)
 Print a string (char array) to USARTx in a given color and go to the next line. More...
 
void dbinfo (char *message)
 Print an info string (char array) to USARTx and go to the next line. More...
 
void dbwarn (char *message)
 Print a warning string (char array) in yellow to USARTx and go to the next line. More...
 
void dbcrit (char *message)
 Print a critical error string (char array) in red to USARTx and go to the next line. More...
 
void dbinfoInt (char *message1, int32_t value, char *message2)
 Print an info value surrounded by two strings (char array) to USARTx. More...
 
void dbwarnInt (char *message1, int32_t value, char *message2)
 Print a warning value surrounded by two strings (char array) to USARTx. More...
 
void dbcritInt (char *message1, int32_t value, char *message2)
 Print a critical value surrounded by two strings (char array) to USARTx. More...
 
void dbinfoInt_hex (char *message1, int32_t value, char *message2)
 Print an info value surrounded by two strings (char array) to USARTx. More...
 
void dbwarnInt_hex (char *message1, int32_t value, char *message2)
 Print a warning value surrounded by two strings (char array) to USARTx. More...
 
void dbcritInt_hex (char *message1, int32_t value, char *message2)
 Print a critical value surrounded by two strings (char array) to USARTx. More...
 
void dbprintInt (int32_t value)
 Print a number in decimal notation to USARTx. More...
 
void dbprintlnInt (int32_t value)
 Print a number in decimal notation to USARTx and go to the next line. More...
 
void dbprintInt_hex (int32_t value)
 Print a number in hexadecimal notation to USARTx. More...
 
void dbprintlnInt_hex (int32_t value)
 Print a number in hexadecimal notation to USARTx and go to the next line. More...
 
char dbReadChar (void)
 Read a character from USARTx. More...
 
uint8_t dbReadInt (void)
 Read a decimal character from USARTx and convert it to a uint8_t value. More...
 
void dbReadLine (char *buf)
 Read a string (char array) from USARTx. More...
 
bool dbGet_RXstatus (void)
 Check if data was received using interrupts in the RX buffer. More...
 
void dbGet_RXbuffer (char *buf)
 Get the value of the RX buffer and clear the dataReceived flag. More...
 
void USART0_RX_IRQHandler (void)
 USART0 RX interrupt service routine. More...
 
void USART0_TX_IRQHandler (void)
 USART0 TX interrupt service routine. More...
 
void USART1_RX_IRQHandler (void)
 USART1 RX interrupt service routine. More...
 
void USART1_TX_IRQHandler (void)
 USART1 TX interrupt service routine. More...
 

Variables

USART_TypeDef * dbpointer
 
volatile bool dataReceived = false
 
volatile char rx_buffer [80]
 
volatile char tx_buffer [80]
 

Detailed Description

Homebrew println/printf replacement "DeBugPrint".

Originally designed for use on the Silicion Labs Happy Gecko EFM32 board (EFM32HG322 – TQFP48).

Version
7.0
Author
Brecht Van Eeckhoudt

Versions

Please check https://github.com/Fescron/dbprint to find the latest version of dbprint!

  • v1.0: "define" used to jump between VCOM or other mode, itoa (<stdlib.h>) used aswell as stdio.h
  • v1.1: Separated printInt method in a separate function for printing "int32_t" and "uint32_t" values.
  • v1.2: Added more options to the initialize method (location selection & boolean if VCOM is used).
  • v2.0: Restructured files to be used in other projects, added a lot more documentation, added "dbAlert" and "dbClear" methods.
  • v2.1: Added interrupt functionality.
  • v2.2: Added parse functions, separated method for printing uint values in a separate one for DEC and HEX notation.
  • v2.3: Updated documentation.
  • v2.4: Fixed notes.
  • v2.5: Separated method for printing int values in a separate one for DEC and HEX notation.
  • v2.6: Stopped using itoa (<stdlib.h>) in all methods.
  • v3.0: Simplified number printing, stopped using separate methods for uint and int values.
  • v3.1: Removed useless if... check.
  • v3.2: Added the ability to print text in a color.
  • v3.3: Added info, warning and critical error printing methods.
  • v3.4: Added printInt(_hex) methods that directly go to a new line.
  • v3.5: Added USART0 IRQ handlers.
  • v3.6: Added the ability to print (u)int values as INFO, WARN or CRIT lines.
  • v3.7: Added separate "_hex" methods for dbinfo/warn/critInt instead of a boolean to select (hexa)decimal notation.
  • v3.8: Added ReadChar-Int-Line methods.
  • v3.9: Added "void" between argument brackets were before nothing was.
  • v4.0: Added more documentation.
  • v4.1: Added color reset before welcome message.
  • v5.0: Made uint-char conversion methods static, moved color functionality to enum, started moving interrupt functionality to use getters and setters.
  • v5.1: Fixed interrupt functionality with getters and setters.
  • v6.0: Cleaned up interrupt functionality and added some documentation. (put some code in comments to maybe fix later if ever necessary)
  • v6.1: Made dbpointer a local variable (removed extern). Removed extern from the documentation.
  • v6.2: Removed static before the local variables (not necessary).
  • v7.0: Updated documentation.

Todo:
Future improvements:
  • Implement dbSet_TXbuffer and charHex_to_uint32 (if necessary).
  • Add more functionality to print numbers, ...
  • Separate back-end <-> MCU specific code

License

Copyright (C) 2019 - Brecht Van Eeckhoudt

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 3 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.

A copy of the GNU General Public License can be found in the LICENSE file along with this source code.


Some methods also use code obtained from examples from Silicon Labs' GitHub. These sections are licensed under the Silabs License Agreement. See the file "Silabs_License_Agreement.txt" for details. Before using this software for any purpose, you must agree to the terms of that agreement.


Attention
See the file dbprint_documentation.h for a lot of useful documentation!

Definition in file dbprint.c.

Macro Definition Documentation

◆ COLOR_BLUE

#define COLOR_BLUE   "\x1b[34m"

Definition at line 108 of file dbprint.c.

◆ COLOR_CYAN

#define COLOR_CYAN   "\x1b[36m"

Definition at line 109 of file dbprint.c.

◆ COLOR_GREEN

#define COLOR_GREEN   "\x1b[32m"

Definition at line 107 of file dbprint.c.

◆ COLOR_MAGENTA

#define COLOR_MAGENTA   "\x1b[35m"

Definition at line 110 of file dbprint.c.

◆ COLOR_RED

#define COLOR_RED   "\x1b[31m"

Definition at line 106 of file dbprint.c.

◆ COLOR_RESET

#define COLOR_RESET   "\x1b[0m"

Definition at line 112 of file dbprint.c.

◆ COLOR_YELLOW

#define COLOR_YELLOW   "\x1b[33m"

Definition at line 111 of file dbprint.c.

◆ TO_DEC

#define TO_DEC (   i)    (i <= 9 ? '0' + i : '?') /* return "?" if out of range */

Definition at line 103 of file dbprint.c.

◆ TO_HEX

#define TO_HEX (   i)    (i <= 9 ? '0' + i : 'A' - 10 + i) /* "?:" = ternary operator (return ['0' + i] if [i <= 9] = true, ['A' - 10 + i] if false) */

Definition at line 102 of file dbprint.c.

Function Documentation

◆ charDec_to_uint32()

static uint32_t charDec_to_uint32 ( char *  buf)
static

Convert a string (char array) in decimal notation to a uint32_t value.

Note
If the input is not a string (ex.: "00BA0FA1") but a char array, the input buffer (array) needs to end with NULL ("\0")!
This is a static method because it's only internally used in this file and called by other methods if necessary.
Parameters
[in]bufThe decimal string to convert to a uint32_t value.
Returns
The resulting uint32_t value.

Definition at line 1186 of file dbprint.c.

1187 {
1188  /* Value to eventually return */
1189  uint32_t value = 0;
1190 
1191  /* Loop until buffer is empty */
1192  while (*buf)
1193  {
1194  /* Get current character, increment afterwards */
1195  uint8_t byte = *buf++;
1196 
1197  /* Check if the next value we need to add can fit in a uint32_t */
1198  if ( (value <= 0xFFFFFFF) && ((byte - '0') <= 0xF) )
1199  {
1200  /* Convert the ASCII (decimal) character to the representing decimal value
1201  * and add it to the value (which is multiplied by 10 for each position) */
1202  value = (value * 10) + (byte - '0');
1203  }
1204  else
1205  {
1206  /* Given buffer can't fit in uint32_t */
1207  return (0);
1208  }
1209  }
1210 
1211  return (value);
1212 }

◆ dbAlert()

void dbAlert ( void  )

Sound an alert in the terminal.

Print the bell (alert) character to USARTx.

Definition at line 344 of file dbprint.c.

345 {
346  USART_Tx(dbpointer, '\a');
347 }
USART_TypeDef * dbpointer
Definition: dbprint.c:116

◆ dbClear()

void dbClear ( void  )

Clear the terminal.

Print the form feed character to USARTx. Accessing old data is still possible by scrolling up in the serial port program.

Definition at line 358 of file dbprint.c.

359 {
360  USART_Tx(dbpointer, '\f');
361 }
USART_TypeDef * dbpointer
Definition: dbprint.c:116

◆ dbcrit()

void dbcrit ( char *  message)

Print a critical error string (char array) in red to USARTx and go to the next line.

Note
If the input is not a string (ex.: "Hello world!") but a char array, the input message (array) needs to end with NULL ("\0")!
Parameters
[in]messageThe string to print to USARTx.

Definition at line 541 of file dbprint.c.

542 {
543  dbprint_color("CRIT: ", RED);
544  dbprintln_color(message, RED);
545 }
Definition: dbprint.h:54
void dbprintln_color(char *message, dbprint_color_t color)
Print a string (char array) to USARTx in a given color and go to the next line.
Definition: dbprint.c:482
void dbprint_color(char *message, dbprint_color_t color)
Print a string (char array) to USARTx in a given color.
Definition: dbprint.c:423

◆ dbcritInt()

void dbcritInt ( char *  message1,
int32_t  value,
char *  message2 
)

Print a critical value surrounded by two strings (char array) to USARTx.

"CRIT: " gets added in front, the decimal notation is used and the function advances to the next line. The value is in the color white, the rest is red.

Note
If the input is not a string (ex.: "Hello world!") but a char array, the input message (array) needs to end with NULL ("\0")!
Parameters
[in]message1The first part of the string to print to USARTx.
[in]valueThe value to print between the two string parts.
[in]message2The second part of the string to print to USARTx.

Definition at line 631 of file dbprint.c.

632 {
633  dbprint_color("CRIT: ", RED);
634  dbprint_color(message1, RED);
635  dbprintInt(value);
636  dbprintln_color(message2, RED);
637 }
Definition: dbprint.h:54
void dbprintInt(int32_t value)
Print a number in decimal notation to USARTx.
Definition: dbprint.c:740
void dbprintln_color(char *message, dbprint_color_t color)
Print a string (char array) to USARTx in a given color and go to the next line.
Definition: dbprint.c:482
void dbprint_color(char *message, dbprint_color_t color)
Print a string (char array) to USARTx in a given color.
Definition: dbprint.c:423

◆ dbcritInt_hex()

void dbcritInt_hex ( char *  message1,
int32_t  value,
char *  message2 
)

Print a critical value surrounded by two strings (char array) to USARTx.

"CRIT: " gets added in front, the hexadecimal notation is used and the function advances to the next line. The value is in the color white, the rest is red.

Note
If the input is not a string (ex.: "Hello world!") but a char array, the input message (array) needs to end with NULL ("\0")!
Parameters
[in]message1The first part of the string to print to USARTx.
[in]valueThe value to print between the two string parts.
[in]message2The second part of the string to print to USARTx.

Definition at line 723 of file dbprint.c.

724 {
725  dbprint_color("CRIT: ", RED);
726  dbprint_color(message1, RED);
727  dbprintInt_hex(value);
728  dbprintln_color(message2, RED);
729 }
Definition: dbprint.h:54
void dbprintInt_hex(int32_t value)
Print a number in hexadecimal notation to USARTx.
Definition: dbprint.c:796
void dbprintln_color(char *message, dbprint_color_t color)
Print a string (char array) to USARTx in a given color and go to the next line.
Definition: dbprint.c:482
void dbprint_color(char *message, dbprint_color_t color)
Print a string (char array) to USARTx in a given color.
Definition: dbprint.c:423

◆ dbGet_RXbuffer()

void dbGet_RXbuffer ( char *  buf)

Get the value of the RX buffer and clear the dataReceived flag.

Note
The index of the RX buffer gets reset in the RX handler when a CR character is received or the buffer is filled.
Attention
Interrupt functionality has to be enabled on initialization for this function to work correctly.
Parameters
[in]bufThe buffer to put the resulting string in.
This needs to have a length of DBPRINT_BUFFER_SIZE for the function to work properly: char buf[DBPRINT_BUFFER_SIZE];!

Definition at line 1019 of file dbprint.c.

1020 {
1021  if (dataReceived)
1022  {
1023  uint32_t i;
1024 
1025  /* Copy data from the RX buffer to the given buffer */
1026  for (i = 0; rx_buffer[i] != 0 && i < DBPRINT_BUFFER_SIZE-1; i++)
1027  {
1028  buf[i] = rx_buffer[i];
1029  }
1030 
1031  /* Add NULL termination character */
1032  buf[i++] = '\0';
1033 
1034  /* Reset "notification" variable */
1035  dataReceived = false;
1036  }
1037  else
1038  {
1039  dbcrit("No received data available!");
1040  }
1041 }
volatile bool dataReceived
Definition: dbprint.c:120
volatile char rx_buffer[80]
Definition: dbprint.c:121
#define DBPRINT_BUFFER_SIZE
Definition: dbprint.h:48
void dbcrit(char *message)
Print a critical error string (char array) in red to USARTx and go to the next line.
Definition: dbprint.c:541

◆ dbGet_RXstatus()

bool dbGet_RXstatus ( void  )

Check if data was received using interrupts in the RX buffer.

Note
The index of the RX buffer gets reset in the RX handler when a CR character is received or the buffer is filled.
Attention
Interrupt functionality has to be enabled on initialization for this function to work correctly.
Returns
  • true - Data is received in the RX buffer.
  • false - No data is received.

Definition at line 911 of file dbprint.c.

912 {
913  return (dataReceived);
914 }
volatile bool dataReceived
Definition: dbprint.c:120

◆ dbinfo()

void dbinfo ( char *  message)

Print an info string (char array) to USARTx and go to the next line.

Note
If the input is not a string (ex.: "Hello world!") but a char array, the input message (array) needs to end with NULL ("\0")!
Parameters
[in]messageThe string to print to USARTx.

Definition at line 505 of file dbprint.c.

506 {
507  dbprint("INFO: ");
508  dbprintln(message);
509 }
void dbprint(char *message)
Print a string (char array) to USARTx.
Definition: dbprint.c:375
void dbprintln(char *message)
Print a string (char array) to USARTx and go to the next line.
Definition: dbprint.c:397

◆ dbinfoInt()

void dbinfoInt ( char *  message1,
int32_t  value,
char *  message2 
)

Print an info value surrounded by two strings (char array) to USARTx.

"INFO: " gets added in front, the decimal notation is used and the function advances to the next line.

Note
If the input is not a string (ex.: "Hello world!") but a char array, the input message (array) needs to end with NULL ("\0")!
Parameters
[in]message1The first part of the string to print to USARTx.
[in]valueThe value to print between the two string parts.
[in]message2The second part of the string to print to USARTx.

Definition at line 569 of file dbprint.c.

570 {
571  dbprint("INFO: ");
572  dbprint(message1);
573  dbprintInt(value);
574  dbprintln(message2);
575 }
void dbprint(char *message)
Print a string (char array) to USARTx.
Definition: dbprint.c:375
void dbprintln(char *message)
Print a string (char array) to USARTx and go to the next line.
Definition: dbprint.c:397
void dbprintInt(int32_t value)
Print a number in decimal notation to USARTx.
Definition: dbprint.c:740

◆ dbinfoInt_hex()

void dbinfoInt_hex ( char *  message1,
int32_t  value,
char *  message2 
)

Print an info value surrounded by two strings (char array) to USARTx.

"INFO: " gets added in front, the hexadecimal notation is used and the function advances to the next line.

Note
If the input is not a string (ex.: "Hello world!") but a char array, the input message (array) needs to end with NULL ("\0")!
Parameters
[in]message1The first part of the string to print to USARTx.
[in]valueThe value to print between the two string parts.
[in]message2The second part of the string to print to USARTx.

Definition at line 661 of file dbprint.c.

662 {
663  dbprint("INFO: ");
664  dbprint(message1);
665  dbprintInt_hex(value);
666  dbprintln(message2);
667 }
void dbprint(char *message)
Print a string (char array) to USARTx.
Definition: dbprint.c:375
void dbprintln(char *message)
Print a string (char array) to USARTx and go to the next line.
Definition: dbprint.c:397
void dbprintInt_hex(int32_t value)
Print a number in hexadecimal notation to USARTx.
Definition: dbprint.c:796

◆ dbprint()

void dbprint ( char *  message)

Print a string (char array) to USARTx.

Note
If the input is not a string (ex.: "Hello world!") but a char array, the input message (array) needs to end with NULL ("\0")!
Parameters
[in]messageThe string to print to USARTx.

Definition at line 375 of file dbprint.c.

376 {
377  /* "message[i] != 0" makes "uint32_t length = strlen(message)"
378  * not necessary (given string MUST be terminated by NULL for this to work) */
379  for (uint32_t i = 0; message[i] != 0; i++)
380  {
381  USART_Tx(dbpointer, message[i]);
382  }
383 }
USART_TypeDef * dbpointer
Definition: dbprint.c:116

◆ dbprint_color()

void dbprint_color ( char *  message,
dbprint_color_t  color 
)

Print a string (char array) to USARTx in a given color.

Note
If the input is not a string (ex.: "Hello world!") but a char array, the input message (array) needs to end with NULL ("\0")!
Parameters
[in]messageThe string to print to USARTx.
[in]colorThe color to print the text in.

Definition at line 423 of file dbprint.c.

424 {
425  switch (color)
426  {
427  case DEFAULT_COLOR:
429  dbprint(message);
430  break;
431  case RED:
433  dbprint(message);
435  break;
436  case GREEN:
438  dbprint(message);
440  break;
441  case BLUE:
443  dbprint(message);
445  break;
446  case CYAN:
448  dbprint(message);
450  break;
451  case MAGENTA:
453  dbprint(message);
455  break;
456  case YELLOW:
458  dbprint(message);
460  break;
461  default:
463  dbprint(message);
464  }
465 }
Definition: dbprint.h:57
#define COLOR_GREEN
Definition: dbprint.c:107
void dbprint(char *message)
Print a string (char array) to USARTx.
Definition: dbprint.c:375
#define COLOR_YELLOW
Definition: dbprint.c:111
Definition: dbprint.h:54
#define COLOR_MAGENTA
Definition: dbprint.c:110
#define COLOR_RED
Definition: dbprint.c:106
Definition: dbprint.h:55
Definition: dbprint.h:59
Definition: dbprint.h:56
#define COLOR_BLUE
Definition: dbprint.c:108
#define COLOR_CYAN
Definition: dbprint.c:109
#define COLOR_RESET
Definition: dbprint.c:112

◆ dbprint_INIT()

void dbprint_INIT ( USART_TypeDef *  pointer,
uint8_t  location,
bool  vcom,
bool  interrupts 
)

Initialize USARTx.

Parameters
[in]pointerPointer to USARTx.
[in]locationLocation for pin routing.
[in]vcom
  • true - Isolation switch enabled by setting PA9 high so the Virtual COM port (CDC) can be used.
  • false - Isolation switch disabled on the Happy Gecko board.
[in]interrupts
  • true - Enable interrupt functionality.
  • false - No interrupt functionality is initialized.

Definition at line 150 of file dbprint.c.

151 {
152  /* Store the pointer in the global variable */
153  dbpointer = pointer;
154 
155  /*
156  * USART_INITASYNC_DEFAULT:
157  * config.enable = usartEnable // Specifies whether TX and/or RX is enabled when initialization is completed
158  * // (Enable RX/TX when initialization is complete).
159  * config.refFreq = 0 // USART/UART reference clock assumed when configuring baud rate setup
160  * // (0 = Use current configured reference clock for configuring baud rate).
161  * config.baudrate = 115200 // Desired baudrate (115200 bits/s).
162  * config.oversampling = usartOVS16 // Oversampling used (16x oversampling).
163  * config.databits = usartDatabits8 // Number of data bits in frame (8 data bits).
164  * config.parity = usartNoParity // Parity mode to use (no parity).
165  * config.stopbits = usartStopbits1 // Number of stop bits to use (1 stop bit).
166  * config.mvdis = false // Majority Vote Disable for 16x, 8x and 6x oversampling modes (Do not disable majority vote).
167  * config.prsRxEnable = false // Enable USART Rx via PRS (Not USART PRS input mode).
168  * config.prsRxCh = 0 // Select PRS channel for USART Rx. (Only valid if prsRxEnable is true - PRS channel 0).
169  * config.autoCsEnable = false // Auto CS enabling (Auto CS functionality enable/disable switch - disabled).
170  */
171 
172  USART_InitAsync_TypeDef config = USART_INITASYNC_DEFAULT;
173 
174  /* Enable oscillator to GPIO*/
175  CMU_ClockEnable(cmuClock_GPIO, true);
176 
177 
178  /* Enable oscillator to USARTx modules */
179  if (dbpointer == USART0)
180  {
181  CMU_ClockEnable(cmuClock_USART0, true);
182  }
183  else if (dbpointer == USART1)
184  {
185  CMU_ClockEnable(cmuClock_USART1, true);
186  }
187 
188 
189  /* Set PA9 (EFM_BC_EN) high if necessary to enable the isolation switch */
190  if (vcom)
191  {
192  GPIO_PinModeSet(gpioPortA, 9, gpioModePushPull, 1);
193  GPIO_PinOutSet(gpioPortA, 9);
194  }
195 
196 
197  /* Set pin modes for UART TX and RX pins */
198  if (dbpointer == USART0)
199  {
200  switch (location)
201  {
202  case 0:
203  GPIO_PinModeSet(gpioPortE, 11, gpioModeInput, 0); /* RX */
204  GPIO_PinModeSet(gpioPortE, 10, gpioModePushPull, 1); /* TX */
205  break;
206  case 2:
207  GPIO_PinModeSet(gpioPortC, 10, gpioModeInput, 0); /* RX */
208  /* No TX pin in this mode */
209  break;
210  case 3:
211  GPIO_PinModeSet(gpioPortE, 12, gpioModeInput, 0); /* RX */
212  GPIO_PinModeSet(gpioPortE, 13, gpioModePushPull, 1); /* TX */
213  break;
214  case 4:
215  GPIO_PinModeSet(gpioPortB, 8, gpioModeInput, 0); /* RX */
216  GPIO_PinModeSet(gpioPortB, 7, gpioModePushPull, 1); /* TX */
217  break;
218  case 5:
219  case 6:
220  GPIO_PinModeSet(gpioPortC, 1, gpioModeInput, 0); /* RX */
221  GPIO_PinModeSet(gpioPortC, 0, gpioModePushPull, 1); /* TX */
222  break;
223  /* default: */
224  /* No default */
225  }
226  }
227  else if (dbpointer == USART1)
228  {
229  switch (location)
230  {
231  case 0:
232  GPIO_PinModeSet(gpioPortC, 1, gpioModeInput, 0); /* RX */
233  GPIO_PinModeSet(gpioPortC, 0, gpioModePushPull, 1); /* TX */
234  break;
235  case 2:
236  case 3:
237  GPIO_PinModeSet(gpioPortD, 6, gpioModeInput, 0); /* RX */
238  GPIO_PinModeSet(gpioPortD, 7, gpioModePushPull, 1); /* TX */
239  break;
240  case 4:
241  GPIO_PinModeSet(gpioPortA, 0, gpioModeInput, 0); /* RX */
242  GPIO_PinModeSet(gpioPortF, 2, gpioModePushPull, 1); /* TX */
243  break;
244  case 5:
245  GPIO_PinModeSet(gpioPortC, 2, gpioModeInput, 0); /* RX */
246  GPIO_PinModeSet(gpioPortC, 1, gpioModePushPull, 1); /* TX */
247  break;
248  /* default: */
249  /* No default */
250  }
251  }
252 
253 
254  /* Initialize USART asynchronous mode */
255  USART_InitAsync(dbpointer, &config);
256 
257  /* Route pins */
258  switch (location)
259  {
260  case 0:
261  dbpointer->ROUTE |= USART_ROUTE_TXPEN | USART_ROUTE_RXPEN | USART_ROUTE_LOCATION_LOC0;
262  break;
263  case 1:
264  dbpointer->ROUTE |= USART_ROUTE_TXPEN | USART_ROUTE_RXPEN | USART_ROUTE_LOCATION_LOC1;
265  break;
266  case 2:
267  dbpointer->ROUTE |= USART_ROUTE_TXPEN | USART_ROUTE_RXPEN | USART_ROUTE_LOCATION_LOC2;
268  break;
269  case 3:
270  dbpointer->ROUTE |= USART_ROUTE_TXPEN | USART_ROUTE_RXPEN | USART_ROUTE_LOCATION_LOC3;
271  break;
272  case 4:
273  dbpointer->ROUTE |= USART_ROUTE_TXPEN | USART_ROUTE_RXPEN | USART_ROUTE_LOCATION_LOC4;
274  break;
275  case 5:
276  dbpointer->ROUTE |= USART_ROUTE_TXPEN | USART_ROUTE_RXPEN | USART_ROUTE_LOCATION_LOC5;
277  break;
278  case 6:
279  dbpointer->ROUTE |= USART_ROUTE_TXPEN | USART_ROUTE_RXPEN | USART_ROUTE_LOCATION_LOC6;
280  break;
281  default:
282  dbpointer->ROUTE |= USART_ROUTE_TXPEN | USART_ROUTE_RXPEN | USART_ROUTE_LOCATION_DEFAULT;
283  }
284 
285  /* Enable interrupts if necessary and print welcome string (and make an alert sound in the console) */
286  if (interrupts)
287  {
288  /* Initialize USART interrupts */
289 
290  /* RX Data Valid Interrupt Enable
291  * Set when data is available in the receive buffer. Cleared when the receive buffer is empty. */
292  USART_IntEnable(dbpointer, USART_IEN_RXDATAV);
293 
294  /* TX Complete Interrupt Enable
295  * Set when a transmission has completed and no more data is available in the transmit buffer.
296  * Cleared when a new transmission starts. */
297  USART_IntEnable(dbpointer, USART_IEN_TXC);
298 
299  if (dbpointer == USART0)
300  {
301  /* Enable USART interrupts */
302  NVIC_EnableIRQ(USART0_RX_IRQn);
303  NVIC_EnableIRQ(USART0_TX_IRQn);
304  }
305  else if (dbpointer == USART1)
306  {
307  /* Enable USART interrupts */
308  NVIC_EnableIRQ(USART1_RX_IRQn);
309  NVIC_EnableIRQ(USART1_TX_IRQn);
310  }
311 
312  /* Print welcome string */
314  dbprintln("\a\r\f### UART initialized (interrupt mode) ###");
315  dbinfo("This is an info message.");
316  dbwarn("This is a warning message.");
317  dbcrit("This is a critical error message.");
318  dbprintln("### Start executing programmed code ###\n");
319 
320  /* Set TX Complete Interrupt Flag (transmission has completed and no more data
321  * is available in the transmit buffer) */
322  USART_IntSet(dbpointer, USART_IFS_TXC);
323  }
324  /* Print welcome string (and make an alert sound in the console) if not in interrupt mode */
325  else
326  {
328  dbprintln("\a\r\f### UART initialized (no interrupts) ###");
329  dbinfo("This is an info message.");
330  dbwarn("This is a warning message.");
331  dbcrit("This is a critical error message.");
332  dbprintln("### Start executing programmed code ###\n");
333  }
334 }
void dbprint(char *message)
Print a string (char array) to USARTx.
Definition: dbprint.c:375
void dbprintln(char *message)
Print a string (char array) to USARTx and go to the next line.
Definition: dbprint.c:397
void dbwarn(char *message)
Print a warning string (char array) in yellow to USARTx and go to the next line.
Definition: dbprint.c:523
void dbinfo(char *message)
Print an info string (char array) to USARTx and go to the next line.
Definition: dbprint.c:505
USART_TypeDef * dbpointer
Definition: dbprint.c:116
#define COLOR_RESET
Definition: dbprint.c:112
void dbcrit(char *message)
Print a critical error string (char array) in red to USARTx and go to the next line.
Definition: dbprint.c:541

◆ dbprintInt()

void dbprintInt ( int32_t  value)

Print a number in decimal notation to USARTx.

Parameters
[in]valueThe number to print to USARTx.
This can be of type uint32_t or int32_t.

Definition at line 740 of file dbprint.c.

741 {
742  /* Buffer to put the char array in (Needs to be 10) */
743  char decchar[10];
744 
745  /* Convert a negative number to a positive one and print the "-" */
746  if (value < 0)
747  {
748  /* Negative of value = flip all bits, +1
749  * bitwise logic: "~" = "NOT" */
750  uint32_t negativeValue = (~value) + 1;
751 
752  dbprint("-");
753 
754  /* Convert the value */
755  uint32_to_charDec(decchar, negativeValue);
756  }
757  else
758  {
759  /* Convert the value */
760  uint32_to_charDec(decchar, value);
761  }
762 
763  /* Print the buffer */
764  dbprint(decchar);
765 }
void dbprint(char *message)
Print a string (char array) to USARTx.
Definition: dbprint.c:375
static void uint32_to_charDec(char *buf, uint32_t value)
Convert a uint32_t value to a decimal char array (string).
Definition: dbprint.c:1124

◆ dbprintInt_hex()

void dbprintInt_hex ( int32_t  value)

Print a number in hexadecimal notation to USARTx.

Parameters
[in]valueThe number to print to USARTx.
This can be of type uint32_t or int32_t.

Definition at line 796 of file dbprint.c.

797 {
798  char hexchar[9]; /* Needs to be 9 */
799  uint32_to_charHex(hexchar, value, true); /* true: add spacing between eight HEX chars */
800  dbprint("0x");
801  dbprint(hexchar);
802 }
void dbprint(char *message)
Print a string (char array) to USARTx.
Definition: dbprint.c:375
static void uint32_to_charHex(char *buf, uint32_t value, bool spacing)
Convert a uint32_t value to a hexadecimal char array (string).
Definition: dbprint.c:1063

◆ dbprintln()

void dbprintln ( char *  message)

Print a string (char array) to USARTx and go to the next line.

Note
If the input is not a string (ex.: "Hello world!") but a char array, the input message (array) needs to end with NULL ("\0")!
Parameters
[in]messageThe string to print to USARTx.

Definition at line 397 of file dbprint.c.

398 {
399  dbprint(message);
400 
401  /* Carriage return */
402  USART_Tx(dbpointer, '\r');
403 
404  /* Line feed (new line) */
405  USART_Tx(dbpointer, '\n');
406 }
void dbprint(char *message)
Print a string (char array) to USARTx.
Definition: dbprint.c:375
USART_TypeDef * dbpointer
Definition: dbprint.c:116

◆ dbprintln_color()

void dbprintln_color ( char *  message,
dbprint_color_t  color 
)

Print a string (char array) to USARTx in a given color and go to the next line.

Note
If the input is not a string (ex.: "Hello world!") but a char array, the input message (array) needs to end with NULL ("\0")!
Parameters
[in]messageThe string to print to USARTx.
[in]colorThe color to print the text in.

Definition at line 482 of file dbprint.c.

483 {
484  dbprint_color(message, color);
485 
486  /* Carriage return */
487  USART_Tx(dbpointer, '\r');
488 
489  /* Line feed (new line) */
490  USART_Tx(dbpointer, '\n');
491 }
USART_TypeDef * dbpointer
Definition: dbprint.c:116
void dbprint_color(char *message, dbprint_color_t color)
Print a string (char array) to USARTx in a given color.
Definition: dbprint.c:423

◆ dbprintlnInt()

void dbprintlnInt ( int32_t  value)

Print a number in decimal notation to USARTx and go to the next line.

Parameters
[in]valueThe number to print to USARTx.
This can be of type uint32_t or int32_t.

Definition at line 776 of file dbprint.c.

777 {
778  dbprintInt(value);
779 
780  /* Carriage return */
781  USART_Tx(dbpointer, '\r');
782 
783  /* Line feed (new line) */
784  USART_Tx(dbpointer, '\n');
785 }
USART_TypeDef * dbpointer
Definition: dbprint.c:116
void dbprintInt(int32_t value)
Print a number in decimal notation to USARTx.
Definition: dbprint.c:740

◆ dbprintlnInt_hex()

void dbprintlnInt_hex ( int32_t  value)

Print a number in hexadecimal notation to USARTx and go to the next line.

Parameters
[in]valueThe number to print to USARTx.
This can be of type uint32_t or int32_t.

Definition at line 813 of file dbprint.c.

814 {
815  dbprintInt_hex(value);
816 
817  /* Carriage return */
818  USART_Tx(dbpointer, '\r');
819 
820  /* Line feed (new line) */
821  USART_Tx(dbpointer, '\n');
822 }
USART_TypeDef * dbpointer
Definition: dbprint.c:116
void dbprintInt_hex(int32_t value)
Print a number in hexadecimal notation to USARTx.
Definition: dbprint.c:796

◆ dbReadChar()

char dbReadChar ( void  )

Read a character from USARTx.

Returns
The character read from USARTx.

Definition at line 832 of file dbprint.c.

833 {
834  return (USART_Rx(dbpointer));
835 }
USART_TypeDef * dbpointer
Definition: dbprint.c:116

◆ dbReadInt()

uint8_t dbReadInt ( void  )

Read a decimal character from USARTx and convert it to a uint8_t value.

Note
Specific methods exist to read uint16_t and uint32_t values:
  • uint16_t USART_RxDouble(USART_TypeDef *usart);
  • uint32_t USART_RxDoubleExt(USART_TypeDef *usart);
Returns
The converted uint8_t value.

Definition at line 850 of file dbprint.c.

851 {
852  /* Method expects a char array ending with a null termination character */
853  char value[2];
854  value[0]= dbReadChar();
855  value[1] = '\0';
856 
857  return (charDec_to_uint32(value));
858 }
static uint32_t charDec_to_uint32(char *buf)
Convert a string (char array) in decimal notation to a uint32_t value.
Definition: dbprint.c:1186
char dbReadChar(void)
Read a character from USARTx.
Definition: dbprint.c:832

◆ dbReadLine()

void dbReadLine ( char *  buf)

Read a string (char array) from USARTx.

Note
The reading stops when a "CR" (Carriage Return, ENTER) character is received or the maximum length (DBPRINT_BUFFER_SIZE) is reached.
Parameters
[in]bufThe buffer to put the resulting string in.
This needs to have a length of DBPRINT_BUFFER_SIZE for the function to work properly: char buf[DBPRINT_BUFFER_SIZE];!

Definition at line 874 of file dbprint.c.

875 {
876  for (uint32_t i = 0; i < DBPRINT_BUFFER_SIZE - 1 ; i++ )
877  {
878  char localBuffer = USART_Rx(dbpointer);
879 
880  /* Check if a CR character is received */
881  if (localBuffer == '\r')
882  {
883  /* End with a null termination character, expected by the dbprintln method */
884  buf[i] = '\0';
885  break;
886  }
887  else
888  {
889  buf[i] = localBuffer;
890  }
891  }
892 }
USART_TypeDef * dbpointer
Definition: dbprint.c:116
#define DBPRINT_BUFFER_SIZE
Definition: dbprint.h:48

◆ dbwarn()

void dbwarn ( char *  message)

Print a warning string (char array) in yellow to USARTx and go to the next line.

Note
If the input is not a string (ex.: "Hello world!") but a char array, the input message (array) needs to end with NULL ("\0")!
Parameters
[in]messageThe string to print to USARTx.

Definition at line 523 of file dbprint.c.

524 {
525  dbprint_color("WARN: ", YELLOW);
526  dbprintln_color(message, YELLOW);
527 }
Definition: dbprint.h:59
void dbprintln_color(char *message, dbprint_color_t color)
Print a string (char array) to USARTx in a given color and go to the next line.
Definition: dbprint.c:482
void dbprint_color(char *message, dbprint_color_t color)
Print a string (char array) to USARTx in a given color.
Definition: dbprint.c:423

◆ dbwarnInt()

void dbwarnInt ( char *  message1,
int32_t  value,
char *  message2 
)

Print a warning value surrounded by two strings (char array) to USARTx.

"WARN: " gets added in front, the decimal notation is used and the function advances to the next line. The value is in the color white, the rest is yellow.

Note
If the input is not a string (ex.: "Hello world!") but a char array, the input message (array) needs to end with NULL ("\0")!
Parameters
[in]message1The first part of the string to print to USARTx.
[in]valueThe value to print between the two string parts.
[in]message2The second part of the string to print to USARTx.

Definition at line 600 of file dbprint.c.

601 {
602  dbprint_color("WARN: ", YELLOW);
603  dbprint_color(message1, YELLOW);
604  dbprintInt(value);
605  dbprintln_color(message2, YELLOW);
606 }
Definition: dbprint.h:59
void dbprintInt(int32_t value)
Print a number in decimal notation to USARTx.
Definition: dbprint.c:740
void dbprintln_color(char *message, dbprint_color_t color)
Print a string (char array) to USARTx in a given color and go to the next line.
Definition: dbprint.c:482
void dbprint_color(char *message, dbprint_color_t color)
Print a string (char array) to USARTx in a given color.
Definition: dbprint.c:423

◆ dbwarnInt_hex()

void dbwarnInt_hex ( char *  message1,
int32_t  value,
char *  message2 
)

Print a warning value surrounded by two strings (char array) to USARTx.

"WARN: " gets added in front, the hexadecimal notation is used and the function advances to the next line. The value is in the color white, the rest is yellow.

Note
If the input is not a string (ex.: "Hello world!") but a char array, the input message (array) needs to end with NULL ("\0")!
Parameters
[in]message1The first part of the string to print to USARTx.
[in]valueThe value to print between the two string parts.
[in]message2The second part of the string to print to USARTx.

Definition at line 692 of file dbprint.c.

693 {
694  dbprint_color("WARN: ", YELLOW);
695  dbprint_color(message1, YELLOW);
696  dbprintInt_hex(value);
697  dbprintln_color(message2, YELLOW);
698 }
Definition: dbprint.h:59
void dbprintInt_hex(int32_t value)
Print a number in hexadecimal notation to USARTx.
Definition: dbprint.c:796
void dbprintln_color(char *message, dbprint_color_t color)
Print a string (char array) to USARTx in a given color and go to the next line.
Definition: dbprint.c:482
void dbprint_color(char *message, dbprint_color_t color)
Print a string (char array) to USARTx in a given color.
Definition: dbprint.c:423

◆ uint32_to_charDec()

static void uint32_to_charDec ( char *  buf,
uint32_t  value 
)
static

Convert a uint32_t value to a decimal char array (string).

Note
This is a static method because it's only internally used in this file and called by other methods if necessary.
Parameters
[out]bufThe buffer to put the resulting string in.
This needs to have a length of 10: char buf[10];!
[in]valueThe uint32_t value to convert to a string.

Definition at line 1124 of file dbprint.c.

1125 {
1126  if (value == 0)
1127  {
1128  buf[0] = '0';
1129  buf[1] = '\0'; /* NULL termination character */
1130  }
1131  else
1132  {
1133  /* MAX uint32_t value = FFFFFFFFh = 4294967295d (10 decimal chars) */
1134  char backwardsBuf[10];
1135 
1136  uint32_t calcval = value;
1137  uint8_t length = 0;
1138  uint8_t lengthCounter = 0;
1139 
1140 
1141  /* Loop until the value is zero (separate characters 0-9) and calculate length */
1142  while (calcval)
1143  {
1144  uint32_t rem = calcval % 10;
1145  backwardsBuf[length] = TO_DEC(rem); /* Convert to ASCII character */
1146  length++;
1147 
1148  calcval = calcval - rem;
1149  calcval = calcval / 10;
1150  }
1151 
1152  /* Backwards counter */
1153  lengthCounter = length;
1154 
1155  /* Reverse the characters in the buffer for the final string */
1156  for (uint8_t i = 0; i < length; i++)
1157  {
1158  buf[i] = backwardsBuf[lengthCounter-1];
1159  lengthCounter--;
1160  }
1161 
1162  /* Add NULL termination character */
1163  buf[length] = '\0';
1164  }
1165 }
#define TO_DEC(i)
Definition: dbprint.c:103

◆ uint32_to_charHex()

static void uint32_to_charHex ( char *  buf,
uint32_t  value,
bool  spacing 
)
static

Convert a uint32_t value to a hexadecimal char array (string).

Note
This is a static method because it's only internally used in this file and called by other methods if necessary.
Parameters
[out]bufThe buffer to put the resulting string in.
This needs to have a length of 9: char buf[9];!
[in]valueThe uint32_t value to convert to a string.
[in]spacing
  • true - Add spacing between the eight HEX chars to make two groups of four.
  • false - Don't add spacing between the eight HEX chars.

Definition at line 1063 of file dbprint.c.

1064 {
1065  /* 4 nibble HEX representation */
1066  if (value <= 0xFFFF)
1067  {
1068  /* Only get necessary nibble by ANDing with a mask and
1069  * shifting one nibble (4 bits) per position */
1070  buf[0] = TO_HEX(((value & 0xF000) >> 12));
1071  buf[1] = TO_HEX(((value & 0x0F00) >> 8 ));
1072  buf[2] = TO_HEX(((value & 0x00F0) >> 4 ));
1073  buf[3] = TO_HEX( (value & 0x000F) );
1074  buf[4] = '\0'; /* NULL termination character */
1075  }
1076 
1077  /* 8 nibble HEX representation */
1078  else
1079  {
1080  /* Only get necessary nibble by ANDing with a mask and
1081  * shifting one nibble (4 bits) per position */
1082  buf[0] = TO_HEX(((value & 0xF0000000) >> 28));
1083  buf[1] = TO_HEX(((value & 0x0F000000) >> 24));
1084  buf[2] = TO_HEX(((value & 0x00F00000) >> 20));
1085  buf[3] = TO_HEX(((value & 0x000F0000) >> 16));
1086 
1087  /* Add spacing if necessary */
1088  if (spacing)
1089  {
1090  buf[4] = ' '; /* Spacing */
1091  buf[5] = TO_HEX(((value & 0x0000F000) >> 12));
1092  buf[6] = TO_HEX(((value & 0x00000F00) >> 8 ));
1093  buf[7] = TO_HEX(((value & 0x000000F0) >> 4 ));
1094  buf[8] = TO_HEX( (value & 0x0000000F) );
1095  buf[9] = '\0'; /* NULL termination character */
1096  }
1097  else
1098  {
1099  buf[4] = TO_HEX(((value & 0x0000F000) >> 12));
1100  buf[5] = TO_HEX(((value & 0x00000F00) >> 8 ));
1101  buf[6] = TO_HEX(((value & 0x000000F0) >> 4 ));
1102  buf[7] = TO_HEX( (value & 0x0000000F) );
1103  buf[8] = '\0'; /* NULL termination character */
1104  }
1105  }
1106 }
#define TO_HEX(i)
Definition: dbprint.c:102

◆ USART0_RX_IRQHandler()

void USART0_RX_IRQHandler ( void  )

USART0 RX interrupt service routine.

The index gets reset to zero when a special character (CR) is received or the buffer is filled.

Note
The weak definition for this method is located in system_efm32hg.h.

Definition at line 1281 of file dbprint.c.

1282 {
1283  /* "static" so it keeps its value between invocations */
1284  static uint32_t i = 0;
1285 
1286  /* Get and clear the pending USART interrupt flags */
1287  uint32_t flags = USART_IntGet(dbpointer);
1288  USART_IntClear(dbpointer, flags);
1289 
1290  /* Store incoming data into dbprint_rx_buffer */
1291  rx_buffer[i++] = USART_Rx(dbpointer);
1292 
1293  /* Set dbprint_rxdata when a special character is received (~ full line received) */
1294  if ( (rx_buffer[i - 1] == '\r') || (rx_buffer[i - 1] == '\f') )
1295  {
1296  dataReceived = true;
1297  rx_buffer[i - 1] = '\0'; /* Overwrite CR or LF character */
1298  i = 0;
1299  }
1300 
1301  /* Set dbprint_rxdata when the buffer is full */
1302  if (i >= (DBPRINT_BUFFER_SIZE - 2))
1303  {
1304  dataReceived = true;
1305  rx_buffer[i] = '\0'; /* Do not overwrite last character */
1306  i = 0;
1307  }
1308 }
volatile bool dataReceived
Definition: dbprint.c:120
volatile char rx_buffer[80]
Definition: dbprint.c:121
USART_TypeDef * dbpointer
Definition: dbprint.c:116
#define DBPRINT_BUFFER_SIZE
Definition: dbprint.h:48

◆ USART0_TX_IRQHandler()

void USART0_TX_IRQHandler ( void  )

USART0 TX interrupt service routine.

The index gets reset to zero when all the characters in the buffer are send.

Note
The weak definition for this method is located in system_efm32hg.h.

Definition at line 1321 of file dbprint.c.

1322 {
1323  /* "static" so it keeps its value between invocations */
1324  static uint32_t i = 0;
1325 
1326  /* Get and clear the pending USART interrupt flags */
1327  uint32_t flags = USART_IntGet(dbpointer);
1328  USART_IntClear(dbpointer, flags);
1329 
1330  /* Mask flags AND "TX Complete Interrupt Flag" */
1331  if (flags & USART_IF_TXC)
1332  {
1333  /* Index is smaller than the maximum buffer size and
1334  * the current item to print is not "NULL" (\0) */
1335  if ( (i < DBPRINT_BUFFER_SIZE) && (tx_buffer[i] != '\0') )
1336  {
1337  /* Transmit byte at current index and increment index */
1338  USART_Tx(dbpointer, tx_buffer[i++]);
1339  }
1340  else
1341  {
1342  i = 0; /* No more data to send */
1343  }
1344  }
1345 }
volatile char tx_buffer[80]
Definition: dbprint.c:122
USART_TypeDef * dbpointer
Definition: dbprint.c:116
#define DBPRINT_BUFFER_SIZE
Definition: dbprint.h:48

◆ USART1_RX_IRQHandler()

void USART1_RX_IRQHandler ( void  )

USART1 RX interrupt service routine.

Note
The weak definition for this method is located in system_efm32hg.h.

Definition at line 1355 of file dbprint.c.

1356 {
1357  /* Call other handler */
1359 }
void USART0_RX_IRQHandler(void)
USART0 RX interrupt service routine.
Definition: dbprint.c:1281

◆ USART1_TX_IRQHandler()

void USART1_TX_IRQHandler ( void  )

USART1 TX interrupt service routine.

Note
The weak definition for this method is located in system_efm32hg.h.

Definition at line 1369 of file dbprint.c.

1370 {
1371  /* Call other handler */
1373 }
void USART0_TX_IRQHandler(void)
USART0 TX interrupt service routine.
Definition: dbprint.c:1321

Variable Documentation

◆ dataReceived

volatile bool dataReceived = false

Definition at line 120 of file dbprint.c.

◆ dbpointer

USART_TypeDef* dbpointer

Local variable to store the settings (pointer).

Definition at line 116 of file dbprint.c.

◆ rx_buffer

volatile char rx_buffer[80]

Definition at line 121 of file dbprint.c.

◆ tx_buffer

volatile char tx_buffer[80]

Definition at line 122 of file dbprint.c.