Paparazzi UAS  v5.14.0_stable-0-g3f680d1
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
actuators.c File Reference

Actuator driver for ardrone2 version. More...

#include "subsystems/actuators.h"
#include "actuators.h"
#include "mcu_periph/gpio.h"
#include "led_hw.h"
#include "mcu_periph/sys_time.h"
#include "navdata.h"
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <termios.h>
#include <stdint.h>
#include "autopilot.h"
+ Include dependency graph for actuators.c:

Go to the source code of this file.

Macros

#define ARDRONE_GPIO_PORT   0x32524
 
#define ARDRONE_GPIO_PIN_MOTOR1   171
 
#define ARDRONE_GPIO_PIN_MOTOR2   172
 
#define ARDRONE_GPIO_PIN_MOTOR3   173
 
#define ARDRONE_GPIO_PIN_MOTOR4   174
 
#define ARDRONE_GPIO_PIN_IRQ_FLIPFLOP   175
 
#define ARDRONE_GPIO_PIN_IRQ_INPUT   176
 
#define BIT_NUMBER(VAL, BIT)   (((VAL)>>BIT)&0x03)
 

Functions

static void actuators_ardrone_reset_flipflop (void)
 
void actuators_ardrone_init (void)
 
int actuators_ardrone_cmd (uint8_t cmd, uint8_t *reply, int replylen)
 
void actuators_ardrone_motor_status (void)
 
void actuators_ardrone_led_run (void)
 
void actuators_ardrone_commit (void)
 
void actuators_ardrone_set_pwm (uint16_t pwm0, uint16_t pwm1, uint16_t pwm2, uint16_t pwm3)
 Write motor speed command cmd = 001aaaaa aaaabbbb bbbbbccc ccccccdd ddddddd0. More...
 
void actuators_ardrone_set_leds (uint8_t led0, uint8_t led1, uint8_t led2, uint8_t led3)
 Write LED command cmd = 011rrrr0 000gggg0 (this is ardrone1 format, we need ardrone2 format) More...
 
void actuators_ardrone_close (void)
 

Variables

int actuator_ardrone2_fd
 Power consumption @ 11V all 4 motors running PWM A 0 0.2 80 1.3 100 1.5 150 2.0 190 2.5 130 3.0. More...
 
uint32_t led_hw_values
 

Detailed Description

Actuator driver for ardrone2 version.

Definition in file actuators.c.

Macro Definition Documentation

#define ARDRONE_GPIO_PIN_IRQ_FLIPFLOP   175
#define ARDRONE_GPIO_PIN_IRQ_INPUT   176

Definition at line 66 of file actuators.c.

Referenced by actuators_ardrone_init(), and actuators_ardrone_motor_status().

#define ARDRONE_GPIO_PIN_MOTOR1   171

Definition at line 60 of file actuators.c.

Referenced by actuators_ardrone_init().

#define ARDRONE_GPIO_PIN_MOTOR2   172

Definition at line 61 of file actuators.c.

Referenced by actuators_ardrone_init().

#define ARDRONE_GPIO_PIN_MOTOR3   173

Definition at line 62 of file actuators.c.

Referenced by actuators_ardrone_init().

#define ARDRONE_GPIO_PIN_MOTOR4   174

Definition at line 63 of file actuators.c.

Referenced by actuators_ardrone_init().

#define ARDRONE_GPIO_PORT   0x32524
#define BIT_NUMBER (   VAL,
  BIT 
)    (((VAL)>>BIT)&0x03)

Definition at line 207 of file actuators.c.

Referenced by actuators_ardrone_led_run().

Function Documentation

void actuators_ardrone_close ( void  )

Definition at line 271 of file actuators.c.

References actuator_ardrone2_fd.

int actuators_ardrone_cmd ( uint8_t  cmd,
uint8_t reply,
int  replylen 
)

Definition at line 158 of file actuators.c.

References actuator_ardrone2_fd, full_read(), and full_write().

Referenced by actuators_ardrone_init().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void actuators_ardrone_commit ( void  )

Definition at line 220 of file actuators.c.

References actuators_ardrone_motor_status(), actuators_ardrone_set_pwm(), and actuators_pwm_values.

+ Here is the call graph for this function:

void actuators_ardrone_led_run ( void  )

Definition at line 210 of file actuators.c.

References actuators_ardrone_set_leds(), BIT_NUMBER, and led_hw_values.

Referenced by actuators_ardrone_set_pwm().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void actuators_ardrone_motor_status ( void  )

Definition at line 170 of file actuators.c.

References ARDRONE_GPIO_PIN_IRQ_FLIPFLOP, ARDRONE_GPIO_PIN_IRQ_INPUT, ARDRONE_GPIO_PORT, autopilot_get_motors_on(), autopilot_set_motors_on(), FALSE, gpio_clear(), gpio_get(), gpio_set(), and gpio_setup_output().

Referenced by actuators_ardrone_commit().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void actuators_ardrone_reset_flipflop ( void  )
inlinestatic

Definition at line 70 of file actuators.c.

References ARDRONE_GPIO_PIN_IRQ_FLIPFLOP, ARDRONE_GPIO_PORT, gpio_clear(), gpio_set(), gpio_setup_output(), and sys_time::nb_sec.

Referenced by actuators_ardrone_init().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void actuators_ardrone_set_leds ( uint8_t  led0,
uint8_t  led1,
uint8_t  led2,
uint8_t  led3 
)

Write LED command cmd = 011rrrr0 000gggg0 (this is ardrone1 format, we need ardrone2 format)

led0 = RearLeft led1 = RearRight led2 = FrontRight led3 = FrontLeft

Definition at line 254 of file actuators.c.

References actuator_ardrone2_fd, and full_write().

Referenced by actuators_ardrone_init(), and actuators_ardrone_led_run().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void actuators_ardrone_set_pwm ( uint16_t  pwm0,
uint16_t  pwm1,
uint16_t  pwm2,
uint16_t  pwm3 
)

Write motor speed command cmd = 001aaaaa aaaabbbb bbbbbccc ccccccdd ddddddd0.

Definition at line 231 of file actuators.c.

References actuator_ardrone2_fd, actuators_ardrone_led_run(), and full_write().

Referenced by actuators_ardrone_commit().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

int actuator_ardrone2_fd

Power consumption @ 11V all 4 motors running PWM A 0 0.2 80 1.3 100 1.5 150 2.0 190 2.5 130 3.0.

File descriptor for the port

Definition at line 56 of file actuators.c.

Referenced by actuators_ardrone_close(), actuators_ardrone_cmd(), actuators_ardrone_init(), actuators_ardrone_set_leds(), and actuators_ardrone_set_pwm().

uint32_t led_hw_values