Ejemplo n.º 1
0
void _delay_us(uint32_t us) {
	systick_start();
	while (us != 0) {
		while ((SysTick->CTRL & SysTick_CTRL_COUNTFLAG_Msk) == 0) {}
		--us;
	}
	systick_stop();
}
Ejemplo n.º 2
0
void system_init()
{
	/* Stop the watchdog */
	startup_watchdog_disable(); /* Do it right now, before it gets a chance to break in */

	/* Note: Brown-Out detection must be powered to operate the ADC. adc_on() will power
	 *  it back on if called after system_init() */
	system_brown_out_detection_config(0);
	system_set_default_power_state();
	clock_config(SELECTED_FREQ);
	set_pins(common_pins);
	gpio_on();
	/* System tick timer MUST be configured and running in order to use the sleeping
	 * functions */
	systick_timer_on(1); /* 1ms */
	systick_start();
}
Ejemplo n.º 3
0
int main(int argc, char* argv[]) {
	const char* title = "\nam18x library for rtc!\n";

	arm_intr_enable();
	systick_start();

	printk(title);
	printk("tary, compiled date : %s %s\n", __DATE__, __TIME__);

	rtc_operation();

	printk("\n");

	arm_intr_disable();

	return 0;
}
Ejemplo n.º 4
0
int main(int argc, char* argv[]) {
	const char* title = "\nam18x library for ecap!\n";
	int i;

	arm_intr_enable();
	systick_start();

	printk(title);
	printk("tary, compiled date : %s %s\n", __DATE__, __TIME__);

	psc_state_transition(PSC_GPIO, PSC_STATE_ENABLE);
	psc_state_transition(PSC_ECAP, PSC_STATE_ENABLE);

	gpio_set_mux(LCDC_BL_PWR, GPIO_DIR_OUTPUT);
	gpio_set_output1(LCDC_BL_PWR, GPIO_HIGH);

	#if 0
	gpio_set_mux(LCDC_BL_PWM, GPIO_DIR_OUTPUT);
	gpio_set_output1(LCDC_BL_PWM, GPIO_HIGH);
	#else
	syscfg_pinmux(LCDC_BL_PWM_PINMUX);
	#endif

	ecap_init(ECAP_HW);

	for (i = 0;; i += 5) {
		if (i > 100) {
			i = 0;
		}
		ecap_conf->duty = i;
		ecap_set_conf(ECAP_HW, ecap_conf);

		systick_sleep(1000);
	}

	return 0;
}
Ejemplo n.º 5
0
void main(void) {
	sparrow_init();
	systick_start(SYSTICK_10MS);
}