# HG changeset patch # User Ethan Zonca # Date 2015-08-23 19:25:58 # Node ID b77b97fa501d55212fd357486de207643887927b # Parent a76c60e8cc43a5ed19276fb9b732834cd16733ad Add max31865 register defs diff --git a/max31865.c b/max31865.c --- a/max31865.c +++ b/max31865.c @@ -5,13 +5,48 @@ #include "states.h" #include "gpio.h" + +// Registers +#define MAX31855_REG_CONFIG 0x00 +#define MAX31855_REG_RTD_MSB 0x01 +#define MAX31855_REG_RTD_LSB 0x02 +#define MAX31855_REG_HFAULT_THRESH_MSB 0x03 +#define MAX31855_REG_HFAULT_THRESH_LSB 0x04 +#define MAX31855_REG_LFAULT_THRESH_MSB 0x05 +#define MAX31855_REG_LFAULT_THRESH_LSB 0x06 +#define MAX31855_REG_FAULTSTATUS 0x07 + +#define MAX31855_REGWRITEMODIFIER 0x80 + +// Fields +#define MAX31865_CONF_VBIAS (1<<7) +#define MAX31865_CONF_CONVMODE (1<<6) +#define MAX31865_CONF_1SHOT (1<<5) +#define MAX31865_CONF_3WIRE (1<<4) + +#define MAX31865_CONF_FAULT_NOACTION 0b0000 +#define MAX31865_CONF_FAULT_AUTODELAY 0b0100 +#define MAX31865_CONF_FAULT_MANUALELAY1 0b1000 +#define MAX31865_CONF_FAULT_MANUALELAY2 0b1100 + +#define MAX31865_CONF_FAULT_CLEAR (1<<1) +#define MAX31865_CONF_50_60HZ_FILTER (1<<0) + + // Grab temperature reading from MAX31865 void max31865_readtemp(SPI_HandleTypeDef* hspi1, therm_settings_t* set, therm_status_t* status) { - // ** FIXME ** FIXME ** FIXME ** // + /////////////////////////////////// // This is duplicated from MAX31855, update for MAX31865 registers/etc /////////////////////////////////// + // TODO: Set configuration register based on params in config.h (2-wire, 4-wire, etc RTD). This is register 0x00. + // 2-wire RTC or 2-wire (duh) NTC thermistor will be the only options + // Need option for resistance of RTD + // These options should be stored in the set structure and should be menu-selectable + // TODO: Read RTD msbs (0x01) + // TODO: Read RTD LSBs (0x02) + // Assert CS HAL_GPIO_WritePin(MAX_CS, 0);