Skip to content

Commit a1be53a

Browse files
committed
codal_app: Rename microphone event constants.
To make it clear they are events. Signed-off-by: Damien George <[email protected]>
1 parent 8970afb commit a1be53a

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/codal_app/microbithal.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,9 @@ extern "C" {
8787
#define MICROBIT_HAL_ACCELEROMETER_EVT_SHAKE (11)
8888
#define MICROBIT_HAL_ACCELEROMETER_EVT_2G (12)
8989

90-
#define MICROBIT_HAL_MICROPHONE_LEVEL_THRESHOLD_LOW (1)
91-
#define MICROBIT_HAL_MICROPHONE_LEVEL_THRESHOLD_HIGH (2)
90+
// Microphone events, passed to microbit_hal_level_detector_callback().
91+
#define MICROBIT_HAL_MICROPHONE_EVT_THRESHOLD_LOW (1)
92+
#define MICROBIT_HAL_MICROPHONE_EVT_THRESHOLD_HIGH (2)
9293

9394
#define MICROBIT_HAL_LOG_TIMESTAMP_NONE (0)
9495
#define MICROBIT_HAL_LOG_TIMESTAMP_MILLISECONDS (1)

src/codal_port/microbit_microphone.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ static uint8_t sound_event_history_array[EVENT_HISTORY_SIZE];
5050
void microbit_hal_level_detector_callback(int value) {
5151
// Work out the sound event.
5252
uint8_t ev;
53-
if (value == MICROBIT_HAL_MICROPHONE_LEVEL_THRESHOLD_LOW) {
53+
if (value == MICROBIT_HAL_MICROPHONE_EVT_THRESHOLD_LOW) {
5454
ev = SOUND_EVENT_QUIET;
55-
} else if (value == MICROBIT_HAL_MICROPHONE_LEVEL_THRESHOLD_HIGH) {
55+
} else if (value == MICROBIT_HAL_MICROPHONE_EVT_THRESHOLD_HIGH) {
5656
ev = SOUND_EVENT_LOUD;
5757
} else {
5858
// Ignore unknown events.

0 commit comments

Comments
 (0)