Last active
January 7, 2023 02:30
-
-
Save cctsao1008/425030c2869aac75becd22fefacd6b50 to your computer and use it in GitHub Desktop.
Revisions
-
cctsao1008 renamed this gist
Jan 7, 2023 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
cctsao1008 created this gist
Jan 7, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,46 @@ #define FIRMWARE_VERSION_MAGIC 0xCAFEBABE #define FIRMWARE_VERSION_MAJOR 1 #define FIRMWARE_VERSION_MINOR 0 __attribute__((used, section(".info"))) uint8_t INFO[] = { // YY year __DATE__[9], __DATE__[10], // First month letter, Oct Nov Dec = '1' otherwise '0' (__DATE__[0] == 'O' || __DATE__[0] == 'N' || __DATE__[0] == 'D') ? '1' : '0', // Second month letter (__DATE__[0] == 'J') ? ((__DATE__[1] == 'a') ? '1' : // Jan, Jun or Jul ((__DATE__[2] == 'n') ? '6' : '7')) : (__DATE__[0] == 'F') ? '2' : // Feb (__DATE__[0] == 'M') ? (__DATE__[2] == 'r') ? '3' : '5' : // Mar or May (__DATE__[0] == 'A') ? (__DATE__[1] == 'p') ? '4' : '8' : // Apr or Aug (__DATE__[0] == 'S') ? '9' : // Sep (__DATE__[0] == 'O') ? '0' : // Oct (__DATE__[0] == 'N') ? '1' : // Nov (__DATE__[0] == 'D') ? '2' : // Dec 0, // First day letter, replace space with digit __DATE__[4] == ' ' ? '0' : __DATE__[4], // Second day letter __DATE__[5], // HHMMSS //__TIME__[0], __TIME__[1], __TIME__[3], __TIME__[4], __TIME__[6], __TIME__[7], // HHMM __TIME__[0], __TIME__[1], __TIME__[3], __TIME__[4], // Magic Code (uint8_t) ((FIRMWARE_VERSION_MAGIC >> 24) & 0xFF), (uint8_t) ((FIRMWARE_VERSION_MAGIC >> 16) & 0xFF), (uint8_t) ((FIRMWARE_VERSION_MAGIC >> 8) & 0xFF), (uint8_t) ((FIRMWARE_VERSION_MAGIC >> 0) & 0xFF), // Firmware Version FIRMWARE_VERSION_MAJOR, FIRMWARE_VERSION_MINOR, };