STM mbed.org OSRAM team / Mbed 2 deprecated eye_r_eye-htpa32x32-v_1_7

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers heimann32x32.h Source File

heimann32x32.h

00001 #ifndef _I2C_HEIMANN32X32_
00002 #define _I2C_HEIMANN32X32_
00003 
00004 #define AdrPixCMin 0x00
00005 #define AdrPixCMax 0x04
00006 #define AdrGradScale 0x08
00007 #define AdrTableNumber 0x0B         //changed to 0x0B with Rev 0.14 and adpated TN readout
00008 #define AdrEpsilon 0x0D
00009 
00010 #define AdrMBITPixC 0x1A
00011 #define AdrBIASPixC 0x1B
00012 #define AdrCLKPixC 0x1C
00013 #define AdrBPAPixC 0x1D
00014 #define AdrPUPixC 0x1E
00015 
00016 #define AdrVddMeasTh1 0x26
00017 #define AdrVddTh1 0x46
00018 
00019 #define AdrPTATGrad 0x34
00020 
00021 #define AdrVddScaling 0x4E
00022 #define AdrVddScalingOff 0x4F
00023 
00024 #define AdrMBITUser 0x60
00025 #define AdrBIASUser 0x61
00026 #define AdrCLKUser 0x62
00027 #define AdrBPAUser 0x63
00028 #define AdrPUUser 0x64
00029 
00030 #define AdrDevID 0x74
00031 
00032 #define AdrGlobalOffset 0x54
00033 #define AdrGlobalGain 0x55
00034 
00035 #define AdrVddCompValues2 0x340
00036 #define AdrVddCompValues 0x540
00037 #define AdrTh1 0x740
00038 #define AdrTh2 0xF40
00039 #define AdrPixC 0x1740
00040 
00041 #define BIAScurrentDefault 0x05
00042 #define CLKTRIMDefault 0x15 //0x20 to let it run with 10 Hz
00043 #define BPATRIMDefault 0x0C
00044 //#define MBITTRIMDefault 0x0C
00045 #define PUTRIMDefault   0x88
00046 
00047 
00048 //pixelcount etc. for 32x32d
00049 #define Pixel 1024              //=32x32
00050 #define PixelEighth 128
00051 #define LINE 32
00052 #define COLUMN 32
00053 #define DATALength 1292//1098                   //length of first packet
00054 #define DATALength2 1288//1096                  //lenght of second/last packet
00055 #define DataLengthHalf 646
00056 #define PTATamount 8
00057 #define ELOFFSET 1024           //start address of el. Offset
00058 #define ELAMOUNT 256
00059 #define ELAMOUNTHALF 128
00060 #define StackSize 16            //must be choosen by the user!
00061 #define PTATSTARTADSRESS 1282
00062 #define VDDADDRESS 1280
00063 
00064 #define GetElEveryFrameX 10     //amount of normal frames to capture after which the el. Offset is fetched
00065 #define STACKSIZEPTAT 30        //should be an even number
00066 #define STACKSIZEVDD 50         //should be an even number
00067 #define VddStackAmount 30
00068 
00069 
00070 #define ReadToFromTable
00071 #ifdef ReadToFromTable
00072     #define HTPA32x32dL2_1HiSiF5_0
00073     //#define HTPA32x32dL2_1HiSiF5_0
00074     //#define HTPA32x32dL2_1HiSiF5_0_withSiFilter
00075     //#define HTPA32x32dL3_6HiSi
00076     //#define HTPA32x32dL3_6HiSi_Rev1
00077     //#define HTPA32x32dL7_0HiSi
00078     //#define HTPA32x32dL5_0HiGeF7_7
00079     //#define HTPA32x32dL1_6HiGe
00080     //#define HTPA32x32dR1L1_6HiGe_Gain3k3
00081     //#define HTPA32x32dR1L2_1SiF5_0_N2
00082     //#define HTPA32x32dL2_1HiSiF5_0_Gain3k3            //is used for SensorRev. 1      
00083     //#define HTPA32x32dR1L2_1HiSiF5_0_Precise  
00084     //#define HTPA32x32dR1L2_85Hi_Gain3k3       
00085     //#define HTPA32x32dR1L3_6HiSi_Rev1_Gain3k3
00086     //#define HTPA32x32dR1L5_0HiGeF7_7_Gain3k3      
00087     //#define HTPA32x32dR1L7_0HiSi_Gain3k3
00088 
00089     #ifdef HTPA32x32dL5_0HiGe
00090         #define TABLENUMBER     79
00091         #define PCSCALEVAL      100000000 //327000000000        //PixelConst scale value for table... lower 'L' for (long)
00092         #define NROFTAELEMENTS  7
00093         #define NROFADELEMENTS  471 //130 possible due to Program memory, higher values possible if NROFTAELEMENTS is decreased
00094         #define TAEQUIDISTANCE  100     //dK
00095         #define ADEQUIDISTANCE  64      //dig
00096         #define ADEXPBITS       6       //2^ADEXPBITS=ADEQUIDISTANCE
00097         #define TABLEOFFSET     512
00098         #define EQUIADTABLE     //if defined, ADELEMENTS have to be 2^N quantizied! else more CPU Power is needed
00099         #ifdef EQUIADTABLE
00100             #undef FLOATTABLE
00101         #endif   
00102     #endif
00103 
00104     #ifdef HTPA32x32dL5_0HiGeF7_7
00105         #define TABLENUMBER     92
00106         #define PCSCALEVAL      100000000 //327000000000        //PixelConst scale value for table... lower 'L' for (long)
00107         #define NROFTAELEMENTS  7
00108         #define NROFADELEMENTS  471 //130 possible due to Program memory, higher values possible if NROFTAELEMENTS is decreased
00109         #define TAEQUIDISTANCE  100     //dK
00110         #define ADEQUIDISTANCE  64      //dig
00111         #define ADEXPBITS       6       //2^ADEXPBITS=ADEQUIDISTANCE
00112         #define TABLEOFFSET     256
00113         #define EQUIADTABLE     //if defined, ADELEMENTS have to be 2^N quantizied! else more CPU Power is needed
00114         #ifdef EQUIADTABLE
00115             #undef FLOATTABLE
00116         #endif   
00117     #endif
00118     
00119     #ifdef HTPA32x32dR1L5_0HiGeF7_7_Gain3k3
00120         #define TABLENUMBER     113
00121         #define PCSCALEVAL      100000000 //327000000000        //PixelConst scale value for table... lower 'L' for (long)
00122         #define NROFTAELEMENTS  7
00123         #define NROFADELEMENTS  1595    //130 possible due to Program memory, higher values possible if NROFTAELEMENTS is decreased
00124         #define TAEQUIDISTANCE  100     //dK
00125         #define ADEQUIDISTANCE  64      //dig
00126         #define ADEXPBITS       6       //2^ADEXPBITS=ADEQUIDISTANCE
00127         #define TABLEOFFSET     1024
00128         #define EQUIADTABLE     //if defined, ADELEMENTS have to be 2^N quantizied! else more CPU Power is needed
00129         #ifdef EQUIADTABLE
00130             #undef FLOATTABLE
00131         #endif   
00132         #define MBITTRIMDefault 0x2C
00133         #define SensRv 1
00134     #endif  
00135 
00136     #ifdef HTPA32x32dL1_6HiGe
00137         #define TABLENUMBER     101 
00138         #define PCSCALEVAL      100000000       //PixelConst scale value for table... lower 'L' for (long)
00139         #define NROFTAELEMENTS  7
00140         #define NROFADELEMENTS  471     //possible due to Program memory, higher values possible if NROFTAELEMENTS is decreased
00141         #define TAEQUIDISTANCE  100     //dK
00142         #define ADEQUIDISTANCE  64      //dig
00143         #define ADEXPBITS       6       //2^ADEXPBITS=ADEQUIDISTANCE
00144         #define TABLEOFFSET     256
00145         #define EQUIADTABLE     //if defined, ADELEMENTS have to be 2^N quantizied! else more CPU Power is needed
00146         #ifdef EQUIADTABLE
00147             #undef FLOATTABLE
00148         #endif   
00149     #endif
00150     
00151     #ifdef HTPA32x32dR1L1_6HiGe_Gain3k3
00152         #define TABLENUMBER     119
00153         #define PCSCALEVAL      100000000 //327000000000        //PixelConst scale value for table... lower 'L' for (long)
00154         #define NROFTAELEMENTS  7
00155         #define NROFADELEMENTS  1595    //130 possible due to Program memory, higher values possible if NROFTAELEMENTS is decreased
00156         #define TAEQUIDISTANCE  100     //dK
00157         #define ADEQUIDISTANCE  64      //dig
00158         #define ADEXPBITS       6       //2^ADEXPBITS=ADEQUIDISTANCE
00159         #define TABLEOFFSET     1024
00160         #define EQUIADTABLE     //if defined, ADELEMENTS have to be 2^N quantizied! else more CPU Power is needed
00161         #ifdef EQUIADTABLE
00162             #undef FLOATTABLE
00163         #endif   
00164         #define MBITTRIMDefault 0x2C
00165         #define SensRv 1
00166     #endif  
00167 
00168     #ifdef HTPA32x32dL2_1HiSi
00169         #define TABLENUMBER     80
00170         #define PCSCALEVAL      100000000       //PixelConst scale value for table... lower 'L' for (long)
00171         #define NROFTAELEMENTS  7
00172         #define NROFADELEMENTS  471 //130 possible due to Program memory, higher values possible if NROFTAELEMENTS is decreased
00173         #define TAEQUIDISTANCE  100     //dK
00174         #define ADEQUIDISTANCE  64      //dig
00175         #define ADEXPBITS       6       //2^ADEXPBITS=ADEQUIDISTANCE
00176         #define TABLEOFFSET     256
00177         #define EQUIADTABLE     //if defined, ADELEMENTS have to be 2^N quantizied! else more CPU Power is needed
00178         #ifdef EQUIADTABLE
00179             #undef FLOATTABLE
00180         #endif
00181     #endif
00182 
00183     #ifdef HTPA32x32dL2_1HiSiF5_0
00184         #define TABLENUMBER     96
00185         #define PCSCALEVAL      100000000       //PixelConst scale value for table... lower 'L' for (long)
00186         #define NROFTAELEMENTS  7
00187         #define NROFADELEMENTS  471 //130 possible due to Program memory, higher values possible if NROFTAELEMENTS is decreased
00188         #define TAEQUIDISTANCE  100     //dK
00189         #define ADEQUIDISTANCE  64      //dig
00190         #define ADEXPBITS       6       //2^ADEXPBITS=ADEQUIDISTANCE
00191         #define TABLEOFFSET     256
00192         #define EQUIADTABLE     //if defined, ADELEMENTS have to be 2^N quantizied! else more CPU Power is needed
00193         #ifdef EQUIADTABLE
00194             #undef FLOATTABLE
00195         #endif
00196     #endif
00197     
00198     #ifdef HTPA32x32dR1L2_1SiF5_0_N2
00199         #define TABLENUMBER     130
00200         #define PCSCALEVAL      100000000 //327000000000        //PixelConst scale value for table... lower 'L' for (long)
00201         #define NROFTAELEMENTS  7
00202         #define NROFADELEMENTS  1595    //130 possible due to Program memory, higher values possible if NROFTAELEMENTS is decreased
00203         #define TAEQUIDISTANCE  100     //dK
00204         #define ADEQUIDISTANCE  64      //dig
00205         #define ADEXPBITS       6       //2^ADEXPBITS=ADEQUIDISTANCE
00206         #define TABLEOFFSET     192
00207         #define EQUIADTABLE     //if defined, ADELEMENTS have to be 2^N quantizied! else more CPU Power is needed
00208         #ifdef EQUIADTABLE
00209             #undef FLOATTABLE
00210         #endif   
00211         #define MBITTRIMDefault 0x2C
00212         #define SensRv 1
00213     #endif  
00214     
00215     #ifdef HTPA32x32dL2_1HiSiF5_0_Gain3k3
00216         #define TABLENUMBER     114
00217         #define PCSCALEVAL      100000000 //327000000000        //PixelConst scale value for table... lower 'L' for (long)
00218         #define NROFTAELEMENTS  7
00219         #define NROFADELEMENTS  1595    //130 possible due to Program memory, higher values possible if NROFTAELEMENTS is decreased
00220         #define TAEQUIDISTANCE  100     //dK
00221         #define ADEQUIDISTANCE  64      //dig
00222         #define ADEXPBITS       6       //2^ADEXPBITS=ADEQUIDISTANCE
00223         #define TABLEOFFSET     1024
00224         #define EQUIADTABLE     //if defined, ADELEMENTS have to be 2^N quantizied! else more CPU Power is needed
00225         #ifdef EQUIADTABLE
00226             #undef FLOATTABLE
00227         #endif   
00228         #define MBITTRIMDefault 0x2C    //use REF_CAL=2 here. Table does not match, so GlobalGain ist set to 50 % to compensate this.
00229         #define SensRv 1                //Sensor Revision is set to 1 (Redesign)
00230     #endif  
00231     
00232     #ifdef HTPA32x32dR1L2_1HiSiF5_0_Precise
00233         #define TABLENUMBER     116
00234         #define PCSCALEVAL      100000000 //327000000000        //PixelConst scale value for table... lower 'L' for (long)
00235         #define NROFTAELEMENTS  22
00236         #define NROFADELEMENTS  1000    //130 possible due to Program memory, higher values possible if NROFTAELEMENTS is decreased
00237         #define TAEQUIDISTANCE  50      //dK
00238         #define ADEQUIDISTANCE  32      //dig
00239         #define ADEXPBITS       5       //2^ADEXPBITS=ADEQUIDISTANCE
00240         #define TABLEOFFSET     1024
00241         #define EQUIADTABLE     //if defined, ADELEMENTS have to be 2^N quantizied! else more CPU Power is needed
00242         #ifdef EQUIADTABLE
00243             #undef FLOATTABLE
00244         #endif   
00245         #define MBITTRIMDefault 0x2C
00246         #define SensRv 1
00247     #endif  
00248 
00249     #ifdef HTPA32x32dL2_1HiSiF5_0_withSiFilter
00250         #define TABLENUMBER     97
00251         #define PCSCALEVAL      100000000       //PixelConst scale value for table... lower 'L' for (long)
00252         #define NROFTAELEMENTS  7
00253         #define NROFADELEMENTS  471 //130 possible due to Program memory, higher values possible if NROFTAELEMENTS is decreased
00254         #define TAEQUIDISTANCE  100     //dK
00255         #define ADEQUIDISTANCE  64      //dig
00256         #define ADEXPBITS       6       //2^ADEXPBITS=ADEQUIDISTANCE
00257         #define TABLEOFFSET     256
00258         #define EQUIADTABLE     //if defined, ADELEMENTS have to be 2^N quantizied! else more CPU Power is needed
00259         #ifdef EQUIADTABLE
00260             #undef FLOATTABLE
00261         #endif
00262     #endif
00263     
00264     #ifdef HTPA32x32dR1L2_85Hi_Gain3k3
00265         #define TABLENUMBER     127
00266         #define PCSCALEVAL      100000000 //327000000000        //PixelConst scale value for table... lower 'L' for (long)
00267         #define NROFTAELEMENTS  7
00268         #define NROFADELEMENTS  1595    //130 possible due to Program memory, higher values possible if NROFTAELEMENTS is decreased
00269         #define TAEQUIDISTANCE  100     //dK
00270         #define ADEQUIDISTANCE  64      //dig
00271         #define ADEXPBITS       6       //2^ADEXPBITS=ADEQUIDISTANCE
00272         #define TABLEOFFSET     1024
00273         #define EQUIADTABLE     //if defined, ADELEMENTS have to be 2^N quantizied! else more CPU Power is needed
00274         #ifdef EQUIADTABLE
00275             #undef FLOATTABLE
00276         #endif   
00277         #define MBITTRIMDefault 0x2C
00278         #define SensRv 1
00279     #endif  
00280 
00281     #ifdef HTPA32x32dL3_6HiSi
00282         #define TABLENUMBER     81
00283         #define PCSCALEVAL      100000000       //PixelConst scale value for table... lower 'L' for (long)
00284         #define NROFTAELEMENTS  7
00285         #define NROFADELEMENTS  471 //130 possible due to Program memory, higher values possible if NROFTAELEMENTS is decreased
00286         #define TAEQUIDISTANCE  100     //dK
00287         #define ADEQUIDISTANCE  64      //dig
00288         #define ADEXPBITS       6       //2^ADEXPBITS=ADEQUIDISTANCE
00289         #define TABLEOFFSET     256
00290         #define EQUIADTABLE     //if defined, ADELEMENTS have to be 2^N quantizied! else more CPU Power is needed
00291         #ifdef EQUIADTABLE
00292             #undef FLOATTABLE
00293         #endif
00294     #endif
00295 
00296     #ifdef HTPA32x32dL3_6HiSi_Rev1
00297         #define TABLENUMBER     106
00298         #define PCSCALEVAL      100000000       //PixelConst scale value for table... lower 'L' for (long)
00299         #define NROFTAELEMENTS  7
00300         #define NROFADELEMENTS  471 //130 possible due to Program memory, higher values possible if NROFTAELEMENTS is decreased
00301         #define TAEQUIDISTANCE  100     //dK
00302         #define ADEQUIDISTANCE  64      //dig
00303         #define ADEXPBITS       6       //2^ADEXPBITS=ADEQUIDISTANCE
00304         #define TABLEOFFSET     256
00305         #define EQUIADTABLE     //if defined, ADELEMENTS have to be 2^N quantizied! else more CPU Power is needed
00306         #ifdef EQUIADTABLE
00307             #undef FLOATTABLE
00308         #endif
00309     #endif
00310     
00311     #ifdef HTPA32x32dR1L3_6HiSi_Rev1_Gain3k3
00312         #define TABLENUMBER     117
00313         #define PCSCALEVAL      100000000       //PixelConst scale value for table... lower 'L' for (long)
00314         #define NROFTAELEMENTS  7
00315         #define NROFADELEMENTS  1595    //130 possible due to Program memory, higher values possible if NROFTAELEMENTS is decreased
00316         #define TAEQUIDISTANCE  100     //dK
00317         #define ADEQUIDISTANCE  64      //dig
00318         #define ADEXPBITS       6       //2^ADEXPBITS=ADEQUIDISTANCE
00319         #define TABLEOFFSET     1024
00320         #define EQUIADTABLE     //if defined, ADELEMENTS have to be 2^N quantizied! else more CPU Power is needed
00321         #ifdef EQUIADTABLE
00322             #undef FLOATTABLE
00323         #endif
00324         #define MBITTRIMDefault 0x2C
00325         #define SensRv 1
00326     #endif  
00327 
00328     #ifdef HTPA32x32dL7_0HiSi
00329         #define TABLENUMBER     107
00330         #define PCSCALEVAL      100000000       //PixelConst scale value for table... lower 'L' for (long)
00331         #define NROFTAELEMENTS  7
00332         #define NROFADELEMENTS  471 //130 possible due to Program memory, higher values possible if NROFTAELEMENTS is decreased
00333         #define TAEQUIDISTANCE  100     //dK
00334         #define ADEQUIDISTANCE  64      //dig
00335         #define ADEXPBITS       6       //2^ADEXPBITS=ADEQUIDISTANCE
00336         #define TABLEOFFSET     256
00337         #define EQUIADTABLE     //if defined, ADELEMENTS have to be 2^N quantizied! else more CPU Power is needed
00338         #ifdef EQUIADTABLE
00339             #undef FLOATTABLE
00340         #endif
00341     #endif
00342     
00343     #ifdef HTPA32x32dR1L7_0HiSi_Gain3k3
00344         #define TABLENUMBER     118
00345         #define PCSCALEVAL      100000000       //PixelConst scale value for table... lower 'L' for (long)
00346         #define NROFTAELEMENTS  7
00347         #define NROFADELEMENTS  1595    //130 possible due to Program memory, higher values possible if NROFTAELEMENTS is decreased
00348         #define TAEQUIDISTANCE  100     //dK
00349         #define ADEQUIDISTANCE  64      //dig
00350         #define ADEXPBITS       6       //2^ADEXPBITS=ADEQUIDISTANCE
00351         #define TABLEOFFSET     640
00352         #define EQUIADTABLE     //if defined, ADELEMENTS have to be 2^N quantizied! else more CPU Power is needed
00353         #ifdef EQUIADTABLE
00354             #undef FLOATTABLE
00355         #endif
00356         #define MBITTRIMDefault 0x2C
00357         #define SensRv 1
00358     #endif  
00359 
00360     #ifdef HTPA32x32dL2_1HiSiDLC
00361         #define TABLENUMBER     83
00362         #define PCSCALEVAL      100000000       //PixelConst scale value for table
00363         #define NROFTAELEMENTS  7
00364         #define NROFADELEMENTS  471
00365         #define TAEQUIDISTANCE  100     //dK
00366         #define ADEQUIDISTANCE  64      //dig
00367         #define ADEXPBITS       6       //2^ADEXPBITS=ADEQUIDISTANCE
00368         #define TABLEOFFSET     512
00369         #define EQUIADTABLE     //if defined, ADELEMENTS have to be 2^N quantizied! else more CPU Power is needed
00370         #ifdef EQUIADTABLE 
00371             #undef FLOATTABLE
00372         #endif
00373     #endif
00374 
00375     #ifdef HTPA32x32dL2_1Si_withSiFilter
00376         #define TABLENUMBER     88
00377         #define PCSCALEVAL      100000000       //PixelConst scale value for table
00378         #define NROFTAELEMENTS  7
00379         #define NROFADELEMENTS  471
00380         #define TAEQUIDISTANCE  100     //dK
00381         #define ADEQUIDISTANCE  8       //dig
00382         #define ADEXPBITS       3       //2^ADEXPBITS=ADEQUIDISTANCE
00383         #define TABLEOFFSET     64
00384         #define EQUIADTABLE     //if defined, ADELEMENTS have to be 2^N quantizied! else more CPU Power is needed
00385         #ifdef EQUIADTABLE 
00386             #undef FLOATTABLE
00387         #endif
00388     #endif
00389 
00390    #ifdef HTPA32x32dL5_0HiGeMult
00391         #define TABLENUMBER0        79
00392         #define PCSCALEVAL      100000000 //327000000000        //PixelConst scale value for table... lower 'L' for (long)
00393         #define NROFTAELEMENTS  7
00394         #define NROFADELEMENTS  251 //130 possible due to Program memory, higher values possible if NROFTAELEMENTS is decreased
00395         #define TAEQUIDISTANCE  100     //dK
00396         #define ADEQUIDISTANCE  128     //dig
00397         #define ADEXPBITS       7       //2^ADEXPBITS=ADEQUIDISTANCE
00398         #define TABLEOFFSET     256
00399         #define EQUIADTABLE     //if defined, ADELEMENTS have to be 2^N quantizied! else more CPU Power is needed
00400         #ifdef EQUIADTABLE
00401             #undef FLOATTABLE
00402         #endif   
00403     #endif
00404 #endif
00405  
00406 //
00407 // I2C stuff
00408 //
00409 #define HTP_ADDRESS        (0x34)
00410 #define HTP_EEPROM_ADDRESS (0xa0)
00411 
00412 //
00413 // REGISTERS: EEPROM
00414 //
00415 #define HTP_EEPROM_CALIB_HI       0x00
00416 #define HTP_EEPROM_CALIB_LO       0x1A
00417 
00418 #define HTP_EEPROM_PTAT_HI        0x00
00419 #define HTP_EEPROM_PTAT_GRAD_LO   0x34
00420 #define HTP_EEPROM_PTAT_OFFS_LO   0x38
00421 
00422 #define HTP_EEPROM_TN_EPS_HI      0x00
00423 #define HTP_EEPROM_TN_LO          0x0C
00424 #define HTP_EEPROM_EPS_LO         0x0D
00425 
00426 #define HTP_EEPROM_GRADSCALE_HI   0x00
00427 #define HTP_EEPROM_GRADSCALE_LO   0x08
00428 
00429 #define HTP_EEPROM_PIXC_HI        0x00
00430 #define HTP_EEPROM_PIXCMIN_LO     0x00
00431 #define HTP_EEPROM_PIXCMAX_LO     0x04
00432 
00433 #define HTP_EEPROM_PIX_HI         0x17
00434 #define HTP_EEPROM_PIX_LO         0x40
00435 
00436 #define HTP_EEPROM_THGRAD_HI      0x07
00437 #define HTP_EEPROM_THGRAD_LO      0x40
00438 
00439 #define HTP_EEPROM_THOFFS_HI      0x0f
00440 #define HTP_EEPROM_THOFFS_LO      0x40
00441 
00442 //
00443 // REGISTERS: HTP
00444 //
00445 #define HTP_CONFIG      0x01
00446 #define HTP_STATUS      0x02
00447 #define HTP_TRIM1_ADC   0x03
00448 #define HTP_TRIM2_BIAS1 0x04
00449 #define HTP_TRIM3_BIAS2 0x05
00450 #define HTP_TRIM4_FREQ  0x06
00451 #define HTP_TRIM5_BPA1  0x07
00452 #define HTP_TRIM6_BPA2  0x08
00453 #define HTP_TRIM7_PU    0x09
00454 #define HTP_DATA1       0x0a
00455 #define HTP_DATA2       0x0b
00456 
00457 
00458 //
00459 // CONFIG REGISTER CONFIGURATION BITS
00460 //
00461 #define CONFIG_WAKEUP     0B00000001
00462 #define CONFIG_BLIND      0B00000010
00463 #define CONFIG_START      0B00001000
00464 #define CONFIG_BLOCK_LSB  0B00010000
00465 #define CONFIG_BLOCK_MSB  0B00100000
00466 
00467 
00468 //
00469 // STATUS REGISTER CONFIGURATION BITS
00470 //
00471 #define STATUS_EOC        0B00000001
00472 #define STATUS_BLOCK_LSB  0B00000100
00473 #define STATUS_BLOCK_MSB  0B00001000
00474 
00475 //
00476 // TRIM1/ADC REGISTER CONFIGURATION BITS
00477 //
00478 #define TRIM1_ADC_MASK    0B00001111
00479 
00480 //
00481 // TRIM2/BIAS1 REGISTER CONFIGURATION BITS
00482 // TRIM3/BIAS2 REGISTER CONFIGURATION BITS
00483 //
00484 #define TRIM_BIAS_MASK    0B00011111
00485 
00486 //
00487 // TRIM4/FREQ REGISTER CONFIGURATION BITS
00488 //
00489 #define TRIM_FREQ_MASK    0B00111111
00490 
00491 //
00492 // TRIM5/BPA1 REGISTER CONFIGURATION BITS
00493 // TRIM6/BPA2 REGISTER CONFIGURATION BITS
00494 //
00495 #define TRIM_BPA_MASK    0B00011111
00496 
00497 //
00498 // TRIM7/PU REGISTER CONFIGURATION BITS
00499 //
00500 #define PU_SDA_1K         0B00010000
00501 #define PU_SDA_10K        0B00100000
00502 #define PU_SDA_50K        0B01000000
00503 #define PU_SDA_100K       0b10000000
00504 #define PU_SCL_1K         0B00000001
00505 #define PU_SCL_10K        0B00000010
00506 #define PU_SCL_50K        0B00000100
00507 #define PU_SCL_100K       0B00001000
00508 
00509 #define HTPA_PROC_RAW       0x00
00510 #define HTPA_PROC_ELOFFS    0x01
00511 #define HTPA_PROC_THOFFS    0x02
00512 #define HTPA_PROC_CONVERT   0x04
00513 //
00514 // CLASS
00515 //
00516 class HTPA32x32
00517 {
00518     public:        
00519         HTPA32x32(I2C * _i2c, I2C * _i2ce, uint8_t a1 = HTP_ADDRESS, uint8_t a2 = HTP_EEPROM_ADDRESS);
00520         volatile uint8_t
00521             mbit, bias, clk, bpa, pu, epsilon, gradScale, tn, proc, available;
00522         volatile int
00523             i2c_addr_htpa, i2c_addr_eeprom;
00524         volatile float
00525             PixC[1024], PixCmin, PixCmax, PTATgrad, PTAToffs;
00526         volatile uint16_t
00527             Ta_dK, Ta_dK_prev, Ta_dK_prev_prev;       
00528         volatile int16_t            
00529             Data[1024], ThGrad[1024], ThOffs[1024], ElOffs[256];
00530         volatile uint16_t
00531              TempTable_TA[NROFADELEMENTS];
00532         uint8_t
00533             ADC ( void ), ADC(uint8_t);
00534         uint8_t
00535             PU ( void ), PU(uint8_t);
00536         uint8_t
00537             BIAS ( void ), BIAS (uint8_t);
00538         uint8_t
00539             CLOCK ( void ), CLOCK (uint8_t);
00540         uint8_t 
00541             BPA ( void ), BPA (uint8_t);
00542         uint8_t
00543             end (void);
00544         void
00545             init( void );     
00546         void
00547             readb();
00548         void 
00549             start();
00550         void 
00551             apply_offsets( void );
00552         uint16_t 
00553             find_dk_from_v ( int16_t v );
00554             
00555     private:
00556         I2C * i2c, *i2ce;
00557         uint8_t 
00558             b;
00559         void 
00560             read_eeprom(uint8_t HiReg, uint8_t LoReg, char *data_ptr, int DCnt);            
00561         void 
00562             download_PIJ( void );
00563         void 
00564             find_temptable_from_ta ( void );
00565 };
00566 
00567 
00568 
00569 #endif