Skip to content

Commit bd05d1f

Browse files
committed
Finalized MotorGo variant files
1 parent 2c7e856 commit bd05d1f

File tree

2 files changed

+69
-12
lines changed

2 files changed

+69
-12
lines changed

variants/motorgo_plink/pins_arduino.h

+10-12
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,29 @@
66
#define USB_VID 0x303A
77
#define USB_PID 0x1001
88

9-
#define DRIVER_VOLTAGE_LIMIT 17.0f
10-
#define DRIVER_CURRENT_LIMIT 2.0f
9+
#define DRIVER_VOLTAGE_LIMIT 15.0f
10+
#define DRIVER_CURRENT_LIMIT 1.5f
1111

1212
// A flag to indicate a GPIO pin is not set
1313
#define MOTORGO_GPIO_NOT_SET 0xFF
1414

1515
// Built-in LED available to user
16-
static const uint8_t LED_BUILTIN = 44;
16+
static const uint8_t LED_BUILTIN = 42;
1717
// backward compatibility
1818
#define BUILTIN_LED LED_BUILTIN
1919
#define LED_BUILTIN LED_BUILTIN
2020

2121
// Status LED
22-
static const uint8_t LED_STATUS = 43;
22+
static const uint8_t LED_STATUS = 41;
23+
#define STATUS_LED LED_STATUS
2324

24-
// TODO: Confirm these are correct
25-
static const uint8_t TX = 4;
26-
static const uint8_t RX = 43;
25+
static const uint8_t TX = 43;
26+
static const uint8_t RX = 44;
2727

2828
// SPI
29-
static const uint8_t MOSI = 48;
30-
static const uint8_t MISO = 39;
31-
static const uint8_t SCK = 40;
29+
static const uint8_t MOSI = 35;
30+
static const uint8_t MISO = 48;
31+
static const uint8_t SCK = 47;
3232
static const uint8_t SS = 21;
3333

3434
// Qwiic
@@ -64,6 +64,4 @@ static const uint8_t CH4_ENC_CS = 9;
6464
static const uint8_t M4_PH = 12;
6565
static const uint8_t M4_EN = 11;
6666

67-
// Analog pins?
68-
6967
#endif /* Pins_Arduino_h */

variants/motorgo_plink/variant.cpp

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 2021 Ha Thach (tinyusb.org) for Adafruit Industries
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in
14+
* all copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
* THE SOFTWARE.
23+
*/
24+
25+
#include "esp32-hal-gpio.h"
26+
#include "pins_arduino.h"
27+
28+
extern "C"
29+
{
30+
// Initialize variant/board, called before setup()
31+
void initVariant(void)
32+
{
33+
pinMode(LED_BUILTIN, OUTPUT);
34+
pinMode(LED_STATUS, OUTPUT);
35+
36+
digitalWrite(LED_BUILTIN, HIGH);
37+
digitalWrite(LED_STATUS, LOW);
38+
39+
// Set motor pins
40+
pinMode(M1_PH, OUTPUT);
41+
pinMode(M1_EN, OUTPUT);
42+
pinMode(M2_PH, OUTPUT);
43+
pinMode(M2_EN, OUTPUT);
44+
pinMode(M3_PH, OUTPUT);
45+
pinMode(M3_EN, OUTPUT);
46+
pinMode(M4_PH, OUTPUT);
47+
pinMode(M4_EN, OUTPUT);
48+
49+
// Set all to LOW
50+
digitalWrite(M1_PH, LOW);
51+
digitalWrite(M1_EN, LOW);
52+
digitalWrite(M2_PH, LOW);
53+
digitalWrite(M2_EN, LOW);
54+
digitalWrite(M3_PH, LOW);
55+
digitalWrite(M3_EN, LOW);
56+
digitalWrite(M4_PH, LOW);
57+
digitalWrite(M4_EN, LOW);
58+
}
59+
}

0 commit comments

Comments
 (0)