-
Notifications
You must be signed in to change notification settings - Fork 0
/
util.hpp
50 lines (44 loc) · 790 Bytes
/
util.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/**
* @file: util.hpp
*
* @date: 2021-06-02
*
* @author: Yazan Saleh & Lukas Güldenstein
*/
#ifndef _UTIL_HPP
#define _UTIL_HPP
/* -------------------------------- includes -------------------------------- */
/**
* flash LED and print message to signal error
*/
void error(String msg)
{
pinMode(LED_BUILTIN, OUTPUT);
Serial.println(msg);
while (true)
{
digitalWrite(LED_BUILTIN, HIGH);
delay(100);
digitalWrite(LED_BUILTIN, LOW);
delay(100);
}
}
/**
* flash LED to signal error
*/
void error()
{
pinMode(LED_BUILTIN, OUTPUT);
while (true)
{
digitalWrite(LED_BUILTIN, HIGH);
delay(100);
digitalWrite(LED_BUILTIN, LOW);
delay(100);
}
}
void setHigherPWMFreq()
{
TCCR1B = TCCR1B & B11111000 | B00000001; // for PWM 31.4kHz
}
#endif /* _UTIL_HPP */