diff --git a/CMakeModules/FindFFmpeg.cmake b/CMakeModules/FindFFmpeg.cmake index d7a720e..dcb3662 100644 --- a/CMakeModules/FindFFmpeg.cmake +++ b/CMakeModules/FindFFmpeg.cmake @@ -1,7 +1,7 @@ include(FindPackageHandleStandardArgs) -set( FFMPEG_LIB "${CMAKE_FIND_ROOT_PATH}/arm-linux-gnueabihf/lib" ) -set( FFMPEG_INC "${CMAKE_FIND_ROOT_PATH}/arm-linux-gnueabihf/include" ) +set( FFMPEG_LIB "${CMAKE_FIND_ROOT_PATH}/aarch64-linux-gnu/lib" ) +set( FFMPEG_INC "${CMAKE_FIND_ROOT_PATH}/aarch64-linux-gnu/include" ) foreach (_component ${FFmpeg_FIND_COMPONENTS}) @@ -23,7 +23,7 @@ foreach (_component ${FFmpeg_FIND_COMPONENTS}) lib HINTS ${FFmpeg_${_component}_INCLUDE_DIR}/../lib - ${FFmpeg_${_component}_INCLUDE_DIR}/../lib/arm-linux-gnueabihf + ${FFmpeg_${_component}_INCLUDE_DIR}/../lib/aarch64-linux-gnu ) if ( FFmpeg_${_component}_LIBRARIES ) set( FFMPEG_${_component}_FOUND 1 ) diff --git a/CMakeModules/FindGPS.cmake b/CMakeModules/FindGPS.cmake index 4c4a851..983d74e 100644 --- a/CMakeModules/FindGPS.cmake +++ b/CMakeModules/FindGPS.cmake @@ -1,7 +1,7 @@ include(FindPackageHandleStandardArgs) -set( LIBGPS_LIB "${CMAKE_FIND_ROOT_PATH}/arm-linux-gnueabihf/lib" ) -set( LIBGPS_INC "${CMAKE_FIND_ROOT_PATH}/arm-linux-gnueabihf/include" ) +set( LIBGPS_LIB "${CMAKE_FIND_ROOT_PATH}/aarch64-linux-gnu/lib" ) +set( LIBGPS_INC "${CMAKE_FIND_ROOT_PATH}/aarch64-linux-gnu/include" ) find_library( GPS_LIBRARIES diff --git a/README.md b/README.md index dca0926..31b8712 100644 --- a/README.md +++ b/README.md @@ -102,7 +102,7 @@ This carrier board has the following features : * Video composite output (can be directly connected to any FPV drone VTX) ## Building `controller_pc` -For cmake to run properly, the below dependecies should be installed first. Below commands are working for: ***Distro***: Ubuntu 22.04.2 LTS (Jammy Jellyfish), ***Kernel***: 5.15.0-69-lowlatency x86_64, ***bits***: 64, ***Desktop***: Xfce 4.16.0 +For cmake to run properly, the below dependecies should be installed first. Below commands are working for: ***Distro***: Ubuntu 22.04.2 LTS (Jammy Jellyfish), ***Kernel***: 5.15.0-69-lowlatency x86_64, ***bits***: 64, ***Desktop***: Xfce 4.16.0 1. **Install dependencies** * `sudo apt-get install nasm qtmultimedia5-dev qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools libnl-3-dev libnl-genl-3-dev libnl-route-3-dev libiw-dev libfftw3-dev` @@ -159,15 +159,14 @@ Currently only Raspberry Pi boards are supported, the 4'th variants are the reco 1. **Install dependencies** * `sudo apt update` - * `sudo apt install git pkg-config cmake make g++ libc6-dev libraspberrypi-dev libiw-dev libdrm-dev libgbm-dev libcamera-dev libgles2-mesa-dev libgps-dev libasound2-dev libcrypt-dev zlib1g-dev libpng-dev libshine-dev libavformat-dev libavutil-dev libavcodec-dev libpigpio-dev lua5.3 libfftw3-dev` + * `sudo apt install git pkg-config cmake make g++ libc6-dev libraspberrypi-dev libiw-dev libdrm-dev libgbm-dev libcamera-dev libgles2-mesa-dev libgps-dev libasound2-dev libcrypt-dev zlib1g-dev libpng-dev libshine-dev libavformat-dev libavutil-dev libavcodec-dev libpigpio-dev lua5.4 liblua5.4-dev libfftw3-dev libpcap-dev` 2. **Build** * `git clone https://github.com/dridri/bcflight` * `cd bcflight/flight` * `cmake -Dboard=rpi -Ddebug=1 -S . -B build` - * `cd build` - * `make -j$(nproc)` - + * `cmake --build build -j` + This will produce two files : `flight_unstripped` which contains all debugging symbols, and `flight` which is a lightweight regular executable. * `flight_unstripped` can be run via gdb, or Valgrind using [flight/valgrind.sh](./flight/valgrind.sh) * `flight` is intended to be used on final product diff --git a/Toolchain-rpi.cmake b/Toolchain-rpi.cmake index 3277d8e..a465c5d 100644 --- a/Toolchain-rpi.cmake +++ b/Toolchain-rpi.cmake @@ -1,19 +1,19 @@ SET( CMAKE_SYSTEM_NAME Linux ) SET( CMAKE_SYSTEM_VERSION 1 ) -SET( CROSS arm-linux-gnueabihf- ) -SET( CMAKE_C_COMPILER arm-linux-gnueabihf-gcc ) -SET( CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++ ) -SET( CMAKE_ASM_COMPILER arm-linux-gnueabihf-as ) +SET( CROSS aarch64-linux-gnu- ) +SET( CMAKE_C_COMPILER aarch64-linux-gnu-gcc ) +SET( CMAKE_CXX_COMPILER aarch64-linux-gnu-g++ ) +SET( CMAKE_ASM_COMPILER aarch64-linux-gnu-as ) execute_process( - COMMAND bash -c "dirname $(dirname $(whereis arm-linux-gnueabihf-gcc | cut -d':' -f2 | tr -d ' '))" + COMMAND bash -c "dirname $(dirname $(which aarch64-linux-gnu-gcc | cut -d':' -f2 | tr -d ' '))" OUTPUT_VARIABLE ROOT_PATH OUTPUT_STRIP_TRAILING_WHITESPACE ) SET( CMAKE_FIND_ROOT_PATH ${ROOT_PATH} ) -set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L${ROOT_PATH}/arm-linux-gnueabihf/lib/arm-linux-gnueabihf") +set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L${ROOT_PATH}/aarch64-linux-gnu/lib/aarch64-linux-gnu") set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) SET( FREETYPE_INCLUDE_DIRS "${CMAKE_FIND_ROOT_PATH}/include/freetype2" ) diff --git a/controller_pc/CMakeLists.txt b/controller_pc/CMakeLists.txt index a611cd7..e0542f9 100644 --- a/controller_pc/CMakeLists.txt +++ b/controller_pc/CMakeLists.txt @@ -63,7 +63,7 @@ if( CMAKE_SIZEOF_VOID_P EQUAL 4 ) set( LUA_32 "-m32" ) endif() # add_custom_target( libluajit_static COMMAND bash ${CMAKE_SOURCE_DIR}/../external/build_luajit.sh ${CMAKE_BINARY_DIR} ${CMAKE_C_COMPILER} ${CMAKE_ASM_COMPILER} ${CROSS}strip ${LUA_32} ) -add_custom_target( libluajit_static COMMAND bash ${CMAKE_SOURCE_DIR}/../external/build_luajit.sh ${CMAKE_BINARY_DIR} ${CMAKE_C_COMPILER} ${CMAKE_ASM_COMPILER} ${CROSS}strip ${LUA_HOST_CC_OPTIONS} ) +# add_custom_target( libluajit_static COMMAND bash ${CMAKE_SOURCE_DIR}/../external/build_luajit.sh ${CMAKE_BINARY_DIR} ${CMAKE_C_COMPILER} ${CMAKE_ASM_COMPILER} ${CROSS}strip ${LUA_HOST_CC_OPTIONS} ) add_custom_target( libopenh264_static COMMAND bash ${CMAKE_SOURCE_DIR}/../external/build_openh264.sh ${CMAKE_BINARY_DIR} ${CMAKE_C_COMPILER} ) qt5_wrap_ui( controller_pc_UI @@ -91,10 +91,10 @@ add_executable( controller_pc ) add_dependencies( controller_pc libopenh264_static ) -add_dependencies( controller_pc libluajit_static ) +# add_dependencies( controller_pc libluajit_static ) add_dependencies( controller_pc controller ) add_dependencies( controller_pc libdebug ) -target_link_libraries( controller_pc -L./ controller libdebug -lluajit_static -ldecoder_static -lopenh264_static ${SHINE_LIBRARIES} ${MP4V2_LIBRARIES} ${QSCINTILLA_LIBRARY} Qt5::Widgets Qt5::OpenGL Qt5::PrintSupport Qt5::Multimedia ${OPENGL_LIBRARIES} -lpthread ${OTHER_LIBS} ) +# target_link_libraries( controller_pc -L./ controller libdebug -lluajit_static -ldecoder_static -lopenh264_static ${SHINE_LIBRARIES} ${MP4V2_LIBRARIES} ${QSCINTILLA_LIBRARY} Qt5::Widgets Qt5::OpenGL Qt5::PrintSupport Qt5::Multimedia ${OPENGL_LIBRARIES} -lpthread ${OTHER_LIBS} ) install( TARGETS controller_pc RUNTIME DESTINATION bin ) diff --git a/controller_rc/CMakeLists.txt b/controller_rc/CMakeLists.txt index 0a49121..44fc4d6 100644 --- a/controller_rc/CMakeLists.txt +++ b/controller_rc/CMakeLists.txt @@ -63,7 +63,7 @@ include_directories( ${CMAKE_SOURCE_DIR}/../external/LuaJIT-2.0.4/src ) add_subdirectory( ${CMAKE_SOURCE_DIR}/../libcontroller libcontroller ) add_subdirectory( ${CMAKE_SOURCE_DIR}/../libdebug libdebug ) -add_custom_target( libluajit_static COMMAND bash ${CMAKE_SOURCE_DIR}/../external/build_luajit.sh ${CMAKE_BINARY_DIR} ${CMAKE_C_COMPILER} ${CMAKE_ASM_COMPILER} ${CROSS}strip "-m32" ) +# add_custom_target( libluajit_static COMMAND bash ${CMAKE_SOURCE_DIR}/../external/build_luajit.sh ${CMAKE_BINARY_DIR} ${CMAKE_C_COMPILER} ${CMAKE_ASM_COMPILER} ${CROSS}strip "-m32" ) add_custom_target( ui_headers COMMAND ${UIC} ${CMAKE_SOURCE_DIR}/ui/main.ui > ${CMAKE_BINARY_DIR}/ui_main.h && ${UIC} ${CMAKE_SOURCE_DIR}/ui/window.ui > ${CMAKE_BINARY_DIR}/ui_window.h @@ -91,10 +91,10 @@ add_executable( controller_rc ) add_dependencies( controller_rc controller ) -add_dependencies( controller_rc libluajit_static ) +# add_dependencies( controller_rc libluajit_static ) add_dependencies( controller_rc ui_headers ) -target_link_libraries( controller_rc -L./ controller libdebug libluajit_static.a -lrt -ldl ${RAWWIFI_LIBS} -lz pthread ${BOARD_LIBS} ) +# target_link_libraries( controller_rc -L./ controller libdebug libluajit_static.a -lrt -ldl ${RAWWIFI_LIBS} -lz pthread ${BOARD_LIBS} ) install( TARGETS controller_rc RUNTIME DESTINATION bin ) diff --git a/controller_rc/boards/rpi/board.cmake b/controller_rc/boards/rpi/board.cmake index 110338e..0e174a1 100644 --- a/controller_rc/boards/rpi/board.cmake +++ b/controller_rc/boards/rpi/board.cmake @@ -3,8 +3,8 @@ execute_process( COMMAND uname -p OUTPUT_VARIABLE BUILD_ARCH ) set( TARGET_CPU_BITS 32 ) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_DEFAULT_SOURCE -DSTANDALONE -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -DTARGET_POSIX -D_LINUX -fPIC -DPIC -D_REENTRANT -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -U_FORTIFY_SOURCE") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfloat-abi=hard -Wl,--unresolved-symbols=ignore-in-shared-libs -I/opt/vc/include/ -L/opt/vc/lib/ -Wl,-rpath=/opt/vc/lib") -set(CMAKE_LD_FLAGS "${CMAKE_LD_FLAGS} -mfloat-abi=hard -Wl,--unresolved-symbols=ignore-in-shared-libs -L/opt/vc/lib/ -Wl,-rpath=/opt/vc/lib") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--unresolved-symbols=ignore-in-shared-libs -I/opt/vc/include/ -L/opt/vc/lib/ -Wl,-rpath=/opt/vc/lib") +set(CMAKE_LD_FLAGS "${CMAKE_LD_FLAGS} -Wl,--unresolved-symbols=ignore-in-shared-libs -L/opt/vc/lib/ -Wl,-rpath=/opt/vc/lib") set(CMAKE_LINKER_FLAGS "${CMAKE_LD_FLAGS}") include_directories( /opt/vc/include ) set( BOARD_LIBS -lpigpio -lrt -lpthread -ldl -lz -liw ) diff --git a/external/build_luajit.sh b/external/build_luajit.sh deleted file mode 100755 index 20ff1df..0000000 --- a/external/build_luajit.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -echo "$0 $1 $2 $3 $4 $5 $6" -echo "HOST_CC=cc $5" -echo "CC=$2" - -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -EXTRA="" - -if [ ! -d ${DIR}/LuaJIT-2.0.4 ]; then - wget "http://luajit.org/download/LuaJIT-2.0.4.tar.gz" -O ${DIR}/LuaJIT-2.0.4.tar.gz - tar xf ${DIR}/LuaJIT-2.0.4.tar.gz -C ${DIR} -# rm ${DIR}/LuaJIT-2.0.4.tar.gz -fi - -if [[ $2 == *"mingw"* ]]; then - EXTRA="TARGET_SYS=Windows"; -fi - -if [ ! -f $1/libluajit_static.a ]; then -# echo "make clean libluajit.a -C ${DIR}/LuaJIT-2.0.4/src HOST_CC=\"cc $5\" BUILDMODE=static CC=\"$2\" ASM=\"$3\" STRIP=$4 $EXTRA XCFLAGS=-DLUAJIT_USE_SYSMALLOC CFLAGS=\"$6\"" - echo "make clean libluajit.a -C ${DIR}/LuaJIT-2.0.4/src HOST_CC=\"cc $5\" BUILDMODE=static CC=\"$2\" ASM=\"$3\" STRIP=$4 $EXTRA CFLAGS=\"$6\"" - make clean libluajit.a -C ${DIR}/LuaJIT-2.0.4/src HOST_CC="cc $5" BUILDMODE=static CC="$2" ASM="$3" STRIP=$4 $EXTRA CFLAGS="$6" - cp ${DIR}/LuaJIT-2.0.4/src/libluajit.a libluajit_static.a -fi diff --git a/flight/BlackBox.cpp b/flight/BlackBox.cpp index d0a122d..0ba6343 100644 --- a/flight/BlackBox.cpp +++ b/flight/BlackBox.cpp @@ -187,7 +187,7 @@ void BlackBox::Enqueue( const char* data[], const char* values[], int n ) mQueueMutex.lock(); for ( int i = 0; i < n; i++ ) { - sprintf( str, "%llu,%s,%s", time, data[i], values[i] ); + sprintf( str, "%" PRIu64 ",%s,%s", time, data[i], values[i] ); mQueue.emplace_back( string(str) ); } mQueueMutex.unlock(); diff --git a/flight/CMakeLists.txt b/flight/CMakeLists.txt index d203fbf..4582cde 100755 --- a/flight/CMakeLists.txt +++ b/flight/CMakeLists.txt @@ -22,6 +22,10 @@ option(debug "debug") option(socket "socket") option(rawwifi "rawwifi") +add_compile_options(-Wall -Werror) +add_compile_options(-Wno-error=return-type) +add_compile_options(-Wno-error=deprecated-declarations) + include( config.cmake ) if ( ${BUILD_links} MATCHES 0 OR ${BUILD_links} MATCHES OFF ) file(GLOB children RELATIVE ${CMAKE_SOURCE_DIR}/links ${CMAKE_SOURCE_DIR}/links/*) @@ -271,10 +275,10 @@ if ( "${CMAKE_SYSTEM_NAME}" MATCHES "Linux" ) else() set( LUA_HOST_CC_OPTIONS "" ) endif() - add_custom_target( libluajit_static COMMAND bash ${CMAKE_SOURCE_DIR}/../external/build_luajit.sh ${CMAKE_BINARY_DIR} ${CMAKE_C_COMPILER} ${CMAKE_ASM_COMPILER} ${CROSS}strip ${LUA_HOST_CC_OPTIONS} "${CMAKE_C_FLAGS} -Wno-misleading-indentation" ) - add_dependencies( flight_unstripped libluajit_static ) + # add_custom_target( libluajit_static COMMAND bash ${CMAKE_SOURCE_DIR}/../external/build_luajit.sh ${CMAKE_BINARY_DIR} ${CMAKE_C_COMPILER} ${CMAKE_ASM_COMPILER} ${CROSS}strip ${LUA_HOST_CC_OPTIONS} "${CMAKE_C_FLAGS} -Wno-misleading-indentation" ) + # add_dependencies( flight_unstripped libluajit_static ) include_directories( ${CMAKE_SOURCE_DIR}/../external/LuaJIT-2.0.4/src ) - set( LIBS ${LIBS} luajit_static ) + # set( LIBS ${LIBS} luajit_static ) elseif( "${CMAKE_SYSTEM_NAME}" MATCHES "Generic" ) # add_definitions( -DLUA_32BITS ) # set( LUA_CFLAGS "${CMAKE_C_FLAGS} -DLUA_32BITS" ) @@ -289,7 +293,7 @@ endif() add_subdirectory( ${CMAKE_SOURCE_DIR}/../libluacore ${CMAKE_CURRENT_BINARY_DIR}/libluacore ) include_directories( ${CMAKE_SOURCE_DIR}/../libluacore/src ) add_definitions( -DLUA_CLASS= -DLUA_EXPORT= ) -add_dependencies( luacore libluajit_static ) +# add_dependencies( luacore libluajit_static ) add_dependencies( flight_unstripped libdebug ) # add_dependencies( flight_unstripped flight_register ) diff --git a/flight/Config.cpp b/flight/Config.cpp index b7a68d5..3bd1cfa 100644 --- a/flight/Config.cpp +++ b/flight/Config.cpp @@ -1,17 +1,17 @@ /* * BCFlight * Copyright (C) 2016 Adrien Aubry (drich) - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . **/ @@ -90,7 +90,7 @@ string Config::ReadFile() file.read( buf, length ); buf[length] = 0; ret = buf; - delete buf; + delete [] buf; file.close(); } diff --git a/flight/boards/rpi/board.cmake b/flight/boards/rpi/board.cmake index f461c0c..db1337a 100644 --- a/flight/boards/rpi/board.cmake +++ b/flight/boards/rpi/board.cmake @@ -1,10 +1,10 @@ execute_process( COMMAND uname -p OUTPUT_VARIABLE BUILD_ARCH ) if ( ${BUILD_ARCH} MATCHES "x86*" ) -# message( "Cross compilation detected, setting compiler prefix to arm-linux-gnueabihf-" ) -# set( CMAKE_C_COMPILER "arm-linux-gnueabihf-gcc" ) -# set( CMAKE_CXX_COMPILER "arm-linux-gnueabihf-g++" ) -# set( CMAKE_AR "arm-linux-gnueabihf-ar" ) +# message( "Cross compilation detected, setting compiler prefix to aarch64-linux-gnu-" ) +# set( CMAKE_C_COMPILER "aarch64-linux-gnu-gcc" ) +# set( CMAKE_CXX_COMPILER "aarch64-linux-gnu-g++" ) +# set( CMAKE_AR "aarch64-linux-gnu-ar" ) endif() set( TARGET_LINUX 1 ) @@ -25,8 +25,8 @@ add_definitions( -DHAVE_PTHREAD_SETNAME_NP ) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_DEFAULT_SOURCE -DSTANDALONE -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -DTARGET_POSIX -D_LINUX -fPIC -DPIC -D_REENTRANT -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -U_FORTIFY_SOURCE") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DHAVE_LIBOPENMAX=2 -DOMX -DOMX_SKIP64BIT -ftree-vectorize -pipe -DUSE_EXTERNAL_OMX -DHAVE_LIBBCM_HOST -DUSE_EXTERNAL_LIBBCM_HOST -DUSE_VCHIQ_ARM -Wno-psabi" ) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,--unresolved-symbols=ignore-in-shared-libs -I/opt/vc/include/ -I/opt/vc/include/interface/vmcs_host -I/opt/vc/include/interface/vmcs_host/khronos -I/opt/vc/include/interface/vmcs_host/khronos -I/opt/vc/include/interface/khronos/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux -L/opt/vc/lib/") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_FLAGS} -mfloat-abi=hard -Wl,--unresolved-symbols=ignore-in-shared-libs -I/opt/vc/include/ -I/opt/vc/include/interface/vmcs_host -I/opt/vc/include/interface/vmcs_host/khronos -I/opt/vc/include/interface/vmcs_host/khronos -I/opt/vc/include/interface/khronos/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux -L/opt/vc/lib/ -Wl,-rpath=/opt/vc/lib") -set(CMAKE_LD_FLAGS "${CMAKE_LD_FLAGS} -mfloat-abi=hard -Wl,--unresolved-symbols=ignore-in-shared-libs -L/opt/vc/lib/ -Wl,-rpath=/opt/vc/lib") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_FLAGS} -Wl,--unresolved-symbols=ignore-in-shared-libs -I/opt/vc/include/ -I/opt/vc/include/interface/vmcs_host -I/opt/vc/include/interface/vmcs_host/khronos -I/opt/vc/include/interface/vmcs_host/khronos -I/opt/vc/include/interface/khronos/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux -L/opt/vc/lib/ -Wl,-rpath=/opt/vc/lib") +set(CMAKE_LD_FLAGS "${CMAKE_LD_FLAGS} -Wl,--unresolved-symbols=ignore-in-shared-libs -L/opt/vc/lib/ -Wl,-rpath=/opt/vc/lib") set(CMAKE_LINKER_FLAGS "${CMAKE_LD_FLAGS}") set( BOARD_LIBS ${BOARD_LIBS} -lpigpio -lbcm_host -lvcos -lvchiq_arm -lrt -lpthread -ldl -lz -ldrm ) # -lpigpio # set( BOARD_LIBS ${BOARD_LIBS} -lavformat -lavcodec -lavutil ) @@ -40,10 +40,12 @@ get_filename_component( CROSS_ROOT ${CMAKE_C_COMPILER} DIRECTORY ) include_directories( ${CROSS_ROOT}/../include ) include_directories( ${CROSS_ROOT}/../include/libdrm ) include_directories( ${CROSS_ROOT}/../include/libcamera ) -include_directories( ${CROSS_ROOT}/../arm-linux-gnueabihf/include ) -include_directories( ${CROSS_ROOT}/../arm-linux-gnueabihf/include/libdrm ) -include_directories( ${CROSS_ROOT}/../arm-linux-gnueabihf/include/libcamera ) +include_directories( ${CROSS_ROOT}/../aarch64-linux-gnu/include ) +include_directories( ${CROSS_ROOT}/../aarch64-linux-gnu/include/libdrm ) +include_directories( ${CROSS_ROOT}/../aarch64-linux-gnu/include/libcamera ) include_directories( /opt/vc/include ) +find_package(Lua REQUIRED) +include_directories( ${LUA_INCLUDE_DIR} ) #if ( "${rawwifi}" MATCHES 1 ) set( BOARD_LIBS ${BOARD_LIBS} -liw -lcamera -lcamera-base -lgps ) @@ -62,7 +64,7 @@ endif() function( board_strip ) add_custom_target( flight ALL - COMMAND arm-linux-gnueabihf-strip -s -o flight flight_unstripped + COMMAND aarch64-linux-gnu-strip -s -o flight flight_unstripped DEPENDS flight_unstripped COMMENT "Stripping executable" VERBATIM diff --git a/flight/links/RF24/RF24.h b/flight/links/RF24/RF24.h index 639145f..23528df 100644 --- a/flight/links/RF24/RF24.h +++ b/flight/links/RF24/RF24.h @@ -73,13 +73,13 @@ class RF24 #if defined (RF24_LINUX) || defined (XMEGA_D3) uint8_t spi_rxbuff[32+1] ; //SPI receive buffer (payload max 32 bytes) uint8_t spi_txbuff[32+1] ; //SPI transmit buffer (payload max 32 bytes + 1 byte for the command) -#endif +#endif bool p_variant; /* False for RF24L01 and true for RF24L01P */ uint8_t payload_size; /**< Fixed size of payloads */ bool dynamic_payloads_enabled; /**< Whether dynamic payloads are enabled. */ uint8_t pipe0_reading_address[5]; /**< Last address set on pipe 0 for reading. */ uint8_t addr_width; /**< The address width to use - 3,4 or 5 bytes. */ - + protected: /** @@ -112,7 +112,7 @@ class RF24 */ RF24(uint16_t _cepin, uint16_t _cspin); //#if defined (RF24_LINUX) - + /** * Optional Linux Constructor * @@ -123,7 +123,7 @@ class RF24 * @param _cspin The pin attached to Chip Select * @param spispeed For RPi, the SPI speed in MHZ ie: BCM2835_SPI_SPEED_8MHZ */ - + RF24(uint16_t _cepin, uint16_t _cspin, uint32_t spispeed ); //#endif @@ -133,7 +133,7 @@ class RF24 /** * Begin operation of the chip - * + * * Call this in setup(), before calling any other methods. * @code radio.begin() @endcode */ @@ -142,13 +142,13 @@ class RF24 /** * Start listening on the pipes opened for reading. * - * 1. Be sure to call openReadingPipe() first. + * 1. Be sure to call openReadingPipe() first. * 2. Do not call write() while in this mode, without first calling stopListening(). - * 3. Call available() to check for incoming traffic, and read() to get it. - * + * 3. Call available() to check for incoming traffic, and read() to get it. + * * @code * Open reading pipe 1 using address CCCECCCECC - * + * * byte address[] = { 0xCC,0xCE,0xCC,0xCE,0xCC }; * radio.openReadingPipe(1,address); * radio.startListening(); @@ -263,7 +263,7 @@ s * * @see openWritingPipe * @see setAddressWidth * - * @note Pipes 0 and 1 will store a full 5-byte address. Pipes 2-5 will technically + * @note Pipes 0 and 1 will store a full 5-byte address. Pipes 2-5 will technically * only store a single byte, borrowing up to 4 additional bytes from pipe #1 per the * assigned address width. * @warning Pipes 1-5 should share the same address, except the first byte. @@ -310,10 +310,10 @@ s * /** * Test whether there are bytes available to be read in the - * FIFO buffers. + * FIFO buffers. * * @param[out] pipe_num Which pipe has the payload available - * + * * @code * uint8_t pipeNum; * if(radio.available(&pipeNum)){ @@ -341,7 +341,7 @@ s * * at max PA level. * During active transmission, the radio will consume about 11.5mA, but this will * be reduced to 26uA (.026mA) between sending. - * In full powerDown mode, the radio will consume approximately 900nA (.0009mA) + * In full powerDown mode, the radio will consume approximately 900nA (.0009mA) * * @code * radio.powerDown(); @@ -353,9 +353,9 @@ s * /** * Leave low-power mode - required for normal radio operation after calling powerDown() - * + * * To return to low power mode, call powerDown(). - * @note This will take up to 5ms for maximum compatibility + * @note This will take up to 5ms for maximum compatibility */ void powerUp(void) ; @@ -502,7 +502,7 @@ s * * @warning Only three of these can be pending at any time as there are only 3 FIFO buffers.
Dynamic payloads must be enabled. * @note Ack payloads are handled automatically by the radio chip when a payload is received. Users should generally * write an ack payload as soon as startListening() is called, so one is available when a regular payload is received. - * @note Ack payloads are dynamic payloads. This only works on pipes 0&1 by default. Call + * @note Ack payloads are dynamic payloads. This only works on pipes 0&1 by default. Call * enableDynamicPayloads() to enable on all pipes. * * @param pipe Which pipe# (typically 1-5) will get this response. @@ -581,7 +581,7 @@ s * * */ void startWrite( const void* buf, uint8_t len, const bool multicast ); - + /** * This function is mainly used internally to take advantage of the auto payload * re-use functionality of the chip, but can be beneficial to users as well. @@ -644,7 +644,7 @@ s * * @return true if this is a legitimate radio */ bool isValid() { return ce_pin != 0xff && csn_pin != 0xff; } - + /** * Close a pipe after it has been previously opened. * Can be safely called without having previously opened a pipe. @@ -655,15 +655,15 @@ s * /** * Enable error detection by un-commenting #define FAILURE_HANDLING in RF24_config.h * If a failure has been detected, it usually indicates a hardware issue. By default the library - * will cease operation when a failure is detected. - * This should allow advanced users to detect and resolve intermittent hardware issues. - * + * will cease operation when a failure is detected. + * This should allow advanced users to detect and resolve intermittent hardware issues. + * * In most cases, the radio must be re-enabled via radio.begin(); and the appropriate settings * applied after a failure occurs, if wanting to re-enable the device immediately. - * + * * Usage: (Failure handling must be enabled per above) * @code - * if(radio.failureDetected){ + * if(radio.failureDetected){ * radio.begin(); // Attempt to re-configure the radio with defaults * radio.failureDetected = 0; // Reset the detection value * radio.openWritingPipe(addresses[1]); // Re-configure pipe addresses @@ -673,9 +673,9 @@ s * * @endcode */ //#if defined (FAILURE_HANDLING) - bool failureDetected; + bool failureDetected; //#endif - + /**@}*/ /**@}*/ @@ -695,7 +695,7 @@ s * */ void setAddressWidth(uint8_t a_width); - + /** * Set the number and delay of retries upon failed submit * @@ -711,7 +711,7 @@ s * * @param channel Which RF channel to communicate on, 0-125 */ void setChannel(uint8_t channel); - + /** * Get RF communication channel * @@ -754,7 +754,7 @@ s * * if(radio.available()){ * if(radio.getDynamicPayloadSize() < 1){ * // Corrupt payload has been flushed - * return; + * return; * } * radio.read(&data,sizeof(data)); * } @@ -770,7 +770,7 @@ s * * Ack payloads are a handy way to return data back to senders without * manually changing the radio modes on both units. * - * @note Ack payloads are dynamic payloads. This only works on pipes 0&1 by default. Call + * @note Ack payloads are dynamic payloads. This only works on pipes 0&1 by default. Call * enableDynamicPayloads() to enable on all pipes. */ void enableAckPayload(void); @@ -783,7 +783,7 @@ s * * */ void enableDynamicPayloads(void); - + /** * Disable dynamically-sized payloads * @@ -794,7 +794,7 @@ s * * */ void disableDynamicPayloads(void); - + /** * Enable dynamic ACKs (single write multicast or unicast) for chosen messages * @@ -808,7 +808,7 @@ s * * @endcode */ void enableDynamicAck(); - + /** * Determine whether the hardware is an nRF24L01+ or not. * @@ -896,7 +896,7 @@ s * /** * Disable CRC validation - * + * * @warning CRC cannot be disabled if auto-ack/ESB is enabled. */ void disableCRC( void ) ; @@ -918,11 +918,11 @@ s * * @param rx_ready Mask payload received interrupts */ void maskIRQ(bool tx_ok,bool tx_fail,bool rx_ready); - + /** - * + * * The driver will delay for this duration when stopListening() is called - * + * * When responding to payloads, faster devices like ARM(RPi) are much faster than Arduino: * 1. Arduino sends data to RPi, switches to RX mode * 2. The RPi receives the data, switches to TX mode and sends before the Arduino radio is in RX mode @@ -930,20 +930,20 @@ s * * * @warning If set to 0, ensure 130uS delay after stopListening() and before any sends */ - + uint32_t txDelay; /** - * + * * On all devices but Linux and ATTiny, a small delay is added to the CSN toggling function - * + * * This is intended to minimise the speed of SPI polling due to radio commands * * If using interrupts or timed requests, this can be set to 0 Default:5 */ - + uint32_t csDelay; - + /**@}*/ /** * @name Deprecated @@ -1149,11 +1149,11 @@ s * */ uint8_t spiTrans(uint8_t cmd); - + #if defined (FAILURE_HANDLING) || defined (RF24_LINUX) void errNotify(void); #endif - + /**@}*/ }; @@ -1183,7 +1183,7 @@ s * * back. The ping node can then see how long the whole cycle took.
* @note For a more efficient call-response scenario see the GettingStarted_CallResponse.ino example. */ - + /** * @example GettingStarted_CallResponse.ino * For Arduino
@@ -1195,7 +1195,7 @@ s * * switch out of Primary Receiver mode to send back a payload, but having the option to switch to
* primary transmitter if wanting to initiate communication instead of respond to a commmunication. */ - + /** * @example gettingstarted_call_response.cpp * For Linux
@@ -1215,7 +1215,7 @@ s * * This example demonstrates how to send multiple variables in a single payload and work with data. As usual, it is * generally important to include an incrementing value like millis() in the payloads to prevent errors. */ - + /** * @example Transfer.ino * For Arduino
@@ -1226,7 +1226,7 @@ s * * with the serial monitor and sending a 'T'. The data transfer will begin, * with the receiver displaying the payload count. (32Byte Payloads)
*/ - + /** * @example transfer.cpp * For Linux
@@ -1289,7 +1289,7 @@ s * * Dec 2014 - TMRh20
* This is an example of how to user interrupts to interact with the radio, with bidirectional communication. */ - + /** * @example pingpair_sleepy.ino * Update: TMRh20
@@ -1304,19 +1304,19 @@ s * * New: Contributed by https://github.com/tong67
* This is an example of how to use the RF24 class to communicate with ATtiny85 and other node.
*/ - + /** * @example timingSearch3pin.ino * New: Contributed by https://github.com/tong67
* This is an example of how to determine the correct timing for ATtiny when using only 3-pins */ - + /** * @example pingpair_dyn.ino * * This is an example of how to use payloads of a varying (dynamic) size on Arduino. */ - + /** * @example pingpair_dyn.cpp * @@ -1327,8 +1327,8 @@ s * * @example pingpair_dyn.py * * This is a python example for RPi of how to use payloads of a varying (dynamic) size. - */ - + */ + /** * @example scanner.ino * @@ -1381,8 +1381,8 @@ s * * @li RF24 Class Documentation * @li Download * @li Source Code - * @li My Blog: RF24 Optimization Overview - * @li My Blog: RPi/Linux w/RF24Gateway + * @li My Blog: RF24 Optimization Overview + * @li My Blog: RPi/Linux w/RF24Gateway * @li Chip Datasheet * * **Additional Information and Add-ons** @@ -1403,7 +1403,7 @@ s * * @li Home Automation for Geeks * @li Original Maniacbug RF24Network Blog Post * @li ManiacBug on GitHub (Original Library Author) - * + * * *
* @@ -1434,25 +1434,25 @@ s * * * @li [0] https://learn.sparkfun.com/tutorials/tiny-avr-programmer-hookup-guide/attiny85-use-hints * @li [1] http://highlowtech.org/?p=1695 - * @li [2] http://littlewire.cc/ + * @li [2] http://littlewire.cc/ *


* * * * * @page Arduino Arduino - * + * * RF24 is fully compatible with Arduino boards
* See http://www.arduino.cc/en/Reference/Board and http://arduino.cc/en/Reference/SPI for more information - * + * * RF24 makes use of the standard hardware SPI pins (MISO,MOSI,SCK) and requires two additional pins, to control * the chip-select and chip-enable functions.
- * These pins must be chosen and designated by the user, in RF24 radio(ce_pin,cs_pin); and can use any + * These pins must be chosen and designated by the user, in RF24 radio(ce_pin,cs_pin); and can use any * available pins. - * + * *
* @section ARD_DUE Arduino Due - * + * * RF24 makes use of the extended SPI functionality available on the Arduino Due, and requires one of the * defined hardware SS/CS pins to be designated in RF24 radio(ce_pin,cs_pin);
* See http://arduino.cc/en/Reference/DueExtendedSPI for more information @@ -1463,7 +1463,7 @@ s * * @section Alternate_SPI Alternate SPI Support * * RF24 supports alternate SPI methods, in case the standard hardware SPI pins are otherwise unavailable. - * + * *
* **Software Driven SPI** * @@ -1483,11 +1483,11 @@ s * *
* **Alternate Hardware (UART) Driven SPI** * - * The Serial Port (UART) on Arduino can also function in SPI mode, and can double-buffer data, while the + * The Serial Port (UART) on Arduino can also function in SPI mode, and can double-buffer data, while the * default SPI hardware cannot. * * The SPI_UART library is available at https://github.com/TMRh20/Sketches/tree/master/SPI_UART - * + * * Enabling: * 1. Install the SPI_UART library * 2. Edit RF24_config.h and uncomment #define SPI_UART @@ -1505,12 +1505,12 @@ s * * * @note SPI_UART on Mega boards requires soldering to an unused pin on the chip.
See * https://github.com/TMRh20/RF24/issues/24 for more information on SPI_UART. - * + * * @page ATTiny ATTiny * * ATTiny support is built into the library, so users are not required to include SPI.h in their sketches
* See the included rf24ping85 example for pin info and usage - * + * * Some versions of Arduino IDE may require a patch to allow use of the full program space on ATTiny
* See https://github.com/TCWORLD/ATTinyCore/tree/master/PCREL%20Patch%20for%20GCC for ATTiny patch * @@ -1518,7 +1518,7 @@ s * * * @section Hardware Hardware Configuration * By tong67 ( https://github.com/tong67 ) - * + * * **ATtiny25/45/85 Pin map with CE_PIN 3 and CSN_PIN 4** * @code * +-\/-+ @@ -1526,7 +1526,7 @@ s * * nRF24L01 CE, pin3 --- PB3 2| |7 PB2 --- nRF24L01 SCK, pin5 * nRF24L01 CSN, pin4 --- PB4 3| |6 PB1 --- nRF24L01 MOSI, pin6 * nRF24L01 GND, pin1 --- GND 4| |5 PB0 --- nRF24L01 MISO, pin7 - * +----+ + * +----+ * @endcode * *
@@ -1537,22 +1537,22 @@ s * * This configuration is enabled when CE_PIN and CSN_PIN are equal, e.g. both 3
* Because CE is always high the power consumption is higher than for 5 pins solution
* @code - * ^^ - * +-\/-+ nRF24L01 CE, pin3 ------| // - * PB5 1|o |8 Vcc --- nRF24L01 VCC, pin2 ------x----------x--|<|-- 5V - * NC PB3 2| |7 PB2 --- nRF24L01 SCK, pin5 --|<|---x-[22k]--| LED - * NC PB4 3| |6 PB1 --- nRF24L01 MOSI, pin6 1n4148 | - * nRF24L01 GND, pin1 -x- GND 4| |5 PB0 --- nRF24L01 MISO, pin7 | - * | +----+ | - * |-----------------------------------------------||----x-- nRF24L01 CSN, pin4 - * 10nF + * ^^ + * +-\/-+ nRF24L01 CE, pin3 ------| // + * PB5 1|o |8 Vcc --- nRF24L01 VCC, pin2 ------x----------x--|<|-- 5V + * NC PB3 2| |7 PB2 --- nRF24L01 SCK, pin5 --|<|---x-[22k]--| LED + * NC PB4 3| |6 PB1 --- nRF24L01 MOSI, pin6 1n4148 | + * nRF24L01 GND, pin1 -x- GND 4| |5 PB0 --- nRF24L01 MISO, pin7 | + * | +----+ | + * |-----------------------------------------------||----x-- nRF24L01 CSN, pin4 + * 10nF * @endcode * *
* **ATtiny24/44/84 Pin map with CE_PIN 8 and CSN_PIN 7**
* Schematic provided and successfully tested by Carmine Pastore (https://github.com/Carminepz)
* @code - * +-\/-+ + * +-\/-+ * nRF24L01 VCC, pin2 --- VCC 1|o |14 GND --- nRF24L01 GND, pin1 * PB0 2| |13 AREF * PB1 3| |12 PA1 @@ -1561,12 +1561,12 @@ s * * PA7 6| |9 PA4 --- nRF24L01 SCK, pin5 * nRF24L01 MISO, pin7 --- PA6 7| |8 PA5 --- nRF24L01 MOSI, pin6 * +----+ - * @endcode - * + * @endcode + * *
* **ATtiny2313/4313 Pin map with CE_PIN 12 and CSN_PIN 13**
* @code - * +-\/-+ + * +-\/-+ * PA2 1|o |20 VCC --- nRF24L01 VCC, pin2 * PD0 2| |19 PB7 --- nRF24L01 SCK, pin5 * PD1 3| |18 PB6 --- nRF24L01 MOSI, pin6 @@ -1578,13 +1578,13 @@ s * * PD5 9| |12 PB0 * nRF24L01 GND, pin1 --- GND 10| |11 PD6 * +----+ - * @endcode + * @endcode * *


* * - * - * + * + * * * * @page Linux Linux devices @@ -1594,10 +1594,10 @@ s * * @note The SPIDEV option should work with most Linux systems supporting spi userspace device.
* *
- * @section AutoInstall Automated Install + * @section AutoInstall Automated Install *(**Designed & Tested on RPi** - Defaults to SPIDEV on devices supporting it) * - * + * * 1. Install prerequisites if there are any (MRAA, LittleWire libraries, setup SPI device etc) * 2. Download the install.sh file from http://tmrh20.github.io/RF24Installer/RPi/install.sh * @code wget http://tmrh20.github.io/RF24Installer/RPi/install.sh @endcode @@ -1606,13 +1606,13 @@ s * * 4. Run it and choose your options * @code ./install.sh @endcode * 5. Run an example from one of the libraries - * @code - * cd rf24libs/RF24/examples_linux + * @code + * cd rf24libs/RF24/examples_linux * @endcode * Edit the gettingstarted example, to set your pin configuration * @code nano gettingstarted.cpp - * make - * sudo ./gettingstarted + * make + * sudo ./gettingstarted * @endcode * *
@@ -1621,7 +1621,7 @@ s * * @note See the MRAA documentation for more info on installing MRAA
* 2. Make a directory to contain the RF24 and possibly RF24Network lib and enter it * @code - * mkdir ~/rf24libs + * mkdir ~/rf24libs * cd ~/rf24libs * @endcode * 3. Clone the RF24 repo @@ -1632,18 +1632,18 @@ s * * 6. Build the library, and run an example file * @code sudo make install @endcode * @code - * cd examples_linux + * cd examples_linux * @endcode * Edit the gettingstarted example, to set your pin configuration - * @code nano gettingstarted.cpp - * make + * @code nano gettingstarted.cpp + * make * sudo ./gettingstarted * @endcode * *

- * + * * @page MRAA MRAA - * + * * MRAA is a Low Level Skeleton Library for Communication on GNU/Linux platforms
* See http://iotdk.intel.com/docs/master/mraa/index.html for more information * @@ -1654,11 +1654,11 @@ s * * 1. Install the MRAA lib * 2. As per your device, SPI may need to be enabled * 3. Follow Linux installation steps to install RF24 libraries - * + * * *


* - * + * * * * @page RPi Raspberry Pi @@ -1675,7 +1675,7 @@ s * * B. Select **Advanced** and **enable the SPI kernel module**
* C. Update other software and libraries * @code sudo apt-get update @endcode - * @code sudo apt-get upgrade @endcode + * @code sudo apt-get upgrade @endcode *

* * @section Build Build Options @@ -1697,7 +1697,7 @@ s * * * 2. Complete the install
* @code nano /etc/ld.so.conf @endcode - * Add the line @code /usr/local/lib/arm-linux-gnueabihf @endcode + * Add the line @code /usr/local/lib/aarch64-linux-gnu @endcode * Run @code sudo ldconfig @endcode * * 3. Install RF24, using MRAA @@ -1731,7 +1731,7 @@ s * * RF24 radio(RPI_V2_GPIO_P1_15,BCM2835_SPI_CS0, BCM2835_SPI_SPEED_8MHZ); * or * RF24 radio(RPI_V2_GPIO_P1_15,BCM2835_SPI_CS1, BCM2835_SPI_SPEED_8MHZ); - * + * * RPi B+: * RF24 radio(RPI_BPLUS_GPIO_J8_15,RPI_BPLUS_GPIO_J8_24, BCM2835_SPI_SPEED_8MHZ); * or @@ -1760,7 +1760,7 @@ s * * * See http://pi.gadgetoid.com/pinout * - * **Pins:** + * **Pins:** * * | PIN | NRF24L01 | RPI | RPi -P1 Connector | * |-----|----------|------------|-------------------| @@ -1772,35 +1772,35 @@ s * * | 6 | MOSI | rpi-mosi | (19) | * | 7 | MISO | rpi-miso | (21) | * | 8 | IRQ | - | - | - * - * - * - * + * + * + * + * *

**************** - * + * * Based on the arduino lib from J. Coliz
- * the library was berryfied by Purinda Gunasekara
+ * the library was berryfied by Purinda Gunasekara
* then forked from github stanleyseow/RF24 to https://github.com/jscrane/RF24-rpi
* Network lib also based on https://github.com/farconada/RF24Network * - * * - * + * + * *


- * * - * + * + * * @page Python Python Wrapper (by https://github.com/mz-fuzzy) * * @note Both python2 and python3 are supported. * - * @section Install Installation: + * @section Install Installation: * * 1. Install the python-dev (or python3-dev) and boost libraries * @code sudo apt-get install python-dev libboost-python-dev @endcode * @note For python3 in Raspbian, it's needed to manually link python boost library, like this: - * @code sudo ln -s /usr/lib/arm-linux-gnueabihf/libboost_python-py34.so /usr/lib/arm-linux-gnueabihf/libboost_python3.so @endcode + * @code sudo ln -s /usr/lib/aarch64-linux-gnu/libboost_python-py34.so /usr/lib/aarch64-linux-gnu/libboost_python3.so @endcode * * 2. Install python-setuptools (or python3-setuptools) * @code sudo apt-get install python-setuptools @endcode @@ -1812,19 +1812,19 @@ s * * 4. Install the library * @code sudo ./setup.py install @endcode * See the additional Platform Support pages for information on connecting your hardware
- * See the included example for usage information. - * + * See the included example for usage information. + * * 5. Running the Example - * Edit the pingpair_dyn.py example to configure the appropriate pins per the above documentation: + * Edit the pingpair_dyn.py example to configure the appropriate pins per the above documentation: * @code nano pingpair_dyn.py @endcode * Configure another device, Arduino or RPi with the pingpair_dyn example
- * Run the example + * Run the example * @code sudo ./pingpair_dyn.py @endcode * *


* * @page CrossCompile Linux cross-compilation - * + * * RF24 library supports cross-compilation. Advantages of cross-compilation: * - development tools don't have to be installed on target machine * - resources of target machine don't have to be sufficient for compilation @@ -1836,7 +1836,7 @@ s * * - cross-compilation toolchain for your target machine; for RPi * @code git clone https://github.com/raspberrypi/tools rpi_tools @endcode * and cross-compilation tools must be in PATH, for example - * @code export PATH=$PATH:/your/dir/rpi-tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin @endcode + * @code export PATH=$PATH:/your/dir/rpi-tools/arm-bcm2708/gcc-linaro-aarch64-linux-gnu-raspbian-x64/bin @endcode * * @section CxSteps Cross compilation steps: * 1. clone RF24 to a machine for cross-compilation @@ -1897,16 +1897,16 @@ s * *


* * @page ATXMEGA ATXMEGA - * + * * The RF24 driver can be build as a static library with Atmel Studio 7 in order to be included as any other library in another program for the XMEGA family. * * Currently only the ATXMEGA D3 family is implemented. - * - * @section Preparation - * + * + * @section Preparation + * * Create an empty GCC Static Library project in AS7.
* As not all files are required, copy the following directory structure in the project: - * + * * @code * utility\ * ATXMegaD3\ @@ -1926,38 +1926,38 @@ s * * RF24.h * RF24_config.h * @endcode - * + * * @section Usage - * + * * Add the library to your project!
* In the file where the **main()** is put the following in order to update the millisecond functionality: - * + * * @code * ISR(TCE0_OVF_vect) * { * update_milisec(); * } * @endcode - * + * * Declare the rf24 radio with **RF24 radio(XMEGA_PORTC_PIN3, XMEGA_SPI_PORT_C);** - * + * * First parameter is the CE pin which can be any available pin on the uC. - * - * Second parameter is the CS which can be on port C (**XMEGA_SPI_PORT_C**) or on port D (**XMEGA_SPI_PORT_D**). - * + * + * Second parameter is the CS which can be on port C (**XMEGA_SPI_PORT_C**) or on port D (**XMEGA_SPI_PORT_D**). + * * Call the **__start_timer()** to start the millisecond timer. - * + * * @note Note about the millisecond functionality:
- * + * * The millisecond functionality is based on the TCE0 so don't use these pins as IO.
- * The operating frequency of the uC is 32MHz. If you have other frequency change the TCE0 registers appropriatly in function **__start_timer()** in **compatibility.c** file for your frequency. + * The operating frequency of the uC is 32MHz. If you have other frequency change the TCE0 registers appropriatly in function **__start_timer()** in **compatibility.c** file for your frequency. * * @page Portability RF24 Portability * * The RF24 radio driver mainly utilizes the Arduino API for GPIO, SPI, and timing functions, which are easily replicated - * on various platforms.
Support files for these platforms are stored under RF24/utility, and can be modified to provide + * on various platforms.
Support files for these platforms are stored under RF24/utility, and can be modified to provide * the required functionality. - * + * *
* @section Hardware_Templates Basic Hardware Template * @@ -1966,18 +1966,18 @@ s * * The RF24 library now includes a basic hardware template to assist in porting to various platforms.
The following files can be included * to replicate standard Arduino functions as needed, allowing devices from ATTiny to Raspberry Pi to utilize the same core RF24 driver. * - * | File | Purpose | - * |--------------------|------------------------------------------------------------------------------| - * | RF24_arch_config.h | Basic Arduino/AVR compatibility, includes for remaining support files, etc | - * | includes.h | Linux only. Defines specific platform, include correct RF24_arch_config file | - * | spi.h | Provides standardized SPI ( transfer() ) methods | - * | gpio.h | Provides standardized GPIO ( digitalWrite() ) methods | - * | compatibility.h | Provides standardized timing (millis(), delay()) methods | - * | your_custom_file.h | Provides access to custom drivers for spi,gpio, etc | + * | File | Purpose | + * |--------------------|------------------------------------------------------------------------------| + * | RF24_arch_config.h | Basic Arduino/AVR compatibility, includes for remaining support files, etc | + * | includes.h | Linux only. Defines specific platform, include correct RF24_arch_config file | + * | spi.h | Provides standardized SPI ( transfer() ) methods | + * | gpio.h | Provides standardized GPIO ( digitalWrite() ) methods | + * | compatibility.h | Provides standardized timing (millis(), delay()) methods | + * | your_custom_file.h | Provides access to custom drivers for spi,gpio, etc | * *
* Examples are provided via the included hardware support templates in **RF24/utility**
- * See the modules page for examples of class declarations + * See the modules page for examples of class declarations * *
* @section Device_Detection Device Detection @@ -1989,7 +1989,7 @@ s * *
* @section Ported_Code Code * To have your ported code included in this library, or for assistance in porting, create a pull request or open an issue at https://github.com/TMRh20/RF24 - * + * * *


*/ diff --git a/flight/links/RF24/utility/spi.cpp b/flight/links/RF24/utility/spi.cpp index 375aca8..5f07a7a 100644 --- a/flight/links/RF24/utility/spi.cpp +++ b/flight/links/RF24/utility/spi.cpp @@ -138,5 +138,5 @@ void nRF24::SPI::transfern(char* buf, uint32_t len) char* rbuf = new char[len]; mSPI->Transfer( buf, rbuf, len ); memcpy( buf, rbuf, len ); - delete rbuf; + delete [] rbuf; } diff --git a/flight/valgrind.suppress b/flight/valgrind.suppress index 0eb5a26..7b020b9 100644 --- a/flight/valgrind.suppress +++ b/flight/valgrind.suppress @@ -1,12 +1,12 @@ { Memcheck:Addr8 -obj:/usr/lib/arm-linux-gnueabihf/libarmmem-v7l.so +obj:/usr/lib/aarch64-linux-gnu/libarmmem-v7l.so } { Memcheck:Cond -obj:/usr/lib/arm-linux-gnueabihf/libarmmem-v7l.so +obj:/usr/lib/aarch64-linux-gnu/libarmmem-v7l.so } { bcm_host diff --git a/flight/video/AvcodecEncoder.h b/flight/video/AvcodecEncoder.h index 70be0f5..18d4d3f 100644 --- a/flight/video/AvcodecEncoder.h +++ b/flight/video/AvcodecEncoder.h @@ -30,7 +30,7 @@ LUA_CLASS class AvcodecEncoder : public VideoEncoder LUA_PROPERTY("framerate") int32_t mFramerate; bool mReady; - AVCodec* mCodec; + const AVCodec* mCodec; AVCodecContext* mCodecContext; }; diff --git a/flight/video/LinuxCamera.cpp b/flight/video/LinuxCamera.cpp index c57ea96..a6730db 100644 --- a/flight/video/LinuxCamera.cpp +++ b/flight/video/LinuxCamera.cpp @@ -15,7 +15,7 @@ std::unique_ptr LinuxCamera::sCameraManager = nullptr; class LibCameraStream : private std::streambuf, public std::ostream { public: LibCameraStream() : std::ostream(this) {} - + private: int overflow( int c ) override { @@ -176,8 +176,8 @@ LuaValue LinuxCamera::infos() ret["Framerate"] = mFps; ret["HDR"] = ( mHDR ? "on" : "off" ); - if ( mCamera->controls().find( libcamera::controls::MAX_LATENCY) != mCamera->controls().end() ) { - ret["Max Latency"] = mCamera->controls().at( libcamera::controls::MAX_LATENCY ).toString(); + if ( mCamera->controls().find( libcamera::controls::draft::MAX_LATENCY) != mCamera->controls().end() ) { + ret["Max Latency"] = mCamera->controls().at( libcamera::controls::draft::MAX_LATENCY ).toString(); } return ret; @@ -246,7 +246,7 @@ void LinuxCamera::Start() // TODO } - mCameraConfiguration->transform = ( mHflip ? libcamera::Transform::HFlip : libcamera::Transform::Identity ) | ( mVflip ? libcamera::Transform::VFlip : libcamera::Transform::Identity ); + // mCameraConfiguration->transform = ( mHflip ? libcamera::Transform::HFlip : libcamera::Transform::Identity ) | ( mVflip ? libcamera::Transform::VFlip : libcamera::Transform::Identity ); mCameraConfiguration->validate(); if ( mRawStreamConfiguration ) { @@ -280,7 +280,7 @@ void LinuxCamera::Start() mAllControls.set( libcamera::controls::Contrast, mContrast ); mAllControls.set( libcamera::controls::Saturation, mSaturation ); mAllControls.set( libcamera::controls::AfMode, libcamera::controls::AfModeAuto ); // AfModeContinuous - mAllControls.set( libcamera::controls::draft::SceneFlicker, libcamera::controls::draft::SceneFickerOff ); + // mAllControls.set( libcamera::controls::draft::SceneFlicker, libcamera::controls::draft::SceneFickerOff ); // mAllControls.set( libcamera::controls::AeMeteringMode, libcamera::controls::MeteringMatrix ); mAllControls.set( libcamera::controls::AeMeteringMode, libcamera::controls::MeteringSpot ); mAllControls.set( libcamera::controls::draft::NoiseReductionMode, libcamera::controls::draft::NoiseReductionModeEnum::NoiseReductionModeFast ); diff --git a/flight/video/RecorderAvformat.cpp b/flight/video/RecorderAvformat.cpp index c3fcf18..a8954f4 100644 --- a/flight/video/RecorderAvformat.cpp +++ b/flight/video/RecorderAvformat.cpp @@ -116,7 +116,7 @@ bool RecorderAvformat::run() mPendingGyros.pop_front(); mGyroMutex.unlock(); // fprintf( mGyroFile, "%llu,%.6f,%.6f,%.6f,%.6f,%.6f,%.6f\n", gyro->t, gyro->gx, gyro->gy, gyro->gz, gyro->ax, gyro->ay, gyro->az ); - fprintf( mGyroFile, "%llu,%.6f,%.6f,%.6f\n", gyro->t, gyro->gx, gyro->gy, gyro->gz ); + fprintf( mGyroFile, "%" PRIu64 ",%.6f,%.6f,%.6f\n", gyro->t, gyro->gx, gyro->gy, gyro->gz ); mGyroMutex.lock(); } mGyroMutex.unlock(); @@ -331,7 +331,7 @@ void RecorderAvformat::Stop() mPendingGyros.pop_front(); mGyroMutex.unlock(); // fprintf( mGyroFile, "%llu,%.6f,%.6f,%.6f,%.6f,%.6f,%.6f\n", gyro->t, gyro->gx, gyro->gy, gyro->gz, gyro->ax, gyro->ay, gyro->az ); - fprintf( mGyroFile, "%llu,%.6f,%.6f,%.6f\n", gyro->t, gyro->gx, gyro->gy, gyro->gz ); + fprintf( mGyroFile, "%" PRIu64 ",%.6f,%.6f,%.6f\n", gyro->t, gyro->gx, gyro->gy, gyro->gz ); mGyroMutex.lock(); } mGyroMutex.unlock(); @@ -458,4 +458,3 @@ void RecorderAvformat::WriteGyro( uint64_t record_time_us, const Vector3f& gyro, mPendingGyros.emplace_back( g ); mGyroMutex.unlock(); } - diff --git a/flight/video/RecorderBasic.cpp b/flight/video/RecorderBasic.cpp index 9cfd218..9753897 100644 --- a/flight/video/RecorderBasic.cpp +++ b/flight/video/RecorderBasic.cpp @@ -215,7 +215,7 @@ bool RecorderBasic::run() if ( fwrite( sample->buf, 1, sample->buflen, sample->track->file ) != sample->buflen ) { goto err; } - if ( fprintf( mRecordFile, "%u,%llu,%u,%u\n", sample->track->id, sample->record_time_us, pos, sample->buflen ) <= 0 ) { + if ( fprintf( mRecordFile, "%u,%" PRIu64 ",%u,%u\n", sample->track->id, sample->record_time_us, pos, sample->buflen ) <= 0 ) { goto err; } diff --git a/libcontroller/CMakeLists.txt b/libcontroller/CMakeLists.txt index 99f5cf6..838e8dc 100644 --- a/libcontroller/CMakeLists.txt +++ b/libcontroller/CMakeLists.txt @@ -2,6 +2,8 @@ cmake_minimum_required( VERSION 3.5 ) set( CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules" ) project( controller ) +add_compile_options(-Wall -Werror) + if ( NOT RAWWIFI_ON ) SET( RAWWIFI_ON 1 CACHE INTERNAL "RAWWIFI_ON" ) endif() @@ -39,11 +41,6 @@ if ( RAWWIFI_ON MATCHES 1 ) include_directories( ../librawwifi++ ) endif() -if ( "${CMAKE_SYSTEM_NAME}" MATCHES "Linux" ) - include_directories( ${CMAKE_SOURCE_DIR}/../external/LuaJIT-2.0.4/src ) -elseif( "${CMAKE_SYSTEM_NAME}" MATCHES "Generic" ) - include_directories( ${CMAKE_SOURCE_DIR}/../external/liblua ) -endif() include_directories( ${CMAKE_SOURCE_DIR}/../libluacore/src ) add_library( controllerbase STATIC @@ -68,4 +65,6 @@ else() # target_link_libraries( controllerbase -lz -liw ) endif() +target_link_libraries( controllerbase PRIVATE luacore ) + target_link_libraries( controller controllerbase ) diff --git a/libcontroller/links/RF24/RF24.h b/libcontroller/links/RF24/RF24.h index 51a9179..5ac39c7 100644 --- a/libcontroller/links/RF24/RF24.h +++ b/libcontroller/links/RF24/RF24.h @@ -70,17 +70,17 @@ class RF24 #if defined (RF24_LINUX) || defined (XMEGA_D3) uint8_t spi_rxbuff[32+1] ; //SPI receive buffer (payload max 32 bytes) uint8_t spi_txbuff[32+1] ; //SPI transmit buffer (payload max 32 bytes + 1 byte for the command) -#endif +#endif bool p_variant; /* False for RF24L01 and true for RF24L01P */ uint8_t payload_size; /**< Fixed size of payloads */ bool dynamic_payloads_enabled; /**< Whether dynamic payloads are enabled. */ uint8_t pipe0_reading_address[5]; /**< Last address set on pipe 0 for reading. */ uint8_t addr_width; /**< The address width to use - 3,4 or 5 bytes. */ - - + + std::function digitalWrite; std::function pinMode; - + protected: /** @@ -118,7 +118,7 @@ class RF24 */ RF24(uint16_t _cepin, uint16_t _cspin); //#if defined (RF24_LINUX) - + /** * Optional Linux Constructor * @@ -129,7 +129,7 @@ class RF24 * @param _cspin The pin attached to Chip Select * @param spispeed For RPi, the SPI speed in MHZ ie: BCM2835_SPI_SPEED_8MHZ */ - + RF24(uint16_t _cepin, uint16_t _cspin, uint32_t spispeed ); //#endif @@ -139,7 +139,7 @@ class RF24 /** * Begin operation of the chip - * + * * Call this in setup(), before calling any other methods. * @code radio.begin() @endcode */ @@ -148,13 +148,13 @@ class RF24 /** * Start listening on the pipes opened for reading. * - * 1. Be sure to call openReadingPipe() first. + * 1. Be sure to call openReadingPipe() first. * 2. Do not call write() while in this mode, without first calling stopListening(). - * 3. Call available() to check for incoming traffic, and read() to get it. - * + * 3. Call available() to check for incoming traffic, and read() to get it. + * * @code * Open reading pipe 1 using address CCCECCCECC - * + * * byte address[] = { 0xCC,0xCE,0xCC,0xCE,0xCC }; * radio.openReadingPipe(1,address); * radio.startListening(); @@ -269,7 +269,7 @@ s * * @see openWritingPipe * @see setAddressWidth * - * @note Pipes 0 and 1 will store a full 5-byte address. Pipes 2-5 will technically + * @note Pipes 0 and 1 will store a full 5-byte address. Pipes 2-5 will technically * only store a single byte, borrowing up to 4 additional bytes from pipe #1 per the * assigned address width. * @warning Pipes 1-5 should share the same address, except the first byte. @@ -316,10 +316,10 @@ s * /** * Test whether there are bytes available to be read in the - * FIFO buffers. + * FIFO buffers. * * @param[out] pipe_num Which pipe has the payload available - * + * * @code * uint8_t pipeNum; * if(radio.available(&pipeNum)){ @@ -347,7 +347,7 @@ s * * at max PA level. * During active transmission, the radio will consume about 11.5mA, but this will * be reduced to 26uA (.026mA) between sending. - * In full powerDown mode, the radio will consume approximately 900nA (.0009mA) + * In full powerDown mode, the radio will consume approximately 900nA (.0009mA) * * @code * radio.powerDown(); @@ -359,9 +359,9 @@ s * /** * Leave low-power mode - required for normal radio operation after calling powerDown() - * + * * To return to low power mode, call powerDown(). - * @note This will take up to 5ms for maximum compatibility + * @note This will take up to 5ms for maximum compatibility */ void powerUp(void) ; @@ -508,7 +508,7 @@ s * * @warning Only three of these can be pending at any time as there are only 3 FIFO buffers.
Dynamic payloads must be enabled. * @note Ack payloads are handled automatically by the radio chip when a payload is received. Users should generally * write an ack payload as soon as startListening() is called, so one is available when a regular payload is received. - * @note Ack payloads are dynamic payloads. This only works on pipes 0&1 by default. Call + * @note Ack payloads are dynamic payloads. This only works on pipes 0&1 by default. Call * enableDynamicPayloads() to enable on all pipes. * * @param pipe Which pipe# (typically 1-5) will get this response. @@ -587,7 +587,7 @@ s * * */ void startWrite( const void* buf, uint8_t len, const bool multicast ); - + /** * This function is mainly used internally to take advantage of the auto payload * re-use functionality of the chip, but can be beneficial to users as well. @@ -650,7 +650,7 @@ s * * @return true if this is a legitimate radio */ bool isValid() { return ce_pin != 0xff && csn_pin != 0xff; } - + /** * Close a pipe after it has been previously opened. * Can be safely called without having previously opened a pipe. @@ -661,15 +661,15 @@ s * /** * Enable error detection by un-commenting #define FAILURE_HANDLING in RF24_config.h * If a failure has been detected, it usually indicates a hardware issue. By default the library - * will cease operation when a failure is detected. - * This should allow advanced users to detect and resolve intermittent hardware issues. - * + * will cease operation when a failure is detected. + * This should allow advanced users to detect and resolve intermittent hardware issues. + * * In most cases, the radio must be re-enabled via radio.begin(); and the appropriate settings * applied after a failure occurs, if wanting to re-enable the device immediately. - * + * * Usage: (Failure handling must be enabled per above) * @code - * if(radio.failureDetected){ + * if(radio.failureDetected){ * radio.begin(); // Attempt to re-configure the radio with defaults * radio.failureDetected = 0; // Reset the detection value * radio.openWritingPipe(addresses[1]); // Re-configure pipe addresses @@ -679,9 +679,9 @@ s * * @endcode */ //#if defined (FAILURE_HANDLING) - bool failureDetected; + bool failureDetected; //#endif - + /**@}*/ /**@}*/ @@ -701,7 +701,7 @@ s * */ void setAddressWidth(uint8_t a_width); - + /** * Set the number and delay of retries upon failed submit * @@ -717,7 +717,7 @@ s * * @param channel Which RF channel to communicate on, 0-125 */ void setChannel(uint8_t channel); - + /** * Get RF communication channel * @@ -760,7 +760,7 @@ s * * if(radio.available()){ * if(radio.getDynamicPayloadSize() < 1){ * // Corrupt payload has been flushed - * return; + * return; * } * radio.read(&data,sizeof(data)); * } @@ -776,7 +776,7 @@ s * * Ack payloads are a handy way to return data back to senders without * manually changing the radio modes on both units. * - * @note Ack payloads are dynamic payloads. This only works on pipes 0&1 by default. Call + * @note Ack payloads are dynamic payloads. This only works on pipes 0&1 by default. Call * enableDynamicPayloads() to enable on all pipes. */ void enableAckPayload(void); @@ -789,7 +789,7 @@ s * * */ void enableDynamicPayloads(void); - + /** * Disable dynamically-sized payloads * @@ -800,7 +800,7 @@ s * * */ void disableDynamicPayloads(void); - + /** * Enable dynamic ACKs (single write multicast or unicast) for chosen messages * @@ -814,7 +814,7 @@ s * * @endcode */ void enableDynamicAck(); - + /** * Determine whether the hardware is an nRF24L01+ or not. * @@ -902,7 +902,7 @@ s * /** * Disable CRC validation - * + * * @warning CRC cannot be disabled if auto-ack/ESB is enabled. */ void disableCRC( void ) ; @@ -924,11 +924,11 @@ s * * @param rx_ready Mask payload received interrupts */ void maskIRQ(bool tx_ok,bool tx_fail,bool rx_ready); - + /** - * + * * The driver will delay for this duration when stopListening() is called - * + * * When responding to payloads, faster devices like ARM(RPi) are much faster than Arduino: * 1. Arduino sends data to RPi, switches to RX mode * 2. The RPi receives the data, switches to TX mode and sends before the Arduino radio is in RX mode @@ -936,20 +936,20 @@ s * * * @warning If set to 0, ensure 130uS delay after stopListening() and before any sends */ - + uint32_t txDelay; /** - * + * * On all devices but Linux and ATTiny, a small delay is added to the CSN toggling function - * + * * This is intended to minimise the speed of SPI polling due to radio commands * * If using interrupts or timed requests, this can be set to 0 Default:5 */ - + uint32_t csDelay; - + /**@}*/ /** * @name Deprecated @@ -1155,11 +1155,11 @@ s * */ uint8_t spiTrans(uint8_t cmd); - + #if defined (FAILURE_HANDLING) || defined (RF24_LINUX) void errNotify(void); #endif - + /**@}*/ }; @@ -1189,7 +1189,7 @@ s * * back. The ping node can then see how long the whole cycle took.
* @note For a more efficient call-response scenario see the GettingStarted_CallResponse.ino example. */ - + /** * @example GettingStarted_CallResponse.ino * For Arduino
@@ -1201,7 +1201,7 @@ s * * switch out of Primary Receiver mode to send back a payload, but having the option to switch to
* primary transmitter if wanting to initiate communication instead of respond to a commmunication. */ - + /** * @example gettingstarted_call_response.cpp * For Linux
@@ -1221,7 +1221,7 @@ s * * This example demonstrates how to send multiple variables in a single payload and work with data. As usual, it is * generally important to include an incrementing value like millis() in the payloads to prevent errors. */ - + /** * @example Transfer.ino * For Arduino
@@ -1232,7 +1232,7 @@ s * * with the serial monitor and sending a 'T'. The data transfer will begin, * with the receiver displaying the payload count. (32Byte Payloads)
*/ - + /** * @example transfer.cpp * For Linux
@@ -1295,7 +1295,7 @@ s * * Dec 2014 - TMRh20
* This is an example of how to user interrupts to interact with the radio, with bidirectional communication. */ - + /** * @example pingpair_sleepy.ino * Update: TMRh20
@@ -1310,19 +1310,19 @@ s * * New: Contributed by https://github.com/tong67
* This is an example of how to use the RF24 class to communicate with ATtiny85 and other node.
*/ - + /** * @example timingSearch3pin.ino * New: Contributed by https://github.com/tong67
* This is an example of how to determine the correct timing for ATtiny when using only 3-pins */ - + /** * @example pingpair_dyn.ino * * This is an example of how to use payloads of a varying (dynamic) size on Arduino. */ - + /** * @example pingpair_dyn.cpp * @@ -1333,8 +1333,8 @@ s * * @example pingpair_dyn.py * * This is a python example for RPi of how to use payloads of a varying (dynamic) size. - */ - + */ + /** * @example scanner.ino * @@ -1387,8 +1387,8 @@ s * * @li RF24 Class Documentation * @li Download * @li Source Code - * @li My Blog: RF24 Optimization Overview - * @li My Blog: RPi/Linux w/RF24Gateway + * @li My Blog: RF24 Optimization Overview + * @li My Blog: RPi/Linux w/RF24Gateway * @li Chip Datasheet * * **Additional Information and Add-ons** @@ -1409,7 +1409,7 @@ s * * @li Home Automation for Geeks * @li Original Maniacbug RF24Network Blog Post * @li ManiacBug on GitHub (Original Library Author) - * + * * *
* @@ -1440,25 +1440,25 @@ s * * * @li [0] https://learn.sparkfun.com/tutorials/tiny-avr-programmer-hookup-guide/attiny85-use-hints * @li [1] http://highlowtech.org/?p=1695 - * @li [2] http://littlewire.cc/ + * @li [2] http://littlewire.cc/ *


* * * * * @page Arduino Arduino - * + * * RF24 is fully compatible with Arduino boards
* See http://www.arduino.cc/en/Reference/Board and http://arduino.cc/en/Reference/SPI for more information - * + * * RF24 makes use of the standard hardware SPI pins (MISO,MOSI,SCK) and requires two additional pins, to control * the chip-select and chip-enable functions.
- * These pins must be chosen and designated by the user, in RF24 radio(ce_pin,cs_pin); and can use any + * These pins must be chosen and designated by the user, in RF24 radio(ce_pin,cs_pin); and can use any * available pins. - * + * *
* @section ARD_DUE Arduino Due - * + * * RF24 makes use of the extended SPI functionality available on the Arduino Due, and requires one of the * defined hardware SS/CS pins to be designated in RF24 radio(ce_pin,cs_pin);
* See http://arduino.cc/en/Reference/DueExtendedSPI for more information @@ -1469,7 +1469,7 @@ s * * @section Alternate_SPI Alternate SPI Support * * RF24 supports alternate SPI methods, in case the standard hardware SPI pins are otherwise unavailable. - * + * *
* **Software Driven SPI** * @@ -1489,11 +1489,11 @@ s * *
* **Alternate Hardware (UART) Driven SPI** * - * The Serial Port (UART) on Arduino can also function in SPI mode, and can double-buffer data, while the + * The Serial Port (UART) on Arduino can also function in SPI mode, and can double-buffer data, while the * default SPI hardware cannot. * * The SPI_UART library is available at https://github.com/TMRh20/Sketches/tree/master/SPI_UART - * + * * Enabling: * 1. Install the SPI_UART library * 2. Edit RF24_config.h and uncomment #define SPI_UART @@ -1511,12 +1511,12 @@ s * * * @note SPI_UART on Mega boards requires soldering to an unused pin on the chip.
See * https://github.com/TMRh20/RF24/issues/24 for more information on SPI_UART. - * + * * @page ATTiny ATTiny * * ATTiny support is built into the library, so users are not required to include SPI.h in their sketches
* See the included rf24ping85 example for pin info and usage - * + * * Some versions of Arduino IDE may require a patch to allow use of the full program space on ATTiny
* See https://github.com/TCWORLD/ATTinyCore/tree/master/PCREL%20Patch%20for%20GCC for ATTiny patch * @@ -1524,7 +1524,7 @@ s * * * @section Hardware Hardware Configuration * By tong67 ( https://github.com/tong67 ) - * + * * **ATtiny25/45/85 Pin map with CE_PIN 3 and CSN_PIN 4** * @code * +-\/-+ @@ -1532,7 +1532,7 @@ s * * nRF24L01 CE, pin3 --- PB3 2| |7 PB2 --- nRF24L01 SCK, pin5 * nRF24L01 CSN, pin4 --- PB4 3| |6 PB1 --- nRF24L01 MOSI, pin6 * nRF24L01 GND, pin1 --- GND 4| |5 PB0 --- nRF24L01 MISO, pin7 - * +----+ + * +----+ * @endcode * *
@@ -1543,22 +1543,22 @@ s * * This configuration is enabled when CE_PIN and CSN_PIN are equal, e.g. both 3
* Because CE is always high the power consumption is higher than for 5 pins solution
* @code - * ^^ - * +-\/-+ nRF24L01 CE, pin3 ------| // - * PB5 1|o |8 Vcc --- nRF24L01 VCC, pin2 ------x----------x--|<|-- 5V - * NC PB3 2| |7 PB2 --- nRF24L01 SCK, pin5 --|<|---x-[22k]--| LED - * NC PB4 3| |6 PB1 --- nRF24L01 MOSI, pin6 1n4148 | - * nRF24L01 GND, pin1 -x- GND 4| |5 PB0 --- nRF24L01 MISO, pin7 | - * | +----+ | - * |-----------------------------------------------||----x-- nRF24L01 CSN, pin4 - * 10nF + * ^^ + * +-\/-+ nRF24L01 CE, pin3 ------| // + * PB5 1|o |8 Vcc --- nRF24L01 VCC, pin2 ------x----------x--|<|-- 5V + * NC PB3 2| |7 PB2 --- nRF24L01 SCK, pin5 --|<|---x-[22k]--| LED + * NC PB4 3| |6 PB1 --- nRF24L01 MOSI, pin6 1n4148 | + * nRF24L01 GND, pin1 -x- GND 4| |5 PB0 --- nRF24L01 MISO, pin7 | + * | +----+ | + * |-----------------------------------------------||----x-- nRF24L01 CSN, pin4 + * 10nF * @endcode * *
* **ATtiny24/44/84 Pin map with CE_PIN 8 and CSN_PIN 7**
* Schematic provided and successfully tested by Carmine Pastore (https://github.com/Carminepz)
* @code - * +-\/-+ + * +-\/-+ * nRF24L01 VCC, pin2 --- VCC 1|o |14 GND --- nRF24L01 GND, pin1 * PB0 2| |13 AREF * PB1 3| |12 PA1 @@ -1567,12 +1567,12 @@ s * * PA7 6| |9 PA4 --- nRF24L01 SCK, pin5 * nRF24L01 MISO, pin7 --- PA6 7| |8 PA5 --- nRF24L01 MOSI, pin6 * +----+ - * @endcode - * + * @endcode + * *
* **ATtiny2313/4313 Pin map with CE_PIN 12 and CSN_PIN 13**
* @code - * +-\/-+ + * +-\/-+ * PA2 1|o |20 VCC --- nRF24L01 VCC, pin2 * PD0 2| |19 PB7 --- nRF24L01 SCK, pin5 * PD1 3| |18 PB6 --- nRF24L01 MOSI, pin6 @@ -1584,13 +1584,13 @@ s * * PD5 9| |12 PB0 * nRF24L01 GND, pin1 --- GND 10| |11 PD6 * +----+ - * @endcode + * @endcode * *


* * - * - * + * + * * * * @page Linux Linux devices @@ -1600,10 +1600,10 @@ s * * @note The SPIDEV option should work with most Linux systems supporting spi userspace device.
* *
- * @section AutoInstall Automated Install + * @section AutoInstall Automated Install *(**Designed & Tested on RPi** - Defaults to SPIDEV on devices supporting it) * - * + * * 1. Install prerequisites if there are any (MRAA, LittleWire libraries, setup SPI device etc) * 2. Download the install.sh file from http://tmrh20.github.io/RF24Installer/RPi/install.sh * @code wget http://tmrh20.github.io/RF24Installer/RPi/install.sh @endcode @@ -1612,13 +1612,13 @@ s * * 4. Run it and choose your options * @code ./install.sh @endcode * 5. Run an example from one of the libraries - * @code - * cd rf24libs/RF24/examples_linux + * @code + * cd rf24libs/RF24/examples_linux * @endcode * Edit the gettingstarted example, to set your pin configuration * @code nano gettingstarted.cpp - * make - * sudo ./gettingstarted + * make + * sudo ./gettingstarted * @endcode * *
@@ -1627,7 +1627,7 @@ s * * @note See the MRAA documentation for more info on installing MRAA
* 2. Make a directory to contain the RF24 and possibly RF24Network lib and enter it * @code - * mkdir ~/rf24libs + * mkdir ~/rf24libs * cd ~/rf24libs * @endcode * 3. Clone the RF24 repo @@ -1638,18 +1638,18 @@ s * * 6. Build the library, and run an example file * @code sudo make install @endcode * @code - * cd examples_linux + * cd examples_linux * @endcode * Edit the gettingstarted example, to set your pin configuration - * @code nano gettingstarted.cpp - * make + * @code nano gettingstarted.cpp + * make * sudo ./gettingstarted * @endcode * *

- * + * * @page MRAA MRAA - * + * * MRAA is a Low Level Skeleton Library for Communication on GNU/Linux platforms
* See http://iotdk.intel.com/docs/master/mraa/index.html for more information * @@ -1660,11 +1660,11 @@ s * * 1. Install the MRAA lib * 2. As per your device, SPI may need to be enabled * 3. Follow Linux installation steps to install RF24 libraries - * + * * *


* - * + * * * * @page RPi Raspberry Pi @@ -1681,7 +1681,7 @@ s * * B. Select **Advanced** and **enable the SPI kernel module**
* C. Update other software and libraries * @code sudo apt-get update @endcode - * @code sudo apt-get upgrade @endcode + * @code sudo apt-get upgrade @endcode *

* * @section Build Build Options @@ -1703,7 +1703,7 @@ s * * * 2. Complete the install
* @code nano /etc/ld.so.conf @endcode - * Add the line @code /usr/local/lib/arm-linux-gnueabihf @endcode + * Add the line @code /usr/local/lib/aarch64-linux-gnu @endcode * Run @code sudo ldconfig @endcode * * 3. Install RF24, using MRAA @@ -1737,7 +1737,7 @@ s * * RF24 radio(RPI_V2_GPIO_P1_15,BCM2835_SPI_CS0, BCM2835_SPI_SPEED_8MHZ); * or * RF24 radio(RPI_V2_GPIO_P1_15,BCM2835_SPI_CS1, BCM2835_SPI_SPEED_8MHZ); - * + * * RPi B+: * RF24 radio(RPI_BPLUS_GPIO_J8_15,RPI_BPLUS_GPIO_J8_24, BCM2835_SPI_SPEED_8MHZ); * or @@ -1766,7 +1766,7 @@ s * * * See http://pi.gadgetoid.com/pinout * - * **Pins:** + * **Pins:** * * | PIN | NRF24L01 | RPI | RPi -P1 Connector | * |-----|----------|------------|-------------------| @@ -1778,35 +1778,35 @@ s * * | 6 | MOSI | rpi-mosi | (19) | * | 7 | MISO | rpi-miso | (21) | * | 8 | IRQ | - | - | - * - * - * - * + * + * + * + * *

**************** - * + * * Based on the arduino lib from J. Coliz
- * the library was berryfied by Purinda Gunasekara
+ * the library was berryfied by Purinda Gunasekara
* then forked from github stanleyseow/RF24 to https://github.com/jscrane/RF24-rpi
* Network lib also based on https://github.com/farconada/RF24Network * - * * - * + * + * *


- * * - * + * + * * @page Python Python Wrapper (by https://github.com/mz-fuzzy) * * @note Both python2 and python3 are supported. * - * @section Install Installation: + * @section Install Installation: * * 1. Install the python-dev (or python3-dev) and boost libraries * @code sudo apt-get install python-dev libboost-python-dev @endcode * @note For python3 in Raspbian, it's needed to manually link python boost library, like this: - * @code sudo ln -s /usr/lib/arm-linux-gnueabihf/libboost_python-py34.so /usr/lib/arm-linux-gnueabihf/libboost_python3.so @endcode + * @code sudo ln -s /usr/lib/aarch64-linux-gnu/libboost_python-py34.so /usr/lib/aarch64-linux-gnu/libboost_python3.so @endcode * * 2. Install python-setuptools (or python3-setuptools) * @code sudo apt-get install python-setuptools @endcode @@ -1818,19 +1818,19 @@ s * * 4. Install the library * @code sudo ./setup.py install @endcode * See the additional Platform Support pages for information on connecting your hardware
- * See the included example for usage information. - * + * See the included example for usage information. + * * 5. Running the Example - * Edit the pingpair_dyn.py example to configure the appropriate pins per the above documentation: + * Edit the pingpair_dyn.py example to configure the appropriate pins per the above documentation: * @code nano pingpair_dyn.py @endcode * Configure another device, Arduino or RPi with the pingpair_dyn example
- * Run the example + * Run the example * @code sudo ./pingpair_dyn.py @endcode * *


* * @page CrossCompile Linux cross-compilation - * + * * RF24 library supports cross-compilation. Advantages of cross-compilation: * - development tools don't have to be installed on target machine * - resources of target machine don't have to be sufficient for compilation @@ -1842,7 +1842,7 @@ s * * - cross-compilation toolchain for your target machine; for RPi * @code git clone https://github.com/raspberrypi/tools rpi_tools @endcode * and cross-compilation tools must be in PATH, for example - * @code export PATH=$PATH:/your/dir/rpi-tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin @endcode + * @code export PATH=$PATH:/your/dir/rpi-tools/arm-bcm2708/gcc-linaro-aarch64-linux-gnu-raspbian-x64/bin @endcode * * @section CxSteps Cross compilation steps: * 1. clone RF24 to a machine for cross-compilation @@ -1903,16 +1903,16 @@ s * *


* * @page ATXMEGA ATXMEGA - * + * * The RF24 driver can be build as a static library with Atmel Studio 7 in order to be included as any other library in another program for the XMEGA family. * * Currently only the ATXMEGA D3 family is implemented. - * - * @section Preparation - * + * + * @section Preparation + * * Create an empty GCC Static Library project in AS7.
* As not all files are required, copy the following directory structure in the project: - * + * * @code * utility\ * ATXMegaD3\ @@ -1932,38 +1932,38 @@ s * * RF24.h * RF24_config.h * @endcode - * + * * @section Usage - * + * * Add the library to your project!
* In the file where the **main()** is put the following in order to update the millisecond functionality: - * + * * @code * ISR(TCE0_OVF_vect) * { * update_milisec(); * } * @endcode - * + * * Declare the rf24 radio with **RF24 radio(XMEGA_PORTC_PIN3, XMEGA_SPI_PORT_C);** - * + * * First parameter is the CE pin which can be any available pin on the uC. - * - * Second parameter is the CS which can be on port C (**XMEGA_SPI_PORT_C**) or on port D (**XMEGA_SPI_PORT_D**). - * + * + * Second parameter is the CS which can be on port C (**XMEGA_SPI_PORT_C**) or on port D (**XMEGA_SPI_PORT_D**). + * * Call the **__start_timer()** to start the millisecond timer. - * + * * @note Note about the millisecond functionality:
- * + * * The millisecond functionality is based on the TCE0 so don't use these pins as IO.
- * The operating frequency of the uC is 32MHz. If you have other frequency change the TCE0 registers appropriatly in function **__start_timer()** in **compatibility.c** file for your frequency. + * The operating frequency of the uC is 32MHz. If you have other frequency change the TCE0 registers appropriatly in function **__start_timer()** in **compatibility.c** file for your frequency. * * @page Portability RF24 Portability * * The RF24 radio driver mainly utilizes the Arduino API for GPIO, SPI, and timing functions, which are easily replicated - * on various platforms.
Support files for these platforms are stored under RF24/utility, and can be modified to provide + * on various platforms.
Support files for these platforms are stored under RF24/utility, and can be modified to provide * the required functionality. - * + * *
* @section Hardware_Templates Basic Hardware Template * @@ -1972,18 +1972,18 @@ s * * The RF24 library now includes a basic hardware template to assist in porting to various platforms.
The following files can be included * to replicate standard Arduino functions as needed, allowing devices from ATTiny to Raspberry Pi to utilize the same core RF24 driver. * - * | File | Purpose | - * |--------------------|------------------------------------------------------------------------------| - * | RF24_arch_config.h | Basic Arduino/AVR compatibility, includes for remaining support files, etc | - * | includes.h | Linux only. Defines specific platform, include correct RF24_arch_config file | - * | spi.h | Provides standardized SPI ( transfer() ) methods | - * | gpio.h | Provides standardized GPIO ( digitalWrite() ) methods | - * | compatibility.h | Provides standardized timing (millis(), delay()) methods | - * | your_custom_file.h | Provides access to custom drivers for spi,gpio, etc | + * | File | Purpose | + * |--------------------|------------------------------------------------------------------------------| + * | RF24_arch_config.h | Basic Arduino/AVR compatibility, includes for remaining support files, etc | + * | includes.h | Linux only. Defines specific platform, include correct RF24_arch_config file | + * | spi.h | Provides standardized SPI ( transfer() ) methods | + * | gpio.h | Provides standardized GPIO ( digitalWrite() ) methods | + * | compatibility.h | Provides standardized timing (millis(), delay()) methods | + * | your_custom_file.h | Provides access to custom drivers for spi,gpio, etc | * *
* Examples are provided via the included hardware support templates in **RF24/utility**
- * See the modules page for examples of class declarations + * See the modules page for examples of class declarations * *
* @section Device_Detection Device Detection @@ -1995,7 +1995,7 @@ s * *
* @section Ported_Code Code * To have your ported code included in this library, or for assistance in porting, create a pull request or open an issue at https://github.com/TMRh20/RF24 - * + * * *


*/ diff --git a/libcontroller/links/RF24/utility/spi.cpp b/libcontroller/links/RF24/utility/spi.cpp index 486d487..2fa0d5c 100644 --- a/libcontroller/links/RF24/utility/spi.cpp +++ b/libcontroller/links/RF24/utility/spi.cpp @@ -99,20 +99,20 @@ void nRF24::SPI::beginTransaction( SPISettings settings ) { std::cout << "SPI rd_mode\n"; } - if ( ioctl( mFD, SPI_IOC_WR_BITS_PER_WORD, &mBitsPerWord ) < 0 ) + if ( ioctl( mFD, SPI_IOC_WR_BITS_PER_WORD, &mBitsPerWord ) < 0 ) { std::cout << "SPI write bits_per_word\n"; } - if ( ioctl( mFD, SPI_IOC_RD_BITS_PER_WORD, &mBitsPerWord ) < 0 ) + if ( ioctl( mFD, SPI_IOC_RD_BITS_PER_WORD, &mBitsPerWord ) < 0 ) { std::cout << "SPI read bits_per_word\n"; } - if ( ioctl( mFD, SPI_IOC_WR_MAX_SPEED_HZ, &speed ) < 0 ) + if ( ioctl( mFD, SPI_IOC_WR_MAX_SPEED_HZ, &speed ) < 0 ) { std::cout << "can't set max speed hz\n"; } - if ( ioctl( mFD, SPI_IOC_RD_MAX_SPEED_HZ, &speed ) < 0 ) + if ( ioctl( mFD, SPI_IOC_RD_MAX_SPEED_HZ, &speed ) < 0 ) { std::cout << "SPI max_speed_hz\n"; } @@ -191,5 +191,5 @@ void nRF24::SPI::transfern( char* buf, uint32_t len ) char* rbuf = new char[len]; transfernb( buf, rbuf, len ); memcpy( buf, rbuf, len ); - delete rbuf; + delete [] rbuf; } \ No newline at end of file diff --git a/libhud/CMakeLists.txt b/libhud/CMakeLists.txt index cc27960..2b7e04e 100644 --- a/libhud/CMakeLists.txt +++ b/libhud/CMakeLists.txt @@ -19,3 +19,5 @@ set( SRCS ) add_library( hud STATIC ${SRCS} ) + +target_link_libraries( hud PRIVATE luacore ) diff --git a/libluacore/CMakeLists.txt b/libluacore/CMakeLists.txt index 966e7a1..2c19a7c 100644 --- a/libluacore/CMakeLists.txt +++ b/libluacore/CMakeLists.txt @@ -6,9 +6,13 @@ set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -g3 -std=gnu++14" ) # -Wno-pmf-co set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -g3" ) SET( CMAKE_REQUIRED_DEFINITIONS "-D_GNU_SOURCE" ) +find_package(Lua REQUIRED) + add_library( luacore STATIC src/LuaInterface.cpp src/Lua.cpp ) target_link_libraries( luacore -ldl ) +target_include_directories( luacore PUBLIC ${LUA_INCLUDE_DIR} ) +target_link_libraries( luacore ${LUA_LIBRARIES} ) \ No newline at end of file diff --git a/libluacore/src/Lua.h b/libluacore/src/Lua.h index d2a7419..fb4afaa 100644 --- a/libluacore/src/Lua.h +++ b/libluacore/src/Lua.h @@ -74,7 +74,7 @@ class LuaValue LuaValue( bool v ) : mType(Boolean), mBoolean(v), mInteger(v), mNumber(v), mString(to_string(v)), mFunctionRef(nullptr), mUserData(nullptr) {} LuaValue( double v ) : mType(Number), mBoolean(v!=0), mInteger(v), mNumber(v), mString(to_string(v)), mFunctionRef(nullptr), mUserData(nullptr) {} LuaValue( float v ) : mType(Number), mBoolean(v!=0), mInteger(v), mNumber(v), mString(to_string(v)), mFunctionRef(nullptr), mUserData(nullptr) {} -#if (!defined(ANDROID) && !defined(BOARD_rpi) && !(TARGET_CPU_BITS == 32)) +#if !(TARGET_CPU_BITS == 32) LuaValue( int32_t v ) : mType(Integer), mBoolean(v!=0), mInteger(v), mNumber(v), mString(to_string(v)), mFunctionRef(nullptr), mUserData(nullptr) {} #endif LuaValue( uint32_t v ) : mType(Integer), mBoolean(v!=0), mInteger(v), mNumber(v), mString(to_string(v)), mFunctionRef(nullptr), mUserData(nullptr) {} diff --git a/libluacore/src/traits.hpp b/libluacore/src/traits.hpp index 3cbef94..a7cbc99 100644 --- a/libluacore/src/traits.hpp +++ b/libluacore/src/traits.hpp @@ -311,5 +311,3 @@ typename std::add_rvalue_reference::type rt_val() noexcept } #endif - - diff --git a/librawwifi++/CMakeModules/FindNL.cmake b/librawwifi++/CMakeModules/FindNL.cmake index 913b8c3..f809763 100644 --- a/librawwifi++/CMakeModules/FindNL.cmake +++ b/librawwifi++/CMakeModules/FindNL.cmake @@ -8,22 +8,22 @@ execute_process( COMMAND sh -c "${CMAKE_C_COMPILER} -print-search-dirs | grep li find_path(NL_ROOT_DIR NAMES include/libnl3 - HINTS ${CMAKE_FIND_ROOT_PATH}/arm-linux-gnueabihf + HINTS ${CMAKE_FIND_ROOT_PATH}/aarch64-linux-gnu ) find_library ( NL_LIBRARY nl-3 - HINTS ${NL_ROOT_DIR}/lib ${NL_ROOT_DIR}/lib/arm-linux-gnueabihf + HINTS ${NL_ROOT_DIR}/lib ${NL_ROOT_DIR}/lib/aarch64-linux-gnu PATHS ${ARM_LIBS} ) find_library ( NLGENL_LIBRARY nl-genl-3 - HINTS ${NL_ROOT_DIR}/lib ${NL_ROOT_DIR}/lib/arm-linux-gnueabihf + HINTS ${NL_ROOT_DIR}/lib ${NL_ROOT_DIR}/lib/aarch64-linux-gnu PATHS ${ARM_LIBS} ) find_library ( NLROUTE_LIBRARY nl-route-3 - HINTS ${NL_ROOT_DIR}/lib ${NL_ROOT_DIR}/lib/arm-linux-gnueabihf + HINTS ${NL_ROOT_DIR}/lib ${NL_ROOT_DIR}/lib/aarch64-linux-gnu PATHS ${ARM_LIBS} ) @@ -32,7 +32,7 @@ find_path( NL_INCLUDE_DIR PATH_SUFFIXES include/libnl3 NAMES netlink/version.h - HINTS ${CMAKE_FIND_ROOT_PATH}/arm-linux-gnueabihf + HINTS ${CMAKE_FIND_ROOT_PATH}/aarch64-linux-gnu ) include(FindPackageHandleStandardArgs) diff --git a/librawwifi++/CMakeModules/FindPCAP.cmake b/librawwifi++/CMakeModules/FindPCAP.cmake index 22e3057..3c51f1d 100644 --- a/librawwifi++/CMakeModules/FindPCAP.cmake +++ b/librawwifi++/CMakeModules/FindPCAP.cmake @@ -21,7 +21,7 @@ find_path(PCAP_ROOT_DIR NAMES include/pcap.h - HINTS ${CMAKE_FIND_ROOT_PATH}/arm-linux-gnueabihf + HINTS ${CMAKE_FIND_ROOT_PATH}/aarch64-linux-gnu ) find_path(PCAP_INCLUDE_DIR @@ -32,7 +32,7 @@ find_path(PCAP_INCLUDE_DIR execute_process( COMMAND sh -c "${CMAKE_C_COMPILER} -print-search-dirs | grep libraries | cut -d'=' -f2 | tr : ';'" OUTPUT_VARIABLE ARM_LIBS ) find_library(PCAP_LIBRARY NAMES pcap - HINTS ${PCAP_ROOT_DIR}/lib ${PCAP_ROOT_DIR}/lib/arm-linux-gnueabihf + HINTS ${PCAP_ROOT_DIR}/lib ${PCAP_ROOT_DIR}/lib/aarch64-linux-gnu PATHS ${ARM_LIBS} )