#ifndef __SYS_DATA_H
#define __SYS_DATA_H

#include "usart.h"
#include "stm32f2xx.h"
#include "string.h"
#include "delay.h"

#define _USART3_RXSIZE           1040
#define ON 1
#define OFF 0

typedef struct
{
  uint32_t             	rxIndex;  
  uint8_t               rxBuf[_USART3_RXSIZE];
  uint8_t               txBusy;
	uint8_t								done; 
}USART_MSG_t;

extern USART_MSG_t usartMsg;
extern uint8_t result;
void call_back(void);

uint8_t channel_LED(uint8_t channel, int i);
uint8_t channel_12VBAT(uint8_t channel, int i);
uint8_t channel_5VBAT(uint8_t channel);
void broad_to_host(void);

//////////////////////// LED //////////////////////// 
// 全部channel下的平台
uint8_t channel_No0_LED(uint8_t platform, int i);// 全部channel
uint8_t channel_No0_platform_No0_LED(uint8_t cmd);// 全部平台
uint8_t channel_No0_platform_No1_LED(uint8_t cmd);
uint8_t channel_No0_platform_No2_LED(uint8_t cmd);
uint8_t channel_No0_platform_No3_LED(uint8_t cmd);
uint8_t channel_No0_platform_No4_LED(uint8_t cmd);
uint8_t channel_No0_platform_No5_LED(uint8_t cmd);
uint8_t channel_No0_platform_No6_LED(uint8_t cmd);

//  channel 1 下的平台
uint8_t channel_No1_LED(uint8_t platform, int i);
uint8_t channel_No1_platform_No0_LED(uint8_t cmd);// 全部平台
uint8_t channel_No1_platform_No1_LED(uint8_t cmd);
uint8_t channel_No1_platform_No2_LED(uint8_t cmd);
uint8_t channel_No1_platform_No3_LED(uint8_t cmd);
uint8_t channel_No1_platform_No4_LED(uint8_t cmd);
uint8_t channel_No1_platform_No5_LED(uint8_t cmd);
uint8_t channel_No1_platform_No6_LED(uint8_t cmd);

// channel 2 下的平台
uint8_t channel_No2_LED(uint8_t platform, int i);
uint8_t channel_No2_platform_No0_LED(uint8_t cmd);// 全部平台
uint8_t channel_No2_platform_No1_LED(uint8_t cmd);
uint8_t channel_No2_platform_No2_LED(uint8_t cmd);
uint8_t channel_No2_platform_No3_LED(uint8_t cmd);
uint8_t channel_No2_platform_No4_LED(uint8_t cmd);
uint8_t channel_No2_platform_No5_LED(uint8_t cmd);
uint8_t channel_No2_platform_No6_LED(uint8_t cmd);

// channel 3 下的平台
uint8_t channel_No3_LED(uint8_t platform, int i);
uint8_t channel_No3_platform_No0_LED(uint8_t cmd);// 全部平台
uint8_t channel_No3_platform_No1_LED(uint8_t cmd);
uint8_t channel_No3_platform_No2_LED(uint8_t cmd);
uint8_t channel_No3_platform_No3_LED(uint8_t cmd);
uint8_t channel_No3_platform_No4_LED(uint8_t cmd);
uint8_t channel_No3_platform_No5_LED(uint8_t cmd);
uint8_t channel_No3_platform_No6_LED(uint8_t cmd);

// channel 4 下的平台
uint8_t channel_No4_LED(uint8_t platform, int i);
uint8_t channel_No4_platform_No0_LED(uint8_t cmd);// 全部平台
uint8_t channel_No4_platform_No1_LED(uint8_t cmd);
uint8_t channel_No4_platform_No2_LED(uint8_t cmd);
uint8_t channel_No4_platform_No3_LED(uint8_t cmd);
uint8_t channel_No4_platform_No4_LED(uint8_t cmd);
uint8_t channel_No4_platform_No5_LED(uint8_t cmd);
uint8_t channel_No4_platform_No6_LED(uint8_t cmd);

//////////////////////// 12VBAT //////////////////////// 
// 全部channel下的平台
uint8_t channel_No0_12VBAT(uint8_t platform, int i); //全部channel
uint8_t channel_No0_platform_No0_12VBAT(uint8_t cmd);// 全部平台
uint8_t channel_No0_platform_No1_12VBAT(uint8_t cmd);
uint8_t channel_No0_platform_No2_12VBAT(uint8_t cmd);
uint8_t channel_No0_platform_No3_12VBAT(uint8_t cmd);
uint8_t channel_No0_platform_No4_12VBAT(uint8_t cmd);
uint8_t channel_No0_platform_No5_12VBAT(uint8_t cmd);
uint8_t channel_No0_platform_No6_12VBAT(uint8_t cmd);

// channel 1 下的平台
uint8_t channel_No1_12VBAT(uint8_t platform, int i); //全部channel
uint8_t channel_No1_platform_No0_12VBAT(uint8_t cmd);// 全部平台
uint8_t channel_No1_platform_No1_12VBAT(uint8_t cmd);
uint8_t channel_No1_platform_No2_12VBAT(uint8_t cmd);
uint8_t channel_No1_platform_No3_12VBAT(uint8_t cmd);
uint8_t channel_No1_platform_No4_12VBAT(uint8_t cmd);
uint8_t channel_No1_platform_No5_12VBAT(uint8_t cmd);
uint8_t channel_No1_platform_No6_12VBAT(uint8_t cmd);

// channel 2 下的平台
uint8_t channel_No2_12VBAT(uint8_t platform, int i); //全部channel
uint8_t channel_No2_platform_No0_12VBAT(uint8_t cmd);// 全部平台
uint8_t channel_No2_platform_No1_12VBAT(uint8_t cmd);
uint8_t channel_No2_platform_No2_12VBAT(uint8_t cmd);
uint8_t channel_No2_platform_No3_12VBAT(uint8_t cmd);
uint8_t channel_No2_platform_No4_12VBAT(uint8_t cmd);
uint8_t channel_No2_platform_No5_12VBAT(uint8_t cmd);
uint8_t channel_No2_platform_No6_12VBAT(uint8_t cmd);

// channel 3 下的平台
uint8_t channel_No3_12VBAT(uint8_t platform, int i); //全部channel
uint8_t channel_No3_platform_No0_12VBAT(uint8_t cmd);// 全部平台
uint8_t channel_No3_platform_No1_12VBAT(uint8_t cmd);
uint8_t channel_No3_platform_No2_12VBAT(uint8_t cmd);
uint8_t channel_No3_platform_No3_12VBAT(uint8_t cmd);
uint8_t channel_No3_platform_No4_12VBAT(uint8_t cmd);
uint8_t channel_No3_platform_No5_12VBAT(uint8_t cmd);
uint8_t channel_No3_platform_No6_12VBAT(uint8_t cmd);

// channel 4 下的平台
uint8_t channel_No4_12VBAT(uint8_t platform, int i); //全部channel
uint8_t channel_No4_platform_No0_12VBAT(uint8_t cmd);// 全部平台
uint8_t channel_No4_platform_No1_12VBAT(uint8_t cmd);
uint8_t channel_No4_platform_No2_12VBAT(uint8_t cmd);
uint8_t channel_No4_platform_No3_12VBAT(uint8_t cmd);
uint8_t channel_No4_platform_No4_12VBAT(uint8_t cmd);
uint8_t channel_No4_platform_No5_12VBAT(uint8_t cmd);
uint8_t channel_No4_platform_No6_12VBAT(uint8_t cmd);
#endif

