Exemple #1
0
/************************ menu callbacks **********************************/
static void clock_activated()
{
	sys_messagebus_register(&clock_event, SYS_MSG_RTC_MINUTE
						| SYS_MSG_RTC_HOUR
						| SYS_MSG_RTC_DAY
						| SYS_MSG_RTC_MONTH
#ifdef CONFIG_MOD_CLOCK_BLINKCOL
						| SYS_MSG_RTC_SECOND
#endif
	);

	/* create two screens, the first is always the active one */
	lcd_screens_create(2);

	/* display stuff that won't change with time */
	display_symbol(0, LCD_SEG_L1_COL, SEG_ON);
	display_char(0, LCD_SEG_L2_2, '-', SEG_SET);

	/* update screens with fake event */
	clock_event(SYS_MSG_RTC_YEAR
					| SYS_MSG_RTC_MONTH
					| SYS_MSG_RTC_DAY
					| SYS_MSG_RTC_HOUR
					| SYS_MSG_RTC_MINUTE);
}
Exemple #2
0
static void altitude_activate(void)
{

	/* display -- symbol while a measure is not performed */
	display_chars(0, LCD_SEG_L1_3_0, "----", SEG_SET);
    update(SYS_MSG_FAKE);

	sys_messagebus_register(&update, consumption_array[consumption-1]);
    
    sys_messagebus_register(&time_callback, SYS_MSG_RTC_MINUTE
                        | SYS_MSG_RTC_HOUR
#ifdef CONFIG_MOD_CLOCK_BLINKCOL
                        | SYS_MSG_RTC_SECOND
#endif
    );
    
    lcd_screens_create(6);
    display_chars(ALT_SCREEN_CLIMB, LCD_SEG_L2_5_0, " CLIMB", SEG_SET);
    display_symbol(ALT_SCREEN_CLIMB, LCD_SEG_L1_DP0, SEG_ON);
    display_symbol(ALT_SCREEN_CLIMB, LCD_UNIT_L1_PER_S, SEG_ON);
    display_chars(ALT_SCREEN_MIN,   LCD_SEG_L2_5_0, " MIN  ", SEG_SET);
    display_chars(ALT_SCREEN_MAX,   LCD_SEG_L2_5_0, " MAX  ", SEG_SET);
    display_chars(ALT_SCREEN_ACC_N, LCD_SEG_L2_5_0, " ACC N", SEG_SET);
    display_chars(ALT_SCREEN_ACC_P, LCD_SEG_L2_5_0, " ACC P", SEG_SET);
}
/* MARK: - Activate and Deactivate */
void activate(void)
{
	moduleActivated = 1;
	/* create three empty screens */
	lcd_screens_create(3);

	activeDisplay = TIDE_DISPLAY_STATE_GRAPH;
	lcd_screen_activate(activeDisplay);
	drawScreen();
}
//* ************************************************************************************************
/// @fn			temperature_activate(void)
/// @brief		Temperature screen activation. Display defaul stuff, register the mesuring loop.
/// @return		none
//* ************************************************************************************************
static void temperature_activate(void)
{
    // Create two screens, the first is always the active one
    lcd_screens_create(2);

    // Display the title of this module at the bottom
    display_chars(0, LCD_SEG_L2_3_0, "TEMP", SEG_SET);

    // Display something while a measure is not performed
    display_chars(0, LCD_SEG_L1_2_0, " - ", SEG_ON);

    // Register an event
    sys_messagebus_register(&measure_temp, SYS_MSG_TIMER_4S);
}
/* Enter the accelerometer menu */
static void acc_activated()
{


	//register to the system bus for vti events as well as the RTC minute events
	sys_messagebus_register(&as_event, SYS_MSG_AS_INT | SYS_MSG_RTC_MINUTE | SYS_MSG_RTC_SECOND);


	/* create two screens, the first is always the active one */
	lcd_screens_create(2);

	/* screen 0 will contain the menu structure and screen 1 the raw accelerometer data */
	
	// Show warning if acceleration sensor was not initialised properly
	if (!as_ok)
	{
		display_chars(0, LCD_SEG_L1_3_0, "ERR", SEG_SET);
	}
	else
	{

		/* Initialization is required only if not in background mode! */
		if (sAccel.mode != ACCEL_MODE_BACKGROUND)
		{
			// Clear previous acceleration value
			sAccel.data = 0;
			// 2 g range
			as_config.range=2;
			// 100 Hz sampling rate
			as_config.sampling=SAMPLING_10_HZ;
			// keep mode
			as_config.mode=ACTIVITY_MODE;
			//time window is 10 msec for free fall and 100 msec for activity
			//2g multiple 71 mg: 0F=4 * 71 mg= 1.065 g
			as_config.MDTHR=2;
			as_config.MDFFTMR=1;

			// Set timeout counter
			sAccel.timeout = ACCEL_MEASUREMENT_TIMEOUT;

			// Set mode for screen 
			sAccel.mode = ACCEL_MODE_ON;

			// Start with mode selection
			submenu_state=VIEW_SET_MODE;

			// Select Axis X
			sAccel.view_style=DISPLAY_ACCEL_Z;

			// Start sensor in motion detection mode
			as_start(ACTIVITY_MODE);
			// After this call interrupts will be generated
		}

		if (!as_ok)
		{
			display_chars(0, LCD_SEG_L1_3_0, "FAIL", SEG_SET);
		}
		display_chars(0, LCD_SEG_L1_3_0 , "ACTI", SEG_SET);
		display_chars(0, LCD_SEG_L2_4_0 , "MODE", SEG_SET);


	}
	/* return to main screen */
	lcd_screen_activate(0);
}