Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Lib/MicroPython: Added I2C Support
  • Loading branch information
oliviermartin committed Feb 27, 2017
1 parent 3610d5e commit b174504
Show file tree
Hide file tree
Showing 9 changed files with 1,127 additions and 2 deletions.
4 changes: 4 additions & 0 deletions Application/LabAPart/MicroPython/Application.cmake
Expand Up @@ -27,5 +27,9 @@
# Heap for MicroPython Garbage collector
set(FIRMWARE_HEAP 0x2000)

if (BOARD STREQUAL "Nordic/nRF52DK")
set(SUPPORT_I2C 1)
endif()

# List of modules needed by the application
set(LIST_MODULES CMSIS Lib/PolyMCU Lib/MicroPython)
5 changes: 5 additions & 0 deletions Lib/MicroPython/CMakeLists.txt
Expand Up @@ -50,6 +50,10 @@ if (BOARD MATCHES "Nordic/")
list(APPEND micropython_lib_SRCS board/nordic/pin.c board/nordic/nRF52_pins.c board/nordic/pin_named_pins.c)
endif()

if (SUPPORT_I2C)
list(APPEND micropython_lib_SRCS i2c.c)
endif()

if(NOT IS_DIRECTORY ${MICROPYTHON_SRC_DIR})
include(ExternalProject)

Expand Down Expand Up @@ -130,6 +134,7 @@ add_custom_command(OUTPUT ${MICROPYTHON_BUILD_DIR}/_frozen_mpy.c
list(APPEND micropython_lib_SRCS ${MICROPYTHON_SRC_DIR}/lib/utils/pyexec.c
${MICROPYTHON_SRC_DIR}/lib/libc/string0.c
${MICROPYTHON_SRC_DIR}/lib/mp-readline/readline.c
${MICROPYTHON_SRC_DIR}/stmhal/bufhelper.c
${MICROPYTHON_BUILD_DIR}/_frozen_mpy.c)

add_library(polymcu_micropython STATIC ${micropython_lib_SRCS} ${CMAKE_CURRENT_SOURCE_DIR}/libmicropython.a)
2 changes: 2 additions & 0 deletions Lib/MicroPython/board/nordic/mpplatformport.h
Expand Up @@ -33,4 +33,6 @@
#define PYB_LED_COUNT 4
#define PYB_LED_HAS_INTENSITY 0

#define PYB_I2C_COUNT 1

#endif

0 comments on commit b174504

Please sign in to comment.