Skip to content

Commit 4d327e3

Browse files
committedMar 13, 2017
Added new command for pinMode to communication protocol
1 parent 5e171e2 commit 4d327e3

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed
 

‎avr/libraries/LottieLemon/src/LottieLemon.h

+4-3
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ namespace LottieLemon {
6666
COMMAND_READ_TRIM = 80,
6767
COMMAND_READ_TRIM_RE = 81,
6868
COMMAND_PAUSE_MODE = 90,
69-
COMMAND_LINE_FOLLOW_CONFIG = 100
69+
COMMAND_LINE_FOLLOW_CONFIG = 100,
70+
COMMAND_PIN_MODE = 110
7071
};
7172

7273
//motor board modes
@@ -77,8 +78,8 @@ namespace LottieLemon {
7778
MODE_IR_CONTROL = 3
7879
};
7980

80-
//bottom TKs, just for communication purpose, DR, DW, AR
81-
enum BottomMicrocontrollerPin { // keep and extend to silkscreen names
81+
//bottom TKs, just for communication purpose
82+
enum BottomMicrocontrollerPin {
8283
B_TK1 = 201,
8384
B_TK2 = 202,
8485
B_TK3 = 203,

‎avr/libraries/LottieLemon/src/utility/LottieLemonMotorBoard.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@ bool MotorBoard::handleMessage(uint8_t command, IntegerEasyTransfer & request) {
103103
case COMMAND_MOTORS_STOP:
104104
motorsStop();
105105
break;
106+
case COMMAND_PIN_MODE:
107+
codename = request.readByte();
108+
value = request.readInt();
109+
_pinMode(codename, value);
106110
case COMMAND_ANALOG_WRITE:
107111
codename = request.readByte();
108112
value = request.readInt();
@@ -243,6 +247,11 @@ void MotorBoard::motorsStop() {
243247
*
244248
*
245249
*/
250+
void MotorBoard::_pinMode(uint8_t codename, int value) {
251+
uint8_t pin = parseCodename(codename);
252+
if (pin == 0) { return; } // Not valid codename.
253+
pinMode(pin, value);
254+
}
246255
void MotorBoard::_digitalWrite(uint8_t codename, bool value) {
247256
uint8_t pin = parseCodename(codename);
248257
if (pin == 0) { return; } // Not valid codename.

‎avr/libraries/LottieLemon/src/utility/LottieLemonMotorBoard.h

+1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ namespace LottieLemon {
5959
void stopCurrentActions();
6060
//void sendCommand(byte command,byte codename,int value);
6161

62+
void _pinMode(uint8_t codename, int value);
6263
void _analogWrite(uint8_t codename, int value);
6364
void _digitalWrite(uint8_t codename, bool value);
6465
void _analogRead(uint8_t codename);

0 commit comments

Comments
 (0)