Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/codal_app/microbithal_microphone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void microbit_hal_microphone_init(void) {

void microbit_hal_microphone_set_threshold(int kind, int value) {
value = value * SOUND_LEVEL_MAXIMUM / 255;
if (kind == 0) {
if (kind == MICROBIT_HAL_MICROPHONE_LEVEL_THRESHOLD_LOW) {
level->setLowThreshold(value);
} else {
level->setHighThreshold(value);
Expand Down
4 changes: 2 additions & 2 deletions src/codal_port/microbit_microphone.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ STATIC mp_obj_t microbit_microphone_set_threshold(mp_obj_t self_in, mp_obj_t sou
uint8_t sound = sound_event_from_obj(sound_in);
int kind;
if (sound == SOUND_EVENT_QUIET) {
kind = 0;
kind = MICROBIT_HAL_MICROPHONE_LEVEL_THRESHOLD_LOW;
} else if (sound == SOUND_EVENT_LOUD) {
kind = 1;
kind = MICROBIT_HAL_MICROPHONE_LEVEL_THRESHOLD_HIGH;
} else {
mp_raise_ValueError(MP_ERROR_TEXT("invalid sound"));
}
Expand Down