[ArDrone] Add protection to lowlevel driver that can short-circuit the board.

This commit is contained in:
Christophe De Wagter
2013-08-31 23:19:39 +02:00
parent 1fac821b79
commit 0a8d097a99
2 changed files with 7 additions and 2 deletions
@@ -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
+6 -1
View File
@@ -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)