static void ps_child(void *args) { for (;;) { gpio_write_bit(ERROR_LED_PORT, ERROR_LED_PIN, 1); os_process_sleep(25); gpio_write_bit(ERROR_LED_PORT, ERROR_LED_PIN, 0); os_process_sleep(4974); } }
static void ps_child(void *args) { for (;;) { gpio_toggle_bit(ERROR_LED_PORT, ERROR_LED_PIN); gpio_toggle_bit(GPIOA, GPIO_MEMLCD_EXTCOMIN); os_process_sleep(40); } }
/* * Here assumes the process will always * be created successfully. */ void ps_main(void *args) { os_process_create(ps_child, NULL, PS_CHILD_STACK_SIZE); os_process_create(ps_button, NULL, PS_BUTTON_STACK_SIZE); os_process_create(ps_console, NULL, PS_CONSOLE_STACK_SIZE); os_process_create(ps_debug, NULL, PS_DEBUG_STACK_SIZE); for (;;) os_process_sleep(1000); }
static void ps_button(void *args) { signal = 0; for (;;) { if (gpio_read_bit(USR_BUT_PORT, USR_BUT_PIN)) { // os_log(LOG_INFO, "%s - pressed.\n", __func__); signal = 1; } os_process_sleep(10); } }
static void ps_debug(void *args) { int index = 0; memlcd_disp(1); memlcd_clear(); for (;;) { #if 1 if (!signal) { os_process_sleep(1); continue; } else { signal = 0; } #else os_process_sleep(1); #endif index++; index = index >= 128 ? 0 : index; memlcd_draw(index); } }
static void eeprom_test(void) { int ret; eeprom_test_setup(); for (;;) { if (!signal) { os_process_sleep(50); continue; } else signal = 0; eeprom_erase(gee, 0, 16); eeprom_read(gee, buffer_r, 0, 16); eeprom_write(gee, buffer_w, 0, 16); ret = eeprom_verify(gee, buffer_w + gee->regaddr_size, 0, 16); if (ret != 0) os_log(LOG_ERROR, "Verify failed.\n"); else os_log(LOG_INFO, "Verify passed.\n"); } }