Module Display :: Class Display
[hide private]
[frames] | no frames]

Class Display

source code

Abstraction of the 4 digit 7-segment display attached to the I2C port. If no display is found, all methods return immediately.

Instance Methods [hide private]
 
__init__(self)
Creates a display instance either from class Display4tronix or DisplayDidel.
source code
 
_setup(self, robot) source code
 
clear(self)
Turns all digits off.
source code
 
showText(self, text, pos=0, dp=[0, 0, 0, 0])
Displays 4 characters of the given text.
source code
 
scrollToLeft(self)
Scrolls the scrollable text one step to the left.
source code
 
scrollToRight(self)
Scrolls the scrollable text one step to the left.
source code
 
setToStart(self)
Shows the scrollable text at the start position.
source code
 
showTicker(self, text, count=1, speed=2, blocking=False)
Shows a ticker text that scroll to left until the last 4 characters are displayed.
source code
 
stopTicker(self)
Stops a running ticker.
source code
 
isTickerAlive(self)
Returns: True, if the ticker is displaying; otherwise False
source code
 
showBlinker(self, text, dp=[0, 0, 0, 0], count=3, speed=1, blocking=False)
Shows a blinking text for the given number of times and blinking speed.
source code
 
stopBlinker(self)
Stops a running blinker.
source code
 
isBlinkerAlive(self)
Returns: True, if the blinker is displaying; otherwise False
source code
 
isAvailable(self)
Returns: True, if the display is detetectd on the I2C interface; otherwise False
source code
 
_checkRobot(self) source code
Method Details [hide private]

__init__(self)
(Constructor)

source code 

Creates a display instance either from class Display4tronix or DisplayDidel. Because the 4tronix display is multiplexed (one digit shown after the other, a display thread is used to display all 4 digits in a rapid succession.

clear(self)

source code 

Turns all digits off. Stops a running display thread.

showText(self, text, pos=0, dp=[0, 0, 0, 0])

source code 

Displays 4 characters of the given text. The text is considered to be prefixed and postfixed by spaces and the 4 character window is selected by the text pointer pos that determines the character displayed at the leftmost digit, e.g. (_: empty): showText("AbCdEF") -> AbCd showText("AbCdEF", 1) -> bCdE showText("AbCdEF", -1) ->_AbC showText("AbCdEF", 4) -> EF__ To display a character and its decimal point, use the dp parameter [most right dp,...,most left dp] and set the decimal point values to 1. Because the 4tronix display is multiplexed (one digit shown after the other, a display thread is started now to display all 4 digits in a rapid succession (if it is not yet started).

Parameters:
  • text - the text to display (list, tuple, string or integer)
  • pos - the start value of the text pointer (character index positioned a leftmost digit)
  • dp - a list with four 1 or 0, if the decimal point is shown or not
Returns:
True, if successful; False, if the display is not available, text or dp has illegal type or one of the characters can't be displayed

scrollToLeft(self)

source code 

Scrolls the scrollable text one step to the left.

Returns:
the number of characters remaining at the right

scrollToRight(self)

source code 

Scrolls the scrollable text one step to the left.

Returns:
the number of characters remaining at the left

showTicker(self, text, count=1, speed=2, blocking=False)

source code 

Shows a ticker text that scroll to left until the last 4 characters are displayed.

Parameters:
  • text - the text to display, if short than 4 characters, scrolling is disabled
  • count - the number of repetitions (default: 1). For count == 0, infinite duration, stopped by calling stopTicker()
  • speed - the speed number of scrolling operations per sec (default: 2)
  • blocking - if True, the method blocks until the ticker has finished; otherwise it returns immediately (default: False)

stopTicker(self)

source code 

Stops a running ticker. The method blocks until the ticker thread is finished and isTickerAlive() returns False.

isTickerAlive(self)

source code 
Returns:
True, if the ticker is displaying; otherwise False

showBlinker(self, text, dp=[0, 0, 0, 0], count=3, speed=1, blocking=False)

source code 

Shows a blinking text for the given number of times and blinking speed.

Parameters:
  • text - the text to display, if short than 4 characters, scrolling is disabled
  • count - the number of repetitions (default: 3). For count = 0, infinite duration, may be stopped by calling stopBlinker().
  • speed - the speed number of blinking operations per sec (default: 1)
  • blocking - if True, the method blocks until the blinker has finished; otherwise it returns immediately (default: False)

stopBlinker(self)

source code 

Stops a running blinker. The method blocks until the blinker thread is finished and isBlinkerAlive() returns False.

isBlinkerAlive(self)

source code 
Returns:
True, if the blinker is displaying; otherwise False

isAvailable(self)

source code 
Returns:
True, if the display is detetectd on the I2C interface; otherwise False