Exemplo n.º 1
0
int main()
{
	uint8_t ret;

	init_stdout();

#ifdef VERBOSE    
	print ("\r\nSREC Bootloader\r\n");
	print ("Loading SREC image from flash @ address: ");
	putnum (FLASH_IMAGE_BASEADDR);
	print ("\r\n");
#endif

	flbuf = (uint8_t*)FLASH_IMAGE_BASEADDR;
	ret = load_exec ();

	/* If we reach here, we are in error */

#ifdef VERBOSE
	if (ret > LD_SREC_LINE_ERROR) {
		print ("ERROR in SREC line: ");
		putnum (srec_line);
		print (errors[ret]);
	} else {
		print ("ERROR: ");
		print (errors[ret]);
	}
#endif

	return ret;
}
Exemplo n.º 2
0
void setup()
{
    /* Start serial communication for some feedback about the progress and redirect stdout
       into Serial.
         The baud rate is chosen high, because in this test environment the DCF task may
       easily be operated with some printf based status output. This (slow) output
       endangers the accuracy of the task timing and makes the measured and reported timing
       values less meaningful. */
    Serial.begin(115200);
    init_stdout();

    /* Write greeting to the console. */
    puts_progmem(rtos_rtuinosStartupMsg);

    /* Initialize the RTuinOS task for DCF decoding. */
    dcf_initializeTask(/* idxTask */ 0, /* prioClass */ 0);
    
} /* End of setup */
Exemplo n.º 3
0
void setup()
{
#ifdef DEBUG
    /* Start serial port at 9600 bps. */
    Serial.begin(9600);

    /* Redirect stdout into Serial. */
    init_stdout();

    /* Print greeting to the console window. */
    puts_progmem(rtos_rtuinosStartupMsg);
#endif

    /* Print greeting on the LCD. */
    dpy_display.printGreeting();

    /* Initialize the digital pin as an output. The LED is used for most basic feedback about
       operability of code. */
    pinMode(LED, OUTPUT);

#ifdef DEBUG
//    printf( "ADC configuration at startup:\n"
//            "  ADMUX  = 0x%02x\n"
//            "  ADCSRB = 0x%02x\n"
//          , ADMUX
//          , ADCSRB
//          );
#endif

    /* Write the invariant parts of the display once. This needs to be done here, before
       multitasking begins. */
    dpy_display.printBackground();

    /* Configure the interrupt task of highest priority class. */
    ASSERT(noTasks == RTOS_NO_TASKS);
    rtos_initializeTask( /* idxTask */          idxTaskOnADCComplete
                       , /* taskFunction */     taskOnADCComplete
                       , /* prioClass */        RTOS_NO_PRIO_CLASSES-1
                       , /* pStackArea */       &_stackTaskOnADCComplete[0]
                       , /* stackSize */        sizeof(_stackTaskOnADCComplete)
                       , /* startEventMask */   EVT_ADC_CONVERSION_COMPLETE
                       , /* startByAllEvents */ false
                       , /* startTimeout */     0
                       );

    /* Configure the real time clock task of lowest priority class. */
    rtos_initializeTask( /* idxTask */          idxTaskRTC
                       , /* taskFunction */     taskRTC
                       , /* prioClass */        0
                       , /* pStackArea */       &_stackTaskRTC[0]
                       , /* stackSize */        sizeof(_stackTaskRTC)
                       , /* startEventMask */   RTOS_EVT_ABSOLUTE_TIMER
                       , /* startByAllEvents */ false
                       , /* startTimeout */     CLK_TASK_TIME_RTUINOS_STANDARD_TICS
                       );

    /* Configure the idle follower task of lowest priority class. */
    rtos_initializeTask( /* idxTask */          idxTaskIdleFollower
                       , /* taskFunction */     taskIdleFollower
                       , /* prioClass */        0
                       , /* pStackArea */       &_stackTaskIdleFollower[0]
                       , /* stackSize */        sizeof(_stackTaskIdleFollower)
                       , /* startEventMask */   EVT_TRIGGER_IDLE_FOLLOWER_TASK
                       , /* startByAllEvents */ false
                       , /* startTimeout */     0
                       );

    /* Configure the button evaluation task. Its priority is below the interrupt but - as
       it implements user interaction - above the priority of the display tasks. */
    rtos_initializeTask( /* idxTask */          idxTaskButton
                       , /* taskFunction */     taskButton
                       , /* prioClass */        1
                       , /* pStackArea */       &_stackTaskButton[0]
                       , /* stackSize */        sizeof(_stackTaskButton)
                       , /* startEventMask */   EVT_TRIGGER_TASK_BUTTON
                       , /* startByAllEvents */ false
                       , /* startTimeout */     0
                       );

    /* Configure the result display task. */
    rtos_initializeTask( /* idxTask */          idxTaskDisplayVoltage
                       , /* taskFunction */     taskDisplayVoltage
                       , /* prioClass */        0
                       , /* pStackArea */       &_stackTaskDisplayVoltage[0]
                       , /* stackSize */        sizeof(_stackTaskDisplayVoltage)
                       , /* startEventMask */   EVT_TRIGGER_TASK_DISPLAY_VOLTAGE
                       , /* startByAllEvents */ false
                       , /* startTimeout */     0
                       );
    
    /* Configure the DCF task. Its priority is higher than that of the real time clock and
       the display tasks. DCF reception benefits from task time accuracy. If the priority
       is high enough for proper timing then the task cycle time (which is the DCF signal
       sample time at the same time) can be chosen relatively low and this saves CPU
       consumption. */
    dcf_initializeTask( /* idxTask */ idxTaskDcf
                      , /* prioClass */ 1
                      );
    
    /* Initialize other modules. */
    adc_initAfterPowerUp();
    
} /* End of setup */