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
adc ADC analog converters driver Stable
ax12 ax12 servo motor driver Experimental
can CAN bus driver Stable
ccp CCP capture compare driver Stable
dma DMA Direct Memory Access drivers Experimental
gpio GPIO port driver Stable
i2c I2C communication driver Stable
ic Input compare driver Implementation needed
motor motor abstraction drivers Experimental
msi MSI dual core communication driver Stable
nvm NVM Non Volatile Memory Flash driver Stable
oc Output compare driver Experimental
pwm PWM driver Experimental
qei Quadrature encoder driver Stable
rtc RTC Real Time Clock drivers Implementation needed
sent SENT communication drivers Implementation needed
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/.