#include "TypeIO.h" TypeIO::TypeIO(PORTS s0, PORTS s1, PORTS s2, PORTS s3) : gpio_s0(s0), gpio_s1(s1), gpio_s2(s2), gpio_s3(s3) { } TypeIO::~TypeIO() { } CISVendor TypeIO::GetCisType() { auto s0 = gpio_s0.getValue(); auto s1 = gpio_s1.getValue(); auto s2 = gpio_s2.getValue(); auto s3 = gpio_s3.getValue(); std::string type; CISVendor vender; if (s0 == 0 && s1 == 0 && s2 == 0 && s3 == 1) { type = "DUNNAN_CIS_V0"; vender = CISVendor::DUNNAN_CIS_V0; } else if (s0 == 0 && s1 == 0 && s2 == 1 && s3 == 1) { type = "HUALIN_CIS_V0"; vender = CISVendor::HUALIN_CIS_V0; } else if (s0 == 0 && s1 == 0 && s2 == 0 && s3 == 0) { type = "DUNNAN_CIS_V0"; vender = CISVendor::DUNNAN_CIS_V0; } else if (s0 == 0 && s1 == 0 && s2 == 1 && s3 == 0) { type = "HUALIN_CIS_V0"; vender = CISVendor::HUALIN_CIS_V0; } else { type = "unknowun CIS TYPE"; vender = CISVendor::CIS_UNKNOWUN; } LOG("CIS Type :%s \n", type.c_str()); return vender; } SMBType TypeIO::GetMotorType() { SMBType type = SMBType::MB_DRV_8825; auto s0 = gpio_s0.getValue(); auto s1 = gpio_s1.getValue(); auto s2 = gpio_s2.getValue(); auto s3 = gpio_s3.getValue(); std::string typeinfo; if (s0 == 0 && s1 == 0 && s2 == 0 && s3 == 1) { typeinfo = "MB_DRV_8825"; LOG("SMBType = MB_DRV_8825\n"); type = SMBType::MB_DRV_8825; } else if (s0 == 0 && s1 == 0 && s2 == 1 && s3 == 1) { typeinfo = "MB_DRV_8825"; LOG("SMBType = MB_DRV_8825\n"); type = SMBType::MB_DRV_8825; } else if (s0 == 0 && s1 == 0 && s2 == 0 && s3 == 0) { typeinfo = "MB_DRV_TMC216"; LOG("SMBType = MB_DRV_TMC216\n"); type = SMBType::MB_DRV_TMC216; } else if (s0 == 0 && s1 == 0 && s2 == 1 && s3 == 0) { typeinfo = "MB_DRV_TMC216"; LOG("SMBType = MB_DRV_TMC216\n"); type = SMBType::MB_DRV_TMC216; type = SMBType::MB_DRV_TMC216; } else { typeinfo = "unknowun Motor TYPE"; LOG("SMBType =unknowun Motor TYPE\n"); type = SMBType::MB_DRV_UNKNOWUN; } return type; }