Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a small python programm which is executed if the board is yun #169

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 23 additions & 4 deletions cmake/Platform/Arduino.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1176,10 +1176,29 @@ function(setup_arduino_bootloader_upload TARGET_NAME BOARD_ID PORT AVRDUDE_FLAGS

list(APPEND AVRDUDE_ARGS "-Uflash:w:${TARGET_PATH}.hex")
list(APPEND AVRDUDE_ARGS "-Ueeprom:w:${TARGET_PATH}.eep:i")
add_custom_target(${UPLOAD_TARGET}
${ARDUINO_AVRDUDE_PROGRAM}
${AVRDUDE_ARGS}
DEPENDS ${TARGET_NAME})

if(${CMAKE_PROJECT_NAME}_BOARD STREQUAL "yun")
set (RESET_TTY_PYTHON_PROG "import sys\;")
set (RESET_TTY_PYTHON_PROG "${RESET_TTY_PYTHON_PROG} import serial\;")
set (RESET_TTY_PYTHON_PROG "${RESET_TTY_PYTHON_PROG} import time\;")
set (RESET_TTY_PYTHON_PROG "${RESET_TTY_PYTHON_PROG} ser=serial.Serial(\"${PORT}\",1200)\;")
set (RESET_TTY_PYTHON_PROG "${RESET_TTY_PYTHON_PROG} ser.close()\;")
set (RESET_TTY_PYTHON_PROG "${RESET_TTY_PYTHON_PROG} time.sleep(5)\;")
add_custom_target(${UPLOAD_TARGET}
COMMAND
python -c
${RESET_TTY_PYTHON_PROG}
COMMAND
${ARDUINO_AVRDUDE_PROGRAM}
${AVRDUDE_ARGS}
DEPENDS ${TARGET_NAME}
VERBATIM)
else()
add_custom_target(${UPLOAD_TARGET}
${ARDUINO_AVRDUDE_PROGRAM}
${AVRDUDE_ARGS}
DEPENDS ${TARGET_NAME})
endif()

# Global upload target
if(NOT TARGET upload)
Expand Down