Subversion Repositories HomeAutomation

Rev

Rev 796 | Rev 1415 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | SVN | RSS feed

  1. /**
  2.  * @defgroup adc ADC driver
  3.  * @code #include <drivers/adc/adc.h> @endcode
  4.  *
  5.  * @brief Simple low level ADC driver.
  6.  *
  7.  * This driver is a simple ADC implementation.
  8.  *
  9.  *
  10.  * @author  Erik Larsson
  11.  * @author  Anders Runeson
  12.  * @author  Martin Norden
  13.  * @date    2008-05-11
  14.  */
  15.  
  16. /**@{*/
  17.  
  18. #ifndef ADC_H_
  19. #define ADC_H_
  20.  
  21. #if !defined(__AVR_ATmega88__) && !defined(__AVR_ATmega168__)
  22. #error only tested on ATmega88/168
  23. #endif
  24.  
  25. /*-----------------------------------------------
  26.  * Includes
  27.  * ---------------------------------------------*/
  28. #include <stdlib.h>
  29. #include <inttypes.h>
  30.  
  31. /*-----------------------------------------------
  32.  * Functions
  33.  * ---------------------------------------------*/
  34.  
  35. /**
  36.  * @brief Initialize ADC.
  37.  *
  38.  * Initializes the ADC-unit on the AVR. The voltage reference is set to Avcc.
  39.  *
  40.  */
  41. uint8_t ADC_Init(void);
  42.  
  43. /**
  44.  * @brief Get an ADC value.
  45.  *
  46.  * Starts an ADC conversion and returns the result right adjusted, 10 bits.
  47.  * If the channel is changed it does a dummy-read first to prevent garbage data.
  48.  *
  49.  * @param channel
  50.  *      Channel to get ADC data from
  51.  * @retval
  52.  *      The ADC data
  53.  */
  54. uint16_t ADC_Get(uint8_t channel);
  55.  
  56. /**@}*/
  57. #endif
  58.