-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMeMegaPi.h
125 lines (119 loc) · 3.96 KB
/
MeMegaPi.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/**
* \par Copyright (C), 2012-2016, MakeBlock
* \brief Driver for MegaPi board.
* @file MeMegaPi.h
* @author MakeBlock
* @version V1.0.5
* @date 2016/09/23
* @brief Driver for MegaPi board.
*
* \par Copyright
* This software is Copyright (C), 2012-2016, MakeBlock. Use is subject to license \n
* conditions. The main licensing options available are GPL V2 or Commercial: \n
*
* \par Open Source Licensing GPL V2
* This is the appropriate option if you want to share the source code of your \n
* application with everyone you distribute it to, and you also want to give them \n
* the right to share who uses it. If you wish to use this software under Open \n
* Source Licensing, you must contribute all your source code to the open source \n
* community in accordance with the GPL Version 2 when your application is \n
* distributed. See http://www.gnu.org/copyleft/gpl.html
*
* \par Description
* This file is the driver for MegaPi board by MakeBlock.
*
* \par History:
* <pre>
* `<Author>` `<Time>` `<Version>` `<Descr>`
* Mark Yan 2016/02/20 1.0.0 Build the New.
* Mark Yan 2016/03/10 1.0.1 Port mapping changes.
* Scott wang 2016/09/18 1.0.2 Add the PORT[15].
* Scott 2016/09/20 1.0.3 Add the PORT[16].
* Scott 2016/09/23 1.0.4 Add the MePS2.h .
* Zzipeng 2017/02/20 1.0.5 put the array megaPi_slots[4] to MegaPi.h
* </pre>
*/
#ifndef MeMegaPi_H
#define MeMegaPi_H
#include <Arduino.h>
#include "MeConfig.h"
// Supported Modules drive needs to be added here
#include "Me7SegmentDisplay.h"
#include "MeUltrasonicSensor.h"
#include "MeDCMotor.h"
#include "MeRGBLed.h"
#include "Me4Button.h"
#include "MePotentiometer.h"
#include "MeJoystick.h"
#include "MePIRMotionSensor.h"
#include "MeShutter.h"
#include "MeLineFollower.h"
#include "MeSoundSensor.h"
#include "MeLimitSwitch.h"
#include "MeLightSensor.h"
#include "MeSerial.h"
#include "MeBluetooth.h"
#include "MeWifi.h"
#include "MeTemperature.h"
#include "MeGyro.h"
#include "MeInfraredReceiver.h"
#include "MeCompass.h"
#include "MeUSBHost.h"
#include "MeTouchSensor.h"
#include "MeStepper.h"
#include "MeStepperOnBoard.h"
#include "MeEncoderMotor.h"
#include "MeEncoderNew.h"
#include "MeBuzzer.h"
#include "MeLEDMatrix.h"
#include "MeHumitureSensor.h"
#include "MeFlameSensor.h"
#include "MeGasSensor.h"
#include "MeEncoderOnBoard.h"
#include "MeMegaPiDCMotor.h"
#include "MePressureSensor.h"
#include "MePS2.h"
#include "MeColorSensor.h"
/********************* MegaPi Board GPIO Map *********************************/
// struct defined in MeMegaPi.h
#define PORT1A PORT_1
#define PORT1B PORT_9
#define PORT2A PORT_2
#define PORT2B PORT_10
#define PORT3A PORT_3
#define PORT3B PORT_11
#define PORT4A PORT_4
#define PORT4B PORT_12
MePort_Sig mePort[17] =
{
{ NC, NC }, { NC, NC }, { NC, NC }, { NC, NC }, { NC, NC },
{ 16, 17 }, { A8, A9 }, { A10, A11 }, { A13, A12 }, { NC, NC },
{ NC, NC }, { NC, NC }, { NC, NC }, { NC, NC }, { NC, NC },
{ NC, NC },{ NC, NC },
};
Encoder_port_type encoder_Port[6] =
{
{ NC, NC, NC, NC, NC},
//NET2 NET1 PWM DIR1 DIR2
{ 18, 31, 12, 34, 35},
//ENB A ENB B PWMB DIR B1 DIR B2
{ 19, 38, 8, 37, 36},
{ 3, 49, 9, 43, 42},
{ 2, A1, 5, A4, A5},
{ NC, NC, NC, NC, NC},
};
megapi_dc_type megapi_dc_Port[14] =
{
{ NC, NC }, {33,32,11}, {40,41, 7}, {47,48, 6}, {A3,A2, 4},
{ NC, NC }, { NC, NC }, { NC, NC }, { NC, NC }, {35,34,12},
{36,37, 8}, {42,43, 9}, {A5,A4, 5},
};
megaPi_slot_type megaPi_slots[4] =
{
{35, 34, 33, 32, 31, 18, 12, 11},
{36, 37, 40, 41, 38, 19, 8, 7},
{42, 43, 47, 48, 49, 3, 9, 6},
{A5, A4, A3, A2, A1, 2, 5, 4}, // for megapi
};
//for step motor on board
#endif // MeMegaPi_H