adc.h
93 lines
| 1.9 KiB
| text/x-c
|
CLexer
r72 | /*------------------------------------------------------------------------------ | |||
-- This file is a part of the libuc, microcontroler library | ||||
-- Copyright (C) 2012, Alexis Jeandet | ||||
-- | ||||
-- This program is free software; you can redistribute it and/or modify | ||||
-- it under the terms of the GNU General Public License as published by | ||||
-- the Free Software Foundation; either version 3 of the License, or | ||||
-- (at your option) any later version. | ||||
-- | ||||
-- This program is distributed in the hope that it will be useful, | ||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
-- GNU General Public License for more details. | ||||
-- | ||||
-- You should have received a copy of the GNU General Public License | ||||
-- along with this program; if not, write to the Free Software | ||||
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||||
------------------------------------------------------------------------------- | ||||
-- Author : Alexis Jeandet | ||||
-- Mail : alexis.jeandet@gmail.com | ||||
-------------------------------------------------------------------------------*/ | ||||
/* | ||||
*/ | ||||
#ifndef ADC_H | ||||
#define ADC_H | ||||
#include <uhandle.h> | ||||
#ifdef __cplusplus | ||||
extern "C" { | ||||
#endif | ||||
typedef struct adc_t | ||||
{ | ||||
void* _dev; | ||||
int cfg; | ||||
int rate; | ||||
}adc_t; | ||||
typedef enum | ||||
{ | ||||
adc6bits = 0x1, | ||||
adc7bits = 0x2, | ||||
adc8bits = 0x3, | ||||
adc9bits = 0x4, | ||||
adc10bits = 0x5, | ||||
adc11bits = 0x6, | ||||
adc12bits = 0x7, | ||||
adc13bits = 0x8, | ||||
adc14bits = 0x9, | ||||
adc15bits = 0xA, | ||||
adc16bits = 0xB, | ||||
adc17bits = 0xC, | ||||
adc18bits = 0xD, | ||||
adc19bits = 0xE, | ||||
adc20bits = 0xF, | ||||
adc21bits = 0x10, | ||||
adc22bits = 0x11, | ||||
adc23bits = 0x12, | ||||
adc24bits = 0x13 | ||||
}adcbits_t; | ||||
#define ADCBITSMASK 0xF | ||||
typedef enum | ||||
{ | ||||
adcsingle = 0x00, | ||||
adcmaster = 0x10 | ||||
}adcconvmode_t; | ||||
#define ADCCONVMODEMASK 0x10 | ||||
#ifdef __cplusplus | ||||
} | ||||
#endif | ||||
#endif //ADC_H | ||||