Study
Dependencies: DisplayApp mbed-os-lychee
Revision 2:437003074bc7, committed 2018-11-16
- Comitter:
- yagyag
- Date:
- Fri Nov 16 07:48:32 2018 +0000
- Parent:
- 1:0756c0a63a4b
- Commit message:
- ???
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Fri Feb 02 05:59:59 2018 +0000 +++ b/main.cpp Fri Nov 16 07:48:32 2018 +0000 @@ -25,9 +25,11 @@ static uint8_t user_frame_buffer0[FRAME_BUFFER_STRIDE * FRAME_BUFFER_HEIGHT]@ ".mirrorram"; #pragma data_alignment=32 static uint8_t JpegBuffer[2][1024 * 64]; +static uint8_t JpegBuffer_Send[1024 * 64]; #else static uint8_t user_frame_buffer0[FRAME_BUFFER_STRIDE * FRAME_BUFFER_HEIGHT]__attribute((section("NC_BSS"),aligned(32))); static uint8_t JpegBuffer[2][1024 * 64]__attribute((aligned(32))); +static uint8_t JpegBuffer_Send[1024 * 64]__attribute((aligned(32))); #endif static size_t jcu_encode_size[2]; static JPEG_Converter Jcu; @@ -48,12 +50,17 @@ } static void snapshot(void) { + //JPEGにエンコード中 or エンコード未完了 while ((jcu_encoding == 1) || (image_change == 0)) { Thread::wait(1); } jcu_buf_index_read = jcu_buf_index_write_done; + //画像データをコピー(JpegBufferは他から書き換えられる可能性があるため) + memcpy(JpegBuffer_Send, JpegBuffer[jcu_buf_index_read],1024 * 64); image_change = 0; - display_app.SendJpeg(JpegBuffer[jcu_buf_index_read], (int)jcu_encode_size[jcu_buf_index_read]); + + //撮影した画像データ(JPEG)をPCにUSBシリアル通信で転送 + display_app.SendJpeg(JpegBuffer_Send, (uint32_t)jcu_encode_size[jcu_buf_index_read]); } static void IntCallbackFunc_Vfield(DisplayBase::int_type_t int_type) {