Parola for Arduino  1.0
Text effects for Parola modular hardware
MD_Parola_Dissolve.cpp
1 /*
2 MD_Parola - Library for modular scrolling text and Effects
3 
4 See header file for comments
5 This file contains implements dissolve 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::effectDissolve(bool bIn)
28 // Dissolve the current message in/out
29 {
30  switch (_fsmState)
31  {
32  case INITIALISE: // bIn = true
33  case PAUSE: // bIn = false
34  case GET_FIRST_CHAR: // first stage dissolve
35  PRINT_STATE("IO DISS");
36  for (uint16_t i=0; i<_D.getColumnCount(); i++)
37  {
38  uint8_t col = _D.getColumn(i);
39 
40  col |= (i&1 ? 0x55 : 0xaa); // checkerboard pattern
41  _D.setColumn(i, col);
42  }
43  _fsmState = GET_NEXT_CHAR;
44  break;
45 
46  case GET_NEXT_CHAR: // second stage dissolve
47  PRINT_STATE("IO DISS");
48  displayClear();
49  if (bIn) commonPrint();
50  for (uint16_t i=0; i<_D.getColumnCount(); i++)
51  {
52  uint8_t col = _D.getColumn(i);
53 
54  col |= (i&1 ? 0xaa : 0x55); // alternate checkerboard pattern
55  _D.setColumn(i, col);
56  }
57  _fsmState = PUT_CHAR;
58  break;
59 
60  case PUT_CHAR:
61  PRINT_STATE("IO DISS");
62  displayClear();
63  if (bIn) commonPrint();
64  _fsmState = (bIn ? PAUSE : END);
65  break;
66 
67  default:
68  PRINT_STATE("IO DISS");
69  _fsmState = (bIn ? PAUSE : END);
70  }
71 }