示例#1
0
/*
 * Program entry point
 */
void main(void) {
    os_init();

    /* Start the timer that will seed the RNG */
    TCCR1B |= (1 << CS10);

    os_add_task( run_game,            30, 1);
    os_add_task( collect_delta,   60, 1);
    //os_add_task( check_switches,  60, 1);

    start_menu();

    sei();
    for(;;){}
}
示例#2
0
int main(void) {
    os_init();
    os_semaphore_init(&lcd_sem, 1);
    os_semaphore_init(&btn_sem, 1);
    os_semaphore_init(&stt_sem, 1);
    os_semaphore_init(&tck_sem, 1);
    os_add_task(uart_task, &uart_task_stack[STACK_SIZE + 64], 1, "uart");
    os_add_task(adc_task, &adc_task_stack[STACK_SIZE + 64], 0, "adc");
    os_add_task(button_task, &button_task_stack[STACK_SIZE + 64], 2, "btn");
    os_start_ticker();
    
    os_semaphore_wait(&lcd_sem);
    lcd_init();
    os_semaphore_signal(&lcd_sem);
    
    i2c_init();
    
    usart_init(USART_TRANSMIT | USART_RECEIVE);
    usart_putc('\f');
    
    while(1) {
        char buff[6];
        os_delay(os_get_current_pid(), 2000);
        /*usart_puts("Start I2C\r\n");
        int8_t start_ = i2c_start();
        int8_t send_ = i2c_send_address(0xa0);
        i2c_stop();
        if (start_ != 0) {
            usart_puts("Start error\r\n");
            uint8_t_to_ascii((uint8_t) start_, &(buff[0]));
            usart_puts(buff);
            usart_puts("\r\n");
            
        }
        if (send_ != 0) {
            usart_puts("Send error\r\n");
            uint8_t_to_ascii((uint8_t) send_, &(buff[0]));
            usart_puts(buff);
            usart_puts("\r\n");
        }
        usart_puts("Stop I2C\r\n\r\n");*/
    }
    
    return 0;
}
示例#3
0
int main(void) {
    os_add_task(test_task, &test_stack[127], 1);
    os_add_task(test_2_task, &test_2_stack[127], 2);
    os_semaphore_init(&a, 1);
    usart_init(0, USART_TRANSMIT);
    os_start();
    
    while (1) {
        uint8_t x;
        os_semaphore_wait(&a);
        for (x = 10; x < 15; x++) {
            usart_putsf("Hello World %d\r\n", x);
            os_delay(os_get_current_pid(), 1000);
        }
        os_semaphore_signal(&a);
        os_delay(os_get_current_pid(), 1000);
    }
}