JM9 XRCU Board 0.1.1
Libraries API Reference
Loading...
Searching...
No Matches
wiring_analog.h
1/*
2 Copyright (c) 2011 Arduino. All right reserved.
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 See the GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with this library; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17*/
18
19#ifndef _WIRING_ANALOG_
20#define _WIRING_ANALOG_
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26/*
27 * \brief SAM3 products have only one reference for ADC
28 * This is kept only for compatibility with existing AVR based API.
29 */
30typedef enum _eAnalogReference {
31 AR_DEFAULT,
32} eAnalogReference ;
33
34/*
35 * \brief Configures the reference voltage used for analog input (i.e. the value used as the top of the input range).
36 * This function is kept only for compatibility with existing AVR based API.
37 *
38 * \param ulMmode Should be set to AR_DEFAULT.
39 */
40extern void analogReference(eAnalogReference ulMode) ;
41
42/*
43 * \brief Writes an analog value (PWM wave) to a pin.
44 *
45 * \param ulPin
46 * \param ulValue
47 */
48extern void analogWrite(uint32_t ulPin, uint32_t ulValue) ;
49
50/*
51 * \brief Reads the value from the specified analog pin.
52 *
53 * \param ulPin
54 *
55 * \return Read value from selected pin, if no error.
56 */
57extern uint32_t analogRead(uint32_t ulPin) ;
58
59/*
60 * \brief Set the resolution of analogRead return values. Default is 10 bits (range from 0 to 1023).
61 *
62 * \param res
63 */
64extern void analogReadResolution(int res);
65
66/*
67 * \brief Set the resolution of analogWrite parameters. Default is 8 bits (range from 0 to 255).
68 *
69 * \param res
70 */
71extern void analogWriteResolution(int res);
72
73/*
74 * \brief Set the frequency of analogWrite. Default is PWM_FREQUENCY (1000) in Hertz.
75 *
76 * \param freq
77 */
78extern void analogWriteFrequency(uint32_t freq);
79
80
81extern void analogOutputInit(void) ;
82
83#ifdef __cplusplus
84}
85#endif
86
87#endif /* _WIRING_ANALOG_ */