Commit 4ebab470 authored by Maxime Robin's avatar Maxime Robin

Suppression registre, compile

parent 53ba2148
/* Ici sont définis les paramètres et adresses du registre
des paramètres d'acquisition du testeur
On définira une adresse et une place prise en commentaire à coté
*/
#include "Registre.h"
const int selectResolution[4] = {12,14,16,18};
const int selectGain[4] = {1,2,4,8};
const uint8_t mask1 = 0b11000000;
const uint8_t mask2 = 0b00110000;
const uint8_t mask3 = 0b00001100;
const uint8_t mask4 = 0b00000011;
void Registre::getParameterI(int i, int* resolution, int* gain, float* coeff)
{
//i--; //entree 1 = indice 0, entree 2 = indice 1, etc...
uint8_t byteRead;
unsigned short int coeffBrut=0;
int indice;
switch(i) { // Récuperation des gains et résolutions
case 1:
byteRead = i2c_eeprom.read(ADDR_resolutions);
indice = (int)((byteRead & mask1)>>6);
*resolution=selectResolution [indice];
byteRead = i2c_eeprom.read(ADDR_gains);
indice = (int)((byteRead & mask1)>>6);
*gain=selectGain [indice]; break;
case 2:
byteRead = i2c_eeprom.read(ADDR_resolutions);
indice = (int)((byteRead & mask2)>>4);
*resolution=selectResolution [indice];
byteRead = i2c_eeprom.read(ADDR_gains);
indice = (int)((byteRead & mask2)>>4);
*gain=selectGain [indice]; break;
case 3:
byteRead = i2c_eeprom.read(ADDR_resolutions);
indice = (int)((byteRead & mask3)>>2);
*resolution=selectResolution [indice];
byteRead = i2c_eeprom.read(ADDR_gains);
indice = (int)((byteRead & mask3)>>2);
*gain=selectGain [indice]; break;
case 4:
byteRead = i2c_eeprom.read(ADDR_resolutions);
indice = (int)(byteRead & mask4);
*resolution=selectResolution [indice];
byteRead = i2c_eeprom.read(ADDR_gains);
indice = (int)(byteRead & mask4);
*gain=selectGain [indice]; break;
}
//récupération coefficients
//coeffBrut=i2c_eeprom
}
\ No newline at end of file
/* Ici sont définis les paramètres et adresses du registre
des paramètres d'acquisition du testeur
On définira une adresse et une place prise en commentaire à coté
*/
// Définition des adresses des flags pour l'utilisation des bornes
// 1 bit par flag -> 10 bits nécessaires
#define FLAGS_1 0x01
// bits du poids fort au faible
// PT1OO 1 et 2 ; entreeDiff 1 à 4 ; Anémomètre ; Girouette
#define FLAGS_2_FREQS 0x02
// bits du poids fort au faible
// Thermocouple; SHT75; freq acquisition (2bits); freq stockage (2bits)
// Selection des gains des entree diff 1 à 4 (poids fort à poids faible)
#define ADDR_gains 0x03
//Seleciton des resolutions des entree diff 1 à 4 (poids fort à poids faible)
#define ADDR_resolutions 0x04
// Définition des adresses des coeff des entrées différentielles
// 2 octets par coeff
#define ADDR_coeffs_1 0x05
#define ADDR_coeffs_2 0x07
#define ADDR_coeffs_3 0x09
#define ADDR_coeffs_4 0x0b
// Adresse des etiquettes pour chaque bornes
// 4 octets par étiquette
#define ADDR_ETIQ_PT100_1 0x0d
#define ADDR_ETIQ_PT100_2 0x11
#define ADDR_ETIQ_ED_1 0x15
#define ADDR_ETIQ_ED_2 0x19
#define ADDR_ETIQ_ED_3 0x1d
#define ADDR_ETIQ_ED_4 0x21
#define ADDR_ETIQ_ANEMOMETRE 0x25
#define ADDR_ETIQ_GIROUETTE 0x29
#define ADDR_ETIQ_THERMOCOUPLE 0x2d
#define ADDR_ETIQ_SHT75 0x31
#include <I2CEEPROM.h>
// 24AA256 - mémoire flash
#ifndef I2C_EEPROM
#define I2C_EEPROM
#define CHIP_ADDRESS 0x50
#define EEPROM_BYTES 32768 // Number of bytes in EEPROM chip
I2CEEPROM i2c_eeprom(CHIP_ADDRESS); // Create I2C EEPROM instance
unsigned int current_address = 0;
#endif
class Registre
{
private:
public:
void getParameterI(int i, int* resolution, int* gain, float* coeff);
};
#include <SPI.h>
#include <Wire.h>
#include <I2CEEPROM.h>
#include "Registre.h"
#include "i2ckeypad_perso.h"
#include "PCF8574.h" // Required for PCF8574
#include "rgb_lcd.h"
......@@ -10,7 +9,7 @@
#include <MCP3424_perso.h>
#include <Sensirion_perso.h>
#include <TimerOne.h>
//#include "Registre.h"
#define PCF8574_ADDR 0x38
#define ROWS 4
......@@ -19,12 +18,13 @@
// 24AA256 - mémoire flash
#ifndef I2C_EEPROM
#define I2C_EEPROM
#define CHIP_ADDRESS 0x50
#define EEPROM_BYTES 32768 // Number of bytes in EEPROM chip
I2CEEPROM i2c_eeprom(CHIP_ADDRESS); // Create I2C EEPROM instance
unsigned int current_address = 0;
#define CHIP_ADDRESS 0x50
#define EEPROM_BYTES 32768 // Number of bytes in EEPROM chip
I2CEEPROM i2c_eeprom(CHIP_ADDRESS); // Create I2C EEPROM instance
#endif
unsigned int current_address = 0;
void sendData(int adresseFin) {
current_address =0;
uint8_t byteToSend=0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment