JeeLib
An easy interface to the port headers, the RF12 driver library, timers, low-power code, and more.
 All Classes Files Functions Variables Enumerations Macros Pages
BlinkPlug Class Reference

Interface for the Blink Plug - see https://jeelabs.org/bp. More...

#include <Ports.h>

Inheritance diagram for BlinkPlug:
Port

Public Types

enum  {
  ALL_OFF, ON1, OFF1, ON2,
  OFF2, SOME_ON, ALL_ON
}
 Enum containing shorthands for BlinkPlug button states.
 

Public Member Functions

 BlinkPlug (byte port)
 Constructor for the BlinkPlug class. More...
 
void ledOn (byte mask)
 Turn on the corresponding leds. More...
 
void ledOff (byte mask)
 Turn off the corresponding leds. More...
 
byte ledState () const
 
byte state ()
 Read entire BlinkPlug state. More...
 
byte pushed ()
 
byte buttonCheck ()
 Check the state of the buttons. More...
 
- Public Member Functions inherited from Port
 Port (uint8_t num)
 Contructor for a Port.
 
void mode (uint8_t value) const
 Set the pin mode of a Port's D pin. More...
 
uint8_t digiRead () const
 Reads the value of a Port's D pin. More...
 
void digiWrite (uint8_t value) const
 Write High or Low to a Port's D pin. More...
 
void anaWrite (uint8_t val) const
 Writes a PWM value to a Port's D pin.
 
uint32_t pulse (uint8_t state, uint32_t timeout=1000000L) const
 Applies the Arduino pulseIn() function on a Port's D pin. More...
 
void mode2 (uint8_t value) const
 Set the pin mode of a Port's A pin. More...
 
uint16_t anaRead () const
 Reads an analog value from a Port's A pin. More...
 
uint8_t digiRead2 () const
 Reads the value of a Port's A pin. More...
 
void digiWrite2 (uint8_t value) const
 Write High or Low to a Port's A pin. More...
 
uint32_t pulse2 (uint8_t state, uint32_t timeout=1000000L) const
 Applies the Arduino pulseIn() function on a Port's A pin. More...
 
void shift (uint8_t bitOrder, uint8_t value) const
 Does Arduino shiftOut() with data on D and clock on A pin of the Port. More...
 
uint16_t shiftRead (uint8_t bitOrder, uint8_t count=8) const
 Shift a number of bites in to read them. More...
 
void shiftWrite (uint8_t bitOrder, uint16_t value, uint8_t count=8) const
 The shiftWrite() call is similar but more general than the shift() call in that it allows an adjustable number of bits to be sent, not just 8. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Port
static void mode3 (uint8_t value)
 Set the pin mode of the I pin on all Ports. More...
 
static uint8_t digiRead3 ()
 Reads the value of the I pin on all Ports. More...
 
static void digiWrite3 (uint8_t value)
 Writes the value of the I pin on all Ports. More...
 
static void anaWrite3 (uint8_t val)
 Writes a PWM value to the I pin of all Ports.
 
- Protected Member Functions inherited from Port
uint8_t digiPin () const
 
uint8_t digiPin2 () const
 
uint8_t anaPin () const
 
- Static Protected Member Functions inherited from Port
static uint8_t digiPin3 ()
 
- Protected Attributes inherited from Port
uint8_t portNum
 The port number is a small integer mathing the hardware port used. More...
 

Detailed Description

Interface for the Blink Plug - see https://jeelabs.org/bp.

Constructor & Destructor Documentation

BlinkPlug::BlinkPlug ( byte  port)
inline

Constructor for the BlinkPlug class.

Parameters
portPortnumber the blinkplug is connected to.

Member Function Documentation

byte BlinkPlug::buttonCheck ( )

Check the state of the buttons.

Returns
The corresponding enum state: ON1, OFF1, ON2, or OFF2.
void BlinkPlug::ledOff ( byte  mask)

Turn off the corresponding leds.

Parameters
mask0 for neither led, 1 for the first led, 2 for the second led or 3 for both leds.
void BlinkPlug::ledOn ( byte  mask)

Turn on the corresponding leds.

Parameters
mask0 for neither led, 1 for the first led, 2 for the second led or 3 for both leds.
byte BlinkPlug::ledState ( ) const
inline
Returns
One byte containing the state of both leds.
byte BlinkPlug::pushed ( )
Deprecated:
This is obsolete code, use buttonCheck().
byte BlinkPlug::state ( )

Read entire BlinkPlug state.

Returns
One byte with the state of the leds on the 1st and 2nd least significant bits and the state of the buttons on the 3rd and 4th least significant bits.

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