Motion_EC_Stm32_archived/Core/Inc/navikit.h

112 lines
1.6 KiB
C

/*
* navikit.h
*
* Created on: Apr 17, 2020
* Author: oarap
*/
#ifndef INC_NAVIKIT_H_
#define INC_NAVIKIT_H_
#include "stdbool.h"
typedef enum
{
shutdown, //only mcu runing
runing, //all function runing
sleep //SOCs and FANs are stop
}sta_t;
typedef struct
{
struct{
sta_t last_sta; //last system state
sta_t sta; //current system state
bool power_btn; //开关是否被按下
bool custom_btn;
bool pwr_led;
bool run_led;
}sys;
struct{
bool fan_1;
bool fan_2;
bool fan_3;
}status;
struct{
bool mod_sleep;
bool power_en;
bool shutdown_req;
bool sys_reset;
bool force_recovery;
bool sleep_wake;
}som;//som power management
struct{
float out_24v_div16;
float out_5v_div8;
float out_12v_div8;
float bkp_bat_div8;
float main_pwr_div16;
bool pmb_temp_sen_en;
bool pmb_temp_sen_alt;
bool pmb_coulomb_alcc;
bool pmb_chrg_stat2;
bool pmg_chrg_stat1;
struct{
float voltage;
float current;
float cap;
float temp;
}coulomb;
}pmb;//power management board
struct{
bool u2_vbus_1;
bool u2_vbus_2;
bool u2_vbus_3;
bool u2_vbus_4;
bool u2_vbus_5;
bool u2_vbus_6;
bool u3_vbus_1;
bool u3_vbus_2;
bool u3_vbus_3;
bool u3_vbus_4;
bool u3_vbus_5;
bool u3_vbus_6;
}port;
struct{
bool u2_hub_pwr;
bool u3_hub_pwr;
bool u3_host_pwr;
bool u3_gec_pwr;
bool ge_sw_pwr;
}soc;
struct{
bool fan_valid_1;
bool fan_valid_2;
bool fan_valid_3;
}fan;
struct {
float sensor_1;
float sensor_2;
float sensor_3;
}temp;
}NaviKit_t;
extern NaviKit_t NaviKit;
void NaviKit_var_init();
#endif /* INC_NAVIKIT_H_ */