Lines Matching refs:pin
11 - Setting the pin direction, which can be input or output (high impedance is not supported currentl…
12 - Reading and writing the pin level, which can be low or high
13 - Setting an interrupt service routine (ISR) function and interrupt trigger mode for a pin
14 - Enabling or disabling interrupts for a pin
22 …When a GPIO is used as an input, it reads the level state (high or low) of each pin. Common input …
26 …When a GPIO is used as an output, it sets the pin level. Common output modes include open-drain ou…
48 As a concept at the software layer, GPIO is used to manage GPIO pin resources. You can use the GPIO…
58 | GpioGetByName(const char *gpioName) | Obtains the GPIO pin number. …
59 | int32_t GpioRead(uint16_t gpio, uint16_t *val) | Reads the level of a GPIO pin. …
60 | int32_t GpioWrite(uint16_t gpio, uint16_t val) | Writes the level of a GPIO pin. …
61 …Dir(uint16_t gpio, uint16_t *dir) | Obtains the direction of a GPIO pin. |
62 | int32_t GpioSetDir(uint16_t gpio, uint16_t dir) | Sets the direction for a GPIO pin.…
63 …t GpioUnsetIrq(uint16_t gpio, void *arg); | Cancels the ISR function for a GPIO pin. |
64 …uint16_t gpio, uint16_t mode, GpioIrqFunc func, void *arg) | Sets an ISR function for a GPIO pin. |
65 | int32_t GpioEnableIrq(uint16_t gpio) | Enables interrupts for a GPIO pin.…
66 | int32_t GpioDisableIrq(uint16_t gpio) | Disables interrupts for a GPIO pin…
74 …s how to use the GPIO APIs to manage pins. In the APIs, a GPIO pin is identified by the pin number.
82 You can determine the GPIO pin number in either of the following ways:
84 - Calculating the pin number based on the system on chip (SoC)
86 …The method for determining the GPIO pin number varies depending on the GPIO controller model, para…
92 GPIO pin number = GPIO group number x Number of GPIO pins in each group + Offset in the group
96 GPIO pin number of GPIO10_3 = 10 x 8 + 3 = 83
102 GPIO pin number = GPIO group number x Number of GPIO pins in each group + Offset in the group
106 GPIO pin number of GPIO7_3 = 7 x 10 + 3 = 73
108 - Obtaining the pin number based on the pin alias
110 …Use **GpioGetByName()** to obtain the pin number based on the pin alias. The global pin number is …
118 Before performing read/write operations on a GPIO pin, use **GpioSetDir()** to set the pin directio…
128 | gpio | GPIO pin number.|
134 Example: Set the direction of GPIO pin 3 to output.
139 ret = GpioSetDir(3, GPIO_DIR_OUT); // Set GPIO pin 3 as an output.
148 Use **GpioGetDir()** to obtain the GPIO pin direction.
158 | gpio | GPIO pin number.|
164 Example: Obtain the direction of GPIO pin 3.
170 ret = GpioGetDir(3, &dir); // Obtain the direction of GPIO pin 3.
179 Use **GpioRead()** to read the level of a GPIO pin.
189 | gpio | GPIO pin number. |
195 Example: Read the level of GPIO pin 3.
201 ret = GpioRead(3, &val); // Read the level of GPIO pin 3.
210 Use **GpioWrite()** to write the level for a GPIO pin.
220 | gpio | GPIO pin number.|
226 Example: Write a low level value to the register of GPIO pin 3.
231 ret = GpioWrite(3, GPIO_VAL_LOW); // Write a low level value to the register of GPIO pin 3.
240 Use **GpioSetIrq()** to set an ISR function for a GPIO pin.
250 | gpio | GPIO pin number. |
259 > Only one ISR function can be set for a GPIO pin. If **GpioSetIrq** is called repeatedly, the prev…
273 | gpio | GPIO pin number. |
281 After the ISR function is set, call **GpioEnableIrq()** to enable interrupts for the GPIO pin.
291 | gpio | GPIO pin number. |
297 > The configured ISR function can be responded only after interrupts are enabled for the GPIO pin.
301 Use **GpioDisableIrq()** to disable interrupts for a pin.
310 | gpio | GPIO pin number. |
333 /* Enable interrupts for GPIO pin 3. */
340 /* Disable interrupts for GPIO pin 3. */
347 /* Cancel the ISR function for GPIO pin 3. */
357 The following example shows how to trigger an interrupt for a GPIO pin. The procedure is as follows…
359 …idle GPIO pin, for example, pin GPIO10_3 on a Hi3516D V300 development board. The pin number of GP…
360 2. Set an ISR function for the pin, with the interrupt trigger mode of rising edge and falling edge.
361 3. Write high and low levels to the pin alternately, and observe the execution of the ISR function.
387 uint16_t gpio = 83; /* Number of the GPIO pin to test */
390 /* Set the pin direction to output. */
397 /* Disable interrupts of the pin. */
404 /* Set the ISR function for the pin. The trigger mode is both rising edge and falling edge. */
413 /* Enable interrupts for the pin. */
423 /* Wait for the ISR function to trigger for this pin. The timeout duration is 1000 ms. */