View on Github

Drivers support

Low level drivers that dependant of the processor.

Each driver must have a particular directory with the same name of the driver which contains a 'driver-name'.mk file.

Actual drivers supported

Driver name Description Status
ax12 ax12 servo motor driver Experimental
motor motor abstraction drivers Experimental
adc ADC analog converters driver Experimental
can CAN bus driver Experimental
i2c I2C communication driver Stable
ic Input compare driver Implementation needed
oc Output compare driver Experimental
pwm PWM driver Experimental
qei Quadrature encoder driver Stable
spi SPI communication driver Implementation needed
sysclock System clock Stable
timer Timer driver Stable
uart UART (serial) communication driver Stable
usb_hal USB low layer driver Experimental
usb_serial USB CDC driver Experimental

How to add a driver support?

Create a directory with the name of the driver in this directory :

mkdir <driver-name>

Add .mk in this directory. This file will be included by the makefile when a project ask the support for this driver.

To avoid multiple inclusion of .mk, add this (example with timer) :

    ifndef TIMER_DRIVER
    TIMER_DRIVER=

    #content of file here ....

    endif

If the driver need the support of another drivers, add it :

    DRIVERS += another_driver

To include C files directory to paths of sources, add this directives and as many you need :

    vpath %.c $(DRIVERPATH)
    vpath %.h $(DRIVERPATH)
    vpath %.c $(DRIVERPATH)/other-source-dir
    vpath %.h $(DRIVERPATH)/other-source-dir

You just need to add header and source code files :

    SRC += timer.c
    HEADER += timer.h

And for specific architecture :

    ifeq ($(ARCHI),$(filter $(ARCHI),dspic33ep dspic33fj))
     ARCHI_SRC += timer_dspic33.c
     HEADER += timer_dspic33.h
    endif
    ifeq ($(ARCHI), pic24)
     ARCHI_SRC += timer_pic24.c
     HEADER += timer_pic24.h
    endif

To implement a simulator interface :

    SIM_SRC += timer_sim.c

And for global inclusion of the driver, add a header file that include needed include files of the support in include/driver/.