Tempo Tapper  1.0.0
A simple library to implement a tempo tapper
tempo_tapper_arduino.cxx
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2021 Patrick Pedersen
3 
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8 
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13 
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  *
17  */
18 
32 #ifdef TT_TARGET_PLATFORM_ARDUINO
33 
34 #include <stdlib.h>
35 #include <stddef.h>
36 
37 #include <Arduino.h>
38 
39 #include <tempo_tapper.h>
40 
41 void current_time(tt_time_t *time)
42 {
43  *time = micros();
44 }
45 
46 void add_time(tt_time_t *a, tt_time_t *b, tt_time_t *res)
47 {
48  *res = *a + *b;
49 }
50 
51 void sub_time(tt_time_t *a, tt_time_t *b, tt_time_t *res)
52 {
53  *res = *a - *b;
54 }
55 
56 unsigned long time_to_us(tt_time_t *time)
57 {
58  return *time;
59 }
60 
61 void reset_time(tt_time_t *time)
62 {
63  *time = 0;
64 }
65 
66 #endif
reset_time
void reset_time(tt_time_t *time)
Resets a time var to 0.
add_time
void add_time(tt_time_t *a, tt_time_t *b, tt_time_t *res)
Adds two time values.
sub_time
void sub_time(tt_time_t *a, tt_time_t *b, tt_time_t *res)
Subtracts two time values.
time_to_us
unsigned long time_to_us(tt_time_t *time)
Returns a time value in microseconds.
current_time
void current_time(tt_time_t *time)
Receives the current clock time.
tempo_tapper.h
Provides all necessary structs and functions to implement a tempo tapper.