From b97775263d8dff8b04b199eff2af86dac970a6f5 Mon Sep 17 00:00:00 2001 From: HomeSpan Date: Sun, 24 Apr 2022 11:55:38 -0500 Subject: [PATCH] Update Overview.md --- docs/Overview.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/docs/Overview.md b/docs/Overview.md index 763aed0..eb63eb6 100644 --- a/docs/Overview.md +++ b/docs/Overview.md @@ -42,6 +42,30 @@ void loop(){ } // end of loop() ``` +Note that as an *alternative*, you can intruct HomeSpan to create separate task that repeatedly calls `homeSpan.poll()` in the background. To do so, **replace** the call to `homeSpan.poll()` in the main `loop()` with a call to `homeSpan.autoPoll()` at the end of the `setup()` function: + +```C++ +#include "HomeSpan.h" // include the HomeSpan library + +void setup() { + + Serial.begin(115200); // start the Serial interface + + homeSpan.begin(); // initialize HomeSpan + + /// DEFINITION OF HAP ACCESSORY ATTRIBUTE DATABASE GOES HERE /// + + homeSpan.autoPoll(); // start a task that repeatedly calls `homeSpan.poll()` in the background + +} // end of setup() + +void loop(){ + +} // end of loop() +``` + +This is particularly efficient when using dual-core processors since HomeSpan will run the polling task on the "free" processor that is otherwise not performing any other Arduino functions. + ## Creating the HAP Accessory Attribute Database The next step is to implement the code that defines the HAP Accessory Attribute Database, which is not really a database but simply a list of all HAP accessory objects, Service objects, and Characteristic objects implemented by this HomeSpan device.