Subversion Repositories Projects

Compare Revisions

Ignore whitespace Rev 64 → Rev 682

/IR-TX-BL/branches/PWM-CTRL_V0.02/PWM-CTRL_V0_02.hex
1,9 → 1,9
:1000000012C02CC02BC02AC029C03AC027C026C0AD
:1000100026C0AAC023C022C021C020C01FC01EC04D
:100020001DC033C31BC011241FBECFE5D4E0DEBF0B
:10003000CDBF11E0A0E6B0E0ECEFFAE002C0059021
:100020001DC013C41BC011241FBECFE5D4E0DEBF2A
:10003000CDBF11E0A0E6B0E0ECEBFCE002C0059023
:100040000D92AA36B107D9F711E0AAE6B1E001C0D6
:100050001D92AA38B107E1F779D14FC5D1CF1F92D0
:100050001D92AA38B107E1F779D12FC6D1CF1F92EF
:100060000F920FB60F9211248F9380916B018F5FC7
:1000700080936B018F910F900FBE0F901F9018957A
:100080001F920F920FB60F9211242F933F934F930D
53,142 → 53,170
:100340008827262F30E0822B932B08952F923F92FF
:100350004F925F926F927F928F929F92AF92BF92D5
:10036000CF92DF92EF92FF920F931F93CF93DF9381
:10037000CDB7DEB722970FB6F894DEBF0FBECDBF64
:10037000CDB7DEB728970FB6F894DEBF0FBECDBF5E
:100380008EE087BB18BA88E084BB15BA88EB81BBC6
:1003900012BA10927C011092780110927E01109294
:1003A000790110927D01109277011FBC82EC8EBD05
:1003B00089B7846289BF81E083BF89B7816089BFC3
:1003C000789444E050E0DA015FD3A0E0B0E022E0AE
:1003D00030E0EA5AF545B9F080EB94E00C0159D3CE
:1003E00088E097E0D9010C0154D38AEA95E5DA0157
:1003F0000C014FD320EB422E24E0522E98E0292E00
:1004000097E0392E05C040D32F01D9013DD31F01FC
:1004100088E893E114DF9A83898388E893E10FDF0A
:100420005C0188EE93E00BDF6C0110E0662477241A
:1004300088248A94982C01C018E080916A01853143
:1004400080F0AB985FDF7C0184EF91E0F8DE5C0127
:100450006E147F0408F43701E814F90420F447010E
:1004600002C0AB9A7201C50113DF882331F088E81E
:1004700093E1E5DE5C0110926A01163008F039C0A4
:10048000F1E4EF16F6E0FF0618F010FD08C006C014
:1004900088E7E81685E0F80610F410FD1F5FC60136
:1004A000F7DE882399F080917C01809580937C0110
:1004B0008091780180958093780180917E0180956C
:1004C00080937E018AEF90E0BADE6C01163089F4E9
:1004D000979A88EB9BE0B3DE9A838983A0E0B0E033
:1004E0000401D7D2A2E0B0E00301D3D2240113016A
:1004F00002C01730C1F4C601CBDE882399F0809189
:100500007C01809580937C01809178018095809317
:10051000780180917E01809580937E0189E190E051
:100520008EDE6C0117E089819A81B2DE882311F09A
:10053000979803C0183009F080CFEEEFFFEFEE0E72
:10054000FF1EE418F5080027F7FC0095102F910115
:10055000241935092450304040E050E060E070EC50
:1005600084ED91E054D2C801B70132D220E23EE4DA
:1005700040E050E04CD2B90137FF03C060E070E0CA
:1005800005C02250364014F061E076E06F3F7105FF
:1005900009F030F460937C011092780110927E0192
:1005A000CB01805091408F3F910509F038F48FEFD7
:1005B00080937C011092780160937E01CB01805082
:1005C00092408F3F910509F048F4862F80958093E3
:1005D0007C01109278018FEF80937E01CB018050D7
:1005E00093408F3F910509F038F410927C0160939D
:1005F00078018FEF80937E01CB01805094408F3F34
:10060000910509F048F410927C018FEF80937801F6
:10061000862F809580937E01CB01805095408F3F3F
:10062000910509F038F460937C018FEF8093780195
:1006300010927E01605076400CF4FECE8FEF8093D6
:100640007C018093780110927E01F6CE1F93182FC3
:100650008A3011F48DE0FADF5D9BFECF1CB980E09B
:1006600090E01F910895599A88E18AB986E880BD83
:1006700089E189B960E070E086E293E03ED00895B8
:1006800082E682B985EC86BF08951F920F920FB65D
:100690000F9211248F939F9381B190E0887F907087
:1006A0008038910599F08138910534F40097C9F0AC
:1006B00080369105C9F40FC0883B910559F0883FF9
:1006C000910561F0883A910579F404C083B1809373
:1006D0007F0101C013B886B7806807C086B78069FC
:1006E00086BF86B7806986BF85EC86BF9F918F9154
:1006F0000F900FBE0F901F901895EF92FF920F93DF
:100700001F93CF93DF938C017B01892B11F4672B0F
:10071000C9F16EE070E081E090E03BD0FC01009711
:1007200089F1DC0180E88383E114F10471F0F38640
:10073000E28681E883838091800190918101892BF9
:1007400021F4F0938101E093800101151105E1F09E
:1007500011870087838182608383809182019091D9
:100760008301892B89F4F0938301E09382018091C6
:10077000840190918501892B39F4F0938501E093F0
:10078000840102C0A0E0B0E0CD01E6E0CDB7DEB765
:10079000A5C10F931F93CF93DF93689F8001699F3B
:1007A000100D789F100D1124C8010DD0EC01009799
:1007B00021F0A80160E070E004D1CE01DF91CF917B
:1007C0001F910F910895CF93DF93AC01029710F41E
:1007D00042E050E0A0918801B0918901FD01C0E0A4
:1007E000D0E020E030E020C080819181841795071F
:1007F00069F482819381209719F09B838A8304C0D6
:1008000090938901809388019F0132C0481759074E
:1008100038F42115310519F08217930708F49C016B
:10082000EF010280F381E02D3097F1F621153105BB
:1008300099F1C901841B950B049708F4A901E0E024
:10084000F0E028C08D919C91119782179307F9F4DD
:100850004817590781F4ED018A819B81309719F07F
:100860009383828304C090938901809388019D01C2
:100870002E5F3F4F4CC0841B950BFD01E80FF91F05
:100880004193519302978D939C939F0140C0FD012A
:10089000A281B3811097B1F6809186019091870172
:1008A000892B41F4809165019091660190938701B5
:1008B00080938601209167013091680121153105EF
:1008C00049F48DB7282F30E0809163019091640145
:1008D000281B390BA0918601B09187012A1B3B0B85
:1008E0002417350790F0CA0102962817390768F0D7
:1008F0009D012E5F3F4FC901840F951F9093870183
:10090000809386014D935C9302C020E030E0C901E2
:10091000DF91CF910895CF93DF93009709F44EC0F4
:10092000EC0122971B821A82A0918801B091890163
:10093000109711F140E050E001C0DC01AC17BD0799
:1009400000F1BB83AA83FE0121913191E20FF31FD5
:10095000EA17FB0771F48D919C911197280F391FAD
:100960002E5F3F4F39832883FD01828193819B83D2
:100970008A834115510559F4D0938901C0938801A8
:100980001DC0FD0182819381AD010097B1F6FA018E
:10099000D383C28321913191E20FF31FEC17FD073E
:1009A00069F488819981280F391F2E5F3F4FFA0122
:1009B000318320838A819B8193838283DF91CF91CE
:1009C0000895DC0101C06D9341505040E0F7089557
:1009D000629FD001739FF001829FE00DF11D649F23
:1009E000E00DF11D929FF00D839FF00D749FF00DAF
:1009F000659FF00D9927729FB00DE11DF91F639F50
:100A0000B00DE11DF91FBD01CF011124089597FB21
:100A1000092E05260ED057FD04D014D00AD0001C94
:100A200038F450954095309521953F4F4F4F5F4F8B
:100A30000895F6F790958095709561957F4F8F4F4B
:100A40009F4F0895A1E21A2EAA1BBB1BFD010DC0EA
:100A5000AA1FBB1FEE1FFF1FA217B307E407F5076E
:100A600020F0A21BB30BE40BF50B661F771F881F4A
:100A7000991F1A9469F760957095809590959B01E0
:100A8000AC01BD01CF01089509D0E02D07D0F02DB4
:100A900008950CD0012C0AD011240895E199FECFBD
:100AA000BFBBAEBBE09A11960DB20895E199FECF9F
:100AB000BFBBAEBB0DBA11960FB6F894E29AE19A9D
:100AC0000FBE08952A88398848885F846E847D84A3
:100AD0008C849B84AA84B984C884DF80EE80FD80E6
:100AE0000C811B81AA81B981CE0FD11D0FB6F8945C
:0C0AF000DEBF0FBECDBFED010895FFCFAB
:100AFC00F005000102030405060708090A0B0C0D9A
:100B0C000E0F000102030405060708090A0B0C0D61
:100B1C000E0F000102030405060708090A0B0C0D51
:100B2C000E0F000102030405060708090A0B0C0D41
:100B3C000E0F000102030405060708090A0B0C0D31
:100B4C000E0F000102030405060708090A0B0C0D21
:100B5C000E0F000102030405060708090A0B0C0D11
:100B6C000E0F000102030405060708090A0B0C0D01
:100B7C000E0F000102030405060708090A0B0C0DF1
:100B8C000E0F000102030405060708090A0B0C0DE1
:100B9C000E0F000102030405060708090A0B0C0DD1
:100BAC000E0F000102030405060708090A0B0C0DC1
:100BBC000E0F000102030405060708090A0B0C0DB1
:100BCC000E0F000102030405060708090A0B0C0DA1
:100BDC000E0F000102030405060708090A0B0C0D91
:100BEC000E0F000102030405060708090A0B0C0D81
:0A0BFC000E0FFE20008A0100000029
:1003900012BA8FEF80937C018093780180937E0165
:1003A0001092790110927D01109277013CD21FBC0E
:1003B00082EC8EBD89B7846289BF81E083BF89B733
:1003C000816089BF789444E050E0DA013DD4A0E038
:1003D000B0E022E030E0EA5AF545B9F080EB94E075
:1003E0000C0137D488E097E0D9010C0132D48AEAB5
:1003F00095E5DA010C012DD450EB652E54E0752EF5
:1004000048E0442E47E0542E05C01ED43F01D901D8
:100410001BD42F0188E893E112DF9A83898380ED52
:1004200097E00DDF9C838B8388EC90E008DF9E8350
:100430008D83DD24EE2488249924AA24AA94BA2C3E
:10044000CC24C39430E0232E30E0332E02C028E0C9
:10045000E22E80916A01853188F0AB9853DF8C01E0
:1004600084EF91E0ECDE9C838B838016910608F488
:1004700048010A151B0520F4580102C0AB9A8301FC
:100480008B819C8105DF882339F088E893E1D7DEF2
:100490009C838B8310926A01F5E0FE1508F481C0FD
:1004A00066E00134160718F0E0FC07C005C075E0EF
:1004B0000837170710F4E0FCE3948D819E81E8DE95
:1004C000882309F45BC02C2D30E0C9018170907045
:1004D0004FEF50E0FC01E49FC001E59F900DF49FB9
:1004E000900D112480937C01C90182709070BC0131
:1004F000649FC001659F900D749F900D112480939F
:100500007801C90184709070FC01E49FC001E59FEF
:10051000900DF49F900D112480937E01C901887085
:100520009070BC01649FC001659F900D749F900DF9
:10053000112480937901C90180719070FC01E49FBE
:10054000C001E59F900DF49F900D112480937D01D3
:1005500020723070249FC001259F900D349F900D14
:10056000112480937701CC0CF0E4CF1611F4CC2445
:10057000C39484E690E063DE9E838D8366E0E61696
:1005800081F4979A88EB9BE05ADE9A838983D101A4
:1005900005015FD3A2E0B0E004015BD33501240183
:1005A00003C077E0E71651F58D819E8171DE8823C7
:1005B00019F180917C01809580937C018091780174
:1005C00080958093780180917E01809580937E0153
:1005D0008091790180958093790180917D0180954A
:1005E00080937D018091770180958093770189E1E7
:1005F00090E025DE9E838D8397E0E92E89819A81A4
:1006000047DE882399F087E08E1580F09798109246
:100610007C0185E5809378018AEA80937E0184E6F7
:1006200090E00DDE98878F83DD2404C098E0E91602
:1006300009F00FCF0250104006191709F8017F0189
:100640000027F7FC0095102F920126193709245036
:10065000304040E050E060E070EC85E494E0B7D2D8
:10066000C801B70195D220E43CE940E050E0AFD2A8
:10067000B90137FF03C060E070E005C02250374089
:1006800014F061E077E06F3F710509F030F460939A
:10069000790110927D0110927701CB018050914039
:1006A0008F3F910509F038F48FEF80937901109214
:1006B0007D0160937701CB01805092408F3F91057F
:1006C00009F048F4862F80958093790110927D017E
:1006D0008FEF80937701CB01805093408F3F91053E
:1006E00009F038F41092790160937D018FEF8093C7
:1006F0007701CB01805094408F3F910509F048F479
:10070000109279018FEF80937D01862F80958093E1
:100710007701CB01805095408F3F910509F038F467
:10072000609379018FEF80937D0110927701CB0167
:10073000805096408F3F910509F038F48FEF8093F9
:10074000790180937D0160937701605077403CF0A0
:100750008FEF8093790180937D01809377018F8162
:10076000988596DD882309F472CED0FC0CC0809168
:100770007C018F5F80937C0180917C018F3F71F4BD
:1007800091E0D92A0BC080917C01815080937C013B
:1007900080917C01882311F4EEEFDE22D1FC0CC0A5
:1007A000809178018F5F80937801809178018F3FED
:1007B00071F4F2E0DF2A0BC08091780181508093C0
:1007C000780180917801882311F46DEFD622D2FC54
:1007D0000CC080917E018F5F80937E0180917E01AD
:1007E0008F3F71F474E0D72A0BC080917E01815055
:1007F00080937E0180917E01882311F48BEFD822B3
:1008000081E090E01CDD98878F8321CE1F93182F05
:100810008A3011F48DE0FADF5D9BFECF1CB980E0D9
:1008200090E01F910895599A88E18AB986E880BDC1
:1008300089E189B960E070E086E094E03ED00895F7
:1008400082E682B985EC86BF08951F920F920FB69B
:100850000F9211248F939F9381B190E0887F9070C5
:100860008038910599F08138910534F40097C9F0EA
:1008700080369105C9F40FC0883B910559F0883F37
:10088000910561F0883A910579F404C083B18093B1
:100890007F0101C013B886B7806807C086B780693A
:1008A00086BF86B7806986BF85EC86BF9F918F9192
:1008B0000F900FBE0F901F901895EF92FF920F931D
:1008C0001F93CF93DF938C017B01892B11F4672B4E
:1008D000C9F16EE070E081E090E03BD0FC01009750
:1008E00089F1DC0180E88383E114F10471F0F3867F
:1008F000E28681E883838091800190918101892B38
:1009000021F4F0938101E093800101151105E1F0DC
:100910001187008783818260838380918201909117
:100920008301892B89F4F0938301E0938201809104
:10093000840190918501892B39F4F0938501E0932E
:10094000840102C0A0E0B0E0CD01E6E0CDB7DEB7A3
:10095000A5C10F931F93CF93DF93689F8001699F79
:10096000100D789F100D1124C8010DD0EC010097D7
:1009700021F0A80160E070E004D1CE01DF91CF91B9
:100980001F910F910895CF93DF93AC01029710F45C
:1009900042E050E0A0918801B0918901FD01C0E0E2
:1009A000D0E020E030E020C080819181841795075D
:1009B00069F482819381209719F09B838A8304C014
:1009C00090938901809388019F0132C0481759078D
:1009D00038F42115310519F08217930708F49C01AA
:1009E000EF010280F381E02D3097F1F621153105FA
:1009F00099F1C901841B950B049708F4A901E0E063
:100A0000F0E028C08D919C91119782179307F9F41B
:100A10004817590781F4ED018A819B81309719F0BD
:100A20009383828304C090938901809388019D0100
:100A30002E5F3F4F4CC0841B950BFD01E80FF91F43
:100A40004193519302978D939C939F0140C0FD0168
:100A5000A281B3811097B1F68091860190918701B0
:100A6000892B41F4809165019091660190938701F3
:100A7000809386012091670130916801211531052D
:100A800049F48DB7282F30E0809163019091640183
:100A9000281B390BA0918601B09187012A1B3B0BC3
:100AA0002417350790F0CA0102962817390768F015
:100AB0009D012E5F3F4FC901840F951F90938701C1
:100AC000809386014D935C9302C020E030E0C90121
:100AD000DF91CF910895CF93DF93009709F44EC033
:100AE000EC0122971B821A82A0918801B0918901A2
:100AF000109711F140E050E001C0DC01AC17BD07D8
:100B000000F1BB83AA83FE0121913191E20FF31F13
:100B1000EA17FB0771F48D919C911197280F391FEB
:100B20002E5F3F4F39832883FD01828193819B8310
:100B30008A834115510559F4D0938901C0938801E6
:100B40001DC0FD0182819381AD010097B1F6FA01CC
:100B5000D383C28321913191E20FF31FEC17FD077C
:100B600069F488819981280F391F2E5F3F4FFA0160
:100B7000318320838A819B8193838283DF91CF910C
:100B80000895DC0101C06D9341505040E0F7089595
:100B9000629FD001739FF001829FE00DF11D649F61
:100BA000E00DF11D929FF00D839FF00D749FF00DED
:100BB000659FF00D9927729FB00DE11DF91F639F8E
:100BC000B00DE11DF91FBD01CF011124089597FB60
:100BD000092E05260ED057FD04D014D00AD0001CD3
:100BE00038F450954095309521953F4F4F4F5F4FCA
:100BF0000895F6F790958095709561957F4F8F4F8A
:100C00009F4F0895A1E21A2EAA1BBB1BFD010DC028
:100C1000AA1FBB1FEE1FFF1FA217B307E407F507AC
:100C200020F0A21BB30BE40BF50B661F771F881F88
:100C3000991F1A9469F760957095809590959B011E
:100C4000AC01BD01CF01089509D0E02D07D0F02DF2
:100C500008950CD0012C0AD011240895E199FECFFB
:100C6000BFBBAEBBE09A11960DB20895E199FECFDD
:100C7000BFBBAEBB0DBA11960FB6F894E29AE19ADB
:100C80000FBE08952A88398848885F846E847D84E1
:100C90008C849B84AA84B984C884DF80EE80FD8024
:100CA0000C811B81AA81B981CE0FD11D0FB6F8949A
:0C0CB000DEBF0FBECDBFED010895FFCFE9
:100CBC00F005000102030405060708090A0B0C0DD8
:100CCC000E0F000102030405060708090A0B0C0DA0
:100CDC000E0F000102030405060708090A0B0C0D90
:100CEC000E0F000102030405060708090A0B0C0D80
:100CFC000E0F000102030405060708090A0B0C0D70
:100D0C000E0F000102030405060708090A0B0C0D5F
:100D1C000E0F000102030405060708090A0B0C0D4F
:100D2C000E0F000102030405060708090A0B0C0D3F
:100D3C000E0F000102030405060708090A0B0C0D2F
:100D4C000E0F000102030405060708090A0B0C0D1F
:100D5C000E0F000102030405060708090A0B0C0D0F
:100D6C000E0F000102030405060708090A0B0C0DFF
:100D7C000E0F000102030405060708090A0B0C0DEF
:100D8C000E0F000102030405060708090A0B0C0DDF
:100D9C000E0F000102030405060708090A0B0C0DCF
:100DAC000E0F000102030405060708090A0B0C0DBF
:0A0DBC000E0FFE20008A0100000067
:00000001FF
/IR-TX-BL/branches/PWM-CTRL_V0.02/main.c
112,6 → 112,7
{
PORTB_BAK LEDON (CH0_B | CH1_B | CH2_B); //new cycle, output on
PORTD_BAK LEDON (CH3_D | CH4_D | CH5_D); //
 
ch0_tmp = CH0;
ch1_tmp = CH1;
ch2_tmp = CH2;
118,6 → 119,7
ch3_tmp = CH3;
ch4_tmp = CH4;
ch5_tmp = CH5;
 
counter = 0;
}
 
233,17 → 235,25
 
unsigned int ppm;
signed int color;
unsigned int setupdly;
unsigned int ppmtodly;
unsigned int flashdly;
volatile unsigned int setupdly;
volatile unsigned int ppmtodly;
volatile unsigned int flashdly;
volatile unsigned int dly1;
 
unsigned char flags;
 
unsigned char setup;
unsigned int lmax;
unsigned int lmin;
unsigned int max;
unsigned int min;
unsigned char temp;
signed long temp1;
signed long temp2;
 
flags = 0;
 
DDRB = (CH0_B|CH1_B|CH2_B);
PORTB = 0x00;
 
253,10 → 263,10
DDRD = (ledgreen|CH3_D|CH4_D|CH5_D);
PORTD = 0x00;
 
CH0 = 0;
CH1 = 0;
CH2 = 0;
CH3 = 0;
CH0 = 0xFF; //PORTB RGBLED red
CH1 = 0xFF; //PORTB RGBLED green
CH2 = 0xFF; //PORTB RGBLED blue
CH3 = 0;
CH4 = 0;
CH5 = 0;
 
263,7 → 273,7
lmax = 0x0000;
lmin = 0xffff;
 
// StartUART();
StartUART();
StartPPM();
//StartI2C();
StartPWM();
287,9 → 297,10
 
 
setup = 0; //reset setup toggle counter
temp = (1<<0);
setupdly = SetDelay(5000);
ppmtodly = SetDelay(5000);
flashdly = SetDelay(1000);
ppmtodly = SetDelay(2000);
flashdly = SetDelay(200);
while (1)
{
323,10 → 334,25
 
if (CheckDelay(flashdly))
{
CH0 = CH0 ^ 0xff;
CH0 = (temp & (1<<0)) * 255;
CH1 = (temp & (1<<1)) * 255;
CH2 = (temp & (1<<2)) * 255;
CH3 = (temp & (1<<3)) * 255;
CH4 = (temp & (1<<4)) * 255;
CH5 = (temp & (1<<5)) * 255;
temp <<= 1;
if (temp == (1<<6)) temp = (1<<0);
 
/*
CH0 = CH0 ^ 0xff; //invert brightness
CH1 = CH1 ^ 0xff;
CH2 = CH2 ^ 0xff;
flashdly = SetDelay(250);
CH3 = CH3 ^ 0xff;
CH4 = CH4 ^ 0xff;
CH5 = CH5 ^ 0xff;
*/
 
flashdly = SetDelay(100);
}
}
 
347,32 → 373,45
{
if (CheckDelay(flashdly)) //each 25ms toggle PWM's
{
CH0 = CH0 ^ 0xff;
CH0 = CH0 ^ 0xff; //invert brightness
CH1 = CH1 ^ 0xff;
CH2 = CH2 ^ 0xff;
CH3 = CH3 ^ 0xff;
CH4 = CH4 ^ 0xff;
CH5 = CH5 ^ 0xff;
 
flashdly = SetDelay(25);
}
}
 
if (CheckDelay(setupdly)) //setup timeout reached
if ((CheckDelay(setupdly)) && setup < 8) //setup timeout reached
{
setup = 8; //lockdown setup
PORTD clrbit ledgreen;
CH0 = 0; //start CH3
CH1 = 85; //CH4
CH2 = 170; //and CH4 with about 120° phase shift
 
flags = 0;
dly1 = SetDelay(100);
}
 
if (setup == 8)
{
 
temp1 = ((long)STEP * 6 * 20000) / ((max-REDUCE) - (min+REDUCE));
 
/************************************************************************************/
/* control CH3, CH4 and CH5 (RGB LED) */
/************************************************************************************/
 
temp1 = ((long)STEP * 7 * 40000) / ((max-REDUCE) - (min+REDUCE));
temp2 = (((int)ppm - ((int)min+REDUCE)) * temp1);
color = temp2 / 20000;
color = temp2 / 40000;
if (color < 0) color = 0;
if (color > ((STEP*6)+1)) color = ((STEP*6)+1);
if (color > ((STEP*7)+1)) color = ((STEP*7)+1);
 
//printf("p %u ",ppm);
382,52 → 421,123
//printf("c %i\n ",color);
// Farbablauf: rot > Violett > blau > tuerkis > gruen > gelb >
// Farbablauf: off > red > purple > blue > cyan > green > yellow > white
if ((color >= (STEP * 0)) && (color < (STEP * 1)))
{
CH0 = MUL * ((color - (STEP * 0))); //fade in red > red (red only)
CH1 = 0;
CH2 = 0;
CH3 = MUL * ((color - (STEP * 0))); //fade in red > red (red only)
CH4 = 0;
CH5 = 0;
}
if ((color >= (STEP * 1)) && (color < (STEP * 2)))
{
CH0 = ((STEP-1) * MUL);
CH1 = 0;
CH2 = MUL * ((color - (STEP * 1))); //fade in blue > purple (red + blue)
CH3 = ((STEP-1) * MUL);
CH4 = 0;
CH5 = MUL * ((color - (STEP * 1))); //fade in blue > purple (red + blue)
}
if ((color >= (STEP * 2)) && (color < (STEP * 3)))
{
CH0 = MUL * ((STEP - 1) - (color - (STEP * 2))); //fade out red > blue (blue only)
CH1 = 0;
CH2 = ((STEP-1) * MUL);
CH3 = MUL * ((STEP - 1) - (color - (STEP * 2))); //fade out red > blue (blue only)
CH4 = 0;
CH5 = ((STEP-1) * MUL);
}
if ((color >= (STEP * 3)) && (color < (STEP * 4)))
{
CH0 = 0;
CH1 = MUL * ((color - (STEP * 3))); //fade in green > cyan (blue + green)
CH2 = ((STEP-1) * MUL);
CH3 = 0;
CH4 = MUL * ((color - (STEP * 3))); //fade in green > cyan (blue + green)
CH5 = ((STEP-1) * MUL);
}
if ((color >= (STEP * 4)) && (color < (STEP * 5)))
{
CH0 = 0;
CH1 = ((STEP-1) * MUL);
CH2 = MUL * ((STEP - 1) - (color - (STEP * 4))); //fade out blue > green (green only)
CH3 = 0;
CH4 = ((STEP-1) * MUL);
CH5 = MUL * ((STEP - 1) - (color - (STEP * 4))); //fade out blue > green (green only)
}
if ((color >= (STEP * 5)) && (color < (STEP * 6)))
{
CH0 = MUL * ((color - (STEP * 5))); //fade in red > yellow (green + red)
CH1 = ((STEP-1) * MUL);
CH2 = 0;
CH3 = MUL * ((color - (STEP * 5))); //fade in red > yellow (green + red)
CH4 = ((STEP-1) * MUL);
CH5 = 0;
}
if (color >= (STEP * 6))
if ((color >= (STEP * 6)) && (color < (STEP * 7)))
{
CH0 = ((STEP-1) * MUL); //fade in red > yellow (green + red)
CH1 = ((STEP-1) * MUL);
CH2 = 0;
CH3 = ((STEP-1) * MUL);
CH4 = ((STEP-1) * MUL);
CH5 = MUL * ((color - (STEP * 1))); //fade in blue > purple (red + blue)
}
 
if (color >= (STEP * 7))
{
CH3 = ((STEP-1) * MUL);
CH4 = ((STEP-1) * MUL);
CH5 = ((STEP-1) * MUL);
}
 
/************************************************************************************/
/* control CH0, CH1 and CH2 */
/************************************************************************************/
 
if (CheckDelay(dly1)) //timeout reached ?
{
 
if ((flags & (1<<0))==0) //check if up or down
{
if (CH0++ == 254) //run CH0 up to 255
{
flags setbit (1<<0); //255 reached next time go down
 
}
}
else //run down
{
if (CH0-- == 1) //run CH0 down to 0
{
flags clrbit (1<<0); //0 reached next time go up
}
}
 
 
if ((flags & (1<<1))==0) //same for CH1
{
if (CH1++ == 254)
{
flags setbit (1<<1);
}
}
else
{
if (CH1-- == 1)
{
flags clrbit (1<<1);
}
}
 
 
if ((flags & (1<<2))==0) //and same for CH2
{
if (CH2++ == 254)
{
flags setbit (1<<2);
}
}
else
{
if (CH2-- == 1)
{
flags clrbit (1<<2);
}
}
 
 
dly1 = SetDelay(1); //set next timeout in 25ms
 
// printf("ch3:%i\n",CH0);
}
 
}
 
 
}
 
}