MakeBlock Drive Updated
Updated library for MakeBlock Ranger
Loading...
Searching...
No Matches
MePort.h
Go to the documentation of this file.
1
56#ifndef MEPORT_H_
57#define MEPORT_H_
58
59#include <Arduino.h>
60#include <avr/interrupt.h>
61#include <avr/io.h>
62#include <util/delay.h>
63#include <stdint.h>
64#include <stdlib.h>
65#include "MeConfig.h"
66
70typedef struct
71{
72 uint8_t s1;
73 uint8_t s2;
75
76extern MePort_Sig mePort[17]; // mePort[0] is nonsense
77
78#define NC (0) //use UART RX for NULL port
79
80#define PORT_1 (0x01)
81#define PORT_2 (0x02)
82#define PORT_3 (0x03)
83#define PORT_4 (0x04)
84#define PORT_5 (0x05)
85#define PORT_6 (0x06)
86#define PORT_7 (0x07)
87#define PORT_8 (0x08)
88#define PORT_9 (0x09)
89#define PORT_10 (0x0a)
90#define M1 (0x09)
91#define M2 (0x0a)
92#define PORT_11 (0x0b)
93#define PORT_12 (0x0c)
94#define PORT_13 (0x0d)
95#define PORT_14 (0x0e)
96#define PORT_15 (0x0f)
97#define PORT_16 (0x10)
98
99#ifdef MeMbot_H
100#define PORT_RGB (0x05)
101#define PORT_LightSensor (0x06)
102#endif
103
104#define SLOT1 (1)
105#define SLOT2 (2)
106#define SLOT3 (3)
107#define SLOT4 (4)
108#define SLOT_1 SLOT1
109#define SLOT_2 SLOT2
110#define SLOT_3 SLOT3
111#define SLOT_4 SLOT4
112
113#ifndef FALSE
114#define FALSE (0)
115#endif
116
117#ifndef TRUE
118#define TRUE (1)
119#endif
120
128{
129public:
130
135 MePort(void);
136
143 MePort(uint8_t port);
144
153 MePort(uint8_t port, uint8_t slot);
154
167 uint8_t getPort(void);
168
181 uint8_t getSlot(void);
182
197 bool dRead1(uint8_t mode = INPUT);
198
213 bool dRead2(uint8_t mode = INPUT);
214
228 bool dpRead1(void);
229
243 bool dpRead2(void);
244
259 void dWrite1(bool value);
260
275 void dWrite2(bool value);
276
289 int16_t aRead1(void);
290
303 int16_t aRead2(void);
304
319 void aWrite1(int16_t value);
320
335 void aWrite2(int16_t value);
336
351 void reset(uint8_t port);
352
369 void reset(uint8_t port, uint8_t slot);
370
383 uint8_t pin1(void);
384
397 uint8_t pin2(void);
398
412 uint8_t pin(void);
413
430 uint8_t pin(uint8_t port, uint8_t slot);
431
432protected:
433
438 uint8_t s1;
439
444 uint8_t s2;
445
451 uint8_t _port;
452
457 uint8_t _slot;
458};
459#endif // MEPORT_H_
Configuration file of library.
Port Mapping for RJ25.
Definition MePort.h:128
void dWrite2(bool value)
Definition MePort.cpp:251
uint8_t pin1(void)
Definition MePort.cpp:392
bool dpRead2(void)
Definition MePort.cpp:209
void aWrite2(int16_t value)
Definition MePort.cpp:330
uint8_t _slot
Definition MePort.h:457
uint8_t getSlot(void)
Definition MePort.cpp:126
int16_t aRead2(void)
Definition MePort.cpp:289
uint8_t s2
Definition MePort.h:444
void reset(uint8_t port)
Definition MePort.cpp:349
uint8_t pin2(void)
Definition MePort.cpp:409
bool dRead1(uint8_t mode=INPUT)
Definition MePort.cpp:145
uint8_t getPort(void)
Definition MePort.cpp:109
void dWrite1(bool value)
Definition MePort.cpp:231
bool dpRead1(void)
Definition MePort.cpp:188
bool dRead2(uint8_t mode=INPUT)
Definition MePort.cpp:167
uint8_t s1
Definition MePort.h:438
int16_t aRead1(void)
Definition MePort.cpp:269
void aWrite1(int16_t value)
Definition MePort.cpp:311
uint8_t _port
Definition MePort.h:451
MePort(void)
Definition MePort.cpp:61
uint8_t pin(void)
Definition MePort.cpp:427
Definition MePort.h:71