Control Surface main
MIDI Control Surface library for Arduino
Public Member Functions | Public Attributes | Static Private Member Functions | Private Attributes | List of all members
HexPuller< CharPuller > Class Template Reference

#include <MIDI_Parsers/HexPuller.hpp>

Detailed Description

template<class CharPuller>
class HexPuller< CharPuller >

Class that parses hexadecimal ASCII text to bytes.

For example, parses the string "7f A 123456" to the bytes {0x7F, 0x0A, 0x12, 0x34, 0x56}.

Template Parameters
CharPullerClass that supplies the ASCII characters to parse.
See also

Definition at line 25 of file HexPuller.hpp.

+ Collaboration diagram for HexPuller< CharPuller >:

Public Member Functions

 HexPuller (CharPuller &&puller)
bool pull (uint8_t &output)
 Pull out a new byte. More...

Public Attributes

CharPuller puller

Static Private Member Functions

static uint8_t hex2int (char hex)
 Convert a hexadecimal character to a 4-bit nibble. More...

Private Attributes

char char1 = '\0'
char char2 = '\0'

Constructor & Destructor Documentation

◆ HexPuller()

HexPuller ( CharPuller &&  puller)

Definition at line 27 of file HexPuller.hpp.

Member Function Documentation

◆ pull()

bool pull ( uint8_t &  output)

Pull out a new byte.

Pulls characters from the CharPuller until a hexadecimal number was found, decodes it, and returns it.

[out]outputA new byte (if available).
True if a byte was available, false otherwise.

Definition at line 35 of file HexPuller.hpp.

◆ hex2int()

static uint8_t hex2int ( char  hex)

Convert a hexadecimal character to a 4-bit nibble.

Definition at line 61 of file HexPuller.hpp.

Member Data Documentation

◆ puller

CharPuller puller

Definition at line 66 of file HexPuller.hpp.

◆ char1

char char1 = '\0'

Definition at line 69 of file HexPuller.hpp.

◆ char2

char char2 = '\0'

Definition at line 70 of file HexPuller.hpp.

The documentation for this class was generated from the following file: