Mozzi  version v2.0
sound synthesis library for Arduino
config_checks_teensy.h
1 /*
2  * config_checks_teensy.h
3  *
4  * This file is part of Mozzi.
5  *
6  * Copyright 2023-2024 Thomas Friedrichsmeier and the Mozzi Team
7  *
8  * Mozzi is licensed under the GNU Lesser General Public Licence (LGPL) Version 2.1 or later.
9  *
10 */
11 
12 #ifndef CONFIG_CHECK_TEENSY_H
13 #define CONFIG_CHECK_TEENSY_H
14 
91 #if !(IS_TEENSY3() || IS_TEENSY4())
92 #error This header should be included for Teensy (3.x or 4.x) boards, only
93 #endif
94 
95 
96 
97 #if IS_TEENSY3()
98 # include "disable_2pinmode_on_github_workflow.h"
99 # if !defined(MOZZI_AUDIO_MODE)
100 # define MOZZI_AUDIO_MODE MOZZI_OUTPUT_INTERNAL_DAC
101 # endif
102 MOZZI_CHECK_SUPPORTED(MOZZI_AUDIO_MODE, MOZZI_OUTPUT_EXTERNAL_TIMED, MOZZI_OUTPUT_EXTERNAL_CUSTOM, MOZZI_OUTPUT_INTERNAL_DAC)
103 #elif IS_TEENSY4()
104 # include "disable_2pinmode_on_github_workflow.h"
105 # if !defined(MOZZI_AUDIO_MODE)
106 # define MOZZI_AUDIO_MODE MOZZI_OUTPUT_PWM
107 # endif
108 MOZZI_CHECK_SUPPORTED(MOZZI_AUDIO_MODE, MOZZI_OUTPUT_EXTERNAL_TIMED, MOZZI_OUTPUT_EXTERNAL_CUSTOM, MOZZI_OUTPUT_PWM)
109 #endif
110 
111 #if !defined(MOZZI_AUDIO_RATE)
112 #define MOZZI_AUDIO_RATE 32768
113 #endif
114 
115 #if defined(MOZZI_PWM_RATE)
116 #error Configuration of MOZZI_PWM_RATE is not currently supported on this platform (always same as MOZZI_AUDIO_RATE)
117 #endif
118 
119 #if !defined(MOZZI_ANALOG_READ)
120 # define MOZZI_ANALOG_READ MOZZI_ANALOG_READ_STANDARD
121 #endif
122 
123 MOZZI_CHECK_SUPPORTED(MOZZI_ANALOG_READ, MOZZI_ANALOG_READ_NONE, MOZZI_ANALOG_READ_STANDARD)
124 
125 #include "teensyPinMap.h"
126 
127 #if MOZZI_IS(MOZZI_AUDIO_MODE, MOZZI_OUTPUT_INTERNAL_DAC)
128 # define MOZZI_AUDIO_BITS 12 // not configurable
129 # if !defined(MOZZI_AUDIO_PIN_1)
130 # if defined(__MKL26Z64__)
131 # define MOZZI_AUDIO_PIN_1 A12
132 # elif defined(__MK20DX128__) || defined(__MK20DX256__)
133 # define MOZZI_AUDIO_PIN_1 A14
134 # elif defined(__MK64FX512__) || defined(__MK66FX1M0__)
135 # define MOZZI_AUDIO_PIN_1 A21
136 # else
137 # error DAC pin not know for this board. Please define MOZZI_AUDIO_PIN_1 as appropriate
138 # endif
139 # endif
140 # include "disable_stereo_on_github_workflow.h"
141 MOZZI_CHECK_SUPPORTED(MOZZI_AUDIO_CHANNELS, 1)
142 #elif MOZZI_IS(MOZZI_AUDIO_MODE, MOZZI_OUTPUT_PWM)
143 # define MOZZI_AUDIO_BITS 10 // not configurable
144 # if !defined(MOZZI_AUDIO_PIN_1)
145 # define MOZZI_AUDIO_PIN_1 A8
146 # endif
147 # if !defined(MOZZI_AUDIO_PIN_2)
148 # define MOZZI_AUDIO_PIN_2 A9
149 # endif
150 #endif
151 
152 //TODO: Not 100% sure this is correct in all cases.
153 #define MOZZI__INTERNAL_ANALOG_READ_RESOLUTION 10
154 
155 #endif // #ifndef CONFIG_CHECK_TEENSY_H
#define MOZZI_AUDIO_CHANNELS
This sets allows to change from a single/mono audio output channel to stereo output.
#define MOZZI_AUDIO_MODE
Configure how Mozzi outputs generated sounds.
#define MOZZI_ANALOG_READ
Whether to compile in support for non-blocking analog reads.