66 lines
1.6 KiB
C

/*
* stm32f10x_sadc.h - Part of Library
*
* Copyright (C) 2013 Houtouridis Christos <houtouridis.ch@gmail.com>
* All Rights Reserved.
*
* NOTICE: All information contained herein is, and remains
* the property of Houtouridis Christos. The intellectual
* and technical concepts contained herein are proprietary to
* Houtouridis Christos and are protected by copyright law.
* Dissemination of this information or reproduction of this material
* is strictly forbidden unless prior written permission is obtained
* from Houtouridis Christos.
*
* Author: Houtouridis Christos <houtouridis.ch@gmail.com>
* Date: 04/2013
*/
#ifndef __sADC_h__
#define __sADC_h__
#include <stm32f10x.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef int adc_t;
/*========== Defines ===========*/
#define ADC_TEMP_AVG_SLOPE (0.0043) //4.3mV
#define ADC_TEMP_V25 (1.41) //1.41 V
#define ADC_VREF_INT_VOLT (1.2) //1.2 V
#define ADC_MAX_VALUE (4096)
typedef enum
{
ADC_CH0=0, ADC_CH1, ADC_CH2,
ADC_CH3, ADC_CH4, ADC_CH5,
ADC_CH6, ADC_CH7, ADC_CH8,
ADC_CH9, ADC_CH10, ADC_CH11,
ADC_CH12, ADC_CH13, ADC_CH14,
ADC_CH15, ADC_TEMP=16,
ADC_VREFINT
}ADC_Channel_t;
void sADC_DeInit (void);
void sADC_Init (uint8_t calib);
void sADC_Calibration (void);
adc_t sADC_GetChannel ( ADC_Channel_t ch );
/*========== Temperature ===========*/
void sADC_TempVref_Enable (void);
void sADC_TempVref_Disable (void);
adc_t sADC_GetVref (void);
adc_t sADC_GetTemp (void);
#ifdef __cplusplus
}
#endif
#endif //#ifndef __sADC_h__