Mozzi  version v2.0
sound synthesis library for Arduino
config_checks_rp2040.h
1 /*
2  * config_checks_rp2040.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_RP2040_H
13 #define CONFIG_CHECK_RP2040_H
14 
72 #if not IS_RP2040()
73 #error This header should be included for RP2040 architecture (Raspberry Pi Pico and others), only
74 #endif
75 
76 #include "disable_2pinmode_on_github_workflow.h"
77 #if !defined(MOZZI_AUDIO_MODE)
78 # define MOZZI_AUDIO_MODE MOZZI_OUTPUT_PWM
79 #endif
80 MOZZI_CHECK_SUPPORTED(MOZZI_AUDIO_MODE, MOZZI_OUTPUT_EXTERNAL_TIMED, MOZZI_OUTPUT_EXTERNAL_CUSTOM, MOZZI_OUTPUT_PWM, MOZZI_OUTPUT_I2S_DAC)
81 
82 #if !defined(MOZZI_AUDIO_RATE)
83 #define MOZZI_AUDIO_RATE 32768
84 #endif
85 
86 #if MOZZI_IS(MOZZI_AUDIO_MODE, MOZZI_OUTPUT_PWM)
87 # if !defined(MOZZI_AUDIO_BITS)
88 # define MOZZI_AUDIO_BITS 16 // PWMAudio expects 16bits
89 # endif
90 # if !defined(MOZZI_AUDIO_PIN_1)
91 # define MOZZI_AUDIO_PIN_1 0
92 # endif
93 # if !defined(MOZZI_AUDIO_PIN_2)
94 # define MOZZI_AUDIO_PIN_2 1
95 # endif
96 # define BYPASS_MOZZI_OUTPUT_BUFFER true
97 # define MOZZI_RP2040_BUFFERS 8 // number of DMA buffers used
98 # if !defined MOZZI_RP2040_BUFFER_SIZE
99 # define MOZZI_RP2040_BUFFER_SIZE MOZZI_OUTPUT_BUFFER_SIZE // total size of the buffer, in samples
100 # if (MOZZI_OUTPUT_BUFFER_SIZE < MOZZI_RP2040_BUFFERS)
101 # error MOZZI_OUTPUT_BUFFER_SIZE cannot be lower than 8 on this platform at the moment
102 # endif
103 # endif
104 #endif
105 
106 #if MOZZI_IS(MOZZI_AUDIO_MODE, MOZZI_OUTPUT_I2S_DAC)
107 # if !defined(MOZZI_AUDIO_BITS)
108 # define MOZZI_AUDIO_BITS 16
109 # endif
110 # if !defined(MOZZI_I2S_PIN_BCK)
111 # define MOZZI_I2S_PIN_BCK 20
112 # endif
113 //# define MOZZI_IS_PIN_WS(MOZZI_I2S_PIN_BCK + 1) // implicit
114 # if !defined(MOZZI_I2S_PIN_DATA)
115 # define MOZZI_I2S_PIN_DATA 22
116 # endif
117 # if !defined(MOZZI_I2S_FORMAT)
118 # define MOZZI_I2S_FORMAT MOZZI_I2S_FORMAT_PLAIN
119 # endif
120 MOZZI_CHECK_SUPPORTED(MOZZI_I2S_FORMAT, MOZZI_I2S_FORMAT_PLAIN, MOZZI_I2S_FORMAT_LSBJ)
121 # define BYPASS_MOZZI_OUTPUT_BUFFER true
122 # define MOZZI_RP2040_BUFFERS 8 // number of DMA buffers used
123 # if !defined MOZZI_RP2040_BUFFER_SIZE
124 # define MOZZI_RP2040_BUFFER_SIZE MOZZI_OUTPUT_BUFFER_SIZE // total size of the buffer, in samples
125 # if (MOZZI_OUTPUT_BUFFER_SIZE < MOZZI_RP2040_BUFFERS)
126 # error MOZZI_OUTPUT_BUFFER_SIZE cannot be lower than 8 on this platform at the moment
127 # endif
128 # endif
129 #endif
130 
131 #if !defined(MOZZI_ANALOG_READ)
132 # define MOZZI_ANALOG_READ MOZZI_ANALOG_READ_STANDARD
133 #endif
134 
135 #define MOZZI__INTERNAL_ANALOG_READ_RESOLUTION 12
136 
137 MOZZI_CHECK_SUPPORTED(MOZZI_ANALOG_READ, MOZZI_ANALOG_READ_NONE, MOZZI_ANALOG_READ_STANDARD)
138 MOZZI_CHECK_SUPPORTED(MOZZI_AUDIO_INPUT, MOZZI_AUDIO_INPUT_NONE, MOZZI_ANALOG_READ_STANDARD)
139 
140 #endif // #ifndef CONFIG_CHECK_RP2040_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.