adc.h
Go to the documentation of this file.
1#ifndef ADC_H
2#define ADC_H
3
4#include <stdint.h>
5
6#include "check.h"
7
8/**
9 * \addtogroup ADC ADC (Analog to Digital Converter)
10 *
11 * \brief Interface to the AD-converter of the ATmega32, which allows to
12 * query the potentiometer and the photosensor of the board
13 *
14 * @{
15 * \file adc.h
16 * \version \$Rev: 7715 $
17 */
18
19/**
20 * \brief Device ids of available periphery connected to ADC channels
21 */
22typedef enum {
23 POTI = 0, /**< the potentiometer (rotation towards LEDs yields higher numbers) **/
24 PHOTO = 1 /**< the photosensor (brighter ambience yields higher numbers) **/
25} __attribute__ ((__packed__)) ADCDEV;
26
28
29/**
30 * \brief Perform a 10-bit A/D conversion for a specific channel/device
31 *
32 * \param dev id of a device connected to the ADC
33 *
34 * \retval >=0 10-bit result of the conversion
35 * \retval -1 invalid device id
36 */
37int16_t sb_adc_read(ADCDEV dev);
38
39/** @}*/
40
41#endif
42
int16_t sb_adc_read(ADCDEV dev)
Perform a 10-bit A/D conversion for a specific channel/device.
ADCDEV
Device ids of available periphery connected to ADC channels.
Definition: adc.h:22
@ PHOTO
Definition: adc.h:24
@ POTI
Definition: adc.h:23
#define CHECK_ENUM_SIZE(VAR, LEN)
Definition: check.h:71