![]() |
Wirepas SDK
|
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 hardware.h.
Go to the source code of this file.
Data Structures | |
| struct | app_lib_hardware_t |
| List of library functions. More... | |
Enumerations | |
| enum | app_lib_hardware_peripheral_e { APP_LIB_HARDWARE_PERIPHERAL_RESERVED = 3 } |
| Hardware peripherals to reserve. More... | |
| 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 0x202 |
| Maximum supported library version. More... | |
| typedef app_res_e(* app_lib_hardware_activate_peripheral_f) (app_lib_hardware_activable_peripheral_e peripheral) |
Request for peripheral activation.
| peripheral | Hardware peripheral to activate |
Definition at line 133 of file hardware.h.
| typedef app_res_e(* app_lib_hardware_deactivate_peripheral_f) (app_lib_hardware_activable_peripheral_e peripheral) |
Request for peripheral deactivation.
| peripheral | Hardware peripheral to deactivate |
Definition at line 146 of file hardware.h.
| 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.
| peripheral | Hardware peripheral to check status |
| activated_p | Pointer to store the status: true if activated, false otherwise |
| timeout_us | Maximum time to wait for activation |
timeout_us is too long APP_RES_INVALID_VALUE is returned. Otherwise, APP_RES_OK is returned and activated_p is updated. Definition at line 169 of file hardware.h.
| typedef uint16_t(* app_lib_hardware_read_supply_voltage_f) (void) |
Query voltage value.
Example: See inventory_app_tag example.
Definition at line 111 of file hardware.h.
| typedef int32_t(* app_lib_hardware_read_temperature_f) (void) |
Ask the last read chip temperature from the stack.
Definition at line 121 of file hardware.h.
| typedef app_res_e(* app_lib_hardware_release_peripheral_f) (app_lib_hardware_peripheral_e peripheral) |
Release a reserved hardware peripheral back for stack use.
| peripheral | Hardware peripheral to reserve |
Definition at line 99 of file hardware.h.
| typedef app_res_e(* app_lib_hardware_reserve_peripheral_f) (app_lib_hardware_peripheral_e peripheral) |
Reserve a hardware peripheral.
| peripheral | Hardware peripheral to reserve |
Definition at line 85 of file hardware.h.
| struct app_lib_hardware_t |
List of library functions.
Definition at line 177 of file 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 | |
| app_lib_hardware_read_supply_voltage_f | readSupplyVoltage | |
| app_lib_hardware_read_temperature_f | readTemperature | |
| app_lib_hardware_release_peripheral_f | releasePeripheral | |
| app_lib_hardware_reserve_peripheral_f | reservePeripheral | |
Hardware peripherals to activate.
To be used with services lib_hw->activatePeripheral() and lib_hw->deactivatePeripheral().
| Enumerator | |
|---|---|
| APP_LIB_HARDWARE_PERIPHERAL_HFXO | General high frequency external crystal |
Definition at line 67 of file hardware.h.
Hardware peripherals to reserve.
To be used with services lib_hw->reservePeripheral() and lib_hw->releasePeripheral().
| Enumerator | |
|---|---|
| APP_LIB_HARDWARE_PERIPHERAL_RESERVED | Reserved for future use |
Definition at line 52 of file hardware.h.
| #define APP_LIB_HARDWARE_NAME 0x014eff15 |
| #define APP_LIB_HARDWARE_VERSION 0x202 |
Maximum supported library version.
Definition at line 41 of file hardware.h.