GlowBit.py
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
glowbit.glowbit Class Reference

Low-level methods common to all GlowBit classes. More...

Inheritance diagram for glowbit.glowbit:
Inheritance graph
[legend]
Collaboration diagram for glowbit.glowbit:
Collaboration graph
[legend]

Public Member Functions

def pixelsShow (self)
 Pushes the internal pixel data buffer to the physical GlowBit LEDs. More...
 
def pixelSet (self, i, colour)
 Sets the i'th GlowBit LED to a 32-bit GlowBit colour value. More...
 
def pixelSetNow (self, i, colour)
 Sets the i'th GlowBit LED to a 32-bit GlowBit colour value and updates the physical LEDs. More...
 
def pixelAdd (self, i, colour)
 Adds a 32-bit GlowBit colour value to the i'th LED in the internal buffer only. More...
 
def pixelSaturatingAdd (self, i, colour)
 Adds a 32-bit GlowBit colour value to the i'th LED in the internal buffer. More...
 
def pixelsFill (self, colour)
 Fills all pixels with a solid colour value. More...
 
def pixelsFillNow (self, colour)
 Fills all pixels with a solid colour value and updates the physical LEDs. More...
 
def blankDisplay (self)
 Blanks the entire GlowBit display. More...
 
def getPixel (self, N)
 Returns the 32-bit GlowBit colour value of the i'th LED. More...
 
def updateRateLimitFPS (self, rateLimitFPS)
 Sets a new value for the GlowBit display's frames per second (FPS) limiter. More...
 
def power (self)
 Calculates an estimate for the total power draw given the current display data. More...
 
def chaos (self, iters=100)
 Sets random colour values on every LED on the attached GlowBit display. More...
 
- Public Member Functions inherited from glowbit.colourFunctions
def wheel (self, pos)
 Converts an integer "colour wheel position" to a packed 32-bit RGB GlowBit colour value. More...
 
def rgbColour (self, r, g, b)
 Converts the r, g, and b integer arguments to a packed 32-bit RGB GlowBit colour value. More...
 
def glowbitColour2RGB (self, colour)
 Converts a 32-bit GlowBit colour value to an (R,G,B) tuple. More...
 
def red (self)
 Returns the GlowBit colour value for pure red.
 
def green (self)
 Returns the GlowBit colour value for pure green.
 
def blue (self)
 Returns the GlowBit colour value for pure blue.
 
def yellow (self)
 Returns the GlowBit colour value for yellow.
 
def purple (self)
 Returns the GlowBit colour value for purple.
 
def cyan (self)
 Returns the GlowBit colour value for cyan.
 
def white (self)
 Returns the GlowBit colour value for white.
 
def black (self)
 Returns the GlowBit colour value for black.
 
- Public Member Functions inherited from glowbit.colourMaps
def colourMapSolid (self, index, minIndex, maxIndex)
 Trivial colourmap method which always returns the colour in the parent object. More...
 
def colourMapRainbow (self, index, minIndex, maxIndex)
 Maps the pure hue colour wheel between minIndex and maxIndex. More...
 

Public Attributes

 lastFrame_ms
 
 rateLimit
 

Static Public Attributes

 sideset_init
 
 OUT_LOW
 
 out_shiftdir
 
 SHIFT_LEFT
 
 autopull
 
 True
 
 pull_thresh
 

Detailed Description

Low-level methods common to all GlowBit classes.

Member Function Documentation

◆ blankDisplay()

def glowbit.glowbit.blankDisplay (   self)

Blanks the entire GlowBit display.

ie: sets the colour value of all GlowBit LEDs to zero in the internal buffer and updates the physical LEDs.

◆ chaos()

def glowbit.glowbit.chaos (   self,
  iters = 100 
)

Sets random colour values on every LED on the attached GlowBit display.

This function is blocking, it does not return until the number of frames specified in the iters parameter have been drawn.

Parameters
itersThe number of frames to draw.

◆ getPixel()

def glowbit.glowbit.getPixel (   self,
  N 
)

Returns the 32-bit GlowBit colour value of the i'th LED.

Parameters
iThe index of the LED
Returns
The 32-bit GlowBit colour value of the i'th LED

◆ pixelAdd()

def glowbit.glowbit.pixelAdd (   self,
  i,
  colour 
)

Adds a 32-bit GlowBit colour value to the i'th LED in the internal buffer only.

Data colour corruption will occur if the sum result of any RGB value exceeds 255. Care must be taken to avoid this manually. eg: if the blue channel's resulting intensity value is 256 it will be set to zero and the red channel incremented by 1. See the colourFunctions class documentation for the 32-bit GlowBit colour specification.

NB: For efficiency, this method does not do any index bounds checking. If the value of the parameter i is larger than the number of LEDs it will cause an IndexError exception.

Parameters
iAn LED's index
colourThe 32-bit GlowBit colour value

◆ pixelSaturatingAdd()

def glowbit.glowbit.pixelSaturatingAdd (   self,
  i,
  colour 
)

Adds a 32-bit GlowBit colour value to the i'th LED in the internal buffer.

This function performs "saturating" arithmetic. It is much slower than pixelAdd but will saturate at 255 to avoid data corruption.

NB: For efficiency, this method does not do any index bounds checking. If the value of the parameter i is larger than the number of LEDs it will cause an IndexError exception.

Parameters
iAn LED's index
colourThe 32-bit GlowBit colour value

◆ pixelSet()

def glowbit.glowbit.pixelSet (   self,
  i,
  colour 
)

Sets the i'th GlowBit LED to a 32-bit GlowBit colour value.

NB: For efficiency, this method does not do any bounds checking. If the value of the parameter i is larger than the number of LEDs it will cause an IndexError exception.

Parameters
iAn LED's index
colourThe 32-bit GlowBit colour value

◆ pixelSetNow()

def glowbit.glowbit.pixelSetNow (   self,
  i,
  colour 
)

Sets the i'th GlowBit LED to a 32-bit GlowBit colour value and updates the physical LEDs.

NB: For efficiency, this method does not do any index bounds checking. If the value of the parameter i is larger than the number of LEDs it will cause an IndexError exception.

Parameters
iAn LED's index
colourThe 32-bit GlowBit colour value

◆ pixelsFill()

def glowbit.glowbit.pixelsFill (   self,
  colour 
)

Fills all pixels with a solid colour value.

Parameters
colourThe 32-bit GlowBit colour value

◆ pixelsFillNow()

def glowbit.glowbit.pixelsFillNow (   self,
  colour 
)

Fills all pixels with a solid colour value and updates the physical LEDs.

Parameters
colourThe 32-bit GlowBit colour value

◆ pixelsShow()

def glowbit.glowbit.pixelsShow (   self)

Pushes the internal pixel data buffer to the physical GlowBit LEDs.

This function must be called before the connected GlowBit LEDs will change colour.

Note that several GlowBit library methods call this method unconditionally (eg: glowbit.blankDisplay ) or optionally (eg: by passing the update = True parameter to stick.graph1D() )

◆ power()

def glowbit.glowbit.power (   self)

Calculates an estimate for the total power draw given the current display data.

Use as a general guide only, error range is around 10-20%.

The estimate is a 4th order polynomical interpolation given measurements of white brightness. The power consumption of pure colours will tend to be under-estimated by up to about 10-20%.

Data was measured at a supply voltage of 3.3V but supply current was not found to vary significantly with supply voltage.

Returns
The current consumption of the framebuffer in amps.

◆ updateRateLimitFPS()

def glowbit.glowbit.updateRateLimitFPS (   self,
  rateLimitFPS 
)

Sets a new value for the GlowBit display's frames per second (FPS) limiter.

Parameters
rateLimitFPSAn integer in units of frames per second.

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