forked from pichenettes/eurorack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhardware_config.h
executable file
·102 lines (87 loc) · 2.61 KB
/
hardware_config.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
// Copyright 2012 Olivier Gillet.
//
// Author: Olivier Gillet ([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 3 of the License, or
// (at your option) 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.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef EDGES_HARDWARE_CONFIG_H_
#define EDGES_HARDWARE_CONFIG_H_
#include "avrlibx/avrlibx.h"
#include "avrlibx/devices/switch.h"
#include "avrlibx/io/gpio.h"
#include "avrlibx/io/parallel_io.h"
#include "avrlibx/io/ring_buffer.h"
#include "avrlibx/io/usart.h"
#include "avrlibx/io/usart_spi.h"
#include "avrlibx/system/timer.h"
namespace edges {
using avrlibx::DualTimer;
using avrlibx::Gpio;
using avrlibx::ParallelPort;
using avrlibx::PortA;
using avrlibx::PortB;
using avrlibx::PortC;
using avrlibx::PortD;
using avrlibx::PortE;
using avrlibx::PWM;
using avrlibx::RingBuffer;
using avrlibx::SPIMaster;
using avrlibx::Timer;
using avrlibx::UsartSPIMaster;
// MIDI
typedef avrlibx::Usart<
PortC,
0,
31250,
avrlibx::RX_POLLED,
avrlibx::TX_DISABLED> MidiIO;
struct MidiBufferSpecs {
typedef uint8_t Value;
enum {
buffer_size = 128,
data_size = 8,
};
};
typedef RingBuffer<MidiBufferSpecs> MidiBuffer;
// IO
typedef ParallelPort<PortA, 0, 3> GateInputs;
typedef ParallelPort<PortA, 4, 7> Leds;
typedef ParallelPort<PortB, 0, 3> Switches;
typedef Gpio<PortE, 0> SyncSwitch;
// Audio DAC
typedef Gpio<PortC, 6> DACSS;
typedef UsartSPIMaster<
PortC, 1,
DACSS, avrlibx::MSB_FIRST, 2> AudioDACInterface;
// ADC
typedef Gpio<PortD, 3> ADCSS;
typedef SPIMaster<
PortD, ADCSS,
avrlibx::MSB_FIRST,
avrlibx::SPI_PRESCALER_CLK_16> ADCInterface;
// Timers
typedef Timer<PortC, 0> Channel3Timer;
typedef Timer<PortC, 1> Channel2Timer;
typedef Timer<PortD, 0> Channel1Timer;
typedef Timer<PortD, 1> Channel0Timer;
typedef PWM<PortC, 0> Channel3;
typedef PWM<PortC, 4> Channel2;
typedef PWM<PortD, 0> Channel1;
typedef PWM<PortD, 4> Channel0;
typedef Timer<PortE, 0> AudioRateTimer;
const uint8_t kNumChannels = 4;
#ifdef OCTAL_ADC
const uint8_t kNumAdcChannels = 8;
#else
const uint8_t kNumAdcChannels = 4;
#endif
} // namespace edges
#endif // EDGES_HARDWARE_CONFIG_H_