|
IoT-MBBR (masterthesis)
Masterthesis upgrading a Moving Bed BioReactor with extra sensors and cloud connectivity.
|
ADC functionality for reading the (battery) voltage, internal temperature and CH4/5/6/7 voltages. More...
#include <stdint.h>#include <stdbool.h>#include "em_device.h"#include "em_cmu.h"#include "em_adc.h"#include "adc.h"#include "debug_dbprint.h"#include "util.h"Go to the source code of this file.
Macros | |
| #define | DBPRINT_TIMEOUT 0 |
| #define | TIMEOUT_CONVERSION 70 |
Functions | |
| static float32_t | convertToCelsius (int32_t adcSample) |
| Method to convert an ADC value to a temperature value. More... | |
| void | initADC (ADC_Measurement_t peripheral) |
| Method to initialize the ADC to later check the battery voltage or internal temperature. More... | |
| int32_t | readADC (ADC_Measurement_t peripheral) |
| Method to read the battery voltage or internal temperature. More... | |
| void | ADC0_IRQHandler (void) |
| Interrupt Service Routine for ADC0. More... | |
Variables | |
| volatile bool | adcConversionComplete = false |
| ADC_Init_TypeDef | init = ADC_INIT_DEFAULT |
| ADC_InitSingle_TypeDef | initSingle = ADC_INITSINGLE_DEFAULT |
ADC functionality for reading the (battery) voltage, internal temperature and CH4/5/6/7 voltages.
other.c to this file. while loop and changed types to int32_t. error function, added functionality to exit methods after error call and updated version number. static before the local variables (not necessary). Copyright (C) 2020 - Brecht Van Eeckhoudt
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
A copy of the GNU General Public License can be found in the LICENSE file along with this source code.
Some methods use code obtained from examples from Silicon Labs' GitHub. These sections are licensed under the Silabs License Agreement. See the file "Silabs_License_Agreement.txt" for details. Before using this software for any purpose, you must agree to the terms of that agreement.
Definition in file adc.c.
| #define DBPRINT_TIMEOUT 0 |
| #define TIMEOUT_CONVERSION 70 |
| void ADC0_IRQHandler | ( | void | ) |
Interrupt Service Routine for ADC0.
Definition at line 376 of file adc.c.
|
static |
Method to convert an ADC value to a temperature value.
| [in] | adcSample | The ADC sample to convert to a temperature value. |
Definition at line 351 of file adc.c.
| void initADC | ( | ADC_Measurement_t | peripheral | ) |
Method to initialize the ADC to later check the battery voltage or internal temperature.
| [in] | peripheral | Select the ADC peripheral to initialize. |
Definition at line 87 of file adc.c.
| int32_t readADC | ( | ADC_Measurement_t | peripheral | ) |
Method to read the battery voltage or internal temperature.
This method re-initializes the ADC settings if necessary.
Negative internal temperatures work fine.
| [in] | peripheral | Select the ADC peripheral to read from. |
Definition at line 189 of file adc.c.