88
99#if PYBRICKS_PY_COMMON
1010
11- #include <pbio/control.h>
12- #include <pbio/servo.h>
13-
1411#include "util_pb/pb_device.h"
1512
1613#include "py/obj.h"
@@ -29,6 +26,45 @@ const mp_obj_module_t pb_module_buttons;
2926// pybricks._common.Battery()
3027const mp_obj_module_t pb_module_battery ;
3128
29+
30+ #if PYBRICKS_PY_COMMON_MOTORS
31+
32+ #include <pbio/control.h>
33+ #include <pbio/servo.h>
34+
35+ // pybricks._common.Control()
36+ const mp_obj_type_t pb_type_Control ;
37+ mp_obj_t common_Control_obj_make_new (pbio_control_t * control );
38+
39+ // pybricks._common.Logger()
40+ mp_obj_t logger_obj_make_new (pbio_log_t * log );
41+
42+ // pybricks._common.Motor()
43+ typedef struct _common_Motor_obj_t {
44+ mp_obj_base_t base ;
45+ pbio_servo_t * srv ;
46+ mp_obj_t logger ;
47+ mp_obj_t control ;
48+ } common_Motor_obj_t ;
49+
50+ const mp_obj_type_t pb_type_Motor ;
51+
52+ // pybricks._common.DCMotor()
53+ typedef struct _common_DCMotor_obj_t {
54+ mp_obj_base_t base ;
55+ pbio_dcmotor_t * dcmotor ;
56+ } common_DCMotor_obj_t ;
57+
58+ const mp_obj_type_t pb_type_DCMotor ;
59+
60+ // Nonstatic objects shared between Motor and DCMotor
61+ void common_DCMotor_print (const mp_print_t * print , mp_obj_t self_in , mp_print_kind_t kind );
62+ const mp_obj_fun_builtin_var_t common_DCMotor_duty_obj ;
63+ const mp_obj_fun_builtin_fixed_t common_DCMotor_stop_obj ;
64+ const mp_obj_fun_builtin_fixed_t common_DCMotor_brake_obj ;
65+
66+ #endif // PYBRICKS_PY_COMMON_MOTORS
67+
3268#endif // PYBRICKS_PY_COMMON
3369
3470#endif // PYBRICKS_INCLUDED_PYBRICKS_COMMON_H
0 commit comments