You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.5 KiB
37 lines
1.5 KiB
#include "hardware.hpp"
|
|
|
|
#include "zsdk/zcanreceiver/zcanreceiver.hpp"
|
|
#define TAG "PROTO"
|
|
using namespace iflytop;
|
|
|
|
/***********************************************************************************************************************
|
|
* EXT *
|
|
***********************************************************************************************************************/
|
|
void Hardware::init() {
|
|
m_motor_spi.init(&MOTOR_SPI);
|
|
m_modbusBlockHost.initialize(&huart3);
|
|
|
|
m_sl_mini_ac_ctrl.initAsOutput(PD14, kxs_gpio_nopull, true, false); // m_sl_mini_ac_ctrl
|
|
m_atta_mini_air_compressor_ctrl.initAsOutput(PD15, kxs_gpio_nopull, true, false); // m_atta_mini_air_compressor_ctrl
|
|
|
|
m_motor[0].initialize(&m_motor_spi, MOTOR1_ENN, MOTOR1_CSN);
|
|
m_motor[0].setIHOLD_IRUN(1, 15, 0);
|
|
m_motor[0].setMotorShaft(true);
|
|
m_motor[0].setAcceleration(300000);
|
|
m_motor[0].setDeceleration(300000);
|
|
|
|
m_motor[1].initialize(&m_motor_spi, MOTOR2_ENN, MOTOR2_CSN);
|
|
m_motor[1].setIHOLD_IRUN(1, 15, 0);
|
|
m_motor[1].setMotorShaft(true);
|
|
m_motor[1].setAcceleration(300000);
|
|
m_motor[1].setDeceleration(300000);
|
|
|
|
int32_t chipv0 = m_motor[0].readChipVERSION(); // 5130:0x11
|
|
int32_t chipv1 = m_motor[1].readChipVERSION(); // 5130:0x11
|
|
|
|
// m_motor[0].rotate(500000);
|
|
// m_motor[1].rotate(500000);
|
|
ZLOGI(TAG, "chipv0: %x, chipv1: %x", chipv0, chipv1);
|
|
|
|
m_pressureSensorBus.init(&m_modbusBlockHost);
|
|
}
|