u8g2-copy/sys/arm-linux
servadmin 45df3148b0 I2C refactored to c-periphery 2021-11-02 19:50:04 -04:00
..
drivers I2C refactored to c-periphery 2021-11-02 19:50:04 -04:00
examples I2C refactored to c-periphery 2021-11-02 19:50:04 -04:00
port I2C refactored to c-periphery 2021-11-02 19:50:04 -04:00
tools/codebuild [rt-thread] copy controller list from parent codebuild.c 2021-10-06 21:07:02 +01:00
.gitignore [add] arm-linux cpp support 2021-10-04 22:28:26 +01:00
Makefile [add] arm-linux support 2021-10-04 21:57:19 +01:00
README.md I2C refactored to c-periphery 2021-11-02 19:50:04 -04:00

README.md

U8g2 for arm-linux has been modified to use c-periphery userspace library.

  • Deprecated sysfs method is no longer used for GPIO thus increasing speed and stability.
  • GPIO pins can be unallocated which is useful for testing multiple times.
  • I2C and SPI also use c-periphery.

Download U8g2 project

  • cd ~/
  • git clone --depth 1 https://github.com/olikraus/u8g2

Modify source as needed

Currently GPIO device, I2C and SPI buses are hard coded in u8g2port.c.

  • Change values as needed
  • nano ~/u8g2/sys/arm-linux/port/u8g2port.c
  • Change example (SPI 4 wire hardware for instance)
  • nano ~/u8g2/sys/arm-linux/examples/c-examples/u8g2_4wire_hw_spi\u8g2_4wire_hw_spi.c
  • Change the DC and RESET as needed (NanoPi Duo here using tx1 and rx1)
  • #define OLED_SPI_PIN_RES 199
  • #define OLED_SPI_PIN_DC 198

Build source with GPIO character device

  • cd ~/u8g2/sys/arm-linux
  • make CPPFLAGS=-DPERIPHERY_GPIO_CDEV_SUPPORT=1 CC=gcc CXX=g++

Build source with GPIO sysfs

  • cd ~/u8g2/sys/arm-linux
  • make CC=gcc CXX=g++