First implementation of a embedded delay information in a single frame.
This commit is contained in:
parent
8653fb545c
commit
53040bd56c
7 changed files with 81 additions and 105 deletions
|
@ -13,5 +13,4 @@
|
||||||
#define MODE_ANIMATION_LOOP 2
|
#define MODE_ANIMATION_LOOP 2
|
||||||
|
|
||||||
#define MAX_EEPROM_FRAMES 32
|
#define MAX_EEPROM_FRAMES 32
|
||||||
#define STARTUP_DELAY_MAX 10
|
|
||||||
|
|
||||||
|
|
|
@ -56,8 +56,8 @@ void init()
|
||||||
ISR (TIMER1_COMPA_vect)
|
ISR (TIMER1_COMPA_vect)
|
||||||
{
|
{
|
||||||
|
|
||||||
delay--; // decrease the delay counter
|
//delay--; // decrease the delay counter
|
||||||
if ( !delay ) // check if we are done with waiting
|
if ( !(--delay) ) // check if we are done with waiting
|
||||||
{
|
{
|
||||||
if (frmnum == MAX_EEPROM_FRAMES)
|
if (frmnum == MAX_EEPROM_FRAMES)
|
||||||
{
|
{
|
||||||
|
@ -69,11 +69,11 @@ ISR (TIMER1_COMPA_vect)
|
||||||
{
|
{
|
||||||
// if we are in an animation mode we have to load a frame out of the eeprom
|
// if we are in an animation mode we have to load a frame out of the eeprom
|
||||||
// and increase the counter
|
// and increase the counter
|
||||||
loadEEPROMFrame(frmnum);
|
frame = eeprom_read_dword( &eep_anim[frmnum] );
|
||||||
frmnum++;
|
frmnum++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delay = delay_max; // start counting from the top of the maximum delay
|
delay = (frame & 0xf8000000) >> 24; // Just shift right by 24 instead of 27 to multiply the delay by 8.
|
||||||
}
|
}
|
||||||
|
|
||||||
// PORTD = __, 9, C, B, A,D+,D-,__
|
// PORTD = __, 9, C, B, A,D+,D-,__
|
||||||
|
@ -95,11 +95,3 @@ ISR (TIMER1_COMPA_vect)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Simple function to load a single frame out of the EEPROM.
|
|
||||||
*/
|
|
||||||
void loadEEPROMFrame(uint8_t f)
|
|
||||||
{
|
|
||||||
frame = eeprom_read_dword( &eep_anim[f] );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -26,14 +26,12 @@ uint8_t level; // current layer
|
||||||
uint8_t mode = MODE_ANIMATION_LOOP; // firmware mode
|
uint8_t mode = MODE_ANIMATION_LOOP; // firmware mode
|
||||||
uint8_t frmnum; // frame nummber in the animation loop
|
uint8_t frmnum; // frame nummber in the animation loop
|
||||||
uint8_t delay; // delay in ISR calls between changing to the next animation frame
|
uint8_t delay; // delay in ISR calls between changing to the next animation frame
|
||||||
uint8_t delay_max = STARTUP_DELAY_MAX; // maximum delay between the animation frames
|
|
||||||
|
|
||||||
// eeprom array of the animation
|
// eeprom array of the animation
|
||||||
uint32_t eep_anim[MAX_EEPROM_FRAMES] EEMEM;
|
uint32_t eep_anim[MAX_EEPROM_FRAMES] EEMEM;
|
||||||
|
|
||||||
// function prototypes
|
// function prototypes
|
||||||
void init(void);
|
void init(void);
|
||||||
void loadEEPROMFrame(uint8_t);
|
|
||||||
|
|
||||||
extern void init_usb(void);
|
extern void init_usb(void);
|
||||||
extern void usbPoll(void);
|
extern void usbPoll(void);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
:1000000083C111C09AC199C1DAC197C196C195C186
|
:1000000083C111C09AC199C1C9C197C196C195C197
|
||||||
:1000100094C193C192C191C190C18FC18EC18DC154
|
:1000100094C193C192C191C190C18FC18EC18DC154
|
||||||
:100020008CC18BC18AC1CF93CFB7CF93C395819B2E
|
:100020008CC18BC18AC1CF93CFB7CF93C395819B2E
|
||||||
:10003000E9F7819B09C0819B07C0819B05C0819B1B
|
:10003000E9F7819B09C0819B07C0819B05C0819B1B
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
:1001A0008700112369F534306AF13093870020937A
|
:1001A0008700112369F534306AF13093870020937A
|
||||||
:1001B0008300109184003BE0311B3093840022C007
|
:1001B0008300109184003BE0311B3093840022C007
|
||||||
:1001C000009187000130E4F40AE54F7049F4309162
|
:1001C000009187000130E4F40AE54F7049F4309162
|
||||||
:1001D000620034FD19C000936200CBE6D0E018C085
|
:1001D000610034FD19C000936100CBE6D0E018C087
|
||||||
:1001E0003091760034FD10C000937600C7E7D0E070
|
:1001E0003091760034FD10C000937600C7E7D0E070
|
||||||
:1001F0000FC02795A8F45150A9F4220F0000F9CFA1
|
:1001F0000FC02795A8F45150A9F4220F0000F9CFA1
|
||||||
:100200004AE503C042ED01C0432FC4E1D0E032E033
|
:100200004AE503C042ED01C0432FC4E1D0E032E033
|
||||||
|
@ -47,83 +47,83 @@
|
||||||
:1002E0000000092101010001221600070581030811
|
:1002E0000000092101010001221600070581030811
|
||||||
:1002F000000A0600FF0901A101150026FF0075088C
|
:1002F000000A0600FF0901A101150026FF0075088C
|
||||||
:1003000095010900B20201C011241FBECFEDCDBF7F
|
:1003000095010900B20201C011241FBECFEDCDBF7F
|
||||||
:1003100010E0A0E6B0E0E4EEF7E002C005900D9238
|
:1003100010E0A0E6B0E0EAEEF7E002C005900D9232
|
||||||
:10032000A436B107D9F710E0A4E6B0E001C01D92F1
|
:10032000A436B107D9F710E0A4E6B0E001C01D92F1
|
||||||
:10033000A13AB107E1F72ED053C262CEA82FB92F50
|
:10033000A13AB107E1F72ED056C262CEA82FB92F4D
|
||||||
:1003400080E090E041E050EA609530E009C02D91F6
|
:1003400080E090E041E050EA609530E009C02D91F6
|
||||||
:1003500082279795879510F084279527305EC8F3FC
|
:1003500082279795879510F084279527305EC8F3FC
|
||||||
:100360006F5FA8F30895EADF8D939D9308958FEF53
|
:100360006F5FA8F30895EADF8D939D9308958FEF53
|
||||||
:1003700087BB88BB88E781BB80E482BB89B7806488
|
:1003700087BB88BB88E781BB80E482BB89B7806488
|
||||||
:1003800089BF82E08BBD81E78ABD8EB58B608EBD53
|
:1003800089BF82E08BBD81E78ABD8EB58B608EBD53
|
||||||
:1003900078940895ECDFE0D184D0FECF90E0880F10
|
:1003900078940895ECDFE3D18DD0FECF1F920F92B9
|
||||||
:1003A000991F880F991F80509040F2D1609366008A
|
:1003A0000FB60F9211241F932F933F934F935F9398
|
||||||
:1003B00070936700809368009093690008951F927E
|
:1003B0006F937F938F939F93AF93BF93EF93FF932D
|
||||||
:1003C0000F920FB60F9211242F933F934F935F9389
|
:1003C00080916500815080936500882389F51091A4
|
||||||
:1003D0006F937F938F939F93AF93BF93EF93FF930D
|
:1003D0006A0080916000103239F4813011F410927B
|
||||||
:1003E000809165008150809365008823C9F48091D5
|
:1003E000600010926A0016C08823A1F0812F90E06F
|
||||||
:1003F0006A0090916000803239F4913011F41092CB
|
:1003F000880F991F880F991F80509040CCD160932F
|
||||||
:10040000600010926A0008C0992331F0C7DF809124
|
:1004000066007093670080936800909369001F5F97
|
||||||
:100410006A008F5F80936A0080916100809365001D
|
:1004100010936A008091660090916700A091680037
|
||||||
:1004200082B3877882BB92B390648091640028E0A5
|
:10042000B091690080709070A070B87FB093650043
|
||||||
:1004300030E0082E02C0220F331F0A94E2F7922BFD
|
:1004300082B3877882BB92B390648091640028E095
|
||||||
:1004400092BB69E09CD12091660030916700409199
|
:1004400030E0082E02C0220F331F0A94E2F7922BED
|
||||||
:1004500068005091690004C05695479537952795D7
|
:1004500092BB69E097D1209166003091670040918E
|
||||||
:100460008A95D2F7822F809588BB30FD969880912F
|
:1004600068005091690004C05695479537952795C7
|
||||||
:1004700064008F5F80936400833010F010926400FA
|
:100470008A95D2F7822F809588BB30FD969880911F
|
||||||
:10048000FF91EF91BF91AF919F918F917F916F916C
|
:1004800064008F5F80936400833010F010926400EA
|
||||||
:100490005F914F913F912F910F900FBE0F901F9042
|
:10049000FF91EF91BF91AF919F918F917F916F915C
|
||||||
:1004A00018951F93CF93DF9380918700835087FD2A
|
:1004A0005F914F913F912F911F910F900FBE0F9031
|
||||||
:1004B000A1C090918400209183002D3209F098C052
|
:1004B0001F9018951F93CF93DF93809187008350EF
|
||||||
:1004C000883009F095C0CCE0D0E0C91BD109C557F0
|
:1004C00087FDA1C090918400209183002D3209F016
|
||||||
:1004D000DF4F83EC80936B008AE58093620013BA50
|
:1004D00098C0883009F095C0CCE0D0E0C91BD109A4
|
||||||
:1004E0008881807619F0CE01DBD079C09A81109294
|
:1004E000C557DF4F83EC80936B008AE580936100F2
|
||||||
:1004F00074008981882331F41092750024E730E07C
|
:1004F00013BA8881807619F0CE01DBD079C09A8159
|
||||||
:1005000082E069C0853019F49093880061C086301C
|
:10050000109274008981882331F41092750024E7D9
|
||||||
:1005100009F048C08B81813041F48EEB92E09093DA
|
:1005100030E082E069C0853019F49093880061C0B2
|
||||||
:1005200086008093850082E13AC0823041F480EDFC
|
:10052000863009F048C08B81813041F48EEB92E037
|
||||||
:1005300092E0909386008093850082E230C0833001
|
:10053000909386008093850082E13AC0823041F436
|
||||||
:10054000C9F4992341F48AE992E09093860080935C
|
:1005400080ED92E0909386008093850082E230C037
|
||||||
:10055000850084E024C0913019F48EE992E004C053
|
:100550008330C9F4992341F48AE992E090938600AC
|
||||||
:100560009230E1F48EEA92E09093860080938500C9
|
:100560008093850084E024C0913019F48EE992E0F4
|
||||||
:1005700080E115C0813241F482EE92E090938600D2
|
:1005700004C09230E1F48EEA92E09093860080937A
|
||||||
:100580008093850089E00BC0823241F482EF92E0D3
|
:10058000850080E115C0813241F482EE92E09093C3
|
||||||
:10059000909386008093850086E101C080E090E41E
|
:1005900086008093850089E00BC0823241F482EFAF
|
||||||
:1005A00093BB1DC0883069F0893019F490938A009C
|
:1005A00092E0909386008093850086E101C080E010
|
||||||
:1005B0000FC08A3049F08B3059F48BE48093770078
|
:1005B00090E493BB1DC0883069F0893019F49093A2
|
||||||
:1005C00007C02AE830E002C024E730E081E003C041
|
:1005C0008A000FC08A3049F08B3059F48BE4809355
|
||||||
:1005D00024E730E080E030938600209385009F81FF
|
:1005D000770007C02AE830E002C024E730E081E07D
|
||||||
:1005E000992321F49E81981708F4892F8093630042
|
:1005E00003C024E730E080E030938600209385004C
|
||||||
:1005F000109287008091620084FF44C08091630064
|
:1005F0009F81992321F49E81981708F4892F809375
|
||||||
:100600008F3F09F43FC0182F893008F018E0811B94
|
:100600006200109287008091610084FF44C0809155
|
||||||
:100610008093630080916B0098E8892780936B003A
|
:1006100062008F3F09F43FC0182F893008F018E0BE
|
||||||
:10062000112321F1E0918500F0918600812F815006
|
:10062000811B8093620080916B0098E889278093FA
|
||||||
:100630009E9B0CC090E083599F4FACE6B0E02491A4
|
:100630006B00112321F1E0918500F0918600812F5C
|
||||||
:100640002D933196A817B907D1F70CC0EF0190E0B0
|
:1006400081509E9B0CC090E083599F4FACE6B0E078
|
||||||
:1006500083599F4FACE6B0E029912D93FE01A81776
|
:1006500024912D933196A817B907D1F70CC0EF015B
|
||||||
:10066000B907D1F7F0938600E09385008CE690E01F
|
:1006600090E083599F4FACE6B0E029912D93FE01B5
|
||||||
:10067000612F79DE1C5F1C3019F08FEF80936300CF
|
:10067000A817B907D1F7F0938600E09385008CE6C0
|
||||||
:100680001093620084E190B3967031F48150D9F7F1
|
:1006800090E0612F70DE1C5F1C3019F08FEF8093BB
|
||||||
:100690001092880010928200DF91CF911F910895EF
|
:1006900062001093610084E190B3967031F4815050
|
||||||
:1006A000FC0180818076803409F054C081818130E2
|
:1006A000D9F71092880010928200DF91CF911F91AC
|
||||||
:1006B00091F5848173816281209166003091670099
|
:1006B0000895FC0180818076803409F04EC08181EC
|
||||||
:1006C0004091680050916900882359F4972F80E089
|
:1006C000813091F58481738162812091660030913F
|
||||||
:1006D000860F911DAA2797FDA095BA2F2070307024
|
:1006D00067004091680050916900882359F4972F72
|
||||||
:1006E0000DC0972F80E0860F911DAA2797FDA0953A
|
:1006E00080E0860F911DAA2797FDA095BA2F207054
|
||||||
:1006F000BA2FDC019927882740705070822B932BEA
|
:1006F00030700DC0972F80E0860F911DAA2797FDBF
|
||||||
:10070000A42BB52B8093660090936700A09368009C
|
:10070000A095BA2FDC019927882740705070822B62
|
||||||
:10071000B09369001FC0823091F4848190E0880F0B
|
:10071000932BA42BB52B8093660090936700A09336
|
||||||
:10072000991F880F991F4091660050916700609152
|
:100720006800B093690019C0823091F4848190E030
|
||||||
:10073000680070916900805090402DD00BC08430CB
|
:10073000880F991F880F991F40916600509167009C
|
||||||
:1007400021F482818093610005C0833019F4828195
|
:1007400060916800709169008050904027D005C08A
|
||||||
:100750008093600080E0089585B7826085BF8BB785
|
:10075000833019F482818093600080E0089585B72A
|
||||||
:1007600080648BBF8BE4809377008AE5809376006A
|
:10076000826085BF8BB780648BBF8BE480937700FA
|
||||||
:10077000899A01C000009150E9F7899808950024F2
|
:100770008AE580937600899A01C000009150E9F7DC
|
||||||
:1007800080FD060E660F11F08695D1F7802D089535
|
:1007800089980895002480FD060E660F11F0869565
|
||||||
:10079000A6E144E00AC0242F16D0252F14D000C0B3
|
:10079000D1F7802D0895A6E144E00AC0242F16D099
|
||||||
:1007A00011D0272F10C0A82F862FE82FE199FECF58
|
:1007A000252F14D000C011D0272F10C0A82F862FBE
|
||||||
:1007B0001FBA05C0EEBBE09AE3950DB20D92415011
|
:1007B000E82FE199FECF1FBA05C0EEBBE09AE395A2
|
||||||
:1007C000C8F70895262FE199FECF1CBA1FBA8EBB39
|
:1007C0000DB20D924150C8F70895262FE199FECF42
|
||||||
:1007D0002DBB0FB6F894E29AE19A0FBE01960895E8
|
:1007D0001CBA1FBA8EBB2DBB0FB6F894E29AE19AF1
|
||||||
:0407E000F894FFCFBB
|
:0A07E0000FBE01960895F894FFCFB4
|
||||||
:0407E400020A5AFFAC
|
:0407EA00025AFF00B0
|
||||||
:00000001FF
|
:00000001FF
|
||||||
|
|
|
@ -21,6 +21,5 @@
|
||||||
#define CUSTOM_RQ_SET_FRAME 1
|
#define CUSTOM_RQ_SET_FRAME 1
|
||||||
#define CUSTOM_RQ_EEPROM_STORE_FRAME 2
|
#define CUSTOM_RQ_EEPROM_STORE_FRAME 2
|
||||||
#define CUSTOM_RQ_SET_MODE 3
|
#define CUSTOM_RQ_SET_MODE 3
|
||||||
#define CUSTOM_RQ_SET_DELAY 4
|
|
||||||
|
|
||||||
#endif /* __REQUESTS_H_INCLUDED__ */
|
#endif /* __REQUESTS_H_INCLUDED__ */
|
||||||
|
|
|
@ -43,11 +43,7 @@ usbMsgLen_t usbFunctionSetup(uchar data[8])
|
||||||
// save the actual frame to the eeprom
|
// save the actual frame to the eeprom
|
||||||
// don't forget to send a frame first
|
// don't forget to send a frame first
|
||||||
eeprom_write_dword( &eep_anim[ rq->wIndex.bytes[0] ], frame );
|
eeprom_write_dword( &eep_anim[ rq->wIndex.bytes[0] ], frame );
|
||||||
} else if ( rq->bRequest == CUSTOM_RQ_SET_DELAY )
|
|
||||||
{
|
|
||||||
// set the maximum delay between two frames
|
|
||||||
// as a multiply of ISR calls
|
|
||||||
delay_max = rq->wValue.bytes[0];
|
|
||||||
} else if ( rq->bRequest == CUSTOM_RQ_SET_MODE )
|
} else if ( rq->bRequest == CUSTOM_RQ_SET_MODE )
|
||||||
{
|
{
|
||||||
// set the firmware mode
|
// set the firmware mode
|
||||||
|
|
|
@ -41,23 +41,15 @@ PROGMEM char usbHidReportDescriptor[22] = { /* USB report descriptor */
|
||||||
0xb2, 0x02, 0x01, // FEATURE (Data,Var,Abs,Buf)
|
0xb2, 0x02, 0x01, // FEATURE (Data,Var,Abs,Buf)
|
||||||
0xc0 // END_COLLECTION
|
0xc0 // END_COLLECTION
|
||||||
};
|
};
|
||||||
/* The descriptor above is a dummy only, it silences the drivers. The report
|
|
||||||
* it describes consists of one byte of undefined data.
|
|
||||||
* We don't transfer our data through HID reports, we use custom requests
|
|
||||||
* instead.
|
|
||||||
*/
|
|
||||||
|
|
||||||
void init_usb(void);
|
void init_usb(void);
|
||||||
|
|
||||||
|
//extern uint8_t eep_delay_max EEMEM;
|
||||||
extern uint32_t eep_anim[MAX_EEPROM_FRAMES] EEMEM;
|
extern uint32_t eep_anim[MAX_EEPROM_FRAMES] EEMEM;
|
||||||
|
|
||||||
// usb buffer
|
// usb buffer
|
||||||
extern uint32_t frame; // Framebuffer
|
extern uint32_t frame; // Framebuffer
|
||||||
extern uint8_t delay_max; // delay in ISR aufrufen
|
|
||||||
extern uint8_t mode; // FW mode
|
extern uint8_t mode; // FW mode
|
||||||
|
|
||||||
//extern cube_t *cube;
|
|
||||||
extern void loadEEPROMFrame(uint8_t);
|
|
||||||
|
|
||||||
#endif // __usb_h__
|
#endif // __usb_h__
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue