File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed
Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -166,6 +166,7 @@ int microbit_hal_compass_get_heading(void);
166166void microbit_hal_microphone_init (void );
167167void microbit_hal_microphone_set_threshold (int kind , int value );
168168int microbit_hal_microphone_get_level (void );
169+ float microbit_hal_microphone_get_level_db (void );
169170
170171const uint8_t * microbit_hal_get_font_data (char c );
171172
Original file line number Diff line number Diff line change @@ -59,4 +59,11 @@ int microbit_hal_microphone_get_level(void) {
5959 return value;
6060}
6161
62+ float microbit_hal_microphone_get_level_db (void ) {
63+ uBit.audio .levelSPL ->setUnit (LEVEL_DETECTOR_SPL_DB);
64+ float value = uBit.audio .levelSPL ->getValue ();
65+ uBit.audio .levelSPL ->setUnit (LEVEL_DETECTOR_SPL_8BIT);
66+ return value;
67+ }
68+
6269}
You can’t perform that action at this time.
0 commit comments