Mozzi  version v2.0
sound synthesis library for Arduino
config_checks_stm32maple.h
1 /*
2  * config_checks_stm32maple.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_STM32MAPLE_H
13 #define CONFIG_CHECKS_STM32MAPLE_H
14 
82 #if not IS_STM32MAPLE()
83 #error This header should be included for STM32 (libmaple based core), only
84 #endif
85 
86 #if !defined(MOZZI_AUDIO_MODE)
87 # define MOZZI_AUDIO_MODE MOZZI_OUTPUT_PWM
88 #endif
89 MOZZI_CHECK_SUPPORTED(MOZZI_AUDIO_MODE, MOZZI_OUTPUT_EXTERNAL_TIMED, MOZZI_OUTPUT_EXTERNAL_CUSTOM, MOZZI_OUTPUT_PWM, MOZZI_OUTPUT_2PIN_PWM)
90 
91 #if !defined(MOZZI_AUDIO_RATE)
92 # define MOZZI_AUDIO_RATE 32768
93 #endif
94 
95 #if MOZZI_IS(MOZZI_AUDIO_MODE, MOZZI_OUTPUT_PWM, MOZZI_OUTPUT_2PIN_PWM, MOZZI_OUTPUT_EXTERNAL_TIMED)
96 # if !defined(MOZZI_AUDIO_UPDATE_TIMER)
97 # define MOZZI_AUDIO_UPDATE_TIMER 2
98 # endif
99 # if !defined(MOZZI_AUDIO_PWM_TIMER)
100 # define MOZZI_AUDIO_PWM_TIMER 4
101 # endif
102 #endif
103 
104 #if MOZZI_IS(MOZZI_AUDIO_MODE, MOZZI_OUTPUT_PWM)
105 # if !defined(MOZZI_AUDIO_PIN_1)
106 # define MOZZI_AUDIO_PIN_1 PB8
107 # endif
108 # if (MOZZI_AUDIO_CHANNELS > 1) && !defined(MOZZI_AUDIO_PIN_1)
109 # define MOZZI_AUDIO_PIN_2 PB9
110 # endif
111 # if !defined(MOZZI_AUDIO_BITS)
112 # define MOZZI_AUDIO_BITS 10
113 # endif
114 # define MOZZI_AUDIO_BITS_PER_CHANNEL MOZZI_AUDIO_BITS
115 #elif MOZZI_IS(MOZZI_AUDIO_MODE, MOZZI_OUTPUT_2PIN_PWM)
116 # if !defined(MOZZI_AUDIO_PIN_1)
117 # define MOZZI_AUDIO_PIN_1 PB8
118 # endif
119 # if !defined(MOZZI_AUDIO_PIN_1_LOW)
120 # define MOZZI_AUDIO_PIN_1_LOW PB9
121 # endif
122 # include "disable_stereo_on_github_workflow.h"
123 MOZZI_CHECK_SUPPORTED(MOZZI_AUDIO_CHANNELS, 1)
124 # if !defined(MOZZI_AUDIO_PER_CHANNEL)
125 # define MOZZI_AUDIO_PER_CHANNEL 7
126 # endif
127 # define MOZZI_AUDIO_BITS MOZZI_AUDIO_BITS_PER_CHANNEL * 2
128 #endif
129 
130 #if !defined(MOZZI_ANALOG_READ)
131 #define MOZZI_ANALOG_READ MOZZI_ANALOG_READ_STANDARD
132 #endif
133 
134 // TODO: This probably isn't correct for all boards!
135 #define MOZZI__INTERNAL_ANALOG_READ_RESOLUTION 12
136 
137 #endif // #ifndef CONFIG_CHECKS_STM32MAPLE_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.