From 90daf297bd67924e6577c142658663df270a8842 Mon Sep 17 00:00:00 2001 From: mlalondesvn Date: Sat, 9 Feb 2008 06:48:47 +0000 Subject: [PATCH] MODIF - More commenting and headers git-svn-id: svn+ssh://oldsvn/home/mlalondesvn/svn/cral@138 3ee9b42a-b53c-0410-a25e-f0b6218d5d5b --- HDQ/hdq.cpp | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++-- HDQ/hdq.h | 13 +++++++++- 2 files changed, 79 insertions(+), 3 deletions(-) diff --git a/HDQ/hdq.cpp b/HDQ/hdq.cpp index 1394589..c620f78 100644 --- a/HDQ/hdq.cpp +++ b/HDQ/hdq.cpp @@ -1,3 +1,68 @@ +/** + * Texas Instruments HDQ implementation for the Arduino API + * (cleft) Matthieu Lalonde 2008 (matth@mlalonde.net) + * Creative Commons BY-SA-NC + * + * http://trac.mlalonde.net/cral/browser/HDQ/ + * + * Revision 1 + * +**/ + +/* ***************** * + * HDQ Usage example * +** ***************** * + +#include "hdq.h" +HDQ HDQ(HDQ_DEFAULT_PIN); + +uint8_t r; + +for (uint8_t jj = 0; jj < 0x10; jj++) { + r = HDQ.read(jj); + + Serial.print("Register 0x"); + Serial.print(jj, HEX); + Serial.print(": "); + Serial.print(r, BIN); + Serial.print(" 0x"); + Serial.println(r, HEX); +} + +r = HDQ.read(0x1e); + +Serial.print("Register 0x1e: "); +Serial.print(r, BIN); +Serial.print(" 0x"); +Serial.println(r, HEX); + +r = HDQ.read(0x7e); + +Serial.print("Register 0x7e: "); +Serial.print(r, BIN); +Serial.print(" 0x"); +Serial.println(r, HEX); + +HDQ.write(0x05, B11011101); + +r = HDQ.read(0x05); + +Serial.print("Register 0x05: "); +Serial.print(r, BIN); +Serial.print(" 0x"); +Serial.println(r, HEX); + +HDQ.write(0x05, B00111001); + +r = HDQ.read(0x05); + +Serial.print("Register 0x05: "); +Serial.print(r, BIN); +Serial.print(" 0x"); +Serial.println(r, HEX); + +*/ + extern "C" { #include "WConstants.h" #include "pins_arduino.h" @@ -6,11 +71,11 @@ extern "C" { #include "avrmacros.h" #include "hdq.h" -#define _HDQ_readPin() (*inputReg & bitmask)>>pin /* Change me to inline!*/ +#define _HDQ_readPin() (*inputReg & bitmask)>>pin /* Change me to inline!*/ /** * Constructor - * @param pin: pin number to attach to + * @param pinArg: pin number to attach to **/ HDQ::HDQ(uint8_t pinArg) { diff --git a/HDQ/hdq.h b/HDQ/hdq.h index 2f759df..50a9e64 100644 --- a/HDQ/hdq.h +++ b/HDQ/hdq.h @@ -1,3 +1,14 @@ +/** + * Texas Instruments HDQ implementation for the Arduino API + * (cleft) Matthieu Lalonde 2008 (matth@mlalonde.net) + * Creative Commons BY-SA-NC + * + * http://trac.mlalonde.net/cral/browser/HDQ/ + * + * Revision 1 + * +**/ + #ifndef _HDQ_H_ #define _HDQ_H_ @@ -53,7 +64,7 @@ public: /** * Constructor - * @param pin: pin number to attach to + * @param pinArg: pin number to attach to **/ HDQ(uint8_t pinArg = HDQ_DEFAULT_PIN);