From 44cd20924e957ccb581e5f4d1537c934eae1b3d2 Mon Sep 17 00:00:00 2001 From: Jonathan Bobrow Date: Mon, 15 Jun 2020 20:21:36 -0400 Subject: [PATCH] Revert "Dev" --- bootloaders/BlinkBIOS.hex | 241 +++++++++--------- cores/blinklib/blinklib.cpp | 13 +- cores/blinklib/blinklib.h | 5 +- libraries/Examples05/Firefly/Firefly.ino | 114 --------- .../HardwareSleepDemo/HardwareSleepDemo.ino | 73 ------ 5 files changed, 124 insertions(+), 322 deletions(-) delete mode 100644 libraries/Examples05/Firefly/Firefly.ino delete mode 100644 libraries/Examples05/HardwareSleepDemo/HardwareSleepDemo.ino diff --git a/bootloaders/BlinkBIOS.hex b/bootloaders/BlinkBIOS.hex index 5fc90dfb..71fd9183 100644 --- a/bootloaders/BlinkBIOS.hex +++ b/bootloaders/BlinkBIOS.hex @@ -37,130 +37,129 @@ :1030400090E074D52FEF80E792E0215080409040CF :10305000E1F700C0000085DF80E090E067D52FEF4A :1030600080E792E0215080409040E1F700C00000EE -:1030700078DFD3CFCF93DF93CDB7DEB7CB5BD1096A -:103080000FB6F894DEBF0FBECDBFC555DF4F8883A6 -:10309000CB5AD04069D581E08093790280E090E0FE -:1030A00045D5C555DF4F2881CB5AD0402223F9F0B2 -:1030B000212C312CE0E0F0E08491280E311C319677 -:1030C000E11537E1F307C1F760E177E2CE018F55F3 -:1030D0009F4FA1DE4EE2C655DF4F4883CA5AD0400B -:1030E0001FE300E088EBF82E96E0B92E43C01DE404 -:1030F000812E11E0912EE12CF12C12E3BE2C1E9DAD -:1031000060011F9DD00C1124F601E35BFE4F80810E -:10311000882309F4A9C083818B3009F0A5C082817E -:10312000843009F0A1C0C4019FD3882309F49CC056 -:10313000F601E05BFE4F2180328001E00E0D06308B -:1031400019F400E0B5E0BB2E81E090E00B2C01C04B -:10315000880F0A94EAF7182F10951F7360E070E04B -:10316000CE018F559F4F57DEC655DF4F1882CA5A82 -:10317000D040F12CCB55DF4F188219821A821B8266 -:10318000C55AD040FBDECB54DF4F2882C55BD04010 -:10319000CA54DF4F3882C65BD04087EC821983194E -:1031A000C954DF4F8883C75BD04053E0C755DF4F1A -:1031B0005883C95AD040C455DF4F1882CC5AD040EA -:1031C0007AEBE72E8B2D90E0E2E3E89F9001E99FF8 -:1031D000300D1124A901435B5E4F3A01FA01339689 -:1031E000C155DF4FF983E883CF5AD040A901405B36 -:1031F0005E4FCF54DF4F59834883C15BD040FC0101 -:10320000EE0FFF1FCD54DF4FF983E883C35BD0403F -:103210004F5F5F4FC854DF4F59834883C85BD0402E -:10322000E050FF4FC355DF4FF983E883CD5AD040BC -:103230002E01F1E84F0E511C9201205E3F4FC65403 -:10324000DF4F39832883CA5BD040C555DF4F3881B3 -:10325000CB5AD040332319F0112309F406C28091D0 -:103260003F0180FF0DC001C23FEFE31AF30A42E3C2 -:10327000840E911C56E0E516F10409F03FCF64CFAF -:10328000C555DF4F8881CB5AD040811198C0F301DA -:103290008081882309F493C0C155DF4FE881F9810B -:1032A000CF5AD04080818B3D09F060C0F30182810C -:1032B000833209F05BC0C301D7D2882309F456C01A -:1032C000CF54DF4FE881F981C15BD04081A18F11DC -:1032D00060C0CD54DF4FE881F981C35BD040E0503E -:1032E000FF4F818187709F2D9295990F907E892B3A -:1032F00081838F2D8370A1E0B0E0AC0FBD1FF0E2A1 -:103300008F9FA00DB11D112490E2C854DF4FE881BA -:10331000F981C85BD04001900D929A95E1F7833016 -:10332000A1F4BE016F5F7F4FC655DF4F8881CA5A37 -:10333000D040E1D3C655DF4F2881CA5AD0402F5F15 -:10334000C655DF4F2883CA5AD040F39438EBF312A6 -:103350002CC0C355DF4FE881F981CD5AD040808120 -:10336000806C808383E08183A12C17C0C155DF4F1F -:10337000E881F981CF5AD0408081883E51F4F30131 -:103380008281823031F4C3016FD2AA24A3948111C7 -:1033900001C0A12CF8EBFF120CC0111108C069EBA1 -:1033A0008B2D4EDD68EBF62E07C0A12C02C058EB2A -:1033B000F52E6F2D8B2D44DDF301108201C0A12C61 -:1033C000C02ED12CF2E3FC9D4001FD9D900C1124F8 -:1033D000F401E35BFE4F8081882309F45CC08381A4 -:1033E0008D3509F04DC08281833009F049C0CF018D -:1033F0003BD2882309F444C021E030E0002E01C014 -:10340000220F0A94EAF7C455DF4F4881CC5AD040C6 -:10341000422BC455DF4F4883CC5AD040F401E05BC7 -:10342000FE4FE180C601880F991F57EB5E15D8F457 -:10343000E9EBEE120BC020951223FC01E050FF4F88 -:103440002081206C20832181276009C0FC01E0508D -:10345000FF4F2081206C20832181287F23602183DE -:103460009924939401C0912CFC01E050FF4F81817D -:1034700087709E2D9295990F907E892B818301C034 -:10348000912C22E32C9DF0012D9DF00D1124E35B86 -:10349000FE4F108201C0912CEF1408F03DC08E2D1C -:1034A00086958695C655DF4F3881CA5AD040831716 -:1034B000B8F440E2E49EC0011124D20184199509B8 -:1034C000FC01EA0FFB1FE491ED93C654DF4FE88146 -:1034D000F981CA5BD040AE17BF0791F7A2010BC0BC -:1034E0008E2D837041E050E04C0F5D1FF0E28F9F06 -:1034F000400D511D11246E2D802FB2DC68E770E065 -:10350000CE018B559F4F87DC23E0C755DF4F2883C3 -:10351000C95AD0403AEBE32EF894409131015091D2 -:10352000320160913301709134017894CB55DF4FB3 -:1035300088819981AA81BB81C55AD040841795079B -:10354000A607B70718F09110CCC08BC0C755DF4F46 -:103550009881C95AD0409111AEC0F8944091310180 -:103560005091320160913301709134017894CF55BC -:10357000DF4F88819981AA81BB81C15AD0408417CD -:103580009507A607B70748F481E090E00C2C01C02E -:10359000880F0A94EAF780951823F601EE0FFF1FB3 -:1035A000E050FF4F818187708183112309F459C056 -:1035B000212F30E00F5F063009F400E0C901002E32 -:1035C00002C0959587950A94E2F780FFF3CF33E028 -:1035D000C755DF4F3883C95AD040802FAED18823DA -:1035E000A9F08BE091D1CB54DF4F8881C55BD040EF -:1035F0008BD1CA54DF4F8881C65BD04085D1C95476 -:10360000DF4F8881C75BD0407FD16ED1E02FF0E0E3 -:10361000EE0FFF1FE050FF4F8181886F8183C455FB -:10362000DF4F4881CC5AD040842F90E0002E02C05A -:10363000959587950A94E2F780FD40C062E370E0BB -:10364000CE018B559F4FE7DBC755DF4F5881C95AD5 -:10365000D0405150C755DF4F5883C95AD0408AEBEC -:10366000E82E31DCAA2009F4F0CD1092790286DC34 -:1036700003E010E0812F61D1882329F088EE44D146 -:103680008AEE42D131D11F5F1630A1F7015089F780 -:1036900088EBF81216C080E090E0E0E0F0E02491C2 -:1036A000820F911D3196E11527E1F207C1F7281627 -:1036B000390639F408C0992089F06FCF68E770E0C7 -:1036C000BFCF83E085DCC555DF4FE881CB5AD040C2 -:1036D000E11102C082E001C081E084D111117DCFEF -:1036E000C0CFC755DF4FF881C95AD040FF2309F436 -:1036F00034CF53CFF89404E00EBF0FEF0DBF789492 -:10370000B9DC87EF84BF0FB6F894A895809160006C -:10371000886180936000109260000FBEC0E8C09383 -:103720006100D1E0D09361002FEF80E792E021505B -:1037300080409040E1F700C00000F7DB85B7982F8C -:10374000916095BF826085BFC0BF84E880936400AC -:10375000809168008460809368005F9A729A589A9A -:10376000599A269A689A279A699A549A529A5E9A0E -:103770005D9A569A559AD0936E0082E080937000BD -:1037800088D084B18F6384B987B1806C87B978940D -:10379000D6D1F894C093610010926100789482D1E0 -:1037A00004B601FE04C08DEF84BF81E0A3DF80E09A -:0E37B00019D180E09FDF76D181E09CDF09DC3B +:1030700078DFD3CF14BE0FB6F894A8958091600086 +:10308000886180936000109260000FBEC1E6D0E0BE +:1030900010E8188301E008832FEF80E792E02150C9 +:1030A00080409040E1F700C000003FDF85B7982FD7 +:1030B000916095BF826085BF10BF84E880936400F3 +:1030C000E8E6F0E08081846080835F9A729A589A83 +:1030D000599A269A689A279A699A549A529A5E9AA5 +:1030E0005D9A569A559A00936E0082E08093700024 +:1030F000D0D384B18F6384B987B1806C87B9789459 +:103100001ED5F894188318827894CCD480E06AD4C1 +:10311000CF93DF93CDB7DEB7CB5BD1090FB6F89471 +:10312000DEBF0FBECDBFC555DF4F8883CB5AD04021 +:103130001BD581E08093790280E090E0F7D4C555FB +:10314000DF4F2881CB5AD0402223F9F0212C312C9B +:10315000E0E0F0E08491280E311C3196E11537E172 +:10316000F307C1F760E177E2CE018F559F4F53DE41 +:103170004EE2C655DF4F4883CA5AD0401FE300E0F5 +:1031800088EBF82E96E0B92E43C01DE4812E11E0A5 +:10319000912EE12CF12C12E3BE2C1E9D60011F9D8F +:1031A000D00C1124F601E35BFE4F8081882309F4E3 +:1031B000A9C083818B3009F0A5C08281843009F0D9 +:1031C000A1C0C40151D3882309F49CC0F601E05B7F +:1031D000FE4F2180328001E00E0D063019F400E030 +:1031E000B5E0BB2E81E090E00B2C01C0880F0A9463 +:1031F000EAF7182F10951F7360E070E0CE018F552D +:103200009F4F09DEC655DF4F1882CA5AD040F12CB5 +:10321000CB55DF4F188219821A821B82C55AD040C3 +:10322000ADDECB54DF4F2882C55BD040CA54DF4FA0 +:103230003882C65BD04087EC82198319C954DF4FAE +:103240008883C75BD04053E0C755DF4F5883C95AC6 +:10325000D040C455DF4F1882CC5AD0407AEBE72ECD +:103260008B2D90E0E2E3E89F9001E99F300D11245F +:10327000A901435B5E4F3A01FA013396C155DF4F16 +:10328000F983E883CF5AD040A901405B5E4FCF5409 +:10329000DF4F59834883C15BD040FC01EE0FFF1F15 +:1032A000CD54DF4FF983E883C35BD0404F5F5F4F5E +:1032B000C854DF4F59834883C85BD040E050FF4F6C +:1032C000C355DF4FF983E883CD5AD0402E01F1E892 +:1032D0004F0E511C9201205E3F4FC654DF4F398381 +:1032E0002883CA5BD040C555DF4F3881CB5AD040C8 +:1032F000332319F0112309F406C280913F0180FFA6 +:103300000DC001C24FEFE41AF40A52E3850E911C7E +:1033100086E0E816F10409F03FCF64CFC555DF4FD2 +:103320009881CB5AD040911198C0F30180818823B5 +:1033300009F493C0C155DF4FE881F981CF5AD040DD +:1033400080818B3D09F060C0F3018281833209F0F6 +:103350005BC0C30189D2882309F456C0CF54DF4F24 +:10336000E881F981C15BD04081A18F1160C0CD544B +:10337000DF4FE881F981C35BD040E050FF4F81818E +:1033800087709F2D9295990F907E892B81838F2D29 +:103390008370A1E0B0E0AC0FBD1FF0E28F9FA00DE5 +:1033A000B11D112490E2C854DF4FE881F981C85B58 +:1033B000D04001900D929A95E1F78330A1F4BE01BF +:1033C0006F5F7F4FC655DF4F8881CA5AD04093D375 +:1033D000C655DF4F2881CA5AD0402F5FC655DF4FF0 +:1033E0002883CA5AD040F39438EBF3122CC0C3554B +:1033F000DF4FE881F981CD5AD0408081806C808395 +:1034000083E08183A12C17C0C155DF4FE881F9818A +:10341000CF5AD0408081883E51F4F30182818230BE +:1034200031F4C30121D2AA24A394811101C0A12C9B +:10343000F8EBFF120CC0111108C069EB8B2D00DDF9 +:1034400068EBF62E07C0A12C02C058EBF52E6F2DAD +:103450008B2DF6DCF301108201C0A12CC02ED12CE3 +:10346000F2E3FC9D4001FD9D900C1124F401E35B0F +:10347000FE4F8081882309F45CC083818D3509F07B +:103480004DC08281833009F049C0CF01EDD188233E +:1034900009F444C021E030E0002E01C0220F0A945C +:1034A000EAF7C455DF4F4881CC5AD040422BC4556F +:1034B000DF4F4883CC5AD040F401E05BFE4FE180FF +:1034C000C601880F991F57EB5E15D8F4E9EBEE1291 +:1034D0000BC020951223FC01E050FF4F2081206C8F +:1034E00020832181276009C0FC01E050FF4F20812B +:1034F000206C20832181287F236021839924939449 +:1035000001C0912CFC01E050FF4F818187709E2DFE +:103510009295990F907E892B818301C0912C22E393 +:103520002C9DF0012D9DF00D1124E35BFE4F1082C8 +:1035300001C0912CEF1408F03DC08E2D8695869524 +:10354000C655DF4F3881CA5AD0408317B8F440E2DD +:10355000E49EC0011124D20184199509FC01EA0FEF +:10356000FB1FE491ED93C654DF4FE881F981CA5BFC +:10357000D040AE17BF0791F7A2010BC08E2D83700C +:1035800041E050E04C0F5D1FF0E28F9F400D511D58 +:1035900011246E2D802F64DC68E770E0CE018B551E +:1035A0009F4F39DC23E0C755DF4F2883C95AD040ED +:1035B0003AEBE32EF8944091310150913201609141 +:1035C0003301709134017894CB55DF4F8881998114 +:1035D000AA81BB81C55AD04084179507A607B707B3 +:1035E00018F09110CBC08BC0C755DF4FF881C95A76 +:1035F000D040F111B8C0F89440913101509132019E +:1036000060913301709134017894CF55DF4F8881F8 +:103610009981AA81BB81C15AD04084179507A6071A +:10362000B70748F481E090E00C2C01C0880F0A94A1 +:10363000EAF780951823F601EE0FFF1FE050FF4FC9 +:10364000818187708183112309F459C0212F30E0D3 +:103650000F5F063009F400E0C901002E02C0959505 +:1036600087950A94E2F780FFF3CF33E0C755DF4F29 +:103670003883C95AD040802F60D18823A9F08BE0CD +:1036800043D1CB54DF4F8881C55BD0403DD1CA5474 +:10369000DF4F8881C65BD04037D1C954DF4F888166 +:1036A000C75BD04031D120D1E02FF0E0EE0FFF1FFB +:1036B000E050FF4F8181886F8183C455DF4F48817F +:1036C000CC5AD040842F90E0002E02C0959587956B +:1036D0000A94E2F780FD4AC062E370E0CE018B55A8 +:1036E0009F4F99DBC755DF4F5881C95AD040515081 +:1036F000C755DF4F5883C95AD0408AEBE82EE3DB29 +:10370000AA2009F4F0CD1092790238DCE8EBFE1221 +:1037100030C080E090E0E0E0F0E02491820F911D65 +:103720003196E11527E1F207C1F72816390609F5A8 +:1037300003E010E0812F01D1882329F088EEE4D046 +:103740008AEEE2D0D1D01F5F1630A1F7015089F781 +:10375000C555DF4F3881CB5AD040311102C082E0CD +:1037600001C081E03FD1992031F065CF68E770E07A +:10377000B5CF83E02DDC11117ECFC1CFC755DF4F10 +:103780002881C95AD040222309F435CF54CFF89468 +:1037900004E00EBF0FEF0DBF7894BADC80E0F7DFD6 +:0837A00081D181E0F4DF14DCAB :1038000031C00000FDCF0000FBCF0000F9CF000069 :10381000C2CB00001AC1000019C10000F7C10000AE -:103820007DC10000C8CF00009FC10000E7C00000BC -:10383000ACC100001AC10000ACCB0000BFCF00003B +:103820007DC10000BDCF00009FC10000E7C00000C7 +:10383000ACC100001AC10000ACCB0000B4CF000046 :10384000E5C10000FFFEFDFBFAF8F5F2EEEAE6E066 :10385000DAD3CCC3BAB0A5998C7E6F5F4E3B2813E8 -:103860000D09030111244DDFFC012281339690E004 +:103860000D090301112406DCFC012281339690E04E :10387000215018F08191980FFBCF81E0923D09F023 :1038800080E008952E9870982F9871985C985A98B7 :1038900008958FEF87BD88BD16BC95B5906895BD1E @@ -272,7 +271,7 @@ :103F300099819923C9F001C0892F8DA71CA606C0BD :103F4000983018F49F5F9CA701C01DA6E2970695C4 :103F500081E0CB31D80709F0B0CFFF2041F080914C -:103F60007902811104C025DC1A8280E8E6CFFF9136 +:103F60007902811104C01ADC1A8280E8E6CFFF9141 :103F7000EF91DF91CF91BF91AF919F918F917F9101 :103F80006F915F914F913F912F911F910F91FF90F2 :0C3F9000EF900F900FBE0F901F9018953F diff --git a/cores/blinklib/blinklib.cpp b/cores/blinklib/blinklib.cpp index e2777f5c..c2d435d0 100644 --- a/cores/blinklib/blinklib.cpp +++ b/cores/blinklib/blinklib.cpp @@ -291,19 +291,12 @@ static void setColorNow( Color newColor ) { Color dim( Color color, byte brightness) { return MAKECOLOR_5BIT_RGB( - (GET_5BIT_R(color)*brightness)/MAX_BRIGHTNESS, - (GET_5BIT_G(color)*brightness)/MAX_BRIGHTNESS, - (GET_5BIT_B(color)*brightness)/MAX_BRIGHTNESS + (GET_5BIT_R(color)*brightness)/255, + (GET_5BIT_G(color)*brightness)/255, + (GET_5BIT_B(color)*brightness)/255 ); } -Color lighten( Color color, byte brightness) { - return MAKECOLOR_5BIT_RGB( - (GET_5BIT_R(color) + (((MAX_BRIGHTNESS_5BIT- (GET_5BIT_R(color)))*brightness)/MAX_BRIGHTNESS )), - (GET_5BIT_G(color) + (((MAX_BRIGHTNESS_5BIT- (GET_5BIT_G(color)))*brightness)/MAX_BRIGHTNESS )), - (GET_5BIT_B(color) + (((MAX_BRIGHTNESS_5BIT- (GET_5BIT_B(color)))*brightness)/MAX_BRIGHTNESS )) - ); -} // When will we warm sleep due to inactivity // reset by a button press or seeing a button press bit on diff --git a/cores/blinklib/blinklib.h b/cores/blinklib/blinklib.h index 95e62002..93ae91d8 100644 --- a/cores/blinklib/blinklib.h +++ b/cores/blinklib/blinklib.h @@ -207,15 +207,12 @@ typedef pixelColor_t Color; #define GET_5BIT_B(color) (color.b) // Dim the specified color. Brightness is 0-255 (0=off, 255=don't dim at all-keep original color) +// Inlined to allow static simplification at compile time #define MAX_BRIGHTNESS (255) Color dim( Color color, byte brightness); -// Brighten the specified color. Brightness is 0-255(0=unaltered color, 255=full white) - -Color lighten( Color color, byte brightness); - // This maps 0-255 values to 0-31 values with the special case that 0 (in 0-255) is the only value that maps to 0 (in 0-31) // This leads to some slight non-linearity since there are not a uniform integral number of 1-255 values // to map to each of the 1-31 values. diff --git a/libraries/Examples05/Firefly/Firefly.ino b/libraries/Examples05/Firefly/Firefly.ino deleted file mode 100644 index 2655a5a4..00000000 --- a/libraries/Examples05/Firefly/Firefly.ino +++ /dev/null @@ -1,114 +0,0 @@ -// Simple synchronizing fire fly demo - -// Put a bunch of blinks together and they will eventually all sync to flash at the same time. -// Press the button to force a blink to immediately flash. -// Read more here: http://josh.com/ly/Firefly_sync.pdf - - -// Consts - -// When urge gets to to this value, then we flash and set back to 0 - -unsigned int URGE_MAX_MS = 2000; - - -// Variables - -// Urge starts at 0 and increases by 1 every every millisecond that passes -// Also increases when we see a neighbor flash - -static unsigned urge_ms=0; - -// Rememeber what time it was last time we ran loop() -// so we can calculate how many milliseconds passed since then - -static unsigned long last_time_ms=0; - - -// This just increments each time we send a flash. We send this over the IRs so -// neighbors can tell when we have flashed. -// It is not the count that counts, just that it changes each time we flash. - -byte flashCountValue = 0; - -// Embelish the flash with a soothing fade to black - -Timer flash_fade_timer; - - -void setup() { - // put your setup code here, to run once: -} - -void loop() { - - // UI - - if (buttonPressed() ) { - - // Flash immedeately when button pressed - - urge_ms= URGE_MAX_MS; - - } - - // Timekeeping - - unsigned diff_ms = millis() - last_time_ms; - - last_time_ms = millis(); - - - // Increment urge - - urge_ms += diff_ms; - - - // Check for changes (flashes) from neighbors - - FOREACH_FACE(f) { - - if (didValueOnFaceChange(f)) { - - // If we see a flash, increment our urge to flash proportional to - // out current urge. Higher divisors = longer sync times. - - // THIS is where the magic happens. - - urge_ms = urge_ms + (urge_ms/50); - - } - - } - - - // Check if we can not hold it any more - - if (urge_ms>=URGE_MAX_MS) { - - // FLASH!!! - - - // For simplicity, we will fade out over the next 255ms - // which happens to look nice and also mean no math is needed - // to map to the milliseconds left to the brightness - - flash_fade_timer.set( 255 ); - - urge_ms=0; - - // Signal flash to neighbors - - flashCountValue++; - - if (flashCountValue >= IR_DATA_VALUE_MAX) { - flashCountValue = 0 ; - } - - setValueSentOnAllFaces( flashCountValue ); - - } - - setColor( dim( GREEN , flash_fade_timer.getRemaining() ) ); - -} diff --git a/libraries/Examples05/HardwareSleepDemo/HardwareSleepDemo.ino b/libraries/Examples05/HardwareSleepDemo/HardwareSleepDemo.ino deleted file mode 100644 index 5bfa51ca..00000000 --- a/libraries/Examples05/HardwareSleepDemo/HardwareSleepDemo.ino +++ /dev/null @@ -1,73 +0,0 @@ -// Example showing how to force a blink to hardware sleep immedeately -// It is probably better to let blinklib manage this for you. Use with caution. - -// This demo flashes RED->GREEN->BLUE and then hardware sleeps. A button press wakes it -// and repeasts the cycle. - -#define BLINKBIOS_SLEEP_NOW_VECTOR boot_vector12 - -// Calling BLINKBIOS_SLEEP_NOW_VECTOR() will immedeately put the blink into hardware sleep -// It can only wake up from a button press. - -extern "C" void BLINKBIOS_SLEEP_NOW_VECTOR() __attribute__((used)) __attribute__((noinline)); - - -void setup() { - // put your setup code here, to run once: - -} - - -// How many times to flash before sleeping -const byte FLASH_BEFORE_SLEEP = 3; - -// How long between flashes in milliseconds -const unsigned int FLASH_PERIOD_MS = 1000; - -// How long is each flash on for in milliseconds -const unsigned int FLASH_ON_MS = 500; - - -static byte flash_count = 0; -static Timer period_timer; -static Timer on_timer; - -void loop() { - - if ( on_timer.isExpired() ) { - - setColor( OFF ) ; - - } - - if ( period_timer.isExpired() ) { - - - if ( flash_count >= FLASH_BEFORE_SLEEP ) { - - BLINKBIOS_SLEEP_NOW_VECTOR(); - - flash_count = 0; - - } - - period_timer.set( FLASH_PERIOD_MS ); - - - switch (flash_count) { - - case 0: setColor( RED ); break; - case 1: setColor( GREEN ); break; - case 2: setColor( BLUE ); break; - - } - - - on_timer.set( FLASH_ON_MS ); - - flash_count++; - - } - - -}