/******************************************************************************
*
* @file    chipTemperature.c
* @author  ECS, Joseph Zimmer
* @version V1.0.0
* @date    24-04-2019
* @brief       
*
******************************************************************************/

//	--- INCLUDES -----------------------------------------------------------------
#include <stdio.h>
#include "sysdata.h"
#include "shunt_voltage_fast.h"
#include "adc.h"
#include "tim.h"
//	--- EXTERNE VARIABLEN -------------------------------------------------------- 
extern __IO int32_t adc4Data[SAMPLE_ARRAY_SIZE] __attribute__((section(".RAM1_CRC")));
//	--- LOKALE DEFINES - bitte hier dokumentieren --------------------------------
#define SHUNT_VOLTAGE_FAST_ADC_RESOLUTION						  65536 
#define SHUNT_VOLTAGE_FAST_ADC_OFFSET							  32768




//	--- LOKALE TYPE DEFS - bitte hier dokumentieren-------------------------------

//	--- DEFINITIONEN GLOBALER VARIABLEN - Bitte in Header dokumentieren ----------

//	--- LOKALE VARIABLEN - bitte hier dokumentieren ------------------------------


//	--- LOKALE FUNKTIONS PROTOTYPEN ---------------------------------------------- 

//	--- LOKALE FUNKTIONEN - bitte hier dokumentieren -----------------------------

/*
* @brief
* @param	kein
* @retval	kein
*/

//	--- GLOBALE FUNKTIONEN - bitte in Header dokumentieren------------------------





void SHUNT_VOLTAGE_FAST_Exec(int32_t newval)
{
  sys_data.s.values.shuntVoltageFast =  ((newval - SHUNT_VOLTAGE_FAST_ADC_OFFSET) * (int64_t) (VREF) * SHUNT_VOLTAGE_VOLTAGE_DIVIDER / SHUNT_VOLTAGE_FAST_ADC_RESOLUTION) - sys_data.s.parameter.shuntVoltageFastOffset ;

}

void SHUNT_VOLTAGE_FAST_ZeroCal(void)
{
	sys_data.s.parameter.shuntVoltageFastOffset = sys_data.s.values.shuntVoltageFast  + sys_data.s.parameter.shuntVoltageFastOffset ;
}



/*************************** End of file ****************************/