Artemis Teensy Flight Software
The software on the Teensy in the Artemis cubesat.
Helpers Namespace Reference

Helper functions and debugging tools. More...

Enumerations

enum  Short_Name : uint8_t {
  RFM23 = 1 , PDU , RPI , MAIN ,
  TEST
}
 Enumeration of channels calling helper functions.
 

Functions

void connect_serial_debug (long baud)
 Connects to a computer over USB Serial for debugging. More...
 
void print_hexdump (Short_Name channel, const char *msg, uint8_t *src, uint8_t size)
 Helper function to print the hexdump of a region of memory. More...
 
template<typename Arg >
void print_args (std::ostream &oss, const Arg &arg)
 Base case of the recursive debug print. More...
 
template<typename Arg , typename... Args>
void print_args (std::ostream &oss, const Arg &arg, const Args &...args)
 Recursive case of the recursive debug print. More...
 
template<typename... Args>
void print_debug (Short_Name channel, const Args &...args)
 Helper function to print debug messages. More...
 
template<typename... Args>
void print_debug_rapid (Short_Name channel, const Args &...args)
 Helper function to print debug messages quickly. More...
 

Detailed Description

Helper functions and debugging tools.

Function Documentation

◆ connect_serial_debug()

void Helpers::connect_serial_debug ( long  baud)

Connects to a computer over USB Serial for debugging.

Parameters
baudThe baud rate of the Serial connection to the host computer.

◆ print_args() [1/2]

template<typename Arg >
void Helpers::print_args ( std::ostream &  oss,
const Arg &  arg 
)

Base case of the recursive debug print.

Template Parameters
ArgThe generic type of the argument to be appended to the stream.
Parameters
ossThe output stream containing the string to be printed.
argThe argument to be added to the ouput string.

◆ print_args() [2/2]

template<typename Arg , typename... Args>
void Helpers::print_args ( std::ostream &  oss,
const Arg &  arg,
const Args &...  args 
)

Recursive case of the recursive debug print.

This function, in combination with its base case version, recursively goes through each argument passed into it, appends the first argument to the output stream, then passes the remaining arguments to the next iteration of the function. This repeats until the base case is reached and the complete output stream is built.

Practically, this function can be called with an arbitrary number of arguments. The arguments are appended to each other as if they were each passed into std::ostream.

For example, print_args("Hello World! int=", int) and print_args("This ", "is ", "a ", "test ") are both valid uses of this function.

Template Parameters
ArgThe generic type of the argument to be appended to the stream.
ArgsThe generic type of the remaining arguments.
Parameters
ossThe output stream containing the string to be printed.
argThe argument to be added to the ouput string.
argsThe remaining arguments.

◆ print_debug()

template<typename... Args>
void Helpers::print_debug ( Short_Name  channel,
const Args &...  args 
)

Helper function to print debug messages.

Template Parameters
ArgsThe generic type of arguments to be appended to the stream.
Parameters
channelThe Short_Name of the channel calling this function.
argsThe arguments to be added to the output string.

◆ print_debug_rapid()

template<typename... Args>
void Helpers::print_debug_rapid ( Short_Name  channel,
const Args &...  args 
)

Helper function to print debug messages quickly.

Template Parameters
ArgsThe generic type of arguments to be appended to the stream.
Parameters
channelThe Short_Name of the channel calling this function.
argsThe arguments to be added to the output string.

◆ print_hexdump()

void Helpers::print_hexdump ( Short_Name  channel,
const char *  msg,
uint8_t *  src,
uint8_t  size 
)

Helper function to print the hexdump of a region of memory.

Parameters
channelThe Short_Name of the channel calling this function.
msgA message to accompany the hexdump.
srcA pointer to the start of the region to be printed.
sizeThe number of bytes to be printed.