

#include "ahw_ioal_driver_test.h"
#include "exo_osal_thread.h"
#include "exo_ahw_al_common.h"
#include "exo_hal_common.h"
#include "exo_ahw_al_imu_common.h"
#include "exo_ahw_al_dt_common.h"
#include "exo_ahw_al_hsc_common.h"
#include "exo_ahw_al_psm_common.h"
#include "exo_ahw_al_gpio_exp_common.h"
#include "exo_ahw_al_temp_sensor_common.h"
#include "morpheus_multifeep_thruster.h"
#include "exo_ahw_al_thruster_common.h"
#include "exo_ahw_al_voltage_sequencer_common.h"
#include "exo_ahw_al_data_acq_dvc_common.h"

#include "stm32f7xx_hal_ext.h"

#include "exo_gpio.h"
//ahw_al_vsm_hdle al_vsm;
//vltg_seq_rail_cfg rail_info;
//vltg_seq_rail_cfg parent_rail_info;
extern ahw_al_thruster_hdle morpheus_thruster;
//extern ahw_al_imu_hdle himu;
//extern imu_int_type_cfg int_config;

extern ahw_al_gpio_exp_hdle hgpio_exp_obc_1;
extern ahw_al_gpio_exp_hdle hgpio_exp_obc_2;

void obc_temp_sensor_test()
{
	hal_ret_sts sts={0};
	sts=sts;
	ahw_al_temp_sensor_hdl tmp_hdl;
	float temp_param=0;
	tmp_hdl.high_temp_threshold=70;
	tmp_hdl.resolution=RES_0_25;
	tmp_hdl.low_temp_threshold=20;
	sts=ahw_al_temp_sensor_init(&tmp_hdl,TEMP_SENSOR_MCP9843_OBC);
	sts=ahw_al_temp_sensor_gettemperature(TEMP_SENSOR_MCP9843_OBC,&temp_param);
}

void obc_power_sensor_test()
{
	hal_ret_sts sts={0};
	sts=sts;
	float vbus_voltage=0;
	float vshunt_voltage=0;
	vbus_voltage=vbus_voltage;
	vshunt_voltage=vshunt_voltage;
	uint32_t power=0;
	power=power;
	float current=0;
	current=current;
	ahw_al_psm_hdle psm_hdl;
    sts=ahw_al_psm_init(&psm_hdl,PSM_INA230_OBC);
	vbus_voltage = ahw_al_psm_get_vbus(PSM_INA230_OBC);
	vshunt_voltage = ahw_al_psm_get_vshunt(PSM_INA230_OBC);
	power  = ahw_al_psm_get_power(PSM_INA230_OBC);
	current  = ahw_al_psm_get_current(PSM_INA230_OBC);
}

uint8_t obc_gpio_exp_sequence()
{
	hal_ret_sts sts=1;
//	io_hal_gpio_writepin(ETH_RESET_N,IOAL_GPIO_PIN_RESET);
	os_delay(50);
//	io_hal_gpio_writepin(ETH_DCDC1_ON,IOAL_GPIO_PIN_SET);
//	io_hal_gpio_writepin(ETH_DCDC2_ON,IOAL_GPIO_PIN_SET);
//	io_hal_gpio_writepin(SBAND_BB_EN,IOAL_GPIO_PIN_SET);
//
//	io_hal_gpio_writepin(UART_SW_EN_2,IOAL_GPIO_PIN_RESET);
//	io_hal_gpio_writepin(UART_SW_SEL_2,IOAL_GPIO_PIN_SET);
//	io_hal_gpio_writepin(GPS_ON_CORE,IOAL_GPIO_PIN_SET);
//
	os_delay(100);
//	io_hal_gpio_writepin(ETH_RESET_N,IOAL_GPIO_PIN_SET);

    return sts;
}

#if 0

void test_main(void)
{
/************ENTIRE THRUST SEQUENCE*************/
	//io_hal_multifeep_init_test();
	//HAL_Delay(1000);
	morpheus_thruster.ahw_gen_info.ahw_inst_id=MORPHEUS_THRUSTER;
	morpheus_thruster.ahw_gen_info.conten_state=AHW_NO_CONTEN_STE;
	morpheus_thruster.ahw_gen_info.slave_address=82;
	morpheus_thruster.ahw_gen_info.state=AH_FREE_STATE;
	//ahw_al_common_morpheus_common_init(&morpheus_thruster);
	io_hal_multifeep_unit_thruster_set_force_test();
	HAL_Delay(1000);
	io_hal_multifeep_unit_set_pwr_test(); // This API set the power of backplane (ON)
	HAL_Delay(1000);
	io_hal_multifeep_sys_get_status_test(); //This API gets the relavant data of the backplane
	HAL_Delay(1000);
	//io_hal_multifeep_unit_set_pwr_test(); // This API set the power of the system (ON)
	io_hal_multifeep_get_housekeeping1_test(); // This API gets the overall status of the system
	HAL_Delay(1000);
	io_hal_multifeep_get_housekeeping2_test(); // This API gets the status of the multifeep unit
	HAL_Delay(1000);
	io_hal_multifeep_unit_thruster_set_mode_test(); // This API set the mode of the unit(MODE2)
	HAL_Delay(1000);
	io_hal_multifeep_sys_get_srl_num_test();
	HAL_Delay(1000);
	io_hal_multifeep_get_unit_get_on_off_test();
	HAL_Delay(1000);
	io_hal_multifeep_set_mode_test();
	HAL_Delay(1000);
	io_hal_multifeep_get_mode_test();
	HAL_Delay(1000);
	io_hal_multifeep_unit_thruster_get_force_test();
	HAL_Delay(1000);
	io_hal_multifeep_reset_test();
	HAL_Delay(1000);
	io_hal_multifeep_boot_test();
	HAL_Delay(1000);
	//io_hal_multifeep_get_housekeeping1_test(); // This API gets the overall status of the system
	//io_hal_multifeep_get_housekeeping2_test(); // This API gets the status of the multifeep unit
	//io_hal_multifeep_unit_thruster_set_mode_test(); //This API set the mode of the unit(MODE4)
	//io_hal_multifeep_get_housekeeping1_test(); // This API gets the overall status of the system
	//io_hal_multifeep_unit_thruster_set_force_test(); // This API set the force (10)
	//io_hal_multifeep_get_housekeeping1_test(); // This API gets the status of the multifeep unit
	//io_hal_multifeep_get_housekeeping2_test(); // This API gets the status of the multifeep unit
	//io_hal_multifeep_unit_thruster_set_force_test(); // This API set the force (60)
	//io_hal_multifeep_get_housekeeping1_test(); // This API gets the status of the multifeep unit
	//io_hal_multifeep_unit_thruster_set_force_test(); // This API set the force (0)
	//io_hal_multifeep_get_housekeeping1_test(); // This API gets the status of the multifeep unit
	//io_hal_multifeep_unit_thruster_set_mode_test(); // This API set the mode of the unit(MODE2)
	//io_hal_multifeep_unit_thruster_set_mode_test(); // This API set the mode of the unit(MODE1)
	//io_hal_multifeep_get_housekeeping1_test(); // This API gets the status of the multifeep unit
	//io_hal_multifeep_unit_set_pwr_test(); // This API gets the serial number of the system(OFF)
	//io_hal_multifeep_get_housekeeping1_test(); // This API gets the status of the multifeep unit

/************Thrust Operation sequence ************/
	/*io_hal_multifeep_get_housekeeping1_test();
	io_hal_multifeep_unit_thruster_set_mode_test(); // This API set the mode2
	io_hal_multifeep_get_housekeeping1_test();
	io_hal_multifeep_get_housekeeping2_test(); //The exemplary value is system_id(unit1)
	io_hal_multifeep_unit_thruster_set_mode_test(); // This API set the mode4
	io_hal_multifeep_unit_thruster_set_force_test(); // This API set the force of system_id(unit 1)
	io_hal_multifeep_get_housekeeping1_test();
	io_hal_multifeep_get_housekeeping2_test(); //The exemplary value is system_id(unit1)
*/

	return;
}

//#define DEBUG_PRINT
//#define DEBUG_PRINT
/*

void io_hal_multifeep_init_test(void)
{
	//hal_ret_sts sts = HAL_MAX_ERR;


	if(ahw_al_morpheus_thruster_init()== HAL_SCS)
	{
#ifdef DEBUG_PRINT
		DEBUG_CPRINT(("major version number:%x\r\n",info->mjr_vers_no));
		DEBUG_CPRINT(("minor version number:%x\r\n",info->mnr_vers_no));
		DEBUG_CPRINT(("patch version number:%x\r\n",info->ptch_vers_no));
		DEBUG_CPRINT(("board temperature :%x\r\n",info->brd_temp));

#endif
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}
*/

/* This API gets the relavant data of the backplane  */

//multifeep_system_get_status(multifeep_intf *inst_ptr, uint8_t system_id,multifeep_sts *info)(1)
void io_hal_multifeep_sys_get_status_test(void)
{
	//hal_ret_sts sts = HAL_MAX_ERR;
	multifeep_sts* info;
	info = (multifeep_sts*)malloc(sizeof(multifeep_sts));
	if(ahw_al_thruster_get_sys_sts(&morpheus_thruster,MULTIFEEP_BACKPLANE,(al_thruster_sts*)info) == HAL_SCS)
	{
#ifdef DEBUG_PRINT
		DEBUG_CPRINT(("major version number:%x\r\n",info->mjr_vers_no));
		DEBUG_CPRINT(("minor version number:%x\r\n",info->mnr_vers_no));
		DEBUG_CPRINT(("patch version number:%x\r\n",info->ptch_vers_no));
		DEBUG_CPRINT(("board temperature :%x\r\n",info->brd_temp));

#endif
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}

/*This API gets the serial number of the system */

//multifeep_system_get_serial_number(multifeep_intf *inst_ptr,uint8_t system_id,uint8_t *srl_num)
void io_hal_multifeep_sys_get_srl_num_test(void)
{
	//hal_ret_sts sts = HAL_MAX_ERR;
	uint8_t *srl_num;
	srl_num=(uint8_t*)malloc(64*sizeof(uint8_t));
	if(ahw_al_thruster_get_sys_srl_num(&morpheus_thruster,UNIT_1,srl_num)== HAL_SCS)
	{
#ifdef DEBUG_PRINT
		DEBUG_CPRINT(("serial number:%x\r\n",srl_num[0]));
		DEBUG_CPRINT(("serial number:%x\r\n",srl_num[1]));
		DEBUG_CPRINT(("serial number:%x\r\n",srl_num[2]));
		DEBUG_CPRINT(("serial number :%x\r\n",srl_num[3]));

#endif
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}

/*This API gets the set the system */

//ahw_al_multifeep_boot(ahw_al_multifeep_hdle *morpheus_thruster)(2)
void io_hal_multifeep_unit_set_pwr_test(void)
{
	//hal_ret_sts sts = HAL_MAX_ERR;
	if(ahw_al_thruster_unit_set_pwr_on_off(&morpheus_thruster,UNIT_1,MULTIFEEP_ON)== HAL_SCS)
	{
		DEBUG_CPRINT(("Test passed\r\n"));
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}

//ahw_al_multifeep_unit_get_pwr_on_off(ahw_al_multifeep_hdle *morpheus_thruster,uint8_t *on_off,uint8_t system_id)
void io_hal_multifeep_get_unit_get_on_off_test(void)
{
	//hal_ret_sts sts = HAL_MAX_ERR;
	uint8_t *on_off;
	on_off = (uint8_t*)malloc(4*sizeof(uint8_t));
	if(ahw_al_thruster_unit_get_pwr_on_off(&morpheus_thruster,on_off,UNIT_1)== HAL_SCS)
	{
#ifdef DEBUG_PRINT
		DEBUG_CPRINT(("Power of the system:%x\r\n",*on_off));

#endif
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}

//multifeep_get_housekeeping1_data(multifeep_intf *inst_ptr,multifeep_housekeeping1 *info)(3)
void io_hal_multifeep_get_housekeeping1_test(void)
{
	//hal_ret_sts sts = HAL_MAX_ERR;
	multifeep_housekeeping1 *info;
	info = (multifeep_housekeeping1*)malloc(sizeof(multifeep_housekeeping1));
	if(ahw_al_thruster_get_housekeeping1_data(&morpheus_thruster,(al_thruster_housekeeping1*)info)== HAL_SCS)
	{
#ifdef DEBUG_PRINT
		DEBUG_CPRINT(("Housekeeping_1:%x\r\n",info->force_unit1));
		DEBUG_CPRINT(("Housekeeping_1:%x\r\n",info->mode_unit1));
		DEBUG_CPRINT(("Housekeeping_1:%x\r\n",info->pwr_unit1));
		DEBUG_CPRINT(("Housekeeping_1:%x\r\n",info->temp));

#endif
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}


//multifeep_get_housekeeping2_data(multifeep_intf *inst_ptr,multifeep_housekeeping2 *info,uint8_t system_id)(4)
void io_hal_multifeep_get_housekeeping2_test(void)
{
	//hal_ret_sts sts = HAL_MAX_ERR;
	multifeep_housekeeping2* info;
	info = (multifeep_housekeeping2*)malloc(sizeof(multifeep_housekeeping2));
	if(ahw_al_thruster_get_housekeeping2_data(&morpheus_thruster,(al_thruster_housekeeping2*)info,MULTIFEEP_UNIT1)== HAL_SCS)
	{
#ifdef DEBUG_PRINT
		DEBUG_CPRINT(("Housekeeping_2:%x\r\n",info->ext1_cur));
		DEBUG_CPRINT(("Housekeeping_2:%x\r\n",info->ext2_cur));
		DEBUG_CPRINT(("Housekeeping_2:%x\r\n",info->ext3_cur));
		DEBUG_CPRINT(("Housekeeping_2:%x\r\n",info->ext4_cur));

#endif
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}


//ahw_al_multifeep_get_housekeeping3_data(ahw_al_multifeep_hdle *morpheus_thruster,uint8_t *housekeeping3)
void io_hal_multifeep_get_housekeeping3_test(void)
{
	//hal_ret_sts sts = HAL_MAX_ERR;
	uint8_t *housekeeping3;
	housekeeping3 = (uint8_t*)malloc(124*sizeof(uint8_t));
	if(ahw_al_thruster_get_housekeeping3_data(&morpheus_thruster,housekeeping3)== HAL_SCS)
	{
#ifdef DEBUG_PRINT
		DEBUG_CPRINT(("Housekeeping_3:%x\r\n",housekeeping3[0]));
		DEBUG_CPRINT(("Housekeeping_3:%x\r\n",housekeeping3[1]));
		DEBUG_CPRINT(("Housekeeping_3:%x\r\n",housekeeping3[2]));
		DEBUG_CPRINT(("Housekeeping_3:%x\r\n",housekeeping3[3]));

#endif
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}


//multifeep_unit_thruster_set_mode(multifeep_intf *inst_ptr,uint8_t system_id,uint8_t mode)(5)
void io_hal_multifeep_unit_thruster_set_mode_test(void)
{
	//hal_ret_sts sts = HAL_MAX_ERR;
	if(ahw_al_thruster_unit_set_mode(&morpheus_thruster,UNIT_1,MULTIFEEP_MODE4)== HAL_SCS)
	{
		DEBUG_CPRINT(("Test passed\r\n"));
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}

/*
void io_hal_multifeep_thruster_get_mode_test(void)
{
	hal_ret_sts sts = HAL_MAX_ERR;
	if(ahw_al_multifeep_thruster_get_mode(&morpheus_thruster,system_id,mode)== HAL_SCS)
	{
		DEBUG_CPRINT(("Test passed\r\n"));
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}
*/

// multifeep_set_mode(multifeep_intf *inst_ptr,uint8_t system_id)
void io_hal_multifeep_set_mode_test(void)
{
	//hal_ret_sts sts = HAL_MAX_ERR;
	if(ahw_al_thruster_set_mode(&morpheus_thruster,MULTIFEEP_BACKPLANE)== HAL_SCS)
	{
		DEBUG_CPRINT(("Test passed\r\n"));
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}

//multifeep_get_mode(multifeep_intf *inst_ptr,uint8_t system_id,uint8_t *mode)
void io_hal_multifeep_get_mode_test(void)
{
	//hal_ret_sts sts = HAL_MAX_ERR;
	uint8_t *mode;
	mode = (uint8_t*)malloc(4*sizeof(uint8_t));
	if(ahw_al_thruster_get_mode(&morpheus_thruster,UNIT_1,mode)== HAL_SCS)
	{
#ifdef DEBUG_PRINT
		DEBUG_CPRINT(("Housekeeping_3:%x\r\n",*mode));

#endif
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}


//ahw_al_multifeep_unit_thruster_set_force(ahw_al_multifeep_hdle *morpheus_thruster,uint8_t system_id,float force)(6)

void io_hal_multifeep_unit_thruster_set_force_test(void)
{
	//hal_ret_sts sts = HAL_MAX_ERR;
	if(ahw_al_thruster_unit_set_frc(&morpheus_thruster,UNIT_ALL,2)== HAL_SCS)
	{
		DEBUG_CPRINT(("Test passed\r\n"));
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}


//ahw_al_multifeep_unit_thruster_set_force(ahw_al_multifeep_hdle *morpheus_thruster,uint8_t system_id,float force)(6)
void io_hal_multifeep_unit_thruster_get_force_test(void)
{
	//hal_ret_sts sts = HAL_MAX_ERR;
	uint8_t *frc;
	frc = (uint8_t*)malloc(4*sizeof(uint8_t));
	if(ahw_al_thruster_unit_get_frc(&morpheus_thruster,UNIT_1,frc)== HAL_SCS)
	{
#ifdef DEBUG_PRINT
		DEBUG_CPRINT(("Force:%x\r\n",*frc));
#endif
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}


//ahw_al_multifeep_reset(ahw_al_multifeep_hdle *morpheus_thruster)
void io_hal_multifeep_reset_test(void)
{
	//hal_ret_sts sts = HAL_MAX_ERR;
	if(ahw_al_thruster_reset(&morpheus_thruster)== HAL_SCS)
	{
		DEBUG_CPRINT(("Test passed\r\n"));
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}


//ahw_al_multifeep_boott(ahw_al_multifeep_hdle *morpheus_thruster)
void io_hal_multifeep_boot_test(void)
{
	//hal_ret_sts sts = HAL_MAX_ERR;
	if(ahw_al_thruster_boot(&morpheus_thruster)== HAL_SCS)
	{
		DEBUG_CPRINT(("Test passed\r\n"));
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}

/*
//ahw_al_multifeep_get_master_time(ahw_al_multifeep_hdle *morpheus_thruster,uint32_t *mst_tm)
void io_hal_multifeep_get_master_time_test(void)
{
	hal_ret_sts sts = HAL_MAX_ERR;
	uint32_t *mst;
	mst = (uint32_t*)malloc(1*(uint32_t));
	if(ahw_al_multifeep_get_master_time(&morpheus_thruster,mst_tm)== HAL_SCS)
	{
		DEBUG_CPRINT(("Test passed\r\n"));
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}

//
void io_hal_multifeep_unit_get_backplane_temp_test(void)
{
	hal_ret_sts sts = HAL_MAX_ERR;
	uint8_t *bckpln_temp;
	bckpln_temp = (uint8_t*)malloc(1*(uint8_t));
	if(ahw_al_multifeep_get_backplane_temp(&morpheus_thruster,bckpln_temp)== HAL_SCS)
	{
		DEBUG_CPRINT(("Test passed\r\n"));
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}


void io_hal_multifeep_get_backplane_tot_frc_test(void)
{
	hal_ret_sts sts = HAL_MAX_ERR;
	uint16_t *bckpln_frc;
	bckpln_frc = (uint16_t*)malloc(1*(uint16_t));
	if(ahw_al_multifeep_get_backplane_total_force(&morpheus_thruster,bckpln_frc)== HAL_SCS)
	{
		DEBUG_CPRINT(("Test passed\r\n"));
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}


void io_hal_multifeep_get_total_azimuthal_angle_test(void)
{
	hal_ret_sts sts = HAL_MAX_ERR;
	uint16_t *tot_azmth;
	tot_azmth = (uint16_t*)malloc(1*(uint16_t));
	if(ahw_al_multifeep_get_total_azimuthal_angle(&morpheus_thruster,tot_azmth)== HAL_SCS)
	{
		DEBUG_CPRINT(("Test passed\r\n"));
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}


void io_hal_multifeep_get_total_polar_angle_test(void)
{
	hal_ret_sts sts = HAL_MAX_ERR;
	uint8_t *tot_plr;
	tot_plr = (uint8_t*)malloc(1*(uint8_t));
	if(ahw_al_multifeep_get_total_polar_angle(&morpheus_thruster,tot_plr)== HAL_SCS)
	{
		DEBUG_CPRINT(("Test passed\r\n"));
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}


void io_hal_multifeep_get_total_pwr_cnsp_test(void)
{
	hal_ret_sts sts = HAL_MAX_ERR;
	uint16_t *pwr_cnsp;
	pwr_cnsp = (uint16_t*)malloc(1*(uint16_t));
	if(ahw_al_multifeep_get_total_pwr_cnsp(&morpheus_thruster,pwr_cnsp)== HAL_SCS)
	{
		DEBUG_CPRINT(("Test passed\r\n"));
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}


void io_hal_multifeep_get_unreg_vol_test(void)
{
	hal_ret_sts sts = HAL_MAX_ERR;
	uint8_t *unreg_vol;
	unreg_vol = (uint8_t*)malloc(1*(uint8_t));
	if(ahw_al_multifeep_get_unreg_vol(&morpheus_thruster,unreg_vol)== HAL_SCS)
	{
		DEBUG_CPRINT(("Test passed\r\n"));
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}


void io_hal_multifeep_get_unreg_vol_test(void)
{
	hal_ret_sts sts = HAL_MAX_ERR;
	uint16_t *prplt;
	prplt = (uint16_t*)malloc(1*(uint16_t));
	if(ahw_al_multifeep_multifeep_get_remn_prplt(&morpheus_thruster,prplt)== HAL_SCS)
	{
		DEBUG_CPRINT(("Test passed\r\n"));
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}

void io_hal_multifeep_get_unreg_vol_test(void)
{
	hal_ret_sts sts = HAL_MAX_ERR;
	uint8_t *unreg_vol;
	unreg_vol = (uint8_t*)malloc(1*(uint8_t));
	if(ahw_al_multifeep_get_unreg_vol(&morpheus_thruster,unreg_vol)== HAL_SCS)
	{
		DEBUG_CPRINT(("Test passed\r\n"));
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}

void io_hal_multifeep_get_unreg_vol_test(void)
{
	hal_ret_sts sts = HAL_MAX_ERR;
	uint8_t *unreg_vol;
	unreg_vol = (uint8_t*)malloc(1*(uint8_t));
	if(ahw_al_multifeep_get_unreg_vol(&morpheus_thruster,unreg_vol)== HAL_SCS)
	{
		DEBUG_CPRINT(("Test passed\r\n"));
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}

void io_hal_multifeep_get_unreg_vol_test(void)
{
	hal_ret_sts sts = HAL_MAX_ERR;
	uint8_t *unreg_vol;
	unreg_vol = (uint8_t*)malloc(1*(uint8_t));
	if(ahw_al_multifeep_get_unreg_vol(&morpheus_thruster,unreg_vol)== HAL_SCS)
	{
		DEBUG_CPRINT(("Test passed\r\n"));
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}

void io_hal_multifeep_get_unreg_vol_test(void)
{
	hal_ret_sts sts = HAL_MAX_ERR;
	uint8_t *unreg_vol;
	unreg_vol = (uint8_t*)malloc(1*(uint8_t));
	if(ahw_al_multifeep_get_unreg_vol(&morpheus_thruster,unreg_vol)== HAL_SCS)
	{
		DEBUG_CPRINT(("Test passed\r\n"));
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}

void io_hal_multifeep_get_unreg_vol_test(void)
{
	hal_ret_sts sts = HAL_MAX_ERR;
	uint8_t *unreg_vol;
	unreg_vol = (uint8_t*)malloc(1*(uint8_t));
	if(ahw_al_multifeep_get_unreg_vol(&morpheus_thruster,unreg_vol)== HAL_SCS)
	{
		DEBUG_CPRINT(("Test passed\r\n"));
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}

void io_hal_multifeep_get_unreg_vol_test(void)
{
	hal_ret_sts sts = HAL_MAX_ERR;
	uint8_t *unreg_vol;
	unreg_vol = (uint8_t*)malloc(1*(uint8_t));
	if(ahw_al_multifeep_get_unreg_vol(&morpheus_thruster,unreg_vol)== HAL_SCS)
	{
		DEBUG_CPRINT(("Test passed\r\n"));
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}


void io_hal_bmx160_init_test(void)
{
	hal_ret_sts sts = HAL_MAX_ERR;
	if(ahw_al_imu_init() == HAL_SCS)
	{
		DEBUG_CPRINT(("Test passed\r\n"));
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}


void io_hal_bmx160_soft_reset_test(void)
{
	hal_ret_sts sts = HAL_MAX_ERR;
	if(ahw_al_imu_soft_reset(&himu) == HAL_SCS)
	{
		DEBUG_CPRINT(("Test passed\r\n"));
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}


void io_hal_bmx160_set_sensor_config_test(void)
{
	hal_ret_sts sts = HAL_MAX_ERR;
	if(ahw_al_imu_set_sensor_config(&himu) == HAL_SCS)
	{
		DEBUG_CPRINT(("Test passed\r\n"));
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}

void io_hal_bmx160_get_sensor_config_test(void)
{
	hal_ret_sts sts = HAL_MAX_ERR;
	if(ahw_al_imu_get_sensor_config(himu) == HAL_SCS)
	{
	#ifdef DEBUG_PRINT
			DEBUG_CPRINT(("major version number:%x\r\n",info->mjr_vers_no));
			DEBUG_CPRINT(("minor version number:%x\r\n",info->mnr_vers_no));
			DEBUG_CPRINT(("patch version number:%x\r\n",info->ptch_vers_no));
			DEBUG_CPRINT(("board temperature :%x\r\n",info->brd_temp));

	#endif
		}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}

void io_hal_bmx160_set_power_mode_test(void)
{
	hal_ret_sts sts = HAL_MAX_ERR;
	if(ahw_al_imu_set_power_mode(&himu) == HAL_SCS)
	{
		DEBUG_CPRINT(("Test passed\r\n"));
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}

void io_hal_bmx160_get_power_mode_test(void)
{
	hal_ret_sts sts = HAL_MAX_ERR;
	if(ahw_al_imu_get_power_mode(&himu) == HAL_SCS)
	{
	#ifdef DEBUG_PRINT
			DEBUG_CPRINT(("major version number:%x\r\n",info->mjr_vers_no));
			DEBUG_CPRINT(("minor version number:%x\r\n",info->mnr_vers_no));
			DEBUG_CPRINT(("patch version number:%x\r\n",info->ptch_vers_no));
			DEBUG_CPRINT(("board temperature :%x\r\n",info->brd_temp));

	#endif
		}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}

void io_hal_bmx160_get_sensor_data_test(void)
{
	hal_ret_sts sts = HAL_MAX_ERR;
	if(ahw_al_imu_get_sensor_data(&himu) == HAL_SCS)
	{
	#ifdef DEBUG_PRINT
			DEBUG_CPRINT(("major version number:%x\r\n",info->mjr_vers_no));
			DEBUG_CPRINT(("minor version number:%x\r\n",info->mnr_vers_no));
			DEBUG_CPRINT(("patch version number:%x\r\n",info->ptch_vers_no));
			DEBUG_CPRINT(("board temperature :%x\r\n",info->brd_temp));

	#endif
		}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}

void io_hal_bmx160_any_motion_detect_ste_cfg_test(void)
{
	hal_ret_sts sts = HAL_MAX_ERR;
	if(ahw_al_imu_any_motion_detect_ste_cfg(&int_config, &himu) == HAL_SCS)
	{
		DEBUG_CPRINT(("Test passed\r\n"));
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}

void io_hal_bmx160_sig_motion_detect_ste_cfg_test(void)
{
	hal_ret_sts sts = HAL_MAX_ERR;
	if(ahw_al_imu_sig_motion_detect_ste_cfg(&int_config, &himu) == HAL_SCS)
	{
		DEBUG_CPRINT(("Test passed\r\n"));
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}

void io_hal_bmx160_no_motion_detect_ste_cfg_test(void)
{
	hal_ret_sts sts = HAL_MAX_ERR;
	if(ahw_al_imu_no_motion_detect_ste_cfg(&int_config, &himu) == HAL_SCS)
	{
		DEBUG_CPRINT(("Test passed\r\n"));
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}

void io_hal_bmx160_orient_detect_ste_cfg_test(void)
{
	hal_ret_sts sts = HAL_MAX_ERR;
	if(ahw_al_imu_orient_detect_ste_cfg(&int_config, &himu) == HAL_SCS)
	{
		DEBUG_CPRINT(("Test passed\r\n"));
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}

void io_hal_bmx160_flat_detect_ste_cfg_test(void)
{
	hal_ret_sts sts = HAL_MAX_ERR;
	if(ahw_al_imu_flat_detect_ste_cfg(&int_config, &himu) == HAL_SCS)
	{
	#ifdef DEBUG_PRINT
			DEBUG_CPRINT(("major version number:%x\r\n",info->mjr_vers_no));
			DEBUG_CPRINT(("minor version number:%x\r\n",info->mnr_vers_no));
			DEBUG_CPRINT(("patch version number:%x\r\n",info->ptch_vers_no));
			DEBUG_CPRINT(("board temperature :%x\r\n",info->brd_temp));

	#endif
		}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}

void io_hal_bmx160_freefall_detect_ste_cfg_test(void)
{
	hal_ret_sts sts = HAL_MAX_ERR;
	if(ahw_al_imu_freefall_detect_ste_cfg(&int_config, &himu) == HAL_SCS)
	{
		DEBUG_CPRINT(("Test passed\r\n"));
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}

void io_hal_bmx160_shock_detect_ste_cfg_test(void)
{
	hal_ret_sts sts = HAL_MAX_ERR;
	if(ahw_al_imu_shock_detect_ste_cfg(&int_config, &himu) == HAL_SCS)
	{
		DEBUG_CPRINT(("Test passed\r\n"));
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}




void io_hal_ucd9081_init_test(void)
{
	hal_ret_sts sts = HAL_MAX_ERR;
	if(ahw_al_vsm_init()== HAL_SCS)
	{
		DEBUG_CPRINT(("Test passed\r\n"));
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}

void io_hal_ucd9081_config_test(void)
{
	hal_ret_sts sts = HAL_MAX_ERR;
	if(ahw_al_vsm_rail_config(&al_vsm,&rail_info)== HAL_SCS)
	{
		DEBUG_CPRINT(("Test passed\r\n"));
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}

void io_hal_ucd9081_undervoltage_thrsld_test(void)
{
	hal_ret_sts sts = HAL_MAX_ERR;
	if(ahw_al_vsm_set_undervoltage_thrsld(&al_vsm,&rail_info,udr_vltg_thrsld)== HAL_SCS)
	{
		DEBUG_CPRINT(("Test passed\r\n"));
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}

void io_hal_ucd9081_ovrvoltage_thrsld_test(void)
{
	hal_ret_sts sts = HAL_MAX_ERR;
	if(ahw_al_vsm_set_overvoltage_thrsld(&al_vsm, &rail_info,ovr_vltg_thrsld)== HAL_SCS)
	{
		DEBUG_CPRINT(("Test passed\r\n"));
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}

void io_hal_ucd9081_enable_polarity_test(void)
{
	hal_ret_sts sts = HAL_MAX_ERR;
	if(ahw_al_vsm_set_enable_polarity(&al_vsm, &rail_info,polarity)== HAL_SCS)
	{
		DEBUG_CPRINT(("Test passed\r\n"));
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}

void io_hal_ucd9081_unsequence_time_test(void)
{
	hal_ret_sts sts = HAL_MAX_ERR;
	if(ahw_al_vsm_set_unsequence_time(&al_vsm, &rail_info,time)== HAL_SCS)
	{
		DEBUG_CPRINT(("Test passed\r\n"));
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}

void io_hal_ucd9081_out_0f_reg_width_test(void)
{
	hal_ret_sts sts = HAL_MAX_ERR;
	if(ahw_al_vsm_set_out_of_reg_width(&al_vsm,&rail_info,width)== HAL_SCS)
	{
		DEBUG_CPRINT(("Test passed\r\n"));
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}

void io_hal_ucd9081_ramp_time_test(void)
{
	hal_ret_sts sts = HAL_MAX_ERR;
	if(ahw_al_vsm_set_ramp_time(&al_vsm,&rail_info,ramp_tm)== HAL_SCS)
	{
		DEBUG_CPRINT(("Test passed\r\n"));
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}

void io_hal_ucd9081_force_restart_test(void)
{
	hal_ret_sts sts = HAL_MAX_ERR;
	if(ahw_al_vsm_force_restart(&al_vsm)== HAL_SCS)
	{
		DEBUG_CPRINT(("Test passed\r\n"));
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}

void io_hal_ucd9081_vsm_restart_test(void)
{
	hal_ret_sts sts = HAL_MAX_ERR;
	if(ahw_al_vsm_restart(&al_vsm)== HAL_SCS)
	{
		DEBUG_CPRINT(("Test passed\r\n"));
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}

void io_hal_ucd9081_fw_version_test(void)
{
	hal_ret_sts sts = HAL_MAX_ERR;
	if(ahw_al_vsm_get_fw_version(&al_vsm,version)== HAL_SCS)
	{
		DEBUG_CPRINT(("Test passed\r\n"));
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}

void io_hal_ucd9081_get_voltage_test(void)
{
	hal_ret_sts sts = HAL_MAX_ERR;
	if(ahw_al_vsm_get_voltage(&al_vsm, &rail_info,voltage)== HAL_SCS)
	{
		DEBUG_CPRINT(("Test passed\r\n"));
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}

//thruster//



void io_hal_ucd9081_alrm_pnding_test(void)
{
	hal_ret_sts sts = HAL_MAX_ERR;
	if(ahw_al_vsm_get_alrm_pndng_sts(&al_vsm,rail_err_sts)== HAL_SCS)
	{
		DEBUG_CPRINT(("Test passed\r\n"));
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}

void io_hal_ucd9081_seq_type_test(void)
{
	hal_ret_sts sts = HAL_MAX_ERR;
	if(ahw_al_vsm_set_seq_type(&al_vsm, &rail_info,seq_tp)== HAL_SCS)
	{
		DEBUG_CPRINT(("Test passed\r\n"));
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}
void io_hal_ucd9081_seq_delay_test(void)
{
	hal_ret_sts sts = HAL_MAX_ERR;
	if(ahw_al_vsm_set_seq_delay(&al_vsm,&rail_info, dly_tm)== HAL_SCS)
	{
		DEBUG_CPRINT(("Test passed\r\n"));
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}
void io_hal_ucd9081_alrm_pnding_test(void)
{
	hal_ret_sts sts = HAL_MAX_ERR;
	if(ahw_al_vsm_set_seq_prnt_vltg_lvl(ahw_al_vsm_hdle *al_vsm, vltg_seq_rail_cfg* actual_rail_info, vltg_seq_rail_cfg* parent_rail_info,voltage)== HAL_SCS)
	{
		DEBUG_CPRINT(("Test passed\r\n"));
	}
	else
	{
		DEBUG_CPRINT(("Test failed\r\n"));
	}
	return;

}

*/
/*
extern ahw_al_vsm_hdle *hvsm_obc;

extern ahw_al_psm_hdle *ahw_hpsm_ps;
extern ahw_al_psm_hdle *ahw_hpsm_obc;

extern ahw_al_imu_hdle ahw_al_himu_obc_1;
extern ahw_al_imu_hdle ahw_al_himu_obc_2;

extern ahw_al_hsc_hdl *hsc_edge;
extern ahw_al_hsc_hdl *hsc_ps_1;
extern ahw_al_hsc_hdl *hsc_ps_2;

extern ahw_al_gpio_exp_hdle *hgpio_exp_edge_1;
extern ahw_al_gpio_exp_hdle *hgpio_exp_edge_2;
extern ahw_al_gpio_exp_hdle *hgpio_exp_ps;

extern ahw_al_dt_hdle *hdt_ps;
extern ahw_al_dt_hdle *hdt_edge;

extern ahw_al_temp_sensor_hdl *ahw_ts_ps;
extern ahw_al_temp_sensor_hdl *ahw_ts_obc;
extern ahw_al_temp_sensor_hdl *ahw_ts_edge;
extern ahw_al_temp_sensor_hdl *ahw_ts_gps;

hal_ret_sts ret_sts;
float temperature_data,temp_fhrnt,temp_cel;

temp_sensor_res_t set_res,get_res;
temp_sensor_hyst_t set_hyst,get_hyst;

void temp_mcp_test()
{

ret_sts = ahw_al_temp_sensor_gettemperature(ahw_ts_edge,&temperature_data);
#if 0
ret_sts = ahw_al_temp_sensor_set_temp_high_threshold( ahw_al_hts,50);
ret_sts = ahw_al_temp_sensor_set_mode(ahw_al_hts,TEMP_SENSE_CONTINUOUS_CONVERSTION);
ret_sts = ahw_al_temp_sensor_set_temp_low_threshold(ahw_al_hts,30);

ret_sts = ahw_al_temp_sensor_get_fahrenheit(ahw_al_hts,&temp_fhrnt);
ret_sts = ahw_al_ts_common_get_celsius(ahw_al_hts,&temp_cel);
///ret_sts = ahw_al_ts_common_read_manufacture_id();
ret_sts = ahw_al_ts_common_set_resolution(ahw_al_hts,&set_res);
ret_sts = ahw_al_ts_common_get_resolution(ahw_al_hts,&get_res);
ret_sts = ahw_al_ts_common_set_hysteresis(ahw_al_hts,set_hyst);
ret_sts = ahw_al_ts_common_get_hysteresis(ahw_al_hts,get_hyst);
#endif

}

hal_ret_sts psm_sts_obc;
uint16_t calib=0x0A00;
uint16_t calib_d;
uint16_t v_bus_th;
float vbus_d;
float vshunt_d;
int16_t vshuntthrshld;
uint32_t powerthrshld;
float current;
uint32_t power;

void psm_test()
{
psm_sts_obc = ahw_al_psm_set_calibration(ahw_hpsm_obc,calib);
calib_d = ahw_al_psm_get_calibration(ahw_hpsm_obc);
vbus_d = ahw_al_psm_get_vbus(ahw_hpsm_obc);                 ////
vshunt_d = ahw_al_psm_get_vshunt(ahw_hpsm_obc);             /////
power = ahw_al_psm_get_power(ahw_hpsm_obc);   ////
current = ahw_al_psm_get_current(ahw_hpsm_obc);  /////
//psm_sts_obc = ahw_al_psm_setvbusthreshold(ahw_al_hpsm,v_bus_th);
///psm_sts_obc = ahw_al_psm_getvbusthreshold(ahw_al_hpsm);

///ahw_al_psm_getpowerthreshold();
//psm_sts_obc = ahw_al_psm_setvshuntthreshold(ahw_al_hpsm,vshuntthrshld);
//psm_sts_obc = ina230_setpowerthreshold(ahw_al_hpsm,powerthrshld);


}
//imu

void imu_test()
{
	hal_ret_sts imu_sts;
	ahw_al_himu_obc_1.accel_cfg.bw=0;
	ahw_al_himu_obc_1.accel_cfg.odr=8;
	ahw_al_himu_obc_1.accel_cfg.power=16;
	ahw_al_himu_obc_1.accel_cfg.range=3;

	ahw_al_himu_obc_1.gyro_cfg.bw=2;
	ahw_al_himu_obc_1.gyro_cfg.odr=8;
	ahw_al_himu_obc_1.gyro_cfg.power=20;
	ahw_al_himu_obc_1.gyro_cfg.range=0;


	imu_sts = ahw_al_imu_set_sensor_config(&ahw_al_himu_obc_1);
	imu_sts = ahw_al_imu_get_sensor_config(&ahw_al_himu_obc_1);
	imu_sts = ahw_al_imu_get_sensor_data(&ahw_al_himu_obc_1);


}

float adm_edge_voltage;
float adm_edge_current;
uint8_t adm_ctrl;
void adm_test()
{
	ahw_al_hsc_read_voltage(hsc_edge,&adm_edge_voltage);
	ahw_al_hsc_read_current(hsc_edge,&adm_edge_current);
	//ahw_al_hsc_hotswap_control(hsc_edge,adm_ctrl);
}

void dt_test()
{
	double temp;
	digital_thermos_resolution reso;
	digital_thermos_resolution set_reso =DT_BIT_13;
	ahw_al_dt_get_temperature(hdt_edge,&temp);
	ahw_al_dt_set_resolution(hdt_edge,set_reso);
	ahw_al_dt_get_resolution(hdt_edge,&reso );
}

extern ahw_al_gpio_exp_hdle *hgpio_exp_edge_1;
extern ahw_al_gpio_exp_hdle *hgpio_exp_edge_2;

gpio_exp_pin_dir pin_dir=GPIO_EXP_OUTPUT;
gpio_exp_gpio_pin pin_num =GPIO_EXP_GPIO_0|GPIO_EXP_GPIO_1|GPIO_EXP_GPIO_2|GPIO_EXP_GPIO_3|GPIO_EXP_GPIO_4|GPIO_EXP_GPIO_6|GPIO_EXP_GPIO_7;
gpio_exp_gpio_pin wr_pin_num=GPIO_EXP_GPIO_0|GPIO_EXP_GPIO_1|GPIO_EXP_GPIO_4|GPIO_EXP_GPIO_7;
gpio_exp_gpio_pinstate wr_pin_state= GPIO_EXP_PIN_SET;
gpio_exp_gpio_pin rd_pin_num=GPIO_EXP_GPIO_0;
gpio_exp_gpio_pinstate rd_pin_state;

gpio_exp_pin_dir pin_dir_2=GPIO_EXP_OUTPUT;
gpio_exp_gpio_pin pin_num_2 =GPIO_EXP_GPIO_0|GPIO_EXP_GPIO_2|GPIO_EXP_GPIO_3|GPIO_EXP_GPIO_6|GPIO_EXP_GPIO_7;
gpio_exp_gpio_pin wr_pin_num_2=GPIO_EXP_GPIO_0|GPIO_EXP_GPIO_2;
gpio_exp_gpio_pinstate wr_pin_state_2= GPIO_EXP_PIN_SET;
gpio_exp_gpio_pin rd_pin_num_2=GPIO_EXP_GPIO_0;
gpio_exp_gpio_pinstate rd_pin_state_2;
void mcp_gpx_test()
{
	ahw_al_gpio_exp_set_dir(hgpio_exp_edge_1,pin_num,pin_dir);
	ahw_al_gpio_exp_writepin(hgpio_exp_edge_1,wr_pin_num,wr_pin_state);
	ahw_al_gpio_exp_readpin(hgpio_exp_edge_1,rd_pin_num,&rd_pin_state);
	HAL_Delay(100);
	ahw_al_gpio_exp_set_dir(hgpio_exp_edge_2,pin_num_2,pin_dir_2);
	ahw_al_gpio_exp_writepin(hgpio_exp_edge_2,wr_pin_num_2,wr_pin_state_2);
	HAL_Delay(600);
	ahw_al_gpio_exp_writepin(hgpio_exp_edge_2,0xC5,wr_pin_state_2);
	HAL_Delay(2000);
	ahw_al_gpio_exp_writepin(hgpio_exp_edge_2,0xCD,wr_pin_state_2);
	ahw_al_gpio_exp_readpin(hgpio_exp_edge_2,rd_pin_num_2,&rd_pin_state_2);

}



void core_board_sensor_test()
{
	float temp;
	hal_ret_sts psm_sts_obc;
	uint16_t calib_obc=0x0A00;
	uint16_t calib_d_obc;
	uint16_t v_bus_th_obc;
	float vbus_d_obc;
	float vshunt_d_obc;
	int16_t vshuntthrshld_obc;
	uint32_t powerthrshld_obc;
	float current_obc;
	uint32_t power_obc;

	ahw_al_temp_sensor_gettemperature(ahw_ts_obc,&temp);

	psm_sts_obc = ahw_al_psm_set_calibration(ahw_hpsm_obc,calib_obc);
	calib_d_obc = ahw_al_psm_get_calibration(ahw_hpsm_obc);
	vbus_d_obc = ahw_al_psm_get_vbus(ahw_hpsm_obc);                 ////
	vshunt_d_obc = ahw_al_psm_get_vshunt(ahw_hpsm_obc);             /////
	power_obc = ahw_al_psm_get_power(ahw_hpsm_obc);   ////
	current_obc = ahw_al_psm_get_current(ahw_hpsm_obc);

}

void edge_board_sensor_test()
{

	float adm_edge_voltage;
	float adm_edge_current;

	float temp_edge;

	ahw_al_hsc_read_voltage(hsc_edge,&adm_edge_voltage);
	ahw_al_hsc_read_current(hsc_edge,&adm_edge_current);

	ahw_al_dt_get_temperature(ahw_ts_edge,&temp_edge);
	temp_edge=0;
	ahw_al_temp_sensor_gettemperature(ahw_ts_edge,&temp_edge);

}

void gps_board_sensor_test()
{
	float temp_gps;
	ahw_al_temp_sensor_gettemperature(ahw_ts_gps,&temp_gps);
}

void ps_board_sensor_test()
{
	float temp_ps;
	float temp_ps_ds;
	hal_ret_sts psm_sts_ps;
	uint16_t calib_ps=0x0A00;
	uint16_t calib_d_ps;
	uint16_t v_bus_th_ps;
	float vbus_d_ps;
	float vshunt_d_ps;
	int16_t vshuntthrshld_ps;
	uint32_t powerthrshld_ps;
	float current_ps;
	uint32_t power_ps;

	float adm_ps1_voltage;
	float adm_ps1_current;

	float adm_ps2_voltage;
	float adm_ps2_current;

	ahw_al_dt_get_temperature(hdt_ps,&temp_ps_ds);

	psm_sts_ps = ahw_al_psm_set_calibration(ahw_hpsm_ps,calib_ps);
	calib_d_ps = ahw_al_psm_get_calibration(ahw_hpsm_ps);
	vbus_d_ps = ahw_al_psm_get_vbus(ahw_hpsm_ps);                 ////
	vshunt_d_ps = ahw_al_psm_get_vshunt(ahw_hpsm_ps);             /////
	power_ps = ahw_al_psm_get_power(ahw_hpsm_ps);   ////
	current_ps = ahw_al_psm_get_current(ahw_hpsm_ps);

	ahw_al_temp_sensor_gettemperature(ahw_ts_ps,&temp_ps);

	ahw_al_hsc_read_voltage(hsc_ps_1,&adm_ps1_voltage);
	ahw_al_hsc_read_current(hsc_ps_1,&adm_ps1_current);

	ahw_al_hsc_read_voltage(hsc_ps_2,&adm_ps2_voltage);
	ahw_al_hsc_read_current(hsc_ps_2,&adm_ps2_current);

}
*/
#endif
