kosmos/source/firmware/kernel/driver/adc.c
2016-07-28 21:02:54 +02:00

37 lines
858 B
C
Executable File

/*
* 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);
}