#ifndef _BSP_SYS_H
#define _BSP_SYS_H


typedef struct {
//    u8  lpwr_warning_cnt;
//    u8  lpwr_warning_times;    //Announce the number of low power, 0xff means a live broadcast
    u8  vbat_nor_cnt;
    u8  lpwr_cnt;              //Low power count
    u8 discon_reason;
    //wav
    u8  vol;
    s8  anl_gain_offset;        //用于动态修改模拟音量表

    u16 kh_vol_msg;
    u16 vbat;
    u32 sleep_time;
    u32 pwroff_time;
    u32 sleep_delay;
    u32 pwroff_delay;
    u32 sleep_wakeup_time;
    u32 ms_ticks;               //ms
    u32 rand_seed;
    u8 wko_pin_en;
    u8 sw_rst_flag;

    u8 sleep_counter;       //sleepmode，Timed count
    u16 temp_tkcnt;
    u16 temp_tkcnt1;

volatile u8  cm_times;

volatile u8  charge_sta;        //0: charging off, 1: charging on, 2: full
volatile u8  charge_bled_flag;  //Charge full of blue light always on
volatile u8  ch_bled_cnt;       //Charge full blue light on time count

volatile u8  poweron_flag;      //Pwrkey power-on flag
volatile u8  pwrdwn_hw_flag;    //Analog hard switch, shutdown flag

volatile u8  dc_rst_flag;       //DC insertion soft reset
volatile u16 dc_rst_tout;       //DC insertion soft reset delay

    ///Bit variables should not be used for variables that need to be changed at an interrupt. Please use bit variables carefully and define as few as possible.
    u8  rtc_first_pwron  : 1,   //Whether the RTC is powered on for the first time
        cm_factory       : 1,   //Whether the first FLASH is powered on
        cm_vol_change    : 1,   //Whether the volume level needs to be updated to FLASH
        port2led_en      : 1;   //One IO push two lights

    u8  sleep_en         : 1,   //Used to control whether to enter the sleep
		lowbat_flag      : 1;
	//----------------LHL-----//
	u8	uart_bt_change_flag;
	u8	uart_bt_len;

} sys_cb_t;
extern sys_cb_t sys_cb;

extern volatile u32 ticks_50ms;

void wdt_key_init(void);
void wdt_test_init(void);
void bsp_sys_init(void);
void bsp_update_init(void);
void timer1_irq_init(void);
void uart0_mapping_sel(void);

#endif // _BSP_SYS_H

