Skip to content
Open
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
15 changes: 15 additions & 0 deletions libs/hw---gdk/analog.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace gdk {
/**
* Blocking single-shot ADC read of P0 (P0.02 / AIN0). Returns 0..1023 (same
* scale as pins.analogReadPin), or -1 on hardware timeout.
*
* On micro:bit V2 the native SAADC implementation in analog.cpp is used.
* The body below is the simulator fallback: there is no SAADC in the
* simulator, so it reports a full battery (1023) to keep the battery
* monitor and any game running without a runtime error.
*/
//% shim=gdk::readP0Adc
export function readP0Adc(): number {
return 1023;
}
}
2 changes: 1 addition & 1 deletion libs/hw---gdk/pxt.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"files": [
"config.ts",
"init.ts",
"analog.ts",
"batteryled.ts",
"device.d.ts",
"shims.d.ts",
"analog.cpp"
],
"card": {
Expand Down
22 changes: 0 additions & 22 deletions libs/hw---gdk/shims.d.ts

This file was deleted.

Loading