Say, today is December 23, 2013. The next event from today would be Christmas which is celebrated on December 25. If you are at the default screen which displays time in binary (refer to the table on this page) and you press button #4 (show event) then you'll see a sliding message "Chrismas - Dec 25 2013 Thursday", now if you press button #2 (show event year info) it will slide "2014 years - started in 0".
Your friend Bob is having birthday tomorrow. Today is April 2, 2014. If you press button #4 (show event), you'll see a sliding message "Bob's birthday - Apr 3 2014" if you press button #2 while the event message is sliding, you'll see "25 years - started in 1989" (if Bob's turning 25).
Events can be set in three ways.
Month and dayExample is Christmas which is always celebrated on December 25. To add an event of this type, go to lib/clock_event_personal.c and add
clock_event_initDayOfMonth (25, DECEMBER, 0, "Christmas")clock_event_initDayOfMonth() is a macro from lib/clock_event.h. Here is its prototype:
// @brief Initializer for an event which is set with month and day // @param day day of month // @param month month of the event // @param year year when the event first occurred // @param name name of the event // #define clock_event_initDayOfMonth(day, month, year, name)
Month and weekThanksgiving in the US is celebrated on the fourth Thursday of November. To add an event of that type, go to lib/clock_event.personal.c and add
clock_event_initDayOfWeek (THURSDAY, 3, WEEK_FROM_START, NOVEMBER, 1574, "Thanksgiving")clock_event_initDayOfWeek() is a macro from lib/clock_event.h
// @brief Initializer for an event which is set with // day of week, week of month, and month // @param dayOfWeek day of week. See macros in lib/date_time.h // @param weekOfMonth week of the month. [0..3] // @param fromBeginningOfMonth whether the _weekOfMonth_ should be counted from the beginning of the month // This can be any number or TRUE / FALSE which can be treated in the boolean context // // @param month month of the event // @param year year when the event first occurred // @param name name of the event // #define clock_event_initDayOfWeek(dayOfWeek, weekOfMonth, fromBeginningOfMonth, month, year, name)weekOfMonth is a number from 0 to 3. There are not more than 4 full weeks in a month. 0 corresponds to the first week, 3 to the fourth. fromBeginningOfMonth is a flag which can be set to TRUE or FALSE. It's easier to understand with example. Thanksgiving is the fourth Thursday of November. In other words it is the fourth thursday from the beginning of the month November. Another example is SysAdmin's day, which is the last Friday of July:
clock_event_initDayOfWeek (FRIDAY, 0, WEEK_FROM_END, JULY, 2000, "SysAdmin's Day")
Day of yearThe last type of events is specified by day of year. Example is Programmer's day which is celebrated on the 256 day of a year.
clock_event_initDayOfYear (256, 2009, "Programmer's day")clock_event_initDayOfYear() is a macro from lib/clock_event.h
// @brief Initializer for an event which is set with day of the year // @param dayOfYear day of year // @param year year when the event first occurred // @param name name of the event // #define clock_event_initDayOfYear(dayOfYear, year, name)
FinallyOnce you have all your events specified in lib/clock_event_personal.c, don't forget to change CLOCK_EVENTS_SIZE macro in lib/clock_event_personal.h to the size of the event's list. If you have 13 events, CLOCK_EVENTS_SIZE should be 13.
After you have all that ready, you may go to the project root and make the target (compile):
$ cd BinaryClock $ makeIf there is no errors, you may see the result in emulator. From the project root run
$ emulator/build/bin/terminal-binary-clockOnce you're satisfied with result, you can move on and upload the software to the real BinaryClock hardware. Plug FTDI to the BinaryClock and do
$ cd arduino $ make upload