/*================================================================================================== * Project : RTD AUTOSAR 4.7 * Platform : CORTEXM * Peripheral : S32K3XX * Dependencies : none * * Autosar Version : 4.7.0 * Autosar Revision : ASR_REL_4_7_REV_0000 * Autosar Conf.Variant : * SW Version : 3.0.0 * Build Version : S32K3_RTD_3_0_0_D2303_ASR_REL_4_7_REV_0000_20230331 * * Copyright 2020 - 2023 NXP Semiconductors * * NXP Confidential. This software is owned or controlled by NXP and may only be * used strictly in accordance with the applicable license terms. By expressly * accepting such terms or by downloading, installing, activating and/or otherwise * using the software, you are agreeing that you have read, and that you agree to * comply with and are bound by, such license terms. If you do not agree to be * bound by the applicable license terms, then you may not retain, install, * activate or otherwise use the software. ==================================================================================================*/ /** * @file main.c * * @addtogroup main_module main module documentation * @{ */ /* Including necessary configuration files. */ #include "Mcal.h" //volatile inde = 0; /* User includes */ #include "Fun.h" #include "Siul2_Port_Ip_Cfg.h" #include "Siul2_Dio_Ip.h" #include "Siul2_Port_Ip.h" #include "OsIf.h" #include "Dma_Ip.h" #include "Dma_Ip_Cfg.h" #include "IntCtrl_Ip.h" #include "CDD_Rm.h" //#include "Pit_Ip.h" #include "Acconeer.h" #include "example_diagnostic_test.h" #include "example_processing_amplitude.h" #include "Acconeer_Config.h" #include "presence_detection.h" #include "core_cm7.h" #include "Clock_Ip.h" #include "Flash.h" #include "RS485.h" #include "Device_P.h" //#include "presence_detection.h" /*! \brief The main function for the project. \details The startup initialization sequence is the following: * - startup asm routine * - main() */ #define FLAHS_WRITE_ACTIVE 1 #define buffer_size 16U volatile uint32_t start = 0; volatile uint32_t Elapsed = 0; uint8_t toggle = 0; int main(void) { /* Write your code here */ /* Initialize OsIf */ OsIf_Init(NULL_PTR); Clock_Ip_Init(&Mcu_aClockConfigPB[0]); Clock_Ip_DistributePll(); OsIf_SetTimerFrequency(120000000U, OSIF_COUNTER_SYSTEM); // Set timer frequency to 1MHz /* Initialize Dma and IntCtrl */ Dma_Ip_Init(&Dma_Ip_xDmaInitPB); Rm_Init(&Rm_Config); IntCtrl_Ip_Init(&IntCtrlConfig_0); IntCtrl_Ip_EnableIrq(DMATCD4_IRQn); IntCtrl_Ip_EnableIrq(DMATCD5_IRQn); IntCtrl_Ip_EnableIrq(DMATCD2_IRQn); IntCtrl_Ip_EnableIrq(DMATCD3_IRQn); IntCtrl_Ip_EnableIrq(LPUART0_IRQn); IntCtrl_Ip_EnableIrq(LPUART1_IRQn); flash_init(); read_device_parameters(); // Read device parameters from flash Config_Processing(); // Process the configuration data Siul2_Port_Ip_Init(NUM_OF_CONFIGURED_PINS0, g_pin_mux_InitConfigArr0); Init_Uarts(); Init_RS485(1); // Initialize RS485 with a timeout of 1 second Init_SPI(); RS485_Receive_Data(); Receive_Uart_Data(1,NULL_PTR , CRC_DATA_LENGTH + 1); Delay_ms(1000U); // Wait for sensor to stabilize SysTick_Config(120000000U / 1000U); // Configure SysTick for 1ms interval for(;;) { // start = HAL_GetTick(); if(start == 0) { start = HAL_GetTick(); } presence_detection_main(); Check_IDLE_Line(); if(HAL_GetTick() - start >= 1000U) { toggle^= 1; start = 0; Siul2_Dio_Ip_WritePin(STATUS_LED1_PORT, STATUS_LED1_PIN, toggle); Siul2_Dio_Ip_WritePin(STATUS_LED2_PORT, STATUS_LED2_PIN, toggle); } // Elapsed = (HAL_GetTick() - start); } return 0; } /** @} */