![]() |
McMajan Library Pack
v 2.00
Improve your Arduino !
|
#include "Ss_McMajan_Config.h"
Go to the source code of this file.
Classes | |
struct | Mc_AnalogLine |
struct | Mc_AnalogSensor |
struct | kalman_state |
Functions | |
void | Mc_Analog_Inist () |
Inizialize McMajanLibrary analogic section. More... | |
float | Mc_SampleAnalogAvg (int, uint16_t) |
This function sample an analogic input and return the averange value. More... | |
double | Mc_OversampledAnalogRead (int) |
This function sample an analogic input using oversample algorithm. More... | |
float | Mc_KalmanAnalogAvg (int, uint16_t) |
This function return the kalman filtered value of samples on an analogic pin. Note: the voltage of input pin must be stable. This function is useful to read the right value removing the background noise. More... | |
void | Mc_SetSensorStep (struct Mc_AnalogSensor *, float) |
This function is useful if you need to do a "manual calibration" of the sensor. More... | |
void | Mc_CalculateSensorStep (struct Mc_AnalogSensor *) |
Calcolate internal parameters to give you values in original units as Ampere, Volt, etc and not only a raw value. More... | |
kalman_state | kalman_init (double, double, double, double) |
This function initialize a Kalman filter. More... | |
void | kalman_update (kalman_state *, double) |
This function updates a Kalman filter. More... | |
struct Mc_AnalogLine | CheckAnalogLine (int, uint16_t num=450) |
Test analogic line. More... | |
struct Mc_AnalogLine CheckAnalogLine | ( | int | pin, |
uint16_t | num | ||
) |
Test analogic line.
This function samples an analogic input to read lower, higher , mean and, rms values. inoltre - althought you can see the number of samples and the kalmann filtered value. This last value is useful to test lines wich signal is stable (or may be it).
pin | is the analogic pin you want to test |
num | is the number of "grid waves" you want to sample (default 450 if you don't specify values). |
Definition at line 130 of file Ss_Analogico.cpp.
References kalman_init(), Mc_AnalogLine::klm, Mc_AnalogLine::max, Mc_SampleAnalogAvg(), Mc_AnalogLine::mean, Mc_AnalogLine::min, and kalman_state::value.
kalman_state kalman_init | ( | double | q, |
double | r, | ||
double | p, | ||
double | intial_value | ||
) |
This function initialize a Kalman filter.
q | process noise covariance |
r | measurement noise covariance |
p | estimation error covariance |
value | initial value |
Definition at line 93 of file Ss_Analogico.cpp.
References kalman_state::p, kalman_state::q, kalman_state::r, and kalman_state::value.
void kalman_update | ( | kalman_state * | state, |
double | measurement | ||
) |
This function updates a Kalman filter.
state | is the actual kalman filter pointer |
measurement | is the new value you want to filter |
Definition at line 110 of file Ss_Analogico.cpp.
References kalman_state::k, kalman_state::p, kalman_state::q, kalman_state::r, and kalman_state::value.
void Mc_Analog_Inist | ( | ) |
Inizialize McMajanLibrary analogic section.
Definition at line 7 of file Ss_Analogico.cpp.
void Mc_CalculateSensorStep | ( | struct Mc_AnalogSensor * | sensore | ) |
Calcolate internal parameters to give you values in original units as Ampere, Volt, etc and not only a raw value.
sensore | is the pointer to the sensor |
Definition at line 22 of file Ss_Analogico.cpp.
References Mc_AnalogSensor::sensor_range, Mc_AnalogSensor::sensor_step, Mc_AnalogSensor::sensor_voltage_range, and Mc_AnalogSensor::sensorunit.
float Mc_KalmanAnalogAvg | ( | int | localpin, |
uint16_t | campioni | ||
) |
This function return the kalman filtered value of samples on an analogic pin. Note: the voltage of input pin must be stable. This function is useful to read the right value removing the background noise.
localpin | is the input pin of Arduino |
campioni | is the number of samples you want to do. |
Definition at line 58 of file Ss_Analogico.cpp.
References kalman_init(), kalman_update(), Mc_OversampledAnalogRead(), and kalman_state::value.
|
inline |
This function sample an analogic input using oversample algorithm.
pin | is the input pin of Arduino |
Definition at line 77 of file Ss_Analogico.cpp.
float Mc_SampleAnalogAvg | ( | int | localpin, |
uint16_t | campioni | ||
) |
This function sample an analogic input and return the averange value.
localpin | is the input pin of Arduino |
campioni | is the number of samples you want to do. |
Definition at line 42 of file Ss_Analogico.cpp.
References Mc_OversampledAnalogRead().
void Mc_SetSensorStep | ( | struct Mc_AnalogSensor * | sensore, |
float | value | ||
) |
This function is useful if you need to do a "manual calibration" of the sensor.
sensore | is the sensor pointer you want to calibrate |
value | is the manual calibration of the sensor |
Definition at line 32 of file Ss_Analogico.cpp.
References Mc_AnalogSensor::sensor_step.