renamed and led test

This commit is contained in:
2025-05-31 16:52:57 +01:00
parent 91e20a2638
commit 3bf41e40fe
4 changed files with 45 additions and 22 deletions

View File

@ -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
```

View File

@ -1,4 +1,4 @@
obj-m += hello.o
obj-m += counter.o
KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)

21
driver/counter.c Normal file
View File

@ -0,0 +1,21 @@
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
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 <wolfgang.hottgenroth@icloud.com>");
MODULE_DESCRIPTION("LKM for MainsCnt counter module");
MODULE_VERSION("0.1");

View File

@ -1,21 +0,0 @@
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
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");