This module implements Utility function.
More...
|
| file | util.h |
| | Util layer interface.
|
| |
|
| void | Clock_destruct (Clock_Struct *structP) |
| |
| void | Event_post (mqd_t eventQueue, uint32_t msg) |
| |
| void * | Util_constructClock (Clock_Struct *entry, UtilTimerCback clockCB, uint32_t clockDuration, uint32_t clockPeriod, uint8_t startFlag, uint32_t arg) |
| | Initialize a TIRTOS Clock instance. More...
|
| |
| void | Util_constructQueue (mqd_t *pQueue) |
| | Initialize an RTOS queue to hold messages from profile to be processed. More...
|
| |
| char * | Util_convertBdAddr2Str (uint8_t *pAddr) |
| | Convert Bluetooth address to string. Only needed when LCD display is used. More...
|
| |
| uint8_t * | Util_dequeueMsg (mqd_t msgQueue) |
| | Dequeues the message from the RTOS queue. More...
|
| |
| uint8_t | Util_enqueueMsg (mqd_t msgQueue, Event_Handle event, uint8_t *pMsg) |
| | Creates a queue node and puts the node in RTOS queue. More...
|
| |
| bool | Util_isActive (Clock_Struct *pClock) |
| | Determine if a clock is currently active. More...
|
| |
| uint8_t | Util_isBufSet (uint8_t *pBuf, uint8_t pattern, uint16_t len) |
| | Check if contents of buffer matches byte pattern. More...
|
| |
| void | Util_rescheduleClock (Clock_Struct *pClock, uint32_t clockPeriod) |
| | Reschedule a clock by changing the timeout and period values. More...
|
| |
| void | Util_restartClock (Clock_Struct *pClock, uint32_t clockTimeout) |
| | Restart a clock by changing the timeout. More...
|
| |
| void | Util_startClock (Clock_Struct *pClock) |
| | Start a clock. More...
|
| |
| void | Util_stopClock (Clock_Struct *pClock) |
| | Stop a clock. More...
|
| |
This module implements Utility function.
§ Event_Handle
| #define Event_Handle void* |
§ SystemReset
| #define SystemReset |
( |
| ) |
Power_reset(); |
§ UTIL_EVENT_ID_00
| #define UTIL_EVENT_ID_00 (0x1) |
§ UTIL_EVENT_ID_01
| #define UTIL_EVENT_ID_01 (0x2) |
§ UTIL_EVENT_ID_02
| #define UTIL_EVENT_ID_02 (0x4) |
§ UTIL_EVENT_ID_03
| #define UTIL_EVENT_ID_03 (0x8) |
§ UTIL_EVENT_ID_04
| #define UTIL_EVENT_ID_04 (0x10) |
§ UTIL_EVENT_ID_05
| #define UTIL_EVENT_ID_05 (0x20) |
§ UTIL_EVENT_ID_06
| #define UTIL_EVENT_ID_06 (0x40) |
§ UTIL_EVENT_ID_NONE
| #define UTIL_EVENT_ID_NONE (0) |
Util Queue Event ID.
In order to wake an application when a message is inserted into its queue, an event must be posted. Util reserved Event Id 30 for a generic queue event.
§ UTIL_QUEUE_EVENT_ID
| #define UTIL_QUEUE_EVENT_ID (0x00100000) |
§ UTIL_TL_CB_EVENT
§ Clock_Struct
§ UtilTimerCback
| typedef void(* UtilTimerCback) (uint32_t arg) |
§ Clock_destruct()
§ Event_post()
| void Event_post |
( |
mqd_t |
eventQueue, |
|
|
uint32_t |
msg |
|
) |
| |
§ Util_constructClock()
| void* Util_constructClock |
( |
Clock_Struct * |
entry, |
|
|
UtilTimerCback |
clockCB, |
|
|
uint32_t |
clockDuration, |
|
|
uint32_t |
clockPeriod, |
|
|
uint8_t |
startFlag, |
|
|
uint32_t |
arg |
|
) |
| |
Initialize a TIRTOS Clock instance.
- Parameters
-
| pClock | - pointer to clock instance structure. |
| clockCB | - callback function upon clock expiration. |
| clockDuration | - longevity of clock timer in milliseconds |
| clockPeriod | - duration of a periodic clock, used continuously after clockDuration expires. |
| startFlag | - TRUE to start immediately, FALSE to wait. |
| arg | - argument passed to callback function. |
- Returns
- Clock_Handle - a handle to the clock instance.
§ Util_constructQueue()
| void Util_constructQueue |
( |
mqd_t * |
pQueue | ) |
|
Initialize an RTOS queue to hold messages from profile to be processed.
- Parameters
-
| pQueue | - pointer to queue instance structure. |
- Returns
- A queue handle.
§ Util_convertBdAddr2Str()
| char* Util_convertBdAddr2Str |
( |
uint8_t * |
pAddr | ) |
|
Convert Bluetooth address to string. Only needed when LCD display is used.
- Parameters
-
- Returns
- BD address as a string
§ Util_dequeueMsg()
| uint8_t* Util_dequeueMsg |
( |
mqd_t |
msgQueue | ) |
|
Dequeues the message from the RTOS queue.
- Parameters
-
- Returns
- pointer to dequeued message, NULL otherwise.
§ Util_enqueueMsg()
| uint8_t Util_enqueueMsg |
( |
mqd_t |
msgQueue, |
|
|
Event_Handle |
event, |
|
|
uint8_t * |
pMsg |
|
) |
| |
Creates a queue node and puts the node in RTOS queue.
- Parameters
-
| msgQueue | - queue handle. |
| event | - the thread's event processing event that this queue is associated with. |
| pMsg | - pointer to message to be queued |
- Returns
- TRUE if message was queued, FALSE otherwise.
§ Util_isActive()
Determine if a clock is currently active.
- Parameters
-
| pClock | - pointer to clock struct |
- Returns
- TRUE or FALSE
§ Util_isBufSet()
| uint8_t Util_isBufSet |
( |
uint8_t * |
pBuf, |
|
|
uint8_t |
pattern, |
|
|
uint16_t |
len |
|
) |
| |
Check if contents of buffer matches byte pattern.
- Parameters
-
| pBuf | - buffer to check |
| pattern | - pattern to match |
| len | - len of buffer (in bytes) to iterate over |
- Returns
- TRUE if buffer matches the pattern, FALSE otherwise.
§ Util_rescheduleClock()
| void Util_rescheduleClock |
( |
Clock_Struct * |
pClock, |
|
|
uint32_t |
clockPeriod |
|
) |
| |
Reschedule a clock by changing the timeout and period values.
- Parameters
-
| pClock | - pointer to clock struct |
| clockPeriod | - longevity of clock timer in milliseconds |
- Returns
- none
§ Util_restartClock()
| void Util_restartClock |
( |
Clock_Struct * |
pClock, |
|
|
uint32_t |
clockTimeout |
|
) |
| |
Restart a clock by changing the timeout.
- Parameters
-
| pClock | - pointer to clock struct |
| clockTimeout | - longevity of clock timer in milliseconds |
- Returns
- none
§ Util_startClock()
Start a clock.
- Parameters
-
| pClock | - pointer to clock struct |
- Returns
- none
§ Util_stopClock()
Stop a clock.
- Parameters
-
| pClock | - pointer to clock struct |
- Returns
- none