File tree Expand file tree Collapse file tree 4 files changed +33
-7
lines changed Expand file tree Collapse file tree 4 files changed +33
-7
lines changed Original file line number Diff line number Diff line change 1
1
#include " Battery.h"
2
2
#include " Events.h"
3
3
#include " Wire.h"
4
+ #include " config.h"
4
5
6
+ #ifdef NANO_MOTOR_CARRIER
7
+ #define SCALE_FACTOR (236 )
8
+ #else
5
9
#define SCALE_FACTOR (77 )
10
+ #endif
6
11
7
12
void Battery::readBattery () {
8
13
index++;
Original file line number Diff line number Diff line change @@ -41,12 +41,28 @@ enum IRQCause {
41
41
#define LED_BUILTIN 3
42
42
43
43
#define MOTOR_2_COUNTER TC1
44
+ #define MOTOR_1_COUNTER TC2
45
+
46
+ #include "config.h"
47
+ #ifdef NANO_MOTOR_CARRIER
48
+ #define MOTOR_2_PIN_A 5
49
+ #define MOTOR_2_PIN_B 4
50
+ #define MOTOR_1_PIN_A 6
51
+ #define MOTOR_1_PIN_B 7
52
+ #define ENCODER_1_PIN_A 8
53
+ #define ENCODER_1_PIN_B 9
54
+ #define ENCODER_2_PIN_A 11
55
+ #define ENCODER_2_PIN_B 10
56
+ #else
44
57
#define MOTOR_2_PIN_A 4
45
58
#define MOTOR_2_PIN_B 5
46
-
47
- #define MOTOR_1_COUNTER TC2
48
59
#define MOTOR_1_PIN_A 7
49
60
#define MOTOR_1_PIN_B 6
61
+ #define ENCODER_1_PIN_A 9
62
+ #define ENCODER_1_PIN_B 8
63
+ #define ENCODER_2_PIN_A 10
64
+ #define ENCODER_2_PIN_B 11
65
+ #endif
50
66
51
67
#define PWM_PIN_SERVO_COUNTER TCC0
52
68
@@ -55,9 +71,4 @@ enum IRQCause {
55
71
#define PWM_PIN_SERVO_3 16
56
72
#define PWM_PIN_SERVO_4 22
57
73
58
- #define ENCODER_1_PIN_A 9
59
- #define ENCODER_1_PIN_B 8
60
- #define ENCODER_2_PIN_A 10
61
- #define ENCODER_2_PIN_B 11
62
-
63
74
void requestAttention (int cause );
Original file line number Diff line number Diff line change
1
+ // uncomment to compile for nano motor carrier
2
+
3
+ // #define NANO_MOTOR_CARRIER
Original file line number Diff line number Diff line change @@ -53,10 +53,17 @@ enum IRQCause {
53
53
#define I2C_ADDRESS 0x66
54
54
#define IRQ_PIN 6
55
55
56
+ #ifdef ARDUINO_SAMD_NANO_33_IOT
57
+ #define MOTOR_3_PIN_A 2
58
+ #define MOTOR_3_PIN_B 3
59
+ #define MOTOR_4_PIN_A 5
60
+ #define MOTOR_4_PIN_B 4
61
+ #else
56
62
#define MOTOR_3_PIN_A 3
57
63
#define MOTOR_3_PIN_B 2
58
64
#define MOTOR_4_PIN_A 4
59
65
#define MOTOR_4_PIN_B 5
66
+ #endif
60
67
61
68
62
69
#ifdef ARDUINO_SAMD_NANO_33_IOT
You can’t perform that action at this time.
0 commit comments