/** * \brief Write Border(Input) Dummy Line * \note Set Border byte 0xFF to write Black and set 0xAA to write White * * \param EPD_type_index The defined EPD size */ static void border_dummy_line(uint8_t EPD_type_index) { uint16_t i; for (i = 0; i < COG_parameters[EPD_type_index].data_line_size; i++) { COG_Line.uint8[i] = 0x00; } *data_line_border_byte=BORDER_BYTE_B; //Write a Border(B) Dummy Line epd_spi_send (0x0a, (uint8_t *)&COG_Line.uint8, COG_parameters[EPD_type_index].data_line_size); //Turn on OE epd_spi_send_byte (0x02, 0x07); sys_delay_ms(40); *data_line_border_byte=BORDER_BYTE_W; //Write a Borde(B) Dummy Line epd_spi_send (0x0a, (uint8_t *)&COG_Line.uint8, COG_parameters[EPD_type_index].data_line_size); //Turn on OE epd_spi_send_byte (0x02, 0x07); sys_delay_ms(200); }
void branching() { sys_delay_ms(2); #define TURN_POWER (60) //currently around 10 ticks per second #define TURN_ENC (38) if (maze.lf > maze.right) //Left is open motor_set_target(TURN_ENC,-TURN_ENC); else //Right is open motor_set_target(-TURN_ENC,TURN_ENC); }
/* Deallocates a mailbox. If there are messages still present in the mailbox when the mailbox is deallocated, it is an indication of a programming error in lwIP and the developer should be notified. */ void sys_mbox_free(sys_mbox_t *mbox) { #define MAX_POLL_CNT 100 #define PER_POLL_DELAY 20 uint16_t count = 0; bool post_null = true; LWIP_DEBUGF(ESP_THREAD_SAFE_DEBUG, ("sys_mbox_free: set alive false\n")); (*mbox)->alive = false; while ( count++ < MAX_POLL_CNT ){ //ESP32_WORKAROUND LWIP_DEBUGF(ESP_THREAD_SAFE_DEBUG, ("sys_mbox_free:try lock=%d\n", count)); if (!sys_mutex_trylock( &(*mbox)->lock )){ LWIP_DEBUGF(ESP_THREAD_SAFE_DEBUG, ("sys_mbox_free:get lock ok %d\n", count)); sys_mutex_unlock( &(*mbox)->lock ); break; } if (post_null){ LWIP_DEBUGF(ESP_THREAD_SAFE_DEBUG, ("sys_mbox_free: post null to mbox\n")); if (sys_mbox_trypost( mbox, NULL) != ERR_OK){ ESP_STATS_DROP_INC(esp.free_mbox_post_fail); LWIP_DEBUGF(ESP_THREAD_SAFE_DEBUG, ("sys_mbox_free: post null mbox fail\n")); } else { post_null = false; LWIP_DEBUGF(ESP_THREAD_SAFE_DEBUG, ("sys_mbox_free: post null mbox ok\n")); } } if (count == (MAX_POLL_CNT-1)){ ESP_LOGW(TAG, "WARNING: mbox %p had a consumer who never unblocked. Leaking!\n", (*mbox)->os_mbox); } sys_delay_ms(PER_POLL_DELAY); } LWIP_DEBUGF(ESP_THREAD_SAFE_DEBUG, ("sys_mbox_free:free mbox\n")); if (uxQueueMessagesWaiting((*mbox)->os_mbox)) { xQueueReset((*mbox)->os_mbox); /* Line for breakpoint. Should never break here! */ __asm__ volatile ("nop"); }
int main(){ /*uint8_t status = 1; CTRL ^= 3 << LEDFLASH_MODE; while(1){ sys_wdt_rst(0); nand_rst(); nand_set_ecc(1); sys_delay_ms(1); }*/ /*uint8_t tmpbuf[32], nullbuf[32]; uint32_t t; for(uint8_t i = 0; i < 32; i++) tmpbuf[i] = i, nullbuf[i] = 0; CTRL ^= LEDFLASH_MODE_MASK; while(1){ t = TIMER; for(uint8_t i = 0; i < 16; i++) spimem_write(0, 32, tmpbuf), spimem_write(0,32,nullbuf); //32 writes sys_uart_printdec(TIMER-t); sys_uart_write(' '); sys_wdt_rst(1); }*/ //sys_signal_startup(); sys_init(); sys_wdt_rst(0); sys_delay_ms(1000); sys_wdt_rst(1); sys_delay_ms(1000); sys_wdt_rst(1); /*CTRL |= ITIMER_MODE_MASK; ITIMER = 32766; set_interrupt_mask(IE_ITIMER_MASK | IE_LOW_BATT_MASK);*/ //set_interrupt_mask(IE_LOW_BATT_MASK); dock_on_start(); // if(SFLAG(WD_FLAG_MASK) && !SFLAG(LUP_FLAG_MASK)) sys_uart_printstr("WDr"); // if(SFLAG(WD_FLAG_MASK | LUP_FLAG_MASK)) sys_uart_printstr("LCKr"); jpeg_init(); sys_signal_startup(); //selftest(); //WARNING!!!!! //sys_failure(SYS_FAILURE_SENSOR_CHECK, 0); while(1){ exec_sign ^= 0x1; //action sensor_grab(1); frame_cnt++; if(diff_use() == 0) monitor_jpeg_to_dest(cur_mode.q_table, 2, 0), saved_frame_cnt++; else exec_sign ^= 0x1F00; //service stat_mode_on_loop(); stat_on_loop(); sys_wdt_rst(1); monitor_loop(); //delay sys_delay_fps(); sys_check_exec_signature(); } return 0; }