Alarm Sensor Module  0.1
⇒ back to Project Page
subfunctions.c
Go to the documentation of this file.
1 /****************************************************************************/
32 #include <stdint.h>
33 #include "subfunctions.h"
34 
35 
36 
37 /****************************************************************************/
56 /****************************************************************************/
57 
58 uint32_t calculate_battery_voltage(uint32_t adc_voltage_u32) {
59 
60  uint32_t tmp_value_u32;
61 
62  tmp_value_u32 = (uint32_t) (adc_voltage_u32 * (uint32_t) R_SUM);
63 
64  return (uint32_t) tmp_value_u32 / (uint32_t) R2_VALUE;
65 
66 
67 }
#define R_SUM
sum of both resistors
Definition: subfunctions.h:49
uint32_t calculate_battery_voltage(uint32_t adc_voltage_u32)
Definition: subfunctions.c:58
#define R2_VALUE
Value of resistor R2, connected to the ground [Ohm].
Definition: subfunctions.h:47