A bundled STM32F10x Std Periph and CMSIS library
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

66 lines
1.6 KiB

  1. /*
  2. * stm32f10x_sadc.h - Part of Library
  3. *
  4. * Copyright (C) 2013 Houtouridis Christos <houtouridis.ch@gmail.com>
  5. * All Rights Reserved.
  6. *
  7. * NOTICE: All information contained herein is, and remains
  8. * the property of Houtouridis Christos. The intellectual
  9. * and technical concepts contained herein are proprietary to
  10. * Houtouridis Christos and are protected by copyright law.
  11. * Dissemination of this information or reproduction of this material
  12. * is strictly forbidden unless prior written permission is obtained
  13. * from Houtouridis Christos.
  14. *
  15. * Author: Houtouridis Christos <houtouridis.ch@gmail.com>
  16. * Date: 04/2013
  17. */
  18. #ifndef __sADC_h__
  19. #define __sADC_h__
  20. #include <stm32f10x.h>
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. typedef int adc_t;
  25. /*========== Defines ===========*/
  26. #define ADC_TEMP_AVG_SLOPE (0.0043) //4.3mV
  27. #define ADC_TEMP_V25 (1.41) //1.41 V
  28. #define ADC_VREF_INT_VOLT (1.2) //1.2 V
  29. #define ADC_MAX_VALUE (4096)
  30. typedef enum
  31. {
  32. ADC_CH0=0, ADC_CH1, ADC_CH2,
  33. ADC_CH3, ADC_CH4, ADC_CH5,
  34. ADC_CH6, ADC_CH7, ADC_CH8,
  35. ADC_CH9, ADC_CH10, ADC_CH11,
  36. ADC_CH12, ADC_CH13, ADC_CH14,
  37. ADC_CH15, ADC_TEMP=16,
  38. ADC_VREFINT
  39. }ADC_Channel_t;
  40. void sADC_DeInit (void);
  41. void sADC_Init (uint8_t calib);
  42. void sADC_Calibration (void);
  43. adc_t sADC_GetChannel ( ADC_Channel_t ch );
  44. /*========== Temperature ===========*/
  45. void sADC_TempVref_Enable (void);
  46. void sADC_TempVref_Disable (void);
  47. adc_t sADC_GetVref (void);
  48. adc_t sADC_GetTemp (void);
  49. #ifdef __cplusplus
  50. }
  51. #endif
  52. #endif //#ifndef __sADC_h__