Changeset 138

Show
Ignore:
Timestamp:
02/08/08 22:48:47 (11 months ago)
Author:
mlalondesvn
Message:

MODIF - More commenting and headers

Location:
HDQ
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • HDQ/hdq.cpp

    r137 r138  
     1/** 
     2 * Texas Instruments HDQ implementation for the Arduino API 
     3 * (cleft) Matthieu Lalonde 2008 (matth@mlalonde.net) 
     4 * Creative Commons BY-SA-NC 
     5 *  
     6 * http://trac.mlalonde.net/cral/browser/HDQ/ 
     7 *  
     8 * Revision 1 
     9 * 
     10**/ 
     11 
     12/* ***************** * 
     13 * HDQ Usage example * 
     14** ***************** * 
     15 
     16#include "hdq.h" 
     17HDQ HDQ(HDQ_DEFAULT_PIN); 
     18 
     19uint8_t r; 
     20 
     21for (uint8_t jj = 0; jj < 0x10; jj++) { 
     22    r = HDQ.read(jj); 
     23 
     24    Serial.print("Register 0x"); 
     25    Serial.print(jj, HEX); 
     26    Serial.print(": "); 
     27    Serial.print(r, BIN); 
     28    Serial.print(" 0x"); 
     29    Serial.println(r, HEX); 
     30} 
     31 
     32r = HDQ.read(0x1e); 
     33 
     34Serial.print("Register 0x1e: "); 
     35Serial.print(r, BIN); 
     36Serial.print(" 0x"); 
     37Serial.println(r, HEX); 
     38 
     39r = HDQ.read(0x7e); 
     40 
     41Serial.print("Register 0x7e: "); 
     42Serial.print(r, BIN); 
     43Serial.print(" 0x"); 
     44Serial.println(r, HEX); 
     45 
     46HDQ.write(0x05, B11011101); 
     47 
     48r = HDQ.read(0x05); 
     49 
     50Serial.print("Register 0x05: "); 
     51Serial.print(r, BIN); 
     52Serial.print(" 0x"); 
     53Serial.println(r, HEX); 
     54 
     55HDQ.write(0x05, B00111001); 
     56 
     57r = HDQ.read(0x05); 
     58 
     59Serial.print("Register 0x05: "); 
     60Serial.print(r, BIN); 
     61Serial.print(" 0x"); 
     62Serial.println(r, HEX); 
     63 
     64*/ 
     65 
    166extern "C" { 
    267    #include "WConstants.h" 
     
    772#include "hdq.h" 
    873 
    9 #define _HDQ_readPin() (*inputReg & bitmask)>>pin /* Change me to inline!*/ 
     74#define _HDQ_readPin() (*inputReg & bitmask)>>pin   /* Change me to inline!*/ 
    1075 
    1176/** 
    1277 * Constructor 
    13  * @param pin: pin number to attach to 
     78 * @param pinArg: pin number to attach to 
    1479**/ 
    1580HDQ::HDQ(uint8_t pinArg) 
  • HDQ/hdq.h

    r136 r138  
     1/** 
     2 * Texas Instruments HDQ implementation for the Arduino API 
     3 * (cleft) Matthieu Lalonde 2008 (matth@mlalonde.net) 
     4 * Creative Commons BY-SA-NC 
     5 *  
     6 * http://trac.mlalonde.net/cral/browser/HDQ/ 
     7 *  
     8 * Revision 1 
     9 * 
     10**/ 
     11 
    112#ifndef _HDQ_H_ 
    213#define _HDQ_H_ 
     
    5465        /** 
    5566         * Constructor 
    56          * @param pin: pin number to attach to 
     67         * @param pinArg: pin number to attach to 
    5768        **/ 
    5869        HDQ(uint8_t pinArg = HDQ_DEFAULT_PIN);