/*
 * NessLab.c
 *
 *  Created on: Aug 3, 2020
 *      Author: parkyj
 */


#include "main.h"
#include "NessLab.h"
#include "adc.h"
#include "crc.h"
//extern uint8_t NessLab_Checksum(uint8_t* data,uint8_t size);

Nesslab_Prot Currstatus;
uint8_t data_Tx[50] = {0,};

void NessLab_Operate(uint8_t* data){
	uint8_t datatype = data[NessLab_MsgID0];

	switch(datatype){
		case NessLab_STATUS_REQ:
			ADC_Check();
			break;


	}
    Uart1_Data_Send(&Currstatus, 30);


}
void NessLab_Frame_Set(){
    Currstatus.Header0 = 0x7E;
    Currstatus.Header1 = 0x7E;

    /* Exception Header Tail Checksum */
    Currstatus.Checksum = NessLab_Checksum(&Currstatus.MsgId, 17);
    
    Currstatus.Tail0 = 0x7E;
    Currstatus.Tail1 = 0x7E;

}


void NessLab_Status_Check(){
	//HAL_GPIO_ReadPin(, GPIO_Pin)
}
void NessLab_PAU_Enable(){
	HAL_GPIO_WritePin(AMP_EN_GPIO_Port,AMP_EN_Pin, HAL_GPIO_ReadPin(PAU_EN_GPIO_Port, PAU_EN_Pin));
	//HAL_GPIO_WritePin(AMP_EN_GPIO_Port,AMP_EN_Pin, HAL_GPIO_ReadPin(PAU_RESET_GPIO_Port, PAU_RESET_Pin));
}
void NessLab_GPIO_Operate(){
	NessLab_PAU_Enable();
}

