Skip to content

mikeframpo/mmculib

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction:

This library (mmculib) contains a number of microprocessor independent
device drivers and miscellaneous functions.  It is primarily designed
for a bare-metal system.  mmculib relies on another library (such as
mat91lib) for microprocessor dependent support (such as low level
drivers for PIO, PWM. timer-counter (TC), etc.).

Compilation:

Here's an example of a Makefile to generate a program for the SAM4S16B
using mmculib and mat91lib.

# Executable file to create.
TARGET = target.bin

SRC = target.c foo.c bar.c

# Drivers from mmculib to use
DRIVERS = usb_cdc busart
# Peripherals from mat91lib to use
PERIPHERALS = ssc tc adc ac

# Microcontroller variety
MCU = SAM4S16B
# Link for ROM or RAM
RUN_MODE = ROM
# Optimisation options
OPT = -Os
# Path to mmculib top-level
MMCULIB_DIR = ../../mmculib
include $(MMCULIB_DIR)/mmculib.mk

The heavy-lifting is performed by the makefile fragment, mmculib.mk.
This automatically includes mat91lib.mk and the makefile fragments for
each driver and peripheral.

Other makefile variables that can be set to control the compilation are:
INCLUDES --- A list of paths to search for include files
VPATH    --- A list of paths to search for source files
CFLAGS   --- C compilation flags



Device driver API guidelines:

Each driver should support the following block read/write functions
where the addr parameter is optional.  Note the buffer is type void *
so that any object can be read/written without casting.  Len is the
transfer size in bytes.  The return value is the actual number of
bytes read or written.  Dev is a handle created by foo_init.  The
readv and writev forms are for reading/writing using a vector of
descriptors.  These forms are useful for coalescing I/O to minimise
writes (say to flash memory) or for atomic operations.


foo_ret_t
foo_read (foo_t dev, foo_addr_t addr, void *buffer, foo_size_t len);


foo_ret_t
foo_write (foo_t dev, foo_addr_t addr, const void *buffer, foo_size_t len);


foo_ret_t
foo_writev (foo_t dev, foo_addr_t addr, iovec_t *iov, iovec_count_t iov_count);


foo_ret_t
foo_readv (foo_t dev, foo_addr_t addr, iovec_t *iov, iovec_count_t iov_count);

Note, these routines should not block, well only for a very short time.


bits.h			Bit twidding macros
busart.c		Buffered USART driver
busart.h
button.c		Button/switch debouncing
button.h
buttons.c		Multiple button/switch debouncing
buttons.h
chaser.c		Sequenced flashing, uses flasher
chaser.h
ds18b20.c		Dallas one wire temperature sensor driver
ds18b20.h
ds2450.c		Dallas one wire ADC driver
ds2450.h
dscrc16.c		Dallas one wire 16 bit CRC
dscrc16.h
dscrc8.c		Dallas one wire 8 bit CRC
dscrc8.h
flasher.c		Generalised software PWM/flashing support
flasher.h
flasher_tweak.c		Run-time flasher manipulation
flasher_tweak.h
font.h			Font definition
isqrt16.c		16 bit integer square root
isqrt32.c		32 bit integer square root
lcd.c			HD44780/KS0066 LCD driver
lcd.h				
led.c			Simple LED driver
led_flash.c		LED flashing support
led_flash.h
led.h
lmatrix.c		LED matrix driver
lmatrix.h
mmelody.c		Interpret and sequence monophonic melodies
mmelody.h
mpwm.c
mpwm.h
mtext.c			Moving text driver
mtext.h
muxleds.c		Multiplexed LED driver
muxleds.h
nmea.c			NMEA string printing
nmea.h
nrf2401.c		Nordic RF driver
nrf2401.h
nrf_config.h
pga.c			Microchip PGA driver
pga.h		
piezo_beep.c		Piezo beep routines
piezo_beep.h
piezo.c			Simple piezo driver
piezo.h
rf.c			Generalised RF driver
rf.h
rf_master.c		Generalised RF master support
rf_slave.c		Generalised RF slave support
ring.c			Ring buffer
ring.h
scroller.c		Bit-mapped text scroller
scroller.h
s_eeprom.c		SPI EEPROM driver
s_eeprom.h
seq.c			Simple sequencer
seq.h
spwm.c
spwm.h
squeaker.c		Simple monophonic tune player
squeaker.h
stext.c			Simple text scroller (use mtext now)
stext.h
ticker.c		Simple polled timer
ticker.h
tweeter.c		PWM control of a piezo tweeter
tweeter.h
u1wire.c		Dallas universal one wire bus support
u1wire_debug.c		Dallas universal one wire bus debugging
u1wire_discover.c       Dallas universal one wire bus device discovery
u1wire_discover.h
u1wire.h
uint16toa.c		16-bit unsigned integer -> ASCII
uint16toa.h
uint8toa.c		8-bit unsigned integer -> ASCII
uint8toa.h


TODO
Convert files to use doxygen markup


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 96.1%
  • C++ 2.9%
  • Makefile 1.0%