Example #1
0
void c42364a_clear_all(void)
{
	lcdca_blink_disable();
	lcdca_circular_shift_disable();
	lcdca_automated_char_stop();
	lcdca_clear_display_memory();
}
Example #2
0
/**
 * \brief Test LCDCA automated scrolling feature.
 *
 * \param test Current test case.
 */
static void run_lcdca_automated_scrolling_test(const struct test_case *test)
{
    uint32_t status;
    /* Automated display configuration */
    struct lcdca_automated_char_config automated_char_cfg;
    /* String for scrolling display */
    uint8_t const scrolling_str[] = "Scrolling  ";

    /* Automated scrolling of character string display */
    automated_char_cfg.automated_mode = LCDCA_AUTOMATED_MODE_SCROLLING;
    automated_char_cfg.automated_timer = LCDCA_TIMER_FC1;
    automated_char_cfg.lcd_tdg = LCDCA_TDG_14SEG4COM;
    automated_char_cfg.stseg = FIRST_14SEG_4C;
    automated_char_cfg.dign = WIDTH_14SEG_4C;
    /* STEPS = string length - DIGN + 1 */
    automated_char_cfg.steps = sizeof(scrolling_str) - WIDTH_14SEG_4C + 1;
    automated_char_cfg.dir_reverse = LCDCA_AUTOMATED_DIR_REVERSE;
    lcdca_automated_char_set_config(&automated_char_cfg);
    lcdca_automated_char_start(scrolling_str, strlen((char const *)scrolling_str));
    delay_ms(1000);

    /* Check status */
    status = LCDCA->LCDCA_ACMCFG & LCDCA_ACMCFG_EN;
    test_assert_true(test,
                     status,
                     "LCDCA automated scrolling test failed.");

    lcdca_automated_char_stop();
}
Example #3
0
/**
 * \brief Test LCDCA automated sequential feature.
 *
 * \param test Current test case.
 */
static void run_lcdca_automated_sequential_test(const struct test_case *test)
{
    uint32_t status;
    /* Automated display configuration */
    struct lcdca_automated_char_config automated_char_cfg;
    /* String for sequential display */
    uint8_t const sequential_str[] = "Sequen tial   ";

    /* Automated sequential character string display */
    automated_char_cfg.automated_mode = LCDCA_AUTOMATED_MODE_SEQUENTIAL;
    automated_char_cfg.automated_timer = LCDCA_TIMER_FC1;
    automated_char_cfg.lcd_tdg = LCDCA_TDG_14SEG4COM;
    automated_char_cfg.stseg = FIRST_14SEG_4C;
    automated_char_cfg.dign = WIDTH_14SEG_4C;
    automated_char_cfg.steps = 0;
    automated_char_cfg.dir_reverse = LCDCA_AUTOMATED_DIR_REVERSE;
    lcdca_automated_char_set_config(&automated_char_cfg);
    lcdca_automated_char_start(sequential_str, strlen((char const *)sequential_str));
    delay_ms(1000);

    /* Check status */
    status = LCDCA->LCDCA_ACMCFG & LCDCA_ACMCFG_EN;
    test_assert_true(test,
                     status,
                     "LCDCA automated sequential test failed.");

    lcdca_automated_char_stop();
}
Example #4
0
void c42412a_show_all(void)
{
	lcdca_blink_disable();
	lcdca_circular_shift_disable();
	lcdca_automated_char_stop();
	lcdca_set_display_memory();
}
Example #5
0
/**
 * \brief Application entry point for LCDCA example.
 *
 * \return Unused (ANSI-C compatibility).
 */
int main(void)
{
	/* LCDCA configuration */
	struct lcdca_config lcdca_cfg;
	/* Automated display configuration */
	struct lcdca_automated_char_config automated_char_cfg;
	/* String for sequential display */
	uint8_t const sequential_str[] = \
		"Sequen tial   string display,Press PB0 to Cont.  ";
	/* String for scrolling display */
	uint8_t const scrolling_str[] = \
		"Scrolling string display, Press PB0 to cont.  ";

	/* String for lowpower display */
#define MAX_NUM_LOWPOWER_STR    4
	uint8_t const lowpower_str[MAX_NUM_LOWPOWER_STR][7] = {
		"In     ",
		"Power  ",
		"Save   ",
		"Mode   ",
	};
	uint32_t str_id = 0;

	struct lcdca_blink_config blink_cfg;
	struct lcdca_circular_shift_config cs_cfg;

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

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

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

	/*
	 * LCDCA Controller initialization
	 * - Clock,
	 * - Connect to C42364A glass LCD component,
	 * - Timing:  64 Hz frame rate & low power waveform, FC0, FC1, FC2
	 * - Interrupt: off
	 */
	lcdca_clk_init();
	lcdca_cfg.port_mask = PORT_MASK;
	lcdca_cfg.x_bias = false;
	lcdca_cfg.lp_wave = true;
	lcdca_cfg.duty_type = LCD_DUTY;
	lcdca_cfg.lcd_pres = false;
	lcdca_cfg.lcd_clkdiv = 3;
	lcdca_cfg.fc0 = 16;
	lcdca_cfg.fc1 = 2;
	lcdca_cfg.fc2 = 6;
	lcdca_cfg.contrast = LCD_CONTRAST_LEVEL;
	lcdca_set_config(&lcdca_cfg);
	lcdca_enable();
	lcdca_enable_timer(LCDCA_TIMER_FC0);
	lcdca_enable_timer(LCDCA_TIMER_FC1);
	lcdca_enable_timer(LCDCA_TIMER_FC2);

	/* Turn on LCD back light */
	ioport_set_pin_level(LCD_BL_GPIO, IOPORT_PIN_LEVEL_HIGH);

	/* Display some texts and icon on segment LCD */
	lcdca_set_pixel(ICON_ARM);
	c42364a_write_num_packet((const uint8_t *)"0123");
	c42364a_write_alpha_packet((const uint8_t *)"Welcome");

	/* Blink "error" icon */
	blink_cfg.lcd_blink_timer = LCDCA_TIMER_FC1;
	blink_cfg.lcd_blink_mode = LCDCA_BLINK_SELECTED;
	lcdca_blink_set_config(&blink_cfg);
	lcdca_set_pixel(ICON_ERROR);
	lcdca_set_blink_pixel(ICON_ERROR);
	lcdca_blink_enable();

	/* Autonomous segment animation of 7-pixels area of the LCD */
	cs_cfg.lcd_csr_timer = LCDCA_TIMER_FC1;
	cs_cfg.lcd_csr_dir = LCDCA_CSR_RIGHT;
	cs_cfg.size = 7;    /* Total 7-pixels */
	cs_cfg.data = 0x03; /* Display 2 pixel at one time */
	lcdca_circular_shift_set_config(&cs_cfg);
	lcdca_circular_shift_enable();

	/* Automated sequential character string display */
	automated_char_cfg.automated_mode = LCDCA_AUTOMATED_MODE_SEQUENTIAL;
	automated_char_cfg.automated_timer = LCDCA_TIMER_FC2;
	automated_char_cfg.lcd_tdg = LCDCA_TDG_14SEG4COM;
	automated_char_cfg.stseg = FIRST_14SEG_4C;
	automated_char_cfg.dign = WIDTH_14SEG_4C;
	automated_char_cfg.steps = 0;
	automated_char_cfg.dir_reverse = LCDCA_AUTOMATED_DIR_REVERSE;
	lcdca_automated_char_set_config(&automated_char_cfg);
	lcdca_automated_char_start(sequential_str, strlen((char const *)sequential_str));
	printf("Press PB0 to stop automated sequential mode and continue.\n\r");
	wait_for_switches();
	lcdca_automated_char_stop();

	/* Automated scrolling of character string display */
	automated_char_cfg.automated_mode = LCDCA_AUTOMATED_MODE_SCROLLING;
	automated_char_cfg.automated_timer = LCDCA_TIMER_FC2;
	automated_char_cfg.lcd_tdg = LCDCA_TDG_14SEG4COM;
	automated_char_cfg.stseg = FIRST_14SEG_4C;
	automated_char_cfg.dign = WIDTH_14SEG_4C;
	/* STEPS = string length - DIGN + 1 */
	automated_char_cfg.steps = sizeof(scrolling_str) - WIDTH_14SEG_4C + 1;
	automated_char_cfg.dir_reverse = LCDCA_AUTOMATED_DIR_REVERSE;
	lcdca_automated_char_set_config(&automated_char_cfg);
	lcdca_automated_char_start(scrolling_str, strlen((char const *)scrolling_str));
	printf("Press PB0 to stop automated scrolling mode and continue.\n\r");
	wait_for_switches();
	lcdca_automated_char_stop();

	/* Set callback for LCDCA interrupt */
	lcdca_set_callback(lcdca_callback, LCDCA_IRQn, 1);

	/* Enable LCDCA wakeup */
	lcdca_enable_wakeup();

	printf("Enter power save mode.\n\r");
	printf("It'll display power save string sequence and"
			"blink wireless icon when every wake up.\n\r");
	while (1) {
		/* Display lowpower string repeatly */
		c42364a_write_alpha_packet(lowpower_str[str_id]);
		str_id = (str_id + 1) % MAX_NUM_LOWPOWER_STR;

		/* Toggle wireless icon */
		lcdca_toggle_pixel(ICON_WLESS);

		/* Enter in sleep mode */
		sleepmgr_enter_sleep();
	}
}
Example #6
0
void c42364a_text_scrolling_stop(void)
{
	lcdca_automated_char_stop();
}