OVMS3-idf/examples/bluetooth/esp_ble_mesh/components/button/README.md

47 lines
2.1 KiB
Markdown
Raw Normal View History

ble_mesh: Add ESP BLE Mesh implementation 1. BLE Mesh Core * Provisioning: Node Role * PB-ADV and PB-GATT * Authentication OOB * Provisioning: Provisioner Role * PB-ADV and PB-GATT * Authentication OOB * Networking * Relay * Segmentation and Reassembly * Key Refresh * IV Update * Proxy Support * Multiple Client Models Run Simultaneously * Support multiple client models send packets to different nodes simultaneously * No blocking between client model and server * NVS Storage * Store BLE Mesh node related information in flash * Store BLE Mesh Provisioner related information in flash 2. BLE Mesh Models * Foundation Models * Configuration Server Model * Configuration Client Model * Health Server Model * Health Client Model * Generic * Generic OnOff Server * Generic OnOff Client * Generic Level Server * Generic Level Client * Generic Default Transition Time Server * Generic Default Transition Time Client * Generic Power OnOff Server * Generic Power OnOff Setup Server * Generic Power OnOff Client * Generic Power Level Server * Generic Power Level Setup Server * Generic Power Level Client * Generic Battery Server * Generic Battery Client * Generic Location Server * Generic Location Setup Server * Generic Location Client * Generic Admin Property Server * Generic Manufacturer Property Server * Generic User Property Server * Generic Client Property Server * Generic Property Client * Sensor Server Model * Sensor Server * Sensor Setup Server * Sensor Client * Time and Scenes * Time Server * Time Setup Server * Time Client * Scene Server * Scene Setup Server * Scene Client * Scheduler Server * Scheduler Setup Server * Scheduler Client * Lighting * Light Lightness Server * Light Lightness Setup Server * Light Lightness Client * Light CTL Server * Light CTL Setup Server * Light CTL Client * Light CTL Temperature Server * Light HSL Server * Light HSL Setup Server * Light HSL Client * Light HSL Hue Server * Light HSL Saturation Server * Light xyL Server * Light xyL Setup Server * Light xyL Client * Light LC Server * Light LC Setup Server * Light LC Client 3. BLE Mesh Applications * BLE Mesh Node * OnOff Client Example * OnOff Server Example * BLE Mesh Provisioner * Example * Fast Provisioning * Vendor Fast Prov Server Model * Vendor Fast Prov Client Model * Examples * Wi-Fi & BLE Mesh Coexistence * Example * BLE Mesh Console Commands * Examples
2019-11-01 08:08:47 +00:00
# Component: Button
* This component defines a button as a well encapsulated object.
* A button device is defined by:
* GPIO number on which the button is attached.
* Active level which decided by peripheral hardware.
* Trigger mode which decides whether to call serial trigger callback during pressing
* Serial threshold seconds which decides that serial trigger callback will be called after how many seconds' pressing
* A button device can provide:
* One push event callback
* One release event callback
* One short-time tap event callback
* One serial trigger event callback
* Several long-time press event callback
We can set different jitter filters for all the events.
Once any of the long press callback is triggered, the short tap event will not be triggered.
This components are based on GPIO provided by idf and soft timer provided by FreeRTOS.
* To use the button device, you need to :
* create a button object returned by iot_button_create().
* Then hook different event callbacks to the button object.
* To free the object, you can call iot_button_delete to delete the button object and free the memory that used.
* Todo:
* Add hardware timer mode(because sometimes soft-timer callback function is limited)
### NOTE:
> All the event callback function are realized by FreeRTOS soft timer APIs, the callback must follow the rule:
```
Button callback functions execute in the context of the timer service task.
It is therefore essential that button callback functions never attempt to block.
For example, a button callback function must not call vTaskDelay(), vTaskDelayUntil(), or specify a non zero block time when accessing a queue or a semaphore.
```
> In addition:
> You can adjust the following macros within FreeRTOS to adjust the stack depth/queue length/task priority of the timer service.
```
#define configUSE_TIMERS //enable soft-timer
#define configTIMER_TASK_PRIORITY // priority of the timers service task
#define configQueue_LENGTH // length of timer command queue
#define configTIMER_TASK_STACK_DEPTH // stack depth of the soft-timer
```