https://git.hornquist.se/lcd-term/ = Terminal Driver = - https://github.com/torvalds/linux/blob/6f0d349d922ba44e4348a17a78ea51b7135965b1/drivers/video/console/sticon.c - http://www.tldp.org/LDP/lkmpg/2.6/html/lkmpg.html#AEN121 - [[https://atmega32-avr.com/how-to-super-simple-serial-terminal-using-atmega128/|Fungerande exempel på ATMEL]] - [[http://linusakesson.net/programming/tty/index.php|The TTY demystified]] - https://www.linux.it/~rubini/docs/serial/serial.html - [[https://www.kernel.org/doc/html/v4.17/driver-api/gpio/consumer.html|kernel doc html v4 17 driver api gpio consumer]] - https://fp-instruments.com/en/accessing-block-device-in-kernel-space/ == Terminal Driver == - [[https://en.wikipedia.org/wiki/Linux_console|Wikipedia:Linux console]] - [[https://www.linuxjournal.com/article/5896|Snabb genomgång]] === Oreilly === Linux Device Drivers (kapitell 18). Finns hos Lysator, samt som HTML och PDF. - https://www.oreilly.com/library/view/linux-device-drivers/0596005903/ch18.html - https://lwn.net/images/pdf/LDD3/ch18.pdf == Device-träd == Barn-nod kan få access till sin förälder, eller vice versa? Därifrån få tag på device-enheten. == Skärm == === `GTC-16041` === - [[https://manualzz.com/doc/17344723/hebei-jiya-electronics-gtc-16041-tr6noc--75-512-11-|Möljgt datablad]] - http://hugo.hornquist.se/datablad/gtc-16041.pdf | # | Lvl | Description | |----|-----|----------------------| | 1 | | Ground | | 2 | | Power Logic | | 3 | | Power LCD | | 4 | | Register Select (RS) | 5 | | Read/Write (RW) | | 6 | | Enable | | 7 | | Data 0 | | 8 | | Data 1 | | 9 | | Data 2 | | 10 | | Data 3 | | 11 | | Data 4 | | 12 | | Data 5 | | 13 | | Data 6 | | 14 | | Data 7 | | 15 | | Backlight | | 16 | | Backlight | Med skärmen till höger om headern. | 4 | 7 | | 5 | 8 | | | 9 | | | 10 | | | 11 | | | 12 | | GND | 13 | | PWR | 14 | | RS | 7 | | RW | 8 | | | 9 | | | 10 | | | 11 | | | 12 | | GND | 13 | | PWR | 14 | | EN | EN | RasPi pinout pin 1: | 3.3v | 5v | | 2 | 5V | | 3 | GND | | 4 | 14 | | GND | 15 | | 17 | 18 | | 27 | GND | | 22 | 23 | | 3.3v | 24 | | 10 | GND | Away from board | 9 | 25 | | 11 | 8 | | GND | 7 | | 0 | 1 | | 5 | GND | | 6 | 12 | | 13 | GND | | 19 | 16 | | 26 | 20 | | GND | 21 | gr bl vi sv 2 3 4 17 bl vi gr sv 14 13 12 11 Mapping | display | pi | |---------|----| | 4 | 22 | | 5 | 0 | | | | | 7 | - | | 8 | - | | 9 | - | | 10 | - | | 11 | 17 | | 12 | 4 | | 13 | 3 | | 14 | 2 | | | | | GND | | | PWR | | == GPIO == - [[https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git|libgpiod]] `/dev/gpiochip0` == Datablad == https://www.raspberrypi.org/documentation/hardware/raspberrypi/mechanical/rpi_MECH_3bplus.pdf - `linux/arch/arm/boot/dts/bcm2837-rpi-3-b.dts` - `/usr/lib/modules/$(uname -r)/kernel` - `/usr/src/rpi-kernel-headers-$(uname -r)` compatible field -------------------------------------------------- {{{ [ 176.886533] mydrive: loading out-of-tree module taints kernel. [ 176.912976] Got cmd = 3 [ 176.932960] Got cmd = 3 [ 176.952975] Got cmd = 3 [ 176.972968] Got cmd = 2 [ 176.992968] Got cmd = 28 [ 177.012966] Got cmd = 8 [ 177.032975] Got cmd = f [ 177.052966] Got cmd = 6 [ 177.052974] Got cmd = 1 [ 177.082968] Got cmd = d [ 177.082975] Got cmd = c [ 177.082982] Got data = 4c [ 177.082988] Got data = 69 [ 177.082994] Got data = 6e [ 177.082999] Got data = 75 [ 177.083004] Got data = 78 [ 177.083010] Got data = 2d [ 177.083015] Got data = 34 [ 177.083020] Got data = 2e [ 177.083025] Got data = 31 [ 177.083031] Got data = 39 [ 177.083036] Got data = 2e [ 177.083041] Got data = 36 [ 177.083046] Got data = 36 [ 177.083052] Got data = 2d [ 177.083057] Got data = 76 [ 177.083063] Got data = 37 [ 177.083069] Got data = 2b [ 177.083074] Got data = 20 [ 177.083080] Got data = 20 [ 177.083085] Got data = 20 [ 177.083090] Got data = 20 [ 177.083095] Got data = 20 [ 177.083100] Got data = 20 [ 177.083105] Got data = 20 [ 177.083110] Got data = 20 [ 177.083115] Got data = 20 [ 177.083120] Got data = 20 [ 177.083125] Got data = 20 [ 177.083131] Got data = 20 [ 177.083136] Got data = 20 [ 177.083141] Got data = 20 [ 177.083146] Got data = 20 [ 177.083151] Got data = 20 [ 177.083157] Got data = 20 [ 177.083162] Got data = 20 [ 177.083167] Got data = 20 [ 177.083172] Got data = 20 [ 177.083177] Got data = 20 [ 177.083182] Got data = 20 [ 177.083187] Got data = 20 [ 177.083192] Got cmd = c0 }}} ------ {{{ $ fdtdump /boot/bcm2708-rpi-b-plus.dtb $ dtc -I dts -O dtb -o ov.dtbo overlay.dts }}} == Escape codes == `\e[2J` :: clear display `\e[H` :: cursor to home `\e[LD` :: Display ON `\e[Ld` :: Display OFF `\e[LC` :: Cursor ON `\e[Lc` :: Cursor OFF `\e[LB` :: Blink ON `\e[Lb` :: Blink OFF `\e[L+` :: Back light ON `\e[L-` :: Back light OFF `\e[L*` :: Flash back light `\e[Lf` :: Small font `\e[LF` :: Large font `\e[Ln` :: One line `\e[LN` :: Two lines `\e[Ll` :: Shift cursor left `\e[Lr` :: Shift cursor right `\e[LL` :: Shift display left `\e[LR` :: Shift display right `\e[Lk` :: kill end of line `\e[LI` :: Reinitialize `\e[LG` :: Redefine character ? case 'x': /* gotoxy : LxXXX[yYYY]; */ case 'y': /* gotoxy : LyYYY[xXXX]; */ == Få igång det hela direkt == /usr/net/src/linux/arch/arm/boot/dts/overlays/hd44780-lcd-overlay.dts i /boot/config.txt {{{ [all] dtoverlay=hd44780-lcd,pin_d4=17,pin_d5=4,pin_d6=3,pin_d7=2,pin_en=22,pin_rs=27,display_height=4,display_width=16 }}} == Raspi paket == kbd :: Linux kernel keymap utils (should be installed by default) console-data :: Extra keymaps (including dvorak) console-tools :: alternative to kbd == Special chars == | 7e | → | | 7f | ← | | | | {{{ ┌───────────────┐ ┌────────────┐ ┌──────────┐ │keyboard input ├───────► │ │ │ └───────────────┘ │ PTY │ │ PTY │ ┌───────────────┐ │ Slave │◄──────────┤ Master ├───────►│ │ │ │ │ │ │ Shell (bash) │ │ ├──────────►│ │◄───────┤ │ ┌───────────────┐ │ │ │ │ └───────────────┘ │Physical Screen│◄──────┤ │ │ │ └───────────────┘ │ │ │ │ └────────────┘ └──────────┘ }}}