MT7687 API Reference  LinkIt SDK v4
hal_isink.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_ISINK_H__
36 #define __HAL_ISINK_H__
37 
38 #include "hal_platform.h"
39 #ifdef HAL_ISINK_MODULE_ENABLED
40 
89 #ifdef __cplusplus
90 extern "C" {
91 #endif
92 
98 typedef enum {
99  HAL_ISINK_CHANNEL_0 = 0,
100  HAL_ISINK_CHANNEL_1 = 1,
101  HAL_ISINK_MAX_CHANNEL
102 } hal_isink_channel_t;
103 
104 
106 typedef enum {
107  HAL_ISINK_CLOCK_SOURCE_32KHZ = 0,
108  HAL_ISINK_CLOCK_SOURCE_2MHZ = 1
109 } hal_isink_clock_source_t ;
110 
112 typedef enum {
113  HAL_ISINK_MODE_PWM = 0,
114  HAL_ISINK_MODE_BREATH = 1,
115  HAL_ISINK_MODE_REGISTER = 2
116 } hal_isink_mode_t ;
117 
118 
120 typedef enum {
121  HAL_ISINK_OUTPUT_CURRENT_4_MA = 0,
122  HAL_ISINK_OUTPUT_CURRENT_8_MA = 1,
123  HAL_ISINK_OUTPUT_CURRENT_12_MA = 2,
124  HAL_ISINK_OUTPUT_CURRENT_16_MA = 3,
125  HAL_ISINK_OUTPUT_CURRENT_20_MA = 4,
126  HAL_ISINK_OUTPUT_CURRENT_24_MA = 5
127 } hal_isink_current_t ;
128 
130 typedef enum {
131  HAL_ISINK_TIME_0_123_SECOND = 0,
132  HAL_ISINK_TIME_0_338_SECOND = 1,
133  HAL_ISINK_TIME_0_523_SECOND = 2,
134  HAL_ISINK_TIME_0_707_SECOND = 3,
135  HAL_ISINK_TIME_0_926_SECOND = 4,
136  HAL_ISINK_TIME_1_107_SECOND = 5,
137  HAL_ISINK_TIME_1_291_SECOND = 6,
138  HAL_ISINK_TIME_1_507_SECOND = 7,
139  HAL_ISINK_TIME_1_691_SECOND = 8,
140  HAL_ISINK_TIME_1_876_SECOND = 9,
141  HAL_ISINK_TIME_2_091_SECOND = 10,
142  HAL_ISINK_TIME_2_276_SECOND = 11,
143  HAL_ISINK_TIME_2_460_SECOND = 12,
144  HAL_ISINK_TIME_2_676_SECOND = 13,
145  HAL_ISINK_TIME_2_860_SECOND = 14,
146  HAL_ISINK_TIME_3_075_SECOND = 15
147 } hal_isink_breath_adjust_on_t ;
148 
151 typedef enum {
152  HAL_ISINK_TIME_0_246_SECOND = 0,
153  HAL_ISINK_TIME_0_677_SECOND = 1,
154  HAL_ISINK_TIME_1_046_SECOND = 2,
155  HAL_ISINK_TIME_1_417_SECOND = 3,
156  HAL_ISINK_TIME_1_845_SECOND = 4,
157  HAL_ISINK_TIME_2_214_SECOND = 5,
158  HAL_ISINK_TIME_2_583_SECOND = 6,
159  HAL_ISINK_TIME_3_014_SECOND = 7,
160  HAL_ISINK_TIME_3_383_SECOND = 8,
161  HAL_ISINK_TIME_3_752_SECOND = 9,
162  HAL_ISINK_TIME_4_183_SECOND = 10,
163  HAL_ISINK_TIME_4_552_SECOND = 11,
164  HAL_ISINK_TIME_4_921_SECOND = 12,
165  HAL_ISINK_TIME_5_351_SECOND = 13,
166  HAL_ISINK_TIME_5_720_SECOND = 14,
167  HAL_ISINK_TIME_6_151_SECOND = 15
168 } hal_isink_breath_adjust_off_t ;
169 
170 
172 typedef enum {
173  HAL_ISINK_STATUS_ERROR = -3,
174  HAL_ISINK_STATUS_ERROR_CHANNEL = -2,
175  HAL_ISINK_STATUS_ERROR_INVALID_PARAMETER = -1,
176  HAL_ISINK_STATUS_OK = 0
177 } hal_isink_status_t;
178 
179 
181 typedef enum {
182  HAL_ISINK_IDLE = 0,
183  HAL_ISINK_BUSY = 1
184 } hal_isink_running_status_t;
185 
196 typedef struct {
197  hal_isink_breath_adjust_on_t darker_to_lighter_time1;
198  hal_isink_breath_adjust_on_t darker_to_lighter_time2;
199  hal_isink_breath_adjust_on_t lightest_time;
200  hal_isink_breath_adjust_on_t lighter_to_darker_time1;
201  hal_isink_breath_adjust_on_t lighter_to_darker_time2;
202  hal_isink_breath_adjust_off_t darkest_time;
203 } hal_isink_breath_mode_t;
204 
205 
219 hal_isink_status_t hal_isink_init(hal_isink_channel_t channel);
220 
221 
222 
231 hal_isink_status_t hal_isink_deinit(hal_isink_channel_t channel);
232 
233 
234 
244 hal_isink_status_t hal_isink_set_clock_source(hal_isink_channel_t channel, hal_isink_clock_source_t source_clock);
245 
246 
247 
257 hal_isink_status_t hal_isink_set_mode(hal_isink_channel_t channel, hal_isink_mode_t mode);
258 
259 
260 
270 hal_isink_status_t hal_isink_set_step_current(hal_isink_channel_t channel, hal_isink_current_t current);
271 
272 
283 hal_isink_status_t hal_isink_set_double_current(hal_isink_channel_t channel, hal_isink_current_t current);
284 
285 
295 hal_isink_status_t hal_isink_enable_breath_mode(hal_isink_channel_t channel, hal_isink_breath_mode_t breath_mode);
296 
297 
298 
307 hal_isink_status_t hal_isink_get_running_status(hal_isink_channel_t channel, hal_isink_running_status_t *running_status);
308 
309 
310 
311 #ifdef __cplusplus
312 }
313 #endif
314 
315 
321 #endif /*HAL_ISINK_MODULE_ENABLED*/
322 #endif /* __HAL_ISINK_H__ */
323