int main(void) { watchdog_off(); clock_init_1MHz(); /* set all pins to output high */ port1_direction = 0xFF; port1_output = 0xFF; /* initialize serial clock, tx and rx parts */ serial_init_clock(); serial_init_tx(); serial_init_rx(); /* enable interrupts */ __eint(); pin_low(LED1); pin_high(LED2); while (1) { unsigned char c; pin_toggle(LED1); pin_toggle(LED2); c = serial_getchar(); serial_putchar(c); if (c == '\r') serial_putchar('\n'); } }
void boot_successful(void) { #if CONFIG_FRAMEBUFFER_SET_VESA_MODE && !CONFIG_FRAMEBUFFER_KEEP_VESA_MODE void vbe_textmode_console(void); vbe_textmode_console(); #endif /* Remember this was a successful boot */ set_boot_successful(); /* turn off the boot watchdog */ watchdog_off(); }
void boot_successful(void) { #if CONFIG_BOOTSPLASH && !CONFIG_COREBOOT_KEEP_FRAMEBUFFER void vbe_textmode_console(void); vbe_textmode_console(); #endif /* Remember this was a successful boot */ set_boot_successful(); /* turn off the boot watchdog */ watchdog_off(); }
int main(void) { watchdog_off(); clock_init_1MHz(); /* set all pins to output high */ port1_direction = 0xFF; port1_output = 0xFF; pin_low(LED1); pin_function_primary(LED2); /* set capture/compare module 1 in reset/set output mode, * that is: * pin 1.6 is set high when timera_count == timera_cc0 * pin 1.6 is set low when timera_count == timera_cc1 */ timera_cc1_config(TIMERA_CC_OUTPUT_RESETSET); /* use the system clock as timer source, * count from 0 up to timera_cc0 before resetting the counter, * and reset the counter now */ timera_config(TIMERA_CLOCK_SMCLK | TIMERA_MODE_UP | TIMERA_CLEAR); /* count from 0 to 1024, that is a frequency of * 1 MHz / 1024 = just under 1kHz. */ timera_cc0 = 1024; while (1) { /* sweep timer_cc1 up */ for (timera_cc1 = 1; timera_cc1 < 1024; timera_cc1 <<= 1) delay_cycles(50000); /* ..and down in exponential steps */ do { timera_cc1 >>= 1; timera_clear(); delay_cycles(50000); } while (timera_cc1 > 0); delay_cycles(50000); } }
int main(void) { watchdog_off(); clock_init_1MHz(); port1_direction = 0xFC; // 1111 1011 --> p1.2 is Rx port2_direction = 0xFF; // 1111 1111 port1_output &= 0x00; // turn off motors or it'll heat up! port2_output &= 0x00; // turn off motors or it'll heat up! delay(0xffff); // wait for initialization or something /* initialize serial clock, tx and rx parts */ serial_init_clock(); serial_init_tx(); serial_init_rx(); /* enable interrupts */ __eint(); while (1) { unsigned int i; unsigned char c; c = serial_getchar(); //debug_char(c); if (c == 'o') { // open flash(); for (i=0; i<ROTATE_AMOUNT; i++) { port1_output = 0x20; // 0010 0000 port2_output = 0x05; // 0000 0101 delay(DELAY); port1_output = 0x28; // 0010 1000 port2_output = 0x04; // 0000 0100 delay(DELAY); port1_output = 0x20; // 0010 0000 port2_output = 0x06; // 0000 0110 delay(DELAY); port1_output = 0x30; // 0011 0000 port2_output = 0x04; // 0000 0100 delay(DELAY); } port1_output &= 0x00; // turn off motors! port2_output &= 0x00; // turn off motors! } else if (c == 'c') { // close flash(); flash(); for (i=0; i<ROTATE_AMOUNT; i++) { port1_output = 0x30; // 0011 0000 port2_output = 0x04; // 0000 0100 delay(DELAY); port1_output = 0x20; // 0010 0000 port2_output = 0x06; // 0000 0110 delay(DELAY); port1_output = 0x28; // 0010 1000 port2_output = 0x04; // 0000 0100 delay(DELAY); port1_output = 0x20; // 0010 0000 port2_output = 0x05; // 0000 0101 delay(DELAY); } port1_output &= 0x00; // turn off motors! port2_output &= 0x00; // turn off motors! } } }