/** * Scroll screen by 1 line */ void defilement(void) { // move the screen up memmove((void*)0xD0000000,(const void*)((uint32_t)0xD0000000+(uint32_t)800*16*2),(size_t)((uint32_t)(800*(480-16)*2))); // initialise the last line for (uint16_t j = 0; j < COL; j++) putc_at(LIN-1, j, ' ', ct, cf); /* uint32_t secondary_buffer = get_secondary_buff_adr(); HAL_DMA2D_DeInit(&Dma2dHandle); Dma2dHandle.Init.Mode = DMA2D_M2M; Dma2dHandle.Init.ColorMode = DMA2D_RGB565; Dma2dHandle.Init.OutputOffset = 0x0; Dma2dHandle.LayerCfg[0].AlphaMode = DMA2D_NO_MODIF_ALPHA; Dma2dHandle.LayerCfg[0].InputAlpha = 0xFF; Dma2dHandle.LayerCfg[0].InputColorMode = CM_RGB565; Dma2dHandle.LayerCfg[0].InputOffset = 0x0; Dma2dHandle.Instance = DMA2D; HAL_DMA2D_Init(&Dma2dHandle); HAL_DMA2D_ConfigLayer(&Dma2dHandle, 0); HAL_DMA2D_Start(&Dma2dHandle, secondary_buffer+LCD_WIDTH*font_px_h*2, secondary_buffer, LCD_WIDTH, LCD_HEIGHT-font_px_h); HAL_DMA2D_PollForTransfer(&Dma2dHandle, 200); HAL_DMA2D_DeInit(&Dma2dHandle); Dma2dHandle.Init.Mode = DMA2D_R2M; Dma2dHandle.Init.ColorMode = DMA2D_RGB565; Dma2dHandle.Init.OutputOffset = 0x0; Dma2dHandle.LayerCfg[0].AlphaMode = DMA2D_NO_MODIF_ALPHA; Dma2dHandle.LayerCfg[0].InputAlpha = 0xFF; Dma2dHandle.LayerCfg[0].InputColorMode = CM_RGB565; Dma2dHandle.LayerCfg[0].InputOffset = 0x0; Dma2dHandle.Instance = DMA2D; HAL_DMA2D_Init(&Dma2dHandle); HAL_DMA2D_ConfigLayer(&Dma2dHandle, 0); HAL_DMA2D_Start(&Dma2dHandle, BLACK, secondary_buffer+LCD_WIDTH*(LCD_HEIGHT-font_px_h)*2, LCD_WIDTH, font_px_h); HAL_DMA2D_PollForTransfer(&Dma2dHandle, 200); switch_buffer(); //*/ }
/** * affiche correctement le caractère selon son type * @param c le caractère à traiter */ void traite_char(char c) { switch(c) { case 8: // \b if (pos_curseur % COL != 0) pos_curseur--; put_cursor(pos_curseur/COL,pos_curseur%COL); break; case 9: // \t pos_curseur += 8-pos_curseur%8; put_cursor(pos_curseur/COL,pos_curseur%COL); break; case 10: // \n if (pos_curseur/COL == LIN-1) { defilement(); pos_curseur -= pos_curseur%COL; } else { pos_curseur += COL - pos_curseur%COL; } put_cursor(pos_curseur/COL, pos_curseur%COL); break; case 12: // \f clear_screen(); pos_curseur = 0; put_cursor(pos_curseur/COL, pos_curseur%COL); break; case 13: // \r pos_curseur -= pos_curseur%COL; put_cursor(pos_curseur/COL, pos_curseur%COL); break; default: putc_at(pos_curseur/COL, pos_curseur%COL, c, ct, cf); pos_curseur++; if (pos_curseur >= COL*LIN) { defilement(); pos_curseur = COL*(LIN-1); } put_cursor(pos_curseur/COL,pos_curseur%COL); break; } }
void exec_command(char *name, int argc, char **args, int w) { uint32_t i; uint32_t j; uint32_t title_len; uint32_t cmd_name_len; bool found; uint32_t *status; for (i = 0, found = false; i < next && !found; i++) { if (!strcmp(commands[i].name, name)) { if (w) { // Add the command's name to the title. title_len = strlen(TITLE); cmd_name_len = strlen(commands[i].name); puts_at(" - ", 0, title_len); puts_at(commands[i].name, 0, title_len + 3); } if (new_thread(name, &status)) { // Within a new thread, call the function and pass the arguments // to it. (*commands[i].func)(argc, args, CALL_TYPE_NORMAL); // When the operation completes, dispose of the thread. dispose_thread(); } if (w) { // Wait for the command to complete. wait(status); // Remove the command's name from the title. for (j = title_len; j < title_len + cmd_name_len + 3; j++) putc_at('\x00', 0, j); } found = true; } } if (!found) puts("Command not found.\n"); }