You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
KED/drivers/README.md

3.2 KiB

Drivers

Description

Drivers are the higher level of code provided by KED. It comes on top of the Peripherals and alows the usage of comercially awailable IC's or moludes.


Please follow this guide to find out about the :


Structure

The driver folder has multiple elements inside :
  • CMakeLists.txt
    • where the DRIVERS_LIST is defined
  • Folders named after the driver that they respresent. Inside you will find:
    • Source file of the driver
    • Header file of the driver
  • This Readme file

Usage

In the CMakeLists.txt you will find the decalarion of DRIVERS_LIST list which contains the dirvers that are to be compiled. The name of the declared driver also defines the name of the driver's folder, souce file and header file. Once the driver is implemented correctly you can call the header of the driver from any soure of header file.

exmaple for ssd1306_i2c

#include "ssd1306_i2c.h"

CMake will the automatically find the driver, compile it and implement it to the main projet as a submodule.


Creation

Let's implement a driver named ssd1306_i2c

First let's add ssd1306_i2c to the DRIVERS_LIST.

Open CMakeLists.txt with your favorite text editor and modifiy the line wehre DRIVERS_LIST is defined. In which order the drivers are added to the list has no importance.

Before adding ssd1306_i2c

set(DRIVERS_LIST lcd_oled max7219 max31865) 

After adding ssd1306_i2c the declaration of DRIVERS_LIST should look like this

set(DRIVERS_LIST lcd_oled max7219 max31865 ssd1306_i2c) 

Than we can create a folder with the same name

mkdir ssd1306_i2c

Inside the newly created folder add the source and header file with the same name as the driver

In our case that means ssd1306_i2c.c and ssd1306_i2c.h

touch ssd1306_i2c.c ssd1306_i2c.h

The final structure should look like this

As you can see this folder also contains the datashhed for this driver. If you have any additional documentation like a datasheet or calculation sheet, feel free to add them here.

└── ssd1306_i2c
    ├── ssd1306_i2c.c
    ├── ssd1306_i2c.h
    └── SSD1306.pdf

Modification

You can modify each driver to your convinience but it can't be pushed again so please be careful during GIT transactions. You can also remove any driver from the complation by simply removing his declaration from the DRIVERS_LIST

Like so : set(DRIVERS_LIST lcd_oled max7219 max31865 ssd1306_i2c)

How to Contribute

Do you want to become a contibutor ? : How is Ked organised : Rules to write a Driver :

Credits

Edwin Koch Kerem Yollu

License

The last section of a high-quality README file is the license. This lets other developers know what they can and cannot do with your project. If you need help choosing a license, refer to https://choosealicense.com/.