diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2020-06-14 17:26:52 +0300 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2020-06-14 17:26:52 +0300 |
| commit | 06c50cb45dc825fed26042d475d73e4cb009e707 (patch) | |
| tree | d1f02dbb0c3bc0f92980fe0d19a399a1b85600c5 /Software/Embedded_SW/Embedded/Drivers | |
| parent | 2a307f7c34e33a02fb605cd6bb4fa913cc17b805 (diff) | |
| parent | a959e6421820dc64889fcf35b755e22ecae17e06 (diff) | |
| download | Tango-06c50cb45dc825fed26042d475d73e4cb009e707.tar.gz Tango-06c50cb45dc825fed26042d475d73e4cb009e707.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Embedded_SW/Embedded/Drivers')
12 files changed, 8 insertions, 1600 deletions
diff --git a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_SPI_Comm.c b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_SPI_Comm.c index 84f078b9f..a900eb75e 100644 --- a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_SPI_Comm.c +++ b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_SPI_Comm.c @@ -691,7 +691,9 @@ uint32_t FPGA_MotorConfig_callback(TimerMotors_t _motorId, uint32_t ReadValue) temp = temp << 24; if(MotorDriverResponse[_motorId].DriverMode == Voltage) { - temp |= 0x2E8F<<8;//voltage + + //temp |= 0x2E8F<<8;//voltage + temp |= (0x2E80 | (MotorsCfg[_motorId].configword & 0x000F)) <<8;//voltage MillisecWriteToMotor(_motorId, temp, 4, FPGA_MotorConfig_callback); } else @@ -700,13 +702,15 @@ uint32_t FPGA_MotorConfig_callback(TimerMotors_t _motorId, uint32_t ReadValue) if((_motorId >= HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_1) && (_motorId <= HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_8)) { //temp |= MotorsCfg[_motorId].configword<<8; - temp |= 0x1C8F<<8;//need to change in current mode? 0x1C0F with OCD 6 or 0x1C8F with OCD 15 + //temp |= 0x1C8F<<8;//need to change in current mode? 0x1C0F with OCD 6 or 0x1C8F with OCD 15 + temp |= (0x1C80 | (MotorsCfg[_motorId].configword & 0x000F)) <<8;// MillisecWriteToMotor(_motorId, temp, 4, FPGA_MotorConfig_callback); } else { - temp |= 0x1C8F<<8;//need to change in current mode? + //temp |= 0x1C8F<<8;//need to change in current mode? + temp |= (0x1C80 | (MotorsCfg[_motorId].configword & 0x000F)) <<8;// MillisecWriteToMotor(_motorId, temp, 4, FPGA_MotorConfig_callback); } } diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_AD5272_Rheostat/AD5272_Driver.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_AD5272_Rheostat/AD5272_Driver.c index c29c037ec..15be36e64 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_AD5272_Rheostat/AD5272_Driver.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_AD5272_Rheostat/AD5272_Driver.c @@ -52,361 +52,3 @@ bool AD5272_WriteRdac(uint8_t i2cbus, WHS_chip_address i2cadd, uint16_t value) return status; } - -//uint32_t MAX11615_Read_allADC() -//{ -// uint32_t status= OK; -// uint8_t Write_Buf[1]; -// uint8_t command_regAddress = 0; -// -// Write_Buf[0] = command_regAddress; -// status |= Block_Main_Head_Mux_Channel(); -// status |= Select_Main_WHS_Mux_Channel(); -// status |= I2C_Write(I2C_ID_WHS_CARD, I2CDAC_ADDRESS, Write_Buf, 1); -// -// delayUs(10);//TODO - check the delay -// -// status |= I2C_Read(I2C_ID_WHS_CARD, I2CDAC_ADDRESS + 1, MAX11614_Read_Buf, 16); -// -// delayUs(10);//TODO - check the delay -// return status; -// -//} - -//uint32_t AD5272_Init () -//{ -// uint32_t status= OK; -// -// U40_AD5272.bits.REG = 0; -// U40_AD5272.setup.bits.SEL2 = 1; -// U40_AD5272.setup.bits.SEL1 = 0; -// U40_AD5272.setup.bits.SEL0 = 1; -// U40_AD5272.setup.bits.CLK = 0; -// U40_AD5272.setup.bits.BIP_UNIn = 0; -// U40_AD5272.setup.bits.RSTn = 1; -// U40_AD5272.setup.bits.Dont_care = 0; -// -// U40_AD5272.configuration.bits.REG = 1; -// U40_AD5272.configuration.bits.SCAN1 = 0; -// U40_AD5272.configuration.bits.SCAN0 = 0; -// U40_AD5272.configuration.bits.CS3 = 0; -// U40_AD5272.configuration.bits.CS2 = 1; -// U40_AD5272.configuration.bits.CS1 = 1; -// U40_AD5272.configuration.bits.CS0 = 1; -// U40_AD5272.configuration.bits.SGL_DIFn = 1; -// -// U40_AD5272.MAX11614_I2CADDR = I2CADC_ADDRESS; -// U40_AD5272.MAX11614_I2CBUS = I2C_ID_WHS_CARD; -// -// -// -// -// status = MAX11615_Setup(U20_MAX11614.MAX11614_I2CBUS, U20_MAX11614.MAX11614_I2CADDR, U20_MAX11614.setup.uchar); -// status |= MAX11615_Configuration(U20_MAX11614.MAX11614_I2CBUS, U20_MAX11614.MAX11614_I2CADDR, U20_MAX11614.configuration.uchar); -// -// return status; -// -//} - -//uint32_t MAX11615_Setup (uint8_t i2cbus, WHS_chip_address i2cadd,uint8_t value) -//{ -// uint32_t status= OK; -// uint8_t Write_Buf[1]; -// -// Write_Buf[0] = value; -// status |= Block_Main_Head_Mux_Channel(); -// status |= Select_Main_WHS_Mux_Channel(); -// status |= I2C_Write(i2cbus, i2cadd, Write_Buf, 1); -// -// delayUs(10);//TODO - check the delay -// delayUs(10);//TODO - check the delay -// return status; -// -//} - -//uint32_t MAX11615_Configuration(uint8_t i2cbus, WHS_chip_address i2cadd,uint8_t value) -//{ -// uint32_t status= OK; -// uint8_t Write_Buf[1]; -// -// -// Write_Buf[0] = value; -// status |= Block_Main_Head_Mux_Channel(); -// status |= Select_Main_WHS_Mux_Channel(); -// status |= I2C_Write(i2cbus, i2cadd, Write_Buf, 1); -// -// delayUs(10);//TODO - check the delay -// return status; -//} - - - - -//uint32_t MAX11615_Write8 (MAX11615*, uint8_t, uint8_t) -//{ -// uint32_t status= OK; -// uint8_t Write_Buf[1]; -// -// Write_Buf[0] = command_regAddress; -// Write_Buf[1] = (uint8_t)(regValue >> 8); -// Write_Buf[2] = (uint8_t)( regValue & 0x00FF ); -// status |= Block_Main_Head_Mux_Channel(); -// status |= Select_Main_WHS_Mux_Channel(); -// status |= I2C_Write(I2C_ID_WHS_CARD, I2CADC_ADDRESS, Write_Buf, 1); -// -// delayUs(10);//TODO - check the delay -// return status; -//} -//uint32_t MAX11615_ADC_Read (MAX11615*, uint8_t, uint16_t*) -//{ -// uint32_t status= OK; -// uint8_t Write_Buf[3]; -// -// delayUs(10);//TODO - check the delay -// return status; -// -//} - -//uint32_t MAX11615_Scan (MAX11615*, uint16_t*) -//{ -// uint32_t status= OK; -// uint8_t Write_Buf[3]; -// -// delayUs(10);//TODO - check the delay -// return status; -// -//} - -///*----------------------------------------------------------------*/ -// -//int32_t i2c_smbus_write_word_data(int i2cFileDescriptor, uint8_t command_regAddress, uint16_t regValue) -//{ -// uint32_t status= OK; -// uint8_t Write_Buf[3]; -// -// Write_Buf[0] = command_regAddress; -// Write_Buf[1] = (uint8_t)(regValue >> 8); -// Write_Buf[2] = (uint8_t)( regValue & 0x00FF ); -// status |= Block_Main_Head_Mux_Channel(); -// status |= Select_Main_WHS_Mux_Channel(); -// status |= I2C_Write(I2C_ID_WHS_CARD, I2CDAC_ADDRESS, Write_Buf, 3); -// -// delayUs(10);//TODO - check the delay -// return status; -//} -// -//int32_t i2c_smbus_read_word_data(int i2cFileDescriptor, uint8_t command_regAddress) -//{ -// uint32_t status= OK; -// uint8_t Write_Buf[1]; -// -// -// Write_Buf[0] = command_regAddress; -// status |= Block_Main_Head_Mux_Channel(); -// status |= Select_Main_WHS_Mux_Channel(); -// status |= I2C_Write(I2C_ID_WHS_CARD, I2CDAC_ADDRESS, Write_Buf, 1); -// -// delayUs(10);//TODO - check the delay -// -// status |= I2C_Read(I2C_ID_WHS_CARD, I2CDAC_ADDRESS + 1, Read_Buf, 2); -// -// return status; -//} -// -//int32_t read_Max5805_device_ID() -//{ -// int32_t status = OK; -// -// status = MAX5805_DEVICEID(); -// if ((Read_Buf[0] == 0x50) && (Read_Buf[1] == 0x82)) -// { -// ReportWithPackageFilter(GeneralFilter,"------------ max5805 ID OK -----------------", __FILE__,__LINE__,(Read_Buf[0]), RpMessage,(Read_Buf[1]), 0); -// } -// else -// { -// ReportWithPackageFilter(GeneralFilter,"------------ max5805 ID NOT OK !!!! -----------------", __FILE__,__LINE__,(Read_Buf[0]), RpMessage,(Read_Buf[1]), 0); -// } -// return status; -//} -// -// -//int32_t Write_Max5805_AUXn(bool value) -//{ -// int32_t status = OK; -// -// -// Whs_I2C_EXP_U3_0x40_VALUE.bits.VALUE_ACTLOW_AUXn = value; -// status = WHS_Write_IO(I2CExp1_ADDRESS, D_TCA9555_PORT_0); -// return status; -//} -// -//int16_t Write_Max5805_LDACn(bool value) -//{ -// int32_t status = OK; -// -// -// Whs_I2C_EXP_U3_0x40_VALUE.bits.VALUE_ACTLOW_LDACn = value; -// status = WHS_Write_IO(I2CExp1_ADDRESS, D_TCA9555_PORT_0); -// return status; -//} -// -// -//void Write_Volt_Blower_Control(uint16_t volt) -//{ -// MAX5805_CODE_LOAD( volt); -//} -// -//void Write_MAX5805_REF(MAX5805_REF_enum_t value) -//{ -// MAX5805_REF(value) ; //REF_OUT_AlwaysOn_2V500 -//} -// -//int32_t init_5805() -//{ -// int32_t ret = OK; -// MAX5805_REF_enum_t ref_value = REF_OUT_AlwaysOn_2V500; -// MAX5805_CONFIG_enum_t confug_value = CONFIG_0000_0000_0011_1000_NONE; -// bool LDACn_value = true; -// bool AUXn_value = true; -// -// Write_MAX5805_REF( ref_value); -// MAX5805_CONFIG(confug_value); -// Write_Max5805_LDACn( LDACn_value); -// Write_Max5805_AUXn( AUXn_value); -// return ret; -//} -// -// -// -// -// -// -///* source */ -///** -// * @note STILL IN DEVELOPMENT -// * @file max11615.c -// * @author Simon Burkhardt github.com/mnemocron -// * @copyright MIT license -// * @date 06.2018 -// * @brief C library for the MAX11615EEE+ I2C ADC for STM32 HAL. -// * @details -// * @see github.com/mnemocron -// * @see https://datasheets.maximintegrated.com/en/ds/MAX11612-MAX11617.pdf -// * @see https://github.com/AllAboutEE/MAX11609EEE-Breakout-Board/tree/master/Software/Arduino/AllAboutEE-MAX11609-Library -// */ -//#include "max11615.h" -//#include "main.h" -// -///** -// * @brief writes a single value into a MAX11615 register -// * @param *chip, pointer to the MAX11615 typedef struct -// * @param reg, the destination register's address -// * @param val, the value for the destination register -// */ -//uint8_t MAX11615_Write8(MAX11615 *chip, uint8_t reg, uint8_t val){ -// if(HAL_I2C_Mem_Write(chip->wireIface, chip->devAddress, reg, 1, &val, 1, 10) != HAL_OK) -// return 1; -// return 0; -//} -// -///** -// * @brief reads a single value from a MAX11615 register -// * @param *chip, pointer to the MAX11615 typedef struct -// * @param reg, the destination register's address -// * @param val, pointer to the location where the value shall be stored -// * @return 0 on success, 1 on transmission error -// */ -//uint8_t MAX11615_Read8(MAX11615 *chip, uint8_t reg, uint8_t *val){ -// if(HAL_I2C_Mem_Read(chip->wireIface, chip->devAddress, reg, 1, val, 1, 10) != HAL_OK) -// return 1; -// return 0; -//} -// -///** -// * @brief sets up the MAX11615 chip with the provided Vref setting -// * @param *chip, pointer to the MAX11615 typedef struct -// * @param *wireIface a pointer to a HAL I2C_HandleTypeDef -// * @param address of the chip on the I2C bus -// */ -//uint8_t MAX11615_Init(MAX11615* chip, I2C_HandleTypeDef* wireIface, uint16_t address, uint8_t vRef){ -// chip->wireIface = wireIface; -// chip->devAddress = address; -// uint8_t ret = 0; -// // 0 - don't care -// // 1 - reset configuration register to default -// // 2 - unipolar -// // 3 - internal clock -// // 4 - SEL0 (vRef) -// // 5 - SEL1 (vRef) -// // 6 - SEL2 (vRef) -// vRef = (vRef<<4) & 0xf0; -// vRef |= 2; // do not reset the setup register -// ret += MAX11615_Setup(chip, vRef); -// // 0 - Single Ended -// // 1 to 4 - Channel Select: 7 -// // 5 to 6 - Scan Mode: read channels up to selected channel -// uint8_t config_byte = 0x00; -// config_byte |= 1; // single ended mode -// config_byte |= ((1<<5) & (1<<6)); // SCAN bits: convert only the channel selected by CS bits -// ret += MAX11615_Configuration(chip, config_byte); -// return ret; -//} -// -//uint8_t MAX11615_Setup(MAX11615* chip, uint8_t data){ -// data = data | 0x80; // make REG bit 7 = 1 (setup byte) -// if(HAL_I2C_Master_Transmit(chip->wireIface, chip->devAddress, &data, 1, 10) != HAL_OK) -// return 1; -// return 0; -//} -// -//uint8_t MAX11615_Configuration(MAX11615* chip, uint8_t data){ -// data = data & (~0x80); // make REG bit 7 = 0 (configuration byte) -// if(HAL_I2C_Master_Transmit(chip->wireIface, chip->devAddress, &data, 1, 10) != HAL_OK) -// return 1; -// return 0; -//} -// -///** -// * Reads one channel. -// * @author Miguel (5/24/2015) -// * @param channel The channel to convert or read. Alternatively -// * if a channel was set already leave null. -// * @param val Pointer to where the return value should be stored. -// * @return uint8_t -// */ -//uint8_t MAX11615_ADC_Read(MAX11615* chip, uint8_t channel, uint16_t* val){ -// uint8_t result[2] = {0,0}; -// -// uint8_t configurationByte = ( (channel<<1) & 0x0e) | 0x61; -// MAX11615_Configuration(chip, configurationByte); -// // the conversion consists of two bytes per channel -// if(HAL_I2C_Master_Receive(chip->wireIface, chip->devAddress, &result[0], 2, 10) != HAL_OK){ -// return 1; -// } -// uint16_t value = 0; -// // cast to uint16_t is necessary to not loose the values by the left shift -// value = (((uint16_t)result[0] & 0x000f) << 8); // MSB is returned first -// value += ((uint16_t)result[1] & 0x00ff); // read LSB -// *val = value; -// return 0; -//} -// -///** -// * Reads all channels conversion into a buffer/array. -// * -// * @author Miguel (5/24/2015) -// * -// * @param buffer an array where the channel read values are put. -// */ -//uint8_t MAX11615_Scan(MAX11615* chip, uint16_t* buffer){ -// uint8_t ret = 0; -// uint8_t configurationByte = 0xf0; -// ret += MAX11615_Configuration(chip, configurationByte); -// // 2 bytes per channel. There are 8 channels -// for(uint8_t i = 0;i<8;i++){ -// ret += MAX11615_ADC_Read(chip, i, buffer+i); -// } -// return ret; -//} - - diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_ADS122_PT100/ADS122X04_Driver.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_ADS122_PT100/ADS122X04_Driver.c index 97b572697..da23df290 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_ADS122_PT100/ADS122X04_Driver.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_ADS122_PT100/ADS122X04_Driver.c @@ -139,7 +139,6 @@ uint32_t WHS_Test_ADS122X_Internal_Temperature_Sensor(uint8_t i2cbus, uint8_t i2 D_ADS122_ReadDataCommand( i2cbus, i2cadd, &Data ); - //Data = Data_ADC_Head; Data = Data & 0xFFFFFF;//24bit @@ -208,308 +207,3 @@ bool D_ADS122_InitConfigReg() } - -//uint32_t ADS122_I2C_Write_SensorId(uint32_t I2C_ID, TEMPERATURE_SENSOR_ID_ENUM SensorId, uint32_t *I2C_Write_buf, uint32_t No_BytesToWrite ) -//{ -// uint32_t status = OK; -// -// I2C_ADC_ADS122C04_SLAVE_ADD = SensorId_To_SlaveAdd(SensorId); -// status |= I2C_Write(I2C_ID, I2C_ADC_ADS122C04_SLAVE_ADD, I2C_Write_buf, No_BytesToWrite); -// -// return status; -//} - -//uint32_t I2C_Read_SensorId(uint32_t I2C_ID, TEMPERATURE_SENSOR_ID_ENUM SensorId, uint32_t *I2C_Read_buf, uint32_t No_BytesToRead ) -//{ -// uint32_t status = OK; -// -// //HeadADCPT100_ControlMux_Brfore_Reading(SensorId); -// //TODO Choose TEMP1 sensor by I/O -// I2C_ADC_ADS122C04_SLAVE_ADD = SensorId_To_SlaveAdd(SensorId); -// status |= I2C_Read(I2C_ID, I2C_ADC_ADS122C04_SLAVE_ADD + 1, I2C_Read_buf, No_BytesToRead); -// -// return status; -//} - - -//uint32_t HeadADCPT100_ControlMux_Brfore_Reading(TEMPERATURE_SENSOR_ID_ENUM SensorId) -//{ -// uint32_t Status = OK; -// -// uint8_t Write_Buf[2]; -// -// if(SensorId % 2) -// HeadTempSensConfig[SensorId].Reg0.bits.MUX = 0x03; // TBD -// else -// HeadTempSensConfig[SensorId].Reg0.bits.MUX = 0x04; // TBD -// -// Write_Buf[0] = ADS122X_WREG_CMD | (ADS122X_CONFIG_0_REG<<2); -// Write_Buf[1] = HeadTempSensConfig[SensorId].Reg0.Byte; -// -// Status |= I2C_Write_SensorId(I2C_ID_HEAD_CARD, SensorId, Write_Buf, 1); -// -// return Status; -//} - - - - - -//uint32_t HeadADCPT100_Config_callback(TEMPERATURE_SENSOR_ID_ENUM SensorId, uint32_t Stage) -//{ -// uint32_t Status = OK; -// -// #ifndef EVALUATION_BOARD -// -// uint8_t Write_Buf[2]; -// -// if((SensorId < HEAD_PT100_ZONE_1_0X80_0) || (SensorId > MAX_HEAD_CARD_TEMP_SENS_ID)) -// return ERROR; -// -// if(HeadTempSensConfig[SensorId].Config == DONE) -// return Status; -// -// Select_Main_Head_Mux_Channel(); -// -// switch(Stage) -// { -// case SENSOR_CONFIG_REG0: -// Write_Buf[0] = ADS122X_WREG_CMD | (ADS122X_CONFIG_0_REG<<2); -// Write_Buf[1] = HeadTempSensConfig[SensorId].Reg0.Byte; -// break; -// case SENSOR_CONFIG_REG1: -// Write_Buf[0] = ADS122X_WREG_CMD | (ADS122X_CONFIG_1_REG<<2); -// Write_Buf[1] = HeadTempSensConfig[SensorId].Reg1.Byte; -// break; -// case SENSOR_CONFIG_REG2: -// Write_Buf[0] = ADS122X_WREG_CMD | (ADS122X_CONFIG_2_REG<<2); -// Write_Buf[1] = HeadTempSensConfig[SensorId].Reg2.Byte; -// break; -// case SENSOR_CONFIG_REG3: -// Write_Buf[0] = ADS122X_WREG_CMD | (ADS122X_CONFIG_3_REG<<2); -// Write_Buf[1] = HeadTempSensConfig[SensorId].Reg3.Byte; -// break; -// default: -// Status = ERROR; -// } -// -// Status |= I2C_Write_SensorId(I2C_ID_HEAD_CARD, SensorId, Write_Buf, 2); -// -// switch(SensorId) -// { -// case HEAD_PT100_ZONE_1_0X80_0: -// case HEAD_PT100_ZONE_2_0X80_1: -// HeadTempSensConfig[HEAD_PT100_ZONE_1_0X80_0].Config = DONE; -// HeadTempSensConfig[HEAD_PT100_ZONE_2_0X80_1].Config = DONE; -// break; -// case HEAD_PT100_ZONE_3_0X82_0: -// case HEAD_PT100_ZONE_4_0X82_1: -// HeadTempSensConfig[HEAD_PT100_ZONE_3_0X82_0].Config = DONE; -// HeadTempSensConfig[HEAD_PT100_ZONE_4_0X82_1].Config = DONE; -// break; -// case HEAD_PT100_ZONE_5_0X84_0: -// case HEAD_PT100_ZONE_6_0X84_1: -// HeadTempSensConfig[HEAD_PT100_ZONE_5_0X84_0].Config = DONE; -// HeadTempSensConfig[HEAD_PT100_ZONE_6_0X84_1].Config = DONE; -// break; -// case HEAD_PT100_ZONE_7_0X86_0: -// case HEAD_PT100_ZONE_8_0X86_1: -// HeadTempSensConfig[HEAD_PT100_ZONE_7_0X86_0].Config = DONE; -// HeadTempSensConfig[HEAD_PT100_ZONE_8_0X86_1].Config = DONE; -// break; -// case HEAD_PT100_ZONE_9_0X88_0: -// case HEAD_PT100_ZONE_10_0X88_1: -// HeadTempSensConfig[HEAD_PT100_ZONE_9_0X88_0].Config = DONE; -// HeadTempSensConfig[HEAD_PT100_ZONE_10_0X88_1].Config = DONE; -// break; -// case HEAD_PT100_ZONE_11_0X8A_0: -// case HEAD_PT100_ZONE_12_0X8A_1: -// HeadTempSensConfig[HEAD_PT100_ZONE_11_0X8A_0].Config = DONE; -// HeadTempSensConfig[HEAD_PT100_ZONE_12_0X8A_1].Config = DONE; -// break; -// case HEAD_PT100_AIR_HEATER_1_0X8C_0: -// case HEAD_PT100_AIR_HEATER_2_0X8C_1: -// HeadTempSensConfig[HEAD_PT100_AIR_HEATER_1_0X8C_0].Config = DONE; -// HeadTempSensConfig[HEAD_PT100_AIR_HEATER_2_0X8C_1].Config = DONE; -// break; -// case HEAD_PT100_MIXER_0X8E_0: -// case HEAD_PT100_RESERVE_0X8E_1: -// HeadTempSensConfig[HEAD_PT100_MIXER_0X8E_0].Config = DONE; -// HeadTempSensConfig[HEAD_PT100_RESERVE_0X8E_1].Config = DONE; -// break; -// default: -// break; -// } -// -// #endif -// -// return Status; -//} - -//void HeadADCPT100_SensorInitConfig() -//{ -// int Sensor=0,Register = 0; -// -// HeadADCPT100_InitConfigReg(); // Initial the configuration registers -// -// for(Register=0;Register<=SENSOR_CONFIG_REG3;Register++) -// { -// for(Sensor=HEAD_PT100_ZONE_1_0X80_0;Sensor<MAX_HEAD_CARD_TEMP_SENS_ID; Sensor++) -// { -// HeadADCPT100_Config_callback( (TEMPERATURE_SENSOR_ID_ENUM)(Sensor), Register); -// } -// SysCtlDelay(1000); -// } -//} - -//uint32_t HeadCard_Toggle_PT100(bool Odd_OR_Even)//ODD/EVEN -//{ -// uint32_t status = OK; -// uint8_t i=0; -// uint8_t Write_Buf[2]; -// -// HeadCard_Toggle_PT100_SEL(Odd_OR_Even); -// -// if(Odd_OR_Even == EVEN) -// { -// for(i=HEAD_PT100_ZONE_2_0X80_1;i < MAX_HEAD_CARD_TEMP_SENS_ID;i=i+2) -// { -// HeadTempSensConfig[i].Reg0.bits.MUX = HEAD_CONFIG_EVEN_PT100_MUX;//Reg0 Bits 4-7 -// -// Write_Buf[0] = ADS122X_WREG_CMD | (ADS122X_CONFIG_0_REG<<2); -// Write_Buf[1] = HeadTempSensConfig[i].Reg0.Byte; -// -// status |= I2C_Write_SensorId(I2C_ID_HEAD_CARD, i, Write_Buf, 2); -// } -// } -// else -// { -// for(i=HEAD_PT100_ZONE_1_0X80_0;i < MAX_HEAD_CARD_TEMP_SENS_ID;i=i+2) -// { -// HeadTempSensConfig[i].Reg0.bits.MUX = HEAD_CONFIG_ODD_PT100_MUX;//Reg0 Bits 4-7 -// -// Write_Buf[0] = ADS122X_WREG_CMD | (ADS122X_CONFIG_0_REG<<2); -// Write_Buf[1] = HeadTempSensConfig[i].Reg0.Byte; -// -// status |= I2C_Write_SensorId(I2C_ID_HEAD_CARD, i, Write_Buf, 2); -// } -// } -// -// return status; -//} - - -//uint32_t HeadCard_Toggle_PT100(TEMPERATURE_SENSOR_ID_ENUM SensorId) -//{ -// uint32_t status = OK; -// uint8_t Write_Buf[2]; -// -// if((SensorId < HEAD_PT100_ZONE_1_0X80_0) || (SensorId > MAX_HEAD_CARD_TEMP_SENS_ID)) -// return ERROR; -// -// Select_Main_Head_Mux_Channel(); -// -// if(Save_Sel_Status != HeadTempSensConfig[SensorId].SEL) -// { -// HeadCard_Toggle_PT100_SEL(HeadTempSensConfig[SensorId].SEL); -// Save_Sel_Status = HeadTempSensConfig[SensorId].SEL; -// } -// -// if(HeadTempSensConfig[SensorId].MUX_Status != HeadTempSensConfig[SensorId].Reg0.bits.MUX) -// { -// Write_Buf[0] = ADS122X_WREG_CMD | (ADS122X_CONFIG_0_REG<<2); -// Write_Buf[1] = HeadTempSensConfig[SensorId].Reg0.Byte; -// -// status |= I2C_Write_SensorId(I2C_ID_HEAD_CARD, SensorId, Write_Buf, 2); -// -// switch(SensorId) -// { -// case HEAD_PT100_ZONE_1_0X80_0: -// case HEAD_PT100_ZONE_2_0X80_1: -// HeadTempSensConfig[HEAD_PT100_ZONE_1_0X80_0].MUX_Status = TempSensConfig[SensorId].Reg0.bits.MUX; -// HeadTempSensConfig[HEAD_PT100_ZONE_2_0X80_1].MUX_Status = TempSensConfig[SensorId].Reg0.bits.MUX; -// break; -// case HEAD_PT100_ZONE_3_0X82_0: -// case HEAD_PT100_ZONE_4_0X82_1: -// HeadTempSensConfig[HEAD_PT100_ZONE_3_0X82_0].MUX_Status = TempSensConfig[SensorId].Reg0.bits.MUX; -// HeadTempSensConfig[HEAD_PT100_ZONE_4_0X82_1].MUX_Status = TempSensConfig[SensorId].Reg0.bits.MUX; -// break; -// case HEAD_PT100_ZONE_5_0X84_0: -// case HEAD_PT100_ZONE_6_0X84_1: -// HeadTempSensConfig[HEAD_PT100_ZONE_5_0X84_0].MUX_Status = TempSensConfig[SensorId].Reg0.bits.MUX; -// HeadTempSensConfig[HEAD_PT100_ZONE_6_0X84_1].MUX_Status = TempSensConfig[SensorId].Reg0.bits.MUX; -// break; -// case HEAD_PT100_ZONE_7_0X86_0: -// case HEAD_PT100_ZONE_8_0X86_1: -// HeadTempSensConfig[HEAD_PT100_ZONE_7_0X86_0].MUX_Status = TempSensConfig[SensorId].Reg0.bits.MUX; -// HeadTempSensConfig[HEAD_PT100_ZONE_8_0X86_1].MUX_Status = TempSensConfig[SensorId].Reg0.bits.MUX; -// break; -// case HEAD_PT100_ZONE_9_0X88_0: -// case HEAD_PT100_ZONE_10_0X88_1: -// HeadTempSensConfig[HEAD_PT100_ZONE_9_0X88_0].MUX_Status = TempSensConfig[SensorId].Reg0.bits.MUX; -// HeadTempSensConfig[HEAD_PT100_ZONE_10_0X88_1].MUX_Status = TempSensConfig[SensorId].Reg0.bits.MUX; -// break; -// case HEAD_PT100_ZONE_11_0X8A_0: -// case HEAD_PT100_ZONE_12_0X8A_1: -// HeadTempSensConfig[HEAD_PT100_ZONE_11_0X8A_0].MUX_Status = TempSensConfig[SensorId].Reg0.bits.MUX; -// HeadTempSensConfig[HEAD_PT100_ZONE_12_0X8A_1].MUX_Status = TempSensConfig[SensorId].Reg0.bits.MUX; -// break; -// case HEAD_PT100_AIR_HEATER_1_0X8C_0: -// case HEAD_PT100_AIR_HEATER_2_0X8C_1: -// HeadTempSensConfig[HEAD_PT100_AIR_HEATER_1_0X8C_0].MUX_Status = TempSensConfig[SensorId].Reg0.bits.MUX; -// HeadTempSensConfig[HEAD_PT100_AIR_HEATER_2_0X8C_1].MUX_Status = TempSensConfig[SensorId].Reg0.bits.MUX; -// break; -// case HEAD_PT100_MIXER_0X8E_0: -// case HEAD_PT100_RESERVE_0X8E_1: -// HeadTempSensConfig[HEAD_PT100_MIXER_0X8E_0].MUX_Status = TempSensConfig[SensorId].Reg0.bits.MUX; -// HeadTempSensConfig[HEAD_PT100_RESERVE_0X8E_1].MUX_Status = TempSensConfig[SensorId].Reg0.bits.MUX; -// break; -// default: -// break; -// } -// } -// return status; -//} - - - - -//uint8_t Test_Read_Buf[4] = {0,0,0,0}; -// -//uint32_t Test_HeadCard_PT100(TEMPERATURE_SENSOR_ID_ENUM SensorId) -//{ -// uint32_t Status = OK; -// uint8_t i = 0; -// -// Select_Main_Head_Mux_Channel(); -// -// //HeadADCPT100_Reset(); -// HeadADCPT100_InitConfigReg(); -// -// -// HeadADCPT100_Config_callback(SensorId, SENSOR_CONFIG_REG0); -// HeadADCPT100_Config_callback(SensorId, SENSOR_CONFIG_REG1); -// HeadADCPT100_Config_callback(SensorId, SENSOR_CONFIG_REG2); -// HeadADCPT100_Config_callback(SensorId, SENSOR_CONFIG_REG3); -// -// HeadADCPT100_StartSync(SensorId); -// -// -// -// uint8_t Write_Buf[4] = {SENSOR_CONFIG_REG0,SENSOR_CONFIG_REG1,SENSOR_CONFIG_REG2,SENSOR_CONFIG_REG3}; -// -// for(i=0; i<4; i++) -// { -// HeadADCPT100_ReadReg(SensorId, Write_Buf[i], &Test_Read_Buf[i]); -// -// } -// -// HeadADCPT100_SendReadDataCommand(SensorId); -// -// -// return Status; -//} - - - - diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_ADS122_PT100/ADS122X04_Driver.h b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_ADS122_PT100/ADS122X04_Driver.h index ffba137e4..9491c68af 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_ADS122_PT100/ADS122X04_Driver.h +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_ADS122_PT100/ADS122X04_Driver.h @@ -422,156 +422,5 @@ bool D_ADS122_WriteAllReg (uint8_t i2cbus, uint8_t i2cadd, D_ADS122C04_T uint32_t WHS_Test_ADS122X_Internal_Temperature_Sensor(uint8_t i2cbus, uint8_t i2cadd, uint8_t *p_readValue ); uint32_t D_ADS122_Calc_Resistance(uint32_t Data_ADS122X); bool D_ADS122_InitConfigReg(); -/* -// Bit field type register configuration -// Configuration Map register ADS122x04 -//--------------Address 0x00--------------------------------- -struct CONFIG_REG_0{ - uint8_t PGA_BYPASS:1; // 0 - uint8_t GAIN:3; // 1-3 - uint8_t MUX:4; // 4-7 -}; -union CONFIG_REG_0_U { - uint8_t all; - struct CONFIG_REG_0 bit; -}; - -//MS Reg. 01-04 adjusted -//--------------Address 0x01--------------------------------- -struct CONFIG_REG_1{ - uint8_t TS:1; // 0 - uint8_t VREF:2; // 1-2 - uint8_t CMBIT:1; // 3 - uint8_t MODE:1; // 4 - uint8_t DR:3; // 5-7 -}; -union CONFIG_REG_1_U { - uint8_t all; - struct CONFIG_REG_1 bit; -}; -//--------------Address 0x02--------------------------------- -struct CONFIG_REG_2{ - uint8_t IDAC:3; // 0-2 - uint8_t BCS:1; // 3 - uint8_t CRC:2; // 4-5 - uint8_t DCNT:1; // 6 - uint8_t DRDY:1; // 7 -}; -union CONFIG_REG_2_U { - uint8_t all; - struct CONFIG_REG_2 bit; -}; - -//--------------Address 0x03--------------------------------- -struct CONFIG_REG_3{ - #ifdef _ADS122U04_ - uint8_t AUTOUART:1; // 0 - uint8_t ZERO:1; // 1 - #else - uint8_t ZERO:2; // 1 - #endif - uint8_t I2MUX:3; // 2-4 - uint8_t I1MUX:3; // 5-7 -}; -union CONFIG_REG_3_U { - uint8_t all; - struct CONFIG_REG_3 bit; -}; - -//MS extended with Reg.0x04 - -//--------------Address 0x04--------------------------------- -#ifdef _ADS122U04_ -struct CONFIG_REG_4{ - uint8_t GPIO0DAT:1; // 0 - uint8_t GPIO1DAT:1; // 1 - uint8_t GPIO2DAT:1; // 2 - uint8_t GPIO2SEL:1; // 3 - uint8_t GPIO0DIR:1; // 4 - uint8_t GPIO1DIR:1; // 5 - uint8_t GPIO2DIR:1; // 6 - uint8_t ZERO:1; // 7 -}; -union CONFIG_REG_4_U { - uint8_t all; - struct CONFIG_REG_4 bit; -}; -#endif -typedef struct ADS122XReg{ - union CONFIG_REG_0_U reg0; - union CONFIG_REG_1_U reg1; - union CONFIG_REG_2_U reg2; - union CONFIG_REG_3_U reg3; - #ifdef _ADS122U04_ - union CONFIG_REG_4_U reg4; // only on ADS122U04, not in ADS122C04 - #endif -}ADS122XReg_t; - -// UART Communication Prototypes -#ifdef _ADS122U04_ -#define UART_SYNC_WORD (0x55) -#else -#define ADS122C04_I2C_ADDR (0x40) //ADS122C04 I2C SLAVE ADDRESS -#endif - -// Port -// SPI not used -// I2C to ADS122C04 is EUSCI_A3_BASE -// UART to ADS122U04 is EUSCI_A3_BASE -#ifdef _ADS122U04_ -#define ADS122X_UART EUSCI_A3_BASE -#else -#define ADS122X_I2C EUSCI_B0_BASE -#endif -// ************************************************************************************************************* / -// * PROTOTYPES * / -// ************************************************************************************************************* / - -typedef struct{ - uint8_t dataRate; - uint8_t gainLevel; - uint8_t convMode; - uint8_t opMode; - uint8_t inputMux; - uint8_t selectVref; - uint8_t routeIDAC1; - uint8_t routeIDAC2; - uint8_t idacCurrent; - uint8_t pgaBypass; - #ifdef _ADS122U04_ - uint8_t dataOutMode; - #endif - uint8_t tempSensorEn; -}ADS122X_initParam; - - -void ADS122X_init(ADS122X_initParam *param); - -void ADS122X_reset(void); -void ADS122X_start(void); -void ADS122X_powerdown(void); -void ADS122X_sendReadDataCommand(void); -void ADS122X_writeReg(uint8_t reg, uint8_t writeValue); -void ADS122X_readReg(uint8_t reg, uint8_t *readValue); - -void ADS122X_isDataReady(uint8_t *isDataReady); -void ADS122X_getConversionData(uint32_t *conversionData); -void ADS122X_getConversionDataWithCount(uint32_t *conversionData, uint8_t *count); -void ADS122X_enableDataCounter(void); -void ADS122X_disableDataCounter(void); -void ADS122X_enableInternalTempSensor(void); -void ADS122X_disableInternalTempSensor(void); -void ADS122X_enableBurnOutCurrent(void); -void ADS122X_disableBurnOutCurrent(void); -#ifdef _ADS122U04_ -void ADS122X_setGpioFunction(uint8_t gpio, uint8_t function); // DRDY only for GPIO2 -void ADS122X_setGpioValue(uint8_t gpio, uint8_t value); -void ADS122X_getGpioValue(uint8_t gpio, uint8_t *value); -#endif - -#ifdef __CPLUSPLUS -} -#endif -*/ #endif /* ADS122X_H_ */ diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_ADS122_PT100/WHS_PT100_ADC.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_ADS122_PT100/WHS_PT100_ADC.c index 71a78fc01..7aa906504 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_ADS122_PT100/WHS_PT100_ADC.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_ADS122_PT100/WHS_PT100_ADC.c @@ -20,13 +20,7 @@ ADDR 0x82 #include <Drivers/I2C_Communication/WHS_Card/IO_Extender_Ports_TCA9555/WHS_IO.h> -//#include "modules/control/millisecTask.h" -//#include "Modules/AlarmHandling/AlarmHandling.h" -//#include "drivers/Heater/TemperatureSensor.h" -//#include "../I2C_WHS_Mux.h" -//#include "drivers/I2C_Communication/I2C.h" -//#include "drivers/I2C_Communication/Head_Card/IO_Ports/Head_IO.h" -//#include "Drivers/I2C_Communication/Head_Card/PT100/Head_PT100_ADC.h" + D_ADS122C04_TempSensConfigStruc PT100_Conf[2]; diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_ADS122_PT100/WHS_PT100_ADC.h b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_ADS122_PT100/WHS_PT100_ADC.h index 4389c85c6..ab09f0e9d 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_ADS122_PT100/WHS_PT100_ADC.h +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_ADS122_PT100/WHS_PT100_ADC.h @@ -29,26 +29,4 @@ bool WHS_PT100_Read(TEMPERATURE_SENSOR_ID_ENUM SensorId); bool WHS_PT100_Get(TEMPERATURE_SENSOR_ID_ENUM SensorId, uint8_t *value ); bool Test_WHS_PT100_ADC(); -//extern HeadBoardTempSensConfigStruc HeadTempSensConfig[MAX_TEMPERATURE_SENSOR_ID]; - - -//uint32_t SensorId_To_SlaveAdd(TEMPERATURE_SENSOR_ID_ENUM SensorId); -//uint32_t I2C_Write_SensorId(uint32_t I2C_ID, TEMPERATURE_SENSOR_ID_ENUM SensorId, uint32_t *I2C_Write_buf, uint32_t No_BytesToWrite ); -//uint32_t was_HeadADCPT100_ControlMux_Brfore_Reading(TEMPERATURE_SENSOR_ID_ENUM SensorId); -//uint32_t was_I2C_Read_SensorId(uint32_t I2C_ID, TEMPERATURE_SENSOR_ID_ENUM SensorId, uint32_t *I2C_Read_buf, uint32_t No_BytesToRead ); -//uint32_t was_HeadADCPT100_Reset(void); -//uint32_t was_HeadADCPT100_StartSync(TEMPERATURE_SENSOR_ID_ENUM SensorId); -//uint32_t was_HeadADCPT100_PowerDown(TEMPERATURE_SENSOR_ID_ENUM SensorId); -//uint32_t was_HeadADCPT100_SendReadDataCommand(TEMPERATURE_SENSOR_ID_ENUM SensorId); -//uint32_t was_HeadADCPT100_WriteReg(TEMPERATURE_SENSOR_ID_ENUM SensorId, uint8_t reg, uint8_t writeValue); -//uint8_t was_HeadADCPT100_InitConfigReg(); -//uint32_t was_HeadADCPT100_Config_callback(TEMPERATURE_SENSOR_ID_ENUM SensorId, uint32_t Stage); -//uint32_t was_HeadADCPT100_ReadReg(TEMPERATURE_SENSOR_ID_ENUM SensorId, uint8_t reg, uint8_t *readValue); -//void was_HeadADCPT100_SensorInitConfig(); -//uint32_t was_HeadADCPT100_Calc_Resistance(TEMPERATURE_SENSOR_ID_ENUM SensorId, unsigned int Current_Measurement); -//uint32_t was_HeadCard_Toggle_PT100(TEMPERATURE_SENSOR_ID_ENUM SensorId); -//uint32_t was_Test_ADS122X_Internal_Temperature_Sensor(TEMPERATURE_SENSOR_ID_ENUM SensorId); - -//uint32_t Test_HeadCard_PT100(TEMPERATURE_SENSOR_ID_ENUM SensorId); - #endif /* DRIVERS_I2C_COMMUNICATION_WHS_CARD_PT100_PT100_ADC_H_ */ diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_EMC2302_Fan/D_EMC2302_fan.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_EMC2302_Fan/D_EMC2302_fan.c index cc61998a3..5934102b5 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_EMC2302_Fan/D_EMC2302_fan.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_EMC2302_Fan/D_EMC2302_fan.c @@ -19,206 +19,11 @@ #include <Drivers/I2C_Communication/WHS_Card/D_EMC2302_Fan/WHS_Fan.h> #include "Drivers/I2C_Communication/WHS_Card/WHS_data.h" -//uint8_t D_Fan_PWM_Output_Config (uint8_t EMC2302_I2C_bus_number , uint8_t EMC2302_I2C_addr); -//uint8_t D_Fan_Setting (uint8_t EMC2302_I2C_bus_number , uint8_t EMC2302_I2C_addr, bool Fan); -//uint8_t D_Fan_Read_Tacho (uint8_t EMC2302_I2C_bus_number , uint8_t EMC2302_I2C_addr, bool Fan); -//uint8_t D_fan_productID (uint8_t EMC2302_I2C_bus_number , uint8_t EMC2302_I2C_addr); -//uint8_t D_fan_manufactuerID (uint8_t EMC2302_I2C_bus_number , uint8_t EMC2302_I2C_addr); -//uint8_t D_fan_revision (uint8_t EMC2302_I2C_bus_number , uint8_t EMC2302_I2C_addr); -//uint8_t D_Read_Config_Reg (uint8_t EMC2302_I2C_bus_number , uint8_t EMC2302_I2C_addr); -//uint8_t D_Fan_config (uint8_t EMC2302_I2C_bus_number , uint8_t EMC2302_I2C_addr); - -/****************************************************************************** -* Module Variable Definitions -*******************************************************************************/ -//uint8_t readbuffer[2]; -//uint8_t writebuffer[2]; - - -//uint32_t I2C_FAN_SLAVE_ADD = 0x5C; - - - - -//uint16_t Fan_Tach[2] = {0,0}; uint8_t D_Fan_PWM_Command[2] = {0,0}; -//D_EMC2302_READ D_EMC2302_Read; -//D_EMC2302_WRITE D_EMC2302_Write; - -//uint8_t D_EMC2302_Reg_Add[EMC2302_Size] = { -//0x20,0x24,0x25,0x26,0x27,0x29,0x2A,0x2B,0x2D, -//0x30,0x40,0x31,0x41,0x32,0x42,0x33,0x43,0x35,0x45,0x36,0x46,0x37,0x47,0x38,0x48,0x39,0x49,0x3A,0x4A,0x3B,0x4B,0x3C,0x4C,0x3D,0x4D,0x3E,0x4E,0x3F,0x4F, -//0xEF,0xFD,0xFE,0xFF}; - -/****************************************************************************** -* Function Definitions -*******************************************************************************/ - - - - - - - - -//uint8_t WHS_Fan_PWM_Base_Frequency() -//{ -// uint8_t status = ERROR; -// -// if( D_EMC2302_Write.Reg.PWM_Base_Freq <= ((FAN_FREQ_2_441HZ << 2) | FAN_FREQ_2_441HZ)) -// { -// writebuffer[0] = EMC2301_PWM_BASE_FREQ; -// writebuffer[1] = D_EMC2302_Write.Reg.PWM_Base_Freq; -// status = I2C_Write(I2C_ID_WHS_CARD, I2C_WHS_FAN_SLAVE_ADD, writebuffer, 2); -// } -// return status; -//} - - - - -/******************************************* - ******** Informational Functions ********** - ******************************************/ - - - - -//uint8_t D_Read_Config_Reg(uint8_t EMC2302_I2C_bus_number, uint8_t EMC2302_I2C_addr) -//{ -// uint8_t status = OK; -// writebuffer[0] = EMC2301_CONFIGURATION; -// status |= I2C_Write(EMC2302_I2C_bus_number, EMC2302_I2C_addr, writebuffer, 1); -// delayUs(10);//TODO - check the delay -// status |= I2C_Read(EMC2302_I2C_bus_number, EMC2302_I2C_addr + 1, readbuffer, 1); -// -// EMC2302_Read.Reg.Configuration = readbuffer[0]; -// -// return status; -//} - -//uint8_t WHS_Fan_Read_Register(uint8_t Reg) -//{ -// uint8_t status = OK; -// writebuffer[0] = Reg; -// status |= I2C_Write(I2C_ID_WHS_CARD, I2C_WHS_FAN_SLAVE_ADD, writebuffer, 1); -// delayUs(10);//TODO - check the delay -// status |= I2C_Read(I2C_ID_WHS_CARD, I2C_WHS_FAN_SLAVE_ADD + 1, readbuffer, 1); -// return readbuffer[0]; -// //return status; -//} - - - -//uint8_t WHS_Fan_Read_Registers() -//{ -// uint8_t status = OK, i = 0; -// -// -// for(i=40;i<EMC2302_Size;i++) -// { -// writebuffer[0] = WHS_EMC2302_Reg_Add[i]; -// status |= I2C_Write(I2C_ID_WHS_CARD, I2C_WHS_FAN_SLAVE_ADD, writebuffer, 1); -// delayUs(10);//TODO - check the delay -// status |= I2C_Read(I2C_ID_WHS_CARD, I2C_WHS_FAN_SLAVE_ADD + 1, readbuffer, 1); -// D_EMC2302_Read.Buf[i] = readbuffer[0]; -// delayms(5);//TODO - check the delay -// } -// return status; -//} - - - -//uint8_t D_Fan_config(uint8_t EMC2302_I2C_bus_number ,uint8_t EMC2302_I2C_addr) -// -//{ -// uint8_t status = OK; -// -// //D_EMC2302_Write.Reg.PWM_Polarity_Config = 0x0;//Bit0 invert PWM1, Bit2 invert PWM2 -// //WHS_Fan_PWM_Polarity_Config(); -// -// //Output is configured as a push-pull output -// D_EMC2302_Write.Reg.PWM_Output_Config = 0x3;//Bit0 Output PWM1, Bit2 Output PWM2, 0 open drain, 1 push-pull -// D_Fan_PWM_Output_Config(EMC2302_I2C_bus_number ,EMC2302_I2C_addr); -// -//// //Max Freq. -//// D_EMC2302_Write.Reg.PWM_Base_Freq = (FAN_FREQ_26KHZ << 2) | FAN_FREQ_26KHZ; -//// WHS_Fan_PWM_Base_Frequency(); -//// -//// -//// WHS_Read_Config_Reg(); -//// if (D_EMC2302_Read.Reg.PWM_Output_Config != D_EMC2302_Write.Reg.PWM_Output_Config) -//// status |= ERROR ; -// -// D_EMC2302_Write.Reg.Fan_Setting[0] = D_Fan_PWM_Command[0]; //Fan 1 Setting - 0xFF Full PWM 0x80 = 50% FF = 100% 0 - STOP -// D_Fan_Setting( EMC2302_I2C_bus_number , EMC2302_I2C_addr, 0); -// delayms(5);//TODO - check the delay -// D_Fan_Read_Tacho( EMC2302_I2C_bus_number , EMC2302_I2C_addr, 0); -// -// D_EMC2302_Write.Reg.Fan_Setting[1] = D_Fan_PWM_Command[1]; //Fan 1 Setting - 0xFF Full PWM 0x80 = 50% FF = 100% 0 - STOP -// D_Fan_Setting( EMC2302_I2C_bus_number , EMC2302_I2C_addr, 1); -// delayms(5);//TODO - check the delay -// D_Fan_Read_Tacho( EMC2302_I2C_bus_number , EMC2302_I2C_addr, 1); -// -// return status; -//} - - -//void Test_WHS_fan_Click(uint8_t EMC2302_I2C_bus_number ,uint8_t EMC2302_I2C_addr) -//{ -// static uint8_t once = 1; -// uint8_t data; -// if (once) -// { -// #ifdef Test_WHSCard_With_DispCard_I2C4_Add0xE2_DispID_0 -// Select_Main_WHS_Mux_Channel_test(); -// #else -// Select_Main_WHS_Mux_Channel(); -// #endif -// -// //once = 0; -// } -// D_fan_productID(EMC2302_I2C_bus_number , EMC2302_I2C_addr, &data); -// D_fan_manufactuerID(EMC2302_I2C_bus_number , EMC2302_I2C_addr, &data); -// D_fan_revision(EMC2302_I2C_bus_number , EMC2302_I2C_addr, &data); -// D_Read_Config_Reg(EMC2302_I2C_bus_number , EMC2302_I2C_addr); -// //WHS_Fan_Read_Registers(); -// D_Fan_config( EMC2302_I2C_bus_number , EMC2302_I2C_addr); -//} - -//uint8_t D_Fan_PWM_Control(uint8_t EMC2302_I2C_bus_number ,uint8_t EMC2302_I2C_addr, uint8_t Fan_ID, uint8_t PWM) -//{ -// uint8_t status = OK; -// -// // Select_Main_WHS_Mux_Channel(); -// -// if(Fan_ID < 0x02) -// { -// D_Fan_PWM_Command[Fan_ID] = PWM; -// } -// else -// status |= ERROR; -// -// -// D_EMC2302_Write.Reg.PWM_Output_Config |= (0x1 << Fan_ID);//Bit0 Output PWM1, Bit2 Output PWM2, 0 open drain, 1 push-pull -// status |= D_Fan_PWM_Output_Config( EMC2302_I2C_bus_number , EMC2302_I2C_addr); -// -// D_EMC2302_Write.Reg.Fan_Setting[Fan_ID] = D_Fan_PWM_Command[Fan_ID]; //Fan 1 Setting - 0xFF Full PWM 0x80 = 50% FF = 100% 0 - STOP -// status |= D_Fan_Setting( EMC2302_I2C_bus_number , EMC2302_I2C_addr, Fan_ID); -// delayms(5);//TODO - check the delay -// status |= D_Fan_Read_Tacho( EMC2302_I2C_bus_number , EMC2302_I2C_addr, Fan_ID); -// -// return status; -//} - -/* ***** use only the next func: ***/ -/* ***** use only the next func: ***/ -/* ***** use only the next func: ***/ -/* ***** use only the next func: ***/ uint8_t D_fan_productID(uint8_t EMC2302_I2C_bus_number, uint8_t EMC2302_I2C_addr, uint8_t *productID) { diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_MAX11614_ADC/MAX11614_Driver.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_MAX11614_ADC/MAX11614_Driver.c index 214910efa..ae37bf938 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_MAX11614_ADC/MAX11614_Driver.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_MAX11614_ADC/MAX11614_Driver.c @@ -64,285 +64,3 @@ bool MAX11614_Configuration(uint8_t i2cbus, WHS_chip_address i2cadd,uint8_t valu return status; } - - - - - - - - - - - - - - -//uint32_t MAX11614_Write8 (MAX11614*, uint8_t, uint8_t) -//{ -// uint32_t status= OK; -// uint8_t Write_Buf[1]; -// -// Write_Buf[0] = command_regAddress; -// Write_Buf[1] = (uint8_t)(regValue >> 8); -// Write_Buf[2] = (uint8_t)( regValue & 0x00FF ); -// status |= Block_Main_Head_Mux_Channel(); -// status |= Select_Main_WHS_Mux_Channel(); -// status |= I2C_Write(I2C_ID_WHS_CARD, I2CADC_ADDRESS, Write_Buf, 1); -// -// delayUs(10);//TODO - check the delay -// return status; -//} -//uint32_t MAX11614_ADC_Read (MAX11614*, uint8_t, uint16_t*) -//{ -// uint32_t status= OK; -// uint8_t Write_Buf[3]; -// -// delayUs(10);//TODO - check the delay -// return status; -// -//} - -//uint32_t MAX11614_Scan (MAX11614*, uint16_t*) -//{ -// uint32_t status= OK; -// uint8_t Write_Buf[3]; -// -// delayUs(10);//TODO - check the delay -// return status; -// -//} - -///*----------------------------------------------------------------*/ -// -//int32_t i2c_smbus_write_word_data(int i2cFileDescriptor, uint8_t command_regAddress, uint16_t regValue) -//{ -// uint32_t status= OK; -// uint8_t Write_Buf[3]; -// -// Write_Buf[0] = command_regAddress; -// Write_Buf[1] = (uint8_t)(regValue >> 8); -// Write_Buf[2] = (uint8_t)( regValue & 0x00FF ); -// status |= Block_Main_Head_Mux_Channel(); -// status |= Select_Main_WHS_Mux_Channel(); -// status |= I2C_Write(I2C_ID_WHS_CARD, I2CDAC_ADDRESS, Write_Buf, 3); -// -// delayUs(10);//TODO - check the delay -// return status; -//} -// -//int32_t i2c_smbus_read_word_data(int i2cFileDescriptor, uint8_t command_regAddress) -//{ -// uint32_t status= OK; -// uint8_t Write_Buf[1]; -// -// -// Write_Buf[0] = command_regAddress; -// status |= Block_Main_Head_Mux_Channel(); -// status |= Select_Main_WHS_Mux_Channel(); -// status |= I2C_Write(I2C_ID_WHS_CARD, I2CDAC_ADDRESS, Write_Buf, 1); -// -// delayUs(10);//TODO - check the delay -// -// status |= I2C_Read(I2C_ID_WHS_CARD, I2CDAC_ADDRESS + 1, Read_Buf, 2); -// -// return status; -//} -// -//int32_t read_Max5805_device_ID() -//{ -// int32_t status = OK; -// -// status = MAX5805_DEVICEID(); -// if ((Read_Buf[0] == 0x50) && (Read_Buf[1] == 0x82)) -// { -// ReportWithPackageFilter(GeneralFilter,"------------ max5805 ID OK -----------------", __FILE__,__LINE__,(Read_Buf[0]), RpMessage,(Read_Buf[1]), 0); -// } -// else -// { -// ReportWithPackageFilter(GeneralFilter,"------------ max5805 ID NOT OK !!!! -----------------", __FILE__,__LINE__,(Read_Buf[0]), RpMessage,(Read_Buf[1]), 0); -// } -// return status; -//} -// -// -//int32_t Write_Max5805_AUXn(bool value) -//{ -// int32_t status = OK; -// -// -// Whs_I2C_EXP_U3_0x40_VALUE.bits.VALUE_ACTLOW_AUXn = value; -// status = WHS_Write_IO(I2CExp1_ADDRESS, D_TCA9555_PORT_0); -// return status; -//} -// -//int16_t Write_Max5805_LDACn(bool value) -//{ -// int32_t status = OK; -// -// -// Whs_I2C_EXP_U3_0x40_VALUE.bits.VALUE_ACTLOW_LDACn = value; -// status = WHS_Write_IO(I2CExp1_ADDRESS, D_TCA9555_PORT_0); -// return status; -//} -// -// -//void Write_Volt_Blower_Control(uint16_t volt) -//{ -// MAX5805_CODE_LOAD( volt); -//} -// -//void Write_MAX5805_REF(MAX5805_REF_enum_t value) -//{ -// MAX5805_REF(value) ; //REF_OUT_AlwaysOn_2V500 -//} -// -//int32_t init_5805() -//{ -// int32_t ret = OK; -// MAX5805_REF_enum_t ref_value = REF_OUT_AlwaysOn_2V500; -// MAX5805_CONFIG_enum_t confug_value = CONFIG_0000_0000_0011_1000_NONE; -// bool LDACn_value = true; -// bool AUXn_value = true; -// -// Write_MAX5805_REF( ref_value); -// MAX5805_CONFIG(confug_value); -// Write_Max5805_LDACn( LDACn_value); -// Write_Max5805_AUXn( AUXn_value); -// return ret; -//} -// -// -// -// -// -// -///* source */ -///** -// * @note STILL IN DEVELOPMENT -// * @file MAX11614.c -// * @author Simon Burkhardt github.com/mnemocron -// * @copyright MIT license -// * @date 06.2018 -// * @brief C library for the MAX11614EEE+ I2C ADC for STM32 HAL. -// * @details -// * @see github.com/mnemocron -// * @see https://datasheets.maximintegrated.com/en/ds/MAX11612-MAX11617.pdf -// * @see https://github.com/AllAboutEE/MAX11609EEE-Breakout-Board/tree/master/Software/Arduino/AllAboutEE-MAX11609-Library -// */ -//#include "MAX11614.h" -//#include "main.h" -// -///** -// * @brief writes a single value into a MAX11614 register -// * @param *chip, pointer to the MAX11614 typedef struct -// * @param reg, the destination register's address -// * @param val, the value for the destination register -// */ -//uint8_t MAX11614_Write8(MAX11614 *chip, uint8_t reg, uint8_t val){ -// if(HAL_I2C_Mem_Write(chip->wireIface, chip->devAddress, reg, 1, &val, 1, 10) != HAL_OK) -// return 1; -// return 0; -//} -// -///** -// * @brief reads a single value from a MAX11614 register -// * @param *chip, pointer to the MAX11614 typedef struct -// * @param reg, the destination register's address -// * @param val, pointer to the location where the value shall be stored -// * @return 0 on success, 1 on transmission error -// */ -//uint8_t MAX11614_Read8(MAX11614 *chip, uint8_t reg, uint8_t *val){ -// if(HAL_I2C_Mem_Read(chip->wireIface, chip->devAddress, reg, 1, val, 1, 10) != HAL_OK) -// return 1; -// return 0; -//} -// -///** -// * @brief sets up the MAX11614 chip with the provided Vref setting -// * @param *chip, pointer to the MAX11614 typedef struct -// * @param *wireIface a pointer to a HAL I2C_HandleTypeDef -// * @param address of the chip on the I2C bus -// */ -//uint8_t MAX11614_Init(MAX11614* chip, I2C_HandleTypeDef* wireIface, uint16_t address, uint8_t vRef){ -// chip->wireIface = wireIface; -// chip->devAddress = address; -// uint8_t ret = 0; -// // 0 - don't care -// // 1 - reset configuration register to default -// // 2 - unipolar -// // 3 - internal clock -// // 4 - SEL0 (vRef) -// // 5 - SEL1 (vRef) -// // 6 - SEL2 (vRef) -// vRef = (vRef<<4) & 0xf0; -// vRef |= 2; // do not reset the setup register -// ret += MAX11614_Setup(chip, vRef); -// // 0 - Single Ended -// // 1 to 4 - Channel Select: 7 -// // 5 to 6 - Scan Mode: read channels up to selected channel -// uint8_t config_byte = 0x00; -// config_byte |= 1; // single ended mode -// config_byte |= ((1<<5) & (1<<6)); // SCAN bits: convert only the channel selected by CS bits -// ret += MAX11614_Configuration(chip, config_byte); -// return ret; -//} -// -//uint8_t MAX11614_Setup(MAX11614* chip, uint8_t data){ -// data = data | 0x80; // make REG bit 7 = 1 (setup byte) -// if(HAL_I2C_Master_Transmit(chip->wireIface, chip->devAddress, &data, 1, 10) != HAL_OK) -// return 1; -// return 0; -//} -// -//uint8_t MAX11614_Configuration(MAX11614* chip, uint8_t data){ -// data = data & (~0x80); // make REG bit 7 = 0 (configuration byte) -// if(HAL_I2C_Master_Transmit(chip->wireIface, chip->devAddress, &data, 1, 10) != HAL_OK) -// return 1; -// return 0; -//} -// -///** -// * Reads one channel. -// * @author Miguel (5/24/2015) -// * @param channel The channel to convert or read. Alternatively -// * if a channel was set already leave null. -// * @param val Pointer to where the return value should be stored. -// * @return uint8_t -// */ -//uint8_t MAX11614_ADC_Read(MAX11614* chip, uint8_t channel, uint16_t* val){ -// uint8_t result[2] = {0,0}; -// -// uint8_t configurationByte = ( (channel<<1) & 0x0e) | 0x61; -// MAX11614_Configuration(chip, configurationByte); -// // the conversion consists of two bytes per channel -// if(HAL_I2C_Master_Receive(chip->wireIface, chip->devAddress, &result[0], 2, 10) != HAL_OK){ -// return 1; -// } -// uint16_t value = 0; -// // cast to uint16_t is necessary to not loose the values by the left shift -// value = (((uint16_t)result[0] & 0x000f) << 8); // MSB is returned first -// value += ((uint16_t)result[1] & 0x00ff); // read LSB -// *val = value; -// return 0; -//} -// -///** -// * Reads all channels conversion into a buffer/array. -// * -// * @author Miguel (5/24/2015) -// * -// * @param buffer an array where the channel read values are put. -// */ -//uint8_t MAX11614_Scan(MAX11614* chip, uint16_t* buffer){ -// uint8_t ret = 0; -// uint8_t configurationByte = 0xf0; -// ret += MAX11614_Configuration(chip, configurationByte); -// // 2 bytes per channel. There are 8 channels -// for(uint8_t i = 0;i<8;i++){ -// ret += MAX11614_ADC_Read(chip, i, buffer+i); -// } -// return ret; -//} - - diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_MAX11614_ADC/MAX11614_Driver.h b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_MAX11614_ADC/MAX11614_Driver.h index ebd211efb..b6bbc4120 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_MAX11614_ADC/MAX11614_Driver.h +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/D_MAX11614_ADC/MAX11614_Driver.h @@ -58,12 +58,4 @@ bool MAX11614_Setup (uint8_t i2cbus, WHS_chip_address i2cadd,uint8_t bool MAX11614_Configuration (uint8_t i2cbus, WHS_chip_address i2cadd,uint8_t value); - - - - -//uint8_t MAX11614_Write8 (MAX11614*, uint8_t, uint8_t); -//uint32_t MAX11614_ADC_Read (uint8_t* read_buf ); -//uint32_t MAX11614_Scan (uint16_t* read_buf); - #endif diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/EEPROM/D_EEPROM.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/EEPROM/D_EEPROM.c index 6cd00ea4c..795c58bb2 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/EEPROM/D_EEPROM.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/EEPROM/D_EEPROM.c @@ -91,120 +91,3 @@ uint32_t D_I2C_EEprom_Read(uint8_t I2C_ID, uint8_t I2C_chip_addr, uint32_t addre return status; } - -/* -uint32_t Check_WHS_Type_Via_EEPROM() -{ -#define WHS_TYPE_ADDR 0 - - uint32_t status = OK; - uint8_t data = 0; - - WHS_I2C_EEprom_Read(WHS_TYPE_ADDR, 1, &data); - - if(I2CMasterErr(I2C_ID_WHS_CARD) == I2C_MASTER_ERR_NONE) - { - WHS_Type = WHS_TYPE_UNKNOWN; - } - else - { - WHS_Type = WHS_TYPE_NEW; - } - -// //temporary -// #ifdef Use_Head_Card -// Head_Type = HEAD_TYPE_SYLKO; -// #else -// Head_Type = HEAD_TYPE_SYLKO_WITHOUT_CARD; -// #endif - - //TODO to test and replace #ifdef Use_Head_Card with if(Head_Type != HEAD_TYPE_SYLKO_WITHOUT_CARD) - - return status; -} -*/ - -/* -uint32_t WHS_I2C_EEprom_Write_Ch() -{ - uint32_t status= OK; - - uint8_t i = 0; - - - status |= Select_Main_WHS_Mux_Channel(); - - WHS_Write_Buf[0] = 0x00; - WHS_Write_Buf[1] = 0x00; - - for(i=0;i<Max_WHS_buf_size;i++) - { - WHS_Write_Buf[i+2] = WHS_struct.Write_WHS_EEPROM.Buf[i]; - } - - status |= I2C_Write(I2C_ID_WHS_CARD, I2CEEPROM_ADDRESS, WHS_Write_Buf, Max_WHS_buf_size+2); - - return status; -} - -uint32_t WHS_I2C_EEprom_Set_for_Read_Ch() -{ - uint32_t status= OK; - - status |= Select_Main_WHS_Mux_Channel(); - - WHS_Write_Buf[0] = 0x00; - WHS_Write_Buf[1] = 0x00; - - status |= I2C_Write(I2C_ID_WHS_CARD, I2CEEPROM_ADDRESS, WHS_Write_Buf, 2); - - return status; -} - -uint32_t WHS_I2C_EEprom_Read_Ch() -{ - uint32_t status= OK; - - status |= Select_Main_WHS_Mux_Channel(); - - status |= I2C_Read(I2C_ID_WHS_CARD, I2CEEPROM_ADDRESS + 1, WHS_struct.Read_WHS_EEPROM.Buf, Max_WHS_buf_size); - - return status; -} - -uint32_t Test_WHS_EEPROM() -{ - uint32_t status= OK; - uint32_t i; - - WHS_struct.Write_WHS_EEPROM.bytes.SN = 0x12345678; - - WHS_struct.Write_WHS_EEPROM.bytes.Uint32_Spare[0] = 0xA123456A; - WHS_struct.Write_WHS_EEPROM.bytes.Uint32_Spare[1] = 0xB123456B; - WHS_struct.Write_WHS_EEPROM.bytes.Uint32_Spare[2] = 0xC123456C; - WHS_struct.Write_WHS_EEPROM.bytes.Uint32_Spare[3] = 0xD123456D; - WHS_struct.Write_WHS_EEPROM.bytes.Uint32_Spare[4] = 0xE123456E; - - WHS_struct.Write_WHS_EEPROM.bytes.Double_Spare[0] = 0xA789012A; - WHS_struct.Write_WHS_EEPROM.bytes.Double_Spare[1] = 0xB789012B; - WHS_struct.Write_WHS_EEPROM.bytes.Double_Spare[2] = 0xC789012C; - WHS_struct.Write_WHS_EEPROM.bytes.Double_Spare[3] = 0xD789012D; - WHS_struct.Write_WHS_EEPROM.bytes.Double_Spare[4] = 0xE789012E; - - status |= WHS_I2C_EEprom_Write_Ch(); - SysCtlDelay(5000000);//Must delay for at least 5 milli. !!! (See data sheet ) - status |= WHS_I2C_EEprom_Set_for_Read_Ch(); - status |= WHS_I2C_EEprom_Read_Ch(); - - if(status == 0) - { - for(i=0;i<Max_WHS_buf_size;i++) - { - if(WHS_struct.Read_WHS_EEPROM.Buf[i]!=WHS_struct.Write_WHS_EEPROM.Buf[i]) - status |= ERROR; - } - } - - return status; -} -*/ diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/EEPROM/WHS_EEPROM.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/EEPROM/WHS_EEPROM.c index c3f91775a..74083e67a 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/EEPROM/WHS_EEPROM.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/EEPROM/WHS_EEPROM.c @@ -118,90 +118,7 @@ uint32_t Check_WHS_Type_Via_EEPROM() return status; } -/* -uint32_t WHS_I2C_EEprom_Write_Ch() -{ - uint32_t status= OK; - - uint8_t i = 0; - - - status |= Select_Main_WHS_Mux_Channel(); - - WHS_Write_Buf[0] = 0x00; - WHS_Write_Buf[1] = 0x00; - - for(i=0;i<Max_WHS_buf_size;i++) - { - WHS_Write_Buf[i+2] = WHS_Eeprom.Buf[i]; - } - - status |= I2C_Write(I2C_ID_WHS_CARD, I2CEEPROM_ADDRESS, WHS_Write_Buf, Max_WHS_buf_size+2); - - return status; -} - -uint32_t WHS_I2C_EEprom_Set_for_Read_Ch() -{ - uint32_t status= OK; - - status |= Select_Main_WHS_Mux_Channel(); - - WHS_Write_Buf[0] = 0x00; - WHS_Write_Buf[1] = 0x00; - - status |= I2C_Write(I2C_ID_WHS_CARD, I2CEEPROM_ADDRESS, WHS_Write_Buf, 2); - - return status; -} - -uint32_t WHS_I2C_EEprom_Read_Ch() -{ - uint32_t status= OK; - - status |= Select_Main_WHS_Mux_Channel(); - - status |= I2C_Read(I2C_ID_WHS_CARD, I2CEEPROM_ADDRESS + 1, WHS_struct.Read_WHS_EEPROM.Buf, Max_WHS_buf_size); - - return status; -} -uint32_t Test_WHS_EEPROM() -{ - uint32_t status= OK; - uint32_t i; - - WHS_Eeprom.bytes.SN = 0x12345678; - - WHS_Eeprom.bytes.Uint32_Spare[0] = 0xA123456A; - WHS_Eeprom.bytes.Uint32_Spare[1] = 0xB123456B; - WHS_Eeprom.bytes.Uint32_Spare[2] = 0xC123456C; - WHS_Eeprom.bytes.Uint32_Spare[3] = 0xD123456D; - WHS_Eeprom.bytes.Uint32_Spare[4] = 0xE123456E; - - WHS_Eeprom.bytes.Double_Spare[0] = 0xA789012A; - WHS_Eeprom.bytes.Double_Spare[1] = 0xB789012B; - WHS_Eeprom.bytes.Double_Spare[2] = 0xC789012C; - WHS_Eeprom.bytes.Double_Spare[3] = 0xD789012D; - WHS_Eeprom.bytes.Double_Spare[4] = 0xE789012E; - - status |= WHS_I2C_EEprom_Write_Ch(); - SysCtlDelay(5000000);//Must delay for at least 5 milli. !!! (See data sheet ) - status |= WHS_I2C_EEprom_Set_for_Read_Ch(); - status |= WHS_I2C_EEprom_Read_Ch(); - - if(status == 0) - { - for(i=0;i<Max_WHS_buf_size;i++) - { - if(WHS_struct.Read_WHS_EEPROM.Buf[i]!=WHS_Eeprom.Buf[i]) - status |= ERROR; - } - } - - return status; -} -*/ /** struct _StubWhsEEpromData uint32_t Header; { diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/I2C_WHS_Mux.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/I2C_WHS_Mux.c index 12be8f91f..a5d36a264 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/I2C_WHS_Mux.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/WHS_Card/I2C_WHS_Mux.c @@ -13,43 +13,6 @@ #include <Drivers/I2C_Communication/WHS_Card/I2C_WHS_Mux.h> #include "Drivers/I2C_Communication/WHS_Card/WHS_data.h" - - -/* -uint32_t Select_Main_WHS_Mux_Channel(bool chnl_stats, uint32_t chnl_number) -{ - uint32_t status= OK; - - static uint8_t Write_Buf; - - if (chnl_stats == TCA9548A_chnl_OPEN) // - { - Write_Buf = chnl_number; - } - else - { - Write_Buf = TCA9548A_All_chnl_CLOSE; - } - //Write_Buf[0] = 0x01 << 1;//Channel 1 - -// avi status = I2C_Write(I2C_ID_HEAD_CARD, I2C1_MAIN_MUX_TCA9548A_0xE0, &Write_Buf, 1); - - return status; -} - -uint32_t Select_Main_WHS_Mux_Channel_test() -{ - uint32_t status= OK; - - uint8_t Write_Buf[1]; - - Write_Buf[0] = 0x01 << 0;//Channel 0 - -//avi status = I2C_Write(I2C_ID_HEAD_CARD, I2C1_MAIN_MUX_TCA9548A_0xE0, Write_Buf, 1); - - return status; -} -*/ #include "Drivers/I2C_Communication/Head_Card/I2C_Head_Mux.h" uint32_t Select_Main_WHS_Mux_Channel() @@ -85,34 +48,3 @@ uint32_t Block_Main_WHS_Mux_Channel() return status; } - -/* -uint32_t Select_Main_WHS_Mux_Channel() -{ - uint32_t status= OK; - - uint8_t Write_Buf[1]; - - Block_Main_Head_Mux_Channel(); - - Write_Buf[0] = 0x01 << 1;//Channel 1 - - status = I2C_Write(I2C_ID_WHS_CARD, I2C2_MAIN_MUX_TCA9548A_0xE0, Write_Buf, 1); - - return status; -} - -uint32_t Block_Main_WHS_Mux_Channel() -{ - uint32_t status= OK; - - uint8_t Write_Buf[1]; - - Write_Buf[0] = 0x00;//Block all - - status = I2C_Write(I2C_ID_WHS_CARD, I2C2_MAIN_MUX_TCA9548A_0xE0, Write_Buf, 1); - - return status; -} -*/ - |
