Skip to content

Raspberry Pi Pico SDK and Toolchain can support modules as of v2.2.0! This is a super simple CMake file to get you started.

Notifications You must be signed in to change notification settings

sysreq/RPi-Pico-Modules

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

Raspberry Pi Pico -- Modules

A simple cmake script to streamline adding modules into your Pi Pico projects. I am not in any way associated with Raspberry Pi - but figured someone else might find this helpful.

Don't forget to enable module support:

set(CMAKE_CXX_STANDARD 23)
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-fmodules-ts>)
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-std=c++23>)

Examples:

Simple module

add_simple_pico_module(i2c_module my_module.cppm pico_stdlib hardware_i2c)

More complex module with multiple files and custom settings

add_pico_module(spi_module
      MODULE_FILES 
          spi_config.cppm
          spi_utils.cppm
      PICO_LIBS 
          pico_stdlib 
          hardware_spi 
          hardware_gpio
      INCLUDE_DIRS 
          ${CMAKE_CURRENT_LIST_DIR}/spi
          ${CMAKE_CURRENT_LIST_DIR}/common
      COMPILE_DEFINITIONS
          SPI_DEBUG=1
  )

Linking

To add the modules into your build just use the alias 'pico_modules'.

target_link_libraries(my_project PRIVATE
        pico_modules
        pico_stdlib
        ...
)

About

Raspberry Pi Pico SDK and Toolchain can support modules as of v2.2.0! This is a super simple CMake file to get you started.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages