engine_control/source/firmware/kernel/driver/include/adc.h
tkl 4eaea0c98b - folder structure reordered
- unnecessary drivers removed
2016-07-27 14:47:22 +02:00

39 lines
1.3 KiB
C
Executable File

/*
* adc.h
*
* Created on: Dec 23, 2012
* Author: tkl
*/
#ifndef ADC_H_
#define ADC_H_
#include <stdint.h>
//------------------------------------------------------------------------------
typedef int (*adc_fp_open)(const void *);
typedef int (*adc_fp_close)(const void *);
typedef uint16_t (*adc_fp_read)(const void *, int);
//------------------------------------------------------------------------------
//! \brief Contains the function pointer to access the adc driver.
struct adc_fp {
const adc_fp_open open; //!< Function pointer to the open function.
const adc_fp_close close; //!< Function pointer to the close function.
const adc_fp_read read; //!< Function pointer to the read function.
};
//------------------------------------------------------------------------------
//! \brief Contains the architecture depended device and the access functions to the adc driver.
struct adc {
const void *arch_dep_device; //!< Architecture depended adc device (i.e. msp430_adc_t).
const struct adc_fp *fp; //!< Function pointer for the adc driver access.
};
//------------------------------------------------------------------------------
int adc_open(const struct adc *device);
int adc_close(const struct adc *device);
uint16_t adc_read(const struct adc *device, int timeout);
#endif /* ADC_H_ */