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 11#include " Battery.h"
22#include " Events.h"
33#include " Wire.h"
4+ #include " config.h"
45
6+ #ifdef NANO_MOTOR_CARRIER
7+ #define SCALE_FACTOR (236 )
8+ #else
59#define SCALE_FACTOR (77 )
10+ #endif
611
712void Battery::readBattery () {
813 index++;
Original file line number Diff line number Diff line change @@ -41,12 +41,28 @@ enum IRQCause {
4141#define LED_BUILTIN 3
4242
4343#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
4457#define MOTOR_2_PIN_A 4
4558#define MOTOR_2_PIN_B 5
46-
47- #define MOTOR_1_COUNTER TC2
4859#define MOTOR_1_PIN_A 7
4960#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
5066
5167#define PWM_PIN_SERVO_COUNTER TCC0
5268
@@ -55,9 +71,4 @@ enum IRQCause {
5571#define PWM_PIN_SERVO_3 16
5672#define PWM_PIN_SERVO_4 22
5773
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-
6374void 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 {
5353#define I2C_ADDRESS 0x66
5454#define IRQ_PIN 6
5555
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
5662#define MOTOR_3_PIN_A 3
5763#define MOTOR_3_PIN_B 2
5864#define MOTOR_4_PIN_A 4
5965#define MOTOR_4_PIN_B 5
66+ #endif
6067
6168
6269#ifdef ARDUINO_SAMD_NANO_33_IOT
You can’t perform that action at this time.
0 commit comments