Code Monkey home page Code Monkey logo

n7d-lkm's Introduction

N7D Device Driver

seven-segment-display

demo

Numerical 7-segment display device driver for Linux. This repository only contains the code for the Raspberry Pi. The RPi only sends the digits and commands via serial to a microcontroller and the mcu just displays the bytes. Although the display can be directly connected to the RPi or use a latch or some shift registers, I just wanted to try bit-banging using kernel timers. The kernel module consists of the upper half which handles user I/O, and the lower half which handles bit transmission via hrtimer. A detailed overview is on my blog.

Requirements

  • kernel headers : the kernel headers are needed to compile a kernel module. The version to download will depend on your (target) kernel version.
  • dtc : the RPi uses device tree for hardware enumeration. The dtc command will be used to compile the overlay and it should already be installed by default.

Install

Clone the repository, run make to compile the device tree overlay and the kernel module.

Device Tree Overlay

This kernel module uses the GPIO pins specified in the fragments in the overlay n7d_overlay.dts. Therefore, the overlay must be compiled, and put into the /boot/firmware/overlays/ directory for it to be accessible on boot. To apply the overlay, it must be specified in /boot/config.txt. For example,

# Compile the overlay
dtc -@ -I dts -O dtb -o $(DT_OVERLAY).dtbo $(DT_OVERLAY).dts

# Place the overlay in the overlays dir
cp $(DT_OVERLAY).dtbo /boot/firmware/overlays/.

# Edit config.txt to include the overlay (specify parameters if needed)
echo "dtoverlay=$(DT_OVERLAY)" >> /boot/config.txt

Kernel Module

To install the kernel module, run :

insmod n7d.ko

sudo or some access may be needed due to permission. modprobe may be used instead of insmod but there are no other dependencies for this module. The baudrate (default 38400) for the serial communication can be specified during module installation:

insmod n7d.ko n7d_baudrate=19200

Uninstall

Run rmmod n7d to remove the module from the kernel.

License

GPL

n7d-lkm's People

Contributors

thinkty avatar

Stargazers

Aldrin Cheung avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.