Question on Monochron code in ratt.c

For RTC breakouts, etc., use the Other Products from Adafruit forum

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
toinec
 
Posts: 12
Joined: Tue Aug 20, 2013 8:42 am

Question on Monochron code in ratt.c

Post by toinec »

Hi there,

Building Monochron clocks is FUN!

Some time ago I downloaded the Monochron pong clock code.
However, I ran into some code in ratt.c that I just don't understand.
Below is a snippet from ratt.c:

Code: Select all

    step();
    if (displaymode == SHOW_TIME) {
      if (! inverted && alarming && (time_s & 0x1)) {
        inverted = 1;
        initdisplay(inverted);
      }
      else if ((inverted && ! alarming) ||
        (alarming && inverted && !(time_s & 0x1))) {
        inverted = 0;
        initdisplay(0);
      } else {
        PORTB |= _BV(5);
        draw(inverted);
        PORTB &= ~_BV(5);
      }
    }
The questions are about the PORTB bit 5 code, at the bottom of the snippet, that encloses the draw() function:
- What will happen when PORTB bit 5 is set or cleared?
- Both draw() and initdisplay() interact with the LCD. So, is there a reason why the initdisplay() function is not enclosed with the same PORTB bit 5 code? Should it be there?
- What may/will happen when the PORTB bit 5 code is removed? Is it essential for a proper functioning pong clock?

Thx to anyone providing me a clue or (even better!) an answer.

Kind regards,
Toine

Locked
Please be positive and constructive with your questions and comments.

Return to “Clock Kits (discontinued)”