Beispiel #1
0
void setup_spi() {
    // TODO move it out of here
    INTDisableInterrupts();
    mCNOpen(CN_ON | CN_IDLE_CON, CN1_ENABLE, CN1_PULLUP_ENABLE);
    mPORTCRead();
    mCNSetIntPriority(6); // same as below
    mCNClearIntFlag();
    mCNIntEnable(1);
    INTEnableInterrupts();
}
Beispiel #2
0
/***************************************************************************************************
InitKeyboard
Initialise the keyboard and sound routines.
****************************************************************************************************/
void initKeyboard(void) {

    // enable pullups on the clock and data lines.
    // This stops them from floating and generating random chars when no keyboard is attached
    CNCONbits.ON = 1;       						// turn on Change Notification module
    P_PS2CLK_PULLUP = P_ON;							// turn on the pullup for pin D6 also called CN15
    P_PS2DAT_PULLUP = P_ON;							// turn on the pullup for pin D7 also called CN16

    // setup Change Notification interrupt
    P_PS2CLK_INT = P_ON;    							// enable PS2CLK (CN15) as a change interrupt
    mCNSetIntPriority(3);  							// set interrupt priority to 3
    mCNClearIntFlag();      							// clear the interrupt flag
    mCNIntEnable(1);       							// enable interrupt
}