| 1 | // %flair:license{
|
---|
| 2 | // This file is part of the Flair framework distributed under the
|
---|
| 3 | // CECILL-C License, Version 1.0.
|
---|
| 4 | // %flair:license}
|
---|
| 5 | // created: 2013/12/19
|
---|
| 6 | // filename: ParrotBldc_impl.h
|
---|
| 7 | //
|
---|
| 8 | // author: Guillaume Sanahuja
|
---|
| 9 | // Copyright Heudiasyc UMR UTC/CNRS 7253
|
---|
| 10 | //
|
---|
| 11 | // version: $Id: $
|
---|
| 12 | //
|
---|
| 13 | // purpose: Classe integrant les moteurs ardrone
|
---|
| 14 | //
|
---|
| 15 | //
|
---|
| 16 | /*********************************************************************/
|
---|
| 17 |
|
---|
| 18 |
|
---|
| 19 | #ifndef PARROTBLDC_IMPL_H
|
---|
| 20 | #define PARROTBLDC_IMPL_H
|
---|
| 21 |
|
---|
| 22 | #include <IODevice.h>
|
---|
| 23 | #include <stdint.h>
|
---|
| 24 |
|
---|
| 25 | namespace flair {
|
---|
| 26 | namespace core {
|
---|
| 27 | class SerialPort;
|
---|
| 28 | }
|
---|
| 29 | namespace actuator {
|
---|
| 30 | class ParrotBldc;
|
---|
| 31 | }
|
---|
| 32 | }
|
---|
| 33 |
|
---|
| 34 | class ParrotBldc_impl {
|
---|
| 35 |
|
---|
| 36 | public:
|
---|
| 37 | ParrotBldc_impl(flair::actuator::ParrotBldc* self,flair::core::SerialPort* serialport);
|
---|
| 38 | ~ParrotBldc_impl();
|
---|
| 39 | void UpdateFrom(flair::core::io_data *data);
|
---|
| 40 | void SetMotors(float* value);
|
---|
| 41 |
|
---|
| 42 | private:
|
---|
| 43 | typedef struct GpioData_t {
|
---|
| 44 | int gpio;
|
---|
| 45 | int value;
|
---|
| 46 | } GpioData_t;
|
---|
| 47 |
|
---|
| 48 | enum class GpioMode_t {
|
---|
| 49 | GpioInput = 0, // Pin configured for input
|
---|
| 50 | GpioOutputLow, // Pin configured for output with low level
|
---|
| 51 | GpioOutputHigh, // Pin configured for output with high level
|
---|
| 52 | };
|
---|
| 53 |
|
---|
| 54 | typedef struct GpioDirection_t {
|
---|
| 55 | int gpio;
|
---|
| 56 | GpioMode_t mode;
|
---|
| 57 | } GpioDirection_t;
|
---|
| 58 |
|
---|
| 59 | void StartTest(void);
|
---|
| 60 | void StopTest(void);
|
---|
| 61 | void ResetBldc(void);
|
---|
| 62 | void SetGPIODirection(int gpio,GpioMode_t mode);
|
---|
| 63 | void SetGPIOValue(int gpio,bool value);
|
---|
| 64 | int WriteCmd(uint8_t cmd, uint8_t *reply, int replylen);
|
---|
| 65 | void SetLeds(uint8_t led0, uint8_t led1, uint8_t led2, uint8_t led3);
|
---|
| 66 |
|
---|
| 67 | flair::actuator::ParrotBldc* self;
|
---|
| 68 | flair::core::SerialPort* serialport;
|
---|
| 69 | bool is_reseted;
|
---|
| 70 | int fd;
|
---|
| 71 | };
|
---|
| 72 |
|
---|
| 73 | #endif // PARROTBLDC_IMPL_H
|
---|