90 this->m_mask = (uint32_t) (1 << pinNum);
102 void write (
const bool value)
const {
115 return (
bool) this->read_fast();
125 waitpeq(this->m_mask, this->m_mask);
135 waitpeq(0, this->m_mask);
145 waitpne(this->read_fast(), this->m_mask);
158 if (!(this->
read())) {
159 waitcnt(debounceDelayInMillis * MILLISECOND + CNT);
161 return !(this->
read());
173 this->m_mask = rhs.m_mask;
181 return this->m_mask == rhs.m_mask;
191 void set_mask (
const uint32_t mask) {
197 void add_pins (
const uint32_t mask) {
203 uint32_t read_fast ()
const {
Pin()
Initialize to a NULL pin mask.
void set_mask(const PropWare::Port::Mask mask)
Utility class to handle general purpose I/O pins.
void set_dir(const PropWare::Port::Dir direction) const
Set port as either input or output.
void clear() const
Clear selected output port (set it to 0)
Generic definitions and functions for the Parallax Propeller.
Pin(const PropWare::Port::Mask mask, const PropWare::Port::Dir direction)
static void flash_pin(const Pin::Mask pinMask, const uint32_t iterations=10)
Great for quick debugging to ensure a line of code is executed, this will quickly flash a given pin a...
bool operator==(const PropWare::Pin &rhs)
Compare the pin mask of two pin objects. Does not compare I/O direction.
bool is_switch_low(const uint16_t debounceDelayInMillis=3) const
Allow easy switch-press detection of any pin; Includes de-bounce protection.
void wait_until_toggle() const
Hold cog execution until an input pin toggles.
void write(const bool value) const
Set or clear the pin programmatically.
void wait_until_high() const
Hold cog execution until an input pin goes high.
void wait_until_low() const
Hold cog execution until an input pin goes low.
Pin(const PropWare::Port::Mask mask)
Create a Pin variable.
bool read() const
Read the value from a single pin and return its state.
void set_mask(const uint32_t mask)
Set the mask for this port.
uint32_t read_fast() const
Allow easy reading of only selected pins from a port.
void set_pin_num(const uint8_t pinNum)
Set a Pin's mask based on the pin number (an integer, 0 through 31)
Flexible port that can have any pin enabled or disabled. Pins are independent of each other...
PropWare::Pin * operator=(const PropWare::Pin &rhs)
Copy one pin object into another; Only copies pin mask, not I/O direction.
static void flash_port(const uint32_t pinMask, uint32_t iterations=10)
Great for quick debugging to ensure a line of code is executed, this will quickly flash a given set o...