This is an old version of the documentation. View the latest version here.
Control Surface  1.0.0
MIDI Control Surface library for Arduino
Frequency.hpp
Go to the documentation of this file.
1 #pragma once
2 
4 
6 
8 class 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 };
16 constexpr Frequency operator"" _Hz(unsigned long long hz) {
17  return Frequency{(unsigned long)hz};
18 }
19 constexpr Frequency operator"" _kHz(long double khz) {
20  return Frequency{(unsigned long)(khz * 1E3)};
21 }
22 constexpr Frequency operator"" _kHz(unsigned long long khz) {
23  return Frequency{(unsigned long)(khz * 1E3)};
24 }
25 constexpr Frequency operator"" _MHz(long double mhz) {
26  return Frequency{(unsigned long)(mhz * 1E6)};
27 }
28 constexpr Frequency operator"" _MHz(unsigned long long mhz) {
29  return Frequency{(unsigned long)(mhz * 1E6)};
30 }
31 
BEGIN_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
Definition: NamespaceSettings.hpp:9
Frequency::hertz
unsigned long hertz
Definition: Frequency.hpp:14
END_CS_NAMESPACE
#define END_CS_NAMESPACE
Definition: NamespaceSettings.hpp:10
NamespaceSettings.hpp
Frequency::Frequency
constexpr Frequency(unsigned long hertz)
Definition: Frequency.hpp:10
Frequency
Type-safe class for frequency values.
Definition: Frequency.hpp:8