Esempio n. 1
0
void adl_main(adl_InitType_e initType) {
    s8 flashHandle = -1;
    u8 counter = 1;

    flashHandle = adl_flhSubscribe(PERSISTENT_COUNTER, 1);
    if (adl_flhExist(PERSISTENT_COUNTER, 0) == 0) {
        adl_flhWrite(PERSISTENT_COUNTER, 0, sizeof(counter), &counter);
    } else {
        adl_flhRead(PERSISTENT_COUNTER, 0, sizeof(counter), &counter);
        counter++;
        adl_flhWrite(PERSISTENT_COUNTER, 0, sizeof(counter), &counter);
    }

    if (initType == ADL_INIT_REBOOT_FROM_EXCEPTION) {
        wm_sprintf(ltsc_Temp, "\r\nA Fatal Error Occurred Test is restarting (%d)", counter);
        adl_atSendResponse(ADL_AT_UNS, ltsc_Temp);
    } else {
        wm_sprintf(ltsc_Temp, "\r\nTest modbus starting(%d) in 15s...'%d'", counter, initType);
        adl_atSendResponse(ADL_AT_UNS, ltsc_Temp);
    }

    UART_Init();

    // The application will switch the UART to data mode n seconds later, so the user has 15s to enter
    adl_tmrSubscribe(FALSE, 150, ADL_TMR_TYPE_100MS, MAIN_StartAppTimerHandler);
}
Esempio n. 2
0
/** @brief Calls the adl_flhSubscribe function on the provided handle and number of objects
 *
 * @param flhHandle
 * @param numObjects
 * @return OK on success
 * @return Error Code on failure
 */
s8 FlashSubscribe(char const *const flhHandle, u16 numObjects)
{
	s8 RetCode = 0;

	RetCode = adl_flhSubscribe((char *)flhHandle, numObjects);
	if ((RetCode == OK) || (RetCode == ADL_RET_ERR_ALREADY_SUBSCRIBED))
	{
		TRACE((1, "Successfully subscribed to the flash"));
		RetCode = OK;
	}
	else
	{
		DisplayErrorCode("adl_flhSubscribe", __FILE__, __LINE__ - 2, RetCode);
	}

	return RetCode;
}