Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
actuators_asctec_v2.c
Go to the documentation of this file.
1/*
2 * Copyright (C) 2013 The Paparazzi Team
3 *
4 * This file is part of paparazzi.
5 *
6 * paparazzi is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * paparazzi is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with paparazzi; see the file COPYING. If not, write to
18 * the Free Software Foundation, 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
20 */
21
28
29#include "mcu_periph/i2c.h"
30#include "mcu_periph/sys_time.h"
31
32#define ACTUATORS_ASCTEC_V2_SLAVE_ADDR 0x02
33
35
37
49
50
52{
53#if defined ACTUATORS_START_DELAY && ! defined SITL
56#ifdef USE_I2C_ACTUATORS_REBOOT_HACK
57 //Lisa-L with Asctech v2 motors only start after reflashing when a bus error was sensed on stm32-i2c.
58 //multiple re-init solves the problem.
59 i2c1_init();
60#endif
61 return;
62 } else { actuators_delay_done = true; }
63 }
64#endif
65
67 case I2CTransFailed:
70 break;
71 case I2CTransSuccess:
72 case I2CTransDone:
74 break;
75 default:
77 return;
78 }
79
80#ifdef KILL_MOTORS
86#else
87 switch (actuators_asctec_v2.cmd) {
88 case TEST:
94 break;
95 case REVERSE:
101 break;
102 case SET_ADDR:
110 break;
111 case NONE:
121 break;
122 default:
123 break;
124 }
126#endif
127
128 actuators_asctec_v2.i2c_trans.type = I2CTransTx; // Can be reset I2C driver
130
131}
132
void actuators_asctec_v2_set(void)
void actuators_asctec_v2_init(void)
struct ActuatorsAsctecV2 actuators_asctec_v2
#define ACTUATORS_ASCTEC_V2_SLAVE_ADDR
Actuators driver for Asctec v2 motor controllers.
enum actuators_asctec_v2_addr cur_addr
enum actuators_asctec_v2_addr new_addr
enum actuators_asctec_v2_cmd cmd
struct i2c_transaction i2c_trans
volatile uint32_t nb_err
volatile uint8_t buf[I2C_BUF_LEN]
Transaction buffer With I2C_BUF_LEN number of bytes.
Definition i2c.h:122
enum I2CTransactionType type
Transaction type.
Definition i2c.h:98
enum I2CTransactionStatus status
Transaction status.
Definition i2c.h:126
uint8_t slave_addr
Slave address.
Definition i2c.h:104
uint8_t len_w
Number of bytes to write/transmit.
Definition i2c.h:116
static bool i2c_submit(struct i2c_periph *p, struct i2c_transaction *t)
Submit a I2C transaction.
Definition i2c.h:266
@ I2CTransSuccess
transaction successfully finished by I2C driver
Definition i2c.h:57
@ I2CTransFailed
transaction failed
Definition i2c.h:58
@ I2CTransDone
transaction set to done by user level
Definition i2c.h:59
@ I2CTransTx
transmit only transaction
Definition i2c.h:47
Architecture independent I2C (Inter-Integrated Circuit Bus) API.
uint16_t foo
Definition main_demo5.c:58
Hardware independent API for actuators (servos, motor controllers).
PRINT_CONFIG_VAR(ONELOOP_ANDI_FILT_CUTOFF)
Architecture independent timing functions.
#define USEC_OF_SEC(sec)
Definition sys_time.h:219
#define SysTimeTimer(_t)
Definition sys_time.h:228