• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/* Copyright 2022 Unionman Technology Co., Ltd.
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 *
15 */
16
17/**
18 * unionman a311d
19 * @since 8
20 * @devices phone, tablet
21 * @import import gpioLed from '@ohos.gpioLed';
22 * @permission N/A
23 */
24
25declare namespace gpioLed {
26    const LED_ON = 1;
27    const LED_OFF = 0;
28    /**
29     * 设置LED灯的开关状态
30     * @param pin pin口号
31     * @param status 状态,1:开启;0:关闭;
32     * @param callback 	回调函数
33     */
34    function setLedStatusWithCallback(pin: number, status: number, callback: (result: number) => void): void;
35
36    /**
37     * 设置LED灯的开关状态
38     * @param pin pin口号
39     * @param status 状态,1:开启;0:关闭;
40     */
41    function setLedStatusWithPromise(pin: number, status: number): Promise<number>;
42
43    /**
44     * 设置LED灯的开关状态
45     * @param pin pin口号
46     * @param status 状态,1:开启;0:关闭;
47     * @param callback 	回调函数
48     */
49    function setLedStatus(pin: number, status: number, callback: (result: number) => void): void;
50
51    /**
52     * 设置LED灯的开关状态
53     * @param pin pin口号
54     * @param status 状态,1:开启;0:关闭;
55     */
56    function setLedStatus(pin: number, status: number): Promise<number>;
57
58    /**
59     * 获取LED灯的开关状态
60     * @param pin pin口号
61     * @param callback 	回调函数
62     */
63    function getLedStatusWithCallback(pin: number, callback: (result: number) => void): void;
64
65    /**
66     * 获取LED灯的开关状态
67     * @param pin pin口号
68     */
69    function getLedStatusWithPromise(pin: number): Promise<number>;
70
71    /**
72     * 获取LED灯的开关状态
73     * @param pin pin口号
74     * @param callback 	回调函数
75     */
76    function getLedStatus(pin: number, callback: (result: number) => void): void;
77
78    /**
79     * 获取LED灯的开关状态
80     * @param pin pin口号
81     */
82    function getLedStatus(pin: number): Promise<number>;
83}
84
85export default gpioLed;