Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: GR-PEACH_video GraphicsFramework R_BSP SDFileSystem_tmp mbed-rtos mbed
Diff: main.cpp
- Revision:
- 3:8489fb71f53d
- Parent:
- 2:e79ddc136968
- Child:
- 4:1a08ad86d9af
--- a/main.cpp Tue May 24 11:20:55 2016 +0000 +++ b/main.cpp Wed May 25 03:15:58 2016 +0000 @@ -30,7 +30,7 @@ #define WXGA (3u) /* 1280 x 800 */ /**** User Selection *********/ -#define WAIT_TIME (8000) +#define WAIT_TIME (10000) /* wait time (ms) */ #define DISSOLVE_STEP_NUM (16) /* minimum 1 */ #define SCROLL_STEP_NUM (8) /* minimum 1 */ #define SCROLL_DIRECTION (-1) /* Select 1(left to right) or -1(right to left) */ @@ -40,7 +40,7 @@ #define FILE_NAME_LEN (64) #define TEXT_SIZE (64 + 1) //null-terminated #define FLD_PATH "/sd/" -#define MAX_JPEG_SIZE (1024 * 512) +#define MAX_JPEG_SIZE (1024 * 300) /* LCD Parameter */ #define LCD_INPUT_CLOCK (66.67f) @@ -96,13 +96,16 @@ Canvas2D_ContextClass canvas2d; #if defined(__ICCARM__) -static uint8_t user_frame_buffer[FRAME_BUFFER_STRIDE * LCD_PIXEL_HEIGHT]@ 0x60100000; -static uint8_t user_frame_buffer2[FRAME_BUFFER_STRIDE * LCD_PIXEL_HEIGHT]@ 0x60500000; -static uint8_t JpegBuffer[2][MAX_JPEG_SIZE]@ 0x60800000; +#pragma data_alignment=32 +static uint8_t user_frame_buffer[FRAME_BUFFER_STRIDE * LCD_PIXEL_HEIGHT]; +static uint8_t user_frame_buffer2[FRAME_BUFFER_STRIDE * LCD_PIXEL_HEIGHT]; +#pragma data_alignment=8 +static uint8_t JpegBuffer[2][MAX_JPEG_SIZE]; //8 bytes aligned!; +#pragma data_alignment=4 #else -static uint8_t user_frame_buffer[FRAME_BUFFER_STRIDE * LCD_PIXEL_HEIGHT]__attribute((at(0x60100000))); -static uint8_t user_frame_buffer2[FRAME_BUFFER_STRIDE * LCD_PIXEL_HEIGHT]__attribute((at(0x60500000))); -static uint8_t JpegBuffer[2][MAX_JPEG_SIZE]__attribute((at(0x60800000))); +static uint8_t user_frame_buffer[FRAME_BUFFER_STRIDE * LCD_PIXEL_HEIGHT]__attribute((aligned(32))); /* 32 bytes aligned */ +static uint8_t user_frame_buffer2[FRAME_BUFFER_STRIDE * LCD_PIXEL_HEIGHT]__attribute((aligned(32))); /* 32 bytes aligned */ +static uint8_t JpegBuffer[2][MAX_JPEG_SIZE]__attribute((section("NC_BSS"),aligned(8))); //8 bytes aligned!; #endif static frame_buffer_t frame_buffer_info; static volatile int32_t vsync_count = 0; @@ -293,6 +296,7 @@ int jpeg_toggle = 0; bool first_view = true; size_t ret; + Timer t; while (1) { // file search @@ -311,19 +315,24 @@ fclose(fp); if (ret < MAX_JPEG_SIZE) { if (first_view != false) { + t.reset(); + t.start(); // Effect NONE first_view = false; draw_image(&frame_buffer_info, (const graphics_image_t*)&JpegBuffer[jpeg_toggle]); } else { bool key_press = false; + t.stop(); // Wait timeout or key press - for (int i = 0; i < WAIT_TIME; i += 100) { + for (int i = t.read_ms(); i < WAIT_TIME; i += 100) { if (button == 0) { key_press = true; break; } Thread::wait(100); } + t.reset(); + t.start(); if (key_press == false) { // Effect DISSOLVE for (int i = 1; i <= DISSOLVE_STEP_NUM; i++) {