Arduino Helpers master
Utility library for Arduino
Macros | Typedefs | Variables
Settings.hpp File Reference

Detailed Description

All user settings and debugging options can be changed here.

Definition in file Settings.hpp.

#include <AH/Types/Frequency.hpp>
#include <AH/Hardware/ADCConfig.hpp>
#include <limits.h>
#include <stddef.h>
#include <stdint.h>
+ Include dependency graph for Settings.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define DEBUG_OUT
 The debug output. More...
 
#define FATAL_ERRORS
 Exit when encountering an error, instead of trying to recover (recommended). More...
 

Typedefs

using ANALOG_FILTER_TYPE = uint16_t
 The unsigned integer type to use for analog inputs during filtering. More...
 

Variables

constexpr unsigned long defaultBaudRate = 115200
 The default baud rate for debug output. More...
 
constexpr uint8_t ADC_BITS = ADC_RESOLUTION
 The bit depth to use for the ADC (Analog to Digital Converter). More...
 
constexpr uint8_t ANALOG_FILTER_SHIFT_FACTOR = 2
 The factor for the analog filter:
Difference equation: \( y[n] = \alpha\cdot x[n] + (1-\alpha)\cdot y[n-1] \) where \( \alpha = \left(\frac{1}{2}\right)^{ANALOG\_FILTER\_SHIFT\_FACTOR} \). More...
 
constexpr unsigned long BUTTON_DEBOUNCE_TIME = 25
 The debounce time for momentary push buttons in milliseconds. More...
 
constexpr unsigned long SELECT_LINE_DELAY = 10
 The time in microseconds to wait for lines of multiplexers and scanning matrices to settle before reading the value. More...
 
constexpr unsigned long LONG_PRESS_DELAY = 450
 The time in milliseconds before a press is registered as a long press. More...
 
constexpr unsigned long LONG_PRESS_REPEAT_DELAY = 200
 The time between increments/decremnets during a long press. More...
 
constexpr unsigned long FILTERED_INPUT_UPDATE_INTERVAL = 1000
 The interval between updating filtered analog inputs, in microseconds. More...
 
static constexpr Frequency SPI_MAX_SPEED = 8_MHz
 

Macro Definition Documentation

◆ DEBUG_OUT

#define DEBUG_OUT

The debug output.


Use #define DEBUG_OUT Serial to print debugging information to the serial monitor.

Note
Printing debug information can slow down the program dramatically.

Definition at line 27 of file Settings.hpp.

◆ FATAL_ERRORS

#define FATAL_ERRORS

Exit when encountering an error, instead of trying to recover (recommended).

Definition at line 32 of file Settings.hpp.

Typedef Documentation

◆ ANALOG_FILTER_TYPE

using ANALOG_FILTER_TYPE = uint16_t

The unsigned integer type to use for analog inputs during filtering.

See also
FilteredAnalog

Definition at line 73 of file Settings.hpp.

Variable Documentation

◆ defaultBaudRate

constexpr unsigned long defaultBaudRate = 115200
constexpr

The default baud rate for debug output.

Definition at line 38 of file Settings.hpp.

◆ ADC_BITS

constexpr uint8_t ADC_BITS = ADC_RESOLUTION
constexpr

The bit depth to use for the ADC (Analog to Digital Converter).

By default, the maximum supported resolution is used, but if you need it for compatibility with other code that expects the default 10-bit resolution, you can use

constexpr uint8_t ADC_BITS = 10;
constexpr uint8_t ADC_BITS
The bit depth to use for the ADC (Analog to Digital Converter).
Definition: Settings.hpp:55

If the library doesn't know your specific hardware, it defaults to 10 bits. This might not be the optimal resolution, so it's best to add the actual resolution to Hardware/ADCConfig.hpp.

Definition at line 55 of file Settings.hpp.

◆ ANALOG_FILTER_SHIFT_FACTOR

constexpr uint8_t ANALOG_FILTER_SHIFT_FACTOR = 2
constexpr

The factor for the analog filter:
Difference equation: \( y[n] = \alpha\cdot x[n] + (1-\alpha)\cdot y[n-1] \) where \( \alpha = \left(\frac{1}{2}\right)^{ANALOG\_FILTER\_SHIFT\_FACTOR} \).

See also
FilteredAnalog

Definition at line 66 of file Settings.hpp.

◆ BUTTON_DEBOUNCE_TIME

constexpr unsigned long BUTTON_DEBOUNCE_TIME = 25
constexpr

The debounce time for momentary push buttons in milliseconds.

Definition at line 76 of file Settings.hpp.

◆ SELECT_LINE_DELAY

constexpr unsigned long SELECT_LINE_DELAY = 10
constexpr

The time in microseconds to wait for lines of multiplexers and scanning matrices to settle before reading the value.


Has no effect on AVR.

Definition at line 81 of file Settings.hpp.

◆ LONG_PRESS_DELAY

constexpr unsigned long LONG_PRESS_DELAY = 450
constexpr

The time in milliseconds before a press is registered as a long press.

Definition at line 84 of file Settings.hpp.

◆ LONG_PRESS_REPEAT_DELAY

constexpr unsigned long LONG_PRESS_REPEAT_DELAY = 200
constexpr

The time between increments/decremnets during a long press.

Definition at line 87 of file Settings.hpp.

◆ FILTERED_INPUT_UPDATE_INTERVAL

constexpr unsigned long FILTERED_INPUT_UPDATE_INTERVAL = 1000
constexpr

The interval between updating filtered analog inputs, in microseconds.

Definition at line 90 of file Settings.hpp.

◆ SPI_MAX_SPEED

constexpr Frequency SPI_MAX_SPEED = 8_MHz
staticconstexpr

Definition at line 92 of file Settings.hpp.