Skip to content

Commit 9a294a1

Browse files
committed
Provide more compile time configurables for the UART control port
* MOTEUS_UART_DEFAULT_COMMAND_BAUD_RATE - does the obvious * MOTEUS_R4_AUX2_RT - switches the two non-connectorized aux2 pins on moteus-r4 to be the R and T pads instead of the DBG1/2 pads
1 parent e0f8cda commit 9a294a1

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

fw/aux_common.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919

2020
#include "mjlib/base/visitor.h"
2121

22+
#ifndef MOTEUS_UART_DEFAULT_COMMAND_BAUD_RATE
23+
#define MOTEUS_UART_DEFAULT_COMMAND_BAUD_RATE 1000000
24+
#endif
25+
2226
namespace moteus {
2327
namespace aux {
2428

@@ -101,7 +105,7 @@ struct UartEncoder {
101105
};
102106
Mode mode = kBoardDefault;
103107

104-
int32_t baud_rate = 1000000;
108+
int32_t baud_rate = MOTEUS_UART_DEFAULT_COMMAND_BAUD_RATE;
105109
int32_t poll_rate_us = 100;
106110
uint8_t cui_amt21_address = 0x54;
107111

fw/moteus_controller.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,8 +426,17 @@ aux::AuxHardwareConfig GetAux2HardwareConfig() {
426426
// ADC# CHN I2C SPI USART TIMER
427427
{ 0, PB_8, -1, 0, I2C1, nullptr, USART3, nullptr },
428428
{ 1, PB_9, -1, 0, I2C1, nullptr, USART3, nullptr },
429+
// Select which two stm32 pins are used for the
430+
// non-connectorized aux2 pins for moteus-r4. By default,
431+
// the DBG1/DBG2, but if MOTEUS_R4_AUX2_RT is
432+
// defined, then they will be the R and T pads.
433+
#ifndef MOTEUS_R4_AUX2_RT
429434
{ 2, PC_14, -1, 0, nullptr, nullptr, nullptr, nullptr },
430435
{ 3, PC_15, -1, 0, nullptr, nullptr, nullptr, nullptr },
436+
#else
437+
{ 2, PC_10, -1, 0, nullptr, nullptr, USART3, nullptr },
438+
{ 3, PC_11, -1, 0, nullptr, nullptr, USART3, nullptr },
439+
#endif
431440
{ -1, NC, },
432441
}},
433442
aux_options,

0 commit comments

Comments
 (0)