Skip to content

Commit 11deadd

Browse files
Fix shim to hide soundLevelDbC() C func, update test code to also serial.
1 parent 6e60d42 commit 11deadd

File tree

3 files changed

+2
-5
lines changed

3 files changed

+2
-5
lines changed

main.ts

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ let maxSound = 0
22
let soundLevel = 0
33
basic.forever(function () {
44
soundLevel = input.soundLevelDb()
5+
serial.writeLine("" + (soundLevel))
56
led.plotBarGraph(
67
Math.map(soundLevel, 30, 120, 0, 25),
78
25

shims.d.ts

-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
// Auto-generated. Do not edit.
22
declare namespace input {
33

4-
/**
5-
* IGNORE THIS VERSION, only used for testing.
6-
*/
7-
//% blockId=device_get_sound_level_db shim=input::soundLevelDbC
8-
function soundLevelDbC(): int32;
94
}
105

116
// Auto-generated. Do not edit. Really.

soundleveldb.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ int scaleLowerDbValues(int value) {
4242
return MIN_DB + (int)(RANGE_DB * nonLinearFraction);
4343
}
4444

45+
/** The C++ function that return sound level in decibels */
4546
//% blockId=device_get_sound_level_db
4647
int soundLevelDbC() {
4748
#if MICROBIT_CODAL

0 commit comments

Comments
 (0)