- def imprimir_tabla(self, rotada=False):
- rango = xrange(16)
- if rotada:
- rango = xrange(15, -1, -1)
- for col in rango:
- for row in xrange(16):
- print int(self.tabla[col,row].prendido),
- print
- print
-
- def imprimir_stream(self, stream):
- for i in stream:
- print '0x%02x' % i
-
- def tabla_a_stream(self):
- stream = []
- for col in xrange(15, -1, -1):
- i = 0
- for row in xrange(8):
- i += int(self.tabla[col,row].prendido) << row
- stream.append(i)
- i = 0
- for row in xrange(8, 16):
- i += int(self.tabla[col,row].prendido) << row
- stream.append(i)
- return stream
-
+ def leds2matrix(self):
+ matrix = {}
+ for row in xrange(16):
+ for col in xrange(16):
+ matrix[row,col] = int(self.tabla[row,col].prendido)
+ etherled.protocol._print_matrix(matrix)
+ return matrix
+
+ def matrix2leds(self, matrix):
+ for row in xrange(16):
+ for col in xrange(16):
+ self.tabla[row,col].prendido = matrix[row,col]
+ etherled.protocol._print_matrix(matrix)
+ return matrix