GlowBit.py
|
Low-level methods common to all GlowBit classes. More...
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 | |
Low-level methods common to all GlowBit classes.
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.
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.
iters | The number of frames to draw. |
def glowbit.glowbit.getPixel | ( | self, | |
N | |||
) |
Returns the 32-bit GlowBit colour value of the i'th LED.
i | The index of the LED |
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.
i | An LED's index |
colour | The 32-bit GlowBit colour value |
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.
i | An LED's index |
colour | The 32-bit GlowBit colour value |
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.
i | An LED's index |
colour | The 32-bit GlowBit colour value |
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.
i | An LED's index |
colour | The 32-bit GlowBit colour value |
def glowbit.glowbit.pixelsFill | ( | self, | |
colour | |||
) |
Fills all pixels with a solid colour value.
colour | The 32-bit GlowBit colour value |
def glowbit.glowbit.pixelsFillNow | ( | self, | |
colour | |||
) |
Fills all pixels with a solid colour value and updates the physical LEDs.
colour | The 32-bit GlowBit colour value |
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() )
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.
def glowbit.glowbit.updateRateLimitFPS | ( | self, | |
rateLimitFPS | |||
) |
Sets a new value for the GlowBit display's frames per second (FPS) limiter.
rateLimitFPS | An integer in units of frames per second. |