Drivers Libraries Help > BM64 Bluetooth Driver Library > Using the Library > How the Library Works > System Functions
MPLAB Harmony Bluetooth Help
System Functions
Initialization

The function DRV_BM64_Initialize is called by the function SYS_Initialize, in the file system_init.c, to initialize the BM64 Bluetooth driver using constants from the generated system_config.h file.

Tasks

The function DRV_BM64_Tasks is called from the System Task Service via the function SYS_Tasks in the file system_tasks.c to maintain the driver's internal control and data interface state machine. 

One can use the function DRV_BM64_TasksReq to make a power on/power off task request (DRV_BM64_REQ_SYSTEM_OFF or DRV_BM64_REQ_SYSTEM_ON).

Status

The function DRV_BM64_Status returns the BM64 Bluetooth driver status, such as SYS_STATUS_READY, SYS_STATUS_BUSY, or SYS_STATUS_ERROR. The driver should not be opened until it has been marked ready. 

Example:  

// note generic version of call (DRV_BT instead of DRV_BM64) is used
if (SYS_STATUS_READY == DRV_BT_Status())
{
// This means the driver can be opened using the
// DRV_BT_Open() function.
}

The BM64-specific function DRV_BM64_GetPowerStatus returns the current power status, e.g. DRV_BM64_STATUS_OFF, DRV_BM64_STATUS_OFF, and DRV_BM64_STATUS_READY. Once it returns a ready status, this means the BM64 driver has completed its internal state machine initialization and can begin processing audio. 

Example:  

case APP_STATE_WAIT_INIT:
{
// note generic version of call (DRV_BT instead of DRV_BM64) is used
if (DRV_BT_STATUS_READY == DRV_BT_GetPowerStatus())
{
appData.state=APP_STATE_IDLE;
// can start processing audio
}
}