示例#1
0
static void c42412a_icon_test(void)
{
	c42412a_show_icon(C42412A_ICON_COLON);
	delay_s(1);
	c42412a_show_battery(C42412A_BATTERY_THREE);
	delay_s(1);
	c42412a_show_battery(C42412A_BATTERY_ONE);
	delay_s(1);
	c42412a_show_wireless(C42412A_WIRELESS_THREE);
	delay_s(1);
	c42412a_show_wireless(C42412A_WIRELESS_TWO);
	delay_s(1);
	c42412a_show_icon(C42412A_ICON_AUDIO_PLAY);
	delay_s(1);
	c42412a_clear_icon(C42412A_ICON_COLON);
}
示例#2
0
/**
 * \brief main function : do init and loop
 */
int main(void)
{
	uint8_t key;
	uint8_t const scrolling_str[] = "C42412A Example  ";
	int32_t value = -123456;
	bool is_scrolling = false;
	bool is_blinking = false;

	status_code_t status;

	/* Initialize the SAM system */
	sysclk_init();
	board_init();

	/* Initialize the console uart */
	configure_console();

	/* Output example information */
	printf("-- C42412A Example --\r\n");
	printf("-- %s\n\r", BOARD_NAME);
	printf("-- Compiled: %s %s --\n\r", __DATE__, __TIME__);

	/* Turn on the backlight. */
	ioport_set_pin_level(LCD_BL_GPIO, LCD_BL_ACTIVE_LEVEL);

	/* Initialize the C42412A LCD glass component. */
	status = c42412a_init();
	if (status != STATUS_OK) {
		printf("-- LCD Initialization fails! --\r\n");
		while (1) {
		}
	}

	printf("Show all the components on the glass.\r\n");
	c42412a_show_all();

	printf("Press any key to continue.\r\n");
	scanf("%c", (char *)&key);

	c42412a_clear_all();

	/* Display menu */
	display_menu();

	while (1) {
		scanf("%c", (char *)&key);

		if(is_scrolling) {
			c42412a_text_scrolling_stop();
			is_scrolling = false;
		}
		if(is_blinking) {
			c42412a_blink_icon_stop(C42412A_ICON_COLON);
			c42412a_clear_icon(C42412A_ICON_COLON);
			is_blinking = false;
		}

		switch (key) {
		case 'h':
			display_menu();
			break;

		case 'c':
			printf("Clear all the screen.\r\n");

			c42412a_clear_all();
			break;

		case '1':
			printf("Show icons, number and string.\r\n");
			c42412a_clear_numeric_dec();
			c42412a_show_icon(C42412A_ICON_ATMEL);
			c42412a_show_numeric_dec(value);
			c42412a_show_battery(C42412A_BATTERY_TWO);
			c42412a_show_wireless(C42412A_WIRELESS_TWO);
			break;

		case '2':
			printf("Blink colon icon, show a time.\r\n");
			c42412a_clear_text();
			c42412a_clear_icon(C42412A_ICON_MINUS);
			c42412a_clear_icon(C42412A_ICON_MINUS_SEG1);
			c42412a_clear_icon(C42412A_ICON_MINUS_SEG2);
			c42412a_show_text((const uint8_t *)"1023");
			c42412a_show_icon(C42412A_ICON_AM);
			c42412a_blink_icon_start(C42412A_ICON_COLON);
			is_blinking = true;
			break;
		case '3':
			printf("Text scrolling.\r\n");
			c42412a_clear_text();
			c42412a_text_scrolling_start(scrolling_str, strlen((char const *)scrolling_str));
			is_scrolling = true;
			break;
		default:
			break;
		}
	}
}