zhaohe 2 years ago
parent
commit
c754d77081
  1. 2
      components/hardware/uart/zuart_helper.cpp
  2. 5
      components/mini_servo_motor/feite_servo_motor.cpp
  3. 2
      components/mini_servo_motor/feite_servo_motor.hpp

2
components/hardware/uart/zuart_helper.cpp

@ -19,6 +19,8 @@ ZUARTHelper::ZUARTHelper(const char* tag, UART_HandleTypeDef* uart, DMA_HandleTy
m_hdma_tx = hdma_tx; m_hdma_tx = hdma_tx;
m_hdma_rx = hdma_rx; m_hdma_rx = hdma_rx;
m_tag = tag; m_tag = tag;
ZASSERT(hdma_rx->Init.Direction == DMA_PERIPH_TO_MEMORY);
ZASSERT(hdma_tx->Init.Direction == DMA_MEMORY_TO_PERIPH);
} }
void ZUARTHelper::cleanRxBuff() { void ZUARTHelper::cleanRxBuff() {

5
components/mini_servo_motor/feite_servo_motor.cpp

@ -22,10 +22,13 @@ static void dumphex(const char* tag, uint8_t* data, uint8_t len) {
printf("\n"); printf("\n");
#endif #endif
} }
void FeiTeServoMotor::initialize2(UART_HandleTypeDef* uart, DMA_HandleTypeDef* hdma_tx,DMA_HandleTypeDef* hdma_rx) {
void FeiTeServoMotor::initialize(UART_HandleTypeDef* uart, DMA_HandleTypeDef* hdma_rx, DMA_HandleTypeDef* hdma_tx) {
m_uart = uart; m_uart = uart;
m_hdma_rx = hdma_rx; m_hdma_rx = hdma_rx;
m_hdma_tx = hdma_tx; m_hdma_tx = hdma_tx;
ZASSERT(hdma_rx->Init.Direction == DMA_PERIPH_TO_MEMORY);
ZASSERT(hdma_tx->Init.Direction == DMA_MEMORY_TO_PERIPH);
m_mutex.init(); m_mutex.init();
} }
bool FeiTeServoMotor::ping(uint8_t id) { bool FeiTeServoMotor::ping(uint8_t id) {

2
components/mini_servo_motor/feite_servo_motor.hpp

@ -128,7 +128,7 @@ class FeiTeServoMotor {
zmutex m_mutex; zmutex m_mutex;
public: public:
void initialize2(UART_HandleTypeDef* uart, DMA_HandleTypeDef* hdma_tx,DMA_HandleTypeDef* hdma_rx);
void initialize(UART_HandleTypeDef* uart, DMA_HandleTypeDef* hdma_rx, DMA_HandleTypeDef* hdma_tx);
bool ping(uint8_t id); bool ping(uint8_t id);
bool readversion(uint8_t id, uint8_t& mainversion, uint8_t& subversion, uint8_t& miniserv_mainversion, uint8_t& miniserv_subversion); bool readversion(uint8_t id, uint8_t& mainversion, uint8_t& subversion, uint8_t& miniserv_mainversion, uint8_t& miniserv_subversion);

Loading…
Cancel
Save