objc

Instance Methods | Class Methods

The GPIO class. More...

#import <Application/Application.h>

Inheritance diagram for GPIO:
Inheritance graph
[legend]
Collaboration diagram for GPIO:
Collaboration graph
[legend]

Instance Methods

(uint8_t) - pin
 Returns the pin number.
 
(bool) - isInput
 Returns true if the GPIO pin is configured as an input.
 
(bool) - isOutput
 Returns true if the GPIO pin is configured as an output.
 
(BOOL- state
 Returns the state of the GPIO pin. More...
 
(void) - setState:
 Sets the state of the GPIO pin. More...
 
- Instance Methods inherited from NXObject
(id- retain
 Increases the retain count of the receiver. More...
 
(void) - release
 Decreases the retain count of the receiver. More...
 
(id- autorelease
 Adds the receiver to the autorelease pool.
 
- Instance Methods inherited from Object
(void) - dealloc
 Free resources for an existing instance.
 
(id- init
 Initialize the instance, after allocation. More...
 
(Class- class
 Returns the class of the instance. More...
 
(Class- superclass
 Returns the superclass of the instance. More...
 
(BOOL- isEqual:
 Compares the receiver to another object for equality. More...
 
(BOOL- isKindOfClass:
 Returns a Boolean value that indicates whether the receiver is an instance of a given class. More...
 
(BOOL- conformsTo:
 Checks if the receiver's class conforms to a protocol. More...
 
(NXString *) - description
 Returns a string that represents the instance. More...
 
- Instance Methods inherited from <ObjectProtocol>
(BOOL- respondsToSelector:
 Checks if the receiver responds to a selector. More...
 

Class Methods

(GPIO *) + inputWithPin:
 Returns a GPIO input instance. More...
 
(GPIO *) + pullupWithPin:
 Returns a GPIO input instance, with pull-up resistor enabled. More...
 
(GPIO *) + pulldownWithPin:
 Returns a GPIO input instance, with pull-down resistor enabled. More...
 
(GPIO *) + outputWithPin:
 Returns a GPIO output instance. More...
 
(uint8_t) + count
 Returns the total number of GPIO pins available. More...
 
(void) + setDelegate:
 Sets the delegate for GPIO events. More...
 
(id< GPIODelegate >) + delegate
 Returns the current delegate for GPIO events. More...
 
- Class Methods inherited from NXObject
(id+ allocWithZone:
 Allocates a new instance of an object in a specific memory zone. More...
 
- Class Methods inherited from Object
(void) + initialize
 Performs one-time initialization for the class. More...
 
(id+ alloc
 Allocate a new class instance. More...
 
(Class+ class
 Returns the class object. More...
 
(Class+ superclass
 Returns the superclass of the class. More...
 
(const char *) + name
 Returns the name of the class. More...
 
(BOOL+ conformsTo:
 Checks if the class conforms to a protocol. More...
 
(NXString *) + description
 Returns a string that represents the class. More...
 

Additional Inherited Members

- Protected Attributes inherited from NXObject
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.
 
- Protected Attributes inherited from Object
Class isa
 A pointer to the object's class structure. More...
 

Detailed Description

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.

Method Documentation

◆ count()

+ (uint8_t) count

Returns the total number of GPIO pins available.

Returns
The total number of GPIO pins. Returns 0 if GPIO is not available.

◆ delegate()

+ (id<GPIODelegate>) 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
pinThe 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
pinThe 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
pinThe 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
pinThe 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:()

+ (void) setDelegate: (id< GPIODelegate >)  delegate

Sets the delegate for GPIO events.

Parameters
delegateThe 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
statetrue to set the pin high (logical 1), false to set low (logical 0).

◆ state()

- (BOOL) 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: