Wirepas SDK
wms_hardware.h File Reference

Detailed Description

The hardware library allows telling the stack that a certain hardware peripheral is in use by the application, so that the stack does not use the peripheral at the same time. Also vice versa, hardware library tells application if it is trying to use hardware peripheral used by the stack. The stack needs to know chip temperature to do periodic RF calibrations on some platforms, and that may require the stack to access hardware peripherals that the application also uses.

The application may use a peripheral either intermittently or permanently.

This library also allows the activation of a hardware peripheral. In fact, some peripheral may be needed by the application or the stack with a concurrent access as the activation of an external crystal for more precision.

Library services are accessed via lib_hw handle.

Definition in file wms_hardware.h.

Go to the source code of this file.

Typedefs

typedef app_res_e(* app_lib_hardware_activate_peripheral_f) (app_lib_hardware_activable_peripheral_e peripheral)
 Request for peripheral activation. More...
 
typedef app_res_e(* app_lib_hardware_deactivate_peripheral_f) (app_lib_hardware_activable_peripheral_e peripheral)
 Request for peripheral deactivation. More...
 
typedef app_res_e(* app_lib_hardware_is_peripheral_activated_f) (app_lib_hardware_activable_peripheral_e peripheral, bool *activated_p, uint32_t timeout_us)
 Request for peripheral status. More...
 

Data Structures

struct  app_lib_hardware_t
 List of library functions. More...
 

Enumerations

enum  app_lib_hardware_activable_peripheral_e { APP_LIB_HARDWARE_PERIPHERAL_HFXO = 0 }
 Hardware peripherals to activate. More...
 

Macros

#define APP_LIB_HARDWARE_NAME   0x014eff15
 Library symbolic name
More...
 
#define APP_LIB_HARDWARE_VERSION   0x203
 Maximum supported library version. More...
 

Typedef Documentation

◆ app_lib_hardware_activate_peripheral_f

typedef app_res_e(* app_lib_hardware_activate_peripheral_f) (app_lib_hardware_activable_peripheral_e peripheral)

Request for peripheral activation.

Parameters
peripheralHardware peripheral to activate
Returns
If peripheral is not recognized or not reservable, APP_RES_RESOURCE_UNAVAILABLE is returned. Otherwise, APP_RES_OK is returned.

Definition at line 68 of file wms_hardware.h.

◆ app_lib_hardware_deactivate_peripheral_f

typedef app_res_e(* app_lib_hardware_deactivate_peripheral_f) (app_lib_hardware_activable_peripheral_e peripheral)

Request for peripheral deactivation.

Parameters
peripheralHardware peripheral to deactivate
Returns
If peripheral is not recognized or not reservable, APP_RES_RESOURCE_UNAVAILABLE is returned. If peripheral was not previously activated, APP_RES_INVALID_CONFIGURATION. Otherwise, APP_RES_OK is returned.

Definition at line 81 of file wms_hardware.h.

◆ app_lib_hardware_is_peripheral_activated_f

typedef app_res_e(* app_lib_hardware_is_peripheral_activated_f) (app_lib_hardware_activable_peripheral_e peripheral, bool *activated_p, uint32_t timeout_us)

Request for peripheral status.

The given timeout_us is the maximum time to wait for peripheral activation. Each peripheral has a maximum timeout dependent on the platform.

Parameters
peripheralHardware peripheral to check status
activated_pPointer to store the status: true if activated, false otherwise
timeout_usMaximum time to wait for activation
Returns
If peripheral is not recognized or not reservable, APP_RES_RESOURCE_UNAVAILABLE is returned. If peripheral was not previously activated, APP_RES_INVALID_CONFIGURATION. If timeout_us is too long APP_RES_INVALID_VALUE is returned. Otherwise, APP_RES_OK is returned and activated_p is updated.
Note
Each peripheral has a maximum timeout dependent on the platform

Definition at line 104 of file wms_hardware.h.


Data Structure Documentation

◆ app_lib_hardware_t

struct app_lib_hardware_t

List of library functions.

Definition at line 112 of file wms_hardware.h.

Data Fields
app_lib_hardware_activate_peripheral_f activatePeripheral
app_lib_hardware_deactivate_peripheral_f deactivatePeripheral
app_lib_hardware_is_peripheral_activated_f isPeripheralActivated

Enumeration Type Documentation

◆ app_lib_hardware_activable_peripheral_e

Hardware peripherals to activate.

To be used with services lib_hw->activatePeripheral() and lib_hw->deactivatePeripheral().

Note
Not all platforms have all peripherals available.
Enumerator
APP_LIB_HARDWARE_PERIPHERAL_HFXO 

General high frequency external crystal

Definition at line 52 of file wms_hardware.h.

Macro Definition Documentation

◆ APP_LIB_HARDWARE_NAME

#define APP_LIB_HARDWARE_NAME   0x014eff15

Library symbolic name

"HWARE"

Definition at line 38 of file wms_hardware.h.

◆ APP_LIB_HARDWARE_VERSION

#define APP_LIB_HARDWARE_VERSION   0x203

Maximum supported library version.

Definition at line 41 of file wms_hardware.h.

app_lib_hardware_activable_peripheral_e
app_lib_hardware_activable_peripheral_e
Hardware peripherals to activate.
Definition: wms_hardware.h:52
APP_LIB_HARDWARE_PERIPHERAL_HFXO
@ APP_LIB_HARDWARE_PERIPHERAL_HFXO
Definition: wms_hardware.h:55