File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed
Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -104,6 +104,26 @@ int microbit_hal_temperature(void) {
104104 return uBit.thermometer .getTemperature ();
105105}
106106
107+ void microbit_hal_power_wake_on_button (int button) {
108+ button_obj[button]->wakeOnActive (true );
109+ }
110+
111+ void microbit_hal_power_wake_on_pin (int pin) {
112+ pin_obj[pin]->wakeOnActive (true );
113+ }
114+
115+ void microbit_hal_power_off (void ) {
116+ uBit.power .off ();
117+ }
118+
119+ void microbit_hal_power_deep_sleep (bool wake_on_ms, uint32_t ms) {
120+ if (wake_on_ms) {
121+ uBit.power .deepSleep (ms);
122+ } else {
123+ uBit.power .deepSleep ();
124+ }
125+ }
126+
107127void microbit_hal_pin_set_pull (int pin, int pull) {
108128 pin_obj[pin]->setPull (pin_pull_mode_mapping[pull]);
109129 pin_pull_state[pin] = pull;
Original file line number Diff line number Diff line change @@ -103,6 +103,11 @@ void microbit_hal_reset(void);
103103void microbit_hal_panic (int );
104104int microbit_hal_temperature (void );
105105
106+ void microbit_hal_power_wake_on_button (int button );
107+ void microbit_hal_power_wake_on_pin (int pin );
108+ void microbit_hal_power_off (void );
109+ void microbit_hal_power_deep_sleep (bool wake_on_ms , uint32_t ms );
110+
106111void microbit_hal_pin_set_pull (int pin , int pull );
107112int microbit_hal_pin_get_pull (int pin );
108113int microbit_hal_pin_set_analog_period_us (int pin , int period );
You can’t perform that action at this time.
0 commit comments