Clean more
							parent
							
								
									5db1783db5
								
							
						
					
					
						commit
						4606a25db4
					
				| @ -1,36 +0,0 @@ | ||||
| /*
 | ||||
|  * HeaderCPU.h | ||||
|  * | ||||
|  *      Author: Aleksey Gerasimenko | ||||
|  *      gerasimenko.aleksey.n@gmail.com | ||||
|  */ | ||||
| 
 | ||||
| #ifndef PERIPHERAL_HEADERCPU_H_ | ||||
| #define PERIPHERAL_HEADERCPU_H_ | ||||
| 
 | ||||
| #include "DSP28335/CPUBase.h" | ||||
| #include "DSP28335/ADC.h" | ||||
| #include "DSP28335/CANBUS.h" | ||||
| #include "DSP28335/CPU.h" | ||||
| #include "DSP28335/CPUBase.h" | ||||
| #include "DSP28335/CPUTimers.h" | ||||
| #include "DSP28335/DiscreteOutputs.h" | ||||
| #include "DSP28335/ECANA.h" | ||||
| #include "DSP28335/ECANB.h" | ||||
| #include "DSP28335/EPWM.h" | ||||
| #include "DSP28335/EQEP1.h" | ||||
| #include "DSP28335/FLASH.h" | ||||
| #include "DSP28335/GPIO.h" | ||||
| #include "DSP28335/MeasureTimeInterval.h" | ||||
| #include "DSP28335/MeasureTimePeriod.h" | ||||
| #include "DSP28335/MemoryZone.h" | ||||
| #include "DSP28335/MemoryZone0.h" | ||||
| #include "DSP28335/MemoryZone7.h" | ||||
| #include "DSP28335/SCIA.h" | ||||
| #include "DSP28335/SCIB.h" | ||||
| #include "DSP28335/SCIBase.h" | ||||
| #include "DSP28335/SCIC.h" | ||||
| #include "DSP28335/XINTF.h" | ||||
| 
 | ||||
| 
 | ||||
| #endif /* PERIPHERAL_HEADERCPU_H_ */ | ||||
| @ -1,19 +0,0 @@ | ||||
| /*
 | ||||
|  * HeaderINTERFACE.h | ||||
|  * | ||||
|  *      Author: Aleksey Gerasimenko | ||||
|  *      gerasimenko.aleksey.n@gmail.com | ||||
|  */ | ||||
| 
 | ||||
| #ifndef RUDRIVEFRAMEWORK_HEADERINTERFACE_H_ | ||||
| #define RUDRIVEFRAMEWORK_HEADERINTERFACE_H_ | ||||
| 
 | ||||
| 
 | ||||
| #include "INTERFACE/CANBUSDataStructures.h" | ||||
| #include "INTERFACE/CANOPENParameters.h" | ||||
| #include "INTERFACE/CANOpenServer.h" | ||||
| #include "INTERFACE/DatabaseConfiguration.h" | ||||
| #include "INTERFACE/SDO.h" | ||||
| 
 | ||||
| 
 | ||||
| #endif /* RUDRIVEFRAMEWORK_HEADERINTERFACE_H_ */ | ||||
| @ -1,32 +0,0 @@ | ||||
| /*
 | ||||
|  * HeaderModbusRTU.h | ||||
|  * | ||||
|  *      Author: Aleksey Gerasimenko | ||||
|  *      gerasimenko.aleksey.n@gmail.com | ||||
|  */ | ||||
| 
 | ||||
| #ifndef RUDRIVEFRAMEWORK_HEADERMODBUSRTU_H_ | ||||
| #define RUDRIVEFRAMEWORK_HEADERMODBUSRTU_H_ | ||||
| 
 | ||||
| #include "MODBUSRTU/ModbusRTUBuffer.h" | ||||
| #include "MODBUSRTU/ModbusRTUBufferCoil.h" | ||||
| #include "MODBUSRTU/ModbusRTUBufferInputCoil.h" | ||||
| #include "MODBUSRTU/ModbusRTUBufferInputRegister.h" | ||||
| #include "MODBUSRTU/ModbusRTUBufferOutputCoil.h" | ||||
| #include "MODBUSRTU/ModbusRTUBufferOutputRegister.h" | ||||
| #include "MODBUSRTU/ModbusRTUBufferRegister.h" | ||||
| #include "MODBUSRTU/ModbusRTUCRC.h" | ||||
| #include "MODBUSRTU/ModbusRTUDefines.h" | ||||
| #include "MODBUSRTU/ModbusRTUIntervalMeasure.h" | ||||
| #include "MODBUSRTU/ModbusRTURegister.h" | ||||
| #include "MODBUSRTU/ModbusRTUSlave.h" | ||||
| #include "MODBUSRTU/ModbusRTUTableCoil.h" | ||||
| #include "MODBUSRTU/ModbusRTUTableRegister.h" | ||||
| #include "MODBUSRTU/ModbusRTUTableUnit.h" | ||||
| #include "MODBUSRTU/ModbusRTUTransceiver.h" | ||||
| #include "MODBUSRTU/ModbusRTUVariant.h" | ||||
| #include "MODBUSRTU/ModbusRTUTransceiverBase.h" | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| #endif /* RUDRIVEFRAMEWORK_HEADERMODBUSRTU_H_ */ | ||||
| @ -1,26 +0,0 @@ | ||||
| /*
 | ||||
|  * HeaderPeriphery.h | ||||
|  * | ||||
|  *      Author: Aleksey Gerasimenko | ||||
|  *      gerasimenko.aleksey.n@gmail.com | ||||
|  */ | ||||
| 
 | ||||
| #ifndef PERIPHERY_HEADERPERIPHERY_H_ | ||||
| #define PERIPHERY_HEADERPERIPHERY_H_ | ||||
| 
 | ||||
| 
 | ||||
| #include "PERIPHERY/AnalogFault.h" | ||||
| #include "PERIPHERY/DigitalIO.h" | ||||
| #include "PERIPHERY/ExtADC.h" | ||||
| #include "PERIPHERY/ExtDAC.h" | ||||
| #include "PERIPHERY/IIIPeriphery.h" | ||||
| #include "PERIPHERY/IPeriphery.h" | ||||
| #include "PERIPHERY/Periphery.h" | ||||
| #include "PERIPHERY/PeripheryMap.h" | ||||
| #include "PERIPHERY/PWMABCInterace.h" | ||||
| #include "PERIPHERY/PWMInterface.h" | ||||
| #include "PERIPHERY/PWMSInterace.h" | ||||
| #include "PERIPHERY/COMMBoard.h" | ||||
| 
 | ||||
| 
 | ||||
| #endif /* PERIPHERY_HEADERPERIPHERY_H_ */ | ||||
| @ -1,37 +0,0 @@ | ||||
| /*
 | ||||
|  * MultiPhaseDafaults.h | ||||
|  * | ||||
|  *      Author: Aleksey Gerasimenko | ||||
|  *      gerasimenko.aleksey.n@gmail.com | ||||
|  */ | ||||
| 
 | ||||
| #ifndef RUDRIVEFRAMEWORK_MULTIPHASEDAFAULTS_H_ | ||||
| #define RUDRIVEFRAMEWORK_MULTIPHASEDAFAULTS_H_ | ||||
| 
 | ||||
| 
 | ||||
| #define MULTI_PHASE_PWM_FREQUENCY              (float)500 | ||||
| #define MULTI_PHASE_ADC_ISR_QUANTITY           (uint16_t)2 | ||||
| #define MULTI_PHASE_ADC_ISR_OFFSET_RELATIVE    (float)FP_ZERO | ||||
| #define MULTI_PHASE_CASCADE_QUANTITY           (uint16_t)1 | ||||
| #define MULTI_PHASE_CELL_QUANTITY              (uint16_t)1 | ||||
| #define MULTI_PHASE_CELL_QANTITY_IN_CASCADE_00 (uint16_t)1 | ||||
| #define MULTI_PHASE_CELL_QANTITY_IN_CASCADE_01 (uint16_t)0 | ||||
| #define MULTI_PHASE_CELL_QANTITY_IN_CASCADE_02 (uint16_t)0 | ||||
| #define MULTI_PHASE_CELL_QANTITY_IN_CASCADE_03 (uint16_t)0 | ||||
| #define MULTI_PHASE_CELL_QANTITY_IN_CASCADE_04 (uint16_t)0 | ||||
| #define MULTI_PHASE_CELL_QANTITY_IN_CASCADE_05 (uint16_t)0 | ||||
| #define MULTI_PHASE_CELL_QANTITY_IN_CASCADE_06 (uint16_t)0 | ||||
| #define MULTI_PHASE_CELL_QANTITY_IN_CASCADE_07 (uint16_t)0 | ||||
| #define MULTI_PHASE_CELL_QANTITY_IN_CASCADE_08 (uint16_t)0 | ||||
| #define MULTI_PHASE_CELL_QANTITY_IN_CASCADE_09 (uint16_t)0 | ||||
| #define MULTI_PHASE_CELL_QANTITY_IN_CASCADE_10 (uint16_t)0 | ||||
| #define MULTI_PHASE_CELL_QANTITY_IN_CASCADE_11 (uint16_t)0 | ||||
| #define MULTI_PHASE_CELL_QANTITY_IN_CASCADE_12 (uint16_t)0 | ||||
| #define MULTI_PHASE_CELL_QANTITY_IN_CASCADE_13 (uint16_t)0 | ||||
| #define MULTI_PHASE_CELL_QANTITY_IN_CASCADE_14 (uint16_t)0 | ||||
| #define MULTI_PHASE_CELL_QANTITY_IN_CASCADE_15 (uint16_t)0 | ||||
| #define MULTI_PHASE_CELL_QANTITY_IN_CASCADE_16 (uint16_t)0 | ||||
| #define MULTI_PHASE_CELL_QANTITY_IN_CASCADE_17 (uint16_t)0 | ||||
| 
 | ||||
| 
 | ||||
| #endif /* RUDRIVEFRAMEWORK_MULTIPHASEDAFAULTS_H_ */ | ||||
| @ -1,280 +0,0 @@ | ||||
| /*
 | ||||
|  * ADCCTRL.cpp | ||||
|  * | ||||
|  *      Author: Aleksey Gerasimenko | ||||
|  *      gerasimenko.aleksey.n@gmail.com | ||||
|  */ | ||||
| 
 | ||||
| #include "SYSCTRL/ADCCTRL.h" | ||||
| 
 | ||||
| namespace SYSCTRL | ||||
| { | ||||
| //CONSTRUCTOR
 | ||||
| ADCCTRL::ADCCTRL(): | ||||
|         m_time_sample(-1.0), | ||||
|         m_result_00(0), | ||||
|         m_result_01(0), | ||||
|         m_result_02(0), | ||||
|         m_result_03(0), | ||||
|         m_result_04(0), | ||||
|         m_result_05(0), | ||||
|         m_result_06(0), | ||||
|         m_result_07(0), | ||||
|         m_result_08(0), | ||||
|         m_result_09(0), | ||||
|         m_result_10(0), | ||||
|         m_result_11(0), | ||||
|         m_result_12(0), | ||||
|         m_result_13(0), | ||||
|         m_result_14(0), | ||||
|         m_result_15(0), | ||||
|         //
 | ||||
|         m_channel_00(0), | ||||
|         m_channel_01(0), | ||||
|         m_channel_02(0), | ||||
|         m_channel_03(0), | ||||
|         m_channel_04(0), | ||||
|         m_channel_05(0), | ||||
|         m_channel_06(0), | ||||
|         m_channel_07(0), | ||||
|         m_channel_08(0), | ||||
|         m_channel_09(0), | ||||
|         m_channel_10(0), | ||||
|         m_channel_11(0), | ||||
|         m_channel_12(0), | ||||
|         m_channel_13(0), | ||||
|         m_channel_14(0), | ||||
|         m_channel_15(0), | ||||
|         //
 | ||||
|         m_offset_00(0), | ||||
|         m_offset_01(0), | ||||
|         m_offset_02(0), | ||||
|         m_offset_03(0), | ||||
|         m_offset_04(0), | ||||
|         m_offset_05(0), | ||||
|         m_offset_06(0), | ||||
|         m_offset_07(0), | ||||
|         m_offset_08(0), | ||||
|         m_offset_09(0), | ||||
|         m_offset_10(0), | ||||
|         m_offset_11(0), | ||||
|         m_offset_12(0), | ||||
|         m_offset_13(0), | ||||
|         m_offset_14(0), | ||||
|         m_offset_15(0), | ||||
|         //
 | ||||
|         m_scale_channel_00(-1.0), | ||||
|         m_scale_channel_01(-1.0), | ||||
|         m_scale_channel_02(-1.0), | ||||
|         m_scale_channel_03(-1.0), | ||||
|         m_scale_channel_04(-1.0), | ||||
|         m_scale_channel_05(-1.0), | ||||
|         m_scale_channel_06(-1.0), | ||||
|         m_scale_channel_07(-1.0), | ||||
|         m_scale_channel_08(-1.0), | ||||
|         m_scale_channel_09(-1.0), | ||||
|         m_scale_channel_10(-1.0), | ||||
|         m_scale_channel_11(-1.0), | ||||
|         m_scale_channel_12(-1.0), | ||||
|         //
 | ||||
|         _read_adc_result(&SYSCTRL::ADCCTRL::_read_adc_result_undef) | ||||
| //
 | ||||
| {}//end CONSTRUCTOR
 | ||||
| 
 | ||||
| 
 | ||||
| void ADCCTRL::setup(const ADCCTRLSetup& setup) | ||||
| { | ||||
|     //
 | ||||
|     if(setup.time_sample > FP_ZERO) | ||||
|     { | ||||
|         m_time_sample = setup.time_sample; | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|         m_time_sample = -1.0; | ||||
|     } | ||||
|     //
 | ||||
| }//end
 | ||||
| //
 | ||||
| void ADCCTRL::configure(const ADCCTRLConfiguration& config) | ||||
| { | ||||
|     static bool _state_config = true; | ||||
| 
 | ||||
|     if(m_time_sample > FP_ZERO) | ||||
|     { | ||||
|         m_offset_00 = config.offset_00; | ||||
|         m_offset_01 = config.offset_01; | ||||
|         m_offset_02 = config.offset_02; | ||||
|         m_offset_03 = config.offset_03; | ||||
|         m_offset_04 = config.offset_04; | ||||
|         m_offset_05 = config.offset_05; | ||||
|         m_offset_06 = config.offset_06; | ||||
|         m_offset_07 = config.offset_07; | ||||
|         m_offset_08 = config.offset_08; | ||||
|         m_offset_09 = config.offset_09; | ||||
|         m_offset_10 = config.offset_10; | ||||
|         m_offset_11 = config.offset_11; | ||||
|         m_offset_12 = config.offset_12; | ||||
|         m_offset_13 = config.offset_13; | ||||
|         m_offset_14 = config.offset_14; | ||||
|         m_offset_15 = config.offset_15; | ||||
| 
 | ||||
|         m_scale_channel_00 = config.scale_current_net_a; | ||||
|         m_scale_channel_01 = config.scale_current_net_b; | ||||
|         m_scale_channel_02 = config.scale_current_net_c; | ||||
| 
 | ||||
|         m_scale_channel_03 = config.scale_current_load_a; | ||||
|         m_scale_channel_04 = config.scale_current_load_b; | ||||
|         m_scale_channel_05 = config.scale_current_load_c; | ||||
| 
 | ||||
|         m_scale_channel_06 = config.scale_voltage_net_a; | ||||
|         m_scale_channel_07 = config.scale_voltage_net_b; | ||||
|         m_scale_channel_08 = config.scale_voltage_net_c; | ||||
| 
 | ||||
|         m_scale_channel_09 = config.scale_voltage_load_a; | ||||
|         m_scale_channel_10 = config.scale_voltage_load_b; | ||||
|         m_scale_channel_11 = config.scale_voltage_load_c; | ||||
| 
 | ||||
|         m_scale_channel_12 = config.scale_voltage_dc; | ||||
| 
 | ||||
|         _state_config &= m_offset_00 >= 0 ? true : false; | ||||
|         _state_config &= m_offset_01 >= 0 ? true : false; | ||||
|         _state_config &= m_offset_02 >= 0 ? true : false; | ||||
|         _state_config &= m_offset_03 >= 0 ? true : false; | ||||
|         _state_config &= m_offset_04 >= 0 ? true : false; | ||||
|         _state_config &= m_offset_05 >= 0 ? true : false; | ||||
|         _state_config &= m_offset_06 >= 0 ? true : false; | ||||
|         _state_config &= m_offset_07 >= 0 ? true : false; | ||||
|         _state_config &= m_offset_08 >= 0 ? true : false; | ||||
|         _state_config &= m_offset_09 >= 0 ? true : false; | ||||
|         _state_config &= m_offset_10 >= 0 ? true : false; | ||||
|         _state_config &= m_offset_11 >= 0 ? true : false; | ||||
|         _state_config &= m_offset_12 >= 0 ? true : false; | ||||
|         _state_config &= m_offset_13 >= 0 ? true : false; | ||||
|         _state_config &= m_offset_14 >= 0 ? true : false; | ||||
|         _state_config &= m_offset_15 >= 0 ? true : false; | ||||
| 
 | ||||
|         _state_config &= m_scale_channel_00 > FP_ZERO ? true : false; | ||||
|         _state_config &= m_scale_channel_01 > FP_ZERO ? true : false; | ||||
|         _state_config &= m_scale_channel_02 > FP_ZERO ? true : false; | ||||
| 
 | ||||
|         _state_config &= m_scale_channel_03 > FP_ZERO ? true : false; | ||||
|         _state_config &= m_scale_channel_04 > FP_ZERO ? true : false; | ||||
|         _state_config &= m_scale_channel_05 > FP_ZERO ? true : false; | ||||
| 
 | ||||
|         _state_config &= m_scale_channel_06 > FP_ZERO ? true : false; | ||||
|         _state_config &= m_scale_channel_07 > FP_ZERO ? true : false; | ||||
|         _state_config &= m_scale_channel_08 > FP_ZERO ? true : false; | ||||
| 
 | ||||
|         _state_config &= m_scale_channel_09 > FP_ZERO ? true : false; | ||||
|         _state_config &= m_scale_channel_10 > FP_ZERO ? true : false; | ||||
|         _state_config &= m_scale_channel_11 > FP_ZERO ? true : false; | ||||
| 
 | ||||
|         _state_config &= m_scale_channel_12 > FP_ZERO ? true : false; | ||||
| 
 | ||||
|         if(_state_config) | ||||
|         { | ||||
|             _read_adc_result = &SYSCTRL::ADCCTRL::_read_adc_result_operational; | ||||
|             //
 | ||||
|         }//end if
 | ||||
|         //
 | ||||
|     }//end if
 | ||||
|     //
 | ||||
| }//end
 | ||||
| //
 | ||||
| #pragma CODE_SECTION("ramfuncs"); | ||||
| void ADCCTRL::read_adc_result() | ||||
| { | ||||
|     (this->*_read_adc_result)(); | ||||
|     //
 | ||||
| }//end
 | ||||
| //
 | ||||
| #pragma CODE_SECTION("ramfuncs"); | ||||
| void ADCCTRL::_read_adc_result_undef() | ||||
| {}//end
 | ||||
| //
 | ||||
| #pragma CODE_SECTION("ramfuncs"); | ||||
| void ADCCTRL::_read_adc_result_operational() | ||||
| { | ||||
|     m_result_00 = (Uint16)(AdcRegs.ADCRESULT0>>4); //INA
 | ||||
|     m_result_01 = (Uint16)(AdcRegs.ADCRESULT1>>4); //INB
 | ||||
|     m_result_02 = (Uint16)(AdcRegs.ADCRESULT2>>4); //INC
 | ||||
|     m_result_03 = (Uint16)(AdcRegs.ADCRESULT3>>4); //ILA
 | ||||
|     m_result_04 = (Uint16)(AdcRegs.ADCRESULT4>>4); //ILB
 | ||||
|     m_result_05 = (Uint16)(AdcRegs.ADCRESULT5>>4); //ILC
 | ||||
|     m_result_06 = (Uint16)(AdcRegs.ADCRESULT6>>4); //UNA
 | ||||
|     m_result_07 = (Uint16)(AdcRegs.ADCRESULT7>>4); //UNB
 | ||||
|     m_result_08 = (Uint16)(AdcRegs.ADCRESULT8>>4); //UNC
 | ||||
|     m_result_09 = (Uint16)(AdcRegs.ADCRESULT9>>4); //ULA
 | ||||
|     m_result_10 = (Uint16)(AdcRegs.ADCRESULT10>>4); //ULB
 | ||||
|     m_result_11 = (Uint16)(AdcRegs.ADCRESULT11>>4); //ULC
 | ||||
|     m_result_12 = (Uint16)(AdcRegs.ADCRESULT12>>4); //UDC
 | ||||
|     m_result_13 = (Uint16)(AdcRegs.ADCRESULT13>>4); //
 | ||||
|     m_result_14 = (Uint16)(AdcRegs.ADCRESULT14>>4); //
 | ||||
|     m_result_15 = (Uint16)(AdcRegs.ADCRESULT15>>4); //
 | ||||
|     //
 | ||||
|     m_channel_00 = (int16)((int16)m_result_00 - (int16)m_offset_00); | ||||
|     m_channel_01 = (int16)((int16)m_result_01 - (int16)m_offset_01); | ||||
|     m_channel_02 = (int16)((int16)m_result_02 - (int16)m_offset_02); | ||||
|     m_channel_03 = (int16)((int16)m_result_03 - (int16)m_offset_03); | ||||
|     m_channel_04 = (int16)((int16)m_result_04 - (int16)m_offset_04); | ||||
|     m_channel_05 = (int16)((int16)m_result_05 - (int16)m_offset_05); | ||||
|     m_channel_06 = (int16)((int16)m_result_06 - (int16)m_offset_06); | ||||
|     m_channel_07 = (int16)((int16)m_result_07 - (int16)m_offset_07); | ||||
|     m_channel_08 = (int16)((int16)m_result_08 - (int16)m_offset_08); | ||||
|     m_channel_09 = (int16)((int16)m_result_09 - (int16)m_offset_09); | ||||
|     m_channel_10 = (int16)((int16)m_result_10 - (int16)m_offset_10); | ||||
|     m_channel_11 = (int16)((int16)m_result_11 - (int16)m_offset_11); | ||||
|     m_channel_12 = (int16)((int16)m_result_12 - (int16)m_offset_12); | ||||
|     m_channel_13 = (int16)((int16)m_result_13 - (int16)m_offset_13); | ||||
|     m_channel_14 = (int16)((int16)m_result_14 - (int16)m_offset_14); | ||||
|     m_channel_15 = (int16)((int16)m_result_15 - (int16)m_offset_15); | ||||
|     //
 | ||||
| }//end
 | ||||
| //
 | ||||
| #pragma CODE_SECTION("ramfuncs"); | ||||
| void ADCCTRL::get_current_net(float& current_net_a, float& current_net_b, float& current_net_c) | ||||
| { | ||||
|     current_net_a = m_scale_channel_00 * (float)m_channel_00; | ||||
|     current_net_b = m_scale_channel_01 * (float)m_channel_01; | ||||
|     current_net_c = m_scale_channel_02 * (float)m_channel_02; | ||||
|     //
 | ||||
| }//end
 | ||||
| //
 | ||||
| #pragma CODE_SECTION("ramfuncs"); | ||||
| void ADCCTRL::get_current_load(float& current_load_a, float& current_load_b, float& current_load_c) | ||||
| { | ||||
|     current_load_a = m_scale_channel_03 * (float)m_channel_03; | ||||
|     current_load_b = m_scale_channel_04 * (float)m_channel_04; | ||||
|     current_load_c = m_scale_channel_05 * (float)m_channel_05; | ||||
|     //
 | ||||
| }//end
 | ||||
| //
 | ||||
| #pragma CODE_SECTION("ramfuncs"); | ||||
| void ADCCTRL::get_voltage_net(float& voltage_net_a, float& voltage_net_b, float& voltage_net_c) | ||||
| { | ||||
|     voltage_net_a = m_scale_channel_06 * (float)m_channel_06; | ||||
|     voltage_net_b = m_scale_channel_07 * (float)m_channel_07; | ||||
|     voltage_net_c = m_scale_channel_08 * (float)m_channel_08; | ||||
|     //
 | ||||
| }//end
 | ||||
| //
 | ||||
| #pragma CODE_SECTION("ramfuncs"); | ||||
| void ADCCTRL::get_voltage_load(float& voltage_load_a, float& voltage_load_b, float& voltage_load_c) | ||||
| { | ||||
|     voltage_load_a = m_scale_channel_09 * (float)m_channel_09; | ||||
|     voltage_load_b = m_scale_channel_10 * (float)m_channel_10; | ||||
|     voltage_load_c = m_scale_channel_11 * (float)m_channel_11; | ||||
|     //
 | ||||
| }//end
 | ||||
| //
 | ||||
| #pragma CODE_SECTION("ramfuncs"); | ||||
| void ADCCTRL::get_voltage_dc(float& voltage_dc) | ||||
| { | ||||
|     voltage_dc = m_scale_channel_12 * (float)m_channel_12; | ||||
|     //
 | ||||
| }//end
 | ||||
| //
 | ||||
| 
 | ||||
| 
 | ||||
| } /* namespace HAL */ | ||||
| @ -1,183 +0,0 @@ | ||||
| /*
 | ||||
|  * ADCCTRL.h | ||||
|  * | ||||
|  *      Author: Aleksey Gerasimenko | ||||
|  *      gerasimenko.aleksey.n@gmail.com | ||||
|  */ | ||||
| 
 | ||||
| #include <cmath> | ||||
| //#include <math.h>
 | ||||
| #include <stdint.h> | ||||
| 
 | ||||
| #include "F28335/DSP28x_Project.h" | ||||
| 
 | ||||
| #ifndef SYSCTRL_ADCCTRL_H_ | ||||
| #define SYSCTRL_ADCCTRL_H_ | ||||
| 
 | ||||
| namespace SYSCTRL | ||||
| { | ||||
| 
 | ||||
| struct ADCCTRLSetup | ||||
| { | ||||
|     float time_sample; | ||||
|     ADCCTRLSetup(): | ||||
|         time_sample(-1.0) | ||||
|     {} | ||||
| };//end ADCCTRLSetup
 | ||||
| 
 | ||||
| struct ADCCTRLConfiguration | ||||
| { | ||||
|     int16 offset_00; | ||||
|     int16 offset_01; | ||||
|     int16 offset_02; | ||||
|     int16 offset_03; | ||||
|     int16 offset_04; | ||||
|     int16 offset_05; | ||||
|     int16 offset_06; | ||||
|     int16 offset_07; | ||||
|     int16 offset_08; | ||||
|     int16 offset_09; | ||||
|     int16 offset_10; | ||||
|     int16 offset_11; | ||||
|     int16 offset_12; | ||||
|     int16 offset_13; | ||||
|     int16 offset_14; | ||||
|     int16 offset_15; | ||||
|     float scale_current_net_a; | ||||
|     float scale_current_net_b; | ||||
|     float scale_current_net_c; | ||||
|     float scale_current_load_a; | ||||
|     float scale_current_load_b; | ||||
|     float scale_current_load_c; | ||||
|     float scale_voltage_net_a; | ||||
|     float scale_voltage_net_b; | ||||
|     float scale_voltage_net_c; | ||||
|     float scale_voltage_load_a; | ||||
|     float scale_voltage_load_b; | ||||
|     float scale_voltage_load_c; | ||||
|     float scale_voltage_dc; | ||||
|     ADCCTRLConfiguration(): | ||||
|         offset_00(0), | ||||
|         offset_01(0), | ||||
|         offset_02(0), | ||||
|         offset_03(0), | ||||
|         offset_04(0), | ||||
|         offset_05(0), | ||||
|         offset_06(0), | ||||
|         offset_07(0), | ||||
|         offset_08(0), | ||||
|         offset_09(0), | ||||
|         offset_10(0), | ||||
|         offset_11(0), | ||||
|         offset_12(0), | ||||
|         offset_13(0), | ||||
|         offset_14(0), | ||||
|         offset_15(0), | ||||
|         scale_current_net_a(-1.0), | ||||
|         scale_current_net_b(-1.0), | ||||
|         scale_current_net_c(-1.0), | ||||
|         scale_current_load_a(-1.0), | ||||
|         scale_current_load_b(-1.0), | ||||
|         scale_current_load_c(-1.0), | ||||
|         scale_voltage_net_a(-1.0), | ||||
|         scale_voltage_net_b(-1.0), | ||||
|         scale_voltage_net_c(-1.0), | ||||
|         scale_voltage_load_a(-1.0), | ||||
|         scale_voltage_load_b(-1.0), | ||||
|         scale_voltage_load_c(-1.0), | ||||
|         scale_voltage_dc(-1.0) | ||||
|     {} | ||||
| };//ADCCTRLConfiguration
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| class ADCCTRL | ||||
| { | ||||
| private: | ||||
|     float m_time_sample; | ||||
| private: | ||||
|     int16 m_result_00; | ||||
|     int16 m_result_01; | ||||
|     int16 m_result_02; | ||||
|     int16 m_result_03; | ||||
|     int16 m_result_04; | ||||
|     int16 m_result_05; | ||||
|     int16 m_result_06; | ||||
|     int16 m_result_07; | ||||
|     int16 m_result_08; | ||||
|     int16 m_result_09; | ||||
|     int16 m_result_10; | ||||
|     int16 m_result_11; | ||||
|     int16 m_result_12; | ||||
|     int16 m_result_13; | ||||
|     int16 m_result_14; | ||||
|     int16 m_result_15; | ||||
| private: | ||||
|     int16 m_channel_00; | ||||
|     int16 m_channel_01; | ||||
|     int16 m_channel_02; | ||||
|     int16 m_channel_03; | ||||
|     int16 m_channel_04; | ||||
|     int16 m_channel_05; | ||||
|     int16 m_channel_06; | ||||
|     int16 m_channel_07; | ||||
|     int16 m_channel_08; | ||||
|     int16 m_channel_09; | ||||
|     int16 m_channel_10; | ||||
|     int16 m_channel_11; | ||||
|     int16 m_channel_12; | ||||
|     int16 m_channel_13; | ||||
|     int16 m_channel_14; | ||||
|     int16 m_channel_15; | ||||
| private: | ||||
|     int16 m_offset_00; | ||||
|     int16 m_offset_01; | ||||
|     int16 m_offset_02; | ||||
|     int16 m_offset_03; | ||||
|     int16 m_offset_04; | ||||
|     int16 m_offset_05; | ||||
|     int16 m_offset_06; | ||||
|     int16 m_offset_07; | ||||
|     int16 m_offset_08; | ||||
|     int16 m_offset_09; | ||||
|     int16 m_offset_10; | ||||
|     int16 m_offset_11; | ||||
|     int16 m_offset_12; | ||||
|     int16 m_offset_13; | ||||
|     int16 m_offset_14; | ||||
|     int16 m_offset_15; | ||||
| private: | ||||
|     float m_scale_channel_00; | ||||
|     float m_scale_channel_01; | ||||
|     float m_scale_channel_02; | ||||
|     float m_scale_channel_03; | ||||
|     float m_scale_channel_04; | ||||
|     float m_scale_channel_05; | ||||
|     float m_scale_channel_06; | ||||
|     float m_scale_channel_07; | ||||
|     float m_scale_channel_08; | ||||
|     float m_scale_channel_09; | ||||
|     float m_scale_channel_10; | ||||
|     float m_scale_channel_11; | ||||
|     float m_scale_channel_12; | ||||
| public: | ||||
|     ADCCTRL(); | ||||
|     void setup(const ADCCTRLSetup& setup); | ||||
|     void configure(const ADCCTRLConfiguration& config); | ||||
| public: | ||||
|     void read_adc_result(); | ||||
| private: | ||||
|     void (ADCCTRL::*_read_adc_result)(); | ||||
|     void _read_adc_result_undef(); | ||||
|     void _read_adc_result_operational(); | ||||
| public: | ||||
|     void get_current_net(float&, float&, float&); | ||||
|     void get_current_load(float&, float&, float&); | ||||
|     void get_voltage_net(float&, float&, float&); | ||||
|     void get_voltage_load(float&, float&, float&); | ||||
|     void get_voltage_dc(float&); | ||||
| }; | ||||
| 
 | ||||
| } /* namespace SYSCTRL */ | ||||
| 
 | ||||
| #endif /* SYSCTRL_ADCCTRL_H_ */ | ||||
| @ -1,43 +0,0 @@ | ||||
| /*
 | ||||
|  * DataTypesDefinitions.h | ||||
|  * | ||||
|  *      Author: Aleksey Gerasimenko | ||||
|  *      gerasimenko.aleksey.n@gmail.com | ||||
|  */ | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| #include <math.h> | ||||
| #include <stdint.h> | ||||
| 
 | ||||
| #include "DSP2833x_Device.h" | ||||
| 
 | ||||
| 
 | ||||
| #ifndef SYSCTRL_DATATYPESDEFINITIONS_H_ | ||||
| #define SYSCTRL_DATATYPESDEFINITIONS_H_ | ||||
| 
 | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif | ||||
| 
 | ||||
| 
 | ||||
| #ifndef DSP28_BYTE_DATA_TYPES | ||||
| #define DSP28_BYTE_DATA_TYPES | ||||
| typedef signed char        int8; | ||||
| typedef unsigned char      Uint8; | ||||
| #endif | ||||
| 
 | ||||
| 
 | ||||
| #ifndef STD_BYTE_DATA_TYPES | ||||
| #define STD_BYTE_DATA_TYPES | ||||
| typedef signed   char   int8_t; | ||||
| typedef unsigned char   uint8_t; | ||||
| #endif | ||||
| 
 | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif /* extern "C" */ | ||||
| 
 | ||||
| #endif /* SYSCTRL_DATATYPESDEFINITIONS_H_ */ | ||||
| @ -1,32 +0,0 @@ | ||||
| /*
 | ||||
|  * FLTSYSLIBheaders.h | ||||
|  * | ||||
|  *      Author: Aleksey Gerasimenko | ||||
|  *      gerasimenko.aleksey.n@gmail.com | ||||
|  */ | ||||
| 
 | ||||
| #ifndef FLTSYSLIB_FLTSYSLIBHEADERS_H_ | ||||
| #define FLTSYSLIB_FLTSYSLIBHEADERS_H_ | ||||
| 
 | ||||
| 
 | ||||
| #include "FLTSYSLIB/DiscreteInput.h" | ||||
| #include "FLTSYSLIB/DiscreteOutput.h" | ||||
| #include "FLTSYSLIB/Filter.h" | ||||
| #include "FLTSYSLIB/FilterSecond.h" | ||||
| #include "FLTSYSLIB/FTimer.h" | ||||
| #include "FLTSYSLIB/Hysteresis.h" | ||||
| #include "FLTSYSLIB/IController.h" | ||||
| #include "FLTSYSLIB/Integrator.h" | ||||
| #include "FLTSYSLIB/PIController.h" | ||||
| #include "FLTSYSLIB/PLLABC.h" | ||||
| #include "FLTSYSLIB/Position.h" | ||||
| #include "FLTSYSLIB/RMS.h" | ||||
| #include "FLTSYSLIB/RMSFFO.h" | ||||
| #include "FLTSYSLIB/RMSFSO.h" | ||||
| #include "FLTSYSLIB/Transformation.h" | ||||
| #include "FLTSYSLIB/UNIPWM.h" | ||||
| #include "FLTSYSLIB/ZeroDriftSecond.h" | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| #endif /* FLTSYSLIB_FLTSYSLIBHEADERS_H_ */ | ||||
| @ -1,17 +0,0 @@ | ||||
| /*
 | ||||
|  * Headers.h | ||||
|  * | ||||
|  *      Author: Aleksey Gerasimenko | ||||
|  *      gerasimenko.aleksey.n@gmail.com | ||||
|  */ | ||||
| 
 | ||||
| #ifndef SYSCTRL_HEADERS_H_ | ||||
| #define SYSCTRL_HEADERS_H_ | ||||
| 
 | ||||
| 
 | ||||
| // #include "SYSCTRL/FLTSYSLIBLIGHT.h"
 | ||||
| #include "SYSCTRL/SystemDefinitions.h" | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| #endif /* SYSCTRL_HEADERS_H_ */ | ||||
| @ -1,55 +0,0 @@ | ||||
| /*
 | ||||
|  * SystemDefinitions.h | ||||
|  * | ||||
|  *      Author: Aleksey Gerasimenko | ||||
|  *      gerasimenko.aleksey.n@gmail.com | ||||
|  */ | ||||
| 
 | ||||
| #include <math.h> | ||||
| #include <stdint.h> | ||||
| 
 | ||||
| #ifndef SYSCTRL_SYSTEMDEFINITIONS_H_ | ||||
| #define SYSCTRL_SYSTEMDEFINITIONS_H_ | ||||
| 
 | ||||
| namespace SYSCTRL | ||||
| { | ||||
| 
 | ||||
| #ifndef NOP | ||||
| #define  NOP   asm(" NOP") | ||||
| #endif | ||||
| 
 | ||||
| 
 | ||||
| #ifndef FP_PI | ||||
| #define FP_PI (float)3.14159265358979323846 // Pi
 | ||||
| #endif | ||||
| 
 | ||||
| #ifndef FP_DAMP_FACTOR | ||||
| #define FP_DAMP_FACTOR   0.70710678118654752440  // 1/sqrt(2)
 | ||||
| #endif | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| //
 | ||||
| // Voltage PLL-ABC Parameters
 | ||||
| //
 | ||||
| #define PLLABC_FREQUENCY_NOMINAL    (float)(2.0*FP_PI*50.0) | ||||
| #define PLLABC_FREQUENCY_CUT        (float)(2.0*FP_PI*10.0) | ||||
| #define PLLABC_FILTER_TIME          (float)(1.0/PLLABC_FREQUENCY_CUT) | ||||
| #define PLLABC_CONTROLLER_GAIN      (float)(PLLABC_FREQUENCY_CUT/2.0) | ||||
| #define PLLABC_CONTROLLER_TIME      (float)(4.0/PLLABC_FREQUENCY_CUT) | ||||
| 
 | ||||
| #define PLLABC_FREQUENCY_LIMIT_HI  PLLABC_FREQUENCY_CUT | ||||
| #define PLLABC_FREQUENCY_LIMIT_LOW -PLLABC_FREQUENCY_CUT | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| } /* namespace SYSCTRL */ | ||||
| 
 | ||||
| #endif /* SYSCTRL_SYSTEMDEFINITIONS_H_ */ | ||||
					Loading…
					
					
				
		Reference in New Issue