1.1.4.4.5 DRV_RF215_Open Function
C
DRV_HANDLE DRV_RF215_Open ( const SYS_MODULE_INDEX index, const DRV_RF215_TRX_ID trxID );
Summary
Opens the specified RF215 driver instance and returns a handle to it.
Description
This routine opens the specified RF215 driver instance and provides a handle that must be provided to all other client-level operations to identify the caller and the instance of the driver. The trxID parameter defines the RF215 transceiver (Sub-GHz or 2.4GHz) used by the client.
Precondition
Function DRV_RF215_Initialize must have been called and function DRV_RF215_Status should have returned SYS_STATUS_READY before calling this function.
Parameters
Param | Description |
---|---|
index | Identifier for the object instance to be opened. Only one instance (index 0) supported. |
trxID | Identifier of the RF215 transceiver (Sub-GHz or 2.4GHz) used by the client. |
Returns
If successful, the routine returns a valid open-instance handle (a number identifying both the caller and the module instance).
If an error occurs, the return value is DRV_HANDLE_INVALID. Error can occur
if the number of clients allocated via MCC is insufficient.
if the specified instance index is not supported.
if the specified RF215 transceiver is not supported or disabled via MCC.
if the driver instance being opened is not ready to be opened (not initialized, initialization in progress or in error state because of wrong peripheral/hardware configuration).
Example
SYS_MODULE_OBJ sysObjDrvRf215; // Returned from DRV_RF215_Initialize
SYS_STATUS drvRf215Status;
DRV_HANDLE drvRf215Handle;
drvRf215Status = DRV_RF215_Status(sysObjDrvRf215);
if (drvRf215Status == SYS_STATUS_READY)
{
// This means now the driver can be opened using DRV_RF215_Open routine
drvRf215Handle = DRV_RF215_Open(DRV_RF215_INDEX_0, RF215_TRX_ID_RF09);
if (drvRf215Handle != DRV_HANDLE_INVALID)
{
// Driver opened successfully
}
}
Remarks
The handle returned is valid until the DRV_RF215_Close routine is called.