-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from MartinEbnerSensirion/master
make example work on Raspberry Pi Pico
- Loading branch information
Showing
5 changed files
with
87 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,69 @@ | ||
cmake_minimum_required(VERSION 3.12) | ||
include(${PICO_SDK_PATH}/pico_sdk_init.cmake) | ||
|
||
project(SCD4XSensor C CXX ASM) | ||
pico_sdk_init() | ||
|
||
set(CMAKE_C_STANDARD 11) | ||
set(CMAKE_CXX_STANDARD 17) | ||
add_executable(main | ||
main.c | ||
sensirion_i2c.c | ||
sensirion_i2c.hal.c | ||
scd4x_i2c.c | ||
sensirion_common.c) | ||
|
||
# pull in common dependencies and additional i2c hardware support | ||
target_link_libraries(main pico_stdlib hardware_i2c) | ||
|
||
pico_enable_stdio_usb(main 1) | ||
|
||
pico_enable_stdio_uart(main 0) | ||
|
||
# create map/bin/hex file etc. | ||
pico_add_extra_outputs(main) | ||
|
||
# Generated Cmake Pico project file | ||
|
||
cmake_minimum_required(VERSION 3.13) | ||
|
||
set(CMAKE_C_STANDARD 11) | ||
set(CMAKE_CXX_STANDARD 17) | ||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) | ||
|
||
# Initialise pico_sdk from installed location | ||
# (note this can come from environment, CMake cache etc) | ||
|
||
# == DO NEVER EDIT THE NEXT LINES for Raspberry Pi Pico VS Code Extension to work == | ||
if(WIN32) | ||
set(USERHOME $ENV{USERPROFILE}) | ||
else() | ||
set(USERHOME $ENV{HOME}) | ||
endif() | ||
set(sdkVersion 1.5.1) | ||
set(toolchainVersion 13_2_Rel1) | ||
set(picotoolVersion 2.0.0) | ||
set(picoVscode ${USERHOME}/.pico-sdk/cmake/pico-vscode.cmake) | ||
if (EXISTS ${picoVscode}) | ||
include(${picoVscode}) | ||
endif() | ||
# ==================================================================================== | ||
set(PICO_BOARD pico CACHE STRING "Board type") | ||
|
||
# Pull in Raspberry Pi Pico SDK (must be before project) | ||
include(pico_sdk_import.cmake) | ||
|
||
project(main C CXX ASM) | ||
|
||
# Initialise the Raspberry Pi Pico SDK | ||
pico_sdk_init() | ||
|
||
# Add executable. Default name is the project name, version 0.1 | ||
|
||
add_executable(main | ||
stc3x_i2c_example_usage.c | ||
sensirion_i2c.c | ||
sensirion_i2c_hal.c | ||
stc3x_i2c.c | ||
sensirion_common.c | ||
) | ||
|
||
pico_set_program_name(main "main") | ||
pico_set_program_version(main "0.1") | ||
|
||
# Modify the below lines to enable/disable output over UART/USB | ||
pico_enable_stdio_uart(main 0) | ||
pico_enable_stdio_usb(main 0) | ||
|
||
# Add the standard library to the build | ||
target_link_libraries(main | ||
hardware_i2c | ||
pico_stdlib) | ||
|
||
# Add the standard include files to the build | ||
target_include_directories(main PRIVATE | ||
${CMAKE_CURRENT_LIST_DIR} | ||
${CMAKE_CURRENT_LIST_DIR}/.. # for our common lwipopts or any other standard includes, if required | ||
) | ||
|
||
# Add any user requested libraries | ||
target_link_libraries(main | ||
|
||
) | ||
|
||
pico_add_extra_outputs(main) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters