mbed-os
Fork of mbed-os by
targets/TARGET_ONSEMI/TARGET_NCS36510/adc_sar.h@0:f269e3021894, 2016-10-23 (annotated)
- Committer:
- elessair
- Date:
- Sun Oct 23 15:10:02 2016 +0000
- Revision:
- 0:f269e3021894
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
elessair | 0:f269e3021894 | 1 | /** |
elessair | 0:f269e3021894 | 2 | ****************************************************************************** |
elessair | 0:f269e3021894 | 3 | * @file adc_sar.h |
elessair | 0:f269e3021894 | 4 | * @internal |
elessair | 0:f269e3021894 | 5 | * @author ON Semiconductor |
elessair | 0:f269e3021894 | 6 | * $Rev: 3426 $ |
elessair | 0:f269e3021894 | 7 | * $Date: 2015-06-15 16:46:35 +0530 (Mon, 15 Jun 2015) $ |
elessair | 0:f269e3021894 | 8 | * @brief Definitions and API for the SAR ADC driver. |
elessair | 0:f269e3021894 | 9 | ****************************************************************************** |
elessair | 0:f269e3021894 | 10 | * Copyright 2016 Semiconductor Components Industries LLC (d/b/a ON Semiconductor). |
elessair | 0:f269e3021894 | 11 | * All rights reserved. This software and/or documentation is licensed by ON Semiconductor |
elessair | 0:f269e3021894 | 12 | * under limited terms and conditions. The terms and conditions pertaining to the software |
elessair | 0:f269e3021894 | 13 | * and/or documentation are available at http://www.onsemi.com/site/pdf/ONSEMI_T&C.pdf |
elessair | 0:f269e3021894 | 14 | * (ON Semiconductor Standard Terms and Conditions of Sale, Section 8 Software) and |
elessair | 0:f269e3021894 | 15 | * if applicable the software license agreement. Do not use this software and/or |
elessair | 0:f269e3021894 | 16 | * documentation unless you have carefully read and you agree to the limited terms and |
elessair | 0:f269e3021894 | 17 | * conditions. By using this software and/or documentation, you agree to the limited |
elessair | 0:f269e3021894 | 18 | * terms and conditions. |
elessair | 0:f269e3021894 | 19 | * |
elessair | 0:f269e3021894 | 20 | * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED |
elessair | 0:f269e3021894 | 21 | * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF |
elessair | 0:f269e3021894 | 22 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. |
elessair | 0:f269e3021894 | 23 | * ON SEMICONDUCTOR SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, |
elessair | 0:f269e3021894 | 24 | * INCIDENTAL, OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. |
elessair | 0:f269e3021894 | 25 | * @endinternal |
elessair | 0:f269e3021894 | 26 | * |
elessair | 0:f269e3021894 | 27 | * @ingroup adc_sar |
elessair | 0:f269e3021894 | 28 | * |
elessair | 0:f269e3021894 | 29 | * @details |
elessair | 0:f269e3021894 | 30 | * <p> |
elessair | 0:f269e3021894 | 31 | * </p> |
elessair | 0:f269e3021894 | 32 | */ |
elessair | 0:f269e3021894 | 33 | |
elessair | 0:f269e3021894 | 34 | #ifndef ADC_DRIVER_H_ |
elessair | 0:f269e3021894 | 35 | #define ADC_DRIVER_H_ |
elessair | 0:f269e3021894 | 36 | |
elessair | 0:f269e3021894 | 37 | #include "adc_sar_map.h" |
elessair | 0:f269e3021894 | 38 | |
elessair | 0:f269e3021894 | 39 | #if DEVICE_ANALOGIN |
elessair | 0:f269e3021894 | 40 | |
elessair | 0:f269e3021894 | 41 | #ifdef __cplusplus |
elessair | 0:f269e3021894 | 42 | extern "C" { |
elessair | 0:f269e3021894 | 43 | #endif |
elessair | 0:f269e3021894 | 44 | |
elessair | 0:f269e3021894 | 45 | /* ADC register bits */ |
elessair | 0:f269e3021894 | 46 | #define ADC_CONTROL_MODE_BIT_POS 0 |
elessair | 0:f269e3021894 | 47 | #define ADC_CONTROL_MEASTYPE_BIT_POS 3 |
elessair | 0:f269e3021894 | 48 | #define ADC_CONTROL_INPUTSCALE_BIT_POS 4 |
elessair | 0:f269e3021894 | 49 | #define ADC_CONTROL_MEAS_CH_BIT_POS 8 |
elessair | 0:f269e3021894 | 50 | #define ADC_CONTROL_REF_CH_BIT_POS 12 |
elessair | 0:f269e3021894 | 51 | #define ADC_PRESCALE_VAL_BIT_POS 0 |
elessair | 0:f269e3021894 | 52 | #define ADC_PRESCALE_EN_BIT_POS 8 |
elessair | 0:f269e3021894 | 53 | #define ADC_DELAY_SAMPLE_RATE_BIT_POS 0 |
elessair | 0:f269e3021894 | 54 | #define ADC_DELAY_WARMUP_BIT_POS 16 |
elessair | 0:f269e3021894 | 55 | #define ADC_DELAY_SAMPLE_TIME_BIT_POS 24 |
elessair | 0:f269e3021894 | 56 | |
elessair | 0:f269e3021894 | 57 | typedef enum { |
elessair | 0:f269e3021894 | 58 | ADC_CHANNEL0 = 0, |
elessair | 0:f269e3021894 | 59 | ADC_CHANNEL1, |
elessair | 0:f269e3021894 | 60 | ADC_CHANNEL2, |
elessair | 0:f269e3021894 | 61 | ADC_CHANNEL3, |
elessair | 0:f269e3021894 | 62 | ADC_TEMPSENSR = 6, |
elessair | 0:f269e3021894 | 63 | ADC_BATTERY |
elessair | 0:f269e3021894 | 64 | } Type_RefCh_ConvCh; |
elessair | 0:f269e3021894 | 65 | |
elessair | 0:f269e3021894 | 66 | typedef enum { |
elessair | 0:f269e3021894 | 67 | ADC_RELATIVE_MEAS = 0, |
elessair | 0:f269e3021894 | 68 | ADC_ABSOLUTE_MEAS |
elessair | 0:f269e3021894 | 69 | } Type_Meastype; |
elessair | 0:f269e3021894 | 70 | |
elessair | 0:f269e3021894 | 71 | typedef enum { |
elessair | 0:f269e3021894 | 72 | ADC_SINGLE_SAMPLE = 0, |
elessair | 0:f269e3021894 | 73 | ADC_CONTINUOUS_SAMPLE |
elessair | 0:f269e3021894 | 74 | } Type_Mode; |
elessair | 0:f269e3021894 | 75 | |
elessair | 0:f269e3021894 | 76 | typedef enum { |
elessair | 0:f269e3021894 | 77 | ADC_INT_DISABLE = 0, |
elessair | 0:f269e3021894 | 78 | ADC_INT_ENABLE |
elessair | 0:f269e3021894 | 79 | } Type_Intrpt; |
elessair | 0:f269e3021894 | 80 | |
elessair | 0:f269e3021894 | 81 | typedef enum { |
elessair | 0:f269e3021894 | 82 | ADC_IP_SCALE_1_0 = 0, |
elessair | 0:f269e3021894 | 83 | ADC_IP_SCALE_0_6923, |
elessair | 0:f269e3021894 | 84 | ADC_IP_SCALE_0_5294, |
elessair | 0:f269e3021894 | 85 | ADC_IP_SCALE_0_4286, |
elessair | 0:f269e3021894 | 86 | ADC_IP_SCALE_0_3600, |
elessair | 0:f269e3021894 | 87 | ADC_IP_SCALE_0_3103, |
elessair | 0:f269e3021894 | 88 | ADC_IP_SCALE_0_2728, |
elessair | 0:f269e3021894 | 89 | ADC_IP_SCALE_0_2432 |
elessair | 0:f269e3021894 | 90 | } Ip_Scale_Type; |
elessair | 0:f269e3021894 | 91 | |
elessair | 0:f269e3021894 | 92 | void fAdcHandler(void); |
elessair | 0:f269e3021894 | 93 | |
elessair | 0:f269e3021894 | 94 | #ifdef __cplusplus |
elessair | 0:f269e3021894 | 95 | } |
elessair | 0:f269e3021894 | 96 | #endif |
elessair | 0:f269e3021894 | 97 | |
elessair | 0:f269e3021894 | 98 | #endif /* DEVICE_ANALOGIN */ |
elessair | 0:f269e3021894 | 99 | |
elessair | 0:f269e3021894 | 100 | #endif /* ADC_DRIVER_H_ */ |