├── .github └── workflows │ └── flowzone.yml ├── .versionbot └── CHANGELOG.yml ├── CHANGELOG.md ├── Dockerfile ├── README.md ├── VERSION ├── balena.yml ├── docker-bake.hcl ├── docker-compose.yml ├── logo.png ├── repo.yml └── start.sh /.github/workflows/flowzone.yml: -------------------------------------------------------------------------------- 1 | name: Flowzone 2 | 3 | on: 4 | pull_request: 5 | types: [opened, synchronize, closed] 6 | branches: [main, master] 7 | # allow external contributions to use secrets within trusted code 8 | pull_request_target: 9 | types: [opened, synchronize, closed] 10 | branches: [main, master] 11 | 12 | jobs: 13 | flowzone: 14 | name: Flowzone 15 | uses: product-os/flowzone/.github/workflows/flowzone.yml@master 16 | # prevent duplicate workflow executions for pull_request and pull_request_target 17 | if: | 18 | ( 19 | github.event.pull_request.head.repo.full_name == github.repository && 20 | github.event_name == 'pull_request' 21 | ) || ( 22 | github.event.pull_request.head.repo.full_name != github.repository && 23 | github.event_name == 'pull_request_target' 24 | ) 25 | secrets: inherit 26 | with: 27 | balena_slugs: 'balenalabs/fbcp' 28 | docker_images: 'balenablocks/fbcp' 29 | -------------------------------------------------------------------------------- /.versionbot/CHANGELOG.yml: -------------------------------------------------------------------------------- 1 | - commits: 2 | - subject: Replace push script with flowzone docker publish 3 | hash: 561c3651c86ddbe9ed85e0849a5e2098962cd61a 4 | body: "" 5 | footer: 6 | Change-type: minor 7 | change-type: minor 8 | Signed-off-by: Kyle Harding 9 | signed-off-by: Kyle Harding 10 | author: Kyle Harding 11 | nested: [] 12 | version: 1.1.0 13 | title: "" 14 | date: 2023-05-11T14:48:37.024Z 15 | - commits: 16 | - subject: renaming from balenablocks to balena-labs-projects 17 | hash: 6e87482071363fd0fd9c3426ea121a220eeadf63 18 | body: "" 19 | footer: 20 | Signed-off-by: Flynn Joffray 21 | signed-off-by: Flynn Joffray 22 | Change-type: patch 23 | change-type: patch 24 | author: Flynn Joffray 25 | nested: [] 26 | version: 1.0.4 27 | title: "" 28 | date: 2022-11-15T20:04:53.984Z 29 | - version: 1.0.3 30 | date: 2022-04-05T10:16:49Z 31 | commits: 32 | - hash: 54c3e76f63b029dd0f2c74290c9719283c6cd05f 33 | author: Rahul Thakoor 34 | subject: "patch: use bh.cr registry address" 35 | body: null 36 | - version: 1.0.2 37 | - date: 2022-03-23T14:14:32Z 38 | - commits: 39 | - hash: 1fadd9ce8ab3a7eb2287310fa3abff7679347941 40 | - commits: 41 | - author: Rahul Thakoor 42 | - commits: 43 | - footers: 44 | change-type: patch 45 | - commits: 46 | - footers: 47 | signed-off-by: Rahul Thakoor 48 | - commits: 49 | - subject: Update to use fleet registry 50 | - commits: 51 | - body: null 52 | - version: 1.0.1 53 | - date: 2021-03-09T11:41:17Z 54 | - commits: 55 | - hash: a1a72be4485bbf5b17c8464960fc3b1e073dad5d 56 | - commits: 57 | - author: Rahul Thakoor 58 | - commits: 59 | - footers: 60 | change-type: patch 61 | - commits: 62 | - footers: 63 | signed-off-by: Rahul Thakoor 64 | - commits: 65 | - subject: Fix balena.yml and document touch support 66 | - commits: 67 | - body: null 68 | - version: 1.0.0 69 | - date: 2021-03-01T12:33:13Z 70 | - commits: 71 | - hash: b24c87f8608559fb452fe9510f082470bfd90203 72 | - commits: 73 | - author: Kyle Harding 74 | - commits: 75 | - footers: 76 | change-type: major 77 | - commits: 78 | - footers: 79 | signed-off-by: Kyle Harding 80 | - commits: 81 | - subject: Generate one image with all display controllers 82 | - commits: 83 | - body: |- 84 | Avoid creating individual images for each display 85 | controller and instead just create one image and require 86 | that FBCP_DISPLAY is set. 87 | This commit also includes support for the `dtoverlay` 88 | display controller which is just the generic rpi-fbcp 89 | that requires `BALENA_HOST_CONFIG_dtoverlay` for drivers. 90 | - commits: 91 | - hash: 820c0732dbc60fa0eee9d820624f910d00701d14 92 | - commits: 93 | - author: Kyle Harding 94 | - commits: 95 | - footers: 96 | signed-off-by: Kyle Harding 97 | - commits: 98 | - subject: "fbcp: use rpi build image and busybox final image" 99 | - commits: 100 | - body: Add support for Pi Zero by building against armv5. 101 | - version: 0.1.0 102 | - date: 2021-02-02T14:18:18Z 103 | - commits: 104 | - hash: 59ac8526962516449b21cf7ab3c30486afdde546 105 | - commits: 106 | - author: Rahul Thakoor 107 | - commits: 108 | - footers: 109 | change-type: patch 110 | - commits: 111 | - footers: 112 | signed-off-by: Rahul Thakoor 113 | - commits: 114 | - subject: Add metadata for balenaHub 115 | - commits: 116 | - body: null 117 | - commits: 118 | - hash: 771df5ed1a9731de81434a2e6c4ddf98382829b5 119 | - commits: 120 | - author: Rahul Thakoor 121 | - commits: 122 | - footers: 123 | change-type: patch 124 | - commits: 125 | - footers: 126 | signed-off-by: Rahul Thakoor 127 | - commits: 128 | - subject: Add default configs 129 | - commits: 130 | - body: null 131 | - commits: 132 | - hash: 1c8208db099a80c99d3854d4d5f787229baf5fa9 133 | - commits: 134 | - author: Rahul Thakoor 135 | - commits: 136 | - footers: 137 | change-type: patch 138 | - commits: 139 | - footers: 140 | signed-off-by: Rahul Thakoor 141 | - commits: 142 | - subject: Add repo.yml 143 | - commits: 144 | - body: null 145 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to this project will be documented in this file 4 | automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY! 5 | This project adheres to [Semantic Versioning](http://semver.org/). 6 | 7 | # v1.1.0 8 | ## (2023-05-11) 9 | 10 | * Replace push script with flowzone docker publish [Kyle Harding] 11 | 12 | # v1.0.4 13 | ## (2022-11-15) 14 | 15 | * renaming from balenablocks to balena-labs-projects [Flynn Joffray] 16 | 17 | # v1.0.3 18 | ## (2022-04-05) 19 | 20 | * patch: use bh.cr registry address [Rahul Thakoor] 21 | 22 | # v1.0.2 23 | ## (2022-03-23) 24 | 25 | * Update to use fleet registry [Rahul Thakoor] 26 | 27 | # v1.0.1 28 | ## (2021-03-09) 29 | 30 | * Fix balena.yml and document touch support [Rahul Thakoor] 31 | 32 | # v1.0.0 33 | ## (2021-03-01) 34 | 35 | * Generate one image with all display controllers [Kyle Harding] 36 | 37 | # v0.1.0 38 | ## (2021-02-02) 39 | 40 | * Add repo.yml [Rahul Thakoor] 41 | * Add default configs [Rahul Thakoor] 42 | * Add metadata for balenaHub [Rahul Thakoor] 43 | * Use higher SPI_BUS_CLOCK_DIVISOR value - use a safer high setting(lower bus speed) [Rahul Thakoor] 44 | * Add supported drivers in single image(balenablocks/fbcp) [Rahul Thakoor] 45 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM balenalib/rpi-python:build AS builder 2 | 3 | WORKDIR /usr/src/ 4 | 5 | RUN install_packages cmake libraspberrypi-dev git rsync binutils 6 | 7 | RUN git clone https://github.com/tasanakorn/rpi-fbcp.git 8 | 9 | WORKDIR /usr/src/rpi-fbcp 10 | 11 | RUN sed '/target_link_libraries/d' -i CMakeLists.txt 12 | RUN echo "target_link_libraries(fbcp pthread bcm_host vchiq_arm vcos atomic)" >> CMakeLists.txt 13 | 14 | WORKDIR /usr/src/rpi-fbcp/build 15 | 16 | RUN cmake .. && make && mv fbcp /usr/bin/fbcp-dtoverlay 17 | 18 | WORKDIR /usr/src/ 19 | 20 | RUN git clone https://github.com/juj/fbcp-ili9341.git 21 | 22 | WORKDIR /usr/src/fbcp-ili9341 23 | 24 | RUN sed '/define TURN_DISPLAY_OFF_AFTER_USECS_OF_INACTIVITY/d' -i config.h 25 | RUN sed '/target_link_libraries/d' -i CMakeLists.txt 26 | RUN echo "target_link_libraries(fbcp-ili9341 pthread bcm_host vchiq_arm vcos atomic)" >> CMakeLists.txt 27 | 28 | WORKDIR /usr/src/fbcp-ili9341/build 29 | 30 | ARG DISPLAYS=" \ 31 | adafruit-hx8357d-pitft \ 32 | adafruit-ili9341-pitft \ 33 | freeplaytech-waveshare32b \ 34 | waveshare35b-ili9486 \ 35 | tontec-mz61581 \ 36 | waveshare-st7789vw-hat \ 37 | waveshare-st7735s-hat \ 38 | kedei-v63-mpi3501 \ 39 | " 40 | 41 | RUN for display in ${DISPLAYS}; do \ 42 | export target="$(echo "${display}" | tr - _ | tr [:lower:] [:upper:])" && \ 43 | echo "Building for target ${display}" && \ 44 | cmake \ 45 | -D${target}=ON \ 46 | -DSPI_BUS_CLOCK_DIVISOR=30 \ 47 | -DBACKLIGHT_CONTROL=ON \ 48 | -DSTATISTICS=0 \ 49 | .. && \ 50 | make -j"$(nproc)" && \ 51 | mv fbcp-ili9341 "/usr/bin/fbcp-${display}" && \ 52 | rm -rf ./* ; \ 53 | done 54 | 55 | WORKDIR /rootfs 56 | 57 | RUN pip install git+https://github.com/larsks/dockerize 58 | 59 | RUN dockerize -n --verbose -o /rootfs/ /usr/bin/fbcp-* 60 | 61 | RUN rm /rootfs/Dockerfile 62 | 63 | FROM arm32v5/busybox 64 | 65 | COPY --from=builder /rootfs/ / 66 | 67 | COPY start.sh ./ 68 | 69 | CMD ["./start.sh"] 70 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # fbcp (frame buffer copy) 2 | 3 | Provides `fbcp` driver for SPI based displays for Raspberry Pis via [fbcp-ili9341](https://github.com/juj/fbcp-ili9341) 4 | 5 | ## Supported Displays 6 | 7 | fbcp-ili9341 [supports several displays](https://github.com/juj/fbcp-ili9341#which-spi-display-should-i-buy-to-make-sure-it-works-best-with-fbcp-ili9341) but we have compiled controllers for 8 | 9 | | Display | Tag | Tested | Tested On | 10 | | -------------------------------------------------------------------------- | --------------------------- | ------ | --------- | 11 | | Adafruit PiTFT - Assembled 480x320 3.5" TFT+Touchscreen for Raspberry Pi | `adafruit-hx8357d-pitft` | ✅ | 3B+ | 12 | | Adafruit 2.8" 320x240 TFT w/ Touch screen for Raspberry Pi | `adafruit-ili9341-pitft` | | | 13 | | Adafruit PiTFT 2.2" HAT Mini Kit - 320x240 2.2" TFT - No Touch | `adafruit-ili9341-pitft` | | | 14 | | Freeplay CM3 DIY Kit | `freeplaytech-waveshare32b` | | | 15 | | Waveshare 3.5" 480x320 (ILI9486) | `waveshare35b-ili9486` | | | 16 | | Tontec 3.5" 320x480 LCD Display | `tontec-mz61581` | | | 17 | | Waveshare 240x240, 1.3inch IPS LCD display HAT for Raspberry Pi (ST7789VW) | `waveshare-st7789vw-hat` | | | 18 | | Waveshare 128x128, 1.44inch LCD display HAT for Raspberry Pi (ST7735S) | `waveshare-st7735s-hat` | | | 19 | | KeDei 3.5 inch SPI TFTLCD 480\*320 16bit/18bit version 6.3 2018/4/9 | `kedei-v63-mpi3501` | | | 20 | | Generic rpi-fbcp using `BALENA_HOST_CONFIG_dtoverlay` for drivers | `dtoverlay` | ✅ | 3B+ | 21 | 22 | ## Usage 23 | 24 | `fbcp` is meant to be used alongside other services, so you will need to create a service in your `docker-compose.yml` file: 25 | 26 | So for example, if you are using `fbcp` with the Adafruit PiTFT - Assembled 480x320 3.5" TFT+Touchscreen along with the [dashboard](https://github.com/balena-labs-projects/dashboard) and [browser](https://github.com/balena-labs-projects/browser) blocks with a Raspberry Pi 3, you would use the following `docker-compose.yml` file 27 | 28 | ```yml 29 | version: "2.1" 30 | 31 | services: 32 | fbcp: 33 | image: bh.cr/balenalabs/fbcp 34 | privileged: true 35 | ... 36 | ``` 37 | 38 | Then set the `FBCP_DISPLAY` environment variable. e.g `FBCP_DISPLAY=adafruit-hx8357d-pitft` 39 | 40 | ## ⚠️ Touch compatibility ⚠️ 41 | 42 | `fbcp` block includes two drivers, namely 43 | 44 | - [tasanakorn/rpi-fbcp](https://github.com/tasanakorn/rpi-fbcp) which has touch support and is used when `FBCP_DISPLAY=dtoverlay`. You will still need to set the proper dtoverlay driver and params. 45 | - [juj/fbcp-ili9341](https://github.com/juj/fbcp-ili9341) which **does not** have touch support. See [here](https://github.com/juj/fbcp-ili9341#does-fbcp-ili9341-work-with-touch-displays) 46 | 47 | ## Configuring HDMI and TFT display sizes 48 | 49 | The following [Device Configuration](https://www.balena.io/docs/learn/manage/configuration/#configuration-variables) variables might be required for proper scaling and resolutions: 50 | 51 | | Name | Value | 52 | | ------------------------------------- | ----------------------------------------------------------------------------------------- | 53 | | BALENA_HOST_CONFIG_hdmi_cvt | ` ` e.g 480 320 60 1 0 0 0 | 54 | | BALENA_HOST_CONFIG_hdmi_force_hotplug | 1 | 55 | | BALENA_HOST_CONFIG_hdmi_group | 2 | 56 | | BALENA_HOST_CONFIG_hdmi_mode | 87 | 57 | 58 | _These lines hint native applications about the default display mode, and let them render to the native resolution of the TFT display. This can however prevent the use of the HDMI connector, if the HDMI connected display does not support such a small resolution._ 59 | 60 | You can read more about these settings in the original [fbcp-ili9341](https://github.com/juj/fbcp-ili9341) documentation [here](https://github.com/juj/fbcp-ili9341#configuring-hdmi-and-tft-display-sizes). 61 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | 1.1.0 -------------------------------------------------------------------------------- /balena.yml: -------------------------------------------------------------------------------- 1 | name: fbcp 2 | description: Provides fbcp driver for using SPI-based displays on Raspberry Pis 3 | post-provisioning: | 4 | ## Usage instructions 5 | Include this snippet in your docker-compose.yml file under 'services': 6 | 7 | ``` 8 | browser: 9 | image: bh.cr/balenalabs/fbcp 10 | privileged: true 11 | ``` 12 | ### Configuring HDMI and TFT display sizes 13 | The following [Device Configuration](https://www.balena.io/docs/learn/manage/configuration/#configuration-variables) variables might be required for proper scaling and resolutions: 14 | 15 | | Name | Value | 16 | | ------------------------------------- | ----------------------------------------------------------------------------------------- | 17 | | BALENA_HOST_CONFIG_hdmi_cvt | ` ` e.g 480 320 60 1 0 0 0 | 18 | | BALENA_HOST_CONFIG_hdmi_force_hotplug | 1 | 19 | | BALENA_HOST_CONFIG_hdmi_group | 2 | 20 | | BALENA_HOST_CONFIG_hdmi_mode | 87 | 21 | type: sw.application 22 | assets: 23 | repository: 24 | type: blob.asset 25 | data: 26 | url: 'https://github.com/balena-labs-projects/fbcp' 27 | logo: 28 | type: blob.asset 29 | data: 30 | url: 'https://raw.githubusercontent.com/balena-labs-projects/fbcp/master/logo.png' 31 | data: 32 | applicationEnvironmentVariables: 33 | - FBCP_DISPLAY: '' 34 | applicationConfigVariables: 35 | - BALENA_HOST_CONFIG_hdmi_cvt: 480 320 60 1 0 0 0 36 | - BALENA_HOST_CONFIG_hdmi_force_hotplug: 1 37 | - BALENA_HOST_CONFIG_hdmi_group: 2 38 | - BALENA_HOST_CONFIG_hdmi_mode: 87 39 | - BALENA_HOST_CONFIG_gpu_mem: 64 40 | defaultDeviceType: raspberry-pi3 41 | supportedDeviceTypes: 42 | - raspberrypi3 43 | - raspberrypi4-64 44 | - fincm3 45 | - raspberry-pi 46 | - raspberry-pi2 47 | version: 1.1.0 48 | -------------------------------------------------------------------------------- /docker-bake.hcl: -------------------------------------------------------------------------------- 1 | target "default" { 2 | platforms = [ 3 | "linux/arm64", 4 | "linux/arm/v7", 5 | "linux/arm/v6", 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "2.1" 2 | 3 | services: 4 | fbcp: 5 | build: ./ 6 | privileged: true -------------------------------------------------------------------------------- /logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/balena-labs-projects/fbcp/ada74e5971d34d47906a0982b374325537e66b60/logo.png -------------------------------------------------------------------------------- /repo.yml: -------------------------------------------------------------------------------- 1 | type: generic -------------------------------------------------------------------------------- /start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/vc/lib 4 | 5 | if [ -z "${FBCP_DISPLAY}" ] 6 | then 7 | echo "WARNING: FBCP_DISPLAY variable not set." 8 | echo " Set the value if you are using an attached display." 9 | tail -f /dev/null 10 | else 11 | "/usr/bin/fbcp-${FBCP_DISPLAY}" 12 | fi 13 | --------------------------------------------------------------------------------