/*--------------------------------------------------------------------------- DefaultIRQHandler() This function is a placeholder for all vector definitions. Either use your own placeholder or add necessary code here. -----------------------------------------------------------------------------*/ __interrupt void DefaultIRQHandler( void ) { __DI(); /* disable interrupts */ while( 1 ) { __wait_nop(); /* halt system */ } }
void wait(long d) { while(d--) { __wait_nop(); } return; }
void wait_(unsigned long a) { unsigned long i; for (i = 0; i < a; i++) { __wait_nop(); } }
void GdcWait(GDC_ULONG ulMSec) { int i; for(i = 0; i < ulMSec * 40000; i++) { __wait_nop(); HWWD_CL = 0; } }
void calibrate_us_bt(wireless_interface_t wiif, wirelessMessage_t* msg) { static uint8_t val = 0; Us_IO_DDR(2, 0, 1); while (Us_Cmd_Wait(1) || Us_Cmd_Wait(2)) __wait_nop(); Us_IO_DDR(2, 1, 1); while (Us_Cmd_Wait(1) || Us_Cmd_Wait(2)) __wait_nop(); Us_IO_Value(2, 0, val); while (Us_Cmd_Wait(1) || Us_Cmd_Wait(2)) __wait_nop(); val ^= 0x01; Us_IO_Value(2, 1, val); while (Us_Cmd_Wait(1) || Us_Cmd_Wait(2)) __wait_nop(); Us_Calibrate(2); }
//------------------------------------------------------------------------------ void wait1mks() { __wait_nop(); __wait_nop(); __wait_nop(); __wait_nop(); __wait_nop(); __wait_nop(); __wait_nop(); __wait_nop(); __wait_nop(); __wait_nop(); __wait_nop(); }
void wait(unsigned long cycles) { unsigned long cur = 0; while (++cur < cycles) __wait_nop(); }
void main(void) { /* your definitions here */ int leftADValue = 0; int rightADValue = 0; char leftButton = 1; char leftButtonLast = 1; char rightButton = 1; char rightButtonLast = 1; // init buttons and seven-segment displays initIO(); // init LCD initLCD(); // init A/D converter initADC(); /* your code here */ drawBuffer(); wait(100001); //setPixel(10, 10, 1); //writeString(5, 0, "Hallo Welt"); writeText(LOREM); for(;;) { switch (curMode) { case 0: leftADValue = getADCValue(1); curLine = inverseScaleDown(leftADValue, lines); writeInt(7, 0, curLine+1); writeInt(7, 104, lines); copyBuffer(curLine, 7); drawBuffer(); //eventloop(4); break; case 1: copyBuffer(curLine, 7); writeInt(7, 0, curLine+1); writeInt(7, (128 - 4*CHARACTER_WIDTH), lines); drawBuffer(); curLine++; if(curLine > lines) curMode = 6; else curMode = 2; break; case 2: wait(DELAY/2); curMode = 3; break; case 3: wait(DELAY/2); curMode = 4; break; case 4: wait(DELAY/2); curMode = 5; break; case 5: wait(DELAY/2); curMode = 1; break; case 6: __wait_nop(); break; } printNumber(curMode); leftButton = PDR07_P0; rightButton = PDR07_P2; if(leftButton == 1 && leftButtonLast == 0) { if (curMode == 0) { curLine = 0; curMode = 1; } else { curMode = 0; } } leftButtonLast = leftButton; rightButtonLast = rightButton; __wait_nop(); } }
// wait a specified amount of cycles void wait(long cycle) { long i; for (i = 0; i < cycle; ++i) __wait_nop(); }
void wait(long cyc) { long d; for (d = 0; d < cyc; d++) { __wait_nop(); } }