microbit-dal/source/CMakeLists.txt

94 lines
3 KiB
CMake
Raw Normal View History

# This file is no longer auto-generated to make the repository builds with GCC
# and ARMCC no matter what.
cmake_minimum_required(VERSION 2.8.12)
enable_language(ASM)
set(YOTTA_AUTO_MICROBIT-DAL_CPP_FILES
"MicroBitSuperMain.cpp"
"MicroBitI2C.cpp"
"MicroBitMultiButton.cpp"
"MicroBitFont.cpp"
"MicroBit.cpp"
"MicroBitButton.cpp"
"MicroBitMessageBus.cpp"
"MicroBitCompass.cpp"
"MicroBitEvent.cpp"
"MicroBitFiber.cpp"
"ManagedString.cpp"
microbit: Added support for compass tilt compensation An e-compass solution requires knowwlede two pieces of data to provide an accurate heading: - Accurate calibration of the magnetometer hardware so that reliable measurements can be taken. - Knowledge of the pitch and roll of of device, so that the correct components of the X/Y and Z axis sensors of the magnetomer can be used to sense the magnetic field in a horizontal plane regardless of the tilt of the device. This commit represent changes to the MicroBitAccelerometer and MicroBitCompass classes to implemen tthese goals. More specifically, this commit provides: - The introduciton of an interactive calibration 'game', that can rapidly gather all the data required to calibrate the compass. - An improved calibration algorithm based on a Least Mean Squares approach of compass samples, as documened in Freescale Application Note AN4248. - The inclusion of a simple Matrix4 class to enable efficient Least Mean Squares implementation. - A change from asynchronous to synchronous calibration of the compass when first used. This is in repsonse to a feature request for this from users and high level languages using microbit-dal. - Support for detemrining tilt and roll angle in MicroBitAccelerometer - Support for multiple co-ordinate spaces in MicroBitAccelerometer and MicroBitCompass. Data can now be read in either RAW (unaltered) data. MICORBIT_SIMPLE_CARTESIAN (as used previously) or NORTH_EAST_DOWN (the industry convention in mobile phones, tablets and aviation) - Implementation of a tilt compensated algorithm, used when determining device heading.
2015-12-17 14:08:30 +00:00
"Matrix4.cpp"
"MicroBitAccelerometer.cpp"
"MicroBitThermometer.cpp"
"MicroBitIO.cpp"
"MicroBitCompat.cpp"
"MicroBitImage.cpp"
"MicroBitDisplay.cpp"
"DynamicPwm.cpp"
"MicroBitPin.cpp"
"MicroBitSerial.cpp"
"MicroBitHeapAllocator.cpp"
"MicroBitListener.cpp"
"RefCounted.cpp"
"MemberFunctionCallback.cpp"
2015-11-15 14:31:44 +00:00
"ble-services/MicroBitBLEManager.cpp"
"ble-services/MicroBitDFUService.cpp"
"ble-services/MicroBitEventService.cpp"
"ble-services/MicroBitLEDService.cpp"
"ble-services/MicroBitAccelerometerService.cpp"
"ble-services/MicroBitMagnetometerService.cpp"
"ble-services/MicroBitButtonService.cpp"
"ble-services/MicroBitIOPinService.cpp"
"ble-services/MicroBitTemperatureService.cpp"
)
execute_process(WORKING_DIRECTORY "../../yotta_modules/${PROJECT_NAME}" COMMAND "git" "log" "--pretty=format:%h" "-n" "1" OUTPUT_VARIABLE git_hash)
execute_process(WORKING_DIRECTORY "../../yotta_modules/${PROJECT_NAME}" COMMAND "git" "rev-parse" "--abbrev-ref" "HEAD" OUTPUT_VARIABLE git_branch OUTPUT_STRIP_TRAILING_WHITESPACE)
if ("${git_branch}" STREQUAL "master")
set(MICROBIT_DAL_VERSION_STRING "${YOTTA_MICROBIT_DAL_VERSION_STRING}")
else()
set(MICROBIT_DAL_VERSION_STRING "${YOTTA_MICROBIT_DAL_VERSION_STRING}-${git_branch}-g${git_hash}")
endif()
set(MICROBIT_DAL_VERSION_FLAGS "-DMICROBIT_DAL_VERSION=\\\"${MICROBIT_DAL_VERSION_STRING}\\\"")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MICROBIT_DAL_VERSION_FLAGS}")
if (YOTTA_CFG_MICROBIT_CONFIGFILE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${YOTTA_FORCE_INCLUDE_FLAG} \"${YOTTA_CFG_MICROBIT_CONFIGFILE}\"")
endif ()
if(CMAKE_COMPILER_IS_GNUCC)
file(REMOVE "asm/CortexContextSwitch.s")
configure_file("asm/CortexContextSwitch.s.gcc" "asm/CortexContextSwitch.s" COPYONLY)
else()
file(REMOVE "asm/CortexContextSwitch.s")
configure_file("asm/CortexContextSwitch.s.armcc" "asm/CortexContextSwitch.s" COPYONLY)
endif()
set(YOTTA_AUTO_MICROBIT-DAL_S_FILES
"asm/CortexContextSwitch.s"
)
add_library(microbit-dal
${YOTTA_AUTO_MICROBIT-DAL_CPP_FILES}
${YOTTA_AUTO_MICROBIT-DAL_S_FILES}
)
yotta_postprocess_target(LIBRARY microbit-dal)
target_link_libraries(microbit-dal
mbed-classic
ble
ble-nrf51822
)
if(CMAKE_COMPILER_IS_GNUCC)
message("suppressing ALL warnings from mbed-classic, ble, ble-nrf51822 & nrf51-sdk")
target_compile_options(mbed-classic PRIVATE "-w")
target_compile_options(ble PRIVATE "-w")
target_compile_options(ble-nrf51822 PRIVATE "-w")
target_compile_options(nrf51-sdk PRIVATE "-w")
endif()