/// @note      Application Core

// System Includes
#include <zephyr.h>
#include <logging/log.h>
#include <nrfx_ipc.h>

// Project Includes
#include "ipc.h"

LOG_MODULE_REGISTER( ipc, LOG_LEVEL_DBG );

void ipc_event_handler( uint32_t event_mask, void * p_context )
{
    ARG_UNUSED( p_context );
    LOG_INF( "Event mask 0x%x\r\n", event_mask );
}

void ipc_init( void )
{
        IRQ_CONNECT(IPC_IRQn, 1, nrfx_ipc_irq_handler, 0, 0);
        nrfx_err_t err = nrfx_ipc_init( 1, ipc_event_handler, NULL );
        if (err != NRFX_SUCCESS)
        {
            LOG_ERR( "nrfx_ipc_init() failed. Error 0x%x\r\n", err );
        }
        nrfx_ipc_receive_event_channel_assign( 0, 0 );
        nrfx_ipc_receive_event_enable( 0 );
}
