Esempio n. 1
0
/**
 * setup
 * Initialises all appropriate global-level variables and sets up all modules
 * appropriately. Also retrieves previous state from EEPROM.
 */
void setup()
{
    char welcomeStr1[] = "Welcome to ";
    char welcomeStr2[] = "   FennecScales!";

    int timer = 0;
    setupPower();

    retrieveState();
    initialiseRS232();
    initialiseADC();
    setupTMR1();
    setupSPI();
    //initialiseEEPROM();
    //initiateTTS();
    initLCD();
    initialiseNumPad();
    //initialisePushBtn();

    clearLCD();
    stringToLCD(welcomeStr1, LCD_LINE_1);
    stringToLCD(welcomeStr2, LCD_LINE_2);

                /* Configure interrupts */
    INTCONbits.GIE = 1; // Enable global interrupts and priority
    INTCONbits.PEIE = 1;
    RCONbits.IPEN = 1;

    for (timer = 0; timer <= 0x3FF; ++timer)
    {
        writeLEDbar(timer, 0x3FF);
        
    }

}
Esempio n. 2
0
int main(void)
{
    // If running on Rev A2 silicon, turn the LDO voltage up to 2.75V.  This is
    // a workaround to allow the PLL to operate reliably.
    if (REVISION_IS_A2)
    {
        SysCtlLDOSet(SYSCTL_LDO_2_75V);
    }

    // Set the clocking to run at 50MHz from the PLL.
    SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN |
                   SYSCTL_XTAL_8MHZ);

    SysCtlPWMClockSet(SYSCTL_PWMDIV_1);

    // Initialise the OLED display.
    RIT128x96x4Init(1000000);

    // Initialise the required peripherals.
    initStatusLight();
    initialisePortB();
    initialiseButtons();
    initialisePWM();
    initialiseADC();
    initialiseUART();

	/* Create the queue used by the OLED task.  Messages for display on the OLED
	are received via this queue. */
	xSendQueue = xQueueCreate( mainSEND_QUEUE_SIZE, sizeof( xQueueMessage ) );
	vCreateQueuesAndSemaphore();

    /*-------------------------------------------
         Create tasks and start scheduler
    -------------------------------------------*/

    /* Create the required tasks */
    xTaskCreate( vSendTask, "Send Task", 240, NULL, 1, NULL);
    xTaskCreate( vLedBlink, "LED Blink", configMINIMAL_STACK_SIZE, NULL, 4, NULL );
    vStartControlTasks( xSendQueue );

	// Enable interrupts to the processor.
	IntMasterEnable();

    /* Start the scheduler so our tasks start executing. */
    vTaskStartScheduler();

    /* If all is well we will never reach here as the scheduler will now be
    running.  If we do reach here then it is likely that there was insufficient
    heap available for the idle task to be created. */
    while (1)
    {
    }
}