Mozzi  version v2.0
sound synthesis library for Arduino
config_checks_mbed.h
1 /*
2  * config_checks_mbed.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_MBED_H
13 #define CONFIG_CHECK_MBED_H
14 
66 #if not IS_MBED()
67 #error This header should be included for MBED architecture, only
68 #endif
69 
70 #include "disable_2pinmode_on_github_workflow.h"
71 #if !defined(MOZZI_AUDIO_MODE)
72 #define MOZZI_AUDIO_MODE MOZZI_OUTPUT_INTERNAL_DAC
73 #endif
74 MOZZI_CHECK_SUPPORTED(MOZZI_AUDIO_MODE, MOZZI_OUTPUT_EXTERNAL_TIMED, MOZZI_OUTPUT_EXTERNAL_CUSTOM, MOZZI_OUTPUT_PDM_VIA_SERIAL, MOZZI_OUTPUT_INTERNAL_DAC)
75 
76 #if !defined(MOZZI_AUDIO_RATE)
77 #define MOZZI_AUDIO_RATE 32768
78 #endif
79 
80 #if defined(MOZZI_PWM_RATE)
81 #error Configuration of MOZZI_PWM_RATE is not currently supported on this platform (always same as MOZZI_AUDIO_RATE)
82 #endif
83 
84 #if !defined(MOZZI_ANALOG_READ)
85 # define MOZZI_ANALOG_READ MOZZI_ANALOG_READ_NONE
86 #endif
87 
88 // yes, correct: async "single" reads are not implemented, but audio input is
89 MOZZI_CHECK_SUPPORTED(MOZZI_ANALOG_READ, MOZZI_ANALOG_READ_NONE)
90 MOZZI_CHECK_SUPPORTED(MOZZI_AUDIO_INPUT, MOZZI_AUDIO_INPUT_NONE, MOZZI_AUDIO_INPUT_STANDARD)
91 
92 #if MOZZI_IS(MOZZI_AUDIO_MODE, MOZZI_OUTPUT_INTERNAL_DAC)
93 # if !defined(MOZZI_AUDIO_BITS)
94 # define MOZZI_AUDIO_BITS 12
95 # endif
96 # if !defined(MOZZI_AUDIO_PIN_1)
97 # define MOZZI_AUDIO_PIN_1 A13
98 # endif
99 # if !defined(MOZZI_AUDIO_PIN_2)
100 # define MOZZI_AUDIO_PIN_2 A12
101 # endif
102 #endif
103 
104 #if !defined(MOZZI_AUDIO_BITS)
105 # define MOZZI_AUDIO_BITS 16
106 #endif
107 
108 #if MOZZI_IS(MOZZI_AUDIO_MODE, MOZZI_OUTPUT_PDM_VIA_SERIAL)
109 # if !defined(MOZZI_PDM_RESOLUTION)
110 # define MOZZI_PDM_RESOLUTION 2
111 # endif
112 # if !defined(MOZZI_SERIAL_PIN_TX)
113 # define MOZZI_SERIAL_PIN_TX SERIAL2_TX
114 # endif
115 # if !defined(MOZZI_SERIAL_PIN_RX)
116 # define MOZZI_SERIAL_PIN_RX SERIAL2_RX
117 # endif
118 #endif
119 
120 // All modes besides timed external bypass the output buffer!
121 #if !MOZZI_IS(MOZZI_AUDIO_MODE, MOZZI_OUTPUT_EXTERNAL_TIMED)
122 # define BYPASS_MOZZI_OUTPUT_BUFFER true
123 #endif
124 
125 // TODO: This value is correct for Arduino Giga and Arduino Portenta, but not necessarily everywhere else
126 #define MOZZI__INTERNAL_ANALOG_READ_RESOLUTION 16
127 
128 #endif // #ifndef CONFIG_CHECK_MBED_H
#define MOZZI_AUDIO_INPUT
Whether to enable built in audio input feature.
#define MOZZI_AUDIO_MODE
Configure how Mozzi outputs generated sounds.
#define MOZZI_ANALOG_READ
Whether to compile in support for non-blocking analog reads.