67 #define SH_CONTROL_SPEED 0x01 68 #define SH_CONTROL_RAMP 0x02 69 #define SH_CONTROL_RELATIVE 0x04 70 #define SH_CONTROL_TACHO 0x08 71 #define SH_CONTROL_BRK 0x10 72 #define SH_CONTROL_ON 0x20 73 #define SH_CONTROL_TIME 0x40 74 #define SH_CONTROL_GO 0x80 76 #define SH_STATUS_SPEED 0x01 77 #define SH_STATUS_RAMP 0x02 78 #define SH_STATUS_MOVING 0x04 79 #define SH_STATUS_TACHO 0x08 80 #define SH_STATUS_BREAK 0x10 81 #define SH_STATUS_OVERLOAD 0x20 82 #define SH_STATUS_TIME 0x40 83 #define SH_STATUS_STALL 0x80 85 #define SH_COMMAND 0x41 86 #define SH_VOLTAGE 0x6E 88 #define SH_SETPT_M1 0x42 89 #define SH_SPEED_M1 0x46 90 #define SH_TIME_M1 0x47 91 #define SH_CMD_B_M1 0x48 92 #define SH_CMD_A_M1 0x49 94 #define SH_SETPT_M2 0x4A 95 #define SH_SPEED_M2 0x4E 96 #define SH_TIME_M2 0x4F 97 #define SH_CMD_B_M2 0x50 98 #define SH_CMD_A_M2 0x51 103 #define SH_POSITION_M1 0x52 104 #define SH_POSITION_M2 0x56 105 #define SH_STATUS_M1 0x5A 106 #define SH_STATUS_M2 0x5B 107 #define SH_TASKS_M1 0x5C 108 #define SH_TASKS_M2 0x5D 110 #define SH_ENCODER_PID 0x5E 111 #define SH_SPEED_PID 0x64 112 #define SH_PASS_COUNT 0x6A 113 #define SH_TOLERANCE 0x6B 115 #define SH_S1_MODE 0x6F 116 #define SH_S1_EV3_MODE 0x6F 117 #define SH_S1_ANALOG 0x70 119 #define SH_S2_MODE 0xA3 120 #define SH_S2_EV3_MODE 0x6F 121 #define SH_S2_ANALOG 0xA4 123 #define SH_BTN_PRESS 0xDA 124 #define SH_RGB_LED 0xD7 125 #define SH_CENTER_RGB_LED 0xDE 127 #define SH_PS_TS_X 0xE3 128 #define SH_PS_TS_Y 0xE5 129 #define SH_PS_TS_RAWX 0xE7 130 #define SH_PS_TS_RAWY 0xE9 131 #define SH_PS_TS_CALIBRATION_DATA_READY 0x70 132 #define SH_PS_TS_CALIBRATION_DATA 0x71 133 #define SH_PS_TS_SAVE 0x77 134 #define SH_PS_TS_LOAD 0x6C 135 #define SH_PS_TS_UNLOCK 0x45 184 #define SH_Speed_Full 90 185 #define SH_Speed_Medium 60 186 #define SH_Speed_Slow 25 197 #define SH_Bank_A 0x34 202 #define SH_Bank_B 0x36 214 #define SH_Type_NONE 0x00 216 #define SH_Type_SWITCH 0x01 222 #define SH_Type_ANALOG 0x02 229 #define SH_Type_LIGHT_REFLECTED 0x03 234 #define SH_Type_LIGHT_AMBIENT 0x04 239 #define SH_Type_I2C 0x09 245 #define SH_Type_COLORFULL 13 250 #define SH_Type_COLORRED 14 255 #define SH_Type_COLORGREEN 15 260 #define SH_Type_COLORBLUE 16 265 #define SH_Type_COLORNONE 17 270 #define SH_Type_EV3_SWITCH 18 275 #define SH_Type_EV3 19 297 #include "EVShieldI2C.h" 300 #include <avr/interrupt.h> 457 bool centerLedSetRGB(uint8_t R, uint8_t G, uint8_t B);
461 bool ledSetRGB(uint8_t R, uint8_t G, uint8_t B);
509 uint8_t duration, uint8_t control);
524 long encoder,
int speed,
525 uint8_t duration, uint8_t control);
580 int speed, uint8_t duration,
597 int speed,
long tachometer,
614 int speed,
long degrees,
630 int speed,
long rotations,
652 bool sensorSetType(uint8_t which_sensor, uint8_t sensor_type);
687 bool sensorSetType(uint8_t which_sensor, uint8_t sensor_type);
722 void initLEDTimers();
745 bool getButtonState(uint8_t btn);
754 void waitForButtonPress(uint8_t btn, uint8_t led_pattern=1);
764 void ledSetRGB(uint8_t red = 0, uint8_t green = 0, uint8_t blue = 0);
770 void ledBreathingPattern();
776 void ledHeartBeatPattern();
784 void getTouchscreenValues(uint16_t *x, uint16_t *y);
808 bool checkButton(uint16_t x, uint16_t y, uint16_t width, uint16_t height);
814 uint8_t getFunctionButton();
818 uint16_t x1, y1, x2, y2, x3, y3, x4, y4;
826 bool useOldTouchscreen =
false;
832 void getReading(uint16_t *x, uint16_t *y);
Definition: EVShield.h:151
int8_t motorGetSpeed(SH_Motor which_motor)
Definition: EVShield.cpp:264
bool motorSetEncoderSpeedTimeAndControl(SH_Motor which_motors, long encoder, int speed, uint8_t duration, uint8_t control)
Definition: EVShield.cpp:468
bool motorSetTimeToRun(SH_Motor which_motor, int seconds)
Definition: EVShield.cpp:271
Definition: SHDefines.h:64
bool motorStop(SH_Motor which_motors, SH_Next_Action next_action)
Definition: EVShield.cpp:702
uint8_t motorGetCommandRegA(SH_Motor which_motor)
Definition: EVShield.cpp:301
SH_Direction
Definition: EVShield.h:159
uint8_t motorGetTimeToRun(SH_Motor which_motor)
Definition: EVShield.cpp:276
uint8_t motorGetCommandRegB(SH_Motor which_motor)
Definition: EVShield.cpp:289
bool motorSetSpeed(SH_Motor which_motor, int speed)
Definition: EVShield.cpp:259
EVShieldBank bank_a
Definition: EVShield.h:703
bool sensorSetType(uint8_t which_sensor, uint8_t sensor_type)
Definition: EVShield.cpp:716
int sensorReadRaw(uint8_t which_sensor)
Definition: EVShield.cpp:742
uint8_t motorGetTasksRunningByte(SH_Motor which_motor)
Definition: EVShield.cpp:322
uint8_t motorWaitUntilTimeDone(SH_Motor which_motors)
Definition: EVShield.cpp:526
bool motorSetSpeedPID(uint16_t Kp, uint16_t Ki, uint16_t Kd)
Definition: EVShield.cpp:339
uint8_t motorIsTimeDone(SH_Motor which_motors)
Definition: EVShield.cpp:493
int nxshieldGetBatteryVoltage()
Definition: EVShield.cpp:225
uint8_t EVShieldIssueCommand(char command)
Definition: EVShield.cpp:238
bool motorSetCommandRegB(SH_Motor which_motor, uint8_t value)
Definition: EVShield.cpp:284
#define SH_Bank_B
Definition: EVShield.h:202
EVShieldBankB bank_b
Definition: EVShield.h:706
Definition: EVShield.h:142
uint8_t motorRunTachometer(SH_Motor which_motors, SH_Direction direction, int speed, long tachometer, SH_Move relative, SH_Completion_Wait wait_for_completion, SH_Next_Action next_action)
Definition: EVShield.cpp:632
bool motorSetCommandRegA(SH_Motor which_motor, uint8_t value)
Definition: EVShield.cpp:296
uint8_t m_protocol
Definition: EVShield.h:700
bool format_bin(uint8_t i, char *s)
Definition: EVShield.cpp:56
bool motorReset()
Definition: EVShield.cpp:391
bool motorResetEncoder(SH_Motor which_motor)
Definition: EVShield.cpp:403
SH_Protocols
Protocols supported by EVShield.
Definition: SHDefines.h:63
This class defines methods for the EVShield Bank(s).
Definition: EVShield.h:306
uint8_t motorRunRotations(SH_Motor which_motors, SH_Direction direction, int speed, long rotations, SH_Completion_Wait wait_for_completion, SH_Next_Action next_action)
Definition: EVShield.cpp:687
Definition: EVShield.h:176
SH_Next_Action
Definition: EVShield.h:150
SH_Completion_Wait
Definition: EVShield.h:175
void motorRunUnlimited(SH_Motor which_motors, SH_Direction direction, int speed)
Definition: EVShield.cpp:601
uint8_t motorGetStatusByte(SH_Motor which_motor)
Definition: EVShield.cpp:315
Definition: EVShield.h:143
int evshieldGetBatteryVoltage()
Definition: EVShield.cpp:230
Definition: EVShield.h:153
void init(void *shield, SH_BankPort bp)
Definition: EVShieldI2C.cpp:142
This class implements I2C interfaces used by EVShield.
Definition: EVShieldI2C.h:32
uint8_t motorWaitUntilTachoDone(SH_Motor which_motors)
Definition: EVShield.cpp:570
bool motorSetEncoderPID(uint16_t Kp, uint16_t Ki, uint16_t Kd)
Definition: EVShield.cpp:330
Definition: EVShield.h:152
SH_Motor
Definition: EVShield.h:141
#define SH_Bank_A
Definition: EVShield.h:197
Definition: EVShield.h:169
bool motorSetPassCount(uint8_t pass_count)
Definition: EVShield.cpp:375
Definition: EVShield.h:168
Definition: EVShield.h:177
This class defines methods to access EVShield features.
Definition: EVShield.h:694
uint8_t motorRunSeconds(SH_Motor which_motors, SH_Direction direction, int speed, uint8_t duration, SH_Completion_Wait wait_for_completion, SH_Next_Action next_action)
Definition: EVShield.cpp:612
EVShieldBank(uint8_t i2c_address=SH_Bank_A)
Definition: EVShield.cpp:203
Definition: EVShield.h:160
bool motorSetTolerance(uint8_t tolerance)
Definition: EVShield.cpp:382
SH_Move
Definition: EVShield.h:167
EVShield has two banks. Bank B has few differences from Bank A. This class defines overriding methods...
Definition: EVShield.h:667
bool motorSetEncoderTarget(SH_Motor which_motor, long target)
Definition: EVShield.cpp:245
Definition: EVShield.h:161
bool motorStartBothInSync()
Definition: EVShield.cpp:397
uint8_t motorIsTachoDone(SH_Motor which_motors)
Definition: EVShield.cpp:538
long motorGetEncoderTarget(SH_Motor which_motor)
Definition: EVShield.cpp:251
int32_t motorGetEncoderPosition(SH_Motor which_motor)
Definition: EVShield.cpp:308
uint8_t motorRunDegrees(SH_Motor which_motors, SH_Direction direction, int speed, long degrees, SH_Completion_Wait wait_for_completion, SH_Next_Action next_action)
Definition: EVShield.cpp:674
bool motorSetSpeedTimeAndControl(SH_Motor which_motors, int speed, uint8_t duration, uint8_t control)
Definition: EVShield.cpp:427
Definition: EVShield.h:144