BOOL Display::run() { LOG_ENTERFN(); m_lastRunTime = getMilliSeconds(); disp(); pauseTask(); LOG_EXITFN(TRUE); }
void rememberCallback(unsigned char tid, void* msg) { unsigned char TempVar; if (PIR1bits.SSPIF == 1) { rememberPath[rememberIndex++] = SSPBUF; if (rememberLength == rememberIndex) { //stop timer //execute callback rememberFunc((Byte*) rememberPath, (Byte) rememberLength); rememberLength = 0; pauseTask(rememberHandle); } else { TempVar = SSPBUF; PIR1bits.SSPIF = 0; //Clear interrupt flag resumeTask(rememberHandle); SSPBUF = 0; } } }
void QfSpi_Init(void) { /* // Sanity check SPI0 state. Assert( Spi0State == Uninitialized ); SetBit( UCTL0, SWRST ); // Hold the USART in Reset while configuring ClearBit( IE1, URXIE0 ); // Disable SPI0 Receive Interrupts U0ME |= UTXE0 + URXE0; // Enable USART0 transmit and receive modules P3SEL |= 0x0E; // Select the SPI option for USART0 pins (P3.1-3) UCTL0 |= CHAR + // Character length is 8 bits SYNC + // Synchronous Mode (as opposed to UART) MM; // 8-bit SPI Master **SWRST** UTCTL0 |= CKPH + // UCLK delayed by 1/2 cycle SSEL1 + SSEL0 + // Clock source is SMCLK (implies Master mode) // 00 UCLKI 10 SMCLK // 01 ACLK (fastest) 11 SMCLK STC; // 3-pin SPI mode (STE disabled) URCTL0 = 0; // Receive control register UMCTL0 = SPI0_MODULATION_CONTROL; // No modulation UBR10 = GetHiByte( SPI0_BAUD_DIVISOR ); // Set baud rate UBR00 = GetLoByte( SPI0_BAUD_DIVISOR ); URCTL0 = 0; // Init receiver contol register ME1 |= UTXE0 + URXE0; // Enable USART0 SPI transmit and receive. (note that // URXE0 and USPIE0 are one in the same on the '449) ClearBit( UCTL0, SWRST ); // Release USART state machine (begin operation). // Doesn't do anything in SPI mode until a write // to TXBUF0 occurs. */ PIE1bits.SSPIE = 0; IPR1bits.SSPIP = 0; //spi interrupt low priority set_LIV_function(&Spi0ReadIsr); TRISCbits.TRISC3 = 0; //sck output TRISCbits.TRISC5 = 0; //sdo output //TRISAbits.TRISA5 = 1; //ss input QfPlat_DeactivateQF4A512ChipSelect(); OpenSPI(SPI_FOSC_16, MODE_00, SMPEND); Spi0State = Idle; //YEB #ifndef __YEB_INTERRUPT__ #ifndef __YEB_IMMEDIATE__ rememberHandle = registerTask(&rememberCallback, 0, (unsigned short) 0, -1); pauseTask(rememberHandle); #endif #endif }