diff --git a/sw/airborne/boards/ardrone/actuators_ardrone2_raw.c b/sw/airborne/boards/ardrone/actuators_ardrone2_raw.c index d5fe722d09..0131db45ba 100644 --- a/sw/airborne/boards/ardrone/actuators_ardrone2_raw.c +++ b/sw/airborne/boards/ardrone/actuators_ardrone2_raw.c @@ -52,7 +52,7 @@ */ int mot_fd; /**< File descriptor for the port */ -#define ARDRONE_GPIO_PORT 0 // Dummy for paparazzi compatibility +#define ARDRONE_GPIO_PORT 0x32524 #define ARDRONE_GPIO_PIN_MOTOR1 171 #define ARDRONE_GPIO_PIN_MOTOR2 172 diff --git a/sw/airborne/boards/ardrone/gpio_ardrone.c b/sw/airborne/boards/ardrone/gpio_ardrone.c index 9222cd27ae..9e3786722b 100644 --- a/sw/airborne/boards/ardrone/gpio_ardrone.c +++ b/sw/airborne/boards/ardrone/gpio_ardrone.c @@ -53,6 +53,7 @@ struct gpio_direction { void gpio_set(uint32_t port, uint16_t pin) { + if (port != 0x32524) return; // protect ardrone board from unauthorized use struct gpio_data data; // Open the device if not open if (gpiofp == 0) @@ -67,6 +68,7 @@ void gpio_set(uint32_t port, uint16_t pin) void gpio_clear(uint32_t port, uint16_t pin) { + if (port != 0x32524) return; // protect ardrone board from unauthorized use struct gpio_data data; // Open the device if not open if (gpiofp == 0) @@ -81,6 +83,7 @@ void gpio_clear(uint32_t port, uint16_t pin) void gpio_setup_input(uint32_t port, uint16_t pin) { + if (port != 0x32524) return; // protect ardrone board from unauthorized use struct gpio_direction dir; // Open the device if not open if (gpiofp == 0) @@ -95,6 +98,7 @@ void gpio_setup_input(uint32_t port, uint16_t pin) void gpio_setup_output(uint32_t port, uint16_t pin) { + if (port != 0x32524) return; // protect ardrone board from unauthorized use struct gpio_direction dir; // Open the device if not open if (gpiofp == 0) @@ -108,8 +112,9 @@ void gpio_setup_output(uint32_t port, uint16_t pin) -uint16_t gpio_get(uint32_t gpioport, uint16_t pin) +uint16_t gpio_get(uint32_t port, uint16_t pin) { + if (port != 0x32524) return 0; // protect ardrone board from unauthorized use struct gpio_data data; // Open the device if not open if (gpiofp == 0)