kosmos/source/firmware/kernel/driver/adc.c

37 lines
858 B
C
Raw Permalink Normal View History

2016-07-28 19:02:54 +00:00
/*
* adc.c
*
* Created on: Dec 23, 2012
* Author: tkl
*/
#include <stddef.h>
#include "adc.h"
//------------------------------------------------------------------------------
int adc_open(const struct adc *device) {
if(NULL == device) {
return -1;
}
adc_fp_open open = device->fp->open;
return open(device->arch_dep_device);
}
//------------------------------------------------------------------------------
int adc_close(const struct adc *device) {
if(NULL == device) {
return -1;
}
adc_fp_close close = device->fp->close;
return close(device->arch_dep_device);
}
//------------------------------------------------------------------------------
uint16_t adc_read(const struct adc *device, int timeout) {
if(NULL == device) {
return -1;
}
adc_fp_read read = device->fp->read;
return read(device->arch_dep_device, timeout);
}