Skip to content

Commit 20de336

Browse files
author
Edmund Hsu
committed
Add C++ linkage for adi_tmr.h
1 parent 9579440 commit 20de336

File tree

1 file changed

+29
-16
lines changed
  • targets/TARGET_Analog_Devices/TARGET_ADUCM4X50/TARGET_ADUCM4050/bsp/drivers/tmr

1 file changed

+29
-16
lines changed

targets/TARGET_Analog_Devices/TARGET_ADUCM4X50/TARGET_ADUCM4050/bsp/drivers/tmr/adi_tmr.h

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @file adi_tmr.h
33
* @brief GP and RGB timer device driver public header file
44
-----------------------------------------------------------------------------
5-
Copyright (c) 2016 Analog Devices, Inc.
5+
Copyright (c) 2016-2018 Analog Devices, Inc.
66
77
All rights reserved.
88
@@ -56,12 +56,16 @@ POSSIBILITY OF SUCH DAMAGE.
5656
* @{
5757
*/
5858

59+
/* C++ linkage */
60+
#ifdef __cplusplus
61+
extern "C" {
62+
#endif /* __cplusplus */
5963

6064
/*!
6165
*****************************************************************************
6266
* \enum ADI_TMR_RESULT
6367
* Enumeration for result code returned from the timer device driver functions.
64-
* The return value of all timer APIs returning #ADI_TMR_RESULT should always
68+
* The return value of all timer APIs returning #ADI_TMR_RESULT should always
6569
* be tested at the application level for success or failure.
6670
*****************************************************************************/
6771
typedef enum {
@@ -97,10 +101,17 @@ typedef enum {
97101
ADI_TMR_DEVICE_GP1 = 1u,
98102
/*! General purpose timer 2 */
99103
ADI_TMR_DEVICE_GP2 = 2u,
104+
#if defined(__ADUCM3029__)
105+
/*! Total number of devices (private) */
106+
ADI_TMR_DEVICE_NUM = 3u,
107+
#elif defined(__ADUCM4050__)
100108
/*! RGB timer */
101109
ADI_TMR_DEVICE_RGB = 3u,
102110
/*! Total number of devices (private) */
103111
ADI_TMR_DEVICE_NUM = 4u,
112+
#else
113+
#error TMR is not ported for this processor
114+
#endif
104115
} ADI_TMR_DEVICE;
105116

106117
/*!
@@ -110,7 +121,7 @@ typedef enum {
110121
*****************************************************************************/
111122
typedef enum {
112123
/*! Timeout event occurred */
113-
ADI_TMR_EVENT_TIMEOUT = 0x01,
124+
ADI_TMR_EVENT_TIMEOUT = 0x01,
114125
/*! Event capture event occurred */
115126
ADI_TMR_EVENT_CAPTURE = 0x02,
116127
} ADI_TMR_EVENT;
@@ -124,7 +135,7 @@ typedef enum {
124135
/*! Count every 1 source clock periods */
125136
ADI_TMR_PRESCALER_1 = 0u,
126137
/*! Count every 16 source clock periods */
127-
ADI_TMR_PRESCALER_16 = 1u,
138+
ADI_TMR_PRESCALER_16 = 1u,
128139
/*! Count every 64 source clock periods */
129140
ADI_TMR_PRESCALER_64 = 2u,
130141
/*! Count every 256 source clock periods */
@@ -138,11 +149,11 @@ typedef enum {
138149
*****************************************************************************/
139150
typedef enum {
140151
/*! Use periphreal clock (PCLK) */
141-
ADI_TMR_CLOCK_PCLK = 0u,
152+
ADI_TMR_CLOCK_PCLK = 0u,
142153
/*! Use internal high frequency clock (HFOSC) */
143-
ADI_TMR_CLOCK_HFOSC = 1u,
154+
ADI_TMR_CLOCK_HFOSC = 1u,
144155
/*! Use internal low frequency clock (LFOSC) */
145-
ADI_TMR_CLOCK_LFOSC = 2u,
156+
ADI_TMR_CLOCK_LFOSC = 2u,
146157
/*! Use external low frequency clock (LFXTAL) */
147158
ADI_TMR_CLOCK_LFXTAL = 3u,
148159
} ADI_TMR_CLOCK_SOURCE;
@@ -151,7 +162,7 @@ typedef enum {
151162
*****************************************************************************
152163
* \enum ADI_TMR_PWM_OUTPUT
153164
* RGB PWM outputs, used to specify which PWM output to configure. For the GP
154-
* timers only #ADI_TMR_PWM_OUTPUT_0 is allowed. The RGB timer has all three
165+
* timers only #ADI_TMR_PWM_OUTPUT_0 is allowed. The RGB timer has all three
155166
* outputs.
156167
*****************************************************************************/
157168
typedef enum {
@@ -168,7 +179,7 @@ typedef enum {
168179
/*!
169180
*****************************************************************************
170181
* \struct ADI_TMR_CONFIG
171-
* Configuration structure to fill and pass to #adi_tmr_ConfigTimer when
182+
* Configuration structure to fill and pass to #adi_tmr_ConfigTimer when
172183
* configuring the GP or RGB timer
173184
*****************************************************************************/
174185
typedef struct {
@@ -180,7 +191,7 @@ typedef struct {
180191
ADI_TMR_PRESCALER ePrescaler;
181192
/*! Clock source */
182193
ADI_TMR_CLOCK_SOURCE eClockSource;
183-
/*! Load value (only relent in periodic mode) */
194+
/*! Load value (only relevant in periodic mode) */
184195
uint16_t nLoad;
185196
/*! Asynchronous load value (only relevant in periodic mode, and when PCLK is used) */
186197
uint16_t nAsyncLoad;
@@ -193,7 +204,7 @@ typedef struct {
193204
/*!
194205
*****************************************************************************
195206
* \struct ADI_TMR_EVENT_CONFIG
196-
* Configuration structure to fill and pass to #adi_tmr_ConfigEvent when
207+
* Configuration structure to fill and pass to #adi_tmr_ConfigEvent when
197208
* configuring event capture
198209
*****************************************************************************/
199210
typedef struct {
@@ -208,7 +219,7 @@ typedef struct {
208219
/*!
209220
*****************************************************************************
210221
* \struct ADI_TMR_PWM_CONFIG
211-
* Configuration structure to fill and pass to #adi_tmr_ConfigPwm when
222+
* Configuration structure to fill and pass to #adi_tmr_ConfigPwm when
212223
* configuring pulse width modulation output
213224
*****************************************************************************/
214225
typedef struct {
@@ -232,9 +243,9 @@ typedef struct {
232243
ADI_TMR_RESULT adi_tmr_Init (ADI_TMR_DEVICE const eDevice, ADI_CALLBACK const pfCallback, void * const pCBParam, bool bEnableInt);
233244

234245
/* Configuration interface functions */
235-
ADI_TMR_RESULT adi_tmr_ConfigTimer (ADI_TMR_DEVICE const eDevice, ADI_TMR_CONFIG timerConfig);
236-
ADI_TMR_RESULT adi_tmr_ConfigEvent (ADI_TMR_DEVICE const eDevice, ADI_TMR_EVENT_CONFIG eventConfig);
237-
ADI_TMR_RESULT adi_tmr_ConfigPwm (ADI_TMR_DEVICE const eDevice, ADI_TMR_PWM_CONFIG pwmConfig );
246+
ADI_TMR_RESULT adi_tmr_ConfigTimer (ADI_TMR_DEVICE const eDevice, ADI_TMR_CONFIG* timerConfig);
247+
ADI_TMR_RESULT adi_tmr_ConfigEvent (ADI_TMR_DEVICE const eDevice, ADI_TMR_EVENT_CONFIG* eventConfig);
248+
ADI_TMR_RESULT adi_tmr_ConfigPwm (ADI_TMR_DEVICE const eDevice, ADI_TMR_PWM_CONFIG* pwmConfig );
238249

239250
/* Timer start and stop */
240251
ADI_TMR_RESULT adi_tmr_Enable (ADI_TMR_DEVICE const eDevice, bool bEnable);
@@ -246,7 +257,9 @@ ADI_TMR_RESULT adi_tmr_GetCaptureCount (ADI_TMR_DEVICE const eDevice, uint16_t *
246257
/* Reload function */
247258
ADI_TMR_RESULT adi_tmr_Reload (ADI_TMR_DEVICE const eDevice);
248259

249-
260+
#ifdef __cplusplus
261+
}
262+
#endif
250263
/*! @} */
251264

252265

0 commit comments

Comments
 (0)