EVShield  v1.3
EVShield Library Reference by mindsensors.com
EVs_PFMate.h
1 
2 // EVs_PFMate.h
3 //
4 // This is a class for controlling the PF Motor Controller, made by Mindsensors.
5 // See http://www.mindsensors.com/index.php?module=pagemaster&PAGE_user_op=view_page&PAGE_id=107 .
6 
7 // Initial version: 2010-06-17 by Andrew Sylvester
8 // Modified for EVShield: 2015-02-17 by Michael Giles
9 // Large parts of the code is ported from the NXC library for the device,
10 // written by Deepak Patil.
11 
12 /*
13  This library is free software; you can redistribute it and/or
14  modify it under the terms of the GNU Lesser General Public
15  License as published by the Free Software Foundation; either
16  version 2.1 of the License, or (at your option) any later version.
17 
18  This library is distributed in the hope that it will be useful,
19  but WITHOUT ANY WARRANTY; without even the implied warranty of
20  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21  Lesser General Public License for more details.
22 
23  You should have received a copy of the GNU Lesser General Public
24  License along with this library; if not, write to the Free Software
25  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 */
27 
28 
29 #ifndef EVs_PFMate_H
30 #define EVs_PFMate_H
31 
32 #define PF_Commmand 0x41
33 
34 #define PF_Channel 0x42
35 #define PF_Channel_1 1
36 #define PF_Channel_2 2
37 #define PF_Channel_3 3
38 #define PF_Channel_4 4
39 
40 #define PF_Control 0x43
41 #define PF_Control_Both 0
42 #define PF_Control_A 1
43 #define PF_Control_B 2
44 
45 #define PF_Speed_A 0x45
46 #define PF_Speed_B 0x47
47 #define PF_Speed_Slow 1
48 #define PF_Speed_Medium 4
49 #define PF_Speed_Full 7
50 
51 #define PF_Operation_A 0x44
52 #define PF_Operation_B 0x46
53 #define PF_Operation_Float 0
54 #define PF_Operation_Forward 1
55 #define PF_Operation_Reverse 2
56 #define PF_Operation_Brake 3
57 
58 #include "EVShieldI2C.h"
59 
63 class EVs_PFMate : public EVShieldI2C
64 {
65 public:
67  EVs_PFMate(uint8_t i2c_address = 0x48);
68 
70  uint8_t issueCommand(char command);
71 
73  bool sendSignal();
74 
76  void controlMotor(uint8_t channel, uint8_t contol, uint8_t operation, uint8_t speed);
77 
79  bool setChannel(uint8_t channel);
80 
82  bool setControl(uint8_t contol);
83 
85  bool setOperationA(uint8_t operation);
86 
88  bool setOperationB(uint8_t operation);
89 
91  bool setSpeedA(uint8_t speed);
92 
94  bool setSpeedB(uint8_t speed);
95 };
96 
97 #endif
bool setOperationB(uint8_t operation)
Definition: EVs_PFMate.cpp:62
void controlMotor(uint8_t channel, uint8_t contol, uint8_t operation, uint8_t speed)
Definition: EVs_PFMate.cpp:77
uint8_t issueCommand(char command)
Definition: EVs_PFMate.cpp:37
bool setSpeedB(uint8_t speed)
Definition: EVs_PFMate.cpp:72
bool setSpeedA(uint8_t speed)
Definition: EVs_PFMate.cpp:67
EVs_PFMate(uint8_t i2c_address=0x48)
Definition: EVs_PFMate.cpp:33
bool setChannel(uint8_t channel)
Definition: EVs_PFMate.cpp:47
This class implements I2C interfaces used by EVShield.
Definition: EVShieldI2C.h:32
bool sendSignal()
Definition: EVs_PFMate.cpp:42
bool setOperationA(uint8_t operation)
Definition: EVs_PFMate.cpp:57
This class interfaces with PFMate attached to EVShield.
Definition: EVs_PFMate.h:63
bool setControl(uint8_t contol)
Definition: EVs_PFMate.cpp:52