This repository has been archived by the owner on Nov 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
adc.h
79 lines (67 loc) · 2.6 KB
/
adc.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*
* Copyright (c)
* (c) 2015-2016 Chintalagiri Shashank, Quazar Technologies Pvt. Ltd.
*
* This file is part of
* Embedded bootstraps : hal-uC
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser 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 Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @file hal_uc_adc.h
* @brief HAL for uC Internal ADC interfaces
*
* This file is the hardware abstraction layer for uC internal ADC interfaces.
*
* The HAL API provided for ADCs follows a least-common-denominator approach.
* ADC features that are less common are not necessarily supported by the HAL,
* and must be directly used from the application layer. Over time,
* specialized ADC features which see common use _may_ be included in the HAL,
* but no guarantees are made.
*
* Each internal ADC is considered a single Interface, and each interface may
* have one or more channels associated with it.
*
* The HAL ADC interface understands the following ADC elements, in one form
* or the other. Many of these parameters will be as preprocessor definitions
* provided by the uC support file in the bsp.
*
* - Number of channels
* - Single shot conversion of a single channel
*
* Note that the typical ADC interface is fairly involved and has a great many
* options, making the HAL less useful for anything but the simplest or the
* most common approaches to ADC use. The implementations in the HAL can be
* extended when specific, clear cut use cases which are used widely enough
* to warrant continuous maintenance, but in the general case, if you want to
* do anything special with the ADC, you would probably have to do so from the
* application layer directly.
*
*/
#ifndef HAL_UC_ADC_H
#define HAL_UC_ADC_H
/**
* @name ADC API Functions
*
*/
/**@{*/
void adc_init(uint8_t intfnum);
void adc_setup_channel(uint8_t intfnum, uint8_t chnum, uint16_t * rbuf);
void adc_trigger_single(uint8_t chnum);
// void adc_setup_autoscan(uint8_t intfnum, uint16_t chnmask);
// void adc_trigger_autoscan(void);
/**@}*/
// Set up the implementation
#include "uc/adc_impl.h"
#endif