From 3bf41e40fe41cc3ca98191ae336bc4df62b48e4a Mon Sep 17 00:00:00 2001 From: Wolfgang Hottgenroth Date: Sat, 31 May 2025 16:52:57 +0100 Subject: [PATCH] renamed and led test --- README.md | 23 +++++++++++++++++++++++ driver/Makefile | 2 +- driver/counter.c | 21 +++++++++++++++++++++ driver/hello.c | 21 --------------------- 4 files changed, 45 insertions(+), 22 deletions(-) create mode 100644 driver/counter.c delete mode 100644 driver/hello.c diff --git a/README.md b/README.md index efa611b..03461d1 100644 --- a/README.md +++ b/README.md @@ -33,4 +33,27 @@ apt install build-essential raspberrypi-kernel-headers git ``` +## Test LEDs: + +GPIO26 is red, GPIO21 is blue: + +Blue on: +``` +pinctrl set 21 op dh +``` + +Blue off: +``` +pinctrl set 21 op dl +``` + +Red on: +``` +pinctrl set 26 op dh +``` + +Red off: +``` +pinctrl set 26 op dl +``` diff --git a/driver/Makefile b/driver/Makefile index e531ee8..1233a6e 100644 --- a/driver/Makefile +++ b/driver/Makefile @@ -1,4 +1,4 @@ -obj-m += hello.o +obj-m += counter.o KDIR := /lib/modules/$(shell uname -r)/build PWD := $(shell pwd) diff --git a/driver/counter.c b/driver/counter.c new file mode 100644 index 0000000..fd8c378 --- /dev/null +++ b/driver/counter.c @@ -0,0 +1,21 @@ +#include +#include +#include + +static int __init counter_init(void) { + pr_info("counter: LKM loaded.\n"); + return 0; +} + +static void __exit counter_exit(void) { + pr_info("counter: LKM unloaded.\n"); +} + +module_init(counter_init); +module_exit(counter_exit); + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Wolfgang Hottgenroth "); +MODULE_DESCRIPTION("LKM for MainsCnt counter module"); +MODULE_VERSION("0.1"); + diff --git a/driver/hello.c b/driver/hello.c deleted file mode 100644 index 3e4c43d..0000000 --- a/driver/hello.c +++ /dev/null @@ -1,21 +0,0 @@ -#include -#include -#include - -static int __init hello_init(void) { - pr_info("hello: Modul wurde geladen.\n"); - return 0; -} - -static void __exit hello_exit(void) { - pr_info("hello: Modul wurde entladen.\n"); -} - -module_init(hello_init); -module_exit(hello_exit); - -MODULE_LICENSE("GPL"); -MODULE_AUTHOR("Du"); -MODULE_DESCRIPTION("Minimales Kernelmodul-Beispiel"); -MODULE_VERSION("0.1"); -