add missing files
This commit is contained in:
59
CMakeLists.txt
Normal file
59
CMakeLists.txt
Normal file
@ -0,0 +1,59 @@
|
||||
## A simple CMake file to compile an Arduino project.
|
||||
## Adjust the settings according to your board.
|
||||
## The settings here work for the Arduino Uno, Rev. 3.
|
||||
|
||||
# Project name
|
||||
project(marklincontroller)
|
||||
|
||||
# CMake version
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
|
||||
# Options
|
||||
# Adjust to your board
|
||||
set(MCU "atmega328p" CACHE STRING "Processor Type")
|
||||
set(CPU_SPEED "16000000" CACHE STRING "Speed of the CPU")
|
||||
set(PORT "/dev/ttyUSB3" CACHE STRING "USB Port")
|
||||
set(PORT_SPEED "57600" CACHE STRING "Serial Port Speed")
|
||||
set(PROGRAMMER "stk500v1" CACHE STRING "Programmer Type")
|
||||
set(COMPILE_FLAGS "" CACHE STRING "Additional Compiler Flags")
|
||||
|
||||
# Set own source files
|
||||
# Simply list all your C / C++ source (not header!) files here
|
||||
set(SRC_FILES main.cpp serial.cpp train.cpp)
|
||||
|
||||
# Compiler suite specification
|
||||
set(CMAKE_C_COMPILER /usr/bin/avr-gcc)
|
||||
set(CMAKE_CXX_COMPILER /usr/bin/avr-g++)
|
||||
set(CMAKE_OBJCOPY /usr/bin/avr-objcopy)
|
||||
set(CMAKE_OBJDUMP /usr/bin/avr-objdump)
|
||||
set(CMAKE_RANLIB /usr/bin/avr-ranlib)
|
||||
set(CMAKE_LINKER /usr/bin/avr-ld)
|
||||
|
||||
# Compiler flags
|
||||
add_definitions(-mmcu=${MCU} -DF_CPU=${CPU_SPEED})
|
||||
add_definitions(-s -c -g -Os -Wall -std=c++11 )
|
||||
add_definitions(-fno-exceptions -ffunction-sections -fdata-sections)
|
||||
|
||||
# Linker flags
|
||||
set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "-Os") # remove -rdynamic for C
|
||||
set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "-Os") # remove -rdynamic for CXX
|
||||
set(CMAKE_EXE_LINKER_FLAGS "-Os -Wl,--gc-sections -mmcu=${MCU}")
|
||||
|
||||
add_executable(${PROJECT_NAME} ${ARDUINO_CORE_SRC} ${SRC_FILES})
|
||||
|
||||
find_program(AR_AVRDUDE NAMES avrdude PATHS /usr/bin NO_DEFAULT_PATH)
|
||||
|
||||
find_program(AR_AVRSIZE NAMES avr-size PATHS /usr/bin NO_DEFAULT_PATH)
|
||||
|
||||
add_custom_target(download
|
||||
COMMAND ${CMAKE_OBJCOPY} -j .text -j .data -O ihex ${PROJECT_NAME} ${PROJECT_NAME}.hex
|
||||
COMMAND ${AR_AVRSIZE} -C ${PROJECT_NAME}
|
||||
COMMAND ${AR_AVRDUDE} -v -p ${MCU} -c ${PROGRAMMER} -P /dev/ttyUSB0 -b 57600 -D -U flash:w:${PROJECT_NAME}.hex
|
||||
DEPENDS ${PROJECT_NAME}
|
||||
)
|
||||
|
||||
add_custom_target(export
|
||||
COMMAND ${CMAKE_OBJCOPY} -j .text -j .data -O ihex ${PROJECT_NAME} ${PROJECT_NAME}.hex
|
||||
COMMAND ${AR_AVRSIZE} -C ${PROJECT_NAME}
|
||||
DEPENDS ${PROJECT_NAME}
|
||||
)
|
9
bitrep.h
Normal file
9
bitrep.h
Normal file
@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
const char *bit_rep[16] =
|
||||
{
|
||||
[ 0] = "0000", [ 1] = "0001", [ 2] = "0010", [ 3] = "0011",
|
||||
[ 4] = "0100", [ 5] = "0101", [ 6] = "0110", [ 7] = "0111",
|
||||
[ 8] = "1000", [ 9] = "1001", [10] = "1010", [11] = "1011",
|
||||
[12] = "1100", [13] = "1101", [14] = "1110", [15] = "1111",
|
||||
};
|
8
commands
Normal file
8
commands
Normal file
@ -0,0 +1,8 @@
|
||||
Lights:
|
||||
|
||||
TRYING: 3 //works 0000000011
|
||||
|
||||
TELEX:
|
||||
|
||||
TRYING: 280 //works front telex 0b1010000000
|
||||
TRYING: 2A0 //works rear telex 0b1010100000
|
Reference in New Issue
Block a user