hanze/muizenval

format arduino-code (21cd760209ad2f34a7423bdf962a36cedc1afb0d)
Repositories

commit 21cd760209ad2f34a7423bdf962a36cedc1afb0d
parent ce9087d3e90814cd77506c6c653aa803ea2b20aa
Author: Friedel Schön <[email protected]>
Date:   Tue, 31 May 2022 14:06:49 +0200

format arduino-code

Diffstat:
A.vscode/arduino.json7+++++++
A.vscode/c_cpp_properties.json502+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
M5g-board/5g-board.ino210+++++++++++++++++++++++++++++++++++++++++--------------------------------------
3 files changed, 618 insertions(+), 101 deletions(-)

diff --git a/.vscode/arduino.json b/.vscode/arduino.json @@ -0,0 +1,6 @@ +{ + "board": "SODAQ:samd:sodaq_sara", + "programmer": "SODAQ:atmel_ice", + "port": "/dev/tty.usbmodem142301", + "sketch": "5g-board/5g-board.ino" +} +\ No newline at end of file diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json @@ -0,0 +1,501 @@ +{ + "version": 4, + "configurations": [ + { + "name": "Arduino", + "compilerPath": "/Users/friedel/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/bin/arm-none-eabi-g++", + "compilerArgs": [ + "-mcpu=cortex-m0plus", + "-mthumb", + "-w", + "-std=gnu++11", + "-ffunction-sections", + "-fdata-sections", + "-fno-threadsafe-statics", + "-nostdlib", + "--param", + "-fno-rtti", + "-fno-exceptions" + ], + "intelliSenseMode": "gcc-x64", + "includePath": [ + "/Users/friedel/Library/Arduino15/packages/arduino/tools/CMSIS/4.5.0/CMSIS/Include/", + "/Users/friedel/Library/Arduino15/packages/arduino/tools/CMSIS-Atmel/1.2.0/CMSIS/Device/ATMEL/", + "/Users/friedel/Library/Arduino15/packages/SODAQ/hardware/samd/1.8.9/cores/arduino", + "/Users/friedel/Library/Arduino15/packages/SODAQ/hardware/samd/1.8.9/variants/sodaq_sara", + "/Users/friedel/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/arm-none-eabi/include/c++/7.2.1", + "/Users/friedel/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/arm-none-eabi/include/c++/7.2.1/arm-none-eabi", + "/Users/friedel/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/arm-none-eabi/include/c++/7.2.1/backward", + "/Users/friedel/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/lib/gcc/arm-none-eabi/7.2.1/include", + "/Users/friedel/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/lib/gcc/arm-none-eabi/7.2.1/include-fixed", + "/Users/friedel/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/arm-none-eabi/include" + ], + "forcedInclude": [ + "/Users/friedel/Library/Arduino15/packages/SODAQ/hardware/samd/1.8.9/cores/arduino/Arduino.h" + ], + "cStandard": "c11", + "cppStandard": "c++11", + "defines": [ + "F_CPU=48000000L", + "ARDUINO=10819", + "ARDUINO_SODAQ_SARA", + "ARDUINO_ARCH_SAMD", + "VERY_LOW_POWER", + "__SAMD21J18A__", + "USB_VID=0x2341", + "USB_PID=0x804d", + "USBCON", + "USB_MANUFACTURER=\"SODAQ\"", + "USB_PRODUCT=\"SODAQ SARA\"", + "__DBL_MIN_EXP__=(-1021)", + "__HQ_FBIT__=15", + "__FLT32X_MAX_EXP__=1024", + "__cpp_attributes=200809", + "__UINT_LEAST16_MAX__=0xffff", + "__ARM_SIZEOF_WCHAR_T=4", + "__ATOMIC_ACQUIRE=2", + "__SFRACT_IBIT__=0", + "__FLT_MIN__=1.1754943508222875e-38F", + "__GCC_IEC_559_COMPLEX=0", + "__cpp_aggregate_nsdmi=201304", + "__UFRACT_MAX__=0XFFFFP-16UR", + "__UINT_LEAST8_TYPE__=unsigned char", + "__DQ_FBIT__=63", + "__INTMAX_C(c)=c ## LL", + "__ULFRACT_FBIT__=32", + "__SACCUM_EPSILON__=0x1P-7HK", + "__CHAR_BIT__=8", + "__USQ_IBIT__=0", + "__UINT8_MAX__=0xff", + "__ACCUM_FBIT__=15", + "__WINT_MAX__=0xffffffffU", + "__FLT32_MIN_EXP__=(-125)", + "__cpp_static_assert=200410", + "__USFRACT_FBIT__=8", + "__ORDER_LITTLE_ENDIAN__=1234", + "__SIZE_MAX__=0xffffffffU", + "__ARM_ARCH_ISA_ARM=1", + "__WCHAR_MAX__=0xffffffffU", + "__LACCUM_IBIT__=32", + "__DBL_DENORM_MIN__=double(4.9406564584124654e-324L)", + "__GCC_ATOMIC_CHAR_LOCK_FREE=1", + "__GCC_IEC_559=0", + "__FLT32X_DECIMAL_DIG__=17", + "__FLT_EVAL_METHOD__=0", + "__cpp_binary_literals=201304", + "__LLACCUM_MAX__=0X7FFFFFFFFFFFFFFFP-31LLK", + "__FLT64_DECIMAL_DIG__=17", + "__GCC_ATOMIC_CHAR32_T_LOCK_FREE=1", + "__FRACT_FBIT__=15", + "__cpp_variadic_templates=200704", + "__UINT_FAST64_MAX__=0xffffffffffffffffULL", + "__SIG_ATOMIC_TYPE__=int", + "__UACCUM_FBIT__=16", + "__DBL_MIN_10_EXP__=(-307)", + "__FINITE_MATH_ONLY__=0", + "__ARMEL__=1", + "__cpp_variable_templates=201304", + "__LFRACT_IBIT__=0", + "__GNUC_PATCHLEVEL__=1", + "__FLT32_HAS_DENORM__=1", + "__LFRACT_MAX__=0X7FFFFFFFP-31LR", + "__UINT_FAST8_MAX__=0xffffffffU", + "__has_include(STR)=__has_include__(STR)", + "__DEC64_MAX_EXP__=385", + "__INT8_C(c)=c", + "__INT_LEAST8_WIDTH__=8", + "__UINT_LEAST64_MAX__=0xffffffffffffffffULL", + "__SA_FBIT__=15", + "__SHRT_MAX__=0x7fff", + "__LDBL_MAX__=1.7976931348623157e+308L", + "__FRACT_MAX__=0X7FFFP-15R", + "__UFRACT_FBIT__=16", + "__UFRACT_MIN__=0.0UR", + "__UINT_LEAST8_MAX__=0xff", + "__GCC_ATOMIC_BOOL_LOCK_FREE=1", + "__UINTMAX_TYPE__=long long unsigned int", + "__LLFRACT_EPSILON__=0x1P-63LLR", + "__DEC32_EPSILON__=1E-6DF", + "__FLT_EVAL_METHOD_TS_18661_3__=0", + "__CHAR_UNSIGNED__=1", + "__UINT32_MAX__=0xffffffffUL", + "__GXX_EXPERIMENTAL_CXX0X__=1", + "__ULFRACT_MAX__=0XFFFFFFFFP-32ULR", + "__TA_IBIT__=64", + "__LDBL_MAX_EXP__=1024", + "__WINT_MIN__=0U", + "__INT_LEAST16_WIDTH__=16", + "__ULLFRACT_MIN__=0.0ULLR", + "__SCHAR_MAX__=0x7f", + "__WCHAR_MIN__=0U", + "__INT64_C(c)=c ## LL", + "__DBL_DIG__=15", + "__GCC_ATOMIC_POINTER_LOCK_FREE=1", + "__LLACCUM_MIN__=(-0X1P31LLK-0X1P31LLK)", + "__SIZEOF_INT__=4", + "__SIZEOF_POINTER__=4", + "__GCC_ATOMIC_CHAR16_T_LOCK_FREE=1", + "__USACCUM_IBIT__=8", + "__USER_LABEL_PREFIX__", + "__STDC_HOSTED__=1", + "__LDBL_HAS_INFINITY__=1", + "__LFRACT_MIN__=(-0.5LR-0.5LR)", + "__HA_IBIT__=8", + "__FLT32_DIG__=6", + "__TQ_IBIT__=0", + "__FLT_EPSILON__=1.1920928955078125e-7F", + "__APCS_32__=1", + "__GXX_WEAK__=1", + "__SHRT_WIDTH__=16", + "__USFRACT_IBIT__=0", + "__LDBL_MIN__=2.2250738585072014e-308L", + "__FRACT_MIN__=(-0.5R-0.5R)", + "__DEC32_MAX__=9.999999E96DF", + "__DA_IBIT__=32", + "__ARM_SIZEOF_MINIMAL_ENUM=1", + "__FLT32X_HAS_INFINITY__=1", + "__INT32_MAX__=0x7fffffffL", + "__UQQ_FBIT__=8", + "__INT_WIDTH__=32", + "__SIZEOF_LONG__=4", + "__UACCUM_MAX__=0XFFFFFFFFP-16UK", + "__UINT16_C(c)=c", + "__PTRDIFF_WIDTH__=32", + "__DECIMAL_DIG__=17", + "__LFRACT_EPSILON__=0x1P-31LR", + "__FLT64_EPSILON__=2.2204460492503131e-16F64", + "__ULFRACT_MIN__=0.0ULR", + "__INTMAX_WIDTH__=64", + "__FLT64_MIN_EXP__=(-1021)", + "__has_include_next(STR)=__has_include_next__(STR)", + "__LDBL_HAS_QUIET_NAN__=1", + "__ULACCUM_IBIT__=32", + "__FLT64_MANT_DIG__=53", + "__UACCUM_EPSILON__=0x1P-16UK", + "__GNUC__=7", + "__ULLACCUM_MAX__=0XFFFFFFFFFFFFFFFFP-32ULLK", + "__GXX_RTTI=1", + "__cpp_delegating_constructors=200604", + "__HQ_IBIT__=0", + "__FLT_HAS_DENORM__=1", + "__SIZEOF_LONG_DOUBLE__=8", + "__BIGGEST_ALIGNMENT__=8", + "__STDC_UTF_16__=1", + "__FLT64_MAX_10_EXP__=308", + "__GNUC_STDC_INLINE__=1", + "__DQ_IBIT__=0", + "__FLT32_HAS_INFINITY__=1", + "__DBL_MAX__=double(1.7976931348623157e+308L)", + "__ULFRACT_IBIT__=0", + "__cpp_raw_strings=200710", + "__INT_FAST32_MAX__=0x7fffffff", + "__DBL_HAS_INFINITY__=1", + "__INT64_MAX__=0x7fffffffffffffffLL", + "__ACCUM_IBIT__=16", + "__DEC32_MIN_EXP__=(-94)", + "__THUMB_INTERWORK__=1", + "__INTPTR_WIDTH__=32", + "__LACCUM_MAX__=0X7FFFFFFFFFFFFFFFP-31LK", + "__FLT32X_HAS_DENORM__=1", + "__INT_FAST16_TYPE__=int", + "__LDBL_HAS_DENORM__=1", + "__cplusplus=201402L", + "__cpp_ref_qualifiers=200710", + "__DEC128_MAX__=9.999999999999999999999999999999999E6144DL", + "__INT_LEAST32_MAX__=0x7fffffffL", + "__ARM_PCS=1", + "__DEC32_MIN__=1E-95DF", + "__ACCUM_MAX__=0X7FFFFFFFP-15K", + "__DEPRECATED=1", + "__cpp_rvalue_references=200610", + "__DBL_MAX_EXP__=1024", + "__USACCUM_EPSILON__=0x1P-8UHK", + "__WCHAR_WIDTH__=32", + "__FLT32_MAX__=3.4028234663852886e+38F32", + "__DEC128_EPSILON__=1E-33DL", + "__SFRACT_MAX__=0X7FP-7HR", + "__FRACT_IBIT__=0", + "__PTRDIFF_MAX__=0x7fffffff", + "__UACCUM_MIN__=0.0UK", + "__UACCUM_IBIT__=16", + "__FLT32_HAS_QUIET_NAN__=1", + "__GNUG__=7", + "__LONG_LONG_MAX__=0x7fffffffffffffffLL", + "__SIZEOF_SIZE_T__=4", + "__ULACCUM_MAX__=0XFFFFFFFFFFFFFFFFP-32ULK", + "__cpp_rvalue_reference=200610", + "__cpp_nsdmi=200809", + "__SIZEOF_WINT_T__=4", + "__LONG_LONG_WIDTH__=64", + "__cpp_initializer_lists=200806", + "__FLT32_MAX_EXP__=128", + "__SA_IBIT__=16", + "__ULLACCUM_MIN__=0.0ULLK", + "__cpp_hex_float=201603", + "__GXX_ABI_VERSION=1011", + "__UTA_FBIT__=64", + "__SOFTFP__=1", + "__FLT_MIN_EXP__=(-125)", + "__USFRACT_MAX__=0XFFP-8UHR", + "__UFRACT_IBIT__=0", + "__cpp_lambdas=200907", + "__INT_FAST64_TYPE__=long long int", + "__FLT64_DENORM_MIN__=4.9406564584124654e-324F64", + "__DBL_MIN__=double(2.2250738585072014e-308L)", + "__FLT32X_EPSILON__=2.2204460492503131e-16F32x", + "__LACCUM_MIN__=(-0X1P31LK-0X1P31LK)", + "__ULLACCUM_FBIT__=32", + "__GXX_TYPEINFO_EQUALITY_INLINE=0", + "__FLT64_MIN_10_EXP__=(-307)", + "__ULLFRACT_EPSILON__=0x1P-64ULLR", + "__USES_INITFINI__=1", + "__DEC128_MIN__=1E-6143DL", + "__REGISTER_PREFIX__", + "__UINT16_MAX__=0xffff", + "__DBL_HAS_DENORM__=1", + "__ACCUM_MIN__=(-0X1P15K-0X1P15K)", + "__SQ_IBIT__=0", + "__FLT32_MIN__=1.1754943508222875e-38F32", + "__UINT8_TYPE__=unsigned char", + "__UHA_FBIT__=8", + "__NO_INLINE__=1", + "__SFRACT_MIN__=(-0.5HR-0.5HR)", + "__UTQ_FBIT__=128", + "__FLT_MANT_DIG__=24", + "__LDBL_DECIMAL_DIG__=17", + "__VERSION__=\"7.2.1 20170904 (release) [ARM/embedded-7-branch revision 255204]\"", + "__UINT64_C(c)=c ## ULL", + "__ULLFRACT_FBIT__=64", + "__cpp_unicode_characters=200704", + "__FRACT_EPSILON__=0x1P-15R", + "__ULACCUM_MIN__=0.0ULK", + "__UDA_FBIT__=32", + "__cpp_decltype_auto=201304", + "__LLACCUM_EPSILON__=0x1P-31LLK", + "__GCC_ATOMIC_INT_LOCK_FREE=1", + "__FLT32_MANT_DIG__=24", + "__FLOAT_WORD_ORDER__=__ORDER_LITTLE_ENDIAN__", + "__USFRACT_MIN__=0.0UHR", + "__ULLACCUM_IBIT__=32", + "__UQQ_IBIT__=0", + "__SCHAR_WIDTH__=8", + "__INT32_C(c)=c ## L", + "__DEC64_EPSILON__=1E-15DD", + "__ORDER_PDP_ENDIAN__=3412", + "__DEC128_MIN_EXP__=(-6142)", + "__UHQ_FBIT__=16", + "__LLACCUM_FBIT__=31", + "__FLT32_MAX_10_EXP__=38", + "__INT_FAST32_TYPE__=int", + "__UINT_LEAST16_TYPE__=short unsigned int", + "__INT16_MAX__=0x7fff", + "__cpp_rtti=199711", + "__SIZE_TYPE__=unsigned int", + "__UINT64_MAX__=0xffffffffffffffffULL", + "__UDQ_FBIT__=64", + "__INT8_TYPE__=signed char", + "__cpp_digit_separators=201309", + "__ELF__=1", + "__ULFRACT_EPSILON__=0x1P-32ULR", + "__LLFRACT_FBIT__=63", + "__FLT_RADIX__=2", + "__INT_LEAST16_TYPE__=short int", + "__LDBL_EPSILON__=2.2204460492503131e-16L", + "__UINTMAX_C(c)=c ## ULL", + "__SACCUM_MAX__=0X7FFFP-7HK", + "__SIG_ATOMIC_MAX__=0x7fffffff", + "__GCC_ATOMIC_WCHAR_T_LOCK_FREE=1", + "__cpp_sized_deallocation=201309", + "__VFP_FP__=1", + "__SIZEOF_PTRDIFF_T__=4", + "__FLT32X_MANT_DIG__=53", + "__LACCUM_EPSILON__=0x1P-31LK", + "__FLT32X_MIN_EXP__=(-1021)", + "__DEC32_SUBNORMAL_MIN__=0.000001E-95DF", + "__INT_FAST16_MAX__=0x7fffffff", + "__FLT64_DIG__=15", + "__UINT_FAST32_MAX__=0xffffffffU", + "__UINT_LEAST64_TYPE__=long long unsigned int", + "__USACCUM_MAX__=0XFFFFP-8UHK", + "__SFRACT_EPSILON__=0x1P-7HR", + "__FLT_HAS_QUIET_NAN__=1", + "__FLT_MAX_10_EXP__=38", + "__LONG_MAX__=0x7fffffffL", + "__DEC128_SUBNORMAL_MIN__=0.000000000000000000000000000000001E-6143DL", + "__FLT_HAS_INFINITY__=1", + "__cpp_unicode_literals=200710", + "__USA_FBIT__=16", + "__UINT_FAST16_TYPE__=unsigned int", + "__DEC64_MAX__=9.999999999999999E384DD", + "__ARM_32BIT_STATE=1", + "__INT_FAST32_WIDTH__=32", + "__CHAR16_TYPE__=short unsigned int", + "__PRAGMA_REDEFINE_EXTNAME=1", + "__SIZE_WIDTH__=32", + "__INT_LEAST16_MAX__=0x7fff", + "__DEC64_MANT_DIG__=16", + "__UINT_LEAST32_MAX__=0xffffffffUL", + "__SACCUM_FBIT__=7", + "__FLT32_DENORM_MIN__=1.4012984643248171e-45F32", + "__GCC_ATOMIC_LONG_LOCK_FREE=1", + "__SIG_ATOMIC_WIDTH__=32", + "__INT_LEAST64_TYPE__=long long int", + "__INT16_TYPE__=short int", + "__INT_LEAST8_TYPE__=signed char", + "__SQ_FBIT__=31", + "__DEC32_MAX_EXP__=97", + "__ARM_ARCH_ISA_THUMB=1", + "__INT_FAST8_MAX__=0x7fffffff", + "__ARM_ARCH=4", + "__INTPTR_MAX__=0x7fffffff", + "__QQ_FBIT__=7", + "__cpp_range_based_for=200907", + "__UTA_IBIT__=64", + "__FLT64_HAS_QUIET_NAN__=1", + "__FLT32_MIN_10_EXP__=(-37)", + "__EXCEPTIONS=1", + "__LDBL_MANT_DIG__=53", + "__SFRACT_FBIT__=7", + "__SACCUM_MIN__=(-0X1P7HK-0X1P7HK)", + "__DBL_HAS_QUIET_NAN__=1", + "__FLT64_HAS_INFINITY__=1", + "__SIG_ATOMIC_MIN__=(-__SIG_ATOMIC_MAX__ - 1)", + "__cpp_return_type_deduction=201304", + "__INTPTR_TYPE__=int", + "__UINT16_TYPE__=short unsigned int", + "__WCHAR_TYPE__=unsigned int", + "__SIZEOF_FLOAT__=4", + "__USQ_FBIT__=32", + "__UINTPTR_MAX__=0xffffffffU", + "__INT_FAST64_WIDTH__=64", + "__DEC64_MIN_EXP__=(-382)", + "__cpp_decltype=200707", + "__FLT32_DECIMAL_DIG__=9", + "__INT_FAST64_MAX__=0x7fffffffffffffffLL", + "__GCC_ATOMIC_TEST_AND_SET_TRUEVAL=1", + "__FLT_DIG__=6", + "__UINT_FAST64_TYPE__=long long unsigned int", + "__INT_MAX__=0x7fffffff", + "__LACCUM_FBIT__=31", + "__USACCUM_MIN__=0.0UHK", + "__UHA_IBIT__=8", + "__INT64_TYPE__=long long int", + "__FLT_MAX_EXP__=128", + "__UTQ_IBIT__=0", + "__DBL_MANT_DIG__=53", + "__cpp_inheriting_constructors=201511", + "__INT_LEAST64_MAX__=0x7fffffffffffffffLL", + "__DEC64_MIN__=1E-383DD", + "__WINT_TYPE__=unsigned int", + "__UINT_LEAST32_TYPE__=long unsigned int", + "__SIZEOF_SHORT__=2", + "__ULLFRACT_IBIT__=0", + "__LDBL_MIN_EXP__=(-1021)", + "__arm__=1", + "__FLT64_MAX__=1.7976931348623157e+308F64", + "__UDA_IBIT__=32", + "__WINT_WIDTH__=32", + "__INT_LEAST8_MAX__=0x7f", + "__FLT32X_MAX_10_EXP__=308", + "__LFRACT_FBIT__=31", + "__WCHAR_UNSIGNED__=1", + "__LDBL_MAX_10_EXP__=308", + "__ATOMIC_RELAXED=0", + "__DBL_EPSILON__=double(2.2204460492503131e-16L)", + "__UINT8_C(c)=c", + "__FLT64_MAX_EXP__=1024", + "__INT_LEAST32_TYPE__=long int", + "__SIZEOF_WCHAR_T__=4", + "__LLFRACT_MAX__=0X7FFFFFFFFFFFFFFFP-63LLR", + "__TQ_FBIT__=127", + "__INT_FAST8_TYPE__=int", + "__ULLACCUM_EPSILON__=0x1P-32ULLK", + "__UHQ_IBIT__=0", + "__ARM_FEATURE_COPROC=1", + "__LLACCUM_IBIT__=32", + "__FLT64_HAS_DENORM__=1", + "__FLT32_EPSILON__=1.1920928955078125e-7F32", + "__DBL_DECIMAL_DIG__=17", + "__STDC_UTF_32__=1", + "__INT_FAST8_WIDTH__=32", + "__DEC_EVAL_METHOD__=2", + "__FLT32X_MAX__=1.7976931348623157e+308F32x", + "__TA_FBIT__=63", + "__UDQ_IBIT__=0", + "__ORDER_BIG_ENDIAN__=4321", + "__cpp_runtime_arrays=198712", + "__UINT64_TYPE__=long long unsigned int", + "__ACCUM_EPSILON__=0x1P-15K", + "__UINT32_C(c)=c ## UL", + "__INTMAX_MAX__=0x7fffffffffffffffLL", + "__cpp_alias_templates=200704", + "__BYTE_ORDER__=__ORDER_LITTLE_ENDIAN__", + "__FLT_DENORM_MIN__=1.4012984643248171e-45F", + "__LLFRACT_IBIT__=0", + "__INT8_MAX__=0x7f", + "__LONG_WIDTH__=32", + "__UINT_FAST32_TYPE__=unsigned int", + "__CHAR32_TYPE__=long unsigned int", + "__FLT_MAX__=3.4028234663852886e+38F", + "__cpp_constexpr=201304", + "__USACCUM_FBIT__=8", + "__INT32_TYPE__=long int", + "__SIZEOF_DOUBLE__=8", + "__cpp_exceptions=199711", + "__FLT_MIN_10_EXP__=(-37)", + "__UFRACT_EPSILON__=0x1P-16UR", + "__FLT64_MIN__=2.2250738585072014e-308F64", + "__INT_LEAST32_WIDTH__=32", + "__INTMAX_TYPE__=long long int", + "__DEC128_MAX_EXP__=6145", + "__FLT32X_HAS_QUIET_NAN__=1", + "__ATOMIC_CONSUME=1", + "__GNUC_MINOR__=2", + "__INT_FAST16_WIDTH__=32", + "__UINTMAX_MAX__=0xffffffffffffffffULL", + "__DEC32_MANT_DIG__=7", + "__FLT32X_DENORM_MIN__=4.9406564584124654e-324F32x", + "__HA_FBIT__=7", + "__DBL_MAX_10_EXP__=308", + "__LDBL_DENORM_MIN__=4.9406564584124654e-324L", + "__INT16_C(c)=c", + "__cpp_generic_lambdas=201304", + "__STDC__=1", + "__ARM_ARCH_4T__=1", + "__FLT32X_DIG__=15", + "__PTRDIFF_TYPE__=int", + "__LLFRACT_MIN__=(-0.5LLR-0.5LLR)", + "__ATOMIC_SEQ_CST=5", + "__DA_FBIT__=31", + "__UINT32_TYPE__=long unsigned int", + "__FLT32X_MIN_10_EXP__=(-307)", + "__UINTPTR_TYPE__=unsigned int", + "__USA_IBIT__=16", + "__DEC64_SUBNORMAL_MIN__=0.000000000000001E-383DD", + "__ARM_EABI__=1", + "__DEC128_MANT_DIG__=34", + "__LDBL_MIN_10_EXP__=(-307)", + "__SIZEOF_LONG_LONG__=8", + "__ULACCUM_EPSILON__=0x1P-32ULK", + "__cpp_user_defined_literals=200809", + "__SACCUM_IBIT__=8", + "__GCC_ATOMIC_LLONG_LOCK_FREE=1", + "__FLT32X_MIN__=2.2250738585072014e-308F32x", + "__LDBL_DIG__=15", + "__FLT_DECIMAL_DIG__=9", + "__UINT_FAST16_MAX__=0xffffffffU", + "__GCC_ATOMIC_SHORT_LOCK_FREE=1", + "__INT_LEAST64_WIDTH__=64", + "__ULLFRACT_MAX__=0XFFFFFFFFFFFFFFFFP-64ULLR", + "__UINT_FAST8_TYPE__=unsigned int", + "__USFRACT_EPSILON__=0x1P-8UHR", + "__ULACCUM_FBIT__=32", + "__QQ_IBIT__=0", + "__cpp_init_captures=201304", + "__ATOMIC_ACQ_REL=4", + "__ATOMIC_RELEASE=3", + "USBCON" + ] + } + ] +} +\ No newline at end of file diff --git a/5g-board/5g-board.ino b/5g-board/5g-board.ino @@ -1,126 +1,134 @@ -#define usbSerial SerialUSB +#define usbSerial SerialUSB #define modemSerial Serial1 -#define powerPin SARA_ENABLE -#define enablePin SARA_TX_ENABLE -#define voltagePin SARA_R4XX_TOGGLE -#define baud 115200 +#define powerPin SARA_ENABLE +#define enablePin SARA_TX_ENABLE +#define voltagePin SARA_R4XX_TOGGLE +#define baud 115200 -#define COMMAND_OK 0 +#define COMMAND_OK 0 #define COMMAND_ERROR 1 #define LINE_BUFFER 256 #define SIM_PIN "0000" -#define APN_DOMAIN "live.vodafone.com" +//#define APN_DOMAIN "live.vodafone.com" +#define APN_DOMAIN "nb.inetd.gdsp" size_t modemReadline(char* dest) { - char buf; - size_t index = 0; - - for (;;) { - while (!modemSerial.available()); - buf = modemSerial.read(); - if (buf == '\r') - continue; - if (buf == '\n') - break; - dest[index++] = buf; - } - dest[index] = '\0'; - return index; + char buf; + size_t index = 0; + + for (;;) { + while (!modemSerial.available()) + ; + buf = modemSerial.read(); + if (buf == '\r') + continue; + if (buf == '\n') + break; + dest[index++] = buf; + } + dest[index] = '\0'; + return index; } // sendCommand returns COMMAND_OK or COMMAND_ERROR int sendCommand(const char* request, char* response) { - char line[LINE_BUFFER]; - size_t lineLen; - - if (response) - response[0] = '\0'; - - modemSerial.write(request); - modemSerial.write("\r\n"); - modemSerial.flush(); - - for (;;) { - lineLen = modemReadline(line); - if (String(line) == "OK") { - return COMMAND_OK; - } else if (String(line) == "ERROR") { - return COMMAND_ERROR; - } else if (response && line[0] != '\0') { - if (response[0] != '\0') // check if not empty string - strcat(response, "\n"); - strcat(response, line); - } - } + char line[LINE_BUFFER]; + size_t lineLen; + + if (response) + response[0] = '\0'; + + modemSerial.write(request); + modemSerial.write("\r\n"); + modemSerial.flush(); + + for (;;) { + lineLen = modemReadline(line); + if (String(line) == "OK") { + return COMMAND_OK; + } else if (String(line) == "ERROR") { + return COMMAND_ERROR; + } else if (response && line[0] != '\0') { + if (response[0] != '\0') // check if not empty string + strcat(response, "\n"); + strcat(response, line); + } + } + delay(100); // wait 1/10 } int sendCommand(const char* request) { - return sendCommand(request, NULL); + return sendCommand(request, NULL); } void setup() { - pinMode(powerPin, OUTPUT); // Put voltage on the nb-iot module - digitalWrite(powerPin, HIGH); - - pinMode(voltagePin, OUTPUT); // Switch module voltage - digitalWrite(voltagePin, LOW); - - pinMode(enablePin, OUTPUT); // Set state to active - digitalWrite(enablePin, HIGH); - - usbSerial.begin(baud); - while (!usbSerial); - - modemSerial.begin(baud); - while (!modemSerial); - - - usbSerial.print("[INFO] Waiting for module to response"); - for (;;) { - usbSerial.print('.'); - modemSerial.write("AT\r\n"); - delay(500); - if (modemSerial.available()) - break; - } - while (modemSerial.available()) // clear cache - modemSerial.read(); - usbSerial.println(); - - sendCommand("ATE0"); // disable command-echo - - if (sendCommand("AT+CPIN=\"" SIM_PIN "\"") == COMMAND_ERROR) { - usbSerial.println("[ERROR] SIM can't be unlocked, wrong PIN"); - return; - } - - sendCommand("AT+CPSMS=0"); // Disable Power Saving Mode - sendCommand("AT+CEDRXS=0"); // Disable eDRX - - sendCommand("AT+CFUN=15"); // Reset the module - sendCommand("AT+UMNOPROF=1"); // Set MNO profile (1=automatic,100=standard europe) - sendCommand("AT+URAT=7"); // Set URAT to LTE-M - sendCommand("AT+CEREG=3"); // Enable URCs - sendCommand("AT+CGDCONT=1,\"IP\",\"" APN_DOMAIN "\""); // Set the APN - sendCommand("AT+COPS=0,2"); // Autoselect the operator - - usbSerial.println("Waiting..."); - - char response[100]; - while (sendCommand("AT+CSQ", response) == COMMAND_OK && strcmp(response, "+CSQ: 99,99")); // Check Siganl strenght, repeat till you have a valid CSQ (99,99 means no signal) - while (sendCommand("AT+CGATT?", response) == COMMAND_OK && !strcmp(responhse, "+CGATT: 1")); // Check Siganl strenght, repeat till you have a valid CSQ (99,99 means no signal) - - usbSerial.println("Connected!"); + pinMode(powerPin, OUTPUT); // Put voltage on the nb-iot module + pinMode(voltagePin, OUTPUT); // Switch module voltage + pinMode(enablePin, OUTPUT); // Set state to active + + digitalWrite(powerPin, HIGH); + digitalWrite(voltagePin, LOW); + digitalWrite(enablePin, HIGH); + + usbSerial.begin(baud); + while (!usbSerial) + ; + + modemSerial.begin(baud); + while (!modemSerial) + ; + + + usbSerial.print("[INFO] Waiting for module to response"); + for (;;) { + usbSerial.print('.'); + modemSerial.write("AT\r\n"); + delay(100); + if (modemSerial.available()) + break; + } + while (modemSerial.available()) // clear cache + modemSerial.read(); + usbSerial.println(); + + sendCommand("ATE0"); // disable command-echo + + usbSerial.println("[INFO] Disabled command-echo"); + + if (sendCommand("AT+CPIN=\"" SIM_PIN "\"") == COMMAND_ERROR) { + usbSerial.println("[ERROR] SIM can't be unlocked, wrong PIN"); + return; + } + + sendCommand("AT+CPSMS=0"); // Disable Power Saving Mode + sendCommand("AT+CEDRXS=0"); // Disable eDRX + + sendCommand("AT+CFUN=15"); // Reset the module + sendCommand("AT+UMNOPROF=1"); // Set MNO profile (1=automatic,100=standard europe) + sendCommand("AT+URAT=7"); // Set URAT to LTE-M + sendCommand("AT+CEREG=3"); // Enable URCs + sendCommand("AT+CGDCONT=1,\"IP\",\"" APN_DOMAIN "\""); // Set the APN + sendCommand("AT+COPS=0,2"); // Autoselect the operator + + usbSerial.println("Waiting..."); + + // char response[100]; + // while (sendCommand("AT+CSQ", response) == COMMAND_OK && strcmp(response, "+CSQ: 99,99")) + // ; // Check Siganl strenght, repeat till you have a valid CSQ (99,99 means no signal) + // while (sendCommand("AT+CGATT?", response) == COMMAND_OK && !strcmp(response, "+CGATT: 1")) + // ; // Check Siganl strenght, repeat till you have a valid CSQ (99,99 means no signal) + + usbSerial.println("Connected!"); } void loop() { - while (usbSerial.available()) - modemSerial.write(usbSerial.read()); - - while (modemSerial.available()) - usbSerial.write(modemSerial.read()); + while (usbSerial.available()) + modemSerial.write(usbSerial.read()); + + while (modemSerial.available()) + usbSerial.write(modemSerial.read()); }