The GPIO class.
More...
#import <Application/Application.h>
|
id | _zone |
| The memory zone where the object is allocated.
|
|
unsigned short | _retain |
| The retain count of the object.
|
|
id | _next |
| The next object in an autorelease pool.
|
|
Class | isa |
| A pointer to the object's class structure. More...
|
|
The GPIO class.
GPIO represents a class for controlling General Purpose Input/Output (GPIO) pins.
- Examples:
- examples/Application/gpio/main.m.
Definition at line 23 of file GPIO.h.
◆ count()
Returns the total number of GPIO pins available.
- Returns
- The total number of GPIO pins. Returns 0 if GPIO is not available.
◆ delegate()
Returns the current delegate for GPIO events.
- Returns
- The current GPIO delegate, or nil if not set.
◆ inputWithPin:()
+ (GPIO *) inputWithPin: |
|
(uint8_t) |
pin |
|
Returns a GPIO input instance.
- Parameters
-
pin | The GPIO pin number to configure as input. |
- Returns
- A new GPIO instance configured for input, or nil if the pin is invalid or initialization failed.
This method creates a GPIO instance configured as a floating input pin. The pin will not have any internal pull-up or pull-down resistors enabled, so external circuitry should be used to ensure proper logic levels.
- Note
- The pin number must be valid for the target platform.
- See also
- + pullupWithPin: for input with pull-up resistor
-
+ pulldownWithPin: for input with pull-down resistor
◆ outputWithPin:()
+ (GPIO *) outputWithPin: |
|
(uint8_t) |
pin |
|
Returns a GPIO output instance.
- Parameters
-
pin | The GPIO pin number to configure as output. |
- Returns
- A new GPIO instance configured for output, or nil if the pin is invalid or initialization failed.
This method creates a GPIO instance configured as an output pin. The initial state of the pin is platform-dependent and should be explicitly set using setState: after creation.
- Note
- The pin number must be valid for the target platform.
- See also
- - setState: for controlling the output - state
◆ pulldownWithPin:()
+ (GPIO *) pulldownWithPin: |
|
(uint8_t) |
pin |
|
Returns a GPIO input instance, with pull-down resistor enabled.
- Parameters
-
pin | The GPIO pin number to configure as input with pull-down. |
- Returns
- A new GPIO instance configured for input with pull-down, or nil if the pin is invalid or initialization failed.
This method creates a GPIO instance configured as an input pin with the internal pull-down resistor enabled. The pin will read as logical low (0) when not driven high by external circuitry.
- Note
- The pin number must be valid for the target platform.
- See also
- + inputWithPin: for floating input
-
+ pullupWithPin: for input with pull-up resistor
◆ pullupWithPin:()
+ (GPIO *) pullupWithPin: |
|
(uint8_t) |
pin |
|
Returns a GPIO input instance, with pull-up resistor enabled.
- Parameters
-
pin | The GPIO pin number to configure as input with pull-up. |
- Returns
- A new GPIO instance configured for input with pull-up, or nil if the pin is invalid or initialization failed.
This method creates a GPIO instance configured as an input pin with the internal pull-up resistor enabled. The pin will read as logical high (1) when not driven low by external circuitry.
- Note
- The pin number must be valid for the target platform.
- See also
- + inputWithPin: for floating input
-
+ pulldownWithPin: for input with pull-down resistor
◆ setDelegate:()
Sets the delegate for GPIO events.
- Parameters
-
delegate | The delegate to set. |
This delegate will be notified of GPIO events, such as input changes. The delegate is not retained by the GPIO instance, so it must be retained by the caller. If called with nil, the current delegate will be removed.
◆ setState:()
- (void) setState: |
|
(BOOL) |
state |
|
Sets the state of the GPIO pin.
- Parameters
-
state | true to set the pin high (logical 1), false to set low (logical 0). |
◆ state()
Returns the state of the GPIO pin.
- Returns
- true if the pin is high (logical 1), false if low (logical 0).
The documentation for this class was generated from the following file: