A C library with functions for common formulas used on embedded systems.
- Portable-ish: only
double
andfloat
depending on the compilation, are not portable. - Testable: 20+ tests.
- ESP-IDF support:
- Component name:
iot-lib-formulas
. - Configurable: using menuconfig.
- Component name:
Everything is at the docs folder.
#include <stdio.h>
#include "iot_lib_formulas/voltage_divider.h"
#include "iot_lib_formulas/thermistor.h"
#include "iot_lib_formulas/temperature.h"
void app_main(void)
{
float_type thermistor_resistance = volt_divider_resistive_calc_resistor_2(5.0, // 5V in.
10000.0, // 10K resistor 1
2.5); // 2.5V out.
float_type kelvin = thermistor_calc_temperature_steinhart_betha(COMMON_THERM_PROBE_AMBIENT_TEMP_KELVIN,
COMMON_THERM_PROBE_RESISTANCE,
COMMON_THERM_PROBE_BETHA,
thermistor_resistance);
float_type celsius = CONV_KELVIN_CELSIUS(kelvin);
prinft("Temperature: %f celsius", celsius);
}