Browse Source

Add pin configuration

master
Dejvino 3 years ago
parent
commit
b5843612c7
2 changed files with 60 additions and 1 deletions
  1. +53
    -0
      README.md
  2. +7
    -1
      demo/base.c

+ 53
- 0
README.md View File

@@ -2,6 +2,59 @@

Built and tested with OrangePi Zero and ST7735 128x160 v1.1 SPI display.

## Hardware Connections

```
+-------------+-----------+
| LCD pin | OPi GPIO |
+-------------+-----------+
| LED | 17 3.3V |
| SCK / SCLK | 23 SCLK |
| SDA / MOSI | 19 MOSI |
| A0 / D/C | 13 |
| RESET / RST | 15 |
| CS | 24 CE.1 |
| GND | 9 GND |
| VCC | 1 3.3V |
+-------------+-----------+
```

### GPIO Pins Reference
```
$ gpio readall
+------+-----+----------+------+---+ OPi H2 +---+------+----------+-----+------+
| GPIO | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | GPIO |
+------+-----+----------+------+---+----++----+---+------+----------+-----+------+
| | | 3.3V | | | 1 || 2 | | | 5V | | |
| 12 | 0 | SDA.0 | OFF | 0 | 3 || 4 | | | 5V | | |
| 11 | 1 | SCL.0 | OFF | 0 | 5 || 6 | | | GND | | |
| 6 | 2 | PWM.1 | OFF | 0 | 7 || 8 | 0 | OFF | TXD.1 | 3 | 198 |
| | | GND | | | 9 || 10 | 0 | OFF | RXD.1 | 4 | 199 |
| 1 | 5 | RXD.2 | OFF | 0 | 11 || 12 | 0 | OFF | PA07 | 6 | 7 |
| 0 | 7 | TXD.2 | OUT | 1 | 13 || 14 | | | GND | | |
| 3 | 8 | CTS.2 | OUT | 1 | 15 || 16 | 0 | OFF | SDA.1 | 9 | 19 |
| | | 3.3V | | | 17 || 18 | 0 | OFF | SCK.1 | 10 | 18 |
| 15 | 11 | MOSI.1 | ALT2 | 0 | 19 || 20 | | | GND | | |
| 16 | 12 | MISO.1 | ALT2 | 0 | 21 || 22 | 0 | OFF | RTS.2 | 13 | 2 |
| 14 | 14 | SCLK.1 | ALT2 | 0 | 23 || 24 | 0 | ALT2 | CE.1 | 15 | 13 |
| | | GND | | | 25 || 26 | 0 | OFF | PA10 | 16 | 10 |
+------+-----+----------+------+---+----++----+---+------+----------+-----+------+
| GPIO | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | GPIO |
+------+-----+----------+------+---+ OPi H2 +---+------+----------+-----+------+
```

## Building

```
meson build
ninja -C build
```

## Running
TODO
## Resources
* [https://github.com/orangepi-xunlong/WiringOP](orangepi-xunlong/WiringOP) - GPIO controlling library compatible with Raspberry Pi's WiringPi
* [https://github.com/dhepper/font8x8](dhepper/font8x8) - 8x8 pixels monospaced font
* [https://github.com/vadzimyatskevich/SSD1306](vadzimyatskevich/SSD1306) - Similar driver for SSD1306 OLED displays


+ 7
- 1
demo/base.c View File

@@ -11,6 +11,8 @@ inline uint8 random_color_r(int seed) { return seed % (256 / 7) * 7; }
inline uint8 random_color_g(int seed) { return seed % (256 / 13) * 13; }
inline uint8 random_color_b(int seed) { return seed % (256 / 23) * 23; }

extern void lcd_setOrientation(lcd_t*, int);

lcd_t* demo_init()
{
setbuf(stdout, NULL);
@@ -18,7 +20,11 @@ lcd_t* demo_init()

wiringPiSetup();

return lcd_init(40000000, 1, 10, 7, 8);
lcd_t* lcd = lcd_init(40000000, 1, 15, 7, 8);
lcd_setOrientation(lcd, 2);

return lcd;
}

void demo_deinit(lcd_t* lcd)


Loading…
Cancel
Save