blob: 34df8b7efdbdbc7330e4d03bf972d3375f1c176c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
/**
* @file adc.h
*
* @ingroup lpc176x
*
* @brief ADC library for the lpc176x bsp.
*/
/*
* Copyright (c) 2014 Taller Technologies.
*
* @author Diaz Marcos (marcos.diaz@tallertechnologies.com)
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.org/license/LICENSE.
*/
#ifndef LPC176X_ADC_H
#define LPC176X_ADC_H
#include <bsp.h>
#include <bsp/common-types.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/**
* @brief Opens and initializes the ADC device.
*
* @param adc_number The ADC pin number to be initialized.
* @return RTEMS_SUCCESSFUL if the initialization was succesful,
* RTEMS_INVALID_NUMBER if wrong parameter.
*/
rtems_status_code adc_open( const lpc176x_pin_number pin_number );
/**
* @brief Closes the ADC device.
*
* @return RTEMS_SUCCESSFUL if closed succesfully.
*/
rtems_status_code adc_close( void );
/**
* @brief Starts a conversion, waits for it to finish and reads the value.
*
* @param pin_number The port to read the value.
* @param result The read result. (In a percentage between 0.0f and 1.0f).
*/
rtems_status_code adc_read(
const lpc176x_pin_number pin_number ,
float *const result
);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif
|