Skip to content

Commit b7a76e4

Browse files
committedFeb 8, 2021
codal_port/mphalport.h: Add defines for C-level pin API.
So that machine.time_pulse_us() works (prior to this commit it was using the virtual-pin API and not working). Signed-off-by: Damien George <[email protected]>
1 parent c758618 commit b7a76e4

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed
 

‎src/codal_port/modmicrobit.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ extern const struct _microbit_button_obj_t microbit_button_a_obj;
191191
extern const struct _microbit_button_obj_t microbit_button_b_obj;
192192

193193
const microbit_pin_obj_t *microbit_obj_get_pin(mp_const_obj_t o);
194+
uint8_t microbit_obj_get_pin_name(mp_obj_t o);
194195

195196
// Release pin for use by other modes. Safe to call in an interrupt.
196197
// If pin is NULL or pin already unused, then this is a no-op

‎src/codal_port/mphalport.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,9 @@
3030
#define mp_hal_ticks_cpu() (0)
3131

3232
void mp_hal_set_interrupt_char(int c);
33+
34+
// MicroPython low-level C API for pins
35+
#include "modmicrobit.h"
36+
#define mp_hal_pin_obj_t uint8_t
37+
#define mp_hal_get_pin_obj(obj) microbit_obj_get_pin_name(obj)
38+
#define mp_hal_pin_read(pin) microbit_hal_pin_read(pin)

0 commit comments

Comments
 (0)
Please sign in to comment.