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

Class for driving triangular GlowBit modules. More...

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

Public Member Functions

def __init__ (self, numTris=1, LEDsPerTri=6, pin=18, brightness=20, rateLimitFPS=20, sm=0)
 Initialisation routine for triangular GlowBit modules and tiled arrays thereof. More...
 
def fillTri (self, tri, colour)
 Fills all LEDs on a given triangle with the same colour. More...
 
def demo (self)
 Displays a simple demo pattern.
 
- Public Member Functions inherited from glowbit.glowbit
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

 sm
 
 pixelsShow
 
 ticks_ms
 
 LEDsPerTri
 
 numLEDs
 
 numTris
 
 strip
 
 ar
 
 dimmer_ar
 
 rateLimit
 
 brightness
 
 lastFrame_ms
 
- Public Attributes inherited from glowbit.glowbit
 lastFrame_ms
 
 rateLimit
 

Additional Inherited Members

- Static Public Attributes inherited from glowbit.glowbit
 sideset_init
 
 OUT_LOW
 
 out_shiftdir
 
 SHIFT_LEFT
 
 autopull
 
 True
 
 pull_thresh
 

Detailed Description

Class for driving triangular GlowBit modules.

Constructor & Destructor Documentation

◆ __init__()

def glowbit.triangle.__init__ (   self,
  numTris = 1,
  LEDsPerTri = 6,
  pin = 18,
  brightness = 20,
  rateLimitFPS = 20,
  sm = 0 
)

Initialisation routine for triangular GlowBit modules and tiled arrays thereof.

Parameters
numTrisThe number of triangle modules in the tiled array.
LEDsPerTriThe number of LEDs on each triangular module.
pinThe GPIO pin connected to the GlowBit stick module. Defaults to 18 as that pin is compatible with the Raspberry Pi and Raspberry Pi Pico. Any pin can be used on the Raspberry Pi Pico, only pins 18 and 12 are valid on the Raspberry Pi.
brightnessThe relative brightness of the LEDs. Colours drawn to the internal buffer should be in the range [0,255] and the brightness parameter scales this value before drawing to the physical display. If brightness is an integer it should be in the range [0,255]. If brightness is floating point it is assumed to be in the range [0,1.0].
rateLimitFPSThe maximum frame rate of the display in frames per second. The pixelsShow() function blocks to enforce this limit.
sm(Raspberry Pi Pico only) The PIO state machine to generate the GlowBit data stream. Each connected GlowBit display chain requires a unique state machine. Valid values are in the range [0,7].

Member Function Documentation

◆ fillTri()

def glowbit.triangle.fillTri (   self,
  tri,
  colour 
)

Fills all LEDs on a given triangle with the same colour.

Parameters
triThe triangle to fill. The first triangle is addressed with 0.
colourA 32-bit GlowBit colour value

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