Skip to content

Commit 41a8a6b

Browse files
committed
zephyrCommon: Make configurable the max number of tones
Allows you to change the maximum number of notes that can be played with `tone()`. Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
1 parent 9c4ef9b commit 41a8a6b

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

Kconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,8 @@ config ARDUINO_ENTRY
3434
bool "Provide arduino setup and loop entry points"
3535
default y
3636

37+
config ARDUINO_MAX_TONES
38+
int "Specify the number of sounds that can be played simultaneously with tone()"
39+
default -1
40+
3741
endif

cores/arduino/zephyrCommon.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,10 @@ PinStatus digitalRead(pin_size_t pinNumber) {
212212
return (gpio_pin_get_dt(&arduino_pins[pinNumber]) == 1) ? HIGH : LOW;
213213
}
214214

215-
#ifndef MAX_TONE_PINS
215+
#if CONFIG_ARDUINO_MAX_TONES == -1
216216
#define MAX_TONE_PINS DT_PROP_LEN(DT_PATH(zephyr_user), digital_pin_gpios)
217+
#else
218+
#define MAX_TONE_PINS CONFIG_ARDUINO_MAX_TONES
217219
#endif
218220

219221
#define TOGGLES_PER_CYCLE 2ULL

0 commit comments

Comments
 (0)