From 38d9268bb5f97387a7a1941fb9af0edc67aa47aa Mon Sep 17 00:00:00 2001 From: Maxwell Pray Date: Sun, 28 Nov 2021 01:37:51 -0800 Subject: [PATCH 1/2] Use externs in common.h. --- ext/rpi_gpio/common.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/ext/rpi_gpio/common.h b/ext/rpi_gpio/common.h index 0680d7f..82fb7cf 100644 --- a/ext/rpi_gpio/common.h +++ b/ext/rpi_gpio/common.h @@ -34,14 +34,14 @@ SOFTWARE. #define I2C 42 #define PWM 43 -int gpio_mode; -const int pin_to_gpio_rev1[41]; -const int pin_to_gpio_rev2[41]; -const int pin_to_gpio_rev3[41]; -const int (*pin_to_gpio)[41]; -int gpio_direction[54]; -rpi_info rpiinfo; -int setup_error; -int module_setup; +extern int gpio_mode; +extern const int pin_to_gpio_rev1[41]; +extern const int pin_to_gpio_rev2[41]; +extern const int pin_to_gpio_rev3[41]; +extern const int (*pin_to_gpio)[41]; +extern int gpio_direction[54]; +extern rpi_info rpiinfo; +extern int setup_error; +extern int module_setup; int check_gpio_priv(void); int get_gpio_number(int channel, unsigned int *gpio); From 5be5c6d6314a83feefcd3d2e989d17dbc4291c00 Mon Sep 17 00:00:00 2001 From: Maxwell Pray Date: Sun, 28 Nov 2021 02:29:17 -0800 Subject: [PATCH 2/2] Add some declarations to match externs in common.c. --- ext/rpi_gpio/common.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ext/rpi_gpio/common.c b/ext/rpi_gpio/common.c index 1a6f60f..fc64620 100644 --- a/ext/rpi_gpio/common.c +++ b/ext/rpi_gpio/common.c @@ -34,6 +34,9 @@ const int pin_to_gpio_rev2[41] = {-1, -1, -1, 2, -1, 3, -1, 4, 14, -1, 15, 17, 1 const int pin_to_gpio_rev3[41] = {-1, -1, -1, 2, -1, 3, -1, 4, 14, -1, 15, 17, 18, 27, -1, 22, 23, -1, 24, 10, -1, 9, 25, 11, 8, -1, 7, -1, -1, 5, -1, 6, 12, 13, -1, 19, 16, 26, 20, -1, 21 }; int setup_error = 0; int module_setup = 0; +const int (*pin_to_gpio)[41]; +int gpio_direction[54]; +rpi_info rpiinfo; int check_gpio_priv(void) {