Skip to content

Commit

Permalink
Merge branch 'develop' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
passy1977 committed Jul 25, 2023
2 parents 2bd159c + ede2802 commit 5f1e2d2
Show file tree
Hide file tree
Showing 13 changed files with 1,082 additions and 48 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,5 @@ build/
.vscode/targets.log
.vscode/configurationCache.log
.vscode/dryrun.log

test/test
9 changes: 8 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
{
"makefile.extensionOutputFolder": "./.vscode"
"makefile.extensionOutputFolder": "./.vscode",
"files.associations": {
"kernel.h": "c",
"module.h": "c",
"types.h": "c",
"posix_types.h": "c",
"type_traits": "c"
}
}
28 changes: 28 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: gcc-10 build active file",
"command": "/usr/bin/gcc-10",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
}
],
"version": "2.0.0"
}
18 changes: 15 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# make -C /lib/modules/$(uname -r)/build M=$(pwd) modules
program_name = hhg_lcd

obj-m += happygardenpidriver.o
happygardenpidriver-objs := src/happygardenpidriver.o
obj-m += $(program_name).o

ccflags-y := -std=gnu11 -Wno-declaration-after-statement
EXTRA_CFLAGS:= -D TEST=1

PWD := $(CURDIR)

Expand All @@ -12,4 +13,15 @@ all:
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean

# Utilities for fast testing ...
insert:
sudo insmod $(program_name).ko gpio_rs=26 gpio_en=19 gpio_db4=13 gpio_db5=6 gpio_db6=5 gpio_db7=11 # insert $ make i
remove:
sudo rmmod $(program_name) # remove $ make r
print:
sudo dmesg # print $ make p
c:
sudo dmesg -c # clear dmesg $ make c
info:
sudo modinfo $(program_name).ko #userspace program prints .modinfo section

32 changes: 31 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,32 @@
# happy-gardenpi-driver
Driver to get access to hardware resources
Simple driver for LCD 16x2 management with chip HITACHI HD44780U compatible.

At the moment, only the 4-bit configuration is tested.

To compile the module:
```
git clone https://github.com/HiHappyGarden/hhg-lcd-16x2-HD44780U.git
cd hhg-lcd-16x2-HD44780U
sudo make
```

To install the module:
```
sudo insmod hhg_lcd.ko gpio_rs=26 gpio_en=19 gpio_db4=13 gpio_db5=6 gpio_db6=5 gpio_db7=11
```
gpio_rs=x gpio_en=x gpio_db4=x gpio_db5=x gpio_db6=x gpio_db7=x correspond to the pins on the LCD as reported in the documentation linked below.

The above configuration has been tested on a Raspberry Pi 4.

To remove the module:
```
sudo rmmod hhg_lcd
```
To test:
```
echo hello_world > /dev/hhg_lcd
```

## Documentation reference
* [HITACHI HD44780U](https://www.sparkfun.com/datasheets/LCD/HD44780.pdf)

Loading

0 comments on commit 5f1e2d2

Please sign in to comment.