Humidistat
Arduino firmware for a humidistat (humidity controller)
Loading...
Searching...
No Matches
advanceEnum.h
Go to the documentation of this file.
1#ifndef HUMIDISTAT_ADVANCEENUM_H
2#define HUMIDISTAT_ADVANCEENUM_H
3
4#include <stdint.h>
5
10template <typename T>
11void advanceEnum(T &e, int8_t n = 1) {
12 e = static_cast<T>((static_cast<typename std::underlying_type<T>::type>(e) + n) % (static_cast<typename std::underlying_type<T>::type>(T::_last) + 1));
13}
14
15#endif //HUMIDISTAT_ADVANCEENUM_H
void advanceEnum(T &e, int8_t n=1)
Cycle through (advance) an enum.
Definition advanceEnum.h:11