Skip to content

Commit 605d72b

Browse files
committed
pybricks.hubs.EV3Brick: Guard ev3dev features.
Use the existing flag for this.
1 parent d186362 commit 605d72b

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

pybricks/hubs/pb_type_ev3brick.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@
1111
#include <pybricks/util_mp/pb_obj_helper.h>
1212
#include <pybricks/util_pb/pb_error.h>
1313

14+
#if PYBRICKS_RUNS_ON_EV3DEV
1415
#include "pb_ev3dev_types.h"
1516

16-
1717
// defined in pbio/platform/ev3dev_stretch/status_light.c
1818
extern pbio_color_light_t *ev3dev_status_light;
19+
#endif // PYBRICKS_RUNS_ON_EV3DEV
1920

2021
typedef struct _hubs_EV3Brick_obj_t {
2122
mp_obj_base_t base;
@@ -55,10 +56,12 @@ STATIC mp_obj_t hubs_EV3Brick_make_new(const mp_obj_type_t *type, size_t n_args,
5556

5657
self->battery = MP_OBJ_FROM_PTR(&pb_module_battery);
5758
self->buttons = pb_type_Keypad_obj_new(pb_type_ev3brick_button_pressed);
59+
#if PYBRICKS_RUNS_ON_EV3DEV
5860
self->light = common_ColorLight_internal_obj_new(ev3dev_status_light);
5961
mp_obj_t screen_args[] = { MP_ROM_QSTR(MP_QSTR__screen_) };
6062
self->screen = MP_OBJ_TYPE_GET_SLOT(&pb_type_ev3dev_Image, make_new)(&pb_type_ev3dev_Image, 1, 0, screen_args);
6163
self->speaker = MP_OBJ_TYPE_GET_SLOT(&pb_type_ev3dev_Speaker, make_new)(&pb_type_ev3dev_Speaker, 0, 0, NULL);
64+
#endif // PYBRICKS_RUNS_ON_EV3DEV
6265
self->system = MP_OBJ_FROM_PTR(&pb_type_System);
6366

6467
return MP_OBJ_FROM_PTR(self);
@@ -67,9 +70,11 @@ STATIC mp_obj_t hubs_EV3Brick_make_new(const mp_obj_type_t *type, size_t n_args,
6770
STATIC const pb_attr_dict_entry_t hubs_EV3Brick_attr_dict[] = {
6871
PB_DEFINE_CONST_ATTR_RO(MP_QSTR_battery, hubs_EV3Brick_obj_t, battery),
6972
PB_DEFINE_CONST_ATTR_RO(MP_QSTR_buttons, hubs_EV3Brick_obj_t, buttons),
73+
#if PYBRICKS_RUNS_ON_EV3DEV
7074
PB_DEFINE_CONST_ATTR_RO(MP_QSTR_light, hubs_EV3Brick_obj_t, light),
7175
PB_DEFINE_CONST_ATTR_RO(MP_QSTR_screen, hubs_EV3Brick_obj_t, screen),
7276
PB_DEFINE_CONST_ATTR_RO(MP_QSTR_speaker, hubs_EV3Brick_obj_t, speaker),
77+
#endif // PYBRICKS_RUNS_ON_EV3DEV
7378
PB_DEFINE_CONST_ATTR_RO(MP_QSTR_system, hubs_EV3Brick_obj_t, system),
7479
PB_ATTR_DICT_SENTINEL
7580
};

0 commit comments

Comments
 (0)