65 lines
1000 B
C
65 lines
1000 B
C
#include "device_task.h"
|
|
#include "drv_relay.h"
|
|
#include "drv_fan.h"
|
|
#include "drv_power.h"
|
|
#include "drv_at24cxx.h"
|
|
#include "drv_tick.h"
|
|
#include "drv_uart.h"
|
|
//SemaphoreHandle_t bat_single_Mutex; // 互斥锁句柄
|
|
|
|
double voltage_pwr;
|
|
double voltage_buck_in;
|
|
double voltage_buck_out;
|
|
double voltage_bat;
|
|
double voltage_current;
|
|
double voltage_temp;
|
|
|
|
uint16_t relay_state1 = 0;
|
|
uint16_t relay_state2 = 0;
|
|
|
|
//设备更新线程
|
|
void StartDeviceTask(void * argument)
|
|
{
|
|
relay_init();
|
|
fan_init();
|
|
adc_init();
|
|
power_init();
|
|
init_uart_fifos();
|
|
AT24C_Init(&hi2c4);
|
|
|
|
tick_init();
|
|
|
|
for(;;)
|
|
{
|
|
osDelay(100);
|
|
|
|
//执行传感器采集工作
|
|
|
|
voltage_pwr = get_voltage(&power_voltage);
|
|
voltage_buck_in = get_voltage(&buck_in_voltage);
|
|
voltage_buck_out = get_voltage(&buck_out_voltage);
|
|
voltage_bat = get_voltage(&bat_voltage);
|
|
voltage_current = get_voltage(&bat_current);
|
|
voltage_temp = get_voltage(&bat_temper);
|
|
|
|
|
|
relay_set(0,relay_state1);
|
|
relay_set(1,relay_state2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|