MODIF - More commenting and headers

git-svn-id: svn+ssh://oldsvn/home/mlalondesvn/svn/cral@138 3ee9b42a-b53c-0410-a25e-f0b6218d5d5b
master
mlalondesvn 17 years ago
parent 26f18000a2
commit 90daf297bd

@ -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" { extern "C" {
#include "WConstants.h" #include "WConstants.h"
#include "pins_arduino.h" #include "pins_arduino.h"
@ -6,11 +71,11 @@ extern "C" {
#include "avrmacros.h" #include "avrmacros.h"
#include "hdq.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 * Constructor
* @param pin: pin number to attach to * @param pinArg: pin number to attach to
**/ **/
HDQ::HDQ(uint8_t pinArg) HDQ::HDQ(uint8_t pinArg)
{ {

@ -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_ #ifndef _HDQ_H_
#define _HDQ_H_ #define _HDQ_H_
@ -53,7 +64,7 @@
public: public:
/** /**
* Constructor * Constructor
* @param pin: pin number to attach to * @param pinArg: pin number to attach to
**/ **/
HDQ(uint8_t pinArg = HDQ_DEFAULT_PIN); HDQ(uint8_t pinArg = HDQ_DEFAULT_PIN);

Loading…
Cancel
Save