Mozzi  version v2.0
sound synthesis library for Arduino
config_checks_stm32duino.h
1 /*
2  * config_checks_stm32duino.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_CHECKS_STM32DUINO_H
13 #define CONFIG_CHECKS_STM32DUINO_H
14 
94 #if not IS_STM32DUINO()
95 #error This header should be included for STM32 (stm32duino.com core), only
96 #endif
97 
98 #if !defined(MOZZI_AUDIO_MODE)
99 # define MOZZI_AUDIO_MODE MOZZI_OUTPUT_PWM
100 #endif
101 MOZZI_CHECK_SUPPORTED(MOZZI_AUDIO_MODE, MOZZI_OUTPUT_EXTERNAL_TIMED, MOZZI_OUTPUT_EXTERNAL_CUSTOM, MOZZI_OUTPUT_PWM, MOZZI_OUTPUT_2PIN_PWM)
102 
103 #if !defined(MOZZI_AUDIO_RATE)
104 # define MOZZI_AUDIO_RATE 32768
105 #endif
106 
107 #if MOZZI_IS(MOZZI_AUDIO_MODE, MOZZI_OUTPUT_PWM, MOZZI_OUTPUT_2PIN_PWM, MOZZI_OUTPUT_EXTERNAL_TIMED)
108 # if !defined(MOZZI_AUDIO_UPDATE_TIMER)
109 # define MOZZI_AUDIO_UPDATE_TIMER TIM2
110 # endif
111 #endif
112 
113 #if MOZZI_IS(MOZZI_AUDIO_MODE, MOZZI_OUTPUT_PWM)
114 # if !defined(MOZZI_AUDIO_PIN_1)
115 # define MOZZI_AUDIO_PIN_1 PA8
116 # endif
117 # if (MOZZI_AUDIO_CHANNELS > 1) && !defined(MOZZI_AUDIO_PIN_1)
118 # define MOZZI_AUDIO_PIN_2 PA9
119 # endif
120 # if !defined(MOZZI_AUDIO_BITS)
121 # define MOZZI_AUDIO_BITS 10
122 # endif
123 # define MOZZI_AUDIO_BITS_PER_CHANNEL MOZZI_AUDIO_BITS
124 #elif MOZZI_IS(MOZZI_AUDIO_MODE, MOZZI_OUTPUT_2PIN_PWM)
125 # if !defined(MOZZI_AUDIO_PIN_1)
126 # define MOZZI_AUDIO_PIN_1 PA8
127 # endif
128 # if !defined(MOZZI_AUDIO_PIN_1_LOW)
129 # define MOZZI_AUDIO_PIN_1_LOW PA9
130 # endif
131 # include "disable_stereo_on_github_workflow.h"
132 MOZZI_CHECK_SUPPORTED(MOZZI_AUDIO_CHANNELS, 1)
133 # if !defined(MOZZI_AUDIO_PER_CHANNEL)
134 # define MOZZI_AUDIO_BITS_PER_CHANNEL 7
135 # endif
136 # define MOZZI_AUDIO_BITS (MOZZI_AUDIO_BITS_PER_CHANNEL * 2)
137 #endif
138 
139 #if !defined(MOZZI_ANALOG_READ)
140 #define MOZZI_ANALOG_READ MOZZI_ANALOG_READ_STANDARD
141 #endif
142 
143 #define MOZZI__INTERNAL_ANALOG_READ_RESOLUTION ADC_RESOLUTION
144 
145 #endif // #ifndef CONFIG_CHECKS_STM32DUINO_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.