Skip to content

Commit 05a3e50

Browse files
committed
pybricks: reduce unused includes
This is a first quick pass over all modules/types.
1 parent 8b35da3 commit 05a3e50

File tree

72 files changed

+165
-460
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+165
-460
lines changed

pybricks/common.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88

99
#if PYBRICKS_PY_COMMON
1010

11-
#include <pybricks/util_pb/pb_device.h>
12-
1311
#include "py/obj.h"
1412

13+
#include <pybricks/util_pb/pb_device.h>
14+
1515
// pybricks._common.ColorLight()
1616
const mp_obj_type_t pb_type_ColorLight;
1717
mp_obj_t common_ColorLight_obj_make_new(pb_device_t *pbdev);

pybricks/common/pb_type_battery.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@
55

66
#if PYBRICKS_PY_COMMON
77

8-
#include "py/obj.h"
8+
#include <pbdrv/battery.h>
99

1010
#include <pbio/button.h>
1111

12+
#include "py/obj.h"
13+
1214
#include <pybricks/common.h>
1315
#include <pybricks/parameters.h>
1416
#include <pybricks/util_pb/pb_error.h>
@@ -17,9 +19,6 @@
1719
// an instance of a Battery type. That would make it consistent with the other
1820
// C types and the high level Python API.
1921

20-
#include <pybricks/util_pb/pb_error.h>
21-
#include <pbdrv/battery.h>
22-
2322
STATIC mp_obj_t battery_voltage(void) {
2423
uint16_t volt;
2524
pb_assert(pbdrv_battery_get_voltage_now(&volt));

pybricks/common/pb_type_colorlight.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
#include <pbio/light.h>
99
#include <pbio/color.h>
1010

11+
#include "py/obj.h"
12+
1113
#include <pybricks/common.h>
1214
#include <pybricks/parameters.h>
1315

14-
#include "py/obj.h"
15-
1616
#include <pybricks/util_pb/pb_error.h>
1717
#include <pybricks/util_mp/pb_obj_helper.h>
1818
#include <pybricks/util_mp/pb_kwarg_helper.h>

pybricks/common/pb_type_control.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55

66
#if PYBRICKS_PY_COMMON_MOTORS
77

8-
#include <pybricks/common.h>
98
#include <pbio/control.h>
109

1110
#include "py/obj.h"
1211

12+
#include <pybricks/common.h>
13+
1314
#include <pybricks/util_pb/pb_error.h>
1415
#include <pybricks/util_mp/pb_obj_helper.h>
1516
#include <pybricks/util_mp/pb_kwarg_helper.h>

pybricks/common/pb_type_dcmotor.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55

66
#if PYBRICKS_PY_COMMON_MOTORS
77

8-
#include <inttypes.h>
9-
108
#include "py/mphal.h"
119

1210
#include <pybricks/common.h>

pybricks/common/pb_type_keypad.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@
55

66
#if PYBRICKS_PY_COMMON
77

8-
#include "py/obj.h"
9-
108
#include <pbio/button.h>
119

10+
#include "py/obj.h"
11+
1212
#include <pybricks/common.h>
1313
#include <pybricks/parameters.h>
14+
1415
#include <pybricks/util_pb/pb_error.h>
1516

1617
// TODO: buttons are currently a module due to the legacy C API, but should be

pybricks/common/pb_type_lightarray.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55

66
#if PYBRICKS_PY_COMMON
77

8-
#include <pybricks/common.h>
9-
108
#include "py/obj.h"
119

10+
#include <pybricks/common.h>
11+
1212
#include <pybricks/util_pb/pb_error.h>
1313
#include <pybricks/util_mp/pb_obj_helper.h>
1414
#include <pybricks/util_mp/pb_kwarg_helper.h>

pybricks/common/pb_type_logger.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55

66
#if PYBRICKS_PY_COMMON_MOTORS
77

8+
#include <inttypes.h>
89
#include <stdbool.h>
910
#include <string.h>
10-
#include <inttypes.h>
1111

1212
#include <pbio/config.h>
1313
#include <pbio/logger.h>

pybricks/common/pb_type_motor.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@
55

66
#if PYBRICKS_PY_COMMON_MOTORS
77

8-
#include <inttypes.h>
9-
10-
#include <pbio/servo.h>
118
#include <pbio/motorpoll.h>
9+
#include <pbio/servo.h>
1210

1311
#include "py/mphal.h"
1412
#include "py/obj.h"

pybricks/ev3devices.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
#define PYBRICKS_INCLUDED_PYBRICKS_EV3DEVICES_H
66

77
#include "py/mpconfig.h"
8-
#include "py/obj.h"
98

109
#if PYBRICKS_PY_EV3DEVICES
1110

11+
#include "py/obj.h"
12+
1213
const mp_obj_module_t pb_module_ev3devices;
1314

1415
const mp_obj_type_t pb_type_ev3devices_ColorSensor;

0 commit comments

Comments
 (0)