Line 122... |
Line 122... |
zip->pic = 0x7fff7fff;
|
zip->pic = 0x7fff7fff;
|
while(sys->io_pwrcount < (second >> 4))
|
while(sys->io_pwrcount < (second >> 4))
|
;
|
;
|
|
|
// Repeating timer, every 250ms
|
// Repeating timer, every 250ms
|
// zip->tma = (second/4) | 0x80000000;
|
zip->tma = (second/4) | 0x80000000;
|
zip->tma = 1024 | 0x80000000;
|
// zip->tma = 1024 | 0x80000000;
|
// Restart the PIC -- listening for SYSINT_TMA only
|
// Restart the PIC -- listening for SYSINT_TMA only
|
zip->pic = SYSINT_TMA;
|
|
zip->pic = EINT(SYSINT_TMA)|SYSINT_TMA;
|
zip->pic = EINT(SYSINT_TMA)|SYSINT_TMA;
|
zip_rtu();
|
zip_rtu();
|
|
zip->pic = EINT(SYSINT_TMA)|SYSINT_TMA;
|
|
|
sys->io_clrled[0] = green;
|
sys->io_clrled[0] = green;
|
sys->io_ledctrl = 0x010;
|
sys->io_ledctrl = 0x010;
|
|
|
zip->pic = SYSINT_TMA;
|
|
zip->pic = EINT(SYSINT_TMA)|SYSINT_TMA;
|
|
zip_rtu();
|
zip_rtu();
|
|
zip->pic = EINT(SYSINT_TMA)|SYSINT_TMA;
|
|
|
sys->io_clrled[0] = dimgreen;
|
sys->io_clrled[0] = dimgreen;
|
sys->io_clrled[1] = green;
|
sys->io_clrled[1] = green;
|
sys->io_scope[0].s_ctrl = 32 | SCOPE_TRIGGER;
|
sys->io_scope[0].s_ctrl = 32 | 0x80000000; // SCOPE_TRIGGER;
|
sys->io_ledctrl = 0x020;
|
sys->io_ledctrl = 0x020;
|
|
|
zip->pic = SYSINT_TMA;
|
|
zip->pic = EINT(SYSINT_TMA)|SYSINT_TMA;
|
|
zip_rtu();
|
zip_rtu();
|
|
zip->pic = EINT(SYSINT_TMA)|SYSINT_TMA;
|
|
|
sys->io_clrled[1] = dimgreen;
|
sys->io_clrled[1] = dimgreen;
|
sys->io_clrled[2] = green;
|
sys->io_clrled[2] = green;
|
sys->io_ledctrl = 0x040;
|
sys->io_ledctrl = 0x040;
|
|
|
zip->pic = SYSINT_TMA;
|
|
zip->pic = EINT(SYSINT_TMA);
|
|
zip_rtu();
|
zip_rtu();
|
|
zip->pic = EINT(SYSINT_TMA)|SYSINT_TMA;
|
|
|
sys->io_clrled[2] = dimgreen;
|
sys->io_clrled[2] = dimgreen;
|
sys->io_clrled[3] = green;
|
sys->io_clrled[3] = green;
|
sys->io_ledctrl = 0x080;
|
sys->io_ledctrl = 0x080;
|
|
|
zip->pic = SYSINT_TMA;
|
|
zip->pic = EINT(SYSINT_TMA);
|
|
zip_rtu();
|
zip_rtu();
|
|
zip->pic = EINT(SYSINT_TMA)|SYSINT_TMA;
|
|
|
sys->io_clrled[3] = dimgreen;
|
sys->io_clrled[3] = dimgreen;
|
|
|
zip->pic = SYSINT_TMA;
|
|
zip->pic = EINT(SYSINT_TMA);
|
|
zip_rtu();
|
zip_rtu();
|
|
zip->pic = EINT(SYSINT_TMA)|SYSINT_TMA;
|
|
|
for(i=0; i<4; i++)
|
for(i=0; i<4; i++)
|
sys->io_clrled[i] = black;
|
sys->io_clrled[i] = black;
|
|
|
// Wait one second ...
|
// Wait one second ...
|
for(i=0; i<4; i++) {
|
for(i=0; i<4; i++) {
|
zip->pic = SYSINT_TMA;
|
|
zip->pic = EINT(SYSINT_TMA);
|
|
zip_rtu();
|
zip_rtu();
|
|
zip->pic = EINT(SYSINT_TMA)|SYSINT_TMA;
|
}
|
}
|
|
|
sw = sys->io_btnsw & 0x0f;
|
sw = sys->io_btnsw & 0x0f;
|
for(int i=0; i<4; i++)
|
for(int i=0; i<4; i++)
|
sys->io_clrled[i] = (sw & (1<<i)) ? white : black;
|
sys->io_clrled[i] = (sw & (1<<i)) ? white : black;
|
|
|
|
|
// Wait another two second ...
|
// Wait another two second ...
|
for(i=0; i<8; i++) {
|
for(i=0; i<8; i++) {
|
zip->pic = SYSINT_TMA;
|
|
zip->pic = EINT(SYSINT_TMA);
|
|
zip_rtu();
|
zip_rtu();
|
|
zip->pic = EINT(SYSINT_TMA)|SYSINT_TMA;
|
}
|
}
|
|
|
// Blink all the LEDs
|
// Blink all the LEDs
|
// First turn them on
|
// First turn them on
|
sys->io_ledctrl = 0x0ff;
|
sys->io_ledctrl = 0x0ff;
|
// Then wait a quarter second
|
// Then wait a quarter second
|
zip->pic = SYSINT_TMA;
|
|
zip->pic = EINT(SYSINT_TMA)|SYSINT_TMA;
|
|
zip_rtu();
|
zip_rtu();
|
|
zip->pic = EINT(SYSINT_TMA)|SYSINT_TMA;
|
// Then turn the back off
|
// Then turn the back off
|
sys->io_ledctrl = 0x0f0;
|
sys->io_ledctrl = 0x0f0;
|
// and wait another quarter second
|
// and wait another quarter second
|
zip->pic = SYSINT_TMA;
|
|
zip->pic = EINT(SYSINT_TMA)|SYSINT_TMA;
|
|
zip_rtu();
|
zip_rtu();
|
|
zip->pic = EINT(SYSINT_TMA)|SYSINT_TMA;
|
|
|
// Now, read buttons, and flash an LED on any button being held
|
// Now, read buttons, and flash an LED on any button being held
|
// down ... ? neat?
|
// down ... ? neat?
|
|
|
// zip->tma = 20000000; // 1/4 second -- already set
|
// zip->tma = 20000000; // 1/4 second -- already set
|
while(1) {
|
while(1) {
|
unsigned btn, ledc;
|
unsigned btn, ledc;
|
|
|
zip->pic = SYSINT_TMA;
|
|
zip->pic = EINT(SYSINT_TMA);
|
|
zip_rtu();
|
zip_rtu();
|
|
zip->pic = EINT(SYSINT_TMA)|SYSINT_TMA;
|
// If the button is pressed, toggle the LED
|
// If the button is pressed, toggle the LED
|
// Otherwise, turn the LED off.
|
// Otherwise, turn the LED off.
|
//
|
//
|
// First, get all the pressed buttons
|
// First, get all the pressed buttons
|
btn = (sys->io_btnsw >> 4) & 0x0f;
|
btn = (sys->io_btnsw >> 4) & 0x0f;
|
sys->io_btnsw = 0x0f0;
|
// Now, acknowledge the button presses that we just read
|
|
sys->io_btnsw = (btn<<4);
|
|
|
// Of any LEDs that are on, or buttons on, toggle their values
|
// Of any LEDs that are on, or buttons on, toggle their values
|
ledc = (sys->io_ledctrl | btn)&0x0f;
|
ledc = (sys->io_ledctrl)&0x0f;
|
|
ledc = (ledc | btn)&0x0f ^ ledc;
|
// Make sure we set everything
|
// Make sure we set everything
|
ledc |= 0x0f0;
|
ledc |= 0x0f0;
|
// Now issue the command
|
// Now issue the command
|
sys->io_ledctrl = ledc;
|
sys->io_ledctrl = ledc;
|
// That way, at the end, the toggle will leave them in the
|
// That way, at the end, the toggle will leave them in the
|