picofuse-objc

Instance Methods | Class Methods | List of all members
NXAnalogInput Class Reference

An ADC channel, or the internal temperature sensor, which is read at an interval, and which sends a message to a target when its reading changes, as an event source of the application. More...

#import <Application/Application.h>

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

Instance Methods

(uint8_t) - channel
 Returns the ADC channel, which is 0 for the temperature sensor.
 
(BOOL) - isTemperature
 Returns YES if it's the internal temperature sensor.
 
(NXDuration) - interval
 Returns how often it's read.
 
(BOOL) - isAttached
 Returns YES if it's attached, so it can be read and sends its message.
 
(float) - floatValue
 Reads it now: volts for an ADC channel, or degrees Celsius for the temperature sensor, or 0 if it isn't attached.
 
- Instance Methods inherited from NXObject
(void) - dealloc
 Frees the instance. More...
 
(NXZone *) - zone
 Returns the zone in which the instance was allocated. More...
 
(id) - retain
 Increases the retain count of the receiver. More...
 
(void) - release
 Decreases the retain count of the receiver. More...
 
(id) - autorelease
 Releases the receiver later, when the current autorelease pool of the thread is drained. More...
 
(id) - copy
 Returns a copy which can't be changed by anything else, which the caller owns and has to release. More...
 
(uintptr_t) - hash
 Returns a number for the object, which is the same for objects which are equal by isEqual:. More...
 
(NXString *) - description
 Returns a string which describes the instance, for logging. More...
 
- Instance Methods inherited from Object
(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...
 
- Instance Methods inherited from <ObjectProtocol>
(BOOL) - respondsToSelector:
 Checks if the receiver responds to a selector. More...
 

Class Methods

(NXAnalogInput *) + inputWithChannel:interval:target:selector:
 Returns an input on an ADC channel, which isn't attached. More...
 
(NXAnalogInput *) + temperatureWithInterval:target:selector:
 Returns an input on the internal temperature sensor, which isn't attached. More...
 
- Class Methods inherited from NXObject
(id) + alloc
 Allocates a new instance in the default zone, or if there isn't one, with sys_calloc(). More...
 
(id) + allocWithZone:
 Allocates a new instance in a specific zone. More...
 
(id) + new
 Allocates and initializes a new instance, as [[cls alloc] init] does. More...
 
(NXString *) + description
 Returns the name of the class.
 
- Class Methods inherited from Object
(void) + initialize
 Performs one-time initialization for the class. 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...
 

Additional Inherited Members

- Protected Attributes inherited from Object
Class isa
 A pointer to the object's class structure. More...
 

Detailed Description

An ADC channel, or the internal temperature sensor, which is read at an interval, and which sends a message to a target when its reading changes, as an event source of the application.

It's an ADC device of picofuse's HID while it's attached with -[NXApplication attachEventSource:], and it can only be read then. The message is sent on any of the run loop's workers, with the input as its argument. Where there's no ADC, as on a Mac or Linux, it doesn't attach. On an RP2040, channels 0 to 2 are GP26 to GP28, and 3 is GP29, which on a Pico W is a third of VSYS.

Definition at line 23 of file NXAnalogInput.h.

Method Documentation

◆ inputWithChannel:interval:target:selector:()

+ (NXAnalogInput *) inputWithChannel: (uint8_t)  channel
interval: (NXDuration)  interval
target: (id)  target
selector: (SEL)  selector 

Returns an input on an ADC channel, which isn't attached.

Parameters
channelThe ADC channel.
intervalHow often it's read, rounded up to a millisecond.
targetWhat the message is sent to when its reading changes, which is retained.
selectorA method of the target which has the input as its one argument.
Returns
The input, or nil if the interval isn't positive, or the selector isn't a method of the target which takes one object.

◆ temperatureWithInterval:target:selector:()

+ (NXAnalogInput *) temperatureWithInterval: (NXDuration)  interval
target: (id)  target
selector: (SEL)  selector 

Returns an input on the internal temperature sensor, which isn't attached.

Returns
The input, or nil, as for inputWithChannel:interval:target:selector:.

The documentation for this class was generated from the following file: