diff --git a/README.md b/README.md index b884528..0aa95d6 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ The sensor abstraction layer is also useful for data-logging and data-transmissi ## How Does it Work? ## -There are two main typedefs and one enum defined in Adafruit_Sensor.h that must be used by any sensor driver that you want to be compliant with the abstraction layer: +Any driver the supports the Adafruit Sensor Abstraction Layer will implement the Adafruit\_Sensor base class. There are two main typedefs and one enum defined in Adafruit_Sensor.h that are used to 'abstract' away the sensor details and values: **Sensor Types (sensors\_type\_t)** @@ -111,6 +111,20 @@ It includes the following fields: - **timestamp**: time in milliseconds when the sensor value was read - **data[4]**: An array of four 32-bit values that allows us to encapsulate any type of sensor data via a simple union (further described below) +**Required Functions** + +In addition to the two standard types and the sensor type enum, all drivers based on Adafruit_Sensor must also implement the following two functions: + +``` +void getEvent(sensors\_event\_t*); +``` +Calling this function will populated the supplied sensors\_event\_t reference with the latest available sensor data. You should call this function as often as you want to update your data. + +``` +void getSensor(sensor_t*); +``` +Calling this function will provide some basic information about the sensor (the sensor name, driver version, min and max values, etc. + **Standardised SI values for sensors\_event\_t** A key part of the abstraction layer is the standardisation of values on SI units of a particular scale, which is accomplished via the data[4] union in sensors\_event\_t above. This 16 byte union includes fields for each main sensor type, and uses the following SI units and scales: @@ -174,4 +188,4 @@ Serial.print ("Min Value: "); Serial.print(sensor.min\_value); Serial.printl Serial.print ("Resolution: "); Serial.print(sensor.resolution); Serial.println(" lux"); Serial.println("------------------------------------"); Serial.println(""); -``` \ No newline at end of file +```