picofuse-objc

NXPin.h
Go to the documentation of this file.
1 
5 #pragma once
6 #include "NXEventSource.h"
8 
13 typedef enum {
17 } NXPinPull;
18 
28 @interface NXPin : NXObject {
29 @protected
30  uint8_t _bank;
31  uint8_t _pin;
32 }
33 
37 - (uint8_t)bank;
38 
42 - (uint8_t)pin;
43 
47 - (BOOL)boolValue;
48 
49 @end
50 
59 @interface NXDigitalOutput : NXPin {
60 @private
61  void *_gpio;
62 }
63 
69 + (NXDigitalOutput *)outputWithPin:(uint8_t)pin;
70 
75 + (NXDigitalOutput *)outputWithBank:(uint8_t)bank pin:(uint8_t)pin;
76 
80 - (void)setBoolValue:(BOOL)value;
81 
85 - (void)toggle;
86 
87 @end
88 
105 @private
106  NXPinPull _pull;
107  id _target;
108  SEL _selector;
109  void *_device;
110  uint16_t _attachment;
111  BOOL _userButton;
112  BOOL _undebounced;
113 }
114 
125 + (NXDigitalInput *)inputWithPin:(uint8_t)pin
126  pull:(NXPinPull)pull
127  target:(id)target
128  selector:(SEL)selector;
129 
133 + (NXDigitalInput *)inputWithBank:(uint8_t)bank
134  pin:(uint8_t)pin
135  pull:(NXPinPull)pull
136  target:(id)target
137  selector:(SEL)selector;
138 
148 + (NXDigitalInput *)userButtonWithTarget:(id)target selector:(SEL)selector;
149 
153 - (NXPinPull)pull;
154 
158 - (BOOL)isAttached;
159 
163 - (BOOL)isDebounced;
164 
170 - (void)setDebounced:(BOOL)debounced;
171 
172 @end
NXPinPull
Whether an input is pulled up or down when nothing drives it.
Definition: NXPin.h:13
Foundation framework header.
Pulled down, so it's low when nothing drives it.
Definition: NXPin.h:16
Neither, so it floats when nothing drives it.
Definition: NXPin.h:14
Something which produces events, such as a timer, while it's attached to the application with -[NXApp...
Definition: NXEventSource.h:17
uint8_t _pin
The pin in the bank.
Definition: NXPin.h:31
Pulled up, so it's high when nothing drives it.
Definition: NXPin.h:15
A pin which is read, and which sends a message to a target when its level changes, as an event source of the application.
Definition: NXPin.h:104
A pin which is driven high or low.
Definition: NXPin.h:59
BOOL boolValue()
Returns YES if the pin is high, or NO if it's low or can't be read.
uint8_t _bank
The bank, which is 0 on a Pico.
Definition: NXPin.h:30
A pin of picofuse's GPIO: one of a bank's pins, and its level.
Definition: NXPin.h:28
Defines the NXEventSource protocol, for what produces events for an application.
uint8_t bank()
Returns the bank, which is 0 on a Pico.
bool BOOL
A Boolean value.
Definition: runtime.h:60
The base class for objects in the Foundation framework.
Definition: NXObject.h:28
const struct objc_selector * SEL
A pointer to a method selector.
Definition: runtime.h:23
struct objc_object * id
A pointer to an instance of a class.
Definition: runtime.h:18
uint8_t pin()
Returns the pin in the bank.