libmcu
                                
                                
                                
                                    libmcu copied to clipboard
                            
                            
                            
                        A toolkit for firmware development
libmcu
Overview
A toolkit for firmware development.
Simplicity and code size are considered first while trying to avoid dynamic allocation as much as possible. No linker script tweak required.
The documentation of each modules are under the subdirectories. Some usage examples can also be found under examples and test cases.
Any feedback would be appreciated.
Modules
- Actor
 - Application Timer
 - Button
 - Command Line Interface
 - Common
 - FSM
 - Logging
 - Metrics
 - Power Management
 - PubSub
 - Retry with exponential backoff
 - Time Extension
 - Trace
 
Interfaces
- ADC
 - BLE
 - Flash
 - GPIO
 - I2C
 - KVStore
 - PWM
 - SPI
 - Timer
 - UART
 - WiFi
 
Integration Guide
The library can be intergrated in your project as a git submodule, using CMake FetchContent, or downloading manually.
git submodule
Include libmcu into your project
$ cd ${YOUR_PROJECT_DIR}
$ git submodule add https://github.com/libmcu/libmcu.git ${THIRD_PARTY_DIR}/libmcu
Add libmcu into your build system
Make
LIBMCU_ROOT ?= <THIRD_PARTY_DIR>/libmcu
# The commented lines below are optional. All modules and interfaces included
# by default if not specified.
#LIBMCU_MODULES := actor metrics
include $(LIBMCU_ROOT)/projects/modules.mk
<SRC_FILES> += $(LIBMCU_MODULES_SRCS)
<INC_PATHS> += $(LIBMCU_MODULES_INCS)
#LIBMCU_INTERFACES := gpio pwm
include $(LIBMCU_ROOT)/projects/interfaces.mk
<SRC_FILES> += $(LIBMCU_INTERFACES_SRCS)
<INC_PATHS> += $(LIBMCU_INTERFACES_INCS)
CMake
add_subdirectory(<THIRD_PARTY_DIR>/libmcu)
or
set(LIBMCU_ROOT <THIRD_PARTY_DIR>/libmcu)
#list(APPEND LIBMCU_MODULES metrics pubsub)
include(${LIBMCU_ROOT}/projects/modules.cmake)
#list(APPEND LIBMCU_INTERFACES i2c uart)
include(${LIBMCU_ROOT}/projects/interfaces.cmake)
# Add ${LIBMCU_MODULES_SRCS} to your target sources
# Add ${LIBMCU_MODULES_INCS} to your target includes
CMake FetchContent
include(FetchContent)
FetchContent_Declare(libmcu
		     GIT_REPOSITORY https://github.com/libmcu/libmcu.git
		     GIT_TAG main
)
FetchContent_MakeAvailable(libmcu)