Library to read and write Azoteq IQS6xx device registers via I2C.
Dependents: IQS620_HelloWorld IQS622_HelloWorld IQS624_HelloWorld IQS621_HelloWorld ... more
Library: IQS62x
Library to read and write Azoteq IQS6xx device registers via I2C.
Supported Devices
Handy Table of ProxFusion Device Features
ALS = Ambient Light Sensor PIR = Passive Infrared
Diff: IQS62x.cpp
- Revision:
- 20:7eb08a52b954
- Parent:
- 19:f0675a3150c7
diff -r f0675a3150c7 -r 7eb08a52b954 IQS62x.cpp
--- a/IQS62x.cpp Thu May 18 15:23:40 2017 +0000
+++ b/IQS62x.cpp Wed Mar 21 05:56:22 2018 +0000
@@ -7,6 +7,7 @@
// ProxFusion 5-minute YouTube video: http://bit.ly/proxfusion-video
#include "IQS62x.h"
+DigitalOut toggle(PB_3);
// constructor
IQS62xIO::IQS62xIO() :
@@ -19,9 +20,9 @@
i2c.frequency( I2Cspeed ); // I2C clock frequency
// this uses memory but is very handy in diagnostics
- memset(writeFlag, 0, I2CBufferSize); // a table to remmber if we wrote to a register
+ memset(writeFlag, 0, I2CBufferSize); // a table to remember if we wrote to a register
memset(lastWrite, 0, I2CBufferSize); // a table to remember what we wrote to a register
- memset(lastRead, 0, I2CBufferSize); // a table to remmber what we read the previous read cycle
+ memset(lastRead, 0, I2CBufferSize); // a table to remember what we read the previous read cycle
memset(readChanges, 0, I2CBufferSize); // a table to mark up any registers that changed since the previous read
memset(readChangesEver, 0, I2CBufferSize); // a table to mark up any registers that changed BUT never forget
memset(writeChanges, 0, I2CBufferSize); // a table to mark up any registers that differ from what was written to it
@@ -30,6 +31,7 @@
// write a single byte to an IQS62x register
void IQS62xIO::writeRegister(int address, int data)
{
+ toggle = !toggle;
writeFlag[ address & 0xff ] = 1; // remember which registers we changed
lastWrite[ address & 0xff ] = data & 0xff; // remember what we wrote
char twoBytes [2];
@@ -69,13 +71,13 @@
if(0!=i2c.read(I2C_ADR,I2CBuffer,numberOfBytes,false))
I2CErrorCount++;
-#define PLEASE_CHECK_FOR_IQS_CHANGES 1
+#define DONT_CHECK_FOR_IQS_CHANGES 1
#ifndef DONT_CHECK_FOR_IQS_CHANGES
// this is optional but handy diagnostics
// we build six tables:
- //writeFlag - a table to remmber if we wrote to a register
+ //writeFlag - a table to remember if we wrote to a register
//lastWrite - a table to remember what we wrote to a register
- //lastRead - a table to remmber what we read the previous read cycle
+ //lastRead - a table to remember what we read the previous read cycle
//readChanges - a table to mark up any registers that changed since the previous read
//readChangesEver - a table to mark up any registers that changed BUT never forget
//writeChanges - a table to mark up any registers that differ from what was written to it
IQS624
IQS620A
IQS620A-EVAL-1
IQS621
IQS621-EVAL-1
IQS622
IQS622-EVAL-1
IQS624-EVAL-1