Control Surface main
MIDI Control Surface library for Arduino
Loading...
Searching...
No Matches
Frequency.hpp
Go to the documentation of this file.
1#pragma once
2
4
6
8class Frequency {
9 public:
10 explicit constexpr Frequency(unsigned long hertz) : hertz(hertz) {}
11 constexpr operator unsigned long() const { return hertz; }
12
13 private:
14 unsigned long hertz;
15};
16constexpr Frequency operator"" _Hz(unsigned long long hz) {
17 return Frequency{(unsigned long)hz};
18}
19constexpr Frequency operator"" _kHz(long double khz) {
20 return Frequency{(unsigned long)(khz * 1E3l)};
21}
22constexpr Frequency operator"" _kHz(unsigned long long khz) {
23 return Frequency{(unsigned long)(khz * 1E3)};
24}
25constexpr Frequency operator"" _MHz(long double mhz) {
26 return Frequency{(unsigned long)(mhz * 1E6l)};
27}
28constexpr Frequency operator"" _MHz(unsigned long long mhz) {
29 return Frequency{(unsigned long)(mhz * 1E6)};
30}
31
#define END_AH_NAMESPACE
#define BEGIN_AH_NAMESPACE
Type-safe class for frequency values.
Definition Frequency.hpp:8
unsigned long hertz
Definition Frequency.hpp:14
constexpr Frequency(unsigned long hertz)
Definition Frequency.hpp:10
A class for serial-in/parallel-out shift registers, like the 74HC595 that are connected to the SPI bu...