#include "project.h"

#include "COMM_IPC_Messages.h"

int main(void)
{
    __enable_irq();

#if(CY_BLE_STACK_MODE_IPC)
    /* Start BLE Controller for dual core mode */
    Cy_BLE_Start(NULL);
#endif /* (CY_BLE_STACK_MODE_IPC)*/
    
    COMM_InitIPCMessages();

    /* Enable CM4.  CY_CORTEX_M4_APPL_ADDR must be updated if CM4 memory layout is changed. */
    Cy_SysEnableCM4(CY_CORTEX_M4_APPL_ADDR); 

    while(true)
    {       
#if(CY_BLE_STACK_MODE_IPC)
        /* Process BLE events continuously for controller in dual core mode */
        Cy_BLE_ProcessEvents();
#endif /* CY_BLE_STACK_MODE_IPC */

        /* To achieve low power in the device */
        Cy_SysPm_DeepSleep(CY_SYSPM_WAIT_FOR_INTERRUPT);
    }
}

