From 717a5cfb332c92e7beced40c47abe8aafb84fc82 Mon Sep 17 00:00:00 2001 From: kraus Date: Wed, 2 Oct 2019 15:28:29 +0200 Subject: [PATCH] issue #1005, write PBM --- csrc/u8g2.h | 2 + csrc/u8g2_buffer.c | 8 ++ csrc/u8x8.h | 9 +- csrc/u8x8_capture.c | 167 +++++++++++++++++++++++++++ csrc/u8x8_u16toa.c | 9 ++ sys/arm/lpc804/blink/blink.a | Bin 19784 -> 0 bytes sys/arm/lpc804/hex2lpc/hex2lpc.c | 32 ++++- sys/arm/lpc804/lpc_chip_804/info.txt | 6 +- sys/sdl/text_full_buffer/main.c | 10 +- 9 files changed, 236 insertions(+), 7 deletions(-) create mode 100644 csrc/u8x8_capture.c delete mode 100644 sys/arm/lpc804/blink/blink.a diff --git a/csrc/u8g2.h b/csrc/u8g2.h index 8548366a..eb155821 100644 --- a/csrc/u8g2.h +++ b/csrc/u8g2.h @@ -1165,6 +1165,8 @@ uint8_t u8g2_NextPage(u8g2_t *u8g2); void u8g2_UpdateDisplayArea(u8g2_t *u8g2, uint8_t tx, uint8_t ty, uint8_t tw, uint8_t th); void u8g2_UpdateDisplay(u8g2_t *u8g2); +void u8g2_WritePBM(u8g2_t *u8g2, void (*out)(const char *s)); + /*==========================================*/ /* u8g2_ll_hvline.c */ diff --git a/csrc/u8g2_buffer.c b/csrc/u8g2_buffer.c index 95ca08f1..20126f02 100644 --- a/csrc/u8g2_buffer.c +++ b/csrc/u8g2_buffer.c @@ -179,3 +179,11 @@ void u8g2_UpdateDisplay(u8g2_t *u8g2) { u8g2_send_buffer(u8g2); } + + +/*============================================*/ + +void u8g2_WritePBM(u8g2_t *u8g2, void (*out)(const char *s)) +{ + u8x8_capture_WritePBM(u8g2_GetBufferPtr(u8g2), u8g2_GetBufferTileWidth(u8g2), u8g2_GetBufferTileHeight(u8g2), out); +} diff --git a/csrc/u8x8.h b/csrc/u8x8.h index 42054d0f..3f976fc6 100644 --- a/csrc/u8x8.h +++ b/csrc/u8x8.h @@ -340,7 +340,7 @@ struct u8x8_struct /* i2c_address is the address for writing data to the display */ /* usually, the lowest bit must be zero for a valid address */ uint8_t i2c_started; /* for i2c interface */ - uint8_t device_address; /* this is the device address, replacement for U8X8_MSG_CAD_SET_DEVICE */ + uint8_t device_address; /* OBSOLETE???? - this is the device address, replacement for U8X8_MSG_CAD_SET_DEVICE */ uint8_t utf8_state; /* number of chars which are still to scan */ uint8_t gpio_result; /* return value from the gpio call (only for MENU keys at the moment) */ uint8_t debounce_default_pin_state; @@ -960,6 +960,7 @@ uint8_t u8x8_GetUTF8Len(u8x8_t *u8x8, const char *s); /* itoa procedures */ const char *u8x8_u8toa(uint8_t v, uint8_t d); const char *u8x8_u16toa(uint16_t v, uint8_t d); +const char *u8x8_utoa(uint16_t v); /*==========================================*/ @@ -1000,6 +1001,12 @@ uint8_t u8x8_UserInterfaceSelectionList(u8x8_t *u8x8, const char *title, uint8_t /* u8x8_message.c */ uint8_t u8x8_UserInterfaceMessage(u8x8_t *u8x8, const char *title1, const char *title2, const char *title3, const char *buttons); +/*==========================================*/ +/* u8x8_capture.c */ + +void u8x8_capture_WritePBM(uint8_t *buffer, uint8_t tile_width, uint8_t tile_height, void (*out)(const char *s)); + + /*==========================================*/ /* u8x8_input_value.c */ diff --git a/csrc/u8x8_capture.c b/csrc/u8x8_capture.c new file mode 100644 index 00000000..11085b99 --- /dev/null +++ b/csrc/u8x8_capture.c @@ -0,0 +1,167 @@ +/* + + u8x8_capture.c + + Screen capture feature + + Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) + + Copyright (c) 2016, olikraus@gmail.com + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this list + of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or other + materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + Warning: This will use global variables + +*/ + +#include "u8x8.h" + +struct _u8x8_capture_struct +{ + u8x8_msg_cb old_cb; + uint8_t *buffer; /* tile_width*tile_height*8 bytes */ + uint8_t tile_width; + uint8_t tile_height; +}; +typedef struct _u8x8_capture_struct u8x8_capture_t; + +/*========================================================*/ + +u8x8_capture_t u8x8_capture; + +/*========================================================*/ + +static void u8x8_capture_memory_copy(uint8_t *dest, uint8_t *src, uint16_t cnt) +{ + while( cnt > 0 ) + { + *dest++ = *src++; + cnt--; + } +} + +static void u8x8_capture_DrawTiles(u8x8_capture_t *capture, uint8_t tx, uint8_t ty, uint8_t tile_cnt, uint8_t *tile_ptr) +{ + uint8_t *dest_ptr = capture->buffer; + //printf("tile pos: %d %d, cnt=%d\n", tx, ty, tile_cnt); + if ( dest_ptr == NULL ) + return; + dest_ptr += (uint16_t)ty*capture->tile_width*8; + dest_ptr += (uint16_t)tx*8; + u8x8_capture_memory_copy(dest_ptr, tile_ptr, tile_cnt*8); +} + +uint8_t u8x8_capture_GetPixel(u8x8_capture_t *capture, uint16_t x, uint16_t y) +{ + uint8_t *dest_ptr = capture->buffer; + if ( dest_ptr == NULL ) + return 0; + dest_ptr += (y/8)*capture->tile_width*8; + y &= 7; + dest_ptr += x; + if ( (*dest_ptr & (1<x_pos; + y = ((u8x8_tile_t *)arg_ptr)->y_pos; + c = ((u8x8_tile_t *)arg_ptr)->cnt; + ptr = ((u8x8_tile_t *)arg_ptr)->tile_ptr; + do + { + u8x8_capture_DrawTiles(&u8x8_capture, x, y, c, ptr); + x += c; + arg_int--; + } while( arg_int > 0 ); + } + return u8x8_capture.old_cb(u8x8, msg, arg_int, arg_ptr); +} + +uint8_t u8x8_GetCaptureMemoryPixel(u8x8_t *u8x8, uint16_t x, uint16_t y) +{ + return u8x8_capture_GetPixel(&u8x8_capture, x, y); +} + +/* memory: tile_width*tile_height*8 bytes */ +void u8x8_ConnectCapture(u8x8_t *u8x8, uint8_t tile_width, uint8_t tile_height, uint8_t *memory) +{ + if ( u8x8->display_cb == u8x8_d_capture ) + return; /* do nothing, capture already installed */ + + u8x8_capture.buffer = memory; /* tile_width*tile_height*8 bytes */ + u8x8_capture.tile_width = tile_width; + u8x8_capture.tile_height = tile_height; + u8x8_capture.old_cb = u8x8->display_cb; + u8x8->display_cb = u8x8_d_capture; + return; +} + diff --git a/csrc/u8x8_u16toa.c b/csrc/u8x8_u16toa.c index 8a3afb56..0cedde85 100644 --- a/csrc/u8x8_u16toa.c +++ b/csrc/u8x8_u16toa.c @@ -66,3 +66,12 @@ const char *u8x8_u16toa(uint16_t v, uint8_t d) return u8x8_u16toap(buf, v) + d; } +const char *u8x8_utoa(uint16_t v) +{ + const char *s = u8x8_u16toa(v, 5); + while( *s == '0' ) + s++; + if ( *s == '\0' ) + s--; + return s; +} \ No newline at end of file diff --git a/sys/arm/lpc804/blink/blink.a b/sys/arm/lpc804/blink/blink.a deleted file mode 100644 index cb04e47cdc205dc0ce225916237b898c25274fb4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 19784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 z1LvI5p!q$H3@5)j6hx3me(a0p*N?Q5UlvHAy=Kls=iT!`B}({)NvC!1?ao +#define VERSION "1.0" + /* this defines the number of bytes, which should be sent before any further read happens */ /* it seems that there is a echo with the LPC devices, so that all data sent to the LPC */ /* is always sent back. This means, while writing, the same number of bytes are sent back */ @@ -1625,13 +1654,14 @@ int is_arg(char ***argv, int c) /*================================================*/ void help(void) { + printf("Version " VERSION); printf("-h Display this help\n"); printf("-f Load data from intel hex \n"); printf("-v Verify flash upload\n"); printf("-x Execute ARM reset handler after upload\n"); printf(" Note: Reset handler must set the stack pointer and restore SYSMEMREMAP\n"); printf("-p Use UART at (default: '/dev/ttyUSB0')\n"); - printf("-s Set UART transfer speed, 0=9600 (default), 1=19200, 2=57600, 3=115200\n"); + printf("-s Set UART transfer speed, 0=9600 (default), 1=19200, 2=57600, 3=115200, 4=230400\n"); printf("-i Show ISP commands sent to the device\n"); } diff --git a/sys/arm/lpc804/lpc_chip_804/info.txt b/sys/arm/lpc804/lpc_chip_804/info.txt index 7ecf98a7..c04a2e03 100644 --- a/sys/arm/lpc804/lpc_chip_804/info.txt +++ b/sys/arm/lpc804/lpc_chip_804/info.txt @@ -8,12 +8,10 @@ https://www.nxp.com/products/processors-and-microcontrollers/arm-microcontroller "LPC804 Example Code Bundle MCUXpresso" - the file inc/chip_setup.h might depend on then project, but should - be a good starting point. Toplevel include should be "LPC8xx.h". The name "LPC8xx.h" might be misleading: This file is specific to the LPC804, but -i decided to to change the name, but keep the orginal file name from the above zip +I decided not to change the name, but keep the orginal file name from the above zip folder. In fact plan is not to modify any of the files in lpc_chip_804 so that they can be overwritten at any time with the original files (maybe chip_setup.h is an exception). @@ -27,7 +25,7 @@ While working in the code, I saw, that there are some issues in "lpc_chip_804": - Alligned "unsigned int" with "uint32_t" declarations in syscon.h and .c - Change the inclusion of "lpc8xx.h" to "LPC8xx.h" in i2c.h - As a conclusion, I had to change the following files: + As a conclusion, I had to change the following files compared to the original zip content: i2c.h syscon.h syscon.c i2c.c spi.c spi.h plu.c \ No newline at end of file diff --git a/sys/sdl/text_full_buffer/main.c b/sys/sdl/text_full_buffer/main.c index 6f4b8ff5..5a66d093 100644 --- a/sys/sdl/text_full_buffer/main.c +++ b/sys/sdl/text_full_buffer/main.c @@ -5,6 +5,11 @@ u8g2_t u8g2; +void stdout_string(const char *s) +{ + printf("%s", s); +} + int main(void) { int x, y; @@ -44,7 +49,7 @@ int main(void) u8g2_DrawHVLine(&u8g2, u8g2.user_x1-1, u8g2.user_y1-1, 1, 0); u8g2_DrawHVLine(&u8g2, u8g2.user_x1-1, u8g2.user_y0, 1, 0); - u8g2_DrawFilledEllipse(&u8g2, x, y, 23, 27, U8G2_DRAW_UPPER_LEFT | U8G2_DRAW_LOWER_LEFT); + //u8g2_DrawFilledEllipse(&u8g2, x, y, 23, 27, U8G2_DRAW_UPPER_LEFT | U8G2_DRAW_LOWER_LEFT); u8g2_SendBuffer(&u8g2); /* @@ -94,6 +99,9 @@ int main(void) if ( k == 'd' ) x += 1; if ( k == 'q' ) break; + if ( k == 'c' ) + u8g2_WritePBM(&u8g2, stdout_string); + //if ( k == 't' ) // u8x8_SaveBitmapTGA(u8g2_GetU8x8(&u8g2), "screenshot.tga");