1.1.4.4.1 DRV_RF215_Initialize Function

C

SYS_MODULE_OBJ DRV_RF215_Initialize (
    const SYS_MODULE_INDEX index,
    const SYS_MODULE_INIT * const init
);

Summary

Initializes the RF215 driver.

Description

This routine initializes the RF215 driver, making it ready for clients to open and use it. The initialization data is specified by the init parameter. It is a single instance driver, so this function should be called only once.

Precondition

None.

Parameters

ParamDescription
indexIdentifier for the instance to be initialized. Only one instance (index 0) supported.
initPointer to the initialization data structure containing the data necessary to initialize the driver.

Returns

If successful, returns a valid handle to a driver instance object. Otherwise, returns SYS_MODULE_OBJ_INVALID.

Example

SYS_MODULE_OBJ sysObjDrvRf215;

/* RF215 Driver Initialization Data */
const DRV_RF215_INIT drvRf215InitData = {
    /* SPI chip select register address used for SPI configuration */
    .spiCSRegAddress = (uint32_t *)&(SPI0_REGS->SPI_CSR[DRV_RF215_CSR_INDEX]),

    /* SPI Transmit Register */
    .spiTransmitAddress = (const void *)&(SPI0_REGS->SPI_TDR),

    /* SPI Receive Register */
    .spiReceiveAddress = (const void *)&(SPI0_REGS->SPI_RDR),

    /* Interrupt source ID for DMA */
    .dmaIntSource = XDMAC_IRQn,

    /* Interrupt source ID for SYS_TIME */
    .sysTimeIntSource = TC0_CH0_IRQn,

    /* Initial PHY frequency band and operating mode for Sub-GHz transceiver */
    .rf09PhyBandOpmIni = SUN_FSK_BAND_863_OPM1,

    /* Initial PHY frequency channel number for Sub-GHz transceiver */
    .rf09PhyChnNumIni = 0,

};

sysObjDrvRf215 = DRV_RF215_Initialize(DRV_RF215_INDEX_0, (SYS_MODULE_INIT *)&drvRf215InitData);

Remarks

This routine must be called before any other RF215 Driver routine and should only be called once during system initialization.