diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-02-25 11:40:09 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-02-25 11:40:09 +0200 |
| commit | 602f49b2b0eb1f032f3dead60e8bf499ceca0a7b (patch) | |
| tree | a8481fa4b4805d3241dd692ca99ebede3ffc8449 /Software | |
| parent | d8e530e38d5ba089097ea58a994e001b7cccd1b0 (diff) | |
| parent | 76cb9a6e1a633d365da5ac26573b39297ba81e78 (diff) | |
| download | Tango-602f49b2b0eb1f032f3dead60e8bf499ceca0a7b.tar.gz Tango-602f49b2b0eb1f032f3dead60e8bf499ceca0a7b.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/_git/Tango
Diffstat (limited to 'Software')
9 files changed, 103 insertions, 27 deletions
diff --git a/Software/Embedded_SW/Embedded/Drivers/ADC_Sampling/ADC.c b/Software/Embedded_SW/Embedded/Drivers/ADC_Sampling/ADC.c index 3d6941668..8bd38a698 100644 --- a/Software/Embedded_SW/Embedded/Drivers/ADC_Sampling/ADC.c +++ b/Software/Embedded_SW/Embedded/Drivers/ADC_Sampling/ADC.c @@ -66,7 +66,7 @@ void ADCAcquireStop(void) //MillisecStop ADC_Data[adc_i] = ADC_GetReading(adc_i); */ -#include "ADC.h" + #include "include.h" #include <stdbool.h> @@ -78,7 +78,8 @@ void ADCAcquireStop(void) //MillisecStop #include <driverlib/rom_map.h> #include <driverlib/interrupt.h> - +#include "drivers/I2C_Communication/ADC_MUX/ADC_MUX.h" +#include "ADC.h" #include <inc/hw_memmap.h> #include <inc/hw_ints.h> @@ -544,5 +545,38 @@ uint8_t Calculate_Gas_Power_Consumption() // WHS return PPM; } +uint32_t Read_Dryer_Heaters_Current(HEATERS_CURRENT Heater_ID) // +{ + uint32_t Status = OK; + + uint32_t temp; + uint32_t TBD1 = 1;//TODO + uint32_t TBD2 = 1;//TODO + + if (Heaters_Current_Read_Enable[Heater_ID] == false) + return Heaters_Current[Heater_ID]; + switch(Heater_ID) + { + case DRYER_CURRENT_1: + temp = ADC_GetReading(CHAN_DRYER_CURRENT_1); + break; + case DRYER_CURRENT_2: + temp = ADC_GetReading(CHAN_DRYER_CURRENT_2); + break; + case DRYER_CURRENT_3: + temp = ADC_GetReading(CHAN_DRYER_CURRENT_3); + break; + default: + Status = ERROR; + break; + } + + Heaters_Current_Bits[Heater_ID] = temp; + #warning after updating the hardware need to add the correct formula + Heaters_Current[Heater_ID] = temp*TBD1/TBD2; + + return Status; + +} diff --git a/Software/Embedded_SW/Embedded/Drivers/ADC_Sampling/ADC.h b/Software/Embedded_SW/Embedded/Drivers/ADC_Sampling/ADC.h index 87d03091d..bacbe0a0d 100644 --- a/Software/Embedded_SW/Embedded/Drivers/ADC_Sampling/ADC.h +++ b/Software/Embedded_SW/Embedded/Drivers/ADC_Sampling/ADC.h @@ -3,6 +3,7 @@ #define DRIVERS_ADC_H_ #include <stdint.h> +#include "drivers/I2C_Communication/ADC_MUX/ADC_MUX.h" //***************************************************************************** // @@ -36,4 +37,6 @@ void ADC0SS0Handler(void); double Calculate_Pitot_Pressure() ; uint8_t Calculate_Gas_Power_Consumption(); +uint32_t Read_Dryer_Heaters_Current(HEATERS_CURRENT Heater_ID); + #endif /* DRIVERS_ADC_H_ */ diff --git a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.c b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.c index 502d0a81c..f8cfaefba 100644 --- a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.c +++ b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.c @@ -11,7 +11,7 @@ #include <DataDef.h> #include "modules/control/millisecTask.h" #include "modules/thread/thread.h" - +#include "delay.h" #include "FPGA_GPIO.h" #include "drivers/FPGA/FPGA.h" #include "StateMachines/Printing/PrintingSTM.h" diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/ADC_MUX/ADC_MUX.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/ADC_MUX/ADC_MUX.c index 2e5e8f18e..4599df653 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/ADC_MUX/ADC_MUX.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/ADC_MUX/ADC_MUX.c @@ -21,6 +21,8 @@ #include "driverlib/i2c.h" #include "drivers/I2C_Communication/I2C.h" +#include "drivers/ADC_Sampling/adc.h" + #include "ADC_MUX.h" bool MidTank_Pressure_Read_Enable[8] = {true,true,true,true,true,true,true,true}; @@ -242,24 +244,38 @@ double Get_MidTank_Pressure_Sensor(MidTank_t MidTank_ID) //0-7 ///////////////////////// Head_MixChip_Heaters_Current ////////////////////////////// -bool Head_MixChip_Heaters_Current_Read_Enable[6] = {true,true,true,true,true,true}; +bool Heaters_Current_Read_Enable[9] = {true,true,true,true,true,true,true,true,true}; -double Head_MixChip_Heaters_Current[6]; +double Heaters_Current[9]; -uint32_t Head_MixChip_Heaters_Current_Bits[6];//just for debug +uint32_t Heaters_Current_Bits[9];//just for debug -void Enable_Head_MixChip_Heaters_Current_Reading(HEAD_MIXCHIP_HEATERS_CURRENT Heater_ID) //0-5 +void Enable_Reading_Heaters_Current(HEATERS_CURRENT Heater_ID) //0-8 { assert (Heater_ID<NUM_OF_HEATERS); - Head_MixChip_Heaters_Current_Read_Enable[Heater_ID] = true; + Heaters_Current_Read_Enable[Heater_ID] = true; } -void Disable_Head_MixChip_Heaters_Current_Reading(HEAD_MIXCHIP_HEATERS_CURRENT Heater_ID) //0-5 +void Disable_Reading_Heaters_Current(HEATERS_CURRENT Heater_ID) //0-8 +{ + assert (Heater_ID<NUM_OF_HEATERS); + Heaters_Current_Read_Enable[Heater_ID] = false; +} + +uint32_t Read_Heaters_Current(HEATERS_CURRENT Heater_ID) //0-8 { + uint32_t Status = OK; + assert (Heater_ID<NUM_OF_HEATERS); - Head_MixChip_Heaters_Current_Read_Enable[Heater_ID] = false; + + if(Heater_ID < DRYER_CURRENT_1) + Status = Read_Head_MixChip_Heaters_Current(Heater_ID); + else + Status = Read_Dryer_Heaters_Current(Heater_ID); + + return Status; } -uint32_t Read_Head_MixChip_Heaters_Current(HEAD_MIXCHIP_HEATERS_CURRENT Heater_ID) //0-5 +uint32_t Read_Head_MixChip_Heaters_Current(HEATERS_CURRENT Heater_ID) //0-5 { uint32_t Status = OK; uint32_t I2C_Slave_Add; @@ -270,8 +286,8 @@ uint32_t Read_Head_MixChip_Heaters_Current(HEAD_MIXCHIP_HEATERS_CURRENT Heater_I #warning to update all the Resistors to 0.025 Ohm after changing the hardware://there is overflow in Dyer Head zone 4 with resistor 0.05 const double Resistor[NUM_OF_HEATERS] = {0.05, 0.025, 0.025, 0.05, 0.025, 0.025}; - if (Head_MixChip_Heaters_Current_Read_Enable[Heater_ID] == false) - return Head_MixChip_Heaters_Current[Heater_ID]; + if (Heaters_Current_Read_Enable[Heater_ID] == false) + return Heaters_Current[Heater_ID]; switch(Heater_ID) { @@ -315,15 +331,15 @@ uint32_t Read_Head_MixChip_Heaters_Current(HEAD_MIXCHIP_HEATERS_CURRENT Heater_I //A2D is 12 bits and his reference is 2.5V . //I=D2A output *0.125/(4095*R) - Head_MixChip_Heaters_Current_Bits[Heater_ID] = VsampleInBits;//just for debug + Heaters_Current_Bits[Heater_ID] = VsampleInBits;//just for debug - Head_MixChip_Heaters_Current[Heater_ID] = VsampleInBits * 0.125 / (4096*Resistor[Heater_ID]); + Heaters_Current[Heater_ID] = VsampleInBits * 0.125 / (4096*Resistor[Heater_ID]); return Status; } -double Get_Head_MixChip_Heaters_Current(HEAD_MIXCHIP_HEATERS_CURRENT Heater_ID) //0-5 +double Get_Heaters_Current(HEATERS_CURRENT Heater_ID) //0-8 { assert (Heater_ID<NUM_OF_HEATERS); - return Head_MixChip_Heaters_Current[Heater_ID]; + return Heaters_Current[Heater_ID]; } diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/ADC_MUX/ADC_MUX.h b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/ADC_MUX/ADC_MUX.h index 99ce4a627..ff0c0ca33 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/ADC_MUX/ADC_MUX.h +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/ADC_MUX/ADC_MUX.h @@ -31,8 +31,17 @@ typedef enum HEAD_ZONE_4, HEAD_ZONE_5_6, MIXCHIP, + DRYER_CURRENT_1, + DRYER_CURRENT_2, + DRYER_CURRENT_3, NUM_OF_HEATERS, -} HEAD_MIXCHIP_HEATERS_CURRENT; +} HEATERS_CURRENT; + +extern bool Heaters_Current_Read_Enable[9]; + +extern double Heaters_Current[9]; + +extern uint32_t Heaters_Current_Bits[9]; uint32_t Read_MidTank_Pressure_Sensor(MidTank_t MidTank_ID); double Get_MidTank_Pressure_Sensor(MidTank_t MidTank_ID); //0-7 @@ -41,9 +50,9 @@ void MidTankPressureCorrection(double Offset); void Enable_MidTank_Pressure_Reading(MidTank_t MidTank_ID); //0-7 void Disable_MidTank_Pressure_Reading(MidTank_t MidTank_ID); //0-7 -void Enable_Head_MixChip_Heaters_Current_Reading(HEAD_MIXCHIP_HEATERS_CURRENT Heater_ID); -void Disable_Head_MixChip_Heaters_Current_Reading(HEAD_MIXCHIP_HEATERS_CURRENT Heater_ID); //0-5 -uint32_t Read_Head_MixChip_Heaters_Current(HEAD_MIXCHIP_HEATERS_CURRENT Heater_ID); -double Get_Head_MixChip_Heaters_Current(HEAD_MIXCHIP_HEATERS_CURRENT Heater_ID); +void Enable_Head_MixChip_Heaters_Current_Reading(HEATERS_CURRENT Heater_ID); +void Disable_Head_MixChip_Heaters_Current_Reading(HEATERS_CURRENT Heater_ID); //0-5 +uint32_t Read_Head_MixChip_Heaters_Current(HEATERS_CURRENT Heater_ID); +double Get_Head_MixChip_Heaters_Current(HEATERS_CURRENT Heater_ID); #endif /* DRIVERS_I2C_COMMUNICATION_ADC_MUX_ADC_MUX_H_ */ diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/RFID_NFC/NFC_I2C/NFC_I2C.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/RFID_NFC/NFC_I2C/NFC_I2C.c index 87676ff6b..03fbb3aa2 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/RFID_NFC/NFC_I2C/NFC_I2C.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/RFID_NFC/NFC_I2C/NFC_I2C.c @@ -12,7 +12,8 @@ #include <DataDef.h> #include "driverlib/sysctl.h" #include <Drivers/I2C_Communication/I2C.h> - +#include "delay.h" +#include <Drivers/I2C_Communication/RFID_NFC/PN7150/PN7150.h> #include <Drivers/I2C_Communication/RFID_NFC/NFC_I2C/Test_NFC.h> #define MUX_I2C_BASE 4 @@ -136,9 +137,9 @@ uint32_t I2C_NFC_Test() */ -uint32_t I2C_NFC_Test() +void I2C_NFC_Test() { - uint32_t Status = OK; + Reset_NFC_Device(CART_1); delayUs(10); @@ -156,11 +157,12 @@ uint32_t I2C_NFC_Test() NCISetConfig_NFC(); NxpNci_StartDiscovery(); - I2C_NFC_Set_For_Read_Ch(); + I2C_NFC_Set_For_Read_Ch(); SysCtlDelay(5); I2C_NFC_Read_Ch(14); delayms(5); } + } diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/RFID_NFC/NFC_I2C/NFC_I2C.h b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/RFID_NFC/NFC_I2C/NFC_I2C.h index 3e96a0016..ebc59575a 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/RFID_NFC/NFC_I2C/NFC_I2C.h +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/RFID_NFC/NFC_I2C/NFC_I2C.h @@ -8,7 +8,7 @@ #ifndef DRIVERS_I2C_COMMUNICATION_RFID_NFC_NFC_I2C_NFC_I2C_H_ #define DRIVERS_I2C_COMMUNICATION_RFID_NFC_NFC_I2C_NFC_I2C_H_ -uint32_t I2C_NFC_Test(); +void I2C_NFC_Test(); uint32_t Enable_I2C_NFC_Channel(PANEL_BUTTON_OR_CRAT_ID Cart_ID); uint32_t I2C_NFC_Write_Ch(uint8_t No_BytesToWrite ); uint32_t I2C_NFC_Set_For_Read_Ch(); @@ -16,4 +16,5 @@ uint32_t I2C_NFC_Read_Ch(uint8_t No_BytesToRead ); + #endif /* DRIVERS_I2C_COMMUNICATION_RFID_NFC_NFC_I2C_NFC_I2C_H_ */ diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/RFID_NFC/NFC_I2C/Test_NFC.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/RFID_NFC/NFC_I2C/Test_NFC.c index a08c76a4f..8b5ea642d 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/RFID_NFC/NFC_I2C/Test_NFC.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/RFID_NFC/NFC_I2C/Test_NFC.c @@ -6,6 +6,8 @@ */ #include "include.h" #include <Drivers/I2C_Communication/RFID_NFC/NFC_I2C/Test_NFC.h> +#include <Drivers/I2C_Communication/RFID_NFC/NFC_I2C/NFC_I2C.h> +#include "delay.h" extern uint8_t NFC_I2C_Read_buf[MaxNoBytesToRead]; extern uint8_t NFC_I2C_Write_Buf[MaxNoBytesToWrite]; diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/RFID_NFC/NFC_I2C/Test_NFC.h b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/RFID_NFC/NFC_I2C/Test_NFC.h index 1a02f1dd1..18f488703 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/RFID_NFC/NFC_I2C/Test_NFC.h +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/RFID_NFC/NFC_I2C/Test_NFC.h @@ -9,6 +9,15 @@ #define MaxNoBytesToRead 7// #define MaxNoBytesToWrite 100// +uint32_t NCICoreReset(); +uint32_t NCICoreInit(); +uint32_t NCIDiscoverMap(); +uint32_t NCIRouting(); +uint32_t NCISetConfig_NFCA_SELRSP(); +uint32_t NCISetConfig_NFC(); +uint32_t NxpNci_StartDiscovery(); +uint32_t NCIProprietary(); + //https://community.nxp.com/thread/434748 /* //NCICoreReset [ CORE_RESET_CMD] |
