89 #if not defined(MOZZI_AUDIO_MODE)
90 #define MOZZI_AUDIO_MODE MOZZI_OUTPUT_PWM
93 #if not defined(MOZZI_AUDIO_RATE)
94 #define MOZZI_AUDIO_RATE 16384
97 #if not defined(MOZZI_ANALOG_READ)
98 #define MOZZI_ANALOG_READ MOZZI_ANALOG_READ_STANDARD
102 #if MOZZI_IS(MOZZI_AUDIO_MODE, MOZZI_OUTPUT_PWM)
103 # if !defined(MOZZI_AUDIO_PIN_1)
104 #define MOZZI_AUDIO_PIN_1 TIMER1_A_PIN
105 #define MOZZI_AUDIO_PIN_1_REGISTER OCR1A
107 # if (MOZZI_AUDIO_CHANNELS > 1
) && !defined(MOZZI_AUDIO_PIN_2)
108 #define MOZZI_AUDIO_PIN_2 TIMER1_B_PIN
109 #define MOZZI_AUDIO_PIN_2_REGISTER OCR1B
112 # if !defined(MOZZI_PWM_RATE)
113 #define MOZZI_PWM_RATE 32768
116 #define MOZZI_AUDIO_BITS 8
117 #define MOZZI_AUDIO_BITS_OPTIMISTIC 9
118 #define MOZZI_AUDIO_BIAS ((uint8_t) 244
)
122 #if MOZZI_IS(MOZZI_AUDIO_MODE, MOZZI_OUTPUT_2PIN_PWM)
123 # if !defined(MOZZI_AUDIO_PIN_1)
124 #define MOZZI_AUDIO_PIN_1 TIMER1_A_PIN
125 #define MOZZI_AUDIO_PIN_1_REGISTER OCR1A
127 # if !defined(MOZZI_AUDIO_PIN_1_LOW)
128 #define MOZZI_AUDIO_PIN_1_LOW TIMER1_B_PIN
129 #define MOZZI_AUDIO_PIN_1_LOW_REGISTER OCR1B
132 # if !defined(MOZZI_PWM_RATE)
133 #define MOZZI_PWM_RATE 125000
136 # if !defined(MOZZI_AUDIO_BITS_PER_CHANNEL)
137 #define MOZZI_AUDIO_BITS_PER_CHANNEL 7
140 #define MOZZI_AUDIO_BITS (2
*MOZZI_AUDIO_BITS_PER_CHANNEL)
143 #define MOZZI__INTERNAL_ANALOG_READ_RESOLUTION 10
148 MOZZI_CHECK_SUPPORTED(
MOZZI_AUDIO_MODE, MOZZI_OUTPUT_PWM, MOZZI_OUTPUT_2PIN_PWM, MOZZI_OUTPUT_EXTERNAL_TIMED, MOZZI_OUTPUT_EXTERNAL_CUSTOM)
150 #if MOZZI_IS(MOZZI_AUDIO_MODE, MOZZI_OUTPUT_PWM)
151 MOZZI_CHECK_SUPPORTED(MOZZI_AUDIO_CHANNELS, MOZZI_MONO, MOZZI_STEREO)
153 #if MOZZI_IS(MOZZI_AUDIO_MODE, MOZZI_OUTPUT_2PIN_PWM)
154 MOZZI_CHECK_SUPPORTED(MOZZI_AUDIO_CHANNELS, MOZZI_MONO)
162 MOZZI_CHECK_SUPPORTED(
MOZZI_ANALOG_READ, MOZZI_ANALOG_READ_NONE, MOZZI_ANALOG_READ_STANDARD)
163 MOZZI_CHECK_SUPPORTED(MOZZI_AUDIO_INPUT, MOZZI_AUDIO_INPUT_NONE, MOZZI_AUDIO_INPUT_STANDARD)
164 #include "../config/known_16bit_timers.h"
166 #if MOZZI_IS(MOZZI_AUDIO_MODE, MOZZI_OUTPUT_PWM, MOZZI_OUTPUT_2PIN_PWM)
167 # if defined(TIMER1_C_PIN)
168 MOZZI_CHECK_SUPPORTED(MOZZI_AUDIO_PIN_1, TIMER1_A_PIN, TIMER1_B_PIN, TIMER1_C_PIN);
170 MOZZI_CHECK_SUPPORTED(MOZZI_AUDIO_PIN_1, TIMER1_A_PIN, TIMER1_B_PIN);