Private
Public Access
2
0

aio: add initial analog input support

Signed-off-by: Nandkishor Sonar <nandkishor.sonar@intel.com>
Reviewed-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
Nandkishor Sonar
2014-05-01 16:36:11 +01:00
committed by Brendan Le Foll
parent 8c016318a6
commit 207c54a5e7
5 changed files with 333 additions and 0 deletions

48
examples/analogin_a0.c Normal file
View File

@@ -0,0 +1,48 @@
/*
* Author: Nandkishor Sonar
* Copyright (c) 2014 Intel Corporation.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <unistd.h>
#include "aio.h"
int main ()
{
maa_aio_context* adc_a0;
unsigned int adc_value = 0;
int i = 0;
adc_a0 = maa_aio_init(A0);
if (adc_a0 == NULL) {
return 1;
}
for(i = 0; i < 10; i++) {
adc_value = maa_aio_read_u16(adc_a0);
fprintf(stdout, "ADC A0 read %X\n", adc_value);
}
maa_aio_close(adc_a0);
return MAA_SUCCESS;
}