/*
 * lin_task.c
 *
 *  Created on: 2021Äê3ÔÂ17ÈÕ
 *      Author: nxa16228
 */

#include "bsp.h"
#include "lin_tja1124_test.h"
#include "lin_sja1124_test.h"

#define TAG "LIN"

Std_ReturnType lin_task_init(void) {
    Std_ReturnType retCode = E_OK;      /* Error status. */

	LPUART_LIN_TJA1124_Test_Init();  /* initialize LPUART and TJA1124 */
	LOGI(TAG,"LPUART and TJA1124 are initialized!\r\n");

	retCode = SJA1124_LIN_Comm_Init(); /* initialize SJA1124 module */
	if(retCode == E_OK)
		LOGI(TAG,"SJA1124 initialization OK!\r\n");
	else
		LOGI(TAG,"SJA1124 initialization failed!\r\n");
	return retCode;
}

void lin_task_runtime(void) {
	/* call TJA1124 quad-LIN phy test */
	LPUART_LIN_TJA1124_Test();

	/* call SJA1124 SPI-to-LIN controller with 4-channel LIN Phy test */
	SJA1124_LIN_Comm_Test();

}
