PX4 Firmware
PX4 Autopilot Software http://px4.io
mkblctrl.cpp File Reference

Driver/configurator for the Mikrokopter BL-Ctrl. More...

#include <px4_platform_common/px4_config.h>
#include <px4_platform_common/tasks.h>
#include <drivers/device/i2c.h>
#include <parameters/param.h>
#include <sys/types.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdlib.h>
#include <semaphore.h>
#include <string.h>
#include <fcntl.h>
#include <poll.h>
#include <errno.h>
#include <stdio.h>
#include <math.h>
#include <unistd.h>
#include <nuttx/arch.h>
#include <nuttx/i2c/i2c_master.h>
#include <board_config.h>
#include <drivers/device/device.h>
#include <drivers/drv_pwm_output.h>
#include <drivers/drv_hrt.h>
#include <drivers/drv_rc_input.h>
#include <drivers/drv_mixer.h>
#include <drivers/drv_tone_alarm.h>
#include <systemlib/err.h>
#include <lib/mixer/MixerGroup.hpp>
#include <uORB/topics/actuator_controls.h>
#include <uORB/topics/actuator_outputs.h>
#include <uORB/topics/actuator_armed.h>
#include <uORB/topics/esc_status.h>
#include <uORB/topics/tune_control.h>
Include dependency graph for mkblctrl.cpp:

Go to the source code of this file.

Classes

struct  MotorData_t
 
class  MK
 

Macros

#define I2C_BUS_SPEED   100000
 
#define UPDATE_RATE   200
 
#define MAX_MOTORS   8
 
#define BLCTRL_BASE_ADDR   0x29
 
#define BLCTRL_OLD   0
 
#define BLCTRL_NEW   1
 
#define BLCTRL_MIN_VALUE   -0.920F
 
#define MOTOR_STATE_PRESENT_MASK   0x80
 
#define MOTOR_STATE_ERROR_MASK   0x7F
 
#define MOTOR_SPINUP_COUNTER   30
 
#define MOTOR_LOCATE_DELAY   10000000
 
#define ESC_UORB_PUBLISH_DELAY   500000
 
#define CONTROL_INPUT_DROP_LIMIT_MS   20
 
#define RC_MIN_VALUE   1010
 
#define RC_MAX_VALUE   2100
 

Enumerations

enum  MappingMode
 
enum  FrameType
 

Functions

__EXPORT int mkblctrl_main (int argc, char *argv[])
 

Variables

const int blctrlAddr_quad_plus [] = { 2, 2, -2, -2, 0, 0, 0, 0 }
 
const int blctrlAddr_hexa_plus [] = { 0, 2, 2, -2, 1, -3, 0, 0 }
 
const int blctrlAddr_octo_plus [] = { 0, 3, -1, 0, 3, 0, 0, -5 }
 
const int blctrlAddr_quad_x [] = { 2, 2, -2, -2, 0, 0, 0, 0 }
 
const int blctrlAddr_hexa_x [] = { 2, 4, -2, 0, -3, -1, 0, 0 }
 
const int blctrlAddr_octo_x [] = { 1, 4, 0, 1, -4, 1, 1, -4 }
 
const int blctrlAddr_px4 [] = { 0, 0, 0, 0, 0, 0, 0, 0}
 
int addrTranslator [] = {0, 0, 0, 0, 0, 0, 0, 0}
 

Detailed Description

Driver/configurator for the Mikrokopter BL-Ctrl.

Author
Marco Bauer marco.nosp@m.@wtn.nosp@m.s.de

Definition in file mkblctrl.cpp.

Macro Definition Documentation

◆ BLCTRL_BASE_ADDR

#define BLCTRL_BASE_ADDR   0x29

◆ BLCTRL_MIN_VALUE

#define BLCTRL_MIN_VALUE   -0.920F

Definition at line 91 of file mkblctrl.cpp.

Referenced by MK::mk_servo_test(), and MK::task_main().

◆ BLCTRL_NEW

#define BLCTRL_NEW   1

Definition at line 90 of file mkblctrl.cpp.

Referenced by MK::mk_check_for_blctrl().

◆ BLCTRL_OLD

#define BLCTRL_OLD   0

Definition at line 89 of file mkblctrl.cpp.

Referenced by MK::mk_check_for_blctrl(), MK::mk_servo_set(), and MK::mk_servo_test().

◆ CONTROL_INPUT_DROP_LIMIT_MS

#define CONTROL_INPUT_DROP_LIMIT_MS   20

Definition at line 98 of file mkblctrl.cpp.

Referenced by MK::task_main().

◆ ESC_UORB_PUBLISH_DELAY

#define ESC_UORB_PUBLISH_DELAY   500000

Definition at line 96 of file mkblctrl.cpp.

Referenced by MK::task_main().

◆ I2C_BUS_SPEED

#define I2C_BUS_SPEED   100000

Definition at line 85 of file mkblctrl.cpp.

◆ MAX_MOTORS

#define MAX_MOTORS   8

Definition at line 87 of file mkblctrl.cpp.

Referenced by MK::mk_check_for_blctrl().

◆ MOTOR_LOCATE_DELAY

#define MOTOR_LOCATE_DELAY   10000000

Definition at line 95 of file mkblctrl.cpp.

Referenced by MK::mk_servo_locate().

◆ MOTOR_SPINUP_COUNTER

#define MOTOR_SPINUP_COUNTER   30

Definition at line 94 of file mkblctrl.cpp.

Referenced by MK::mk_servo_test().

◆ MOTOR_STATE_ERROR_MASK

#define MOTOR_STATE_ERROR_MASK   0x7F

Definition at line 93 of file mkblctrl.cpp.

Referenced by MK::mk_servo_set().

◆ MOTOR_STATE_PRESENT_MASK

#define MOTOR_STATE_PRESENT_MASK   0x80

Definition at line 92 of file mkblctrl.cpp.

Referenced by MK::mk_check_for_blctrl(), and MK::mk_servo_set().

◆ RC_MAX_VALUE

#define RC_MAX_VALUE   2100

Definition at line 100 of file mkblctrl.cpp.

Referenced by mkblctrl_main().

◆ RC_MIN_VALUE

#define RC_MIN_VALUE   1010

Definition at line 99 of file mkblctrl.cpp.

Referenced by mkblctrl_main().

◆ UPDATE_RATE

#define UPDATE_RATE   200

Definition at line 86 of file mkblctrl.cpp.

Enumeration Type Documentation

◆ FrameType

enum FrameType

Definition at line 1150 of file mkblctrl.cpp.

◆ MappingMode

Definition at line 1145 of file mkblctrl.cpp.

Function Documentation

◆ mkblctrl_main()

int mkblctrl_main ( int  argc,
char *  argv[] 
)

Variable Documentation

◆ addrTranslator

int addrTranslator[] = {0, 0, 0, 0, 0, 0, 0, 0}

◆ blctrlAddr_hexa_plus

const int blctrlAddr_hexa_plus[] = { 0, 2, 2, -2, 1, -3, 0, 0 }

Definition at line 202 of file mkblctrl.cpp.

Referenced by MK::set_motor_count().

◆ blctrlAddr_hexa_x

const int blctrlAddr_hexa_x[] = { 2, 4, -2, 0, -3, -1, 0, 0 }

Definition at line 206 of file mkblctrl.cpp.

Referenced by MK::set_motor_count().

◆ blctrlAddr_octo_plus

const int blctrlAddr_octo_plus[] = { 0, 3, -1, 0, 3, 0, 0, -5 }

Definition at line 203 of file mkblctrl.cpp.

Referenced by MK::set_motor_count().

◆ blctrlAddr_octo_x

const int blctrlAddr_octo_x[] = { 1, 4, 0, 1, -4, 1, 1, -4 }

Definition at line 207 of file mkblctrl.cpp.

Referenced by MK::set_motor_count().

◆ blctrlAddr_px4

const int blctrlAddr_px4[] = { 0, 0, 0, 0, 0, 0, 0, 0}

Definition at line 209 of file mkblctrl.cpp.

Referenced by MK::set_motor_count().

◆ blctrlAddr_quad_plus

const int blctrlAddr_quad_plus[] = { 2, 2, -2, -2, 0, 0, 0, 0 }

Definition at line 201 of file mkblctrl.cpp.

Referenced by MK::set_motor_count().

◆ blctrlAddr_quad_x

const int blctrlAddr_quad_x[] = { 2, 2, -2, -2, 0, 0, 0, 0 }

Definition at line 205 of file mkblctrl.cpp.

Referenced by MK::set_motor_count().