Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:23:03

0001 /**
0002  * @file
0003  *
0004  * @ingroup RTEMSBSPsARMLPC176X
0005  *
0006  * @brief ADC library for the lpc176x bsp.
0007  */
0008 
0009 /*
0010  * Copyright (c) 2014 Taller Technologies.
0011  *
0012  * @author  Diaz Marcos (marcos.diaz@tallertechnologies.com)
0013  *
0014  * The license and distribution terms for this file may be
0015  * found in the file LICENSE in this distribution or at
0016  * http://www.rtems.org/license/LICENSE.
0017  */
0018 
0019 #ifndef LPC176X_ADC_H
0020 #define LPC176X_ADC_H
0021 
0022 #include <bsp.h>
0023 #include <bsp/common-types.h>
0024 
0025 #ifdef __cplusplus
0026 extern "C" {
0027 #endif /* __cplusplus */
0028 
0029 /**
0030  * @brief Opens and initializes the ADC device.
0031  *
0032  * @param adc_number The ADC pin number to be initialized.
0033  * @return RTEMS_SUCCESSFUL if the initialization was succesful,
0034  *  RTEMS_INVALID_NUMBER if wrong parameter.
0035  */
0036 rtems_status_code adc_open( const lpc176x_pin_number pin_number );
0037 
0038 /**
0039  * @brief Closes the ADC device.
0040  *
0041  * @return RTEMS_SUCCESSFUL if closed succesfully.
0042  */
0043 rtems_status_code adc_close( void );
0044 
0045 /**
0046  * @brief Starts a conversion, waits for it to finish and reads the value.
0047  *
0048  * @param pin_number The port to read the value.
0049  * @param result The read result. (In a percentage between 0.0f and 1.0f).
0050  */
0051 rtems_status_code adc_read(
0052   const lpc176x_pin_number pin_number ,
0053   float *const             result
0054 );
0055 
0056 #ifdef __cplusplus
0057 }
0058 #endif /* __cplusplus */
0059 
0060 #endif