forked from zynthian/zyncoder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
zyntof.h
76 lines (61 loc) · 2.43 KB
/
zyntof.h
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
* ******************************************************************
* ZYNTHIAN PROJECT: TOF Library
*
* Library for interfacing VL53L0X "Time Of Flight" sensor
*
* Copyright (C) 2015-2020 Fernando Moyano <[email protected]>
*
* ******************************************************************
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* For a full copy of the GNU General Public License see the LICENSE.txt file.
*
* ******************************************************************
*/
//-----------------------------------------------------------------------------
// TCA954X (43/44/48) Stuff => I2C Multiplexer
//-----------------------------------------------------------------------------
//Default config for TCA9543 (I2C multiplexer)
#define TCA954X_I2C_ADDRESS 0x70
void select_zyntof_chan(uint8_t i);
//-----------------------------------------------------------------------------
// VL53L0X Stuff
//-----------------------------------------------------------------------------
#define VL53L0X_I2C_ADDRESS 0x29
#define VL53L0X_DISTANCE_MODE 1
//-----------------------------------------------------------------------------
// Generate MIDI events from Distance
//-----------------------------------------------------------------------------
#define MAX_NUM_ZYNTOFS 4
#define POLL_ZYNTOFS_US 1000
#define MIN_TOF_DISTANCE 60
#define MAX_TOF_DISTANCE 600
struct zyntof_st {
uint8_t enabled;
uint8_t i;
uint16_t val;
uint8_t midi_evt;
uint8_t midi_chan;
uint8_t midi_num;
uint8_t midi_val;
};
void setup_zyntof(uint8_t i, uint8_t midi_evt, uint8_t midi_chan, uint8_t midi_num);
void disable_zyntof(uint8_t i);
void send_zyntof_midi(uint8_t i);
pthread_t init_poll_zyntofs();
//-----------------------------------------------------------------------------
// TOFs Library Initialization
//-----------------------------------------------------------------------------
int init_zyntof();
int end_zyntof();
//-----------------------------------------------------------------------------