|
|
|
@ -40,20 +40,40 @@
|
|
|
|
|
#define CMD_SET_SPI_MODE 123
|
|
|
|
|
#define CMD_SET_SPI_BITS_PER_WORD 124
|
|
|
|
|
#define CMD_SET_SPI_MAXSPEEDHZ 125
|
|
|
|
|
#define CMD_SET_PWM_BEE_STATE 126
|
|
|
|
|
#define CMD_SET_ALM_MODE 128
|
|
|
|
|
#define CMD_SET_PWM_BEE_STATE 126 // Removed
|
|
|
|
|
#define CMD_SET_ALM_MODE 128 // Removed
|
|
|
|
|
#define CMD_SET_SYSTEM_RESET 202
|
|
|
|
|
#define CMD_SET_485_EN_STATE 131
|
|
|
|
|
#define CMD_SET_12V_EN_STATE 133
|
|
|
|
|
#if 1
|
|
|
|
|
#define CMD_SET_SPI_POWER 129
|
|
|
|
|
#define CMD_SET_CAM_3V3_EN_STATE 132
|
|
|
|
|
#define CMD_SET_3V3_PWR_EN 132
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#else // defined(USING_PLZ)
|
|
|
|
|
|
|
|
|
|
#define CMD_SET_OTG_STATE 107
|
|
|
|
|
#define CMD_GET_OTG_STATE 108
|
|
|
|
|
#define CMD_SET_SPI_POWER 129
|
|
|
|
|
|
|
|
|
|
#define CMD_SET_12V_EN_STATE 0 // TO BE ADDED
|
|
|
|
|
#define CMD_SET_SYSTEM_RESET 0 // TO BE ADDED
|
|
|
|
|
#define CMD_GET_CHARGING_VOL_STATE 0 // TO BE ADDED
|
|
|
|
|
#define CMD_GET_CHARGING_SHUNT_VOLTAGE_STATE 0 // TO BE ADDED
|
|
|
|
|
#define CMD_GET_CHARGING_BUS_VOLTAGE_STATE 0 // TO BE ADDED
|
|
|
|
|
#define CMD_GET_CHARGING_POWER_STATE 0 // TO BE ADDED
|
|
|
|
|
#define CMD_GET_CHARGING_CURRENT_STATE 0 // TO BE ADDED
|
|
|
|
|
#define CMD_GET_BAT_VOL_STATE 0 // TO BE ADDED
|
|
|
|
|
#define CMD_GET_BAT_SHUNT_VOLTAGE_STATE 0 // TO BE ADDED
|
|
|
|
|
#define CMD_GET_BAT_BUS_VOLTAGE_STATE 0 // TO BE ADDED
|
|
|
|
|
#define CMD_GET_BAT_POWER_STATE 0 // TO BE ADDED
|
|
|
|
|
#define CMD_GET_BAT_CURRENT_STATE 0 // TO BE ADDED
|
|
|
|
|
#define CMD_SET_SPI_MODE 0 // TO BE ADDED
|
|
|
|
|
#define CMD_SET_SPI_BITS_PER_WORD 0 // TO BE ADDED
|
|
|
|
|
#define CMD_SET_SPI_MAXSPEEDHZ 0 // TO BE ADDED
|
|
|
|
|
|
|
|
|
|
#define CMD_SET_485_ENABLE 512
|
|
|
|
|
#define CMD_SET_3V3_PWR_ENABLE 516
|
|
|
|
|
#define CMD_SET_3V3_PWR_EN 516
|
|
|
|
|
#define CMD_SET_5V_PWR_ENABLE 517
|
|
|
|
|
#define CMD_SET_SENSOR_ENABLE 504
|
|
|
|
|
#define CMD_SET_SENSOR_PWR_ENABLE 505
|
|
|
|
@ -87,7 +107,7 @@
|
|
|
|
|
|
|
|
|
|
#define CMD_SET_SYSTEM_RESET 202
|
|
|
|
|
#define CMD_SET_485_EN1 302
|
|
|
|
|
#define CMD_SET_CAM_3V3_EN_STATE 360
|
|
|
|
|
#define CMD_SET_3V3_PWR_EN 360
|
|
|
|
|
#define CMD_SET_UART0_EN 361
|
|
|
|
|
#define CMD_SET_485_EN0 301
|
|
|
|
|
#define CMD_SET_NETWORK_POWER_EN 362
|
|
|
|
@ -187,25 +207,36 @@ public:
|
|
|
|
|
|
|
|
|
|
static void setCam3V3Enable(bool enabled, uint32_t delayedCloseTime)
|
|
|
|
|
{
|
|
|
|
|
enabled ? TurnOn(CMD_SET_CAM_3V3_EN_STATE) : TurnOff(CMD_SET_CAM_3V3_EN_STATE, delayedCloseTime);
|
|
|
|
|
#ifdef USING_PLZ
|
|
|
|
|
enabled ? TurnOn(CMD_SET_3V3_PWR_EN) : TurnOff(CMD_SET_3V3_PWR_EN, delayedCloseTime);
|
|
|
|
|
#else
|
|
|
|
|
enabled ? TurnOn(CMD_SET_3V3_PWR_EN) : TurnOff(CMD_SET_3V3_PWR_EN, delayedCloseTime);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void setCam3V3Enable(bool enabled)
|
|
|
|
|
{
|
|
|
|
|
enabled ? TurnOn(CMD_SET_CAM_3V3_EN_STATE) : TurnOff(CMD_SET_CAM_3V3_EN_STATE);
|
|
|
|
|
#ifdef USING_PLZ
|
|
|
|
|
enabled ? TurnOn(CMD_SET_3V3_PWR_EN) : TurnOff(CMD_SET_3V3_PWR_EN);
|
|
|
|
|
#else
|
|
|
|
|
enabled ? TurnOn(CMD_SET_3V3_PWR_EN) : TurnOff(CMD_SET_3V3_PWR_EN);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void setBeeOn(bool z)
|
|
|
|
|
{
|
|
|
|
|
#ifndef USING_N938
|
|
|
|
|
#ifndef USING_PLZ
|
|
|
|
|
z ? TurnOn(CMD_SET_PWM_BEE_STATE) : TurnOff(CMD_SET_PWM_BEE_STATE);
|
|
|
|
|
#endif
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void setJidianqiState(bool z) {
|
|
|
|
|
#ifndef USING_N938
|
|
|
|
|
#ifndef USING_PLZ
|
|
|
|
|
z ? TurnOn(CMD_SET_ALM_MODE) : TurnOff(CMD_SET_ALM_MODE);
|
|
|
|
|
#endif
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -220,7 +251,11 @@ public:
|
|
|
|
|
static void setRS485Enable(bool z, uint32_t delayedCloseTime)
|
|
|
|
|
{
|
|
|
|
|
#ifndef USING_N938
|
|
|
|
|
#ifdef USING_PLZ
|
|
|
|
|
z ? TurnOn(CMD_SET_485_ENABLE) : TurnOff(CMD_SET_485_ENABLE, delayedCloseTime);
|
|
|
|
|
#else
|
|
|
|
|
z ? TurnOn(CMD_SET_485_EN_STATE) : TurnOff(CMD_SET_485_EN_STATE, delayedCloseTime);
|
|
|
|
|
#endif
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -234,7 +269,11 @@ public:
|
|
|
|
|
static void setRS485Enable(bool z)
|
|
|
|
|
{
|
|
|
|
|
#ifndef USING_N938
|
|
|
|
|
#ifdef USING_PLZ
|
|
|
|
|
z ? TurnOn(CMD_SET_485_ENABLE) : TurnOff(CMD_SET_485_ENABLE);
|
|
|
|
|
#else
|
|
|
|
|
z ? TurnOn(CMD_SET_485_EN_STATE) : TurnOff(CMD_SET_485_EN_STATE);
|
|
|
|
|
#endif
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -253,14 +292,22 @@ public:
|
|
|
|
|
static void setLightAdc(int i)
|
|
|
|
|
{
|
|
|
|
|
#ifndef USING_N938
|
|
|
|
|
#ifdef USING_PLZ
|
|
|
|
|
setInt(CMD_SET_LIGHT1_RESISTOR_ENABLE, i);
|
|
|
|
|
#else
|
|
|
|
|
setInt(CMD_SET_LIGHT_ADC, i);
|
|
|
|
|
#endif
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int getLightAdc()
|
|
|
|
|
{
|
|
|
|
|
#ifndef USING_N938
|
|
|
|
|
#ifdef USING_PLZ
|
|
|
|
|
return getInt(CMD_SET_LIGHT1_RESISTOR_ENABLE);
|
|
|
|
|
#else
|
|
|
|
|
return getInt(CMD_GET_LIGHT_ADC);
|
|
|
|
|
#endif
|
|
|
|
|
#else
|
|
|
|
|
return -1;
|
|
|
|
|
#endif
|
|
|
|
|