Parola for Arduino  1.0
Text effects for Parola modular hardware
MD_Parola_Print.cpp
1 /*
2 MD_Parola - Library for modular scrolling text and Effects
3 
4 See header file for comments
5 This file contains implements static text display
6 
7 Copyright (C) 2013 Marco Colli. All rights reserved.
8 
9 This library is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Lesser General Public
11 License as published by the Free Software Foundation; either
12 version 2.1 of the License, or (at your option) any later version.
13 
14 This library is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Lesser General Public License for more details.
18 
19 You should have received a copy of the GNU Lesser General Public
20 License along with this library; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22  */
23 
24 #include <MD_Parola.h>
25 #include <MD_Parola_lib.h>
26 
27 void MD_Parola::commonPrint(void)
28 {
29  int16_t nextPos = 0;
30 
31  FSMPRINTS("\ncommonPrint");
32  nextPos = _limitLeft;
33  _charCols = getFirstChar();
34  _countCols = 0;
35 
36  while (nextPos >= _limitRight)
37  {
38  if (_countCols == _charCols)
39  {
40  _charCols = getNextChar();
41  _countCols = 0;
42  }
43 
44  // now put something on the display
45  _D.setColumn(nextPos--, _cBuf[_countCols++]);
46  }
47 }
48 
49 void MD_Parola::effectPrint(bool bIn)
50 // Just print the message in the justification selected
51 {
52  if (bIn) // incoming
53  {
54  commonPrint();
55  _fsmState = PAUSE;
56  }
57  else //exiting
58  {
59  displayClear();
60  _fsmState = END;
61  }
62 }