int board_init(void)
{
	/* Address of boot parameters */
	gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;

	imx_iomux_v3_setup_multiple_pads(iox_pads, ARRAY_SIZE(iox_pads));

	iox74lv_init();

#ifdef CONFIG_SYS_I2C_MXC
	setup_i2c(0, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info1);
#endif

#ifdef	CONFIG_FEC_MXC
	setup_fec(CONFIG_FEC_ENET_DEV);
#endif

#ifdef CONFIG_USB_EHCI_MX6
	setup_usb();
#endif

#ifdef CONFIG_FSL_QSPI
	board_qspi_init();
#endif

#ifdef CONFIG_VIDEO_MXS
	setup_lcd();
#endif

	return 0;
}
int board_init(void)
{
	/* address of boot parameters */
	gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;

	imx_iomux_v3_setup_multiple_pads(iox_pads, ARRAY_SIZE(iox_pads));

	iox74lv_init();

#ifdef CONFIG_FEC_MXC
	setup_fec();
#endif

#ifdef CONFIG_NAND_MXS
	setup_gpmi_nand();
#endif

#ifdef CONFIG_VIDEO_MXS
	setup_lcd();
#endif

#ifdef CONFIG_FSL_QSPI
	board_qspi_init();
#endif

	return 0;
}
Beispiel #3
0
int board_init(void)
{
	/* address of boot parameters */
	gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;

#ifdef CONFIG_FEC_MXC
	setup_fec();
#endif

#ifdef CONFIG_NAND_MXS
	setup_gpmi_nand();
#endif

#ifdef CONFIG_VIDEO_MXS
	setup_lcd();
#endif

	return 0;
}
Beispiel #4
0
int board_init(void)
{
	/* address of boot parameters */
	gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;

#ifdef CONFIG_FEC_MXC
	setup_fec();
#endif

#ifdef CONFIG_NAND_MXS
	setup_gpmi_nand();
#endif

#ifdef CONFIG_VIDEO_MXS
	setup_lcd();
#endif

#ifdef CONFIG_USB_EHCI_MX6
	imx_iomux_v3_setup_multiple_pads(usb_cdet_pads, ARRAY_SIZE(usb_cdet_pads));
	gpio_request(USB_CDET_GPIO, "usb-cdet-gpio");
#endif

	return 0;
}
/**************************************************************************//**
 * @brief  Main function
 *****************************************************************************/
int main(void)
{
	// Chip errata
	CHIP_Init();

	setup_rtc();

	setup_gpio_and_buttons();

	setup_lcd();

	// Set 1ms SysTick
	if (SysTick_Config(CMU_ClockFreqGet(cmuClock_CORE) / 1000))
	{
		DEBUG_BREAK;
	}

	typedef enum { INIT, PROGRAM, ON, OFF } program_modes;

	program_modes mode = INIT;
	program_modes last_mode = INIT;

	while (1)
	{
		if (!set_button.short_press)
		{
			EMU_EnterEM2(false);
		}

		switch (mode)
		{
		case INIT:
			if (set_button.short_press || program_button.long_press)
			{
				mode = PROGRAM;
			}
			break;
		case PROGRAM:
			program_timer();
			last_mode = PROGRAM;
			mode = ON;
			break;
		case ON:
			if (mode != last_mode)
			{
				SegmentLCD_Write("ON");
				timer_on = true;
				last_mode = ON;
				RTC_CompareSet(0, time_keeper.timer_start_seconds);
				//SysTick->CTRL = 0;
			}
			if (program_button.long_press)
			{
				mode = PROGRAM;
			}
			else if (set_button.short_press)
			{
				mode = OFF;
				// Delay so that we don't get double presses
				delay(BUTTON_DELAY);
			}
			break;
		case OFF:
			if (mode != last_mode)
			{
				SegmentLCD_Write("OFF");
				timer_on = false;
				last_mode = OFF;
				//SysTick->CTRL = 0;
			}
			if (program_button.long_press)
			{
				mode = PROGRAM;
			}
			else if (set_button.short_press)
			{
				mode = ON;
				// Delay so that we don't get double presses
				delay(BUTTON_DELAY);
			}
			break;
		}
	}
}