source: flair-src/trunk/lib/FlairSensorActuator/src/unexported/ParrotBldc_impl.h @ 5

Last change on this file since 5 was 5, checked in by Sanahuja Guillaume, 6 years ago

m

File size: 2.0 KB
Line 
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//see linux-ardrone2-2.6.32-9/drivers/parrot/char/gpio2_ioctl.h for ardrone2 specific gpios definitions
19
20#ifndef PARROTBLDC_IMPL_H
21#define PARROTBLDC_IMPL_H
22
23#include <IODevice.h>
24#include <stdint.h>
25
26namespace flair {
27    namespace core {
28        class SerialPort;
29    }
30    namespace actuator {
31        class ParrotBldc;
32    }
33}
34
35class ParrotBldc_impl {
36
37    public:
38        ParrotBldc_impl(flair::actuator::ParrotBldc* self,flair::core::SerialPort* serialport);
39        ~ParrotBldc_impl();
40        void UpdateFrom(flair::core::io_data *data);
41        void SetMotors(float* value);
42
43    private:
44        typedef struct GpioData_t {
45            int gpio;
46            int value;
47        } GpioData_t;
48
49        enum class GpioMode_t {
50            GpioInput = 0, // Pin configured for input
51            GpioOutputLow, // Pin configured for output with low level
52            GpioOutputHigh, // Pin configured for output with high level
53        };
54
55        typedef struct GpioDirection_t {
56            int gpio;
57            GpioMode_t mode;
58        } GpioDirection_t;
59
60        void StartTest(void);
61        void StopTest(void);
62        void ResetBldc(void);
63        void SetGPIODirection(int gpio,GpioMode_t mode);
64        void SetGPIOValue(int gpio,bool value);
65        int WriteCmd(uint8_t cmd, uint8_t *reply, int replylen);
66        void SetLeds(uint8_t led0, uint8_t led1, uint8_t led2, uint8_t led3);
67
68        flair::actuator::ParrotBldc* self;
69        flair::core::SerialPort* serialport;
70        bool is_reseted;
71        int fd;
72};
73
74#endif // PARROTBLDC_IMPL_H
Note: See TracBrowser for help on using the repository browser.