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.
Revision 4:bafd63604b7c, committed 2016-11-25
- Comitter:
- dkato
- Date:
- Fri Nov 25 11:16:42 2016 +0000
- Parent:
- 3:3a97fce90f37
- Child:
- 5:4e96673f4830
- Commit message:
- Add character string sample to layer 2.
Changed in this revision
| AsciiFont.lib | Show annotated file Show diff for this revision Revisions of this file |
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/AsciiFont.lib Fri Nov 25 11:16:42 2016 +0000 @@ -0,0 +1,1 @@ +https://developer.mbed.org/teams/Renesas/code/AsciiFont/#0d8bc371d109
--- a/main.cpp Fri Nov 25 10:10:19 2016 +0000
+++ b/main.cpp Fri Nov 25 11:16:42 2016 +0000
@@ -1,6 +1,7 @@
#include "mbed.h"
#include "DisplayBace.h"
#include "rtos.h"
+#include "AsciiFont.h"
#define VIDEO_CVBS (0) /* Analog Video Signal */
#define VIDEO_CMOS_CAMERA (1) /* Digital Video Signal */
@@ -80,6 +81,12 @@
#define TOUCH_NUM (2u)
#define DROW_POINT (5)
+/* STRING BUFFER Parameter GRAPHICS_LAYER_2 */
+#define STRING_PIXEL_HW (120)
+#define STRING_PIXEL_VM (24)
+#define STRING_BUFFER_BYTE_PER_PIXEL (2u)
+#define STRING_BUFFER_STRIDE (((LCD_PIXEL_WIDTH * STRING_BUFFER_BYTE_PER_PIXEL) + 31u) & ~31u)
+
static DisplayBase Display;
static DigitalOut lcd_pwon(P7_15);
static DigitalOut lcd_blon(P8_1);
@@ -100,12 +107,15 @@
static uint8_t user_frame_buffer2[FRAME_BUFFER_STRIDE * LCD_PIXEL_HEIGHT];
#pragma data_alignment=32
static uint8_t user_frame_buffer_touch[TOUCH_BUFFER_STRIDE * LCD_PIXEL_HEIGHT];
+#pragma data_alignment=32
+static uint8_t user_frame_buffer_string[STRING_BUFFER_STRIDE * STRING_PIXEL_VM];
#else
/* 32 bytes aligned */
static uint8_t user_frame_buffer0[FRAME_BUFFER_STRIDE * LCD_PIXEL_HEIGHT]__attribute((aligned(32)));
static uint8_t user_frame_buffer1[FRAME_BUFFER_STRIDE * LCD_PIXEL_HEIGHT]__attribute((aligned(32)));
static uint8_t user_frame_buffer2[FRAME_BUFFER_STRIDE * LCD_PIXEL_HEIGHT]__attribute((aligned(32)));
static uint8_t user_frame_buffer_touch[TOUCH_BUFFER_STRIDE * LCD_PIXEL_HEIGHT]__attribute((aligned(32)));
+static uint8_t user_frame_buffer_string[STRING_BUFFER_STRIDE * STRING_PIXEL_VM]__attribute((aligned(32)));
#endif
static uint8_t * FrameBufferTbl[FRAME_BUFFER_NUM] = {user_frame_buffer0, user_frame_buffer1, user_frame_buffer2};
#if VIDEO_INPUT_METHOD == VIDEO_CVBS
@@ -535,6 +545,9 @@
/****** main ******/
int main(void) {
+ DisplayBase::rect_t rect;
+ char test_cnt = 0x20;
+
/* Change the baud rate of the printf() */
pc.baud(921600);
@@ -552,8 +565,38 @@
Thread touchTask;
touchTask.start(touch_task);
+ /* The layer by which the touch panel location is drawn */
+ memset(user_frame_buffer_string, 0, sizeof(user_frame_buffer_string));
+ dcache_clean(user_frame_buffer_string, sizeof(user_frame_buffer_string));
+ rect.vs = LCD_PIXEL_HEIGHT - STRING_PIXEL_VM - 10;
+ rect.vw = STRING_PIXEL_VM;
+ rect.hs = LCD_PIXEL_WIDTH - STRING_PIXEL_HW - 10;
+ rect.hw = STRING_PIXEL_HW;
+ Display.Graphics_Read_Setting(
+ DisplayBase::GRAPHICS_LAYER_2,
+ (void *)user_frame_buffer_string,
+ STRING_BUFFER_STRIDE,
+ DisplayBase::GRAPHICS_FORMAT_ARGB4444,
+ DisplayBase::WR_RD_WRSWA_32_16BIT,
+ &rect
+ );
+ Display.Graphics_Start(DisplayBase::GRAPHICS_LAYER_2);
+
+ /* String */
+ AsciiFont ascii_font(user_frame_buffer_string, STRING_PIXEL_HW, STRING_PIXEL_VM,
+ STRING_BUFFER_STRIDE, STRING_BUFFER_BYTE_PER_PIXEL);
while (1) {
led_blue = !led_blue;
+
+ //colour: rrrrGBAR (r:Reserve G:Green B:Blue A:Alpha R:Red
+ ascii_font.DrawStr("Font:", 0, 8, 0x0000ffff, 2);
+ ascii_font.DrawChar(test_cnt, 84, 0, 0x0000aa9f, 3);
+ if (test_cnt < 0x7e) {
+ test_cnt++;
+ } else {
+ test_cnt = 0x20;
+ }
+ dcache_clean(user_frame_buffer_string, sizeof(user_frame_buffer_string));
Thread::wait(1000);
}
}