@@ -56,8 +56,23 @@ class BaseLEDMatrix : public TimerAction {
5656
5757 virtual unsigned int multiplier5microseconds ( size_t frame ) const ;
5858public:
59-
6059
60+ /* *
61+ * Constructs the base LED matrix controller object.
62+ *
63+ * @param rows the number of rows in the LED matrix. Rows are expected to have
64+ * shared power to the LEDs.
65+ * @param columns the number of columns in the LED matrix.
66+ * @param columnBitWidth the number of bits needed to represent one physical LED in
67+ * a column. E.g., and RGB LED needs 3 bits.
68+ * @param pwmCycleScanCount the number of row scans needed for the PWM cycle of the matrix.
69+ * @param columnControlBitOn what value a column bit should be set to to the column on.
70+ * @param rowControlBitOn what value a row bit should be set to to turn the row on.
71+ * E.g. of the row is common anode and a PNP transistor is being use
72+ * to switch power to the row, the row bit likely needs to be LOW to
73+ * cause the transistor to power the row.
74+ * @param slavePin which ard pin is used for the latch signal.
75+ */
6176 BaseLEDMatrix (
6277 unsigned int rows,
6378 unsigned int columns,
@@ -73,18 +88,60 @@ class BaseLEDMatrix : public TimerAction {
7388 );
7489 virtual ~BaseLEDMatrix ();
7590
91+ /* *
92+ * Should be called before any operations against this object is performed. Child
93+ * classes implementing matrix-type specific implementation should call this parent
94+ * class implementation of setup() before doing their own setup work.
95+ */
7696 virtual void setup ();
7797
98+ /* *
99+ * Increments the draw lock. While a matrix has a non-zero draw lock, any changes to
100+ * the image() buffer will not be pass through to the matrix scan buffer.
101+ */
78102 void startDrawing (void ) { _isDrawingCount++; }
103+
104+ /* *
105+ * Decrements the draw lock. All calls to startDrawing() should be balanced with a
106+ * call to stopDrawing().
107+ */
79108 void stopDrawing (void ) { _isDrawingCount--; if (_isDrawingCount < 0 ) { _isDrawingCount = 0 ; }}
109+
110+
111+ /* *
112+ * Returns true is a draw lock is active.
113+ */
80114 bool isDrawing (void ) const { return (_isDrawingCount > 0 ); }
81115
116+ /* *
117+ * Returns the number of rows in this matrix.
118+ *
119+ * @return the number of rows in the matrix.
120+ */
82121 unsigned int rows () const { return _rows; }
122+
123+ /* *
124+ * Returns the number of columns in this matrix.
125+ *
126+ * @return the number of columns in the matrix.
127+ */
83128 unsigned int columns () const { return _columns; }
84129
130+ /* *
131+ * Begins the row scan timer interrupt, which in turn starts sending data through the
132+ * SPI interface to the LED matrix.
133+ */
85134 void startScanning (void );
135+
136+ /* *
137+ * Stops the LED matrix row scan timmer interrupt.
138+ */
86139 void stopScanning (void );
87140
141+ /* *
142+ * This methods are "private" to this class but have to be declared public so
143+ * the timer interrupt can access them.
144+ */
88145 void shiftOutCurrentRow (void );
89146 unsigned int nextTimerInterval (void ) const ;
90147 void incrementScanRow ( void );
0 commit comments