コード例 #1
0
ファイル: main.c プロジェクト: notbryant/project-stupid-robot
int main(void)
{

	BYTE	stBtn1;
	BYTE	stBtn2;

	DeviceInit();
	AppInit();

        
        while(stBtn1!=stPressed && stBtn2!=stPressed)
        {
            mT5IntEnable(fFalse);
            stBtn1 = btnBtn1.stBtn;
            stBtn2 = btnBtn2.stBtn;
            mT5IntEnable(fTrue);
        }

        RightReverse;
        LeftReverse;
        SetLeftSpeed(dtcMtrMedium);
        SetRightSpeed(dtcMtrMedium);

        mCNIntEnable(fTrue);	//Sensors will trigger
        while(fTrue);
}
コード例 #2
0
ファイル: spi.c プロジェクト: LibreRVAC/librervac-sr8730
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();
}
コード例 #3
0
void enableCNModule(int userIsWatchingTV)
{
    if(userIsWatchingTV)
    {
        //do not enable PIR input during TV operation it is useless
        mCNOpen(CN_ON | CN_IDLE_CON, CN16_ENABLE, CN16_PULLUP_ENABLE | CN4_PULLUP_ENABLE);
    }
    else
    {
        mCNOpen(CN_ON | CN_IDLE_CON, CN16_ENABLE | CN4_ENABLE, CN16_PULLUP_ENABLE | CN4_PULLUP_ENABLE);
    }
    mCNIntEnable(1);
}
コード例 #4
0
ファイル: Keyboard.c プロジェクト: OLIMEX/DuinoMite
/***************************************************************************************************
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
}