├── .gitignore ├── LICENSE ├── README.md ├── aaf-1202fnf ├── CMakeLists.txt ├── core1.c ├── core1.h ├── font.h ├── gldp_32_linear.h ├── gldp_32_nonlinear.h ├── lcd.c ├── lcd.h ├── lcddata.pio ├── lut.h ├── main.c ├── pico_extras_import.cmake └── pico_sdk_import.cmake ├── ac057tc1 ├── CMakeLists.txt ├── epd.c ├── epd.h ├── fw.c ├── lut.c ├── lut.h └── pico_sdk_import.cmake ├── bg999076a ├── ST7637.C └── ST7637.H ├── ed060sc4 └── sdvideo │ ├── epd.c │ ├── epd.h │ ├── font.h │ ├── main.c │ ├── main.h │ ├── sdcard.c │ ├── sdcard.h │ ├── sdio_sd.c │ ├── sdio_sd.h │ ├── spi.c │ ├── spi.h │ ├── sram.c │ ├── sram.h │ ├── stm32f2xx_conf.h │ ├── stm32f4xx_conf.h │ ├── stm32f4xx_it.c │ ├── stm32f4xx_it.h │ ├── usart.c │ └── usart.h ├── el114tr1 ├── CMakeLists.txt ├── font.h ├── main.c └── pico_sdk_import.cmake ├── el640480am1 ├── bitbang │ ├── CMakeLists.txt │ ├── el.c │ ├── el.h │ ├── font.h │ ├── main.c │ ├── pico_extras_import.cmake │ ├── pico_sdk_import.cmake │ └── sample_text.h ├── frame_dma_pio │ ├── CMakeLists.txt │ ├── el.c │ ├── el.h │ ├── eldata.pio │ ├── main.c │ ├── pico_extras_import.cmake │ └── pico_sdk_import.cmake ├── line_dma_pio │ ├── CMakeLists.txt │ ├── el.c │ ├── el.h │ ├── eldata.pio │ ├── font.h │ ├── main.c │ ├── pico_extras_import.cmake │ ├── pico_sdk_import.cmake │ └── sample_text.h ├── loop_pio │ ├── CMakeLists.txt │ ├── el.c │ ├── el.h │ ├── eldata.pio │ ├── font.h │ ├── main.c │ ├── pico_extras_import.cmake │ ├── pico_sdk_import.cmake │ └── sample_text.h └── sdvideo │ ├── CMakeLists.txt │ ├── el.c │ ├── el.h │ ├── eldata.pio │ ├── main.c │ ├── pico_extras_import.cmake │ └── pico_sdk_import.cmake ├── elw1501aa ├── CMakeLists.txt ├── font.h ├── fw.c ├── lcd.c ├── lcd.h ├── pico_sdk_import.cmake ├── ui.c └── ui.h ├── er-tft0.96-1 ├── CMakeLists.txt ├── font.h ├── fw.c ├── lcd.c ├── lcd.h ├── pico_sdk_import.cmake ├── ui.c └── ui.h ├── gbp ├── main_core1.c ├── stnlcd.c └── stnlcd.h ├── gpm675a0 ├── lcd.c └── lcd.h ├── gv6416gfsl011 ├── CMakeLists.txt ├── font.h ├── lcd.c ├── lcd.h ├── main.c ├── pico_extras_import.cmake └── pico_sdk_import.cmake ├── gy3216n1frn6a ├── lcd.c └── lcd.h ├── ip270-lcd ├── CMakeLists.txt ├── font.h ├── main.c └── pico_sdk_import.cmake ├── lb18db ├── demo │ ├── CMakeLists.txt │ ├── font.h │ ├── image.h │ ├── lcd.c │ ├── lcd.h │ ├── lcddata.pio │ ├── main.c │ ├── pico_extras_import.cmake │ └── pico_sdk_import.cmake └── imgcvt │ ├── Makefile │ ├── config.h │ ├── disp.c │ ├── disp.h │ ├── main.c │ ├── run.log │ ├── stb.c │ ├── stb_image.h │ └── stb_image_resize.h ├── lm081hb1t01 ├── lcd.c └── lcd.h ├── lm9033a ├── lcd.c └── lcd.h ├── s60715 ├── lcd.c └── lcd.h ├── sclm-p107 ├── CMakeLists.txt ├── font.h ├── main.c └── pico_sdk_import.cmake ├── wd-g1206 ├── lcd.c └── lcd.h └── wd-x16161 ├── CMakeLists.txt ├── font.h ├── lcd.c ├── lcd.h ├── lcddata.pio ├── main.c ├── pico_extras_import.cmake └── pico_sdk_import.cmake /.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | .vscode/ 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Wenting Zhang 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # driving-lcds 2 | Code for my LCD driving blog posts 3 | 4 | ## Screens 5 | 6 | - AAF-1202FNF: 6.2" 320x100 NT770x FSTN LCD 7 | - BG999076A: 1.5" 128x128 ST7637 CSTN LCD 8 | - ED060SC4: 6.0" 800x600 EINK 9 | - EL640480AM1: 10.4" 640x480 TFEL 10 | - ELW1501AA: 1.5" 128x128 SSD1327 PM OLED 11 | - ER-TFT0.96-1: 0.96" 160x80 ST7735 IPS TFT LCD 12 | - GBP: 2.6" 160x160 FSTN LCD 13 | - GPM675A0: 3.8" 320x240 FSTN LCD 14 | - GV6416GFSL011: 3" 64x16 ST7049A FSC TN LCD 15 | - GY3216N1FRN6A: 6.4" 320x160 FSTN LCD 16 | - IP270-LCD: 4.0" 255x64 ST7529 FSTN LCD 17 | - LM9033A: 2.3" 128x96 S6B0741 STN LCD 18 | - S60715: 4.8" 320x160 UC1698U FSTN LCD 19 | - SCLM-P107: 5.5" 24x24 NT7701 FSC TN LCD 20 | - WD-G1206: 2.0" 128x64 ST7565 FSTN LCD 21 | - WD-X16161: 4.0" 160x160 NT770x CSTN LCD 22 | -------------------------------------------------------------------------------- /aaf-1202fnf/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Generated Cmake Pico project file 2 | 3 | cmake_minimum_required(VERSION 3.13) 4 | 5 | set(CMAKE_C_STANDARD 11) 6 | set(CMAKE_CXX_STANDARD 17) 7 | 8 | # initalize pico_sdk from installed location 9 | # (note this can come from environment, CMake cache etc) 10 | set(PICO_SDK_PATH "/home/wenting/pico/pico-sdk") 11 | set(PICO_EXTRAS_PATH "/home/wenting/pico/pico-extras") 12 | 13 | # Pull in Raspberry Pi Pico SDK (must be before project) 14 | include(pico_sdk_import.cmake) 15 | 16 | # We also need PICO EXTRAS 17 | include(pico_extras_import.cmake) 18 | 19 | project(lcddemo C CXX ASM) 20 | 21 | set(PICO_BOARD_HEADER_DIRS ${CMAKE_SOURCE_DIR}/board) 22 | set(PICO_BOARD "picooc") 23 | 24 | # Initialise the Raspberry Pi Pico SDK 25 | pico_sdk_init() 26 | 27 | add_executable(lcddemo) 28 | 29 | pico_generate_pio_header(lcddemo ${CMAKE_CURRENT_LIST_DIR}/lcddata.pio) 30 | 31 | target_sources(lcddemo PRIVATE 32 | core1.c 33 | main.c 34 | lcd.c 35 | ) 36 | 37 | add_compile_definitions(lcddemo 38 | PICO_SD_CLK_PIN=26 39 | PICO_SD_CMD_PIN=18 40 | PICO_SD_DAT0_PIN=19 41 | PICO_SD_CARD_EXTRA_CLOCK_DIVIDER=2 42 | ) 43 | 44 | pico_set_program_name(lcddemo "lcddemo") 45 | pico_set_program_version(lcddemo "0.1") 46 | 47 | pico_enable_stdio_uart(lcddemo 0) 48 | pico_enable_stdio_usb(lcddemo 0) 49 | 50 | target_include_directories(lcddemo PRIVATE ${CMAKE_CURRENT_LIST_DIR}) 51 | 52 | # Add the standard library to the build 53 | target_link_libraries(lcddemo pico_stdlib hardware_dma hardware_pwm) 54 | 55 | # Add any user requested libraries 56 | target_link_libraries(lcddemo 57 | pico_stdlib 58 | pico_multicore 59 | pico_sd_card 60 | hardware_pio 61 | ) 62 | 63 | pico_add_extra_outputs(lcddemo) 64 | 65 | add_compile_options(-Ofast) 66 | -------------------------------------------------------------------------------- /aaf-1202fnf/core1.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2021 Wenting Zhang 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | #pragma once 23 | // These are all code running on core 1 24 | // Core 0 should not call these functions or use any variables 25 | void core1_entry(); 26 | -------------------------------------------------------------------------------- /aaf-1202fnf/gldp_32_linear.h: -------------------------------------------------------------------------------- 1 | const static unsigned char gldp[] = { 2 | // 0 3 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4 | // 1 5 | 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6 | // 2 7 | 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8 | // 3 9 | 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10 | // 4 11 | 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 12 | // 5 13 | 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 14 | // 6 15 | 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 16 | // 7 17 | 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 18 | // 8 19 | 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 20 | // 9 21 | 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 22 | // 10 23 | 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 24 | // 11 25 | 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 26 | // 12 27 | 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 28 | // 13 29 | 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 30 | // 14 31 | 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 32 | // 15 33 | 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 34 | // 16 35 | 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 36 | // 17 37 | 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 38 | // 18 39 | 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 40 | // 19 41 | 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 42 | // 20 43 | 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 44 | // 21 45 | 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 46 | // 22 47 | 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 48 | // 23 49 | 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 50 | // 24 51 | 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 52 | // 25 53 | 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 54 | // 26 55 | 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 56 | // 27 57 | 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 58 | // 28 59 | 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 60 | // 29 61 | 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 62 | // 30 63 | 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 64 | // 31 65 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 66 | }; -------------------------------------------------------------------------------- /aaf-1202fnf/gldp_32_nonlinear.h: -------------------------------------------------------------------------------- 1 | const static unsigned char gldp_g0[] = {1, 0}; // 0, 0 2 | const static unsigned char gldp_g1[] = {9, 0, 0, 0, 0, 0, 0, 0, 0, 1}; // 1, 1/9 3 | const static unsigned char gldp_g2[] = {8, 0, 0, 0, 0, 0, 0, 0, 1}; // 2, 1/8 4 | const static unsigned char gldp_g3[] = {7, 0, 0, 0, 0, 0, 0, 1}; // 3, 1/7 5 | const static unsigned char gldp_g4[] = {6, 0, 0, 0, 0, 0, 1}; // 4, 1/6 6 | const static unsigned char gldp_g5[] = {5, 0, 0, 0, 0, 1}; // 5, 1/5 7 | const static unsigned char gldp_g6[] = {4, 0, 0, 0, 1}; // 6, 1/4 8 | const static unsigned char gldp_g7[] = {7, 0, 0, 0, 1, 0, 0, 1}; // 7, 2/7 9 | const static unsigned char gldp_g8[] = {10, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1}; // 8, 3/10 10 | const static unsigned char gldp_g9[] = {3, 0, 0, 1}; // 9, 1/3 11 | const static unsigned char gldp_g10[] = {8, 0, 1, 0, 0, 1, 0, 0, 1}; // 3/8 12 | const static unsigned char gldp_g11[] = {5, 0, 0, 1, 0, 1}; // 2/5 13 | const static unsigned char gldp_g12[] = {9, 0, 0, 1, 0, 1, 0, 1, 0, 1}; // 4/9 14 | const static unsigned char gldp_g13[] = {13, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1}; // 6/13 15 | const static unsigned char gldp_g14[] = {2, 0, 1}; // 1/2 16 | const static unsigned char gldp_g15[] = {13, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1}; // 7/13 17 | const static unsigned char gldp_g16[] = {9, 1, 0, 1, 0, 1, 0, 1, 0, 1}; // 5/9 18 | const static unsigned char gldp_g17[] = {5, 1, 0, 1, 0, 1}; // 3/5 19 | const static unsigned char gldp_g18[] = {11, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1}; // 7/11 20 | const static unsigned char gldp_g19[] = {3, 0, 1, 1}; // 2/3 21 | const static unsigned char gldp_g20[] = {13, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1}; // 9/13 22 | const static unsigned char gldp_g21[] = {8, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0}; // 8/11 23 | const static unsigned char gldp_g22[] = {4, 1, 1, 1, 0}; // 3/4 24 | const static unsigned char gldp_g23[] = {9, 1, 1, 1, 0, 1, 1, 1, 0, 1}; // 7/9 25 | const static unsigned char gldp_g24[] = {5, 1, 1, 0, 1, 1}; // 4/5 26 | const static unsigned char gldp_g25[] = {6, 1, 1, 1, 0, 1, 1}; // 5/6 27 | const static unsigned char gldp_g26[] = {7, 0, 1, 1, 1, 1, 1, 1}; // 6/7 28 | const static unsigned char gldp_g27[] = {9, 0, 1, 1, 1, 1, 1, 1, 1, 1}; // 8/9 29 | const static unsigned char gldp_g28[] = {11, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; // 10/11 30 | const static unsigned char gldp_g29[] = {15, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; // 14/15 31 | const static unsigned char gldp_g30[] = {31, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; // 30/31 32 | const static unsigned char gldp_g31[] = {1, 1}; 33 | 34 | const static unsigned char *gldp[] = { 35 | gldp_g0, gldp_g1, gldp_g2, gldp_g3, gldp_g4, gldp_g5, gldp_g6, gldp_g7, gldp_g8, gldp_g9, 36 | gldp_g10, gldp_g11, gldp_g12, gldp_g13, gldp_g14, gldp_g15, gldp_g16, gldp_g17, gldp_g18, gldp_g19, 37 | gldp_g20, gldp_g21, gldp_g22, gldp_g23, gldp_g24, gldp_g25, gldp_g26, gldp_g27, gldp_g28, gldp_g29, 38 | gldp_g30, gldp_g31 39 | }; -------------------------------------------------------------------------------- /aaf-1202fnf/lcd.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2021 Wenting Zhang 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | #pragma once 23 | 24 | #define VSYNC_PIN (6) 25 | #define HSYNC_PIN (4) 26 | #define PIXCLK_PIN (5) 27 | // D0-7: 8-15 28 | #define D0_PIN (8) 29 | 30 | #define AC_PIN (1) 31 | 32 | #define EN_PIN (7) 33 | 34 | // PIO related 35 | #define LCD_DATA_SM (0) 36 | #define LCD_AC_SM (1) 37 | 38 | // Screen related 39 | 40 | #define LCD_BUS_WIDTH (4) 41 | 42 | #define SCR_WIDTH (320) 43 | #define SCR_HEIGHT (100) 44 | 45 | /*#define SCR_WIDTH (256) 46 | #define SCR_HEIGHT (160)*/ 47 | 48 | /* 49 | #define LCD_BUS_WIDTH (8) 50 | 51 | #define SCR_WIDTH (160*3) 52 | #define SCR_HEIGHT (160)*/ 53 | 54 | #define SCR_LINE_TRANSFERS (SCR_WIDTH / LCD_BUS_WIDTH) 55 | 56 | #define SCR_STRIDE (SCR_WIDTH / 8) 57 | #define SCR_STRIDE_WORDS (SCR_WIDTH / 32) 58 | #define SCR_REFRESH_LINES (SCR_HEIGHT) 59 | 60 | #define LCD_TARGET_HZ (240) 61 | #define LCD_TARGET_PIXCLK (LCD_TARGET_HZ * (SCR_LINE_TRANSFERS + 10) * SCR_REFRESH_LINES) 62 | 63 | // Public variables and functions 64 | extern unsigned char framebuf_bp0[SCR_STRIDE * SCR_HEIGHT]; 65 | extern unsigned char framebuf_bp1[SCR_STRIDE * SCR_HEIGHT]; 66 | extern volatile bool frame_sync; 67 | 68 | void lcd_start(); 69 | unsigned char *lcd_swap_buffer(); 70 | void lcd_wait_vsync(); -------------------------------------------------------------------------------- /aaf-1202fnf/lcddata.pio: -------------------------------------------------------------------------------- 1 | 2 | ; LCD SM handles D0-3, PCLK, HSYNC and VSYNC 3 | ; PCLK is mapped to SIDE, HSYNC and VSYNC are mapped to SET, and D0-3 are mapped to OUT 4 | .program lcd_data 5 | .side_set 1 6 | irq set 5 side 0 ; assert here for frame & line inversion 7 | mov x, isr side 0 8 | loop_first_line: 9 | out pins, 4 side 1 10 | jmp x-- loop_first_line side 0 11 | end_first_line: 12 | set pins, 0b101 [5] side 0; Hsync high, Vsync high 13 | set pins, 0b100 side 0; Hsync low, Vsync high 14 | set pins, 0b000 [9] side 0; HVsync low 15 | line_start: 16 | ;irq set 5 side 0 ; assert here only for line inversion 17 | mov x, isr side 0 18 | loop: 19 | out pins, 4 side 1 ; Output 4 bit data 20 | jmp x-- loop side 0 ; Loop until x hits 0, then wait for next line 21 | loop_end: 22 | set pins, 0b001 [5] side 0; Hsync high, Vsync low 23 | set pins, 0b000 [10] side 0; HVsync low 24 | jmp y-- line_start side 0 25 | ; end of frame, signal CPU 26 | irq wait 1 side 0 27 | 28 | .program lcd_ac 29 | .wrap_target 30 | wait irq 5 31 | set pins, 1 32 | wait irq 5 33 | set pins, 0 34 | .wrap -------------------------------------------------------------------------------- /aaf-1202fnf/lut.h: -------------------------------------------------------------------------------- 1 | const uint8_t color_lut[256] = { 2 | 0, 3 | 0, 4 | 1, 5 | 1, 6 | 2, 7 | 3, 8 | 3, 9 | 4, 10 | 5, 11 | 6, 12 | 7, 13 | 8, 14 | 8, 15 | 9, 16 | 10, 17 | 10, 18 | 11, 19 | 11, 20 | 12, 21 | 12, 22 | 13, 23 | 13, 24 | 13, 25 | 14, 26 | 14, 27 | 14, 28 | 15, 29 | 15, 30 | 15, 31 | 16, 32 | 16, 33 | 16, 34 | 17, 35 | 17, 36 | 17, 37 | 17, 38 | 18, 39 | 18, 40 | 18, 41 | 18, 42 | 19, 43 | 19, 44 | 19, 45 | 19, 46 | 19, 47 | 20, 48 | 20, 49 | 20, 50 | 20, 51 | 20, 52 | 21, 53 | 21, 54 | 21, 55 | 21, 56 | 21, 57 | 22, 58 | 22, 59 | 22, 60 | 22, 61 | 22, 62 | 22, 63 | 23, 64 | 23, 65 | 23, 66 | 23, 67 | 23, 68 | 23, 69 | 24, 70 | 24, 71 | 24, 72 | 24, 73 | 24, 74 | 24, 75 | 25, 76 | 25, 77 | 25, 78 | 25, 79 | 25, 80 | 25, 81 | 25, 82 | 26, 83 | 26, 84 | 26, 85 | 26, 86 | 26, 87 | 26, 88 | 26, 89 | 27, 90 | 27, 91 | 27, 92 | 27, 93 | 27, 94 | 27, 95 | 27, 96 | 28, 97 | 28, 98 | 28, 99 | 28, 100 | 28, 101 | 28, 102 | 28, 103 | 29, 104 | 29, 105 | 29, 106 | 29, 107 | 29, 108 | 29, 109 | 29, 110 | 30, 111 | 30, 112 | 30, 113 | 30, 114 | 30, 115 | 30, 116 | 30, 117 | 30, 118 | 31, 119 | 31, 120 | 31, 121 | 31, 122 | 31, 123 | 31, 124 | 31, 125 | 31, 126 | 32, 127 | 32, 128 | 32, 129 | 32, 130 | 32, 131 | 32, 132 | 32, 133 | 33, 134 | 33, 135 | 33, 136 | 33, 137 | 33, 138 | 33, 139 | 33, 140 | 33, 141 | 34, 142 | 34, 143 | 34, 144 | 34, 145 | 34, 146 | 34, 147 | 34, 148 | 34, 149 | 35, 150 | 35, 151 | 35, 152 | 35, 153 | 35, 154 | 35, 155 | 35, 156 | 36, 157 | 36, 158 | 36, 159 | 36, 160 | 36, 161 | 36, 162 | 36, 163 | 36, 164 | 37, 165 | 37, 166 | 37, 167 | 37, 168 | 37, 169 | 37, 170 | 37, 171 | 38, 172 | 38, 173 | 38, 174 | 38, 175 | 38, 176 | 38, 177 | 38, 178 | 39, 179 | 39, 180 | 39, 181 | 39, 182 | 39, 183 | 39, 184 | 39, 185 | 40, 186 | 40, 187 | 40, 188 | 40, 189 | 40, 190 | 40, 191 | 40, 192 | 41, 193 | 41, 194 | 41, 195 | 41, 196 | 41, 197 | 41, 198 | 42, 199 | 42, 200 | 42, 201 | 42, 202 | 42, 203 | 42, 204 | 43, 205 | 43, 206 | 43, 207 | 43, 208 | 43, 209 | 43, 210 | 44, 211 | 44, 212 | 44, 213 | 44, 214 | 44, 215 | 45, 216 | 45, 217 | 45, 218 | 45, 219 | 45, 220 | 46, 221 | 46, 222 | 46, 223 | 46, 224 | 46, 225 | 47, 226 | 47, 227 | 47, 228 | 47, 229 | 48, 230 | 48, 231 | 48, 232 | 48, 233 | 49, 234 | 49, 235 | 49, 236 | 50, 237 | 50, 238 | 50, 239 | 51, 240 | 51, 241 | 52, 242 | 52, 243 | 53, 244 | 53, 245 | 54, 246 | 55, 247 | 55, 248 | 56, 249 | 57, 250 | 59, 251 | 59, 252 | 60, 253 | 61, 254 | 61, 255 | 62, 256 | 63, 257 | 63, 258 | }; 259 | -------------------------------------------------------------------------------- /aaf-1202fnf/pico_extras_import.cmake: -------------------------------------------------------------------------------- 1 | # This is a copy of /external/pico_extras_import.cmake 2 | 3 | # This can be dropped into an external project to help locate pico-extras 4 | # It should be include()ed prior to project() 5 | 6 | if (DEFINED ENV{PICO_EXTRAS_PATH} AND (NOT PICO_EXTRAS_PATH)) 7 | set(PICO_EXTRAS_PATH $ENV{PICO_EXTRAS_PATH}) 8 | message("Using PICO_EXTRAS_PATH from environment ('${PICO_EXTRAS_PATH}')") 9 | endif () 10 | 11 | if (DEFINED ENV{PICO_EXTRAS_FETCH_FROM_GIT} AND (NOT PICO_EXTRAS_FETCH_FROM_GIT)) 12 | set(PICO_EXTRAS_FETCH_FROM_GIT $ENV{PICO_EXTRAS_FETCH_FROM_GIT}) 13 | message("Using PICO_EXTRAS_FETCH_FROM_GIT from environment ('${PICO_EXTRAS_FETCH_FROM_GIT}')") 14 | endif () 15 | 16 | if (DEFINED ENV{PICO_EXTRAS_FETCH_FROM_GIT_PATH} AND (NOT PICO_EXTRAS_FETCH_FROM_GIT_PATH)) 17 | set(PICO_EXTRAS_FETCH_FROM_GIT_PATH $ENV{PICO_EXTRAS_FETCH_FROM_GIT_PATH}) 18 | message("Using PICO_EXTRAS_FETCH_FROM_GIT_PATH from environment ('${PICO_EXTRAS_FETCH_FROM_GIT_PATH}')") 19 | endif () 20 | 21 | if (NOT PICO_EXTRAS_PATH) 22 | if (PICO_EXTRAS_FETCH_FROM_GIT) 23 | include(FetchContent) 24 | set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR}) 25 | if (PICO_EXTRAS_FETCH_FROM_GIT_PATH) 26 | get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_EXTRAS_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}") 27 | endif () 28 | FetchContent_Declare( 29 | PICO_EXTRAS 30 | GIT_REPOSITORY https://github.com/raspberrypi/pico-extras 31 | GIT_TAG master 32 | ) 33 | if (NOT PICO_EXTRAS) 34 | message("Downloading PICO EXTRAS") 35 | FetchContent_Populate(PICO_EXTRAS) 36 | set(PICO_EXTRAS_PATH ${PICO_EXTRAS_SOURCE_DIR}) 37 | endif () 38 | set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE}) 39 | else () 40 | if (PICO_SDK_PATH AND EXISTS "${PICO_SDK_PATH}/../pico-extras") 41 | set(PICO_EXTRAS_PATH ${PICO_SDK_PATH}/../pico-extras) 42 | message("Defaulting PICO_EXTRAS_PATH as sibling of PICO_SDK_PATH: ${PICO_EXTRAS_PATH}") 43 | else() 44 | message(FATAL_ERROR 45 | "PICO EXTRAS location was not specified. Please set PICO_EXTRAS_PATH or set PICO_EXTRAS_FETCH_FROM_GIT to on to fetch from git." 46 | ) 47 | endif() 48 | endif () 49 | endif () 50 | 51 | set(PICO_EXTRAS_PATH "${PICO_EXTRAS_PATH}" CACHE PATH "Path to the PICO EXTRAS") 52 | set(PICO_EXTRAS_FETCH_FROM_GIT "${PICO_EXTRAS_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of PICO EXTRAS from git if not otherwise locatable") 53 | set(PICO_EXTRAS_FETCH_FROM_GIT_PATH "${PICO_EXTRAS_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download EXTRAS") 54 | 55 | get_filename_component(PICO_EXTRAS_PATH "${PICO_EXTRAS_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") 56 | if (NOT EXISTS ${PICO_EXTRAS_PATH}) 57 | message(FATAL_ERROR "Directory '${PICO_EXTRAS_PATH}' not found") 58 | endif () 59 | 60 | set(PICO_EXTRAS_PATH ${PICO_EXTRAS_PATH} CACHE PATH "Path to the PICO EXTRAS" FORCE) 61 | 62 | add_subdirectory(${PICO_EXTRAS_PATH} pico_extras) -------------------------------------------------------------------------------- /aaf-1202fnf/pico_sdk_import.cmake: -------------------------------------------------------------------------------- 1 | # This is a copy of /external/pico_sdk_import.cmake 2 | 3 | # This can be dropped into an external project to help locate this SDK 4 | # It should be include()ed prior to project() 5 | 6 | if (DEFINED ENV{PICO_SDK_PATH} AND (NOT PICO_SDK_PATH)) 7 | set(PICO_SDK_PATH $ENV{PICO_SDK_PATH}) 8 | message("Using PICO_SDK_PATH from environment ('${PICO_SDK_PATH}')") 9 | endif () 10 | 11 | if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT} AND (NOT PICO_SDK_FETCH_FROM_GIT)) 12 | set(PICO_SDK_FETCH_FROM_GIT $ENV{PICO_SDK_FETCH_FROM_GIT}) 13 | message("Using PICO_SDK_FETCH_FROM_GIT from environment ('${PICO_SDK_FETCH_FROM_GIT}')") 14 | endif () 15 | 16 | if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_PATH} AND (NOT PICO_SDK_FETCH_FROM_GIT_PATH)) 17 | set(PICO_SDK_FETCH_FROM_GIT_PATH $ENV{PICO_SDK_FETCH_FROM_GIT_PATH}) 18 | message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')") 19 | endif () 20 | 21 | set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the Raspberry Pi Pico SDK") 22 | set(PICO_SDK_FETCH_FROM_GIT "${PICO_SDK_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of SDK from git if not otherwise locatable") 23 | set(PICO_SDK_FETCH_FROM_GIT_PATH "${PICO_SDK_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download SDK") 24 | 25 | if (NOT PICO_SDK_PATH) 26 | if (PICO_SDK_FETCH_FROM_GIT) 27 | include(FetchContent) 28 | set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR}) 29 | if (PICO_SDK_FETCH_FROM_GIT_PATH) 30 | get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_SDK_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}") 31 | endif () 32 | FetchContent_Declare( 33 | pico_sdk 34 | GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk 35 | GIT_TAG master 36 | ) 37 | if (NOT pico_sdk) 38 | message("Downloading Raspberry Pi Pico SDK") 39 | FetchContent_Populate(pico_sdk) 40 | set(PICO_SDK_PATH ${pico_sdk_SOURCE_DIR}) 41 | endif () 42 | set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE}) 43 | else () 44 | message(FATAL_ERROR 45 | "SDK location was not specified. Please set PICO_SDK_PATH or set PICO_SDK_FETCH_FROM_GIT to on to fetch from git." 46 | ) 47 | endif () 48 | endif () 49 | 50 | get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") 51 | if (NOT EXISTS ${PICO_SDK_PATH}) 52 | message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' not found") 53 | endif () 54 | 55 | set(PICO_SDK_INIT_CMAKE_FILE ${PICO_SDK_PATH}/pico_sdk_init.cmake) 56 | if (NOT EXISTS ${PICO_SDK_INIT_CMAKE_FILE}) 57 | message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' does not appear to contain the Raspberry Pi Pico SDK") 58 | endif () 59 | 60 | set(PICO_SDK_PATH ${PICO_SDK_PATH} CACHE PATH "Path to the Raspberry Pi Pico SDK" FORCE) 61 | 62 | include(${PICO_SDK_INIT_CMAKE_FILE}) 63 | -------------------------------------------------------------------------------- /ac057tc1/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Generated Cmake Pico project file 2 | 3 | cmake_minimum_required(VERSION 3.13) 4 | 5 | set(CMAKE_C_STANDARD 11) 6 | set(CMAKE_CXX_STANDARD 17) 7 | 8 | # initalize pico_sdk from installed location 9 | # (note this can come from environment, CMake cache etc) 10 | set(PICO_SDK_PATH "/Users/andylithia/pico/pico-sdk") 11 | 12 | # Pull in Raspberry Pi Pico SDK (must be before project) 13 | include(pico_sdk_import.cmake) 14 | 15 | project(fw C CXX ASM) 16 | 17 | # Initialise the Raspberry Pi Pico SDK 18 | pico_sdk_init() 19 | 20 | # Add executable. Default name is the project name, version 0.1 21 | 22 | add_executable(fw 23 | fw.c 24 | epd.c 25 | image_3bpp.c 26 | image_6bpp.c 27 | image_9bpp.c 28 | lut.c 29 | ) 30 | 31 | pico_set_program_name(fw "fw") 32 | pico_set_program_version(fw "0.1") 33 | 34 | pico_enable_stdio_uart(fw 1) 35 | pico_enable_stdio_usb(fw 0) 36 | 37 | # Add the standard library to the build 38 | target_link_libraries(fw pico_stdlib) 39 | 40 | # Add any user requested libraries 41 | target_link_libraries(fw 42 | hardware_spi 43 | hardware_dma 44 | ) 45 | 46 | pico_add_extra_outputs(fw) 47 | 48 | -------------------------------------------------------------------------------- /ac057tc1/epd.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2024 Wenting Zhang 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | #pragma once 23 | 24 | #define EPD_BLACK 0x0 25 | #define EPD_WHITE 0x1 26 | #define EPD_GREEN 0x2 27 | #define EPD_BLUE 0x3 28 | #define EPD_RED 0x4 29 | #define EPD_YELLOW 0x5 30 | #define EPD_ORANGE 0x6 31 | 32 | #define EPD_WIDTH 600 33 | #define EPD_HEIGHT 448 34 | #define EPD_BUFLEN (EPD_WIDTH * EPD_HEIGHT / 2) 35 | 36 | void epd_init(void); 37 | void epd_clear(uint8_t color); 38 | void epd_disp_palette_3bpp(void); 39 | void epd_disp_palette_6bpp(void); 40 | void epd_disp_palette_9bpp(void); 41 | void epd_disp_image_3bpp(uint8_t *image); 42 | void epd_disp_image_6bpp(uint8_t *image); 43 | void epd_disp_image_9bpp(uint8_t *image); 44 | void epd_sleep(void); -------------------------------------------------------------------------------- /ac057tc1/fw.c: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2021 Wenting Zhang 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | #include 23 | #include "pico/stdlib.h" 24 | #include "epd.h" 25 | 26 | extern const char test_image_3bpp[]; 27 | extern const char test_image_6bpp[]; 28 | extern const char test_image_9bpp[]; 29 | 30 | int main() 31 | { 32 | stdio_init_all(); 33 | 34 | printf("START\n"); 35 | 36 | epd_init(); 37 | //epd_disp_palette_3bpp(); 38 | //epd_disp_palette_6bpp(); 39 | epd_disp_palette_9bpp(); 40 | //epd_disp_image_3bpp(test_image_3bpp); 41 | //epd_disp_image_6bpp(test_image_6bpp); 42 | //epd_disp_image_9bpp(test_image_9bpp); 43 | epd_sleep(); 44 | 45 | while (1) { 46 | // 47 | } 48 | 49 | return 0; 50 | } 51 | -------------------------------------------------------------------------------- /ac057tc1/lut.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2024 Wenting Zhang 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | #pragma once 23 | 24 | #include 25 | 26 | #define VCOM_LUT_SIZE 220 27 | #define COLOR_LUT_SIZE 260 28 | #define XON_LUT_SIZE 200 29 | 30 | #define VCOM_LUT_REG 0x20 31 | #define XON_LUT_REG 0x29 32 | 33 | typedef struct { 34 | const uint8_t *lut; 35 | uint32_t size; 36 | } lut_t; 37 | 38 | extern const lut_t lut0[10]; 39 | extern const lut_t lut1[10]; 40 | -------------------------------------------------------------------------------- /ac057tc1/pico_sdk_import.cmake: -------------------------------------------------------------------------------- 1 | # This is a copy of /external/pico_sdk_import.cmake 2 | 3 | # This can be dropped into an external project to help locate this SDK 4 | # It should be include()ed prior to project() 5 | 6 | if (DEFINED ENV{PICO_SDK_PATH} AND (NOT PICO_SDK_PATH)) 7 | set(PICO_SDK_PATH $ENV{PICO_SDK_PATH}) 8 | message("Using PICO_SDK_PATH from environment ('${PICO_SDK_PATH}')") 9 | endif () 10 | 11 | if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT} AND (NOT PICO_SDK_FETCH_FROM_GIT)) 12 | set(PICO_SDK_FETCH_FROM_GIT $ENV{PICO_SDK_FETCH_FROM_GIT}) 13 | message("Using PICO_SDK_FETCH_FROM_GIT from environment ('${PICO_SDK_FETCH_FROM_GIT}')") 14 | endif () 15 | 16 | if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_PATH} AND (NOT PICO_SDK_FETCH_FROM_GIT_PATH)) 17 | set(PICO_SDK_FETCH_FROM_GIT_PATH $ENV{PICO_SDK_FETCH_FROM_GIT_PATH}) 18 | message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')") 19 | endif () 20 | 21 | set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the Raspberry Pi Pico SDK") 22 | set(PICO_SDK_FETCH_FROM_GIT "${PICO_SDK_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of SDK from git if not otherwise locatable") 23 | set(PICO_SDK_FETCH_FROM_GIT_PATH "${PICO_SDK_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download SDK") 24 | 25 | if (NOT PICO_SDK_PATH) 26 | if (PICO_SDK_FETCH_FROM_GIT) 27 | include(FetchContent) 28 | set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR}) 29 | if (PICO_SDK_FETCH_FROM_GIT_PATH) 30 | get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_SDK_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}") 31 | endif () 32 | FetchContent_Declare( 33 | pico_sdk 34 | GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk 35 | GIT_TAG master 36 | ) 37 | if (NOT pico_sdk) 38 | message("Downloading Raspberry Pi Pico SDK") 39 | FetchContent_Populate(pico_sdk) 40 | set(PICO_SDK_PATH ${pico_sdk_SOURCE_DIR}) 41 | endif () 42 | set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE}) 43 | else () 44 | message(FATAL_ERROR 45 | "SDK location was not specified. Please set PICO_SDK_PATH or set PICO_SDK_FETCH_FROM_GIT to on to fetch from git." 46 | ) 47 | endif () 48 | endif () 49 | 50 | get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") 51 | if (NOT EXISTS ${PICO_SDK_PATH}) 52 | message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' not found") 53 | endif () 54 | 55 | set(PICO_SDK_INIT_CMAKE_FILE ${PICO_SDK_PATH}/pico_sdk_init.cmake) 56 | if (NOT EXISTS ${PICO_SDK_INIT_CMAKE_FILE}) 57 | message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' does not appear to contain the Raspberry Pi Pico SDK") 58 | endif () 59 | 60 | set(PICO_SDK_PATH ${PICO_SDK_PATH} CACHE PATH "Path to the Raspberry Pi Pico SDK" FORCE) 61 | 62 | include(${PICO_SDK_INIT_CMAKE_FILE}) 63 | -------------------------------------------------------------------------------- /bg999076a/ST7637.C: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zephray/driving-lcds/bf0a5c129f6dd3f654957116ad62a5b4d52e87bd/bg999076a/ST7637.C -------------------------------------------------------------------------------- /bg999076a/ST7637.H: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zephray/driving-lcds/bf0a5c129f6dd3f654957116ad62a5b4d52e87bd/bg999076a/ST7637.H -------------------------------------------------------------------------------- /ed060sc4/sdvideo/epd.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zephray/driving-lcds/bf0a5c129f6dd3f654957116ad62a5b4d52e87bd/ed060sc4/sdvideo/epd.c -------------------------------------------------------------------------------- /ed060sc4/sdvideo/epd.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | EPD DRIVER FOR STM32F2/4 w/ FSMC 3 | By ZephRay(zephray@outlook.com) 4 | *******************************************************************************/ 5 | #ifndef __EPD_H__ 6 | #define __EPD_H__ 7 | 8 | #include "main.h" 9 | 10 | //SOURCE DRIVER 11 | #define EPD_CL_L() GPIOA->BSRRH = GPIO_Pin_1 12 | #define EPD_CL_H() GPIOA->BSRRL = GPIO_Pin_1 13 | #define EPD_LE_L() GPIOA->BSRRH = GPIO_Pin_2 14 | #define EPD_LE_H() GPIOA->BSRRL = GPIO_Pin_2 15 | #define EPD_OE_L() GPIOA->BSRRH = GPIO_Pin_3 16 | #define EPD_OE_H() GPIOA->BSRRL = GPIO_Pin_3 17 | #define EPD_SHR_L() GPIOA->BSRRH = GPIO_Pin_4 18 | #define EPD_SHR_H() GPIOA->BSRRL = GPIO_Pin_4 19 | #define EPD_SPH_L() GPIOA->BSRRH = GPIO_Pin_5 20 | #define EPD_SPH_H() GPIOA->BSRRL = GPIO_Pin_5 21 | 22 | //GATE DRIVER 23 | #define EPD_GMODE1_L() GPIOE->BSRRH = GPIO_Pin_3 24 | #define EPD_GMODE1_H() GPIOE->BSRRL = GPIO_Pin_3 25 | #define EPD_GMODE2_L() GPIOE->BSRRH = GPIO_Pin_2 26 | #define EPD_GMODE2_H() GPIOE->BSRRL = GPIO_Pin_2 27 | #define EPD_XRL_L() GPIOE->BSRRH = GPIO_Pin_4 28 | #define EPD_XRL_H() GPIOE->BSRRL = GPIO_Pin_4 29 | #define EPD_SPV_L() GPIOA->BSRRH = GPIO_Pin_6 30 | #define EPD_SPV_H() GPIOA->BSRRL = GPIO_Pin_6 31 | #define EPD_CKV_L() GPIOA->BSRRH = GPIO_Pin_7 32 | #define EPD_CKV_H() GPIOA->BSRRL = GPIO_Pin_7 33 | 34 | 35 | void EPD_Init(void); 36 | void EPD_Power_Off(void); 37 | void EPD_Power_On(void); 38 | void EPD_Clear(void); 39 | void EPD_Refresh(unsigned char *last, unsigned char *now); 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /ed060sc4/sdvideo/font.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zephray/driving-lcds/bf0a5c129f6dd3f654957116ad62a5b4d52e87bd/ed060sc4/sdvideo/font.h -------------------------------------------------------------------------------- /ed060sc4/sdvideo/main.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zephray/driving-lcds/bf0a5c129f6dd3f654957116ad62a5b4d52e87bd/ed060sc4/sdvideo/main.c -------------------------------------------------------------------------------- /ed060sc4/sdvideo/main.h: -------------------------------------------------------------------------------- 1 | #ifndef __MAIN_H__ 2 | #define __MAIN_H__ 3 | 4 | #include "stm32f2xx.h" 5 | #include 6 | 7 | extern __IO uint8_t ShiftState; 8 | 9 | /* Exported macro ------------------------------------------------------------*/ 10 | #define ABS(x) (x < 0) ? (-x) : x 11 | /* Exported functions ------------------------------------------------------- */ 12 | void TimingDelay_Decrement(void); 13 | void Delay(__IO uint32_t nTime); 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /ed060sc4/sdvideo/sdcard.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zephray/driving-lcds/bf0a5c129f6dd3f654957116ad62a5b4d52e87bd/ed060sc4/sdvideo/sdcard.c -------------------------------------------------------------------------------- /ed060sc4/sdvideo/spi.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zephray/driving-lcds/bf0a5c129f6dd3f654957116ad62a5b4d52e87bd/ed060sc4/sdvideo/spi.c -------------------------------------------------------------------------------- /ed060sc4/sdvideo/spi.h: -------------------------------------------------------------------------------- 1 | #ifndef __SPI_H__ 2 | #define __SPI_H__ 3 | 4 | #include "main.h" 5 | 6 | void SPI1_Config(void); 7 | uint8_t SPI1_Recv(void); 8 | void SPI1_ITConfig(void); 9 | 10 | #endif -------------------------------------------------------------------------------- /ed060sc4/sdvideo/sram.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zephray/driving-lcds/bf0a5c129f6dd3f654957116ad62a5b4d52e87bd/ed060sc4/sdvideo/sram.c -------------------------------------------------------------------------------- /ed060sc4/sdvideo/sram.h: -------------------------------------------------------------------------------- 1 | #ifndef __SRAM_H__ 2 | #define __SRAM_H__ 3 | 4 | #include "main.h" 5 | 6 | void SRAM_GPIO_Config(void); 7 | void SRAM_FSMC_Config(void); 8 | 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /ed060sc4/sdvideo/stm32f2xx_conf.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file Project/STM32F2xx_StdPeriph_Template/stm32f2xx_conf.h 4 | * @author MCD Application Team 5 | * @version V1.1.0 6 | * @date 13-April-2012 7 | * @brief Library configuration file. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef __STM32F2xx_CONF_H 30 | #define __STM32F2xx_CONF_H 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | /* Uncomment the line below to enable peripheral header file inclusion */ 34 | #include "stm32f2xx_adc.h" 35 | #include "stm32f2xx_can.h" 36 | #include "stm32f2xx_crc.h" 37 | #include "stm32f2xx_cryp.h" 38 | #include "stm32f2xx_dac.h" 39 | #include "stm32f2xx_dbgmcu.h" 40 | #include "stm32f2xx_dcmi.h" 41 | #include "stm32f2xx_dma.h" 42 | #include "stm32f2xx_exti.h" 43 | #include "stm32f2xx_flash.h" 44 | #include "stm32f2xx_fsmc.h" 45 | #include "stm32f2xx_hash.h" 46 | #include "stm32f2xx_gpio.h" 47 | #include "stm32f2xx_i2c.h" 48 | #include "stm32f2xx_iwdg.h" 49 | #include "stm32f2xx_pwr.h" 50 | #include "stm32f2xx_rcc.h" 51 | #include "stm32f2xx_rng.h" 52 | #include "stm32f2xx_rtc.h" 53 | #include "stm32f2xx_sdio.h" 54 | #include "stm32f2xx_spi.h" 55 | #include "stm32f2xx_syscfg.h" 56 | #include "stm32f2xx_tim.h" 57 | #include "stm32f2xx_usart.h" 58 | #include "stm32f2xx_wwdg.h" 59 | #include "misc.h" /* High level functions for NVIC and SysTick (add-on to CMSIS functions) */ 60 | 61 | /* Exported types ------------------------------------------------------------*/ 62 | /* Exported constants --------------------------------------------------------*/ 63 | 64 | /* If an external clock source is used, then the value of the following define 65 | should be set to the value of the external clock source, else, if no external 66 | clock is used, keep this define commented */ 67 | /*#define I2S_EXTERNAL_CLOCK_VAL 12288000 */ /* Value of the external clock in Hz */ 68 | 69 | 70 | /* Uncomment the line below to expanse the "assert_param" macro in the 71 | Standard Peripheral Library drivers code */ 72 | /* #define USE_FULL_ASSERT 1 */ 73 | 74 | /* Exported macro ------------------------------------------------------------*/ 75 | #ifdef USE_FULL_ASSERT 76 | 77 | /** 78 | * @brief The assert_param macro is used for function's parameters check. 79 | * @param expr: If expr is false, it calls assert_failed function 80 | * which reports the name of the source file and the source 81 | * line number of the call that failed. 82 | * If expr is true, it returns no value. 83 | * @retval None 84 | */ 85 | #define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__)) 86 | /* Exported functions ------------------------------------------------------- */ 87 | void assert_failed(uint8_t* file, uint32_t line); 88 | #else 89 | #define assert_param(expr) ((void)0) 90 | #endif /* USE_FULL_ASSERT */ 91 | 92 | #endif /* __STM32F2xx_CONF_H */ 93 | 94 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 95 | -------------------------------------------------------------------------------- /ed060sc4/sdvideo/stm32f4xx_conf.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_conf.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 19-September-2011 7 | * @brief Library configuration file. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __STM32F4xx_CONF_H 24 | #define __STM32F4xx_CONF_H 25 | 26 | #if defined (HSE_VALUE) 27 | #undef HSE_VALUE 28 | #define HSE_VALUE ((uint32_t)25000000) 29 | #endif /* HSE_VALUE */ 30 | 31 | /* Includes ------------------------------------------------------------------*/ 32 | /* Uncomment the line below to enable peripheral header file inclusion */ 33 | #include "stm32f4xx_adc.h" 34 | #include "stm32f4xx_can.h" 35 | #include "stm32f4xx_crc.h" 36 | #include "stm32f4xx_cryp.h" 37 | #include "stm32f4xx_dac.h" 38 | #include "stm32f4xx_dbgmcu.h" 39 | #include "stm32f4xx_dcmi.h" 40 | #include "stm32f4xx_dma.h" 41 | #include "stm32f4xx_exti.h" 42 | #include "stm32f4xx_flash.h" 43 | #include "stm32f4xx_fsmc.h" 44 | #include "stm32f4xx_hash.h" 45 | #include "stm32f4xx_gpio.h" 46 | #include "stm32f4xx_i2c.h" 47 | #include "stm32f4xx_iwdg.h" 48 | #include "stm32f4xx_pwr.h" 49 | #include "stm32f4xx_rcc.h" 50 | #include "stm32f4xx_rng.h" 51 | #include "stm32f4xx_rtc.h" 52 | #include "stm32f4xx_sdio.h" 53 | #include "stm32f4xx_spi.h" 54 | #include "stm32f4xx_syscfg.h" 55 | #include "stm32f4xx_tim.h" 56 | #include "stm32f4xx_usart.h" 57 | #include "stm32f4xx_wwdg.h" 58 | #include "misc.h" /* High level functions for NVIC and SysTick (add-on to CMSIS functions) */ 59 | 60 | /* Exported types ------------------------------------------------------------*/ 61 | /* Exported constants --------------------------------------------------------*/ 62 | 63 | /* If an external clock source is used, then the value of the following define 64 | should be set to the value of the external clock source, else, if no external 65 | clock is used, keep this define commented */ 66 | /*#define I2S_EXTERNAL_CLOCK_VAL 12288000 */ /* Value of the external clock in Hz */ 67 | 68 | 69 | /* Uncomment the line below to expanse the "assert_param" macro in the 70 | Standard Peripheral Library drivers code */ 71 | /* #define USE_FULL_ASSERT 1 */ 72 | 73 | /* Exported macro ------------------------------------------------------------*/ 74 | #ifdef USE_FULL_ASSERT 75 | 76 | /** 77 | * @brief The assert_param macro is used for function's parameters check. 78 | * @param expr: If expr is false, it calls assert_failed function 79 | * which reports the name of the source file and the source 80 | * line number of the call that failed. 81 | * If expr is true, it returns no value. 82 | * @retval None 83 | */ 84 | #define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__)) 85 | /* Exported functions ------------------------------------------------------- */ 86 | void assert_failed(uint8_t* file, uint32_t line); 87 | #else 88 | #define assert_param(expr) ((void)0) 89 | #endif /* USE_FULL_ASSERT */ 90 | 91 | #endif /* __STM32F4xx_CONF_H */ 92 | 93 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 94 | -------------------------------------------------------------------------------- /ed060sc4/sdvideo/stm32f4xx_it.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_it.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 19-September-2011 7 | * @brief This file contains the headers of the interrupt handlers. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __STM32F4xx_IT_H 24 | #define __STM32F4xx_IT_H 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | /* Includes ------------------------------------------------------------------*/ 31 | 32 | /* Exported types ------------------------------------------------------------*/ 33 | /* Exported constants --------------------------------------------------------*/ 34 | /* Exported macro ------------------------------------------------------------*/ 35 | /* Exported functions ------------------------------------------------------- */ 36 | 37 | void NMI_Handler(void); 38 | void HardFault_Handler(void); 39 | void MemManage_Handler(void); 40 | void BusFault_Handler(void); 41 | void UsageFault_Handler(void); 42 | void SVC_Handler(void); 43 | void DebugMon_Handler(void); 44 | void PendSV_Handler(void); 45 | void SysTick_Handler(void); 46 | 47 | #ifdef __cplusplus 48 | } 49 | #endif 50 | 51 | #endif /* __STM32F4xx_IT_H */ 52 | 53 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 54 | -------------------------------------------------------------------------------- /ed060sc4/sdvideo/usart.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zephray/driving-lcds/bf0a5c129f6dd3f654957116ad62a5b4d52e87bd/ed060sc4/sdvideo/usart.c -------------------------------------------------------------------------------- /ed060sc4/sdvideo/usart.h: -------------------------------------------------------------------------------- 1 | #ifndef __USART_H__ 2 | #define __USART_H__ 3 | 4 | #include "main.h" 5 | 6 | #ifdef __GNUC__ 7 | /* With GCC/RAISONANCE, small printf (option LD Linker->Libraries->Small printf 8 | set to 'Yes') calls __io_putchar() */ 9 | #define PUTCHAR_PROTOTYPE int __io_putchar(int ch) 10 | #else 11 | #define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f) 12 | #endif /* __GNUC__ */ 13 | 14 | void USART1_Config(); 15 | uint8_t USART1_GetCh(void); 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /el114tr1/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Generated Cmake Pico project file 2 | 3 | cmake_minimum_required(VERSION 3.13) 4 | 5 | set(CMAKE_C_STANDARD 11) 6 | set(CMAKE_CXX_STANDARD 17) 7 | 8 | # initalize pico_sdk from installed location 9 | # (note this can come from environment, CMake cache etc) 10 | set(PICO_SDK_PATH "/Users/wenting/pico/pico-sdk") 11 | 12 | # Pull in Raspberry Pi Pico SDK (must be before project) 13 | include(pico_sdk_import.cmake) 14 | 15 | project(fw C CXX ASM) 16 | 17 | # Initialise the Raspberry Pi Pico SDK 18 | pico_sdk_init() 19 | 20 | # Add executable. Default name is the project name, version 0.1 21 | 22 | add_executable(fw 23 | main.c 24 | export.c 25 | ) 26 | 27 | pico_set_program_name(fw "fw") 28 | pico_set_program_version(fw "0.1") 29 | 30 | pico_enable_stdio_uart(fw 0) 31 | pico_enable_stdio_usb(fw 0) 32 | 33 | # Add the standard library to the build 34 | target_link_libraries(fw pico_stdlib) 35 | 36 | # Add any user requested libraries 37 | target_link_libraries(fw 38 | hardware_spi 39 | hardware_dma 40 | hardware_i2c 41 | ) 42 | 43 | pico_add_extra_outputs(fw) 44 | 45 | -------------------------------------------------------------------------------- /el114tr1/font.h: -------------------------------------------------------------------------------- 1 | static const char font[] = { 2 | 0x00, 0x00, 0x00, 0x00, 0x00,// (space) 3 | 0x00, 0x00, 0x5F, 0x00, 0x00,// ! 4 | 0x00, 0x07, 0x00, 0x07, 0x00,// " 5 | 0x14, 0x7F, 0x14, 0x7F, 0x14,// # 6 | 0x24, 0x2A, 0x7F, 0x2A, 0x12,// $ 7 | 0x23, 0x13, 0x08, 0x64, 0x62,// % 8 | 0x36, 0x49, 0x55, 0x22, 0x50,// & 9 | 0x00, 0x05, 0x03, 0x00, 0x00,// ' 10 | 0x00, 0x1C, 0x22, 0x41, 0x00,// ( 11 | 0x00, 0x41, 0x22, 0x1C, 0x00,// ) 12 | 0x08, 0x2A, 0x1C, 0x2A, 0x08,// * 13 | 0x08, 0x08, 0x3E, 0x08, 0x08,// + 14 | 0x00, 0x50, 0x30, 0x00, 0x00,// , 15 | 0x08, 0x08, 0x08, 0x08, 0x08,// - 16 | 0x00, 0x60, 0x60, 0x00, 0x00,// . 17 | 0x20, 0x10, 0x08, 0x04, 0x02,// / 18 | 0x3E, 0x51, 0x49, 0x45, 0x3E,// 0 19 | 0x00, 0x42, 0x7F, 0x40, 0x00,// 1 20 | 0x42, 0x61, 0x51, 0x49, 0x46,// 2 21 | 0x21, 0x41, 0x45, 0x4B, 0x31,// 3 22 | 0x18, 0x14, 0x12, 0x7F, 0x10,// 4 23 | 0x27, 0x45, 0x45, 0x45, 0x39,// 5 24 | 0x3C, 0x4A, 0x49, 0x49, 0x30,// 6 25 | 0x01, 0x71, 0x09, 0x05, 0x03,// 7 26 | 0x36, 0x49, 0x49, 0x49, 0x36,// 8 27 | 0x06, 0x49, 0x49, 0x29, 0x1E,// 9 28 | 0x00, 0x36, 0x36, 0x00, 0x00,// : 29 | 0x00, 0x56, 0x36, 0x00, 0x00,// ; 30 | 0x00, 0x08, 0x14, 0x22, 0x41,// < 31 | 0x14, 0x14, 0x14, 0x14, 0x14,// = 32 | 0x41, 0x22, 0x14, 0x08, 0x00,// > 33 | 0x02, 0x01, 0x51, 0x09, 0x06,// ? 34 | 0x32, 0x49, 0x79, 0x41, 0x3E,// @ 35 | 0x7E, 0x11, 0x11, 0x11, 0x7E,// A 36 | 0x7F, 0x49, 0x49, 0x49, 0x36,// B 37 | 0x3E, 0x41, 0x41, 0x41, 0x22,// C 38 | 0x7F, 0x41, 0x41, 0x22, 0x1C,// D 39 | 0x7F, 0x49, 0x49, 0x49, 0x41,// E 40 | 0x7F, 0x09, 0x09, 0x01, 0x01,// F 41 | 0x3E, 0x41, 0x41, 0x51, 0x32,// G 42 | 0x7F, 0x08, 0x08, 0x08, 0x7F,// H 43 | 0x00, 0x41, 0x7F, 0x41, 0x00,// I 44 | 0x20, 0x40, 0x41, 0x3F, 0x01,// J 45 | 0x7F, 0x08, 0x14, 0x22, 0x41,// K 46 | 0x7F, 0x40, 0x40, 0x40, 0x40,// L 47 | 0x7F, 0x02, 0x04, 0x02, 0x7F,// M 48 | 0x7F, 0x04, 0x08, 0x10, 0x7F,// N 49 | 0x3E, 0x41, 0x41, 0x41, 0x3E,// O 50 | 0x7F, 0x09, 0x09, 0x09, 0x06,// P 51 | 0x3E, 0x41, 0x51, 0x21, 0x5E,// Q 52 | 0x7F, 0x09, 0x19, 0x29, 0x46,// R 53 | 0x46, 0x49, 0x49, 0x49, 0x31,// S 54 | 0x01, 0x01, 0x7F, 0x01, 0x01,// T 55 | 0x3F, 0x40, 0x40, 0x40, 0x3F,// U 56 | 0x1F, 0x20, 0x40, 0x20, 0x1F,// V 57 | 0x7F, 0x20, 0x18, 0x20, 0x7F,// W 58 | 0x63, 0x14, 0x08, 0x14, 0x63,// X 59 | 0x03, 0x04, 0x78, 0x04, 0x03,// Y 60 | 0x61, 0x51, 0x49, 0x45, 0x43,// Z 61 | 0x00, 0x00, 0x7F, 0x41, 0x41,// [ 62 | 0x02, 0x04, 0x08, 0x10, 0x20,// "\" 63 | 0x41, 0x41, 0x7F, 0x00, 0x00,// ] 64 | 0x04, 0x02, 0x01, 0x02, 0x04,// ^ 65 | 0x40, 0x40, 0x40, 0x40, 0x40,// _ 66 | 0x00, 0x01, 0x02, 0x04, 0x00,// ` 67 | 0x20, 0x54, 0x54, 0x54, 0x78,// a 68 | 0x7F, 0x48, 0x44, 0x44, 0x38,// b 69 | 0x38, 0x44, 0x44, 0x44, 0x20,// c 70 | 0x38, 0x44, 0x44, 0x48, 0x7F,// d 71 | 0x38, 0x54, 0x54, 0x54, 0x18,// e 72 | 0x08, 0x7E, 0x09, 0x01, 0x02,// f 73 | 0x08, 0x14, 0x54, 0x54, 0x3C,// g 74 | 0x7F, 0x08, 0x04, 0x04, 0x78,// h 75 | 0x00, 0x44, 0x7D, 0x40, 0x00,// i 76 | 0x20, 0x40, 0x44, 0x3D, 0x00,// j 77 | 0x00, 0x7F, 0x10, 0x28, 0x44,// k 78 | 0x00, 0x41, 0x7F, 0x40, 0x00,// l 79 | 0x7C, 0x04, 0x18, 0x04, 0x78,// m 80 | 0x7C, 0x08, 0x04, 0x04, 0x78,// n 81 | 0x38, 0x44, 0x44, 0x44, 0x38,// o 82 | 0x7C, 0x14, 0x14, 0x14, 0x08,// p 83 | 0x08, 0x14, 0x14, 0x18, 0x7C,// q 84 | 0x7C, 0x08, 0x04, 0x04, 0x08,// r 85 | 0x48, 0x54, 0x54, 0x54, 0x20,// s 86 | 0x04, 0x3F, 0x44, 0x40, 0x20,// t 87 | 0x3C, 0x40, 0x40, 0x20, 0x7C,// u 88 | 0x1C, 0x20, 0x40, 0x20, 0x1C,// v 89 | 0x3C, 0x40, 0x30, 0x40, 0x3C,// w 90 | 0x44, 0x28, 0x10, 0x28, 0x44,// x 91 | 0x0C, 0x50, 0x50, 0x50, 0x3C,// y 92 | 0x44, 0x64, 0x54, 0x4C, 0x44,// z 93 | 0x00, 0x08, 0x36, 0x41, 0x00,// { 94 | 0x00, 0x00, 0x7F, 0x00, 0x00,// | 95 | 0x00, 0x41, 0x36, 0x08, 0x00,// } 96 | 0x08, 0x08, 0x2A, 0x1C, 0x08,// -> 97 | 0x08, 0x1C, 0x2A, 0x08, 0x08 // <- 98 | }; -------------------------------------------------------------------------------- /el114tr1/pico_sdk_import.cmake: -------------------------------------------------------------------------------- 1 | # This is a copy of /external/pico_sdk_import.cmake 2 | 3 | # This can be dropped into an external project to help locate this SDK 4 | # It should be include()ed prior to project() 5 | 6 | if (DEFINED ENV{PICO_SDK_PATH} AND (NOT PICO_SDK_PATH)) 7 | set(PICO_SDK_PATH $ENV{PICO_SDK_PATH}) 8 | message("Using PICO_SDK_PATH from environment ('${PICO_SDK_PATH}')") 9 | endif () 10 | 11 | if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT} AND (NOT PICO_SDK_FETCH_FROM_GIT)) 12 | set(PICO_SDK_FETCH_FROM_GIT $ENV{PICO_SDK_FETCH_FROM_GIT}) 13 | message("Using PICO_SDK_FETCH_FROM_GIT from environment ('${PICO_SDK_FETCH_FROM_GIT}')") 14 | endif () 15 | 16 | if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_PATH} AND (NOT PICO_SDK_FETCH_FROM_GIT_PATH)) 17 | set(PICO_SDK_FETCH_FROM_GIT_PATH $ENV{PICO_SDK_FETCH_FROM_GIT_PATH}) 18 | message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')") 19 | endif () 20 | 21 | set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the Raspberry Pi Pico SDK") 22 | set(PICO_SDK_FETCH_FROM_GIT "${PICO_SDK_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of SDK from git if not otherwise locatable") 23 | set(PICO_SDK_FETCH_FROM_GIT_PATH "${PICO_SDK_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download SDK") 24 | 25 | if (NOT PICO_SDK_PATH) 26 | if (PICO_SDK_FETCH_FROM_GIT) 27 | include(FetchContent) 28 | set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR}) 29 | if (PICO_SDK_FETCH_FROM_GIT_PATH) 30 | get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_SDK_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}") 31 | endif () 32 | FetchContent_Declare( 33 | pico_sdk 34 | GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk 35 | GIT_TAG master 36 | ) 37 | if (NOT pico_sdk) 38 | message("Downloading Raspberry Pi Pico SDK") 39 | FetchContent_Populate(pico_sdk) 40 | set(PICO_SDK_PATH ${pico_sdk_SOURCE_DIR}) 41 | endif () 42 | set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE}) 43 | else () 44 | message(FATAL_ERROR 45 | "SDK location was not specified. Please set PICO_SDK_PATH or set PICO_SDK_FETCH_FROM_GIT to on to fetch from git." 46 | ) 47 | endif () 48 | endif () 49 | 50 | get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") 51 | if (NOT EXISTS ${PICO_SDK_PATH}) 52 | message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' not found") 53 | endif () 54 | 55 | set(PICO_SDK_INIT_CMAKE_FILE ${PICO_SDK_PATH}/pico_sdk_init.cmake) 56 | if (NOT EXISTS ${PICO_SDK_INIT_CMAKE_FILE}) 57 | message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' does not appear to contain the Raspberry Pi Pico SDK") 58 | endif () 59 | 60 | set(PICO_SDK_PATH ${PICO_SDK_PATH} CACHE PATH "Path to the Raspberry Pi Pico SDK" FORCE) 61 | 62 | include(${PICO_SDK_INIT_CMAKE_FILE}) 63 | -------------------------------------------------------------------------------- /el640480am1/bitbang/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Generated Cmake Pico project file 2 | 3 | cmake_minimum_required(VERSION 3.13) 4 | 5 | set(CMAKE_C_STANDARD 11) 6 | set(CMAKE_CXX_STANDARD 17) 7 | 8 | # initalize pico_sdk from installed location 9 | # (note this can come from environment, CMake cache etc) 10 | set(PICO_SDK_PATH "/home/wenting/pico/pico-sdk") 11 | set(PICO_EXTRAS_PATH "/home/wenting/pico/pico-extras") 12 | 13 | # Pull in Raspberry Pi Pico SDK (must be before project) 14 | include(pico_sdk_import.cmake) 15 | 16 | # We also need PICO EXTRAS 17 | include(pico_extras_import.cmake) 18 | 19 | project(eldemo C CXX ASM) 20 | 21 | # Initialise the Raspberry Pi Pico SDK 22 | pico_sdk_init() 23 | 24 | add_executable(eldemo) 25 | 26 | target_sources(eldemo PRIVATE 27 | main.c 28 | el.c 29 | ) 30 | 31 | pico_set_program_name(eldemo "eldemo") 32 | pico_set_program_version(eldemo "0.1") 33 | 34 | pico_enable_stdio_uart(eldemo 0) 35 | pico_enable_stdio_usb(eldemo 0) 36 | 37 | target_include_directories(eldemo PRIVATE ${CMAKE_CURRENT_LIST_DIR}) 38 | 39 | # Add the standard library to the build 40 | target_link_libraries(eldemo pico_stdlib hardware_dma) 41 | 42 | # Add any user requested libraries 43 | target_link_libraries(eldemo 44 | hardware_pio 45 | ) 46 | 47 | pico_add_extra_outputs(eldemo) 48 | 49 | -------------------------------------------------------------------------------- /el640480am1/bitbang/el.c: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2021 Wenting Zhang 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | #include 23 | #include 24 | #include "pico/stdlib.h" 25 | #include "el.h" 26 | 27 | unsigned char framebuf[SCR_STRIDE * SCR_HEIGHT]; 28 | 29 | void el_start() { 30 | memset(framebuf, 0x00, SCR_STRIDE * SCR_HEIGHT); 31 | 32 | gpio_init(HSYNC_PIN); 33 | gpio_set_dir(HSYNC_PIN, GPIO_OUT); 34 | gpio_init(VSYNC_PIN); 35 | gpio_set_dir(VSYNC_PIN, GPIO_OUT); 36 | gpio_init(PIXCLK_PIN); 37 | gpio_set_dir(PIXCLK_PIN, GPIO_OUT); 38 | 39 | for (int i = 0; i < 4; i++) { 40 | gpio_init(UD0_PIN + i); 41 | gpio_set_dir(UD0_PIN + i, GPIO_OUT); 42 | gpio_init(LD0_PIN + i); 43 | gpio_set_dir(LD0_PIN + i, GPIO_OUT); 44 | } 45 | } 46 | 47 | static void delay(uint32_t x) { 48 | while(x--); 49 | } 50 | 51 | void el_frame() { 52 | uint8_t *rdptr_ud = framebuf; 53 | uint8_t *rdptr_ld = framebuf + SCR_STRIDE * SCR_HEIGHT / 2; 54 | for (int y = 0; y < SCR_HEIGHT / 2; y++) { 55 | for (int x = 0; x < SCR_STRIDE; x++) { 56 | uint8_t du = *rdptr_ud++; 57 | uint8_t dl = *rdptr_ld++; 58 | for (int b = 0; b < 2; b++) { 59 | gpio_put(PIXCLK_PIN, 1); 60 | gpio_put(LD0_PIN, dl & 0x01); 61 | gpio_put(LD1_PIN, dl & 0x02); 62 | gpio_put(LD2_PIN, dl & 0x04); 63 | gpio_put(LD3_PIN, dl & 0x08); 64 | gpio_put(UD0_PIN, du & 0x01); 65 | gpio_put(UD1_PIN, du & 0x02); 66 | gpio_put(UD2_PIN, du & 0x04); 67 | gpio_put(UD3_PIN, du & 0x08); 68 | gpio_put(PIXCLK_PIN, 0); 69 | dl >>= 4; 70 | du >>= 4; 71 | } 72 | } 73 | gpio_put(HSYNC_PIN, 1); 74 | gpio_put(VSYNC_PIN, (y == 0) ? 1 : 0); 75 | delay(15); 76 | gpio_put(HSYNC_PIN, 0); 77 | delay(5); 78 | gpio_put(VSYNC_PIN, 0); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /el640480am1/bitbang/el.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2021 Wenting Zhang 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | #pragma once 23 | 24 | #define VSYNC_PIN (15) 25 | #define HSYNC_PIN (14) 26 | #define PIXCLK_PIN (4) 27 | // UD0-3: 5-8 28 | #define UD0_PIN (6) 29 | #define UD1_PIN (7) 30 | #define UD2_PIN (8) 31 | #define UD3_PIN (9) 32 | // LD0-3: 9-12 33 | #define LD0_PIN (10) 34 | #define LD1_PIN (11) 35 | #define LD2_PIN (12) 36 | #define LD3_PIN (13) 37 | 38 | // PIO related 39 | #define EL_UDATA_SM (0) 40 | #define EL_LDATA_SM (1) 41 | 42 | // Screen related 43 | #define EL_TARGET_PIXCLK (4500000) 44 | 45 | #define SCR_WIDTH (640) 46 | #define SCR_HEIGHT (480) 47 | #define SCR_LINE_TRANSFERS (SCR_WIDTH / 4) 48 | #define SCR_STRIDE (SCR_WIDTH / 8) 49 | #define SCR_STRIDE_WORDS (SCR_WIDTH / 32) 50 | #define SCR_REFRESH_LINES (SCR_HEIGHT / 2) 51 | 52 | // Public variables and functions 53 | extern unsigned char framebuf[SCR_STRIDE * SCR_HEIGHT]; 54 | extern volatile bool frame_sync; 55 | 56 | void el_start(); 57 | void el_frame(); 58 | -------------------------------------------------------------------------------- /el640480am1/bitbang/main.c: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2021 Wenting Zhang 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | #include 23 | #include 24 | #include "pico/stdlib.h" 25 | #include "font.h" 26 | #include "el.h" 27 | #include "sample_text.h" 28 | 29 | static void putpixel(unsigned char *buf, int x, int y, int c) { 30 | if (c) 31 | buf[SCR_STRIDE * y + x / 8] |= 1 << (x % 8); 32 | else 33 | buf[SCR_STRIDE * y + x / 8] &= ~(1 << (x % 8)); 34 | } 35 | 36 | void put_char(unsigned char *buf, int x, int y, char c, int fg, int bg) { 37 | int i, j, p; 38 | for(i = 0; i < 6; i++) 39 | { 40 | for(j = 8; j > 0; j--) 41 | { 42 | p = charMap_ascii_mini[(unsigned char)c][i] << j ; 43 | if (p & 0x80) 44 | putpixel(buf, x + i, y + 8 - j, fg); 45 | else 46 | putpixel(buf, x + i, y + 8 - j, bg); 47 | } 48 | } 49 | } 50 | 51 | void put_string(unsigned char *buf, int x, int y, char *str, int fg, int bg) { 52 | while (*str) { 53 | char c = *str++; 54 | if ((c == '\n') || (x > SCR_WIDTH)) { 55 | y += 8; 56 | x = 0; 57 | } 58 | if (c != '\n') 59 | put_char(buf, x, y, c, fg, bg); 60 | x += 6; 61 | } 62 | } 63 | 64 | int main() 65 | { 66 | stdio_init_all(); 67 | 68 | const uint LED_PIN = PICO_DEFAULT_LED_PIN; 69 | gpio_init(LED_PIN); 70 | gpio_set_dir(LED_PIN, GPIO_OUT); 71 | 72 | gpio_put(LED_PIN, 1); 73 | sleep_ms(250); 74 | gpio_put(LED_PIN, 0); 75 | sleep_ms(250); 76 | 77 | el_start(); 78 | 79 | put_string(framebuf, 0, 0, text, 1, 0); 80 | 81 | while(1) { 82 | el_frame(); 83 | } 84 | 85 | return 0; 86 | } 87 | -------------------------------------------------------------------------------- /el640480am1/bitbang/pico_extras_import.cmake: -------------------------------------------------------------------------------- 1 | # This is a copy of /external/pico_extras_import.cmake 2 | 3 | # This can be dropped into an external project to help locate pico-extras 4 | # It should be include()ed prior to project() 5 | 6 | if (DEFINED ENV{PICO_EXTRAS_PATH} AND (NOT PICO_EXTRAS_PATH)) 7 | set(PICO_EXTRAS_PATH $ENV{PICO_EXTRAS_PATH}) 8 | message("Using PICO_EXTRAS_PATH from environment ('${PICO_EXTRAS_PATH}')") 9 | endif () 10 | 11 | if (DEFINED ENV{PICO_EXTRAS_FETCH_FROM_GIT} AND (NOT PICO_EXTRAS_FETCH_FROM_GIT)) 12 | set(PICO_EXTRAS_FETCH_FROM_GIT $ENV{PICO_EXTRAS_FETCH_FROM_GIT}) 13 | message("Using PICO_EXTRAS_FETCH_FROM_GIT from environment ('${PICO_EXTRAS_FETCH_FROM_GIT}')") 14 | endif () 15 | 16 | if (DEFINED ENV{PICO_EXTRAS_FETCH_FROM_GIT_PATH} AND (NOT PICO_EXTRAS_FETCH_FROM_GIT_PATH)) 17 | set(PICO_EXTRAS_FETCH_FROM_GIT_PATH $ENV{PICO_EXTRAS_FETCH_FROM_GIT_PATH}) 18 | message("Using PICO_EXTRAS_FETCH_FROM_GIT_PATH from environment ('${PICO_EXTRAS_FETCH_FROM_GIT_PATH}')") 19 | endif () 20 | 21 | if (NOT PICO_EXTRAS_PATH) 22 | if (PICO_EXTRAS_FETCH_FROM_GIT) 23 | include(FetchContent) 24 | set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR}) 25 | if (PICO_EXTRAS_FETCH_FROM_GIT_PATH) 26 | get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_EXTRAS_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}") 27 | endif () 28 | FetchContent_Declare( 29 | PICO_EXTRAS 30 | GIT_REPOSITORY https://github.com/raspberrypi/pico-extras 31 | GIT_TAG master 32 | ) 33 | if (NOT PICO_EXTRAS) 34 | message("Downloading PICO EXTRAS") 35 | FetchContent_Populate(PICO_EXTRAS) 36 | set(PICO_EXTRAS_PATH ${PICO_EXTRAS_SOURCE_DIR}) 37 | endif () 38 | set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE}) 39 | else () 40 | if (PICO_SDK_PATH AND EXISTS "${PICO_SDK_PATH}/../pico-extras") 41 | set(PICO_EXTRAS_PATH ${PICO_SDK_PATH}/../pico-extras) 42 | message("Defaulting PICO_EXTRAS_PATH as sibling of PICO_SDK_PATH: ${PICO_EXTRAS_PATH}") 43 | else() 44 | message(FATAL_ERROR 45 | "PICO EXTRAS location was not specified. Please set PICO_EXTRAS_PATH or set PICO_EXTRAS_FETCH_FROM_GIT to on to fetch from git." 46 | ) 47 | endif() 48 | endif () 49 | endif () 50 | 51 | set(PICO_EXTRAS_PATH "${PICO_EXTRAS_PATH}" CACHE PATH "Path to the PICO EXTRAS") 52 | set(PICO_EXTRAS_FETCH_FROM_GIT "${PICO_EXTRAS_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of PICO EXTRAS from git if not otherwise locatable") 53 | set(PICO_EXTRAS_FETCH_FROM_GIT_PATH "${PICO_EXTRAS_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download EXTRAS") 54 | 55 | get_filename_component(PICO_EXTRAS_PATH "${PICO_EXTRAS_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") 56 | if (NOT EXISTS ${PICO_EXTRAS_PATH}) 57 | message(FATAL_ERROR "Directory '${PICO_EXTRAS_PATH}' not found") 58 | endif () 59 | 60 | set(PICO_EXTRAS_PATH ${PICO_EXTRAS_PATH} CACHE PATH "Path to the PICO EXTRAS" FORCE) 61 | 62 | add_subdirectory(${PICO_EXTRAS_PATH} pico_extras) -------------------------------------------------------------------------------- /el640480am1/bitbang/pico_sdk_import.cmake: -------------------------------------------------------------------------------- 1 | # This is a copy of /external/pico_sdk_import.cmake 2 | 3 | # This can be dropped into an external project to help locate this SDK 4 | # It should be include()ed prior to project() 5 | 6 | if (DEFINED ENV{PICO_SDK_PATH} AND (NOT PICO_SDK_PATH)) 7 | set(PICO_SDK_PATH $ENV{PICO_SDK_PATH}) 8 | message("Using PICO_SDK_PATH from environment ('${PICO_SDK_PATH}')") 9 | endif () 10 | 11 | if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT} AND (NOT PICO_SDK_FETCH_FROM_GIT)) 12 | set(PICO_SDK_FETCH_FROM_GIT $ENV{PICO_SDK_FETCH_FROM_GIT}) 13 | message("Using PICO_SDK_FETCH_FROM_GIT from environment ('${PICO_SDK_FETCH_FROM_GIT}')") 14 | endif () 15 | 16 | if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_PATH} AND (NOT PICO_SDK_FETCH_FROM_GIT_PATH)) 17 | set(PICO_SDK_FETCH_FROM_GIT_PATH $ENV{PICO_SDK_FETCH_FROM_GIT_PATH}) 18 | message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')") 19 | endif () 20 | 21 | set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the Raspberry Pi Pico SDK") 22 | set(PICO_SDK_FETCH_FROM_GIT "${PICO_SDK_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of SDK from git if not otherwise locatable") 23 | set(PICO_SDK_FETCH_FROM_GIT_PATH "${PICO_SDK_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download SDK") 24 | 25 | if (NOT PICO_SDK_PATH) 26 | if (PICO_SDK_FETCH_FROM_GIT) 27 | include(FetchContent) 28 | set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR}) 29 | if (PICO_SDK_FETCH_FROM_GIT_PATH) 30 | get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_SDK_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}") 31 | endif () 32 | FetchContent_Declare( 33 | pico_sdk 34 | GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk 35 | GIT_TAG master 36 | ) 37 | if (NOT pico_sdk) 38 | message("Downloading Raspberry Pi Pico SDK") 39 | FetchContent_Populate(pico_sdk) 40 | set(PICO_SDK_PATH ${pico_sdk_SOURCE_DIR}) 41 | endif () 42 | set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE}) 43 | else () 44 | message(FATAL_ERROR 45 | "SDK location was not specified. Please set PICO_SDK_PATH or set PICO_SDK_FETCH_FROM_GIT to on to fetch from git." 46 | ) 47 | endif () 48 | endif () 49 | 50 | get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") 51 | if (NOT EXISTS ${PICO_SDK_PATH}) 52 | message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' not found") 53 | endif () 54 | 55 | set(PICO_SDK_INIT_CMAKE_FILE ${PICO_SDK_PATH}/pico_sdk_init.cmake) 56 | if (NOT EXISTS ${PICO_SDK_INIT_CMAKE_FILE}) 57 | message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' does not appear to contain the Raspberry Pi Pico SDK") 58 | endif () 59 | 60 | set(PICO_SDK_PATH ${PICO_SDK_PATH} CACHE PATH "Path to the Raspberry Pi Pico SDK" FORCE) 61 | 62 | include(${PICO_SDK_INIT_CMAKE_FILE}) 63 | -------------------------------------------------------------------------------- /el640480am1/frame_dma_pio/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Generated Cmake Pico project file 2 | 3 | cmake_minimum_required(VERSION 3.13) 4 | 5 | set(CMAKE_C_STANDARD 11) 6 | set(CMAKE_CXX_STANDARD 17) 7 | 8 | # initalize pico_sdk from installed location 9 | # (note this can come from environment, CMake cache etc) 10 | set(PICO_SDK_PATH "/home/wenting/pico/pico-sdk") 11 | set(PICO_EXTRAS_PATH "/home/wenting/pico/pico-extras") 12 | 13 | # Pull in Raspberry Pi Pico SDK (must be before project) 14 | include(pico_sdk_import.cmake) 15 | 16 | # We also need PICO EXTRAS 17 | include(pico_extras_import.cmake) 18 | 19 | project(eldemo C CXX ASM) 20 | 21 | # Initialise the Raspberry Pi Pico SDK 22 | pico_sdk_init() 23 | 24 | add_executable(eldemo) 25 | 26 | pico_generate_pio_header(eldemo ${CMAKE_CURRENT_LIST_DIR}/eldata.pio) 27 | 28 | target_sources(eldemo PRIVATE 29 | main.c 30 | el.c 31 | ) 32 | 33 | pico_set_program_name(eldemo "eldemo") 34 | pico_set_program_version(eldemo "0.1") 35 | 36 | pico_enable_stdio_uart(eldemo 0) 37 | pico_enable_stdio_usb(eldemo 0) 38 | 39 | target_include_directories(eldemo PRIVATE ${CMAKE_CURRENT_LIST_DIR}) 40 | 41 | # Add the standard library to the build 42 | target_link_libraries(eldemo pico_stdlib hardware_dma) 43 | 44 | # Add any user requested libraries 45 | target_link_libraries(eldemo 46 | hardware_pio 47 | ) 48 | 49 | pico_add_extra_outputs(eldemo) 50 | 51 | -------------------------------------------------------------------------------- /el640480am1/frame_dma_pio/el.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2021 Wenting Zhang 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | #pragma once 23 | 24 | #define VSYNC_PIN (15) 25 | #define HSYNC_PIN (14) 26 | #define PIXCLK_PIN (4) 27 | // UD0-3: 5-8 28 | #define UD0_PIN (6) 29 | #define UD1_PIN (7) 30 | #define UD2_PIN (8) 31 | #define UD3_PIN (9) 32 | // LD0-3: 9-12 33 | #define LD0_PIN (10) 34 | #define LD1_PIN (11) 35 | #define LD2_PIN (12) 36 | #define LD3_PIN (13) 37 | 38 | // PIO related 39 | #define EL_UDATA_SM (0) 40 | #define EL_LDATA_SM (1) 41 | 42 | // Screen related 43 | #define EL_TARGET_PIXCLK (4500000) 44 | 45 | #define SCR_WIDTH (640) 46 | #define SCR_HEIGHT (480) 47 | #define SCR_LINE_TRANSFERS (SCR_WIDTH / 4) 48 | #define SCR_STRIDE (SCR_WIDTH / 8) 49 | #define SCR_STRIDE_WORDS (SCR_WIDTH / 32) 50 | #define SCR_REFRESH_LINES (SCR_HEIGHT / 2) 51 | 52 | // Public variables and functions 53 | extern unsigned char framebuf_bp0[SCR_STRIDE * SCR_HEIGHT]; 54 | extern unsigned char framebuf_bp1[SCR_STRIDE * SCR_HEIGHT]; 55 | extern volatile int frame_scroll_lines; 56 | extern volatile bool frame_sync; 57 | 58 | void el_start(); 59 | unsigned char *el_swap_buffer(); -------------------------------------------------------------------------------- /el640480am1/frame_dma_pio/eldata.pio: -------------------------------------------------------------------------------- 1 | 2 | ; UDATA SM handles UD0-3, PCLK, and VSYNC 3 | ; PCLK is mapped to SIDE, VSYNC is mapped to SET, and UD0-3 are mapped to OUT 4 | .program el_udata 5 | .side_set 1 6 | irq set 5 side 0 7 | mov x, isr side 0 8 | loop_first_line: 9 | out pins, 4 side 1 10 | jmp x-- loop_first_line side 0 11 | end_first_line: 12 | set pins, 1 [6] side 0 13 | set pins, 0 [9] side 0 14 | line_start: 15 | irq set 5 side 0 16 | mov x, isr side 0 17 | loop: 18 | out pins, 4 side 1 ; Output 4 bit data 19 | jmp x-- loop side 0 ; Loop until x hits 0, then wait for next line 20 | loop_end: 21 | nop [15] side 0 22 | jmp y-- line_start side 0 23 | ; end of frame, signal CPU 24 | irq wait 1 side 0 25 | 26 | 27 | ; LDATA SM handles LD0-3 and HSYNC 28 | ; HSYNC is mapped to SET, and LD0-3 are mapped to OUT 29 | .program el_ldata 30 | ; Signal UDATA SM to start outputting data 31 | mov x, isr 32 | wait irq 5 33 | loop: 34 | out pins, 4 35 | jmp x-- loop 36 | ; toggle Hsync and signal Vsync SM 37 | set pins, 1 [5] 38 | set pins, 0 [10] 39 | -------------------------------------------------------------------------------- /el640480am1/frame_dma_pio/pico_extras_import.cmake: -------------------------------------------------------------------------------- 1 | # This is a copy of /external/pico_extras_import.cmake 2 | 3 | # This can be dropped into an external project to help locate pico-extras 4 | # It should be include()ed prior to project() 5 | 6 | if (DEFINED ENV{PICO_EXTRAS_PATH} AND (NOT PICO_EXTRAS_PATH)) 7 | set(PICO_EXTRAS_PATH $ENV{PICO_EXTRAS_PATH}) 8 | message("Using PICO_EXTRAS_PATH from environment ('${PICO_EXTRAS_PATH}')") 9 | endif () 10 | 11 | if (DEFINED ENV{PICO_EXTRAS_FETCH_FROM_GIT} AND (NOT PICO_EXTRAS_FETCH_FROM_GIT)) 12 | set(PICO_EXTRAS_FETCH_FROM_GIT $ENV{PICO_EXTRAS_FETCH_FROM_GIT}) 13 | message("Using PICO_EXTRAS_FETCH_FROM_GIT from environment ('${PICO_EXTRAS_FETCH_FROM_GIT}')") 14 | endif () 15 | 16 | if (DEFINED ENV{PICO_EXTRAS_FETCH_FROM_GIT_PATH} AND (NOT PICO_EXTRAS_FETCH_FROM_GIT_PATH)) 17 | set(PICO_EXTRAS_FETCH_FROM_GIT_PATH $ENV{PICO_EXTRAS_FETCH_FROM_GIT_PATH}) 18 | message("Using PICO_EXTRAS_FETCH_FROM_GIT_PATH from environment ('${PICO_EXTRAS_FETCH_FROM_GIT_PATH}')") 19 | endif () 20 | 21 | if (NOT PICO_EXTRAS_PATH) 22 | if (PICO_EXTRAS_FETCH_FROM_GIT) 23 | include(FetchContent) 24 | set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR}) 25 | if (PICO_EXTRAS_FETCH_FROM_GIT_PATH) 26 | get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_EXTRAS_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}") 27 | endif () 28 | FetchContent_Declare( 29 | PICO_EXTRAS 30 | GIT_REPOSITORY https://github.com/raspberrypi/pico-extras 31 | GIT_TAG master 32 | ) 33 | if (NOT PICO_EXTRAS) 34 | message("Downloading PICO EXTRAS") 35 | FetchContent_Populate(PICO_EXTRAS) 36 | set(PICO_EXTRAS_PATH ${PICO_EXTRAS_SOURCE_DIR}) 37 | endif () 38 | set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE}) 39 | else () 40 | if (PICO_SDK_PATH AND EXISTS "${PICO_SDK_PATH}/../pico-extras") 41 | set(PICO_EXTRAS_PATH ${PICO_SDK_PATH}/../pico-extras) 42 | message("Defaulting PICO_EXTRAS_PATH as sibling of PICO_SDK_PATH: ${PICO_EXTRAS_PATH}") 43 | else() 44 | message(FATAL_ERROR 45 | "PICO EXTRAS location was not specified. Please set PICO_EXTRAS_PATH or set PICO_EXTRAS_FETCH_FROM_GIT to on to fetch from git." 46 | ) 47 | endif() 48 | endif () 49 | endif () 50 | 51 | set(PICO_EXTRAS_PATH "${PICO_EXTRAS_PATH}" CACHE PATH "Path to the PICO EXTRAS") 52 | set(PICO_EXTRAS_FETCH_FROM_GIT "${PICO_EXTRAS_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of PICO EXTRAS from git if not otherwise locatable") 53 | set(PICO_EXTRAS_FETCH_FROM_GIT_PATH "${PICO_EXTRAS_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download EXTRAS") 54 | 55 | get_filename_component(PICO_EXTRAS_PATH "${PICO_EXTRAS_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") 56 | if (NOT EXISTS ${PICO_EXTRAS_PATH}) 57 | message(FATAL_ERROR "Directory '${PICO_EXTRAS_PATH}' not found") 58 | endif () 59 | 60 | set(PICO_EXTRAS_PATH ${PICO_EXTRAS_PATH} CACHE PATH "Path to the PICO EXTRAS" FORCE) 61 | 62 | add_subdirectory(${PICO_EXTRAS_PATH} pico_extras) -------------------------------------------------------------------------------- /el640480am1/frame_dma_pio/pico_sdk_import.cmake: -------------------------------------------------------------------------------- 1 | # This is a copy of /external/pico_sdk_import.cmake 2 | 3 | # This can be dropped into an external project to help locate this SDK 4 | # It should be include()ed prior to project() 5 | 6 | if (DEFINED ENV{PICO_SDK_PATH} AND (NOT PICO_SDK_PATH)) 7 | set(PICO_SDK_PATH $ENV{PICO_SDK_PATH}) 8 | message("Using PICO_SDK_PATH from environment ('${PICO_SDK_PATH}')") 9 | endif () 10 | 11 | if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT} AND (NOT PICO_SDK_FETCH_FROM_GIT)) 12 | set(PICO_SDK_FETCH_FROM_GIT $ENV{PICO_SDK_FETCH_FROM_GIT}) 13 | message("Using PICO_SDK_FETCH_FROM_GIT from environment ('${PICO_SDK_FETCH_FROM_GIT}')") 14 | endif () 15 | 16 | if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_PATH} AND (NOT PICO_SDK_FETCH_FROM_GIT_PATH)) 17 | set(PICO_SDK_FETCH_FROM_GIT_PATH $ENV{PICO_SDK_FETCH_FROM_GIT_PATH}) 18 | message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')") 19 | endif () 20 | 21 | set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the Raspberry Pi Pico SDK") 22 | set(PICO_SDK_FETCH_FROM_GIT "${PICO_SDK_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of SDK from git if not otherwise locatable") 23 | set(PICO_SDK_FETCH_FROM_GIT_PATH "${PICO_SDK_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download SDK") 24 | 25 | if (NOT PICO_SDK_PATH) 26 | if (PICO_SDK_FETCH_FROM_GIT) 27 | include(FetchContent) 28 | set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR}) 29 | if (PICO_SDK_FETCH_FROM_GIT_PATH) 30 | get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_SDK_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}") 31 | endif () 32 | FetchContent_Declare( 33 | pico_sdk 34 | GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk 35 | GIT_TAG master 36 | ) 37 | if (NOT pico_sdk) 38 | message("Downloading Raspberry Pi Pico SDK") 39 | FetchContent_Populate(pico_sdk) 40 | set(PICO_SDK_PATH ${pico_sdk_SOURCE_DIR}) 41 | endif () 42 | set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE}) 43 | else () 44 | message(FATAL_ERROR 45 | "SDK location was not specified. Please set PICO_SDK_PATH or set PICO_SDK_FETCH_FROM_GIT to on to fetch from git." 46 | ) 47 | endif () 48 | endif () 49 | 50 | get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") 51 | if (NOT EXISTS ${PICO_SDK_PATH}) 52 | message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' not found") 53 | endif () 54 | 55 | set(PICO_SDK_INIT_CMAKE_FILE ${PICO_SDK_PATH}/pico_sdk_init.cmake) 56 | if (NOT EXISTS ${PICO_SDK_INIT_CMAKE_FILE}) 57 | message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' does not appear to contain the Raspberry Pi Pico SDK") 58 | endif () 59 | 60 | set(PICO_SDK_PATH ${PICO_SDK_PATH} CACHE PATH "Path to the Raspberry Pi Pico SDK" FORCE) 61 | 62 | include(${PICO_SDK_INIT_CMAKE_FILE}) 63 | -------------------------------------------------------------------------------- /el640480am1/line_dma_pio/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Generated Cmake Pico project file 2 | 3 | cmake_minimum_required(VERSION 3.13) 4 | 5 | set(CMAKE_C_STANDARD 11) 6 | set(CMAKE_CXX_STANDARD 17) 7 | 8 | # initalize pico_sdk from installed location 9 | # (note this can come from environment, CMake cache etc) 10 | set(PICO_SDK_PATH "/home/wenting/pico/pico-sdk") 11 | set(PICO_EXTRAS_PATH "/home/wenting/pico/pico-extras") 12 | 13 | # Pull in Raspberry Pi Pico SDK (must be before project) 14 | include(pico_sdk_import.cmake) 15 | 16 | # We also need PICO EXTRAS 17 | include(pico_extras_import.cmake) 18 | 19 | project(eldemo C CXX ASM) 20 | 21 | # Initialise the Raspberry Pi Pico SDK 22 | pico_sdk_init() 23 | 24 | add_executable(eldemo) 25 | 26 | pico_generate_pio_header(eldemo ${CMAKE_CURRENT_LIST_DIR}/eldata.pio) 27 | 28 | target_sources(eldemo PRIVATE 29 | main.c 30 | el.c 31 | ) 32 | 33 | pico_set_program_name(eldemo "eldemo") 34 | pico_set_program_version(eldemo "0.1") 35 | 36 | pico_enable_stdio_uart(eldemo 0) 37 | pico_enable_stdio_usb(eldemo 0) 38 | 39 | target_include_directories(eldemo PRIVATE ${CMAKE_CURRENT_LIST_DIR}) 40 | 41 | # Add the standard library to the build 42 | target_link_libraries(eldemo pico_stdlib hardware_dma) 43 | 44 | # Add any user requested libraries 45 | target_link_libraries(eldemo 46 | hardware_pio 47 | ) 48 | 49 | pico_add_extra_outputs(eldemo) 50 | 51 | -------------------------------------------------------------------------------- /el640480am1/line_dma_pio/el.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2021 Wenting Zhang 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | #pragma once 23 | 24 | #define VSYNC_PIN (15) 25 | #define HSYNC_PIN (14) 26 | #define PIXCLK_PIN (4) 27 | // UD0-3: 5-8 28 | #define UD0_PIN (6) 29 | #define UD1_PIN (7) 30 | #define UD2_PIN (8) 31 | #define UD3_PIN (9) 32 | // LD0-3: 9-12 33 | #define LD0_PIN (10) 34 | #define LD1_PIN (11) 35 | #define LD2_PIN (12) 36 | #define LD3_PIN (13) 37 | 38 | // PIO related 39 | #define EL_UDATA_SM (0) 40 | #define EL_LDATA_SM (1) 41 | 42 | // Screen related 43 | #define EL_TARGET_PIXCLK (4500000) 44 | 45 | #define SCR_WIDTH (640) 46 | #define SCR_HEIGHT (480) 47 | #define SCR_LINE_TRANSFERS (SCR_WIDTH / 4) 48 | #define SCR_STRIDE (SCR_WIDTH / 8) 49 | #define SCR_STRIDE_WORDS (SCR_WIDTH / 32) 50 | #define SCR_REFRESH_LINES (SCR_HEIGHT / 2) 51 | 52 | // Public variables and functions 53 | extern unsigned char framebuf[SCR_STRIDE * SCR_HEIGHT]; 54 | extern volatile bool frame_sync; 55 | 56 | void el_start(); 57 | void el_frame(); 58 | -------------------------------------------------------------------------------- /el640480am1/line_dma_pio/eldata.pio: -------------------------------------------------------------------------------- 1 | 2 | .program el_udata 3 | .side_set 1 4 | .wrap_target 5 | out pins, 4 side 1 6 | nop side 0 7 | .wrap 8 | 9 | .program el_ldata 10 | .wrap_target 11 | out pins, 4 12 | nop 13 | .wrap -------------------------------------------------------------------------------- /el640480am1/line_dma_pio/pico_extras_import.cmake: -------------------------------------------------------------------------------- 1 | # This is a copy of /external/pico_extras_import.cmake 2 | 3 | # This can be dropped into an external project to help locate pico-extras 4 | # It should be include()ed prior to project() 5 | 6 | if (DEFINED ENV{PICO_EXTRAS_PATH} AND (NOT PICO_EXTRAS_PATH)) 7 | set(PICO_EXTRAS_PATH $ENV{PICO_EXTRAS_PATH}) 8 | message("Using PICO_EXTRAS_PATH from environment ('${PICO_EXTRAS_PATH}')") 9 | endif () 10 | 11 | if (DEFINED ENV{PICO_EXTRAS_FETCH_FROM_GIT} AND (NOT PICO_EXTRAS_FETCH_FROM_GIT)) 12 | set(PICO_EXTRAS_FETCH_FROM_GIT $ENV{PICO_EXTRAS_FETCH_FROM_GIT}) 13 | message("Using PICO_EXTRAS_FETCH_FROM_GIT from environment ('${PICO_EXTRAS_FETCH_FROM_GIT}')") 14 | endif () 15 | 16 | if (DEFINED ENV{PICO_EXTRAS_FETCH_FROM_GIT_PATH} AND (NOT PICO_EXTRAS_FETCH_FROM_GIT_PATH)) 17 | set(PICO_EXTRAS_FETCH_FROM_GIT_PATH $ENV{PICO_EXTRAS_FETCH_FROM_GIT_PATH}) 18 | message("Using PICO_EXTRAS_FETCH_FROM_GIT_PATH from environment ('${PICO_EXTRAS_FETCH_FROM_GIT_PATH}')") 19 | endif () 20 | 21 | if (NOT PICO_EXTRAS_PATH) 22 | if (PICO_EXTRAS_FETCH_FROM_GIT) 23 | include(FetchContent) 24 | set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR}) 25 | if (PICO_EXTRAS_FETCH_FROM_GIT_PATH) 26 | get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_EXTRAS_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}") 27 | endif () 28 | FetchContent_Declare( 29 | PICO_EXTRAS 30 | GIT_REPOSITORY https://github.com/raspberrypi/pico-extras 31 | GIT_TAG master 32 | ) 33 | if (NOT PICO_EXTRAS) 34 | message("Downloading PICO EXTRAS") 35 | FetchContent_Populate(PICO_EXTRAS) 36 | set(PICO_EXTRAS_PATH ${PICO_EXTRAS_SOURCE_DIR}) 37 | endif () 38 | set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE}) 39 | else () 40 | if (PICO_SDK_PATH AND EXISTS "${PICO_SDK_PATH}/../pico-extras") 41 | set(PICO_EXTRAS_PATH ${PICO_SDK_PATH}/../pico-extras) 42 | message("Defaulting PICO_EXTRAS_PATH as sibling of PICO_SDK_PATH: ${PICO_EXTRAS_PATH}") 43 | else() 44 | message(FATAL_ERROR 45 | "PICO EXTRAS location was not specified. Please set PICO_EXTRAS_PATH or set PICO_EXTRAS_FETCH_FROM_GIT to on to fetch from git." 46 | ) 47 | endif() 48 | endif () 49 | endif () 50 | 51 | set(PICO_EXTRAS_PATH "${PICO_EXTRAS_PATH}" CACHE PATH "Path to the PICO EXTRAS") 52 | set(PICO_EXTRAS_FETCH_FROM_GIT "${PICO_EXTRAS_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of PICO EXTRAS from git if not otherwise locatable") 53 | set(PICO_EXTRAS_FETCH_FROM_GIT_PATH "${PICO_EXTRAS_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download EXTRAS") 54 | 55 | get_filename_component(PICO_EXTRAS_PATH "${PICO_EXTRAS_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") 56 | if (NOT EXISTS ${PICO_EXTRAS_PATH}) 57 | message(FATAL_ERROR "Directory '${PICO_EXTRAS_PATH}' not found") 58 | endif () 59 | 60 | set(PICO_EXTRAS_PATH ${PICO_EXTRAS_PATH} CACHE PATH "Path to the PICO EXTRAS" FORCE) 61 | 62 | add_subdirectory(${PICO_EXTRAS_PATH} pico_extras) -------------------------------------------------------------------------------- /el640480am1/line_dma_pio/pico_sdk_import.cmake: -------------------------------------------------------------------------------- 1 | # This is a copy of /external/pico_sdk_import.cmake 2 | 3 | # This can be dropped into an external project to help locate this SDK 4 | # It should be include()ed prior to project() 5 | 6 | if (DEFINED ENV{PICO_SDK_PATH} AND (NOT PICO_SDK_PATH)) 7 | set(PICO_SDK_PATH $ENV{PICO_SDK_PATH}) 8 | message("Using PICO_SDK_PATH from environment ('${PICO_SDK_PATH}')") 9 | endif () 10 | 11 | if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT} AND (NOT PICO_SDK_FETCH_FROM_GIT)) 12 | set(PICO_SDK_FETCH_FROM_GIT $ENV{PICO_SDK_FETCH_FROM_GIT}) 13 | message("Using PICO_SDK_FETCH_FROM_GIT from environment ('${PICO_SDK_FETCH_FROM_GIT}')") 14 | endif () 15 | 16 | if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_PATH} AND (NOT PICO_SDK_FETCH_FROM_GIT_PATH)) 17 | set(PICO_SDK_FETCH_FROM_GIT_PATH $ENV{PICO_SDK_FETCH_FROM_GIT_PATH}) 18 | message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')") 19 | endif () 20 | 21 | set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the Raspberry Pi Pico SDK") 22 | set(PICO_SDK_FETCH_FROM_GIT "${PICO_SDK_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of SDK from git if not otherwise locatable") 23 | set(PICO_SDK_FETCH_FROM_GIT_PATH "${PICO_SDK_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download SDK") 24 | 25 | if (NOT PICO_SDK_PATH) 26 | if (PICO_SDK_FETCH_FROM_GIT) 27 | include(FetchContent) 28 | set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR}) 29 | if (PICO_SDK_FETCH_FROM_GIT_PATH) 30 | get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_SDK_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}") 31 | endif () 32 | FetchContent_Declare( 33 | pico_sdk 34 | GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk 35 | GIT_TAG master 36 | ) 37 | if (NOT pico_sdk) 38 | message("Downloading Raspberry Pi Pico SDK") 39 | FetchContent_Populate(pico_sdk) 40 | set(PICO_SDK_PATH ${pico_sdk_SOURCE_DIR}) 41 | endif () 42 | set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE}) 43 | else () 44 | message(FATAL_ERROR 45 | "SDK location was not specified. Please set PICO_SDK_PATH or set PICO_SDK_FETCH_FROM_GIT to on to fetch from git." 46 | ) 47 | endif () 48 | endif () 49 | 50 | get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") 51 | if (NOT EXISTS ${PICO_SDK_PATH}) 52 | message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' not found") 53 | endif () 54 | 55 | set(PICO_SDK_INIT_CMAKE_FILE ${PICO_SDK_PATH}/pico_sdk_init.cmake) 56 | if (NOT EXISTS ${PICO_SDK_INIT_CMAKE_FILE}) 57 | message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' does not appear to contain the Raspberry Pi Pico SDK") 58 | endif () 59 | 60 | set(PICO_SDK_PATH ${PICO_SDK_PATH} CACHE PATH "Path to the Raspberry Pi Pico SDK" FORCE) 61 | 62 | include(${PICO_SDK_INIT_CMAKE_FILE}) 63 | -------------------------------------------------------------------------------- /el640480am1/loop_pio/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Generated Cmake Pico project file 2 | 3 | cmake_minimum_required(VERSION 3.13) 4 | 5 | set(CMAKE_C_STANDARD 11) 6 | set(CMAKE_CXX_STANDARD 17) 7 | 8 | # initalize pico_sdk from installed location 9 | # (note this can come from environment, CMake cache etc) 10 | set(PICO_SDK_PATH "/home/wenting/pico/pico-sdk") 11 | set(PICO_EXTRAS_PATH "/home/wenting/pico/pico-extras") 12 | 13 | # Pull in Raspberry Pi Pico SDK (must be before project) 14 | include(pico_sdk_import.cmake) 15 | 16 | # We also need PICO EXTRAS 17 | include(pico_extras_import.cmake) 18 | 19 | project(eldemo C CXX ASM) 20 | 21 | # Initialise the Raspberry Pi Pico SDK 22 | pico_sdk_init() 23 | 24 | add_executable(eldemo) 25 | 26 | pico_generate_pio_header(eldemo ${CMAKE_CURRENT_LIST_DIR}/eldata.pio) 27 | 28 | target_sources(eldemo PRIVATE 29 | main.c 30 | el.c 31 | ) 32 | 33 | pico_set_program_name(eldemo "eldemo") 34 | pico_set_program_version(eldemo "0.1") 35 | 36 | pico_enable_stdio_uart(eldemo 0) 37 | pico_enable_stdio_usb(eldemo 0) 38 | 39 | target_include_directories(eldemo PRIVATE ${CMAKE_CURRENT_LIST_DIR}) 40 | 41 | # Add the standard library to the build 42 | target_link_libraries(eldemo pico_stdlib hardware_dma) 43 | 44 | # Add any user requested libraries 45 | target_link_libraries(eldemo 46 | hardware_pio 47 | ) 48 | 49 | pico_add_extra_outputs(eldemo) 50 | 51 | -------------------------------------------------------------------------------- /el640480am1/loop_pio/el.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2021 Wenting Zhang 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | #pragma once 23 | 24 | #define VSYNC_PIN (15) 25 | #define HSYNC_PIN (14) 26 | #define PIXCLK_PIN (4) 27 | // UD0-3: 5-8 28 | #define UD0_PIN (6) 29 | #define UD1_PIN (7) 30 | #define UD2_PIN (8) 31 | #define UD3_PIN (9) 32 | // LD0-3: 9-12 33 | #define LD0_PIN (10) 34 | #define LD1_PIN (11) 35 | #define LD2_PIN (12) 36 | #define LD3_PIN (13) 37 | 38 | // PIO related 39 | #define EL_UDATA_SM (0) 40 | #define EL_LDATA_SM (1) 41 | 42 | // Screen related 43 | #define EL_TARGET_PIXCLK (4500000) 44 | 45 | #define SCR_WIDTH (640) 46 | #define SCR_HEIGHT (480) 47 | #define SCR_LINE_TRANSFERS (SCR_WIDTH / 4) 48 | #define SCR_STRIDE (SCR_WIDTH / 8) 49 | #define SCR_STRIDE_WORDS (SCR_WIDTH / 32) 50 | #define SCR_REFRESH_LINES (SCR_HEIGHT / 2) 51 | 52 | // Public variables and functions 53 | extern unsigned char framebuf[SCR_STRIDE * SCR_HEIGHT]; 54 | extern volatile bool frame_sync; 55 | 56 | void el_start(); 57 | void el_frame(); 58 | -------------------------------------------------------------------------------- /el640480am1/loop_pio/eldata.pio: -------------------------------------------------------------------------------- 1 | 2 | .program el_udata 3 | .side_set 1 4 | .wrap_target 5 | out pins, 4 side 1 6 | nop side 0 7 | .wrap 8 | 9 | .program el_ldata 10 | .wrap_target 11 | out pins, 4 12 | nop 13 | .wrap -------------------------------------------------------------------------------- /el640480am1/loop_pio/main.c: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2021 Wenting Zhang 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | #include 23 | #include 24 | #include "pico/stdlib.h" 25 | #include "font.h" 26 | #include "el.h" 27 | #include "sample_text.h" 28 | 29 | static void putpixel(unsigned char *buf, int x, int y, int c) { 30 | if (c) 31 | buf[SCR_STRIDE * y + x / 8] |= 1 << (x % 8); 32 | else 33 | buf[SCR_STRIDE * y + x / 8] &= ~(1 << (x % 8)); 34 | } 35 | 36 | void put_char(unsigned char *buf, int x, int y, char c, int fg, int bg) { 37 | int i, j, p; 38 | for(i = 0; i < 6; i++) 39 | { 40 | for(j = 8; j > 0; j--) 41 | { 42 | p = charMap_ascii_mini[(unsigned char)c][i] << j ; 43 | if (p & 0x80) 44 | putpixel(buf, x + i, y + 8 - j, fg); 45 | else 46 | putpixel(buf, x + i, y + 8 - j, bg); 47 | } 48 | } 49 | } 50 | 51 | void put_string(unsigned char *buf, int x, int y, char *str, int fg, int bg) { 52 | while (*str) { 53 | char c = *str++; 54 | if ((c == '\n') || (x > SCR_WIDTH)) { 55 | y += 8; 56 | x = 0; 57 | } 58 | if (c != '\n') 59 | put_char(buf, x, y, c, fg, bg); 60 | x += 6; 61 | } 62 | } 63 | 64 | int main() 65 | { 66 | stdio_init_all(); 67 | 68 | const uint LED_PIN = PICO_DEFAULT_LED_PIN; 69 | gpio_init(LED_PIN); 70 | gpio_set_dir(LED_PIN, GPIO_OUT); 71 | 72 | gpio_put(LED_PIN, 1); 73 | sleep_ms(250); 74 | gpio_put(LED_PIN, 0); 75 | sleep_ms(250); 76 | 77 | el_start(); 78 | 79 | put_string(framebuf, 0, 0, text, 1, 0); 80 | 81 | while(1) { 82 | el_frame(); 83 | } 84 | 85 | return 0; 86 | } 87 | -------------------------------------------------------------------------------- /el640480am1/loop_pio/pico_extras_import.cmake: -------------------------------------------------------------------------------- 1 | # This is a copy of /external/pico_extras_import.cmake 2 | 3 | # This can be dropped into an external project to help locate pico-extras 4 | # It should be include()ed prior to project() 5 | 6 | if (DEFINED ENV{PICO_EXTRAS_PATH} AND (NOT PICO_EXTRAS_PATH)) 7 | set(PICO_EXTRAS_PATH $ENV{PICO_EXTRAS_PATH}) 8 | message("Using PICO_EXTRAS_PATH from environment ('${PICO_EXTRAS_PATH}')") 9 | endif () 10 | 11 | if (DEFINED ENV{PICO_EXTRAS_FETCH_FROM_GIT} AND (NOT PICO_EXTRAS_FETCH_FROM_GIT)) 12 | set(PICO_EXTRAS_FETCH_FROM_GIT $ENV{PICO_EXTRAS_FETCH_FROM_GIT}) 13 | message("Using PICO_EXTRAS_FETCH_FROM_GIT from environment ('${PICO_EXTRAS_FETCH_FROM_GIT}')") 14 | endif () 15 | 16 | if (DEFINED ENV{PICO_EXTRAS_FETCH_FROM_GIT_PATH} AND (NOT PICO_EXTRAS_FETCH_FROM_GIT_PATH)) 17 | set(PICO_EXTRAS_FETCH_FROM_GIT_PATH $ENV{PICO_EXTRAS_FETCH_FROM_GIT_PATH}) 18 | message("Using PICO_EXTRAS_FETCH_FROM_GIT_PATH from environment ('${PICO_EXTRAS_FETCH_FROM_GIT_PATH}')") 19 | endif () 20 | 21 | if (NOT PICO_EXTRAS_PATH) 22 | if (PICO_EXTRAS_FETCH_FROM_GIT) 23 | include(FetchContent) 24 | set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR}) 25 | if (PICO_EXTRAS_FETCH_FROM_GIT_PATH) 26 | get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_EXTRAS_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}") 27 | endif () 28 | FetchContent_Declare( 29 | PICO_EXTRAS 30 | GIT_REPOSITORY https://github.com/raspberrypi/pico-extras 31 | GIT_TAG master 32 | ) 33 | if (NOT PICO_EXTRAS) 34 | message("Downloading PICO EXTRAS") 35 | FetchContent_Populate(PICO_EXTRAS) 36 | set(PICO_EXTRAS_PATH ${PICO_EXTRAS_SOURCE_DIR}) 37 | endif () 38 | set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE}) 39 | else () 40 | if (PICO_SDK_PATH AND EXISTS "${PICO_SDK_PATH}/../pico-extras") 41 | set(PICO_EXTRAS_PATH ${PICO_SDK_PATH}/../pico-extras) 42 | message("Defaulting PICO_EXTRAS_PATH as sibling of PICO_SDK_PATH: ${PICO_EXTRAS_PATH}") 43 | else() 44 | message(FATAL_ERROR 45 | "PICO EXTRAS location was not specified. Please set PICO_EXTRAS_PATH or set PICO_EXTRAS_FETCH_FROM_GIT to on to fetch from git." 46 | ) 47 | endif() 48 | endif () 49 | endif () 50 | 51 | set(PICO_EXTRAS_PATH "${PICO_EXTRAS_PATH}" CACHE PATH "Path to the PICO EXTRAS") 52 | set(PICO_EXTRAS_FETCH_FROM_GIT "${PICO_EXTRAS_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of PICO EXTRAS from git if not otherwise locatable") 53 | set(PICO_EXTRAS_FETCH_FROM_GIT_PATH "${PICO_EXTRAS_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download EXTRAS") 54 | 55 | get_filename_component(PICO_EXTRAS_PATH "${PICO_EXTRAS_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") 56 | if (NOT EXISTS ${PICO_EXTRAS_PATH}) 57 | message(FATAL_ERROR "Directory '${PICO_EXTRAS_PATH}' not found") 58 | endif () 59 | 60 | set(PICO_EXTRAS_PATH ${PICO_EXTRAS_PATH} CACHE PATH "Path to the PICO EXTRAS" FORCE) 61 | 62 | add_subdirectory(${PICO_EXTRAS_PATH} pico_extras) -------------------------------------------------------------------------------- /el640480am1/loop_pio/pico_sdk_import.cmake: -------------------------------------------------------------------------------- 1 | # This is a copy of /external/pico_sdk_import.cmake 2 | 3 | # This can be dropped into an external project to help locate this SDK 4 | # It should be include()ed prior to project() 5 | 6 | if (DEFINED ENV{PICO_SDK_PATH} AND (NOT PICO_SDK_PATH)) 7 | set(PICO_SDK_PATH $ENV{PICO_SDK_PATH}) 8 | message("Using PICO_SDK_PATH from environment ('${PICO_SDK_PATH}')") 9 | endif () 10 | 11 | if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT} AND (NOT PICO_SDK_FETCH_FROM_GIT)) 12 | set(PICO_SDK_FETCH_FROM_GIT $ENV{PICO_SDK_FETCH_FROM_GIT}) 13 | message("Using PICO_SDK_FETCH_FROM_GIT from environment ('${PICO_SDK_FETCH_FROM_GIT}')") 14 | endif () 15 | 16 | if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_PATH} AND (NOT PICO_SDK_FETCH_FROM_GIT_PATH)) 17 | set(PICO_SDK_FETCH_FROM_GIT_PATH $ENV{PICO_SDK_FETCH_FROM_GIT_PATH}) 18 | message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')") 19 | endif () 20 | 21 | set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the Raspberry Pi Pico SDK") 22 | set(PICO_SDK_FETCH_FROM_GIT "${PICO_SDK_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of SDK from git if not otherwise locatable") 23 | set(PICO_SDK_FETCH_FROM_GIT_PATH "${PICO_SDK_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download SDK") 24 | 25 | if (NOT PICO_SDK_PATH) 26 | if (PICO_SDK_FETCH_FROM_GIT) 27 | include(FetchContent) 28 | set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR}) 29 | if (PICO_SDK_FETCH_FROM_GIT_PATH) 30 | get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_SDK_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}") 31 | endif () 32 | FetchContent_Declare( 33 | pico_sdk 34 | GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk 35 | GIT_TAG master 36 | ) 37 | if (NOT pico_sdk) 38 | message("Downloading Raspberry Pi Pico SDK") 39 | FetchContent_Populate(pico_sdk) 40 | set(PICO_SDK_PATH ${pico_sdk_SOURCE_DIR}) 41 | endif () 42 | set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE}) 43 | else () 44 | message(FATAL_ERROR 45 | "SDK location was not specified. Please set PICO_SDK_PATH or set PICO_SDK_FETCH_FROM_GIT to on to fetch from git." 46 | ) 47 | endif () 48 | endif () 49 | 50 | get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") 51 | if (NOT EXISTS ${PICO_SDK_PATH}) 52 | message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' not found") 53 | endif () 54 | 55 | set(PICO_SDK_INIT_CMAKE_FILE ${PICO_SDK_PATH}/pico_sdk_init.cmake) 56 | if (NOT EXISTS ${PICO_SDK_INIT_CMAKE_FILE}) 57 | message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' does not appear to contain the Raspberry Pi Pico SDK") 58 | endif () 59 | 60 | set(PICO_SDK_PATH ${PICO_SDK_PATH} CACHE PATH "Path to the Raspberry Pi Pico SDK" FORCE) 61 | 62 | include(${PICO_SDK_INIT_CMAKE_FILE}) 63 | -------------------------------------------------------------------------------- /el640480am1/sdvideo/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Generated Cmake Pico project file 2 | 3 | cmake_minimum_required(VERSION 3.13) 4 | 5 | set(CMAKE_C_STANDARD 11) 6 | set(CMAKE_CXX_STANDARD 17) 7 | 8 | # initalize pico_sdk from installed location 9 | # (note this can come from environment, CMake cache etc) 10 | set(PICO_SDK_PATH "/home/wenting/pico/pico-sdk") 11 | set(PICO_EXTRAS_PATH "/home/wenting/pico/pico-extras") 12 | 13 | # Pull in Raspberry Pi Pico SDK (must be before project) 14 | include(pico_sdk_import.cmake) 15 | 16 | # We also need PICO EXTRAS 17 | include(pico_extras_import.cmake) 18 | 19 | project(sdvideo C CXX ASM) 20 | 21 | # Initialise the Raspberry Pi Pico SDK 22 | pico_sdk_init() 23 | 24 | add_executable(sdvideo) 25 | 26 | pico_generate_pio_header(sdvideo ${CMAKE_CURRENT_LIST_DIR}/eldata.pio) 27 | 28 | target_sources(sdvideo PRIVATE 29 | main.c 30 | el.c 31 | ) 32 | 33 | add_compile_definitions(sdvideo 34 | PICO_SD_CLK_PIN=5 35 | PICO_SD_CMD_PIN=18 36 | PICO_SD_DAT0_PIN=19 37 | ) 38 | 39 | pico_set_program_name(sdvideo "sdvideo") 40 | pico_set_program_version(sdvideo "0.1") 41 | 42 | pico_enable_stdio_uart(sdvideo 0) 43 | pico_enable_stdio_usb(sdvideo 0) 44 | 45 | target_include_directories(sdvideo PRIVATE ${CMAKE_CURRENT_LIST_DIR}) 46 | 47 | # Add the standard library to the build 48 | target_link_libraries(sdvideo pico_stdlib pico_sd_card hardware_dma) 49 | 50 | # Add any user requested libraries 51 | target_link_libraries(sdvideo 52 | hardware_pio 53 | ) 54 | 55 | pico_add_extra_outputs(sdvideo) 56 | 57 | -------------------------------------------------------------------------------- /el640480am1/sdvideo/el.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2021 Wenting Zhang 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | #pragma once 23 | 24 | #define VSYNC_PIN (15) 25 | #define HSYNC_PIN (14) 26 | #define PIXCLK_PIN (4) 27 | // UD0-3: 5-8 28 | #define UD0_PIN (6) 29 | #define UD1_PIN (7) 30 | #define UD2_PIN (8) 31 | #define UD3_PIN (9) 32 | // LD0-3: 9-12 33 | #define LD0_PIN (10) 34 | #define LD1_PIN (11) 35 | #define LD2_PIN (12) 36 | #define LD3_PIN (13) 37 | 38 | // PIO related 39 | #define EL_UDATA_SM (0) 40 | #define EL_LDATA_SM (1) 41 | 42 | // Screen related 43 | #define EL_TARGET_PIXCLK (4500000) 44 | 45 | #define SCR_WIDTH (640) 46 | #define SCR_HEIGHT (480) 47 | // Additional line for smooth scrolling 48 | #define SCR_ADD_HEIGHT (32) 49 | #define SCR_BUF_HEIGHT (SCR_HEIGHT + SCR_ADD_HEIGHT) 50 | #define SCR_LINE_TRANSFERS (SCR_WIDTH / 4) 51 | #define SCR_STRIDE (SCR_WIDTH / 8) 52 | #define SCR_STRIDE_WORDS (SCR_WIDTH / 32) 53 | #define SCR_REFRESH_LINES (SCR_HEIGHT / 2) 54 | 55 | // Public variables and functions 56 | extern unsigned char framebuf_bp0[SCR_STRIDE * SCR_BUF_HEIGHT]; 57 | extern unsigned char framebuf_bp1[SCR_STRIDE * SCR_BUF_HEIGHT]; 58 | extern volatile int frame_scroll_lines; 59 | extern volatile bool frame_sync; 60 | 61 | void el_start(); 62 | unsigned char *el_swap_buffer(); -------------------------------------------------------------------------------- /el640480am1/sdvideo/eldata.pio: -------------------------------------------------------------------------------- 1 | 2 | ; UDATA SM handles UD0-3, PCLK, and VSYNC 3 | ; PCLK is mapped to SIDE, VSYNC is mapped to SET, and UD0-3 are mapped to OUT 4 | .program el_udata 5 | .side_set 1 6 | irq set 5 side 0 7 | mov x, isr side 0 8 | loop_first_line: 9 | out pins, 4 side 1 10 | jmp x-- loop_first_line side 0 11 | end_first_line: 12 | set pins, 1 [6] side 0 13 | set pins, 0 [9] side 0 14 | line_start: 15 | irq set 5 side 0 16 | mov x, isr side 0 17 | loop: 18 | out pins, 4 side 1 ; Output 4 bit data 19 | jmp x-- loop side 0 ; Loop until x hits 0, then wait for next line 20 | loop_end: 21 | nop [15] side 0 22 | jmp y-- line_start side 0 23 | ; end of frame, signal CPU 24 | irq wait 1 side 0 25 | 26 | 27 | ; LDATA SM handles LD0-3 and HSYNC 28 | ; HSYNC is mapped to SET, and LD0-3 are mapped to OUT 29 | .program el_ldata 30 | ; Signal UDATA SM to start outputting data 31 | mov x, isr 32 | wait irq 5 33 | loop: 34 | out pins, 4 35 | jmp x-- loop 36 | ; toggle Hsync and signal Vsync SM 37 | set pins, 1 [5] 38 | set pins, 0 [10] 39 | -------------------------------------------------------------------------------- /el640480am1/sdvideo/main.c: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2021 Wenting Zhang 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | #include 23 | #include "pico/stdlib.h" 24 | #include "pico/sd_card.h" 25 | #include "el.h" 26 | 27 | void sd_read_blocks(uint8_t *dst, uint32_t block, int block_count) { 28 | int batches = block_count / 32; 29 | int remainders = block_count % 32; 30 | uint32_t block_addr = block; 31 | for (int i = 0; i < batches; i++) { 32 | sd_readblocks_sync((unsigned int *)dst, block_addr, 32); 33 | dst += 32 * 512; 34 | block_addr += 32; 35 | } 36 | sd_readblocks_sync((unsigned int *)dst, block_addr, remainders); 37 | } 38 | 39 | int main() 40 | { 41 | stdio_init_all(); 42 | 43 | const uint LED_PIN = PICO_DEFAULT_LED_PIN; 44 | gpio_init(LED_PIN); 45 | gpio_set_dir(LED_PIN, GPIO_OUT); 46 | 47 | for (int i = 0; i < 2; i++) { 48 | gpio_put(LED_PIN, 1); 49 | sleep_ms(250); 50 | gpio_put(LED_PIN, 0); 51 | sleep_ms(250); 52 | } 53 | 54 | int result = sd_init_4pins(); 55 | 56 | if (result != SD_OK) { 57 | gpio_put(LED_PIN, 1); 58 | sleep_ms(500); 59 | gpio_put(LED_PIN, 0); 60 | sleep_ms(500); 61 | } 62 | 63 | gpio_put(LED_PIN, 1); 64 | sleep_ms(250); 65 | gpio_put(LED_PIN, 0); 66 | sleep_ms(250); 67 | 68 | el_start(); 69 | 70 | uint32_t block_addr = 0; 71 | uint8_t val = 0x00; 72 | for (int i = 0; i < 5262; i++) { 73 | unsigned char *fbuf = el_swap_buffer(); 74 | 75 | sd_read_blocks(fbuf, block_addr, 75); 76 | block_addr += 75; 77 | } 78 | 79 | while(1) { 80 | } 81 | 82 | return 0; 83 | } 84 | -------------------------------------------------------------------------------- /el640480am1/sdvideo/pico_extras_import.cmake: -------------------------------------------------------------------------------- 1 | # This is a copy of /external/pico_extras_import.cmake 2 | 3 | # This can be dropped into an external project to help locate pico-extras 4 | # It should be include()ed prior to project() 5 | 6 | if (DEFINED ENV{PICO_EXTRAS_PATH} AND (NOT PICO_EXTRAS_PATH)) 7 | set(PICO_EXTRAS_PATH $ENV{PICO_EXTRAS_PATH}) 8 | message("Using PICO_EXTRAS_PATH from environment ('${PICO_EXTRAS_PATH}')") 9 | endif () 10 | 11 | if (DEFINED ENV{PICO_EXTRAS_FETCH_FROM_GIT} AND (NOT PICO_EXTRAS_FETCH_FROM_GIT)) 12 | set(PICO_EXTRAS_FETCH_FROM_GIT $ENV{PICO_EXTRAS_FETCH_FROM_GIT}) 13 | message("Using PICO_EXTRAS_FETCH_FROM_GIT from environment ('${PICO_EXTRAS_FETCH_FROM_GIT}')") 14 | endif () 15 | 16 | if (DEFINED ENV{PICO_EXTRAS_FETCH_FROM_GIT_PATH} AND (NOT PICO_EXTRAS_FETCH_FROM_GIT_PATH)) 17 | set(PICO_EXTRAS_FETCH_FROM_GIT_PATH $ENV{PICO_EXTRAS_FETCH_FROM_GIT_PATH}) 18 | message("Using PICO_EXTRAS_FETCH_FROM_GIT_PATH from environment ('${PICO_EXTRAS_FETCH_FROM_GIT_PATH}')") 19 | endif () 20 | 21 | if (NOT PICO_EXTRAS_PATH) 22 | if (PICO_EXTRAS_FETCH_FROM_GIT) 23 | include(FetchContent) 24 | set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR}) 25 | if (PICO_EXTRAS_FETCH_FROM_GIT_PATH) 26 | get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_EXTRAS_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}") 27 | endif () 28 | FetchContent_Declare( 29 | PICO_EXTRAS 30 | GIT_REPOSITORY https://github.com/raspberrypi/pico-extras 31 | GIT_TAG master 32 | ) 33 | if (NOT PICO_EXTRAS) 34 | message("Downloading PICO EXTRAS") 35 | FetchContent_Populate(PICO_EXTRAS) 36 | set(PICO_EXTRAS_PATH ${PICO_EXTRAS_SOURCE_DIR}) 37 | endif () 38 | set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE}) 39 | else () 40 | if (PICO_SDK_PATH AND EXISTS "${PICO_SDK_PATH}/../pico-extras") 41 | set(PICO_EXTRAS_PATH ${PICO_SDK_PATH}/../pico-extras) 42 | message("Defaulting PICO_EXTRAS_PATH as sibling of PICO_SDK_PATH: ${PICO_EXTRAS_PATH}") 43 | else() 44 | message(FATAL_ERROR 45 | "PICO EXTRAS location was not specified. Please set PICO_EXTRAS_PATH or set PICO_EXTRAS_FETCH_FROM_GIT to on to fetch from git." 46 | ) 47 | endif() 48 | endif () 49 | endif () 50 | 51 | set(PICO_EXTRAS_PATH "${PICO_EXTRAS_PATH}" CACHE PATH "Path to the PICO EXTRAS") 52 | set(PICO_EXTRAS_FETCH_FROM_GIT "${PICO_EXTRAS_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of PICO EXTRAS from git if not otherwise locatable") 53 | set(PICO_EXTRAS_FETCH_FROM_GIT_PATH "${PICO_EXTRAS_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download EXTRAS") 54 | 55 | get_filename_component(PICO_EXTRAS_PATH "${PICO_EXTRAS_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") 56 | if (NOT EXISTS ${PICO_EXTRAS_PATH}) 57 | message(FATAL_ERROR "Directory '${PICO_EXTRAS_PATH}' not found") 58 | endif () 59 | 60 | set(PICO_EXTRAS_PATH ${PICO_EXTRAS_PATH} CACHE PATH "Path to the PICO EXTRAS" FORCE) 61 | 62 | add_subdirectory(${PICO_EXTRAS_PATH} pico_extras) -------------------------------------------------------------------------------- /el640480am1/sdvideo/pico_sdk_import.cmake: -------------------------------------------------------------------------------- 1 | # This is a copy of /external/pico_sdk_import.cmake 2 | 3 | # This can be dropped into an external project to help locate this SDK 4 | # It should be include()ed prior to project() 5 | 6 | if (DEFINED ENV{PICO_SDK_PATH} AND (NOT PICO_SDK_PATH)) 7 | set(PICO_SDK_PATH $ENV{PICO_SDK_PATH}) 8 | message("Using PICO_SDK_PATH from environment ('${PICO_SDK_PATH}')") 9 | endif () 10 | 11 | if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT} AND (NOT PICO_SDK_FETCH_FROM_GIT)) 12 | set(PICO_SDK_FETCH_FROM_GIT $ENV{PICO_SDK_FETCH_FROM_GIT}) 13 | message("Using PICO_SDK_FETCH_FROM_GIT from environment ('${PICO_SDK_FETCH_FROM_GIT}')") 14 | endif () 15 | 16 | if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_PATH} AND (NOT PICO_SDK_FETCH_FROM_GIT_PATH)) 17 | set(PICO_SDK_FETCH_FROM_GIT_PATH $ENV{PICO_SDK_FETCH_FROM_GIT_PATH}) 18 | message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')") 19 | endif () 20 | 21 | set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the Raspberry Pi Pico SDK") 22 | set(PICO_SDK_FETCH_FROM_GIT "${PICO_SDK_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of SDK from git if not otherwise locatable") 23 | set(PICO_SDK_FETCH_FROM_GIT_PATH "${PICO_SDK_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download SDK") 24 | 25 | if (NOT PICO_SDK_PATH) 26 | if (PICO_SDK_FETCH_FROM_GIT) 27 | include(FetchContent) 28 | set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR}) 29 | if (PICO_SDK_FETCH_FROM_GIT_PATH) 30 | get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_SDK_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}") 31 | endif () 32 | FetchContent_Declare( 33 | pico_sdk 34 | GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk 35 | GIT_TAG master 36 | ) 37 | if (NOT pico_sdk) 38 | message("Downloading Raspberry Pi Pico SDK") 39 | FetchContent_Populate(pico_sdk) 40 | set(PICO_SDK_PATH ${pico_sdk_SOURCE_DIR}) 41 | endif () 42 | set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE}) 43 | else () 44 | message(FATAL_ERROR 45 | "SDK location was not specified. Please set PICO_SDK_PATH or set PICO_SDK_FETCH_FROM_GIT to on to fetch from git." 46 | ) 47 | endif () 48 | endif () 49 | 50 | get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") 51 | if (NOT EXISTS ${PICO_SDK_PATH}) 52 | message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' not found") 53 | endif () 54 | 55 | set(PICO_SDK_INIT_CMAKE_FILE ${PICO_SDK_PATH}/pico_sdk_init.cmake) 56 | if (NOT EXISTS ${PICO_SDK_INIT_CMAKE_FILE}) 57 | message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' does not appear to contain the Raspberry Pi Pico SDK") 58 | endif () 59 | 60 | set(PICO_SDK_PATH ${PICO_SDK_PATH} CACHE PATH "Path to the Raspberry Pi Pico SDK" FORCE) 61 | 62 | include(${PICO_SDK_INIT_CMAKE_FILE}) 63 | -------------------------------------------------------------------------------- /elw1501aa/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Generated Cmake Pico project file 2 | 3 | cmake_minimum_required(VERSION 3.13) 4 | 5 | set(CMAKE_C_STANDARD 11) 6 | set(CMAKE_CXX_STANDARD 17) 7 | 8 | # initalize pico_sdk from installed location 9 | # (note this can come from environment, CMake cache etc) 10 | set(PICO_SDK_PATH "/home/wenting/pico/pico-sdk") 11 | 12 | # Pull in Raspberry Pi Pico SDK (must be before project) 13 | include(pico_sdk_import.cmake) 14 | 15 | project(fw C CXX ASM) 16 | 17 | # Initialise the Raspberry Pi Pico SDK 18 | pico_sdk_init() 19 | 20 | # Add executable. Default name is the project name, version 0.1 21 | 22 | add_executable(fw 23 | fw.c 24 | lcd.c 25 | ui.c 26 | ) 27 | 28 | pico_set_program_name(fw "fw") 29 | pico_set_program_version(fw "0.1") 30 | 31 | pico_enable_stdio_uart(fw 0) 32 | pico_enable_stdio_usb(fw 0) 33 | 34 | # Add the standard library to the build 35 | target_link_libraries(fw pico_stdlib) 36 | 37 | # Add any user requested libraries 38 | target_link_libraries(fw 39 | hardware_spi 40 | hardware_dma 41 | hardware_i2c 42 | ) 43 | 44 | pico_add_extra_outputs(fw) 45 | 46 | -------------------------------------------------------------------------------- /elw1501aa/font.h: -------------------------------------------------------------------------------- 1 | static const char font[] = { 2 | 0x00, 0x00, 0x00, 0x00, 0x00,// (space) 3 | 0x00, 0x00, 0x5F, 0x00, 0x00,// ! 4 | 0x00, 0x07, 0x00, 0x07, 0x00,// " 5 | 0x14, 0x7F, 0x14, 0x7F, 0x14,// # 6 | 0x24, 0x2A, 0x7F, 0x2A, 0x12,// $ 7 | 0x23, 0x13, 0x08, 0x64, 0x62,// % 8 | 0x36, 0x49, 0x55, 0x22, 0x50,// & 9 | 0x00, 0x05, 0x03, 0x00, 0x00,// ' 10 | 0x00, 0x1C, 0x22, 0x41, 0x00,// ( 11 | 0x00, 0x41, 0x22, 0x1C, 0x00,// ) 12 | 0x08, 0x2A, 0x1C, 0x2A, 0x08,// * 13 | 0x08, 0x08, 0x3E, 0x08, 0x08,// + 14 | 0x00, 0x50, 0x30, 0x00, 0x00,// , 15 | 0x08, 0x08, 0x08, 0x08, 0x08,// - 16 | 0x00, 0x60, 0x60, 0x00, 0x00,// . 17 | 0x20, 0x10, 0x08, 0x04, 0x02,// / 18 | 0x3E, 0x51, 0x49, 0x45, 0x3E,// 0 19 | 0x00, 0x42, 0x7F, 0x40, 0x00,// 1 20 | 0x42, 0x61, 0x51, 0x49, 0x46,// 2 21 | 0x21, 0x41, 0x45, 0x4B, 0x31,// 3 22 | 0x18, 0x14, 0x12, 0x7F, 0x10,// 4 23 | 0x27, 0x45, 0x45, 0x45, 0x39,// 5 24 | 0x3C, 0x4A, 0x49, 0x49, 0x30,// 6 25 | 0x01, 0x71, 0x09, 0x05, 0x03,// 7 26 | 0x36, 0x49, 0x49, 0x49, 0x36,// 8 27 | 0x06, 0x49, 0x49, 0x29, 0x1E,// 9 28 | 0x00, 0x36, 0x36, 0x00, 0x00,// : 29 | 0x00, 0x56, 0x36, 0x00, 0x00,// ; 30 | 0x00, 0x08, 0x14, 0x22, 0x41,// < 31 | 0x14, 0x14, 0x14, 0x14, 0x14,// = 32 | 0x41, 0x22, 0x14, 0x08, 0x00,// > 33 | 0x02, 0x01, 0x51, 0x09, 0x06,// ? 34 | 0x32, 0x49, 0x79, 0x41, 0x3E,// @ 35 | 0x7E, 0x11, 0x11, 0x11, 0x7E,// A 36 | 0x7F, 0x49, 0x49, 0x49, 0x36,// B 37 | 0x3E, 0x41, 0x41, 0x41, 0x22,// C 38 | 0x7F, 0x41, 0x41, 0x22, 0x1C,// D 39 | 0x7F, 0x49, 0x49, 0x49, 0x41,// E 40 | 0x7F, 0x09, 0x09, 0x01, 0x01,// F 41 | 0x3E, 0x41, 0x41, 0x51, 0x32,// G 42 | 0x7F, 0x08, 0x08, 0x08, 0x7F,// H 43 | 0x00, 0x41, 0x7F, 0x41, 0x00,// I 44 | 0x20, 0x40, 0x41, 0x3F, 0x01,// J 45 | 0x7F, 0x08, 0x14, 0x22, 0x41,// K 46 | 0x7F, 0x40, 0x40, 0x40, 0x40,// L 47 | 0x7F, 0x02, 0x04, 0x02, 0x7F,// M 48 | 0x7F, 0x04, 0x08, 0x10, 0x7F,// N 49 | 0x3E, 0x41, 0x41, 0x41, 0x3E,// O 50 | 0x7F, 0x09, 0x09, 0x09, 0x06,// P 51 | 0x3E, 0x41, 0x51, 0x21, 0x5E,// Q 52 | 0x7F, 0x09, 0x19, 0x29, 0x46,// R 53 | 0x46, 0x49, 0x49, 0x49, 0x31,// S 54 | 0x01, 0x01, 0x7F, 0x01, 0x01,// T 55 | 0x3F, 0x40, 0x40, 0x40, 0x3F,// U 56 | 0x1F, 0x20, 0x40, 0x20, 0x1F,// V 57 | 0x7F, 0x20, 0x18, 0x20, 0x7F,// W 58 | 0x63, 0x14, 0x08, 0x14, 0x63,// X 59 | 0x03, 0x04, 0x78, 0x04, 0x03,// Y 60 | 0x61, 0x51, 0x49, 0x45, 0x43,// Z 61 | 0x00, 0x00, 0x7F, 0x41, 0x41,// [ 62 | 0x02, 0x04, 0x08, 0x10, 0x20,// "\" 63 | 0x41, 0x41, 0x7F, 0x00, 0x00,// ] 64 | 0x04, 0x02, 0x01, 0x02, 0x04,// ^ 65 | 0x40, 0x40, 0x40, 0x40, 0x40,// _ 66 | 0x00, 0x01, 0x02, 0x04, 0x00,// ` 67 | 0x20, 0x54, 0x54, 0x54, 0x78,// a 68 | 0x7F, 0x48, 0x44, 0x44, 0x38,// b 69 | 0x38, 0x44, 0x44, 0x44, 0x20,// c 70 | 0x38, 0x44, 0x44, 0x48, 0x7F,// d 71 | 0x38, 0x54, 0x54, 0x54, 0x18,// e 72 | 0x08, 0x7E, 0x09, 0x01, 0x02,// f 73 | 0x08, 0x14, 0x54, 0x54, 0x3C,// g 74 | 0x7F, 0x08, 0x04, 0x04, 0x78,// h 75 | 0x00, 0x44, 0x7D, 0x40, 0x00,// i 76 | 0x20, 0x40, 0x44, 0x3D, 0x00,// j 77 | 0x00, 0x7F, 0x10, 0x28, 0x44,// k 78 | 0x00, 0x41, 0x7F, 0x40, 0x00,// l 79 | 0x7C, 0x04, 0x18, 0x04, 0x78,// m 80 | 0x7C, 0x08, 0x04, 0x04, 0x78,// n 81 | 0x38, 0x44, 0x44, 0x44, 0x38,// o 82 | 0x7C, 0x14, 0x14, 0x14, 0x08,// p 83 | 0x08, 0x14, 0x14, 0x18, 0x7C,// q 84 | 0x7C, 0x08, 0x04, 0x04, 0x08,// r 85 | 0x48, 0x54, 0x54, 0x54, 0x20,// s 86 | 0x04, 0x3F, 0x44, 0x40, 0x20,// t 87 | 0x3C, 0x40, 0x40, 0x20, 0x7C,// u 88 | 0x1C, 0x20, 0x40, 0x20, 0x1C,// v 89 | 0x3C, 0x40, 0x30, 0x40, 0x3C,// w 90 | 0x44, 0x28, 0x10, 0x28, 0x44,// x 91 | 0x0C, 0x50, 0x50, 0x50, 0x3C,// y 92 | 0x44, 0x64, 0x54, 0x4C, 0x44,// z 93 | 0x00, 0x08, 0x36, 0x41, 0x00,// { 94 | 0x00, 0x00, 0x7F, 0x00, 0x00,// | 95 | 0x00, 0x41, 0x36, 0x08, 0x00,// } 96 | 0x08, 0x08, 0x2A, 0x1C, 0x08,// -> 97 | 0x08, 0x1C, 0x2A, 0x08, 0x08 // <- 98 | }; -------------------------------------------------------------------------------- /elw1501aa/fw.c: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2021 Wenting Zhang 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | #include 23 | #include 24 | #include "pico/stdlib.h" 25 | #include "lcd.h" 26 | #include "ui.h" 27 | 28 | int main() 29 | { 30 | stdio_init_all(); 31 | 32 | lcd_init(); 33 | ui_init(); 34 | memset(framebuffer, 0x00, sizeof(framebuffer)); 35 | for (int i = 0; i < 16; i++) { 36 | ui_disp_string(0, 8 * i, "Hello, world", i); 37 | } 38 | lcd_update(); 39 | 40 | while (1) { 41 | /*for (uint8_t i = 0; i < 16; i++) { 42 | uint8_t b = (i << 4) | i; 43 | ui_clear(i); 44 | lcd_update(); 45 | sleep_ms(500); 46 | }*/ 47 | } 48 | 49 | return 0; 50 | } 51 | -------------------------------------------------------------------------------- /elw1501aa/lcd.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2021 Wenting Zhang 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | #pragma once 23 | 24 | // Using horizontal mode causes visible diagnal image tearing. Using vertical 25 | // mode only produces verital image tearing, which is less perceptiable. 26 | 27 | #define LCD_WIDTH (128) 28 | #define LCD_HEIGHT (128) 29 | 30 | extern uint8_t framebuffer[LCD_WIDTH * LCD_HEIGHT / 2]; 31 | 32 | void lcd_init(void); 33 | void lcd_set_window(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2); 34 | void lcd_update(void); -------------------------------------------------------------------------------- /elw1501aa/pico_sdk_import.cmake: -------------------------------------------------------------------------------- 1 | # This is a copy of /external/pico_sdk_import.cmake 2 | 3 | # This can be dropped into an external project to help locate this SDK 4 | # It should be include()ed prior to project() 5 | 6 | if (DEFINED ENV{PICO_SDK_PATH} AND (NOT PICO_SDK_PATH)) 7 | set(PICO_SDK_PATH $ENV{PICO_SDK_PATH}) 8 | message("Using PICO_SDK_PATH from environment ('${PICO_SDK_PATH}')") 9 | endif () 10 | 11 | if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT} AND (NOT PICO_SDK_FETCH_FROM_GIT)) 12 | set(PICO_SDK_FETCH_FROM_GIT $ENV{PICO_SDK_FETCH_FROM_GIT}) 13 | message("Using PICO_SDK_FETCH_FROM_GIT from environment ('${PICO_SDK_FETCH_FROM_GIT}')") 14 | endif () 15 | 16 | if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_PATH} AND (NOT PICO_SDK_FETCH_FROM_GIT_PATH)) 17 | set(PICO_SDK_FETCH_FROM_GIT_PATH $ENV{PICO_SDK_FETCH_FROM_GIT_PATH}) 18 | message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')") 19 | endif () 20 | 21 | set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the Raspberry Pi Pico SDK") 22 | set(PICO_SDK_FETCH_FROM_GIT "${PICO_SDK_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of SDK from git if not otherwise locatable") 23 | set(PICO_SDK_FETCH_FROM_GIT_PATH "${PICO_SDK_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download SDK") 24 | 25 | if (NOT PICO_SDK_PATH) 26 | if (PICO_SDK_FETCH_FROM_GIT) 27 | include(FetchContent) 28 | set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR}) 29 | if (PICO_SDK_FETCH_FROM_GIT_PATH) 30 | get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_SDK_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}") 31 | endif () 32 | FetchContent_Declare( 33 | pico_sdk 34 | GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk 35 | GIT_TAG master 36 | ) 37 | if (NOT pico_sdk) 38 | message("Downloading Raspberry Pi Pico SDK") 39 | FetchContent_Populate(pico_sdk) 40 | set(PICO_SDK_PATH ${pico_sdk_SOURCE_DIR}) 41 | endif () 42 | set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE}) 43 | else () 44 | message(FATAL_ERROR 45 | "SDK location was not specified. Please set PICO_SDK_PATH or set PICO_SDK_FETCH_FROM_GIT to on to fetch from git." 46 | ) 47 | endif () 48 | endif () 49 | 50 | get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") 51 | if (NOT EXISTS ${PICO_SDK_PATH}) 52 | message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' not found") 53 | endif () 54 | 55 | set(PICO_SDK_INIT_CMAKE_FILE ${PICO_SDK_PATH}/pico_sdk_init.cmake) 56 | if (NOT EXISTS ${PICO_SDK_INIT_CMAKE_FILE}) 57 | message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' does not appear to contain the Raspberry Pi Pico SDK") 58 | endif () 59 | 60 | set(PICO_SDK_PATH ${PICO_SDK_PATH} CACHE PATH "Path to the Raspberry Pi Pico SDK" FORCE) 61 | 62 | include(${PICO_SDK_INIT_CMAKE_FILE}) 63 | -------------------------------------------------------------------------------- /elw1501aa/ui.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2021 Wenting Zhang 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | #pragma once 23 | 24 | #define UI_HEIGHT LCD_HEIGHT 25 | #define UI_WIDTH LCD_WIDTH 26 | 27 | void ui_init(void); 28 | void ui_clear(uint8_t c); 29 | void ui_disp_string(int x, int y, char *str, uint8_t c); 30 | int ui_disp_string_bb(char *str, int width); 31 | //void ui_disp_fill(int x1, int y1, int x2, int y2, uint16_t c); 32 | void ui_disp_num(int x, int y, uint32_t num, uint8_t c); 33 | void ui_disp_hex(int x, int y, uint32_t num, uint8_t c); 34 | int ui_printf(int x, int y, const char *format, ...); 35 | -------------------------------------------------------------------------------- /er-tft0.96-1/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Generated Cmake Pico project file 2 | 3 | cmake_minimum_required(VERSION 3.13) 4 | 5 | set(CMAKE_C_STANDARD 11) 6 | set(CMAKE_CXX_STANDARD 17) 7 | 8 | # initalize pico_sdk from installed location 9 | # (note this can come from environment, CMake cache etc) 10 | set(PICO_SDK_PATH "/home/wenting/pico/pico-sdk") 11 | 12 | # Pull in Raspberry Pi Pico SDK (must be before project) 13 | include(pico_sdk_import.cmake) 14 | 15 | project(fw C CXX ASM) 16 | 17 | # Initialise the Raspberry Pi Pico SDK 18 | pico_sdk_init() 19 | 20 | # Add executable. Default name is the project name, version 0.1 21 | 22 | add_executable(fw 23 | fw.c 24 | lcd.c 25 | ui.c 26 | ) 27 | 28 | pico_set_program_name(fw "fw") 29 | pico_set_program_version(fw "0.1") 30 | 31 | pico_enable_stdio_uart(fw 0) 32 | pico_enable_stdio_usb(fw 0) 33 | 34 | # Add the standard library to the build 35 | target_link_libraries(fw pico_stdlib) 36 | 37 | # Add any user requested libraries 38 | target_link_libraries(fw 39 | hardware_spi 40 | hardware_dma 41 | hardware_i2c 42 | ) 43 | 44 | pico_add_extra_outputs(fw) 45 | 46 | -------------------------------------------------------------------------------- /er-tft0.96-1/font.h: -------------------------------------------------------------------------------- 1 | static const char font[] = { 2 | 0x00, 0x00, 0x00, 0x00, 0x00,// (space) 3 | 0x00, 0x00, 0x5F, 0x00, 0x00,// ! 4 | 0x00, 0x07, 0x00, 0x07, 0x00,// " 5 | 0x14, 0x7F, 0x14, 0x7F, 0x14,// # 6 | 0x24, 0x2A, 0x7F, 0x2A, 0x12,// $ 7 | 0x23, 0x13, 0x08, 0x64, 0x62,// % 8 | 0x36, 0x49, 0x55, 0x22, 0x50,// & 9 | 0x00, 0x05, 0x03, 0x00, 0x00,// ' 10 | 0x00, 0x1C, 0x22, 0x41, 0x00,// ( 11 | 0x00, 0x41, 0x22, 0x1C, 0x00,// ) 12 | 0x08, 0x2A, 0x1C, 0x2A, 0x08,// * 13 | 0x08, 0x08, 0x3E, 0x08, 0x08,// + 14 | 0x00, 0x50, 0x30, 0x00, 0x00,// , 15 | 0x08, 0x08, 0x08, 0x08, 0x08,// - 16 | 0x00, 0x60, 0x60, 0x00, 0x00,// . 17 | 0x20, 0x10, 0x08, 0x04, 0x02,// / 18 | 0x3E, 0x51, 0x49, 0x45, 0x3E,// 0 19 | 0x00, 0x42, 0x7F, 0x40, 0x00,// 1 20 | 0x42, 0x61, 0x51, 0x49, 0x46,// 2 21 | 0x21, 0x41, 0x45, 0x4B, 0x31,// 3 22 | 0x18, 0x14, 0x12, 0x7F, 0x10,// 4 23 | 0x27, 0x45, 0x45, 0x45, 0x39,// 5 24 | 0x3C, 0x4A, 0x49, 0x49, 0x30,// 6 25 | 0x01, 0x71, 0x09, 0x05, 0x03,// 7 26 | 0x36, 0x49, 0x49, 0x49, 0x36,// 8 27 | 0x06, 0x49, 0x49, 0x29, 0x1E,// 9 28 | 0x00, 0x36, 0x36, 0x00, 0x00,// : 29 | 0x00, 0x56, 0x36, 0x00, 0x00,// ; 30 | 0x00, 0x08, 0x14, 0x22, 0x41,// < 31 | 0x14, 0x14, 0x14, 0x14, 0x14,// = 32 | 0x41, 0x22, 0x14, 0x08, 0x00,// > 33 | 0x02, 0x01, 0x51, 0x09, 0x06,// ? 34 | 0x32, 0x49, 0x79, 0x41, 0x3E,// @ 35 | 0x7E, 0x11, 0x11, 0x11, 0x7E,// A 36 | 0x7F, 0x49, 0x49, 0x49, 0x36,// B 37 | 0x3E, 0x41, 0x41, 0x41, 0x22,// C 38 | 0x7F, 0x41, 0x41, 0x22, 0x1C,// D 39 | 0x7F, 0x49, 0x49, 0x49, 0x41,// E 40 | 0x7F, 0x09, 0x09, 0x01, 0x01,// F 41 | 0x3E, 0x41, 0x41, 0x51, 0x32,// G 42 | 0x7F, 0x08, 0x08, 0x08, 0x7F,// H 43 | 0x00, 0x41, 0x7F, 0x41, 0x00,// I 44 | 0x20, 0x40, 0x41, 0x3F, 0x01,// J 45 | 0x7F, 0x08, 0x14, 0x22, 0x41,// K 46 | 0x7F, 0x40, 0x40, 0x40, 0x40,// L 47 | 0x7F, 0x02, 0x04, 0x02, 0x7F,// M 48 | 0x7F, 0x04, 0x08, 0x10, 0x7F,// N 49 | 0x3E, 0x41, 0x41, 0x41, 0x3E,// O 50 | 0x7F, 0x09, 0x09, 0x09, 0x06,// P 51 | 0x3E, 0x41, 0x51, 0x21, 0x5E,// Q 52 | 0x7F, 0x09, 0x19, 0x29, 0x46,// R 53 | 0x46, 0x49, 0x49, 0x49, 0x31,// S 54 | 0x01, 0x01, 0x7F, 0x01, 0x01,// T 55 | 0x3F, 0x40, 0x40, 0x40, 0x3F,// U 56 | 0x1F, 0x20, 0x40, 0x20, 0x1F,// V 57 | 0x7F, 0x20, 0x18, 0x20, 0x7F,// W 58 | 0x63, 0x14, 0x08, 0x14, 0x63,// X 59 | 0x03, 0x04, 0x78, 0x04, 0x03,// Y 60 | 0x61, 0x51, 0x49, 0x45, 0x43,// Z 61 | 0x00, 0x00, 0x7F, 0x41, 0x41,// [ 62 | 0x02, 0x04, 0x08, 0x10, 0x20,// "\" 63 | 0x41, 0x41, 0x7F, 0x00, 0x00,// ] 64 | 0x04, 0x02, 0x01, 0x02, 0x04,// ^ 65 | 0x40, 0x40, 0x40, 0x40, 0x40,// _ 66 | 0x00, 0x01, 0x02, 0x04, 0x00,// ` 67 | 0x20, 0x54, 0x54, 0x54, 0x78,// a 68 | 0x7F, 0x48, 0x44, 0x44, 0x38,// b 69 | 0x38, 0x44, 0x44, 0x44, 0x20,// c 70 | 0x38, 0x44, 0x44, 0x48, 0x7F,// d 71 | 0x38, 0x54, 0x54, 0x54, 0x18,// e 72 | 0x08, 0x7E, 0x09, 0x01, 0x02,// f 73 | 0x08, 0x14, 0x54, 0x54, 0x3C,// g 74 | 0x7F, 0x08, 0x04, 0x04, 0x78,// h 75 | 0x00, 0x44, 0x7D, 0x40, 0x00,// i 76 | 0x20, 0x40, 0x44, 0x3D, 0x00,// j 77 | 0x00, 0x7F, 0x10, 0x28, 0x44,// k 78 | 0x00, 0x41, 0x7F, 0x40, 0x00,// l 79 | 0x7C, 0x04, 0x18, 0x04, 0x78,// m 80 | 0x7C, 0x08, 0x04, 0x04, 0x78,// n 81 | 0x38, 0x44, 0x44, 0x44, 0x38,// o 82 | 0x7C, 0x14, 0x14, 0x14, 0x08,// p 83 | 0x08, 0x14, 0x14, 0x18, 0x7C,// q 84 | 0x7C, 0x08, 0x04, 0x04, 0x08,// r 85 | 0x48, 0x54, 0x54, 0x54, 0x20,// s 86 | 0x04, 0x3F, 0x44, 0x40, 0x20,// t 87 | 0x3C, 0x40, 0x40, 0x20, 0x7C,// u 88 | 0x1C, 0x20, 0x40, 0x20, 0x1C,// v 89 | 0x3C, 0x40, 0x30, 0x40, 0x3C,// w 90 | 0x44, 0x28, 0x10, 0x28, 0x44,// x 91 | 0x0C, 0x50, 0x50, 0x50, 0x3C,// y 92 | 0x44, 0x64, 0x54, 0x4C, 0x44,// z 93 | 0x00, 0x08, 0x36, 0x41, 0x00,// { 94 | 0x00, 0x00, 0x7F, 0x00, 0x00,// | 95 | 0x00, 0x41, 0x36, 0x08, 0x00,// } 96 | 0x08, 0x08, 0x2A, 0x1C, 0x08,// -> 97 | 0x08, 0x1C, 0x2A, 0x08, 0x08 // <- 98 | }; -------------------------------------------------------------------------------- /er-tft0.96-1/fw.c: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2021 Wenting Zhang 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | #include 23 | #include "pico/stdlib.h" 24 | #include "lcd.h" 25 | #include "ui.h" 26 | 27 | int main() 28 | { 29 | stdio_init_all(); 30 | 31 | lcd_init(); 32 | ui_init(); 33 | lcd_update(); 34 | 35 | while (1) { 36 | ui_clear(0xf800); 37 | lcd_update(); 38 | sleep_ms(500); 39 | ui_clear(0x07e0); 40 | lcd_update(); 41 | sleep_ms(500); 42 | ui_clear(0x001f); 43 | lcd_update(); 44 | sleep_ms(500); 45 | } 46 | 47 | return 0; 48 | } 49 | -------------------------------------------------------------------------------- /er-tft0.96-1/lcd.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2021 Wenting Zhang 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | #pragma once 23 | 24 | // Using horizontal mode causes visible diagnal image tearing. Using vertical 25 | // mode only produces verital image tearing, which is less perceptiable. 26 | 27 | //#define LCD_HORIZONTAL 28 | #define LCD_VERTICAL 29 | 30 | #ifdef LCD_HORIZONTAL 31 | #define LCD_WIDTH (160) 32 | #define LCD_HEIGHT (80) 33 | #define LCD_OFFSET_X (1) 34 | #define LCD_OFFSET_Y (26) 35 | #else 36 | #define LCD_WIDTH (80) 37 | #define LCD_HEIGHT (160) 38 | #define LCD_OFFSET_X (26) 39 | #define LCD_OFFSET_Y (1) 40 | #endif 41 | 42 | extern uint16_t framebuffer[LCD_WIDTH * LCD_HEIGHT]; 43 | 44 | void lcd_init(void); 45 | void lcd_set_window(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2); 46 | void lcd_update(void); -------------------------------------------------------------------------------- /er-tft0.96-1/pico_sdk_import.cmake: -------------------------------------------------------------------------------- 1 | # This is a copy of /external/pico_sdk_import.cmake 2 | 3 | # This can be dropped into an external project to help locate this SDK 4 | # It should be include()ed prior to project() 5 | 6 | if (DEFINED ENV{PICO_SDK_PATH} AND (NOT PICO_SDK_PATH)) 7 | set(PICO_SDK_PATH $ENV{PICO_SDK_PATH}) 8 | message("Using PICO_SDK_PATH from environment ('${PICO_SDK_PATH}')") 9 | endif () 10 | 11 | if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT} AND (NOT PICO_SDK_FETCH_FROM_GIT)) 12 | set(PICO_SDK_FETCH_FROM_GIT $ENV{PICO_SDK_FETCH_FROM_GIT}) 13 | message("Using PICO_SDK_FETCH_FROM_GIT from environment ('${PICO_SDK_FETCH_FROM_GIT}')") 14 | endif () 15 | 16 | if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_PATH} AND (NOT PICO_SDK_FETCH_FROM_GIT_PATH)) 17 | set(PICO_SDK_FETCH_FROM_GIT_PATH $ENV{PICO_SDK_FETCH_FROM_GIT_PATH}) 18 | message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')") 19 | endif () 20 | 21 | set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the Raspberry Pi Pico SDK") 22 | set(PICO_SDK_FETCH_FROM_GIT "${PICO_SDK_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of SDK from git if not otherwise locatable") 23 | set(PICO_SDK_FETCH_FROM_GIT_PATH "${PICO_SDK_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download SDK") 24 | 25 | if (NOT PICO_SDK_PATH) 26 | if (PICO_SDK_FETCH_FROM_GIT) 27 | include(FetchContent) 28 | set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR}) 29 | if (PICO_SDK_FETCH_FROM_GIT_PATH) 30 | get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_SDK_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}") 31 | endif () 32 | FetchContent_Declare( 33 | pico_sdk 34 | GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk 35 | GIT_TAG master 36 | ) 37 | if (NOT pico_sdk) 38 | message("Downloading Raspberry Pi Pico SDK") 39 | FetchContent_Populate(pico_sdk) 40 | set(PICO_SDK_PATH ${pico_sdk_SOURCE_DIR}) 41 | endif () 42 | set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE}) 43 | else () 44 | message(FATAL_ERROR 45 | "SDK location was not specified. Please set PICO_SDK_PATH or set PICO_SDK_FETCH_FROM_GIT to on to fetch from git." 46 | ) 47 | endif () 48 | endif () 49 | 50 | get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") 51 | if (NOT EXISTS ${PICO_SDK_PATH}) 52 | message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' not found") 53 | endif () 54 | 55 | set(PICO_SDK_INIT_CMAKE_FILE ${PICO_SDK_PATH}/pico_sdk_init.cmake) 56 | if (NOT EXISTS ${PICO_SDK_INIT_CMAKE_FILE}) 57 | message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' does not appear to contain the Raspberry Pi Pico SDK") 58 | endif () 59 | 60 | set(PICO_SDK_PATH ${PICO_SDK_PATH} CACHE PATH "Path to the Raspberry Pi Pico SDK" FORCE) 61 | 62 | include(${PICO_SDK_INIT_CMAKE_FILE}) 63 | -------------------------------------------------------------------------------- /er-tft0.96-1/ui.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2021 Wenting Zhang 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | #pragma once 23 | 24 | #define UI_HEIGHT LCD_HEIGHT 25 | #define UI_WIDTH LCD_WIDTH 26 | 27 | void ui_init(void); 28 | void ui_clear(uint16_t c); 29 | void ui_disp_string(int x, int y, char *str, uint16_t c); 30 | int ui_disp_string_bb(char *str, int width); 31 | //void ui_disp_fill(int x1, int y1, int x2, int y2, uint16_t c); 32 | void ui_disp_num(int x, int y, uint32_t num, uint16_t c); 33 | void ui_disp_hex(int x, int y, uint32_t num, uint16_t c); 34 | int ui_printf(int x, int y, const char *format, ...); 35 | -------------------------------------------------------------------------------- /gbp/main_core1.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Freescale Semiconductor, Inc. 3 | * Copyright 2016-2018 NXP 4 | * All rights reserved. 5 | * 6 | * SPDX-License-Identifier: BSD-3-Clause 7 | */ 8 | 9 | #include "board.h" 10 | #include "fsl_mailbox.h" 11 | #include "fsl_ctimer.h" 12 | 13 | #include "fsl_common.h" 14 | #include "pin_mux.h" 15 | #include "stnlcd.h" 16 | /******************************************************************************* 17 | * Definitions 18 | ******************************************************************************/ 19 | #define PRIMARY_CORE_MAILBOX_CPU_ID kMAILBOX_CM33_Core0 20 | #define SECONDARY_CORE_MAILBOX_CPU_ID kMAILBOX_CM33_Core1 21 | 22 | #define START_EVENT 1234 23 | 24 | /******************************************************************************* 25 | * Prototypes 26 | ******************************************************************************/ 27 | void ctimer_match0_callback(uint32_t flags); 28 | 29 | ctimer_callback_t ctimer_callback_table[] = { 30 | NULL, ctimer_match0_callback, NULL, NULL, NULL, NULL, NULL, NULL}; 31 | 32 | /******************************************************************************* 33 | * Variables 34 | ******************************************************************************/ 35 | volatile uint32_t g_msg; 36 | static ctimer_match_config_t matchConfig0; 37 | 38 | /******************************************************************************* 39 | * Code 40 | ******************************************************************************/ 41 | void MAILBOX_IRQHandler() 42 | { 43 | g_msg = MAILBOX_GetValue(MAILBOX, SECONDARY_CORE_MAILBOX_CPU_ID); 44 | MAILBOX_ClearValueBits(MAILBOX, SECONDARY_CORE_MAILBOX_CPU_ID, 0xffffffff); 45 | g_msg++; 46 | MAILBOX_SetValue(MAILBOX, PRIMARY_CORE_MAILBOX_CPU_ID, g_msg); 47 | } 48 | 49 | void ctimer_match0_callback(uint32_t flags) 50 | { 51 | STN_Line(); 52 | } 53 | 54 | /*! 55 | * @brief Main function 56 | */ 57 | int main(void) 58 | { 59 | ctimer_config_t config; 60 | 61 | /* Init board hardware.*/ 62 | BOARD_InitPins_Core1(); 63 | 64 | /* Initialize Mailbox */ 65 | MAILBOX_Init(MAILBOX); 66 | 67 | /* Enable mailbox interrupt */ 68 | NVIC_EnableIRQ(MAILBOX_IRQn); 69 | 70 | /* Let the other side know the application is up and running */ 71 | MAILBOX_SetValue(MAILBOX, PRIMARY_CORE_MAILBOX_CPU_ID, (uint32_t)START_EVENT); 72 | 73 | /* Initialize screen driver */ 74 | STN_Init(); 75 | 76 | /* Use 12 MHz clock for some of the Ctimers */ 77 | CLOCK_AttachClk(kFRO_HF_to_CTIMER2); 78 | 79 | CTIMER_GetDefaultConfig(&config); 80 | 81 | CTIMER_Init(CTIMER2, &config); 82 | 83 | /* Configuration 0 */ 84 | matchConfig0.enableCounterReset = true; 85 | matchConfig0.enableCounterStop = false; 86 | matchConfig0.matchValue = CLOCK_GetFreq(kCLOCK_CTmier2) / 13600; // Hsync = 13.6kHz 87 | matchConfig0.outControl = kCTIMER_Output_NoAction; 88 | matchConfig0.outPinInitState = false; 89 | matchConfig0.enableInterrupt = true; 90 | 91 | CTIMER_RegisterCallBack(CTIMER2, &ctimer_callback_table[0], kCTIMER_MultipleCallback); 92 | CTIMER_SetupMatch(CTIMER2, kCTIMER_Match_1, &matchConfig0); 93 | CTIMER_StartTimer(CTIMER2); 94 | 95 | while (1) 96 | { 97 | __WFI(); 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /gbp/stnlcd.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 Wenting Zhang 3 | * All rights reserved. 4 | * 5 | * SPDX-License-Identifier: BSD-3-Clause 6 | */ 7 | #include "fsl_gpio.h" 8 | #include "pin_mux.h" 9 | 10 | extern const unsigned char gImage_160144test2bpp[23040]; 11 | unsigned char framebuffer[160*160]; 12 | static unsigned y; 13 | 14 | #define STN_CPG_H() GPIO->SET[BOARD_INITPINS_CORE1_STN_CPG_PORT] = 1u << BOARD_INITPINS_CORE1_STN_CPG_PIN 15 | #define STN_CPG_L() GPIO->CLR[BOARD_INITPINS_CORE1_STN_CPG_PORT] = 1u << BOARD_INITPINS_CORE1_STN_CPG_PIN 16 | #define STN_CPG_W(x) GPIO->B[BOARD_INITPINS_CORE1_STN_CPG_PORT][BOARD_INITPINS_CORE1_STN_CPG_PIN] = x 17 | #define STN_CPL_H() GPIO->SET[BOARD_INITPINS_CORE1_STN_CPL_PORT] = 1u << BOARD_INITPINS_CORE1_STN_CPL_PIN 18 | #define STN_CPL_L() GPIO->CLR[BOARD_INITPINS_CORE1_STN_CPL_PORT] = 1u << BOARD_INITPINS_CORE1_STN_CPL_PIN 19 | #define STN_ST_H() GPIO->SET[BOARD_INITPINS_CORE1_STN_ST_PORT] = 1u << BOARD_INITPINS_CORE1_STN_ST_PIN 20 | #define STN_ST_L() GPIO->CLR[BOARD_INITPINS_CORE1_STN_ST_PORT] = 1u << BOARD_INITPINS_CORE1_STN_ST_PIN 21 | #define STN_CP_H() GPIO->SET[BOARD_INITPINS_CORE1_STN_CP_PORT] = 1u << BOARD_INITPINS_CORE1_STN_CP_PIN 22 | #define STN_CP_L() GPIO->CLR[BOARD_INITPINS_CORE1_STN_CP_PORT] = 1u << BOARD_INITPINS_CORE1_STN_CP_PIN 23 | #define STN_FR_T() GPIO->NOT[BOARD_INITPINS_CORE1_STN_FR_PORT] = 1u << BOARD_INITPINS_CORE1_STN_FR_PIN 24 | #define STN_S_W(x) GPIO->B[BOARD_INITPINS_CORE1_STN_S_PORT][BOARD_INITPINS_CORE1_STN_S_PIN] = x 25 | #define STN_D0_W(x) GPIO->B[BOARD_INITPINS_CORE1_STN_D0_PORT][BOARD_INITPINS_CORE1_STN_D0_PIN] = x 26 | #define STN_D1_W(x) GPIO->B[BOARD_INITPINS_CORE1_STN_D1_PORT][BOARD_INITPINS_CORE1_STN_D1_PIN] = x 27 | 28 | void STN_Wait(unsigned long t) 29 | { 30 | int i; 31 | while(t--) { 32 | for (i = 0; i < 5; i++) 33 | asm("nop"); 34 | } 35 | } 36 | 37 | void STN_Line() { 38 | unsigned x; 39 | 40 | if (y == 0) STN_FR_T(); 41 | 42 | // Line start sequence 43 | STN_CPG_H(); 44 | STN_CPL_H(); 45 | STN_Wait(2); 46 | STN_CPL_L(); 47 | 48 | STN_Wait(1); 49 | STN_S_W((y == 0) ? 1 : 0); // Frame Sync 50 | STN_Wait(1); 51 | STN_CPG_L(); 52 | STN_Wait(2); 53 | STN_CPG_H(); 54 | STN_Wait(2); 55 | STN_CPG_L(); 56 | 57 | // Before Line start 58 | STN_Wait(16); 59 | STN_ST_H(); 60 | STN_Wait(2); 61 | STN_CP_H(); 62 | STN_Wait(1); 63 | STN_CP_L(); 64 | STN_Wait(2); 65 | STN_ST_L(); 66 | STN_Wait(1); 67 | 68 | int ptr = y * 160; 69 | 70 | // Shift out pixels 71 | for (x = 0; x < 160; x++) { 72 | STN_CP_H(); 73 | STN_CPG_W(((x >= 84) && (x < 88)) ? 1 : 0); 74 | STN_D0_W((framebuffer[ptr] >> 6) & 1); 75 | STN_D1_W((framebuffer[ptr] >> 7) & 1); 76 | ptr ++; 77 | STN_CP_L(); 78 | } 79 | 80 | // Nothing to do now 81 | STN_Wait(0); 82 | STN_CPG_H(); 83 | STN_Wait(2); 84 | STN_CPG_L(); 85 | 86 | // Increment line counter 87 | y = (y < 159) ? (y+1) : 0; 88 | } 89 | 90 | void STN_Init() { 91 | // Actually, there is nothing much to initialize 92 | memcpy(framebuffer, gImage_160144test2bpp, 23040); 93 | /*for (int i = 0; i < 23040; i++) { 94 | framebuffer[i] = (i & 1) ? 0xff : 0x00; 95 | }*/ 96 | y = 0; 97 | } 98 | -------------------------------------------------------------------------------- /gbp/stnlcd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * stnlcd.h 3 | * 4 | * Created on: 2019年9月21日 5 | * Author: Wenting 6 | */ 7 | 8 | #ifndef STNLCD_H_ 9 | #define STNLCD_H_ 10 | 11 | void STN_Init(); 12 | void STN_Line(); 13 | 14 | #endif /* STNLCD_H_ */ 15 | -------------------------------------------------------------------------------- /gpm675a0/lcd.h: -------------------------------------------------------------------------------- 1 | #ifndef __LCD_H__ 2 | #define __LCD_H__ 3 | 4 | #endif -------------------------------------------------------------------------------- /gv6416gfsl011/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Generated Cmake Pico project file 2 | 3 | cmake_minimum_required(VERSION 3.13) 4 | 5 | set(CMAKE_C_STANDARD 11) 6 | set(CMAKE_CXX_STANDARD 17) 7 | 8 | # initalize pico_sdk from installed location 9 | # (note this can come from environment, CMake cache etc) 10 | set(PICO_SDK_PATH "/Users/wenting/pico/pico-sdk") 11 | set(PICO_EXTRAS_PATH "/Users/wenting/pico/pico-extras") 12 | 13 | # Pull in Raspberry Pi Pico SDK (must be before project) 14 | include(pico_sdk_import.cmake) 15 | 16 | # We also need PICO EXTRAS 17 | include(pico_extras_import.cmake) 18 | 19 | project(lcddemo C CXX ASM) 20 | 21 | # Initialise the Raspberry Pi Pico SDK 22 | pico_sdk_init() 23 | 24 | add_executable(lcddemo) 25 | 26 | target_sources(lcddemo PRIVATE 27 | main.c 28 | lcd.c 29 | ) 30 | 31 | add_compile_definitions(lcddemo 32 | PICO_SD_CLK_PIN=26 33 | PICO_SD_CMD_PIN=18 34 | PICO_SD_DAT0_PIN=19 35 | PICO_SD_CARD_EXTRA_CLOCK_DIVIDER=2 36 | ) 37 | 38 | pico_set_program_name(lcddemo "lcddemo") 39 | pico_set_program_version(lcddemo "0.1") 40 | 41 | pico_enable_stdio_uart(lcddemo 0) 42 | pico_enable_stdio_usb(lcddemo 0) 43 | 44 | target_include_directories(lcddemo PRIVATE ${CMAKE_CURRENT_LIST_DIR}) 45 | 46 | # Add the standard library to the build 47 | target_link_libraries(lcddemo pico_stdlib hardware_dma hardware_pwm) 48 | 49 | # Add any user requested libraries 50 | target_link_libraries(lcddemo 51 | pico_stdlib 52 | pico_multicore 53 | pico_sd_card 54 | hardware_spi 55 | ) 56 | 57 | pico_add_extra_outputs(lcddemo) 58 | 59 | add_compile_options(-Ofast) 60 | -------------------------------------------------------------------------------- /gv6416gfsl011/lcd.h: -------------------------------------------------------------------------------- 1 | // 2 | // This code is based on https://yuanze.wang/posts/st7049a-rgb-backlight-tn-lcd 3 | // 4 | #pragma once 5 | 6 | #define LCD_X_PIXELS 64 7 | #define LCD_Y_PIXELS 16 8 | 9 | typedef enum { 10 | lcd_color_white = 0, 11 | lcd_color_yellow = 1, 12 | lcd_color_pink = 2, 13 | lcd_color_red = 3, 14 | lcd_color_cyan = 4, 15 | lcd_color_green = 5, 16 | lcd_color_blue = 6, 17 | lcd_color_black = 7, 18 | lcd_color_max 19 | } lcd_color_t; 20 | 21 | void lcd_init(void); 22 | void lcd_set_point(int x, int y, lcd_color_t color); 23 | void lcd_send_buffer(); 24 | void lcd_clear(); 25 | void lcd_test(uint8_t a); 26 | -------------------------------------------------------------------------------- /gv6416gfsl011/pico_extras_import.cmake: -------------------------------------------------------------------------------- 1 | # This is a copy of /external/pico_extras_import.cmake 2 | 3 | # This can be dropped into an external project to help locate pico-extras 4 | # It should be include()ed prior to project() 5 | 6 | if (DEFINED ENV{PICO_EXTRAS_PATH} AND (NOT PICO_EXTRAS_PATH)) 7 | set(PICO_EXTRAS_PATH $ENV{PICO_EXTRAS_PATH}) 8 | message("Using PICO_EXTRAS_PATH from environment ('${PICO_EXTRAS_PATH}')") 9 | endif () 10 | 11 | if (DEFINED ENV{PICO_EXTRAS_FETCH_FROM_GIT} AND (NOT PICO_EXTRAS_FETCH_FROM_GIT)) 12 | set(PICO_EXTRAS_FETCH_FROM_GIT $ENV{PICO_EXTRAS_FETCH_FROM_GIT}) 13 | message("Using PICO_EXTRAS_FETCH_FROM_GIT from environment ('${PICO_EXTRAS_FETCH_FROM_GIT}')") 14 | endif () 15 | 16 | if (DEFINED ENV{PICO_EXTRAS_FETCH_FROM_GIT_PATH} AND (NOT PICO_EXTRAS_FETCH_FROM_GIT_PATH)) 17 | set(PICO_EXTRAS_FETCH_FROM_GIT_PATH $ENV{PICO_EXTRAS_FETCH_FROM_GIT_PATH}) 18 | message("Using PICO_EXTRAS_FETCH_FROM_GIT_PATH from environment ('${PICO_EXTRAS_FETCH_FROM_GIT_PATH}')") 19 | endif () 20 | 21 | if (NOT PICO_EXTRAS_PATH) 22 | if (PICO_EXTRAS_FETCH_FROM_GIT) 23 | include(FetchContent) 24 | set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR}) 25 | if (PICO_EXTRAS_FETCH_FROM_GIT_PATH) 26 | get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_EXTRAS_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}") 27 | endif () 28 | FetchContent_Declare( 29 | PICO_EXTRAS 30 | GIT_REPOSITORY https://github.com/raspberrypi/pico-extras 31 | GIT_TAG master 32 | ) 33 | if (NOT PICO_EXTRAS) 34 | message("Downloading PICO EXTRAS") 35 | FetchContent_Populate(PICO_EXTRAS) 36 | set(PICO_EXTRAS_PATH ${PICO_EXTRAS_SOURCE_DIR}) 37 | endif () 38 | set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE}) 39 | else () 40 | if (PICO_SDK_PATH AND EXISTS "${PICO_SDK_PATH}/../pico-extras") 41 | set(PICO_EXTRAS_PATH ${PICO_SDK_PATH}/../pico-extras) 42 | message("Defaulting PICO_EXTRAS_PATH as sibling of PICO_SDK_PATH: ${PICO_EXTRAS_PATH}") 43 | else() 44 | message(FATAL_ERROR 45 | "PICO EXTRAS location was not specified. Please set PICO_EXTRAS_PATH or set PICO_EXTRAS_FETCH_FROM_GIT to on to fetch from git." 46 | ) 47 | endif() 48 | endif () 49 | endif () 50 | 51 | set(PICO_EXTRAS_PATH "${PICO_EXTRAS_PATH}" CACHE PATH "Path to the PICO EXTRAS") 52 | set(PICO_EXTRAS_FETCH_FROM_GIT "${PICO_EXTRAS_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of PICO EXTRAS from git if not otherwise locatable") 53 | set(PICO_EXTRAS_FETCH_FROM_GIT_PATH "${PICO_EXTRAS_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download EXTRAS") 54 | 55 | get_filename_component(PICO_EXTRAS_PATH "${PICO_EXTRAS_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") 56 | if (NOT EXISTS ${PICO_EXTRAS_PATH}) 57 | message(FATAL_ERROR "Directory '${PICO_EXTRAS_PATH}' not found") 58 | endif () 59 | 60 | set(PICO_EXTRAS_PATH ${PICO_EXTRAS_PATH} CACHE PATH "Path to the PICO EXTRAS" FORCE) 61 | 62 | add_subdirectory(${PICO_EXTRAS_PATH} pico_extras) -------------------------------------------------------------------------------- /gv6416gfsl011/pico_sdk_import.cmake: -------------------------------------------------------------------------------- 1 | # This is a copy of /external/pico_sdk_import.cmake 2 | 3 | # This can be dropped into an external project to help locate this SDK 4 | # It should be include()ed prior to project() 5 | 6 | if (DEFINED ENV{PICO_SDK_PATH} AND (NOT PICO_SDK_PATH)) 7 | set(PICO_SDK_PATH $ENV{PICO_SDK_PATH}) 8 | message("Using PICO_SDK_PATH from environment ('${PICO_SDK_PATH}')") 9 | endif () 10 | 11 | if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT} AND (NOT PICO_SDK_FETCH_FROM_GIT)) 12 | set(PICO_SDK_FETCH_FROM_GIT $ENV{PICO_SDK_FETCH_FROM_GIT}) 13 | message("Using PICO_SDK_FETCH_FROM_GIT from environment ('${PICO_SDK_FETCH_FROM_GIT}')") 14 | endif () 15 | 16 | if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_PATH} AND (NOT PICO_SDK_FETCH_FROM_GIT_PATH)) 17 | set(PICO_SDK_FETCH_FROM_GIT_PATH $ENV{PICO_SDK_FETCH_FROM_GIT_PATH}) 18 | message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')") 19 | endif () 20 | 21 | set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the Raspberry Pi Pico SDK") 22 | set(PICO_SDK_FETCH_FROM_GIT "${PICO_SDK_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of SDK from git if not otherwise locatable") 23 | set(PICO_SDK_FETCH_FROM_GIT_PATH "${PICO_SDK_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download SDK") 24 | 25 | if (NOT PICO_SDK_PATH) 26 | if (PICO_SDK_FETCH_FROM_GIT) 27 | include(FetchContent) 28 | set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR}) 29 | if (PICO_SDK_FETCH_FROM_GIT_PATH) 30 | get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_SDK_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}") 31 | endif () 32 | FetchContent_Declare( 33 | pico_sdk 34 | GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk 35 | GIT_TAG master 36 | ) 37 | if (NOT pico_sdk) 38 | message("Downloading Raspberry Pi Pico SDK") 39 | FetchContent_Populate(pico_sdk) 40 | set(PICO_SDK_PATH ${pico_sdk_SOURCE_DIR}) 41 | endif () 42 | set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE}) 43 | else () 44 | message(FATAL_ERROR 45 | "SDK location was not specified. Please set PICO_SDK_PATH or set PICO_SDK_FETCH_FROM_GIT to on to fetch from git." 46 | ) 47 | endif () 48 | endif () 49 | 50 | get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") 51 | if (NOT EXISTS ${PICO_SDK_PATH}) 52 | message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' not found") 53 | endif () 54 | 55 | set(PICO_SDK_INIT_CMAKE_FILE ${PICO_SDK_PATH}/pico_sdk_init.cmake) 56 | if (NOT EXISTS ${PICO_SDK_INIT_CMAKE_FILE}) 57 | message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' does not appear to contain the Raspberry Pi Pico SDK") 58 | endif () 59 | 60 | set(PICO_SDK_PATH ${PICO_SDK_PATH} CACHE PATH "Path to the Raspberry Pi Pico SDK" FORCE) 61 | 62 | include(${PICO_SDK_INIT_CMAKE_FILE}) 63 | -------------------------------------------------------------------------------- /gy3216n1frn6a/lcd.h: -------------------------------------------------------------------------------- 1 | #ifndef __LCD_H__ 2 | #define __LCD_H__ 3 | 4 | #endif -------------------------------------------------------------------------------- /ip270-lcd/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Generated Cmake Pico project file 2 | 3 | cmake_minimum_required(VERSION 3.13) 4 | 5 | set(CMAKE_C_STANDARD 11) 6 | set(CMAKE_CXX_STANDARD 17) 7 | 8 | # initalize pico_sdk from installed location 9 | # (note this can come from environment, CMake cache etc) 10 | set(PICO_SDK_PATH "/home/wenting/pico/pico-sdk") 11 | 12 | # Pull in Raspberry Pi Pico SDK (must be before project) 13 | include(pico_sdk_import.cmake) 14 | 15 | project(fw C CXX ASM) 16 | 17 | # Initialise the Raspberry Pi Pico SDK 18 | pico_sdk_init() 19 | 20 | # Add executable. Default name is the project name, version 0.1 21 | 22 | add_executable(fw 23 | main.c 24 | ) 25 | 26 | pico_set_program_name(fw "fw") 27 | pico_set_program_version(fw "0.1") 28 | 29 | pico_enable_stdio_uart(fw 0) 30 | pico_enable_stdio_usb(fw 0) 31 | 32 | # Add the standard library to the build 33 | target_link_libraries(fw pico_stdlib) 34 | 35 | # Add any user requested libraries 36 | target_link_libraries(fw 37 | hardware_spi 38 | hardware_dma 39 | hardware_i2c 40 | ) 41 | 42 | pico_add_extra_outputs(fw) 43 | 44 | -------------------------------------------------------------------------------- /ip270-lcd/font.h: -------------------------------------------------------------------------------- 1 | static const char font[] = { 2 | 0x00, 0x00, 0x00, 0x00, 0x00,// (space) 3 | 0x00, 0x00, 0x5F, 0x00, 0x00,// ! 4 | 0x00, 0x07, 0x00, 0x07, 0x00,// " 5 | 0x14, 0x7F, 0x14, 0x7F, 0x14,// # 6 | 0x24, 0x2A, 0x7F, 0x2A, 0x12,// $ 7 | 0x23, 0x13, 0x08, 0x64, 0x62,// % 8 | 0x36, 0x49, 0x55, 0x22, 0x50,// & 9 | 0x00, 0x05, 0x03, 0x00, 0x00,// ' 10 | 0x00, 0x1C, 0x22, 0x41, 0x00,// ( 11 | 0x00, 0x41, 0x22, 0x1C, 0x00,// ) 12 | 0x08, 0x2A, 0x1C, 0x2A, 0x08,// * 13 | 0x08, 0x08, 0x3E, 0x08, 0x08,// + 14 | 0x00, 0x50, 0x30, 0x00, 0x00,// , 15 | 0x08, 0x08, 0x08, 0x08, 0x08,// - 16 | 0x00, 0x60, 0x60, 0x00, 0x00,// . 17 | 0x20, 0x10, 0x08, 0x04, 0x02,// / 18 | 0x3E, 0x51, 0x49, 0x45, 0x3E,// 0 19 | 0x00, 0x42, 0x7F, 0x40, 0x00,// 1 20 | 0x42, 0x61, 0x51, 0x49, 0x46,// 2 21 | 0x21, 0x41, 0x45, 0x4B, 0x31,// 3 22 | 0x18, 0x14, 0x12, 0x7F, 0x10,// 4 23 | 0x27, 0x45, 0x45, 0x45, 0x39,// 5 24 | 0x3C, 0x4A, 0x49, 0x49, 0x30,// 6 25 | 0x01, 0x71, 0x09, 0x05, 0x03,// 7 26 | 0x36, 0x49, 0x49, 0x49, 0x36,// 8 27 | 0x06, 0x49, 0x49, 0x29, 0x1E,// 9 28 | 0x00, 0x36, 0x36, 0x00, 0x00,// : 29 | 0x00, 0x56, 0x36, 0x00, 0x00,// ; 30 | 0x00, 0x08, 0x14, 0x22, 0x41,// < 31 | 0x14, 0x14, 0x14, 0x14, 0x14,// = 32 | 0x41, 0x22, 0x14, 0x08, 0x00,// > 33 | 0x02, 0x01, 0x51, 0x09, 0x06,// ? 34 | 0x32, 0x49, 0x79, 0x41, 0x3E,// @ 35 | 0x7E, 0x11, 0x11, 0x11, 0x7E,// A 36 | 0x7F, 0x49, 0x49, 0x49, 0x36,// B 37 | 0x3E, 0x41, 0x41, 0x41, 0x22,// C 38 | 0x7F, 0x41, 0x41, 0x22, 0x1C,// D 39 | 0x7F, 0x49, 0x49, 0x49, 0x41,// E 40 | 0x7F, 0x09, 0x09, 0x01, 0x01,// F 41 | 0x3E, 0x41, 0x41, 0x51, 0x32,// G 42 | 0x7F, 0x08, 0x08, 0x08, 0x7F,// H 43 | 0x00, 0x41, 0x7F, 0x41, 0x00,// I 44 | 0x20, 0x40, 0x41, 0x3F, 0x01,// J 45 | 0x7F, 0x08, 0x14, 0x22, 0x41,// K 46 | 0x7F, 0x40, 0x40, 0x40, 0x40,// L 47 | 0x7F, 0x02, 0x04, 0x02, 0x7F,// M 48 | 0x7F, 0x04, 0x08, 0x10, 0x7F,// N 49 | 0x3E, 0x41, 0x41, 0x41, 0x3E,// O 50 | 0x7F, 0x09, 0x09, 0x09, 0x06,// P 51 | 0x3E, 0x41, 0x51, 0x21, 0x5E,// Q 52 | 0x7F, 0x09, 0x19, 0x29, 0x46,// R 53 | 0x46, 0x49, 0x49, 0x49, 0x31,// S 54 | 0x01, 0x01, 0x7F, 0x01, 0x01,// T 55 | 0x3F, 0x40, 0x40, 0x40, 0x3F,// U 56 | 0x1F, 0x20, 0x40, 0x20, 0x1F,// V 57 | 0x7F, 0x20, 0x18, 0x20, 0x7F,// W 58 | 0x63, 0x14, 0x08, 0x14, 0x63,// X 59 | 0x03, 0x04, 0x78, 0x04, 0x03,// Y 60 | 0x61, 0x51, 0x49, 0x45, 0x43,// Z 61 | 0x00, 0x00, 0x7F, 0x41, 0x41,// [ 62 | 0x02, 0x04, 0x08, 0x10, 0x20,// "\" 63 | 0x41, 0x41, 0x7F, 0x00, 0x00,// ] 64 | 0x04, 0x02, 0x01, 0x02, 0x04,// ^ 65 | 0x40, 0x40, 0x40, 0x40, 0x40,// _ 66 | 0x00, 0x01, 0x02, 0x04, 0x00,// ` 67 | 0x20, 0x54, 0x54, 0x54, 0x78,// a 68 | 0x7F, 0x48, 0x44, 0x44, 0x38,// b 69 | 0x38, 0x44, 0x44, 0x44, 0x20,// c 70 | 0x38, 0x44, 0x44, 0x48, 0x7F,// d 71 | 0x38, 0x54, 0x54, 0x54, 0x18,// e 72 | 0x08, 0x7E, 0x09, 0x01, 0x02,// f 73 | 0x08, 0x14, 0x54, 0x54, 0x3C,// g 74 | 0x7F, 0x08, 0x04, 0x04, 0x78,// h 75 | 0x00, 0x44, 0x7D, 0x40, 0x00,// i 76 | 0x20, 0x40, 0x44, 0x3D, 0x00,// j 77 | 0x00, 0x7F, 0x10, 0x28, 0x44,// k 78 | 0x00, 0x41, 0x7F, 0x40, 0x00,// l 79 | 0x7C, 0x04, 0x18, 0x04, 0x78,// m 80 | 0x7C, 0x08, 0x04, 0x04, 0x78,// n 81 | 0x38, 0x44, 0x44, 0x44, 0x38,// o 82 | 0x7C, 0x14, 0x14, 0x14, 0x08,// p 83 | 0x08, 0x14, 0x14, 0x18, 0x7C,// q 84 | 0x7C, 0x08, 0x04, 0x04, 0x08,// r 85 | 0x48, 0x54, 0x54, 0x54, 0x20,// s 86 | 0x04, 0x3F, 0x44, 0x40, 0x20,// t 87 | 0x3C, 0x40, 0x40, 0x20, 0x7C,// u 88 | 0x1C, 0x20, 0x40, 0x20, 0x1C,// v 89 | 0x3C, 0x40, 0x30, 0x40, 0x3C,// w 90 | 0x44, 0x28, 0x10, 0x28, 0x44,// x 91 | 0x0C, 0x50, 0x50, 0x50, 0x3C,// y 92 | 0x44, 0x64, 0x54, 0x4C, 0x44,// z 93 | 0x00, 0x08, 0x36, 0x41, 0x00,// { 94 | 0x00, 0x00, 0x7F, 0x00, 0x00,// | 95 | 0x00, 0x41, 0x36, 0x08, 0x00,// } 96 | 0x08, 0x08, 0x2A, 0x1C, 0x08,// -> 97 | 0x08, 0x1C, 0x2A, 0x08, 0x08 // <- 98 | }; -------------------------------------------------------------------------------- /ip270-lcd/pico_sdk_import.cmake: -------------------------------------------------------------------------------- 1 | # This is a copy of /external/pico_sdk_import.cmake 2 | 3 | # This can be dropped into an external project to help locate this SDK 4 | # It should be include()ed prior to project() 5 | 6 | if (DEFINED ENV{PICO_SDK_PATH} AND (NOT PICO_SDK_PATH)) 7 | set(PICO_SDK_PATH $ENV{PICO_SDK_PATH}) 8 | message("Using PICO_SDK_PATH from environment ('${PICO_SDK_PATH}')") 9 | endif () 10 | 11 | if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT} AND (NOT PICO_SDK_FETCH_FROM_GIT)) 12 | set(PICO_SDK_FETCH_FROM_GIT $ENV{PICO_SDK_FETCH_FROM_GIT}) 13 | message("Using PICO_SDK_FETCH_FROM_GIT from environment ('${PICO_SDK_FETCH_FROM_GIT}')") 14 | endif () 15 | 16 | if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_PATH} AND (NOT PICO_SDK_FETCH_FROM_GIT_PATH)) 17 | set(PICO_SDK_FETCH_FROM_GIT_PATH $ENV{PICO_SDK_FETCH_FROM_GIT_PATH}) 18 | message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')") 19 | endif () 20 | 21 | set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the Raspberry Pi Pico SDK") 22 | set(PICO_SDK_FETCH_FROM_GIT "${PICO_SDK_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of SDK from git if not otherwise locatable") 23 | set(PICO_SDK_FETCH_FROM_GIT_PATH "${PICO_SDK_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download SDK") 24 | 25 | if (NOT PICO_SDK_PATH) 26 | if (PICO_SDK_FETCH_FROM_GIT) 27 | include(FetchContent) 28 | set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR}) 29 | if (PICO_SDK_FETCH_FROM_GIT_PATH) 30 | get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_SDK_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}") 31 | endif () 32 | FetchContent_Declare( 33 | pico_sdk 34 | GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk 35 | GIT_TAG master 36 | ) 37 | if (NOT pico_sdk) 38 | message("Downloading Raspberry Pi Pico SDK") 39 | FetchContent_Populate(pico_sdk) 40 | set(PICO_SDK_PATH ${pico_sdk_SOURCE_DIR}) 41 | endif () 42 | set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE}) 43 | else () 44 | message(FATAL_ERROR 45 | "SDK location was not specified. Please set PICO_SDK_PATH or set PICO_SDK_FETCH_FROM_GIT to on to fetch from git." 46 | ) 47 | endif () 48 | endif () 49 | 50 | get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") 51 | if (NOT EXISTS ${PICO_SDK_PATH}) 52 | message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' not found") 53 | endif () 54 | 55 | set(PICO_SDK_INIT_CMAKE_FILE ${PICO_SDK_PATH}/pico_sdk_init.cmake) 56 | if (NOT EXISTS ${PICO_SDK_INIT_CMAKE_FILE}) 57 | message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' does not appear to contain the Raspberry Pi Pico SDK") 58 | endif () 59 | 60 | set(PICO_SDK_PATH ${PICO_SDK_PATH} CACHE PATH "Path to the Raspberry Pi Pico SDK" FORCE) 61 | 62 | include(${PICO_SDK_INIT_CMAKE_FILE}) 63 | -------------------------------------------------------------------------------- /lb18db/demo/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Generated Cmake Pico project file 2 | 3 | cmake_minimum_required(VERSION 3.13) 4 | 5 | set(CMAKE_C_STANDARD 11) 6 | set(CMAKE_CXX_STANDARD 17) 7 | 8 | # initalize pico_sdk from installed location 9 | # (note this can come from environment, CMake cache etc) 10 | set(PICO_SDK_PATH "/home/wenting/pico/pico-sdk") 11 | set(PICO_EXTRAS_PATH "/home/wenting/pico/pico-extras") 12 | 13 | # Pull in Raspberry Pi Pico SDK (must be before project) 14 | include(pico_sdk_import.cmake) 15 | 16 | # We also need PICO EXTRAS 17 | include(pico_extras_import.cmake) 18 | 19 | project(lcddemo C CXX ASM) 20 | 21 | # Initialise the Raspberry Pi Pico SDK 22 | pico_sdk_init() 23 | 24 | add_executable(lcddemo) 25 | 26 | pico_generate_pio_header(lcddemo ${CMAKE_CURRENT_LIST_DIR}/lcddata.pio) 27 | 28 | target_sources(lcddemo PRIVATE 29 | main.c 30 | lcd.c 31 | ) 32 | 33 | pico_set_program_name(lcddemo "lcddemo") 34 | pico_set_program_version(lcddemo "0.1") 35 | 36 | pico_enable_stdio_uart(lcddemo 0) 37 | pico_enable_stdio_usb(lcddemo 1) 38 | 39 | target_include_directories(lcddemo PRIVATE ${CMAKE_CURRENT_LIST_DIR}) 40 | 41 | # Add the standard library to the build 42 | target_link_libraries(lcddemo pico_stdlib hardware_dma) 43 | 44 | # Add any user requested libraries 45 | target_link_libraries(lcddemo 46 | hardware_pio 47 | ) 48 | 49 | pico_add_extra_outputs(lcddemo) 50 | 51 | -------------------------------------------------------------------------------- /lb18db/demo/lcd.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2021 Wenting Zhang 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | #pragma once 23 | 24 | #define VSYNC_PIN (9) 25 | #define HSYNC_PIN (8) 26 | #define PIXCLK_PIN (10) 27 | // DATA_PIN 28 | #define D0_PIN (0) 29 | 30 | // PIO related 31 | #define LCD_DATA_SM (0) 32 | #define LCD_CLK_SM (1) 33 | 34 | // Screen related 35 | 36 | #define LCD_BUS_WIDTH (8) 37 | 38 | #define SCR_WIDTH (372) 39 | #define SCR_HEIGHT (242) 40 | 41 | #define SCR_HSYNC (20) 42 | 43 | #define SRC_X_OFFSET (26) 44 | #define SRC_Y_OFFSET (3) 45 | 46 | #define LCD_TARGET_HZ (60) 47 | #define LCD_TARGET_PIXCLK (LCD_TARGET_HZ * (SCR_WIDTH + 40) * (SCR_HEIGHT + 10)) 48 | 49 | // Public variables and functions 50 | extern unsigned char framebuf_bp0[SCR_WIDTH * SCR_HEIGHT]; 51 | extern unsigned char framebuf_bp1[SCR_WIDTH * SCR_HEIGHT]; 52 | extern volatile bool frame_sync; 53 | 54 | void lcd_start(); 55 | unsigned char *lcd_swap_buffer(); 56 | void lcd_wait_vsync(); -------------------------------------------------------------------------------- /lb18db/demo/lcddata.pio: -------------------------------------------------------------------------------- 1 | 2 | .program lcd_data 3 | line_loop: 4 | ; Send hsync pulse (32+32+2=66 cycles) 5 | set pins, 0b10 [31] ; Vsync inactive, Hsync active 6 | nop [31] 7 | set pins, 0b11 [1] ; Vsync inactive, Hsync inactive 8 | ; Output line data 9 | mov x, isr [1] 10 | data_loop: 11 | out pins, 8 [2] 12 | jmp x-- data_loop 13 | ; end of line 14 | nop [2] 15 | jmp y-- line_loop 16 | ; End of data frame, send Vsync 17 | 18 | set y, 20 [1] 19 | 20 | dummy_line_loop: 21 | set pins, 0b00 [31] ; Vsync active, Hsync active 22 | nop [31] 23 | set pins, 0b01 [1] ; Vsync active, Hsync inactive 24 | ; Output dummy line 25 | mov x, isr 26 | nop 27 | dummy_data_loop: 28 | nop [2] 29 | jmp x-- dummy_data_loop 30 | nop 31 | jmp y-- dummy_line_loop 32 | ; end of frame, signal CPU 33 | irq wait 1 side 0 34 | 35 | 36 | .program lcd_clk 37 | .wrap_target 38 | set pins, 1 39 | set pins, 0 40 | .wrap -------------------------------------------------------------------------------- /lb18db/demo/pico_extras_import.cmake: -------------------------------------------------------------------------------- 1 | # This is a copy of /external/pico_extras_import.cmake 2 | 3 | # This can be dropped into an external project to help locate pico-extras 4 | # It should be include()ed prior to project() 5 | 6 | if (DEFINED ENV{PICO_EXTRAS_PATH} AND (NOT PICO_EXTRAS_PATH)) 7 | set(PICO_EXTRAS_PATH $ENV{PICO_EXTRAS_PATH}) 8 | message("Using PICO_EXTRAS_PATH from environment ('${PICO_EXTRAS_PATH}')") 9 | endif () 10 | 11 | if (DEFINED ENV{PICO_EXTRAS_FETCH_FROM_GIT} AND (NOT PICO_EXTRAS_FETCH_FROM_GIT)) 12 | set(PICO_EXTRAS_FETCH_FROM_GIT $ENV{PICO_EXTRAS_FETCH_FROM_GIT}) 13 | message("Using PICO_EXTRAS_FETCH_FROM_GIT from environment ('${PICO_EXTRAS_FETCH_FROM_GIT}')") 14 | endif () 15 | 16 | if (DEFINED ENV{PICO_EXTRAS_FETCH_FROM_GIT_PATH} AND (NOT PICO_EXTRAS_FETCH_FROM_GIT_PATH)) 17 | set(PICO_EXTRAS_FETCH_FROM_GIT_PATH $ENV{PICO_EXTRAS_FETCH_FROM_GIT_PATH}) 18 | message("Using PICO_EXTRAS_FETCH_FROM_GIT_PATH from environment ('${PICO_EXTRAS_FETCH_FROM_GIT_PATH}')") 19 | endif () 20 | 21 | if (NOT PICO_EXTRAS_PATH) 22 | if (PICO_EXTRAS_FETCH_FROM_GIT) 23 | include(FetchContent) 24 | set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR}) 25 | if (PICO_EXTRAS_FETCH_FROM_GIT_PATH) 26 | get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_EXTRAS_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}") 27 | endif () 28 | FetchContent_Declare( 29 | PICO_EXTRAS 30 | GIT_REPOSITORY https://github.com/raspberrypi/pico-extras 31 | GIT_TAG master 32 | ) 33 | if (NOT PICO_EXTRAS) 34 | message("Downloading PICO EXTRAS") 35 | FetchContent_Populate(PICO_EXTRAS) 36 | set(PICO_EXTRAS_PATH ${PICO_EXTRAS_SOURCE_DIR}) 37 | endif () 38 | set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE}) 39 | else () 40 | if (PICO_SDK_PATH AND EXISTS "${PICO_SDK_PATH}/../pico-extras") 41 | set(PICO_EXTRAS_PATH ${PICO_SDK_PATH}/../pico-extras) 42 | message("Defaulting PICO_EXTRAS_PATH as sibling of PICO_SDK_PATH: ${PICO_EXTRAS_PATH}") 43 | else() 44 | message(FATAL_ERROR 45 | "PICO EXTRAS location was not specified. Please set PICO_EXTRAS_PATH or set PICO_EXTRAS_FETCH_FROM_GIT to on to fetch from git." 46 | ) 47 | endif() 48 | endif () 49 | endif () 50 | 51 | set(PICO_EXTRAS_PATH "${PICO_EXTRAS_PATH}" CACHE PATH "Path to the PICO EXTRAS") 52 | set(PICO_EXTRAS_FETCH_FROM_GIT "${PICO_EXTRAS_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of PICO EXTRAS from git if not otherwise locatable") 53 | set(PICO_EXTRAS_FETCH_FROM_GIT_PATH "${PICO_EXTRAS_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download EXTRAS") 54 | 55 | get_filename_component(PICO_EXTRAS_PATH "${PICO_EXTRAS_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") 56 | if (NOT EXISTS ${PICO_EXTRAS_PATH}) 57 | message(FATAL_ERROR "Directory '${PICO_EXTRAS_PATH}' not found") 58 | endif () 59 | 60 | set(PICO_EXTRAS_PATH ${PICO_EXTRAS_PATH} CACHE PATH "Path to the PICO EXTRAS" FORCE) 61 | 62 | add_subdirectory(${PICO_EXTRAS_PATH} pico_extras) -------------------------------------------------------------------------------- /lb18db/demo/pico_sdk_import.cmake: -------------------------------------------------------------------------------- 1 | # This is a copy of /external/pico_sdk_import.cmake 2 | 3 | # This can be dropped into an external project to help locate this SDK 4 | # It should be include()ed prior to project() 5 | 6 | if (DEFINED ENV{PICO_SDK_PATH} AND (NOT PICO_SDK_PATH)) 7 | set(PICO_SDK_PATH $ENV{PICO_SDK_PATH}) 8 | message("Using PICO_SDK_PATH from environment ('${PICO_SDK_PATH}')") 9 | endif () 10 | 11 | if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT} AND (NOT PICO_SDK_FETCH_FROM_GIT)) 12 | set(PICO_SDK_FETCH_FROM_GIT $ENV{PICO_SDK_FETCH_FROM_GIT}) 13 | message("Using PICO_SDK_FETCH_FROM_GIT from environment ('${PICO_SDK_FETCH_FROM_GIT}')") 14 | endif () 15 | 16 | if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_PATH} AND (NOT PICO_SDK_FETCH_FROM_GIT_PATH)) 17 | set(PICO_SDK_FETCH_FROM_GIT_PATH $ENV{PICO_SDK_FETCH_FROM_GIT_PATH}) 18 | message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')") 19 | endif () 20 | 21 | set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the Raspberry Pi Pico SDK") 22 | set(PICO_SDK_FETCH_FROM_GIT "${PICO_SDK_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of SDK from git if not otherwise locatable") 23 | set(PICO_SDK_FETCH_FROM_GIT_PATH "${PICO_SDK_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download SDK") 24 | 25 | if (NOT PICO_SDK_PATH) 26 | if (PICO_SDK_FETCH_FROM_GIT) 27 | include(FetchContent) 28 | set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR}) 29 | if (PICO_SDK_FETCH_FROM_GIT_PATH) 30 | get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_SDK_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}") 31 | endif () 32 | FetchContent_Declare( 33 | pico_sdk 34 | GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk 35 | GIT_TAG master 36 | ) 37 | if (NOT pico_sdk) 38 | message("Downloading Raspberry Pi Pico SDK") 39 | FetchContent_Populate(pico_sdk) 40 | set(PICO_SDK_PATH ${pico_sdk_SOURCE_DIR}) 41 | endif () 42 | set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE}) 43 | else () 44 | message(FATAL_ERROR 45 | "SDK location was not specified. Please set PICO_SDK_PATH or set PICO_SDK_FETCH_FROM_GIT to on to fetch from git." 46 | ) 47 | endif () 48 | endif () 49 | 50 | get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") 51 | if (NOT EXISTS ${PICO_SDK_PATH}) 52 | message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' not found") 53 | endif () 54 | 55 | set(PICO_SDK_INIT_CMAKE_FILE ${PICO_SDK_PATH}/pico_sdk_init.cmake) 56 | if (NOT EXISTS ${PICO_SDK_INIT_CMAKE_FILE}) 57 | message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' does not appear to contain the Raspberry Pi Pico SDK") 58 | endif () 59 | 60 | set(PICO_SDK_PATH ${PICO_SDK_PATH} CACHE PATH "Path to the Raspberry Pi Pico SDK" FORCE) 61 | 62 | include(${PICO_SDK_INIT_CMAKE_FILE}) 63 | -------------------------------------------------------------------------------- /lb18db/imgcvt/config.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Target resolution 4 | #define TITLE "IMGVIEW" 5 | #define TARGET_FPS (30) 6 | #define DISP_WIDTH (312) 7 | #define DISP_HEIGHT (230) 8 | #define WINDOW_WIDTH (DISP_WIDTH * 2 + 1) 9 | #define WINDOW_HEIGHT (DISP_HEIGHT * 2) 10 | #define ENABLE_LPF 11 | -------------------------------------------------------------------------------- /lb18db/imgcvt/disp.h: -------------------------------------------------------------------------------- 1 | // 2 | // NekoInk Image Viewer 3 | // Copyright 2021 Wenting Zhang 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | // 23 | // File : disp.h 24 | // Brief: Hardware display related functions 25 | // 26 | #pragma once 27 | 28 | typedef enum { 29 | // Greyscale packed formats 30 | PIXFMT_Y1_PACKED, // 8 pixels per byte 31 | PIXFMT_Y2_PACKED, // 4 pixels per byte 32 | PIXFMT_Y4_PACKED, // 2 pixels per byte 33 | PIXFMT_Y8, // 1 pixels per byte 34 | // Greyscale formats in LSB 35 | PIXFMT_Y1_LSB, 36 | PIXFMT_Y2_LSB, 37 | PIXFMT_Y4_LSB, 38 | // Color formats 39 | PIXFMT_RGB888, // Always BE 40 | // Color formats, assuming little endian (preferred) 41 | PIXFMT_RGB565, 42 | PIXFMT_ARGB8888, // Actually BGRA8888 43 | PIXFMT_RGBA8888, // Actually ABGR8888 44 | // Color formats, using big endian 45 | PIXFMT_RGB565_BE, 46 | PIXFMT_ARGB8888_BE, 47 | PIXFMT_RGBA8888_BE, 48 | // Color formats for non-standard CFA screen (dot vs pixel) 49 | PIXFMT_C1_LSB, 50 | PIXFMT_C2_LSB, 51 | PIXFMT_C4_LSB, 52 | PIXFMT_C8 53 | } PixelFormat; 54 | 55 | typedef enum { 56 | WVMD_INIT = 0, 57 | WVMD_DU = 1, 58 | WVMD_GC16 = 2, 59 | WVMD_GC4 = 3, 60 | WVMD_A2 = 4 61 | } WaveformMode; 62 | 63 | typedef struct { 64 | int width; 65 | int height; 66 | PixelFormat pixelFormat; 67 | uint8_t buf[]; 68 | } Canvas; 69 | 70 | typedef struct { 71 | int x; 72 | int y; 73 | int w; 74 | int h; 75 | } Rect; 76 | 77 | Canvas *disp_create(int w, int h, PixelFormat fmt); 78 | void disp_free(Canvas *canvas); 79 | void disp_conv(Canvas *dst, Canvas *src); 80 | void disp_scale_image_fit(Canvas *src, Canvas *dst); 81 | void disp_filtering_image(Canvas *src, Rect src_rect, Rect dst_rect); 82 | void disp_init(void); 83 | void disp_deinit(void); 84 | void disp_present(Rect dest_rect, WaveformMode mode, bool partial, bool wait); 85 | Canvas *disp_load_image(char *filename); -------------------------------------------------------------------------------- /lb18db/imgcvt/main.c: -------------------------------------------------------------------------------- 1 | // 2 | // NekoInk Image Viewer 3 | // Copyright 2021 Wenting Zhang 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | // 23 | // File : main.c 24 | // Brief: Main entry point of the application 25 | // 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include "config.h" 32 | #include "disp.h" 33 | #include 34 | 35 | #define PROFILE(x) { \ 36 | clock_t t = clock();\ 37 | x;\ 38 | t = clock() - t;\ 39 | printf("%.2f ms\n", (double)t / CLOCKS_PER_SEC * 1000);\ 40 | } 41 | 42 | void dump_hex(uint8_t *buf, int count) { 43 | for (int i = 0; i < count / 16; i++) { 44 | for (int j = 0; j < 16; j++) { 45 | printf("%02x ", *buf++); 46 | } 47 | printf("\n"); 48 | } 49 | } 50 | 51 | int main(int argc, char *argv[]) { 52 | if (argc < 2) { 53 | fprintf(stderr, "Usage: imgview \n"); 54 | return 1; 55 | } 56 | 57 | Canvas *target = disp_create(DISP_WIDTH, DISP_HEIGHT, PIXFMT_RGB888); 58 | Rect zero_rect = {0}; 59 | 60 | disp_init(); 61 | 62 | Canvas *image; 63 | 64 | printf("Loading image: "); 65 | PROFILE(image = disp_load_image(argv[1])); 66 | 67 | if (image->pixelFormat != target->pixelFormat) { 68 | Canvas *image_new = disp_create(image->width, image->height, target->pixelFormat); 69 | 70 | printf("Converting image: "); 71 | PROFILE(disp_conv(image_new, image)); 72 | disp_free(image); 73 | image = image_new; 74 | } 75 | 76 | printf("Scaling image: "); 77 | PROFILE(disp_scale_image_fit(image, target)); 78 | 79 | printf("Filtering image: "); 80 | PROFILE(disp_filtering_image(target, zero_rect, zero_rect)); 81 | 82 | //disp_filtering_image_b(image); 83 | 84 | printf("Present image: "); 85 | PROFILE(disp_present(zero_rect, WVMD_GC16, true, true)); 86 | 87 | SDL_Event event; 88 | float time_delta = 0.0f; 89 | int last_ticks = SDL_GetTicks(); 90 | bool running = true; 91 | 92 | while (running) { 93 | int cur_ticks = SDL_GetTicks(); 94 | time_delta -= cur_ticks - last_ticks; // Actual ticks passed since last iteration 95 | time_delta += 1000.0f / (float)TARGET_FPS; // Time allocated for this iteration 96 | last_ticks = cur_ticks; 97 | 98 | // Process SDL events 99 | while (SDL_PollEvent(&event)) { 100 | if (event.type == SDL_QUIT) { 101 | running = false; 102 | } 103 | else { 104 | // handle events 105 | } 106 | } 107 | 108 | // Wait for next frame 109 | int time_to_wait = time_delta - (SDL_GetTicks() - last_ticks); 110 | if (time_to_wait > 0) 111 | SDL_Delay(time_to_wait); 112 | } 113 | 114 | disp_deinit(); 115 | 116 | return 0; 117 | } -------------------------------------------------------------------------------- /lb18db/imgcvt/stb.c: -------------------------------------------------------------------------------- 1 | #define STB_IMAGE_IMPLEMENTATION 2 | #include "stb_image.h" 3 | #define STB_IMAGE_RESIZE_IMPLEMENTATION 4 | #include "stb_image_resize.h" -------------------------------------------------------------------------------- /lm081hb1t01/lcd.h: -------------------------------------------------------------------------------- 1 | #ifndef __LCD_H__ 2 | #define __LCD_H__ 3 | 4 | #endif -------------------------------------------------------------------------------- /lm9033a/lcd.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include "lcd.h" 3 | #include "delay.h" 4 | 5 | 6 | extern uint16_t LCD_CS; 7 | extern uint16_t LCD_RST; 8 | extern uint16_t LCD_RS; 9 | extern uint16_t LCD_WR; 10 | extern uint16_t LCD_RD; 11 | 12 | #define LCD_CS_LOW() GPIOB->BRR = LCD_CS 13 | #define LCD_CS_HIGH() GPIOB->BSRR = LCD_CS 14 | #define LCD_RST_LOW() GPIOB->BRR = LCD_RST 15 | #define LCD_RST_HIGH() GPIOB->BSRR = LCD_RST 16 | #define LCD_RS_LOW() GPIOB->BRR = LCD_RS 17 | #define LCD_RS_HIGH() GPIOB->BSRR = LCD_RS 18 | #define LCD_WR_LOW() GPIOB->BRR = LCD_WR 19 | #define LCD_WR_HIGH() GPIOB->BSRR = LCD_WR 20 | #define LCD_RD_LOW() GPIOB->BRR = LCD_RD 21 | #define LCD_RD_HIGH() GPIOB->BSRR = LCD_RD 22 | 23 | 24 | void LCD_GPIO_Config(void) 25 | { 26 | GPIO_InitTypeDef GPIO_InitStructure; 27 | 28 | RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA,ENABLE); 29 | RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB,ENABLE); 30 | 31 | GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_3| 32 | GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_6|GPIO_Pin_7; 33 | GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; 34 | GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; 35 | 36 | GPIO_Init(GPIOA, &GPIO_InitStructure); 37 | 38 | GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_5| 39 | GPIO_Pin_6; 40 | GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; 41 | GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; 42 | 43 | GPIO_Init(GPIOB, &GPIO_InitStructure); 44 | } 45 | 46 | unsigned char ReverseBits(unsigned char num) 47 | { 48 | num = ((num&0x0f)<<4) | ((num&0xf0)>>4); 49 | num = ((num&0x33)<<2) | ((num&0xcc)>>2); 50 | num = ((num&0x55)<<1) | ((num&0xaa)>>1); 51 | return num; 52 | } 53 | 54 | void LCD_WriteCmd(unsigned char c) 55 | { 56 | LCD_RS_LOW(); 57 | LCD_CS_LOW(); 58 | LCD_RD_HIGH(); 59 | Delayms(1); 60 | //GPIOE->ODR = ReverseBits(c); 61 | GPIOA->ODR = c; 62 | LCD_WR_LOW(); 63 | Delayms(1); 64 | LCD_WR_HIGH(); 65 | Delayms(1); 66 | LCD_CS_HIGH(); 67 | } 68 | 69 | void LCD_WriteDat(unsigned char d) 70 | { 71 | LCD_RS_HIGH(); 72 | LCD_CS_LOW(); 73 | LCD_RD_HIGH(); 74 | Delayms(1); 75 | //GPIOE->ODR = ReverseBits(d); 76 | GPIOA->ODR = d; 77 | LCD_WR_LOW(); 78 | Delayms(1); 79 | LCD_WR_HIGH(); 80 | Delayms(1); 81 | LCD_CS_HIGH(); 82 | } 83 | 84 | void LCD_Init() 85 | { 86 | LCD_GPIO_Config(); 87 | LCD_RST_LOW(); 88 | Delayms(100); 89 | LCD_RST_HIGH(); 90 | Delayms(100); 91 | 92 | LCD_WriteCmd(0x48); 93 | LCD_WriteCmd(0x60); 94 | LCD_WriteCmd(0xa1); 95 | LCD_WriteCmd(0xc8); 96 | LCD_WriteCmd(0x44); 97 | LCD_WriteCmd(0x10); 98 | LCD_WriteCmd(0x40); 99 | LCD_WriteCmd(0x00); 100 | LCD_WriteCmd(0xab); 101 | LCD_WriteCmd(0x66); 102 | LCD_WriteCmd(0x27); 103 | LCD_WriteCmd(0x81); 104 | LCD_WriteCmd(0x20); 105 | LCD_WriteCmd(0x54); 106 | LCD_WriteCmd(0x93); 107 | LCD_WriteCmd(0x88); 108 | LCD_WriteCmd(0x00); 109 | LCD_WriteCmd(0x89); 110 | LCD_WriteCmd(0x00); 111 | LCD_WriteCmd(0x8a); 112 | LCD_WriteCmd(0x88); 113 | LCD_WriteCmd(0x8b); 114 | LCD_WriteCmd(0x88); 115 | LCD_WriteCmd(0x8c); 116 | LCD_WriteCmd(0xbb); 117 | LCD_WriteCmd(0x8d); 118 | LCD_WriteCmd(0xbb); 119 | LCD_WriteCmd(0x8e); 120 | LCD_WriteCmd(0xee); 121 | LCD_WriteCmd(0x8f); 122 | LCD_WriteCmd(0xee); 123 | LCD_WriteCmd(0x2c); 124 | Delayms(10); 125 | LCD_WriteCmd(0x2e); 126 | Delayms(10); 127 | LCD_WriteCmd(0x2f); 128 | Delayms(10); 129 | LCD_WriteCmd(0xaf); 130 | } 131 | 132 | void LCD_DispImg(unsigned char *d) 133 | { 134 | unsigned char i,j; 135 | unsigned int p; 136 | p = 0; 137 | for (i=0;i<8;i++) 138 | { 139 | LCD_WriteCmd(0xee); 140 | LCD_WriteCmd(0xb0|i); 141 | LCD_WriteCmd(0x10); 142 | LCD_WriteCmd(0x00); 143 | LCD_WriteCmd(0xe0); 144 | for (j=0;j<128;j++) 145 | LCD_WriteDat(d[p++]); 146 | } 147 | LCD_WriteCmd(0xee); 148 | LCD_WriteCmd(0xb8); 149 | LCD_WriteCmd(0x10); 150 | LCD_WriteCmd(0x00); 151 | LCD_WriteCmd(0xe0); 152 | for (j=0;j<128;j++) 153 | LCD_WriteDat(0xff); 154 | } -------------------------------------------------------------------------------- /lm9033a/lcd.h: -------------------------------------------------------------------------------- 1 | #ifndef __LCD_H__ 2 | #define __LCD_H__ 3 | 4 | #endif -------------------------------------------------------------------------------- /s60715/lcd.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zephray/driving-lcds/bf0a5c129f6dd3f654957116ad62a5b4d52e87bd/s60715/lcd.c -------------------------------------------------------------------------------- /s60715/lcd.h: -------------------------------------------------------------------------------- 1 | #ifndef __LCD_H__ 2 | #define __LCD_H__ 3 | 4 | #endif -------------------------------------------------------------------------------- /sclm-p107/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Generated Cmake Pico project file 2 | 3 | cmake_minimum_required(VERSION 3.13) 4 | 5 | set(CMAKE_C_STANDARD 11) 6 | set(CMAKE_CXX_STANDARD 17) 7 | 8 | # initalize pico_sdk from installed location 9 | # (note this can come from environment, CMake cache etc) 10 | set(PICO_SDK_PATH "/home/wenting/pico/pico-sdk") 11 | 12 | # Pull in Raspberry Pi Pico SDK (must be before project) 13 | include(pico_sdk_import.cmake) 14 | 15 | project(fw C CXX ASM) 16 | 17 | # Initialise the Raspberry Pi Pico SDK 18 | pico_sdk_init() 19 | 20 | # Add executable. Default name is the project name, version 0.1 21 | 22 | add_executable(fw 23 | main.c 24 | ) 25 | 26 | pico_set_program_name(fw "fw") 27 | pico_set_program_version(fw "0.1") 28 | 29 | pico_enable_stdio_uart(fw 0) 30 | pico_enable_stdio_usb(fw 0) 31 | 32 | # Add the standard library to the build 33 | target_link_libraries(fw pico_stdlib) 34 | 35 | # Add any user requested libraries 36 | target_link_libraries(fw 37 | hardware_spi 38 | hardware_dma 39 | hardware_i2c 40 | ) 41 | 42 | pico_add_extra_outputs(fw) 43 | 44 | -------------------------------------------------------------------------------- /sclm-p107/font.h: -------------------------------------------------------------------------------- 1 | static const char font[] = { 2 | 0x00, 0x00, 0x00, 0x00, 0x00,// (space) 3 | 0x00, 0x00, 0x5F, 0x00, 0x00,// ! 4 | 0x00, 0x07, 0x00, 0x07, 0x00,// " 5 | 0x14, 0x7F, 0x14, 0x7F, 0x14,// # 6 | 0x24, 0x2A, 0x7F, 0x2A, 0x12,// $ 7 | 0x23, 0x13, 0x08, 0x64, 0x62,// % 8 | 0x36, 0x49, 0x55, 0x22, 0x50,// & 9 | 0x00, 0x05, 0x03, 0x00, 0x00,// ' 10 | 0x00, 0x1C, 0x22, 0x41, 0x00,// ( 11 | 0x00, 0x41, 0x22, 0x1C, 0x00,// ) 12 | 0x08, 0x2A, 0x1C, 0x2A, 0x08,// * 13 | 0x08, 0x08, 0x3E, 0x08, 0x08,// + 14 | 0x00, 0x50, 0x30, 0x00, 0x00,// , 15 | 0x08, 0x08, 0x08, 0x08, 0x08,// - 16 | 0x00, 0x60, 0x60, 0x00, 0x00,// . 17 | 0x20, 0x10, 0x08, 0x04, 0x02,// / 18 | 0x3E, 0x51, 0x49, 0x45, 0x3E,// 0 19 | 0x00, 0x42, 0x7F, 0x40, 0x00,// 1 20 | 0x42, 0x61, 0x51, 0x49, 0x46,// 2 21 | 0x21, 0x41, 0x45, 0x4B, 0x31,// 3 22 | 0x18, 0x14, 0x12, 0x7F, 0x10,// 4 23 | 0x27, 0x45, 0x45, 0x45, 0x39,// 5 24 | 0x3C, 0x4A, 0x49, 0x49, 0x30,// 6 25 | 0x01, 0x71, 0x09, 0x05, 0x03,// 7 26 | 0x36, 0x49, 0x49, 0x49, 0x36,// 8 27 | 0x06, 0x49, 0x49, 0x29, 0x1E,// 9 28 | 0x00, 0x36, 0x36, 0x00, 0x00,// : 29 | 0x00, 0x56, 0x36, 0x00, 0x00,// ; 30 | 0x00, 0x08, 0x14, 0x22, 0x41,// < 31 | 0x14, 0x14, 0x14, 0x14, 0x14,// = 32 | 0x41, 0x22, 0x14, 0x08, 0x00,// > 33 | 0x02, 0x01, 0x51, 0x09, 0x06,// ? 34 | 0x32, 0x49, 0x79, 0x41, 0x3E,// @ 35 | 0x7E, 0x11, 0x11, 0x11, 0x7E,// A 36 | 0x7F, 0x49, 0x49, 0x49, 0x36,// B 37 | 0x3E, 0x41, 0x41, 0x41, 0x22,// C 38 | 0x7F, 0x41, 0x41, 0x22, 0x1C,// D 39 | 0x7F, 0x49, 0x49, 0x49, 0x41,// E 40 | 0x7F, 0x09, 0x09, 0x01, 0x01,// F 41 | 0x3E, 0x41, 0x41, 0x51, 0x32,// G 42 | 0x7F, 0x08, 0x08, 0x08, 0x7F,// H 43 | 0x00, 0x41, 0x7F, 0x41, 0x00,// I 44 | 0x20, 0x40, 0x41, 0x3F, 0x01,// J 45 | 0x7F, 0x08, 0x14, 0x22, 0x41,// K 46 | 0x7F, 0x40, 0x40, 0x40, 0x40,// L 47 | 0x7F, 0x02, 0x04, 0x02, 0x7F,// M 48 | 0x7F, 0x04, 0x08, 0x10, 0x7F,// N 49 | 0x3E, 0x41, 0x41, 0x41, 0x3E,// O 50 | 0x7F, 0x09, 0x09, 0x09, 0x06,// P 51 | 0x3E, 0x41, 0x51, 0x21, 0x5E,// Q 52 | 0x7F, 0x09, 0x19, 0x29, 0x46,// R 53 | 0x46, 0x49, 0x49, 0x49, 0x31,// S 54 | 0x01, 0x01, 0x7F, 0x01, 0x01,// T 55 | 0x3F, 0x40, 0x40, 0x40, 0x3F,// U 56 | 0x1F, 0x20, 0x40, 0x20, 0x1F,// V 57 | 0x7F, 0x20, 0x18, 0x20, 0x7F,// W 58 | 0x63, 0x14, 0x08, 0x14, 0x63,// X 59 | 0x03, 0x04, 0x78, 0x04, 0x03,// Y 60 | 0x61, 0x51, 0x49, 0x45, 0x43,// Z 61 | 0x00, 0x00, 0x7F, 0x41, 0x41,// [ 62 | 0x02, 0x04, 0x08, 0x10, 0x20,// "\" 63 | 0x41, 0x41, 0x7F, 0x00, 0x00,// ] 64 | 0x04, 0x02, 0x01, 0x02, 0x04,// ^ 65 | 0x40, 0x40, 0x40, 0x40, 0x40,// _ 66 | 0x00, 0x01, 0x02, 0x04, 0x00,// ` 67 | 0x20, 0x54, 0x54, 0x54, 0x78,// a 68 | 0x7F, 0x48, 0x44, 0x44, 0x38,// b 69 | 0x38, 0x44, 0x44, 0x44, 0x20,// c 70 | 0x38, 0x44, 0x44, 0x48, 0x7F,// d 71 | 0x38, 0x54, 0x54, 0x54, 0x18,// e 72 | 0x08, 0x7E, 0x09, 0x01, 0x02,// f 73 | 0x08, 0x14, 0x54, 0x54, 0x3C,// g 74 | 0x7F, 0x08, 0x04, 0x04, 0x78,// h 75 | 0x00, 0x44, 0x7D, 0x40, 0x00,// i 76 | 0x20, 0x40, 0x44, 0x3D, 0x00,// j 77 | 0x00, 0x7F, 0x10, 0x28, 0x44,// k 78 | 0x00, 0x41, 0x7F, 0x40, 0x00,// l 79 | 0x7C, 0x04, 0x18, 0x04, 0x78,// m 80 | 0x7C, 0x08, 0x04, 0x04, 0x78,// n 81 | 0x38, 0x44, 0x44, 0x44, 0x38,// o 82 | 0x7C, 0x14, 0x14, 0x14, 0x08,// p 83 | 0x08, 0x14, 0x14, 0x18, 0x7C,// q 84 | 0x7C, 0x08, 0x04, 0x04, 0x08,// r 85 | 0x48, 0x54, 0x54, 0x54, 0x20,// s 86 | 0x04, 0x3F, 0x44, 0x40, 0x20,// t 87 | 0x3C, 0x40, 0x40, 0x20, 0x7C,// u 88 | 0x1C, 0x20, 0x40, 0x20, 0x1C,// v 89 | 0x3C, 0x40, 0x30, 0x40, 0x3C,// w 90 | 0x44, 0x28, 0x10, 0x28, 0x44,// x 91 | 0x0C, 0x50, 0x50, 0x50, 0x3C,// y 92 | 0x44, 0x64, 0x54, 0x4C, 0x44,// z 93 | 0x00, 0x08, 0x36, 0x41, 0x00,// { 94 | 0x00, 0x00, 0x7F, 0x00, 0x00,// | 95 | 0x00, 0x41, 0x36, 0x08, 0x00,// } 96 | 0x08, 0x08, 0x2A, 0x1C, 0x08,// -> 97 | 0x08, 0x1C, 0x2A, 0x08, 0x08 // <- 98 | }; -------------------------------------------------------------------------------- /sclm-p107/main.c: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. 3 | * 4 | * SPDX-License-Identifier: BSD-3-Clause 5 | */ 6 | 7 | #include "pico/stdlib.h" 8 | #include 9 | #include "font.h" 10 | 11 | #define PIXCLK_PIN 2 12 | #define INV_PIN 1 13 | #define LP_PIN 4 14 | #define EI_PIN 5 15 | #define D3_PIN 6 16 | #define D2_PIN 7 17 | #define D1_PIN 8 18 | #define D0_PIN 9 19 | 20 | static uint8_t framebuf[40]; 21 | 22 | static void delay(int t) { 23 | volatile int x = t * 10; 24 | while (x--); 25 | } 26 | 27 | static void frame(void) { 28 | uint8_t *rdptr = framebuf; 29 | for (int x = 0; x < 40; x++) { 30 | uint8_t d = *rdptr++; 31 | d = ~d; 32 | for (int b = 0; b < 2; b++) { 33 | gpio_put(PIXCLK_PIN, 1); 34 | gpio_put(D0_PIN, d & 0x08); 35 | gpio_put(D1_PIN, d & 0x04); 36 | gpio_put(D2_PIN, d & 0x02); 37 | gpio_put(D3_PIN, d & 0x01); 38 | delay(9); 39 | gpio_put(PIXCLK_PIN, 0); 40 | d >>= 4; 41 | delay(10); 42 | } 43 | } 44 | gpio_put(LP_PIN, 1); 45 | delay(15); 46 | gpio_put(LP_PIN, 0); 47 | delay(5); 48 | } 49 | 50 | void setpixel(int i, int j, int c) { 51 | int bitp = i*12+j + 16; 52 | int bytep = bitp >> 3; 53 | int bito = bitp & 7; 54 | if (c == 0) 55 | framebuf[bytep] |= (0x1 << bito); 56 | else 57 | framebuf[bytep] &= ~(0x1 << bito); 58 | } 59 | 60 | 61 | void disphar(int x, int y, char c, int cl) { 62 | if (c < 0x20) 63 | return; 64 | c -= 0x20; 65 | for (int yy = 0; yy < 7; yy++) { 66 | if ((y + yy) < 0) continue; 67 | if ((y + yy) >= 24) continue; 68 | for (int xx = 0; xx < 5; xx++) { 69 | if ((x + xx) < 0) continue; 70 | if ((x + xx) >= 24) continue; 71 | if ((font[c * 5 + xx] >> yy) & 0x01) { 72 | setpixel(x + xx, y + yy, cl); 73 | } 74 | else { 75 | setpixel(x + xx, y + yy, 0); 76 | } 77 | } 78 | } 79 | } 80 | 81 | int main() { 82 | gpio_init(PIXCLK_PIN); 83 | gpio_set_dir(PIXCLK_PIN, GPIO_OUT); 84 | gpio_init(INV_PIN); 85 | gpio_set_dir(INV_PIN, GPIO_OUT); 86 | gpio_init(LP_PIN); 87 | gpio_set_dir(LP_PIN, GPIO_OUT); 88 | gpio_init(EI_PIN); 89 | gpio_set_dir(EI_PIN, GPIO_OUT); 90 | gpio_init(D3_PIN); 91 | gpio_set_dir(D3_PIN, GPIO_OUT); 92 | gpio_init(D2_PIN); 93 | gpio_set_dir(D2_PIN, GPIO_OUT); 94 | gpio_init(D1_PIN); 95 | gpio_set_dir(D1_PIN, GPIO_OUT); 96 | gpio_init(D0_PIN); 97 | gpio_set_dir(D0_PIN, GPIO_OUT); 98 | 99 | gpio_put(EI_PIN, 0); 100 | 101 | memset(framebuf, 0x00, 40); 102 | 103 | int i = 0, dir = 0; 104 | while (true) { 105 | /*memset(framebuf, 0x00, 40); 106 | framebuf[i / 8] = 1 << (i % 8); 107 | i++; 108 | if (i == 320) i = 0; 109 | for (int i = 0; i < 500; i++) 110 | frame();*/ 111 | gpio_put(INV_PIN, 1); 112 | frame(); 113 | sleep_ms(10); 114 | gpio_put(INV_PIN, 0); 115 | frame(); 116 | sleep_ms(10); 117 | 118 | memset(framebuf + 2, 0xff, 36); 119 | disphar(0, i, 'b', 1); 120 | disphar(6, i, 'e', 1); 121 | disphar(12, i, 'e', 1); 122 | disphar(18, i, 'f', 1); 123 | if (dir == 0) { 124 | i++; 125 | if (i == 6) { 126 | i = 4; 127 | dir = 1; 128 | } 129 | } 130 | else { 131 | i--; 132 | if (i == -1) { 133 | i = 1; 134 | dir = 0; 135 | } 136 | } 137 | } 138 | } 139 | -------------------------------------------------------------------------------- /sclm-p107/pico_sdk_import.cmake: -------------------------------------------------------------------------------- 1 | # This is a copy of /external/pico_sdk_import.cmake 2 | 3 | # This can be dropped into an external project to help locate this SDK 4 | # It should be include()ed prior to project() 5 | 6 | if (DEFINED ENV{PICO_SDK_PATH} AND (NOT PICO_SDK_PATH)) 7 | set(PICO_SDK_PATH $ENV{PICO_SDK_PATH}) 8 | message("Using PICO_SDK_PATH from environment ('${PICO_SDK_PATH}')") 9 | endif () 10 | 11 | if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT} AND (NOT PICO_SDK_FETCH_FROM_GIT)) 12 | set(PICO_SDK_FETCH_FROM_GIT $ENV{PICO_SDK_FETCH_FROM_GIT}) 13 | message("Using PICO_SDK_FETCH_FROM_GIT from environment ('${PICO_SDK_FETCH_FROM_GIT}')") 14 | endif () 15 | 16 | if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_PATH} AND (NOT PICO_SDK_FETCH_FROM_GIT_PATH)) 17 | set(PICO_SDK_FETCH_FROM_GIT_PATH $ENV{PICO_SDK_FETCH_FROM_GIT_PATH}) 18 | message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')") 19 | endif () 20 | 21 | set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the Raspberry Pi Pico SDK") 22 | set(PICO_SDK_FETCH_FROM_GIT "${PICO_SDK_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of SDK from git if not otherwise locatable") 23 | set(PICO_SDK_FETCH_FROM_GIT_PATH "${PICO_SDK_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download SDK") 24 | 25 | if (NOT PICO_SDK_PATH) 26 | if (PICO_SDK_FETCH_FROM_GIT) 27 | include(FetchContent) 28 | set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR}) 29 | if (PICO_SDK_FETCH_FROM_GIT_PATH) 30 | get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_SDK_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}") 31 | endif () 32 | FetchContent_Declare( 33 | pico_sdk 34 | GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk 35 | GIT_TAG master 36 | ) 37 | if (NOT pico_sdk) 38 | message("Downloading Raspberry Pi Pico SDK") 39 | FetchContent_Populate(pico_sdk) 40 | set(PICO_SDK_PATH ${pico_sdk_SOURCE_DIR}) 41 | endif () 42 | set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE}) 43 | else () 44 | message(FATAL_ERROR 45 | "SDK location was not specified. Please set PICO_SDK_PATH or set PICO_SDK_FETCH_FROM_GIT to on to fetch from git." 46 | ) 47 | endif () 48 | endif () 49 | 50 | get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") 51 | if (NOT EXISTS ${PICO_SDK_PATH}) 52 | message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' not found") 53 | endif () 54 | 55 | set(PICO_SDK_INIT_CMAKE_FILE ${PICO_SDK_PATH}/pico_sdk_init.cmake) 56 | if (NOT EXISTS ${PICO_SDK_INIT_CMAKE_FILE}) 57 | message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' does not appear to contain the Raspberry Pi Pico SDK") 58 | endif () 59 | 60 | set(PICO_SDK_PATH ${PICO_SDK_PATH} CACHE PATH "Path to the Raspberry Pi Pico SDK" FORCE) 61 | 62 | include(${PICO_SDK_INIT_CMAKE_FILE}) 63 | -------------------------------------------------------------------------------- /wd-g1206/lcd.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include "lcd.h" 3 | #include "delay.h" 4 | 5 | 6 | extern uint16_t LCD_CS; 7 | extern uint16_t LCD_RST; 8 | extern uint16_t LCD_RS; 9 | extern uint16_t LCD_WR; 10 | extern uint16_t LCD_RD; 11 | 12 | #define LCD_CS_LOW() GPIOD->BRR = LCD_CS 13 | #define LCD_CS_HIGH() GPIOD->BSRR = LCD_CS 14 | #define LCD_RST_LOW() GPIOD->BRR = LCD_RST 15 | #define LCD_RST_HIGH() GPIOD->BSRR = LCD_RST 16 | #define LCD_RS_LOW() GPIOD->BRR = LCD_RS 17 | #define LCD_RS_HIGH() GPIOD->BSRR = LCD_RS 18 | #define LCD_WR_LOW() GPIOD->BRR = LCD_WR 19 | #define LCD_WR_HIGH() GPIOD->BSRR = LCD_WR 20 | #define LCD_RD_LOW() GPIOD->BRR = LCD_RD 21 | #define LCD_RD_HIGH() GPIOD->BSRR = LCD_RD 22 | 23 | 24 | void LCD_GPIO_Config(void) 25 | { 26 | GPIO_InitTypeDef GPIO_InitStructure; 27 | 28 | RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOD,ENABLE); 29 | RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOE,ENABLE); 30 | 31 | GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_3| 32 | GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_6|GPIO_Pin_7; 33 | GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; 34 | GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; 35 | 36 | GPIO_Init(GPIOE, &GPIO_InitStructure); 37 | 38 | GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_3| 39 | GPIO_Pin_4; 40 | GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; 41 | GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; 42 | 43 | GPIO_Init(GPIOD, &GPIO_InitStructure); 44 | } 45 | 46 | unsigned char ReverseBits(unsigned char num) 47 | { 48 | num = ((num&0x0f)<<4) | ((num&0xf0)>>4); 49 | num = ((num&0x33)<<2) | ((num&0xcc)>>2); 50 | num = ((num&0x55)<<1) | ((num&0xaa)>>1); 51 | return num; 52 | } 53 | 54 | void LCD_WriteCmd(unsigned char c) 55 | { 56 | LCD_RS_LOW(); 57 | LCD_CS_LOW(); 58 | LCD_RD_HIGH(); 59 | Delayms(1); 60 | //GPIOE->ODR = ReverseBits(c); 61 | GPIOE->ODR = c; 62 | LCD_WR_LOW(); 63 | Delayms(1); 64 | LCD_WR_HIGH(); 65 | Delayms(1); 66 | LCD_CS_HIGH(); 67 | } 68 | 69 | void LCD_WriteDat(unsigned char d) 70 | { 71 | LCD_RS_HIGH(); 72 | LCD_CS_LOW(); 73 | LCD_RD_HIGH(); 74 | Delayms(1); 75 | //GPIOE->ODR = ReverseBits(d); 76 | GPIOE->ODR = d; 77 | LCD_WR_LOW(); 78 | Delayms(1); 79 | LCD_WR_HIGH(); 80 | Delayms(1); 81 | LCD_CS_HIGH(); 82 | } 83 | 84 | void LCD_Init() 85 | { 86 | LCD_GPIO_Config(); 87 | LCD_RST_LOW(); 88 | Delayms(100); 89 | LCD_RST_HIGH(); 90 | Delayms(100); 91 | 92 | LCD_WriteCmd(0xe2);//system reset 93 | Delayms(50); 94 | LCD_WriteCmd(0xa2); 95 | LCD_WriteCmd(0xa0); 96 | LCD_WriteCmd(0xc8); 97 | LCD_WriteCmd(0x26); 98 | LCD_WriteCmd(0x81); 99 | LCD_WriteCmd(0x1e); 100 | LCD_WriteCmd(0x2f); 101 | Delayms(50); 102 | LCD_WriteCmd(0xaf); 103 | LCD_WriteCmd(0xf8); 104 | LCD_WriteCmd(0x00); 105 | } 106 | 107 | void LCD_DispImg(unsigned char *d) 108 | { 109 | unsigned char i,j; 110 | unsigned int p; 111 | p = 0; 112 | for (i=0;i<8;i++) 113 | { 114 | LCD_WriteCmd(0xee); 115 | LCD_WriteCmd(0xb0|i); 116 | LCD_WriteCmd(0x10); 117 | LCD_WriteCmd(0x00); 118 | LCD_WriteCmd(0xe0); 119 | for (j=0;j<128;j++) 120 | LCD_WriteDat(d[p++]); 121 | } 122 | LCD_WriteCmd(0xee); 123 | LCD_WriteCmd(0xb8); 124 | LCD_WriteCmd(0x10); 125 | LCD_WriteCmd(0x00); 126 | LCD_WriteCmd(0xe0); 127 | for (j=0;j<128;j++) 128 | LCD_WriteDat(0xff); 129 | } -------------------------------------------------------------------------------- /wd-g1206/lcd.h: -------------------------------------------------------------------------------- 1 | #ifndef __LCD_H__ 2 | #define __LCD_H__ 3 | 4 | #endif -------------------------------------------------------------------------------- /wd-x16161/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Generated Cmake Pico project file 2 | 3 | cmake_minimum_required(VERSION 3.13) 4 | 5 | set(CMAKE_C_STANDARD 11) 6 | set(CMAKE_CXX_STANDARD 17) 7 | 8 | # initalize pico_sdk from installed location 9 | # (note this can come from environment, CMake cache etc) 10 | set(PICO_SDK_PATH "/home/wenting/pico/pico-sdk") 11 | set(PICO_EXTRAS_PATH "/home/wenting/pico/pico-extras") 12 | 13 | # Pull in Raspberry Pi Pico SDK (must be before project) 14 | include(pico_sdk_import.cmake) 15 | 16 | # We also need PICO EXTRAS 17 | include(pico_extras_import.cmake) 18 | 19 | project(lcddemo C CXX ASM) 20 | 21 | # Initialise the Raspberry Pi Pico SDK 22 | pico_sdk_init() 23 | 24 | add_executable(lcddemo) 25 | 26 | pico_generate_pio_header(lcddemo ${CMAKE_CURRENT_LIST_DIR}/lcddata.pio) 27 | 28 | target_sources(lcddemo PRIVATE 29 | main.c 30 | lcd.c 31 | ) 32 | 33 | pico_set_program_name(lcddemo "lcddemo") 34 | pico_set_program_version(lcddemo "0.1") 35 | 36 | pico_enable_stdio_uart(lcddemo 0) 37 | pico_enable_stdio_usb(lcddemo 0) 38 | 39 | target_include_directories(lcddemo PRIVATE ${CMAKE_CURRENT_LIST_DIR}) 40 | 41 | # Add the standard library to the build 42 | target_link_libraries(lcddemo pico_stdlib hardware_dma hardware_pwm) 43 | 44 | # Add any user requested libraries 45 | target_link_libraries(lcddemo 46 | hardware_pio 47 | ) 48 | 49 | pico_add_extra_outputs(lcddemo) 50 | 51 | -------------------------------------------------------------------------------- /wd-x16161/lcd.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2021 Wenting Zhang 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | // SOFTWARE. 21 | // 22 | #pragma once 23 | 24 | #define VSYNC_PIN (6) 25 | #define HSYNC_PIN (4) 26 | #define PIXCLK_PIN (5) 27 | // D0-7: 8-15 28 | #define D0_PIN (8) 29 | 30 | #define AC_PIN (1) 31 | 32 | #define EN_PIN (7) 33 | 34 | // PIO related 35 | #define LCD_DATA_SM (0) 36 | 37 | // Screen related 38 | #define LCD_TARGET_PIXCLK (1000000) 39 | 40 | #define SCR_WIDTH (160*3) 41 | #define SCR_HEIGHT (160) 42 | #define SCR_LINE_TRANSFERS (SCR_WIDTH / 8) 43 | #define SCR_STRIDE (SCR_WIDTH / 8) 44 | #define SCR_STRIDE_WORDS (SCR_WIDTH / 32) 45 | #define SCR_REFRESH_LINES (SCR_HEIGHT) 46 | 47 | // Public variables and functions 48 | extern unsigned char framebuf_bp0[SCR_STRIDE * SCR_HEIGHT]; 49 | extern unsigned char framebuf_bp1[SCR_STRIDE * SCR_HEIGHT]; 50 | extern volatile bool frame_sync; 51 | 52 | void lcd_start(); 53 | unsigned char *lcd_swap_buffer(); -------------------------------------------------------------------------------- /wd-x16161/lcddata.pio: -------------------------------------------------------------------------------- 1 | 2 | ; LCD SM handles D0-7, PCLK, HSYNC and VSYNC 3 | ; PCLK is mapped to SIDE, HSYNC and VSYNC are mapped to SET, and D0-7 are mapped to OUT 4 | .program lcd_data 5 | .side_set 1 6 | irq set 5 side 0 7 | mov x, isr side 0 8 | loop_first_line: 9 | out pins, 8 side 1 10 | jmp x-- loop_first_line side 0 11 | end_first_line: 12 | set pins, 0b101 [5] side 0; Hsync high, Vsync high 13 | set pins, 0b100 side 0; Hsync low, Vsync high 14 | set pins, 0b000 [9] side 0; HVsync low 15 | line_start: 16 | mov x, isr side 0 17 | loop: 18 | out pins, 8 side 1 ; Output 8 bit data 19 | jmp x-- loop side 0 ; Loop until x hits 0, then wait for next line 20 | loop_end: 21 | set pins, 0b001 [5] side 0; Hsync high, Vsync low 22 | set pins, 0b000 [10] side 0; HVsync low 23 | jmp y-- line_start side 0 24 | ; end of frame, signal CPU 25 | irq wait 1 side 0 26 | -------------------------------------------------------------------------------- /wd-x16161/pico_extras_import.cmake: -------------------------------------------------------------------------------- 1 | # This is a copy of /external/pico_extras_import.cmake 2 | 3 | # This can be dropped into an external project to help locate pico-extras 4 | # It should be include()ed prior to project() 5 | 6 | if (DEFINED ENV{PICO_EXTRAS_PATH} AND (NOT PICO_EXTRAS_PATH)) 7 | set(PICO_EXTRAS_PATH $ENV{PICO_EXTRAS_PATH}) 8 | message("Using PICO_EXTRAS_PATH from environment ('${PICO_EXTRAS_PATH}')") 9 | endif () 10 | 11 | if (DEFINED ENV{PICO_EXTRAS_FETCH_FROM_GIT} AND (NOT PICO_EXTRAS_FETCH_FROM_GIT)) 12 | set(PICO_EXTRAS_FETCH_FROM_GIT $ENV{PICO_EXTRAS_FETCH_FROM_GIT}) 13 | message("Using PICO_EXTRAS_FETCH_FROM_GIT from environment ('${PICO_EXTRAS_FETCH_FROM_GIT}')") 14 | endif () 15 | 16 | if (DEFINED ENV{PICO_EXTRAS_FETCH_FROM_GIT_PATH} AND (NOT PICO_EXTRAS_FETCH_FROM_GIT_PATH)) 17 | set(PICO_EXTRAS_FETCH_FROM_GIT_PATH $ENV{PICO_EXTRAS_FETCH_FROM_GIT_PATH}) 18 | message("Using PICO_EXTRAS_FETCH_FROM_GIT_PATH from environment ('${PICO_EXTRAS_FETCH_FROM_GIT_PATH}')") 19 | endif () 20 | 21 | if (NOT PICO_EXTRAS_PATH) 22 | if (PICO_EXTRAS_FETCH_FROM_GIT) 23 | include(FetchContent) 24 | set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR}) 25 | if (PICO_EXTRAS_FETCH_FROM_GIT_PATH) 26 | get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_EXTRAS_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}") 27 | endif () 28 | FetchContent_Declare( 29 | PICO_EXTRAS 30 | GIT_REPOSITORY https://github.com/raspberrypi/pico-extras 31 | GIT_TAG master 32 | ) 33 | if (NOT PICO_EXTRAS) 34 | message("Downloading PICO EXTRAS") 35 | FetchContent_Populate(PICO_EXTRAS) 36 | set(PICO_EXTRAS_PATH ${PICO_EXTRAS_SOURCE_DIR}) 37 | endif () 38 | set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE}) 39 | else () 40 | if (PICO_SDK_PATH AND EXISTS "${PICO_SDK_PATH}/../pico-extras") 41 | set(PICO_EXTRAS_PATH ${PICO_SDK_PATH}/../pico-extras) 42 | message("Defaulting PICO_EXTRAS_PATH as sibling of PICO_SDK_PATH: ${PICO_EXTRAS_PATH}") 43 | else() 44 | message(FATAL_ERROR 45 | "PICO EXTRAS location was not specified. Please set PICO_EXTRAS_PATH or set PICO_EXTRAS_FETCH_FROM_GIT to on to fetch from git." 46 | ) 47 | endif() 48 | endif () 49 | endif () 50 | 51 | set(PICO_EXTRAS_PATH "${PICO_EXTRAS_PATH}" CACHE PATH "Path to the PICO EXTRAS") 52 | set(PICO_EXTRAS_FETCH_FROM_GIT "${PICO_EXTRAS_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of PICO EXTRAS from git if not otherwise locatable") 53 | set(PICO_EXTRAS_FETCH_FROM_GIT_PATH "${PICO_EXTRAS_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download EXTRAS") 54 | 55 | get_filename_component(PICO_EXTRAS_PATH "${PICO_EXTRAS_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") 56 | if (NOT EXISTS ${PICO_EXTRAS_PATH}) 57 | message(FATAL_ERROR "Directory '${PICO_EXTRAS_PATH}' not found") 58 | endif () 59 | 60 | set(PICO_EXTRAS_PATH ${PICO_EXTRAS_PATH} CACHE PATH "Path to the PICO EXTRAS" FORCE) 61 | 62 | add_subdirectory(${PICO_EXTRAS_PATH} pico_extras) -------------------------------------------------------------------------------- /wd-x16161/pico_sdk_import.cmake: -------------------------------------------------------------------------------- 1 | # This is a copy of /external/pico_sdk_import.cmake 2 | 3 | # This can be dropped into an external project to help locate this SDK 4 | # It should be include()ed prior to project() 5 | 6 | if (DEFINED ENV{PICO_SDK_PATH} AND (NOT PICO_SDK_PATH)) 7 | set(PICO_SDK_PATH $ENV{PICO_SDK_PATH}) 8 | message("Using PICO_SDK_PATH from environment ('${PICO_SDK_PATH}')") 9 | endif () 10 | 11 | if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT} AND (NOT PICO_SDK_FETCH_FROM_GIT)) 12 | set(PICO_SDK_FETCH_FROM_GIT $ENV{PICO_SDK_FETCH_FROM_GIT}) 13 | message("Using PICO_SDK_FETCH_FROM_GIT from environment ('${PICO_SDK_FETCH_FROM_GIT}')") 14 | endif () 15 | 16 | if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_PATH} AND (NOT PICO_SDK_FETCH_FROM_GIT_PATH)) 17 | set(PICO_SDK_FETCH_FROM_GIT_PATH $ENV{PICO_SDK_FETCH_FROM_GIT_PATH}) 18 | message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')") 19 | endif () 20 | 21 | set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the Raspberry Pi Pico SDK") 22 | set(PICO_SDK_FETCH_FROM_GIT "${PICO_SDK_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of SDK from git if not otherwise locatable") 23 | set(PICO_SDK_FETCH_FROM_GIT_PATH "${PICO_SDK_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download SDK") 24 | 25 | if (NOT PICO_SDK_PATH) 26 | if (PICO_SDK_FETCH_FROM_GIT) 27 | include(FetchContent) 28 | set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR}) 29 | if (PICO_SDK_FETCH_FROM_GIT_PATH) 30 | get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_SDK_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}") 31 | endif () 32 | FetchContent_Declare( 33 | pico_sdk 34 | GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk 35 | GIT_TAG master 36 | ) 37 | if (NOT pico_sdk) 38 | message("Downloading Raspberry Pi Pico SDK") 39 | FetchContent_Populate(pico_sdk) 40 | set(PICO_SDK_PATH ${pico_sdk_SOURCE_DIR}) 41 | endif () 42 | set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE}) 43 | else () 44 | message(FATAL_ERROR 45 | "SDK location was not specified. Please set PICO_SDK_PATH or set PICO_SDK_FETCH_FROM_GIT to on to fetch from git." 46 | ) 47 | endif () 48 | endif () 49 | 50 | get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") 51 | if (NOT EXISTS ${PICO_SDK_PATH}) 52 | message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' not found") 53 | endif () 54 | 55 | set(PICO_SDK_INIT_CMAKE_FILE ${PICO_SDK_PATH}/pico_sdk_init.cmake) 56 | if (NOT EXISTS ${PICO_SDK_INIT_CMAKE_FILE}) 57 | message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' does not appear to contain the Raspberry Pi Pico SDK") 58 | endif () 59 | 60 | set(PICO_SDK_PATH ${PICO_SDK_PATH} CACHE PATH "Path to the Raspberry Pi Pico SDK" FORCE) 61 | 62 | include(${PICO_SDK_INIT_CMAKE_FILE}) 63 | --------------------------------------------------------------------------------