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 # define MOZZI_RP2040_BUFFER_SIZE 256 // total size of the buffer, in samples
99 #endif
100 
101 #if MOZZI_IS(MOZZI_AUDIO_MODE, MOZZI_OUTPUT_I2S_DAC)
102 # if !defined(MOZZI_AUDIO_BITS)
103 # define MOZZI_AUDIO_BITS 16
104 # endif
105 # if !defined(MOZZI_I2S_PIN_BCK)
106 # define MOZZI_I2S_PIN_BCK 20
107 # endif
108 //# define MOZZI_IS_PIN_WS(MOZZI_I2S_PIN_BCK + 1) // implicit
109 # if !defined(MOZZI_I2S_PIN_DATA)
110 # define MOZZI_I2S_PIN_DATA 22
111 # endif
112 # if !defined(MOZZI_I2S_FORMAT)
113 # define MOZZI_I2S_FORMAT MOZZI_I2S_FORMAT_PLAIN
114 # endif
115 MOZZI_CHECK_SUPPORTED(MOZZI_I2S_FORMAT, MOZZI_I2S_FORMAT_PLAIN, MOZZI_I2S_FORMAT_LSBJ)
116 # define BYPASS_MOZZI_OUTPUT_BUFFER true
117 # define MOZZI_RP2040_BUFFERS 8 // number of DMA buffers used
118 # define MOZZI_RP2040_BUFFER_SIZE 256 // total size of the buffer, in samples
119 #endif
120 
121 #if !defined(MOZZI_ANALOG_READ)
122 # define MOZZI_ANALOG_READ MOZZI_ANALOG_READ_STANDARD
123 #endif
124 
125 #define MOZZI__INTERNAL_ANALOG_READ_RESOLUTION 12
126 
127 MOZZI_CHECK_SUPPORTED(MOZZI_ANALOG_READ, MOZZI_ANALOG_READ_NONE, MOZZI_ANALOG_READ_STANDARD)
128 MOZZI_CHECK_SUPPORTED(MOZZI_AUDIO_INPUT, MOZZI_AUDIO_INPUT_NONE, MOZZI_ANALOG_READ_STANDARD)
129 
130 #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.