| Line | |
|---|
| 1 | /******************************************************************************
|
|---|
| 2 | *
|
|---|
| 3 | * @file fast_current.c
|
|---|
| 4 | * @author ECS, Falko Jahn
|
|---|
| 5 | * @version V1.0.0
|
|---|
| 6 | * @date 2022-01-16
|
|---|
| 7 | * @brief
|
|---|
| 8 | *
|
|---|
| 9 | ******************************************************************************/
|
|---|
| 10 |
|
|---|
| 11 | // --- INCLUDES -----------------------------------------------------------------
|
|---|
| 12 | #include "fast_current.h"
|
|---|
| 13 | #include "main.h"
|
|---|
| 14 | #include "sysdata.h"
|
|---|
| 15 |
|
|---|
| 16 | // --- EXTERNE VARIABLEN --------------------------------------------------------
|
|---|
| 17 |
|
|---|
| 18 | // --- LOKALE DEFINES - bitte hier dokumentieren --------------------------------
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 | // --- LOKALE TYPE DEFS - bitte hier dokumentieren-------------------------------
|
|---|
| 24 |
|
|---|
| 25 | // --- DEFINITIONEN GLOBALER VARIABLEN - Bitte in Header dokumentieren ----------
|
|---|
| 26 |
|
|---|
| 27 | // --- LOKALE VARIABLEN - bitte hier dokumentieren ------------------------------
|
|---|
| 28 |
|
|---|
| 29 | // --- LOKALE FUNKTIONS PROTOTYPEN ----------------------------------------------
|
|---|
| 30 |
|
|---|
| 31 | // --- LOKALE FUNKTIONEN - bitte hier dokumentieren -----------------------------
|
|---|
| 32 |
|
|---|
| 33 | // --- GLOBALE FUNKTIONEN - bitte in Header dokumentieren------------------------
|
|---|
| 34 |
|
|---|
| 35 |
|
|---|
| 36 | void FAST_CURRENT_Exec(uint32_t newVal )
|
|---|
| 37 | {
|
|---|
| 38 |
|
|---|
| 39 | //Umrechung auf Strom
|
|---|
| 40 | double temp_current;
|
|---|
| 41 | temp_current = ((int32_t) newVal - FAST_CURRENT_ADC_OFFSET) * VREF ;
|
|---|
| 42 | temp_current = temp_current / FAST_CURRENT_ADC_RESOLUTION;
|
|---|
| 43 | temp_current = temp_current / FAST_CURRENT_I_SENSE_GAIN ;
|
|---|
| 44 | temp_current = temp_current / FAST_CURRENT_SHUNT_RESISTOR ;
|
|---|
| 45 | sys_data.s.values.fast_current = temp_current * (sys_data.s.parameter.batteryCurrentGainCorrectionFaktor / 1000000.0);
|
|---|
| 46 |
|
|---|
| 47 | }
|
|---|
| 48 |
|
|---|
| 49 | /*************************** End of file ****************************/
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.