Embedded System Design 2 - Project
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
6.2
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).

Todo:
Future improvements:
  • Fix dbSet_TXbuffer and also 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 106 of file dbprint.c.

◆ COLOR_CYAN

#define COLOR_CYAN   "\x1b[36m"

Definition at line 107 of file dbprint.c.

◆ COLOR_GREEN

#define COLOR_GREEN   "\x1b[32m"

Definition at line 105 of file dbprint.c.

◆ COLOR_MAGENTA

#define COLOR_MAGENTA   "\x1b[35m"

Definition at line 108 of file dbprint.c.

◆ COLOR_RED

#define COLOR_RED   "\x1b[31m"

Definition at line 104 of file dbprint.c.

◆ COLOR_RESET

#define COLOR_RESET   "\x1b[0m"

Definition at line 110 of file dbprint.c.

◆ COLOR_YELLOW

#define COLOR_YELLOW   "\x1b[33m"

Definition at line 109 of file dbprint.c.

◆ TO_DEC

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

Definition at line 101 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 100 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 1184 of file dbprint.c.

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

◆ dbAlert()

void dbAlert ( void  )

Sound an alert in the terminal.

Print the bell (alert) character to USARTx.

Definition at line 342 of file dbprint.c.

343 {
344  USART_Tx(dbpointer, '\a');
345 }
USART_TypeDef * dbpointer
Definition: dbprint.c:114

◆ 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 356 of file dbprint.c.

357 {
358  USART_Tx(dbpointer, '\f');
359 }
USART_TypeDef * dbpointer
Definition: dbprint.c:114

◆ 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 539 of file dbprint.c.

540 {
541  dbprint_color("CRIT: ", RED);
542  dbprintln_color(message, RED);
543 }
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:480
void dbprint_color(char *message, dbprint_color_t color)
Print a string (char array) to USARTx in a given color.
Definition: dbprint.c:421

◆ 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 629 of file dbprint.c.

630 {
631  dbprint_color("CRIT: ", RED);
632  dbprint_color(message1, RED);
633  dbprintInt(value);
634  dbprintln_color(message2, RED);
635 }
Definition: dbprint.h:54
void dbprintInt(int32_t value)
Print a number in decimal notation to USARTx.
Definition: dbprint.c:738
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:480
void dbprint_color(char *message, dbprint_color_t color)
Print a string (char array) to USARTx in a given color.
Definition: dbprint.c:421

◆ 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 721 of file dbprint.c.

722 {
723  dbprint_color("CRIT: ", RED);
724  dbprint_color(message1, RED);
725  dbprintInt_hex(value);
726  dbprintln_color(message2, RED);
727 }
Definition: dbprint.h:54
void dbprintInt_hex(int32_t value)
Print a number in hexadecimal notation to USARTx.
Definition: dbprint.c:794
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:480
void dbprint_color(char *message, dbprint_color_t color)
Print a string (char array) to USARTx in a given color.
Definition: dbprint.c:421

◆ 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 1017 of file dbprint.c.

1018 {
1019  if (dataReceived)
1020  {
1021  uint32_t i;
1022 
1023  /* Copy data from the RX buffer to the given buffer */
1024  for (i = 0; rx_buffer[i] != 0 && i < DBPRINT_BUFFER_SIZE-1; i++)
1025  {
1026  buf[i] = rx_buffer[i];
1027  }
1028 
1029  /* Add NULL termination character */
1030  buf[i++] = '\0';
1031 
1032  /* Reset "notification" variable */
1033  dataReceived = false;
1034  }
1035  else
1036  {
1037  dbcrit("No received data available!");
1038  }
1039 }
volatile bool dataReceived
Definition: dbprint.c:118
volatile char rx_buffer[80]
Definition: dbprint.c:119
#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:539

◆ 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 909 of file dbprint.c.

910 {
911  return (dataReceived);
912 }
volatile bool dataReceived
Definition: dbprint.c:118

◆ 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 503 of file dbprint.c.

504 {
505  dbprint("INFO: ");
506  dbprintln(message);
507 }
void dbprint(char *message)
Print a string (char array) to USARTx.
Definition: dbprint.c:373
void dbprintln(char *message)
Print a string (char array) to USARTx and go to the next line.
Definition: dbprint.c:395

◆ 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 567 of file dbprint.c.

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

◆ 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 659 of file dbprint.c.

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

◆ 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 373 of file dbprint.c.

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

◆ 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 421 of file dbprint.c.

422 {
423  switch (color)
424  {
425  case DEFAULT_COLOR:
427  dbprint(message);
428  break;
429  case RED:
431  dbprint(message);
433  break;
434  case GREEN:
436  dbprint(message);
438  break;
439  case BLUE:
441  dbprint(message);
443  break;
444  case CYAN:
446  dbprint(message);
448  break;
449  case MAGENTA:
451  dbprint(message);
453  break;
454  case YELLOW:
456  dbprint(message);
458  break;
459  default:
461  dbprint(message);
462  }
463 }
Definition: dbprint.h:57
#define COLOR_GREEN
Definition: dbprint.c:105
void dbprint(char *message)
Print a string (char array) to USARTx.
Definition: dbprint.c:373
#define COLOR_YELLOW
Definition: dbprint.c:109
Definition: dbprint.h:54
#define COLOR_MAGENTA
Definition: dbprint.c:108
#define COLOR_RED
Definition: dbprint.c:104
Definition: dbprint.h:55
Definition: dbprint.h:59
Definition: dbprint.h:56
#define COLOR_BLUE
Definition: dbprint.c:106
#define COLOR_CYAN
Definition: dbprint.c:107
#define COLOR_RESET
Definition: dbprint.c:110

◆ 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 148 of file dbprint.c.

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

◆ 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 738 of file dbprint.c.

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

◆ 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 794 of file dbprint.c.

795 {
796  char hexchar[9]; /* Needs to be 9 */
797  uint32_to_charHex(hexchar, value, true); /* true: add spacing between eight HEX chars */
798  dbprint("0x");
799  dbprint(hexchar);
800 }
void dbprint(char *message)
Print a string (char array) to USARTx.
Definition: dbprint.c:373
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:1061

◆ 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 395 of file dbprint.c.

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

◆ 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 480 of file dbprint.c.

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

◆ 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 774 of file dbprint.c.

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

◆ 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 811 of file dbprint.c.

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

◆ dbReadChar()

char dbReadChar ( void  )

Read a character from USARTx.

Returns
The character read from USARTx.

Definition at line 830 of file dbprint.c.

831 {
832  return (USART_Rx(dbpointer));
833 }
USART_TypeDef * dbpointer
Definition: dbprint.c:114

◆ 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 848 of file dbprint.c.

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

◆ 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 872 of file dbprint.c.

873 {
874  for (uint32_t i = 0; i < DBPRINT_BUFFER_SIZE - 1 ; i++ )
875  {
876  char localBuffer = USART_Rx(dbpointer);
877 
878  /* Check if a CR character is received */
879  if (localBuffer == '\r')
880  {
881  /* End with a null termination character, expected by the dbprintln method */
882  buf[i] = '\0';
883  break;
884  }
885  else
886  {
887  buf[i] = localBuffer;
888  }
889  }
890 }
USART_TypeDef * dbpointer
Definition: dbprint.c:114
#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 521 of file dbprint.c.

522 {
523  dbprint_color("WARN: ", YELLOW);
524  dbprintln_color(message, YELLOW);
525 }
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:480
void dbprint_color(char *message, dbprint_color_t color)
Print a string (char array) to USARTx in a given color.
Definition: dbprint.c:421

◆ 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 598 of file dbprint.c.

599 {
600  dbprint_color("WARN: ", YELLOW);
601  dbprint_color(message1, YELLOW);
602  dbprintInt(value);
603  dbprintln_color(message2, YELLOW);
604 }
Definition: dbprint.h:59
void dbprintInt(int32_t value)
Print a number in decimal notation to USARTx.
Definition: dbprint.c:738
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:480
void dbprint_color(char *message, dbprint_color_t color)
Print a string (char array) to USARTx in a given color.
Definition: dbprint.c:421

◆ 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 690 of file dbprint.c.

691 {
692  dbprint_color("WARN: ", YELLOW);
693  dbprint_color(message1, YELLOW);
694  dbprintInt_hex(value);
695  dbprintln_color(message2, YELLOW);
696 }
Definition: dbprint.h:59
void dbprintInt_hex(int32_t value)
Print a number in hexadecimal notation to USARTx.
Definition: dbprint.c:794
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:480
void dbprint_color(char *message, dbprint_color_t color)
Print a string (char array) to USARTx in a given color.
Definition: dbprint.c:421

◆ 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 1122 of file dbprint.c.

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

◆ 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 1061 of file dbprint.c.

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

◆ 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 1279 of file dbprint.c.

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

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

1354 {
1355  /* Call other handler */
1357 }
void USART0_RX_IRQHandler(void)
USART0 RX interrupt service routine.
Definition: dbprint.c:1279

◆ 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 1367 of file dbprint.c.

1368 {
1369  /* Call other handler */
1371 }
void USART0_TX_IRQHandler(void)
USART0 TX interrupt service routine.
Definition: dbprint.c:1319

Variable Documentation

◆ dataReceived

volatile bool dataReceived = false

Definition at line 118 of file dbprint.c.

◆ dbpointer

USART_TypeDef* dbpointer

Local variable to store the settings (pointer).

Definition at line 114 of file dbprint.c.

◆ rx_buffer

volatile char rx_buffer[80]

Definition at line 119 of file dbprint.c.

◆ tx_buffer

volatile char tx_buffer[80]

Definition at line 120 of file dbprint.c.