MT7687 API Reference  LinkIt SDK v4
hal_pwm.h
1 /* Copyright Statement:
2  *
3  * (C) 2005-2016 MediaTek Inc. All rights reserved.
4  *
5  * This software/firmware and related documentation ("MediaTek Software") are
6  * protected under relevant copyright laws. The information contained herein
7  * is confidential and proprietary to MediaTek Inc. ("MediaTek") and/or its licensors.
8  * Without the prior written permission of MediaTek and/or its licensors,
9  * any reproduction, modification, use or disclosure of MediaTek Software,
10  * and information contained herein, in whole or in part, shall be strictly prohibited.
11  * You may only use, reproduce, modify, or distribute (as applicable) MediaTek Software
12  * if you have agreed to and been bound by the applicable license agreement with
13  * MediaTek ("License Agreement") and been granted explicit permission to do so within
14  * the License Agreement ("Permitted User"). If you are not a Permitted User,
15  * please cease any access or use of MediaTek Software immediately.
16  * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
17  * THAT MEDIATEK SOFTWARE RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES
18  * ARE PROVIDED TO RECEIVER ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
19  * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
20  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
21  * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
22  * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
23  * SUPPLIED WITH MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH
24  * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES
25  * THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES
26  * CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK
27  * SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
28  * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND
29  * CUMULATIVE LIABILITY WITH RESPECT TO MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
30  * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE MEDIATEK SOFTWARE AT ISSUE,
31  * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO
32  * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
33  */
34 
35 #ifndef __HAL_PWM_H__
36 #define __HAL_PWM_H__
37 #include "hal_platform.h"
38 
39 #ifdef HAL_PWM_MODULE_ENABLED
40 
76 #ifdef HAL_PWM_FEATURE_ADVANCED_CONFIG
77 
78 
143 #else
144 
206 #endif
207 
208 
217 #ifdef __cplusplus
218 extern "C" {
219 #endif
220 
226 typedef enum {
233 
234 
235 
237 typedef enum {
241 
246 #ifdef HAL_PWM_FEATURE_ADVANCED_CONFIG
247 
253 typedef enum {
254  HAL_PWM_CLOCK_DIVISION_2 = 1,
255  HAL_PWM_CLOCK_DIVISION_4 = 2,
256  HAL_PWM_CLOCK_DIVISION_8 = 3
257 } hal_pwm_advanced_config_t;
258 
263 #endif
264 
265 
266 
267 #ifdef HAL_PWM_FEATURE_SINGLE_SOURCE_CLOCK
268 
289 
301 
302 
303 #else
304 
324 
325 
337 
338 #endif
339 
351 hal_pwm_status_t hal_pwm_set_frequency(hal_pwm_channel_t pwm_channel, uint32_t frequency, uint32_t *total_count);
352 
353 
366 hal_pwm_status_t hal_pwm_set_duty_cycle(hal_pwm_channel_t pwm_channel, uint32_t duty_cycle);
367 
368 
369 
382 
395 
396 
409 hal_pwm_status_t hal_pwm_get_frequency(hal_pwm_channel_t pwm_channel, uint32_t *frequency);
410 
411 
412 
425 hal_pwm_status_t hal_pwm_get_duty_cycle(hal_pwm_channel_t pwm_channel, uint32_t *duty_cycle);
426 
427 
440 
441 
442 #ifdef HAL_PWM_FEATURE_ADVANCED_CONFIG
443 
455 hal_pwm_status_t hal_pwm_set_advanced_config(hal_pwm_channel_t pwm_channel, hal_pwm_advanced_config_t advanced_config);
456 
457 #else
458 
459 #endif
460 
461 
462 #ifdef __cplusplus
463 }
464 #endif
465 
466 
473 #endif /*HAL_PWM_MODULE_ENABLED*/
474 #endif /* __HAL_PWM_H__ */
475 
hal_pwm_status_t hal_pwm_init(hal_pwm_source_clock_t source_clock)
This function initializes the PWM hardware source clock.
A wrong PWM channel is given.
Definition: hal_pwm.h:228
The PWM status is idle.
Definition: hal_pwm.h:238
hal_pwm_source_clock_t
pwm clock source seletion
Definition: hal_platform.h:754
hal_pwm_status_t hal_pwm_get_duty_cycle(hal_pwm_channel_t pwm_channel, uint32_t *duty_cycle)
This function gets the current duty cycle of the PWM.
hal_pwm_status_t
This enum defines the API return type.
Definition: hal_pwm.h:226
hal_pwm_status_t hal_pwm_set_frequency(hal_pwm_channel_t pwm_channel, uint32_t frequency, uint32_t *total_count)
This function sets the PWM frequency and retrieves total count of the PWM hardware at the specified f...
An error occurred during the function call.
Definition: hal_pwm.h:227
A wrong parameter is given.
Definition: hal_pwm.h:229
hal_pwm_status_t hal_pwm_start(hal_pwm_channel_t pwm_channel)
This function starts the PWM execution.
hal_pwm_running_status_t
This enum defines the PWM running status.
Definition: hal_pwm.h:237
No error during the function call.
Definition: hal_pwm.h:231
The PWM status is busy.
Definition: hal_pwm.h:239
hal_pwm_status_t hal_pwm_deinit(void)
This function deinitializes the PWM hardware.
hal_pwm_status_t hal_pwm_get_frequency(hal_pwm_channel_t pwm_channel, uint32_t *frequency)
This function gets current frequency of the PWM, the unit of frequency is Hz.
hal_pwm_status_t hal_pwm_set_duty_cycle(hal_pwm_channel_t pwm_channel, uint32_t duty_cycle)
This function sets the PWM duty cycle.
A smaller frequency is given.
Definition: hal_pwm.h:230
hal_pwm_status_t hal_pwm_stop(hal_pwm_channel_t pwm_channel)
This function stops the PWM execution.
hal_pwm_status_t hal_pwm_get_running_status(hal_pwm_channel_t pwm_channel, hal_pwm_running_status_t *running_status)
This function gets the current status of PWM.
hal_pwm_channel_t
pwm channel
Definition: hal_platform.h:721