Image scroll Sample. This program uses GraphicsFramework library and Si1143 sensor.

Dependencies:   GR-PEACH_video GraphicsFramework R_BSP SI1143 mbed-rtos mbed

Fork of RGA_HelloWorld by Renesas

About Si1143

Si1143 is a gesture sensor and can be controlled by using the I2C.
This can be detected from the shortest 1cm up to 200cm.
Si1143 emits three infrared LED that is mounted on a substrate, and detects the movement by measuring the reflected light from the external object.

About wiring

VDD3.3V
SCLD15
SDAD14
GNDGND
Committer:
1050186
Date:
Mon May 30 04:55:35 2016 +0000
Revision:
4:2318f8bee89c
Parent:
3:841987280a7f
First Commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
1050186 0:84e4649e7707 1 /*
1050186 0:84e4649e7707 2 Permission is hereby granted, free of charge, to any person obtaining a copy
1050186 0:84e4649e7707 3 of this software and associated documentation files (the "Software"), to deal
1050186 0:84e4649e7707 4 in the Software without restriction, including without limitation the rights
1050186 0:84e4649e7707 5 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1050186 0:84e4649e7707 6 copies of the Software, and to permit persons to whom the Software is
1050186 0:84e4649e7707 7 furnished to do so, subject to the following conditions:
1050186 0:84e4649e7707 8
1050186 0:84e4649e7707 9 The above copyright notice and this permission notice shall be included in
1050186 0:84e4649e7707 10 all copies or substantial portions of the Software.
1050186 0:84e4649e7707 11
1050186 0:84e4649e7707 12 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1050186 0:84e4649e7707 13 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1050186 0:84e4649e7707 14 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1050186 0:84e4649e7707 15 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1050186 0:84e4649e7707 16 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1050186 0:84e4649e7707 17 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1050186 0:84e4649e7707 18 THE SOFTWARE.
1050186 0:84e4649e7707 19 */
1050186 0:84e4649e7707 20
1050186 0:84e4649e7707 21 #include "mbed.h"
1050186 0:84e4649e7707 22 #include "rga_func.h"
1050186 0:84e4649e7707 23
1050186 0:84e4649e7707 24 Canvas2D_ContextClass canvas2d;
1050186 0:84e4649e7707 25
1050186 0:84e4649e7707 26 void Set_RGAObject(frame_buffer_t* frmbuf_info) {
1050186 0:84e4649e7707 27 errnum_t err;
1050186 0:84e4649e7707 28 Canvas2D_ContextConfigClass config;
1050186 0:84e4649e7707 29
1050186 0:84e4649e7707 30 config.frame_buffer = frmbuf_info;
1050186 0:84e4649e7707 31 canvas2d = R_RGA_New_Canvas2D_ContextClass(config);
1050186 0:84e4649e7707 32 err = R_OSPL_GetErrNum();
1050186 0:84e4649e7707 33 if (err != 0) {
1050186 0:84e4649e7707 34 printf("Line %d, error %d\n", __LINE__, err);
1050186 0:84e4649e7707 35 while (1);
1050186 0:84e4649e7707 36 }
1050186 0:84e4649e7707 37 }
1050186 0:84e4649e7707 38
1050186 4:2318f8bee89c 39 void RGA_Func_DrawTopScreen(frame_buffer_t* frmbuf_info, const graphics_image_t* image) {
1050186 4:2318f8bee89c 40 canvas2d.drawImage((const graphics_image_t*)image, 0, 0);
dkato 2:c7faef0ef374 41
1050186 0:84e4649e7707 42 /* Complete drawing */
1050186 0:84e4649e7707 43 R_GRAPHICS_Finish(canvas2d.c_LanguageContext);
1050186 0:84e4649e7707 44 }
1050186 0:84e4649e7707 45
1050186 4:2318f8bee89c 46 void RGA_Func_Scroll(frame_buffer_t* frmbuf_info, const graphics_image_t* image_old, const graphics_image_t* image_new,
1050186 4:2318f8bee89c 47 int direction, float32_t scroll) {
1050186 4:2318f8bee89c 48 canvas2d.drawImage((const graphics_image_t*)image_old, 0, 0);
1050186 0:84e4649e7707 49
1050186 4:2318f8bee89c 50 /* Scroll */
1050186 4:2318f8bee89c 51 switch (direction) {
1050186 4:2318f8bee89c 52 case DIREC_RIGHT:
1050186 4:2318f8bee89c 53 canvas2d.drawImage((const graphics_image_t*)image_new,
1050186 4:2318f8bee89c 54 ((int)(frmbuf_info->width * scroll) - frmbuf_info->width) * 1, 0,
1050186 4:2318f8bee89c 55 frmbuf_info->width, frmbuf_info->height);
1050186 4:2318f8bee89c 56 break;
1050186 4:2318f8bee89c 57 case DIREC_LEFT:
1050186 4:2318f8bee89c 58 canvas2d.drawImage((const graphics_image_t*)image_new,
1050186 4:2318f8bee89c 59 ((int)(frmbuf_info->width * scroll) - frmbuf_info->width) * -1, 0,
1050186 4:2318f8bee89c 60 frmbuf_info->width, frmbuf_info->height);
1050186 4:2318f8bee89c 61 break;
1050186 4:2318f8bee89c 62 case DIREC_UP:
1050186 4:2318f8bee89c 63 canvas2d.drawImage((const graphics_image_t*)image_new,
1050186 4:2318f8bee89c 64 0, ((int)(frmbuf_info->height * scroll) - frmbuf_info->height) * -1,
1050186 4:2318f8bee89c 65 frmbuf_info->width, frmbuf_info->height);
1050186 4:2318f8bee89c 66 break;
1050186 4:2318f8bee89c 67 case DIREC_DOWN:
1050186 4:2318f8bee89c 68 canvas2d.drawImage((const graphics_image_t*)image_new,
1050186 4:2318f8bee89c 69 0, ((int)(frmbuf_info->height * scroll) - frmbuf_info->height) * 1,
1050186 4:2318f8bee89c 70 frmbuf_info->width, frmbuf_info->height);
1050186 4:2318f8bee89c 71 break;
1050186 4:2318f8bee89c 72 default :
1050186 4:2318f8bee89c 73 break;
1050186 4:2318f8bee89c 74 }
dkato 2:c7faef0ef374 75
1050186 0:84e4649e7707 76 /* Complete drawing */
1050186 0:84e4649e7707 77 R_GRAPHICS_Finish(canvas2d.c_LanguageContext);
1050186 0:84e4649e7707 78 }
1050186 0:84e4649e7707 79