initial commit
This commit is contained in:
36
source/firmware/kernel/driver/adc.c
Executable file
36
source/firmware/kernel/driver/adc.c
Executable file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* 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);
|
||||
}
|
||||
Reference in New Issue
Block a user