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.
135 lines
2.6 KiB
135 lines
2.6 KiB
#pragma once
|
|
|
|
#include "can_control/can_controller.h"
|
|
#include "LED/pump_controller.h"
|
|
#include "LED/air_valve.h"
|
|
#include "LED/three_way_valve.h"
|
|
#include "LED/high_voltage_pack.h"
|
|
#include "LED/laser_control.h"
|
|
|
|
#include "zgpio.hpp"
|
|
#include "appcfg.h"
|
|
#include "stm32components.hpp"
|
|
#include "LED/temp_control.h"
|
|
#include "uart_control/uart_control.h"
|
|
|
|
namespace iflytop {
|
|
|
|
class ID {
|
|
public:
|
|
ZGPIO ID0;
|
|
ZGPIO ID1;
|
|
ZGPIO ID2;
|
|
ZGPIO ID3;
|
|
ZGPIO ID4;
|
|
};
|
|
|
|
class AppHardware {
|
|
private:
|
|
/* data */
|
|
public:
|
|
ZGPIO MOTO_POWER_EN;
|
|
ZGPIO MOTO1_CSN;
|
|
ZGPIO MOTO2_CSN;
|
|
ZGPIO MOTO3_CSN;
|
|
ZGPIO MOTO4_CSN;
|
|
ZGPIO MOTO1_DRV_ENN;
|
|
ZGPIO MOTO2_DRV_ENN;
|
|
ZGPIO MOTO3_DRV_ENN;
|
|
ZGPIO MOTO4_DRV_ENN;
|
|
|
|
ZGPIO MOTOR1_REF_L;
|
|
ZGPIO MOTOR1_REF_R;
|
|
ZGPIO MOTOR2_REF_L;
|
|
ZGPIO MOTOR2_REF_R;
|
|
ZGPIO MOTOR3_REF_L;
|
|
ZGPIO MOTOR3_REF_R;
|
|
ZGPIO MOTOR4_REF_L;
|
|
ZGPIO MOTOR4_REF_R;
|
|
|
|
TMC51X0 MOTO1;
|
|
TMC51X0 MOTO2;
|
|
TMC51X0 MOTO3;
|
|
// TMC51X0 MOTO4;
|
|
|
|
ID id;
|
|
|
|
ZGPIO IO_OUT1;
|
|
ZGPIO IO_OUT2;
|
|
|
|
ZGPIO BLE_CONNECTED_STATE;
|
|
|
|
UART_HandleTypeDef* tjcUart;
|
|
ZGPIO TJC_UART_CH_SEL;
|
|
ZGPIO TJC_UART_CH_EN;
|
|
|
|
UART_HandleTypeDef* remoteContolerUart;
|
|
|
|
#if CAN_MODULE_ENABLE
|
|
CanController can0Controller; // CAN 收发控制
|
|
#endif
|
|
UartControl uart_control;
|
|
|
|
AirValve valve_controller; // 阀门控制
|
|
ThreeWayValve three_way_valve; // 三通阀控制
|
|
PumpController pump_controller; // 电机泵
|
|
HighVoltagePack high_voltage_pack; // 注射泵
|
|
LaserControl laser_control; // 激光
|
|
TempControl temp_control_nozzle; // 喷嘴温度控制
|
|
TempControl temp_control_slide; // 拨片温度控制
|
|
|
|
bool hardwareInitedOK = false;
|
|
|
|
static AppHardware* ins() {
|
|
static AppHardware instance;
|
|
return &instance;
|
|
}
|
|
|
|
AppHardware();
|
|
|
|
void initialize();
|
|
TMC51X0* getPump(int32_t index) {
|
|
if (index == 0) return &MOTO1;
|
|
if (index == 1) return &MOTO2;
|
|
if (index == 2) return &MOTO3;
|
|
ZASSERT(false);
|
|
return nullptr;
|
|
}
|
|
|
|
bool isHardInitOk();
|
|
|
|
void SystemPowerOn();
|
|
|
|
void SystemPowerOff(bool is_force = false);
|
|
|
|
void setTJCScreenInDownloadMode();
|
|
|
|
void setE_Stop(bool isE_Stop);
|
|
bool isE_Stop();
|
|
|
|
void toggleLaunched();
|
|
bool isLaunched();
|
|
|
|
bool isStarted();
|
|
|
|
void setFlowSpeed(uint16_t flowSpeed);
|
|
void setHumidity(int16_t humidity);
|
|
void setTemp(int16_t temp);
|
|
|
|
uint16_t getFlowSpeed();
|
|
int16_t getHumidity();
|
|
int16_t getTemp();
|
|
|
|
private:
|
|
bool isLaunched_ { false };
|
|
bool isE_Stop_ { false };
|
|
|
|
bool isStarted_;
|
|
|
|
osMutexId_t mutex_; // 锁
|
|
uint16_t flowSpeed_; // 流速
|
|
int16_t humidity_; // 湿度
|
|
int16_t temp_; // 温度
|
|
};
|
|
|
|
} // namespace iflytop
|