Skip to content

Commit 1970ca2

Browse files
committed
pybricks/ev3devices: Enable remaining device support
This compiles, and IR distance measurement appears to be working correctly. Ultrasonic sensors and gyro have not been manually tested but are expected to work as they share the common UART protocol handling.
1 parent 4484552 commit 1970ca2

File tree

5 files changed

+8
-15
lines changed

5 files changed

+8
-15
lines changed

pybricks/ev3devices.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,10 @@
1212

1313
extern const mp_obj_type_t pb_type_ev3devices_TouchSensor;
1414
extern const mp_obj_type_t pb_type_ev3devices_ColorSensor;
15-
16-
#endif // PYBRICKS_PY_EV3DEVICES
17-
18-
#if PYBRICKS_PY_EV3DEVDEVICES
19-
2015
extern const mp_obj_type_t pb_type_ev3devices_InfraredSensor;
21-
extern const mp_obj_type_t pb_type_ev3devices_GyroSensor;
2216
extern const mp_obj_type_t pb_type_ev3devices_UltrasonicSensor;
17+
extern const mp_obj_type_t pb_type_ev3devices_GyroSensor;
2318

24-
#endif // PYBRICKS_PY_EV3DEVDEVICES
19+
#endif // PYBRICKS_PY_EV3DEVICES
2520

2621
#endif // PYBRICKS_INCLUDED_PYBRICKS_EV3DEVICES_H

pybricks/ev3devices/pb_module_ev3devices.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,9 @@ static const mp_rom_map_elem_t ev3devices_globals_table[] = {
1515
#endif
1616
{ MP_ROM_QSTR(MP_QSTR_TouchSensor), MP_ROM_PTR(&pb_type_ev3devices_TouchSensor) },
1717
{ MP_ROM_QSTR(MP_QSTR_ColorSensor), MP_ROM_PTR(&pb_type_ev3devices_ColorSensor) },
18-
#if PYBRICKS_PY_EV3DEVDEVICES
1918
{ MP_ROM_QSTR(MP_QSTR_InfraredSensor), MP_ROM_PTR(&pb_type_ev3devices_InfraredSensor) },
2019
{ MP_ROM_QSTR(MP_QSTR_UltrasonicSensor), MP_ROM_PTR(&pb_type_ev3devices_UltrasonicSensor)},
2120
{ MP_ROM_QSTR(MP_QSTR_GyroSensor), MP_ROM_PTR(&pb_type_ev3devices_GyroSensor) },
22-
#endif
2321
};
2422
static MP_DEFINE_CONST_DICT(pb_module_ev3devices_globals, ev3devices_globals_table);
2523

pybricks/ev3devices/pb_type_ev3devices_gyrosensor.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#include "py/mpconfig.h"
55

6-
#if PYBRICKS_PY_EV3DEVDEVICES
6+
#if PYBRICKS_PY_EV3DEVICES
77

88
#include <pybricks/common.h>
99
#include <pybricks/ev3devices.h>
@@ -103,4 +103,4 @@ MP_DEFINE_CONST_OBJ_TYPE(pb_type_ev3devices_GyroSensor,
103103
make_new, ev3devices_GyroSensor_make_new,
104104
locals_dict, &ev3devices_GyroSensor_locals_dict);
105105

106-
#endif // PYBRICKS_PY_EV3DEVDEVICES
106+
#endif // PYBRICKS_PY_EV3DEVICES

pybricks/ev3devices/pb_type_ev3devices_infraredsensor.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#include "py/mpconfig.h"
55

6-
#if PYBRICKS_PY_EV3DEVDEVICES
6+
#if PYBRICKS_PY_EV3DEVICES
77

88
#include <pybricks/common.h>
99
#include <pybricks/ev3devices.h>
@@ -181,4 +181,4 @@ MP_DEFINE_CONST_OBJ_TYPE(pb_type_ev3devices_InfraredSensor,
181181
make_new, ev3devices_InfraredSensor_make_new,
182182
locals_dict, &ev3devices_InfraredSensor_locals_dict);
183183

184-
#endif // PYBRICKS_PY_EV3DEVDEVICES
184+
#endif // PYBRICKS_PY_EV3DEVICES

pybricks/ev3devices/pb_type_ev3devices_ultrasonicsensor.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#include "py/mpconfig.h"
55

6-
#if PYBRICKS_PY_EV3DEVDEVICES
6+
#if PYBRICKS_PY_EV3DEVICES
77

88
#include <pybricks/common.h>
99
#include <pybricks/ev3devices.h>
@@ -63,4 +63,4 @@ MP_DEFINE_CONST_OBJ_TYPE(pb_type_ev3devices_UltrasonicSensor,
6363
make_new, ev3devices_UltrasonicSensor_make_new,
6464
locals_dict, &ev3devices_UltrasonicSensor_locals_dict);
6565

66-
#endif // PYBRICKS_PY_EV3DEVDEVICES
66+
#endif // PYBRICKS_PY_EV3DEVICES

0 commit comments

Comments
 (0)