├── .gitignore ├── .mbedignore ├── .travis.yml ├── Gemfile ├── LICENSE ├── contributing.md ├── design_goals.md ├── doxygen ├── .gitignore ├── Doxyfile ├── DoxygenLayout.xml ├── Makefile ├── conf.py ├── footer.html ├── header.html ├── html │ └── .gitignore ├── index.rst ├── mainpage.md └── style.css ├── examples ├── chip_interface │ ├── .mbedignore │ ├── bin │ │ └── .gitignore │ ├── build │ │ └── .gitignore │ ├── interrupt_example.c │ ├── makefile │ ├── read_example.c │ ├── set_mode_example.c │ └── write_example.c ├── doxygen │ ├── .mbedignore │ ├── bin │ │ └── .gitignore │ ├── build │ │ └── .gitignore │ ├── example.c │ └── makefile ├── mbed │ ├── .gitignore │ ├── Dockerfile │ ├── bare_metal │ │ ├── .gitignore │ │ ├── lora_device_lib.lib │ │ ├── main.cpp │ │ ├── mbed-os.lib │ │ ├── mbed_app.json │ │ └── readme.md │ ├── makefile │ ├── readme.md │ ├── rtos │ │ ├── .gitignore │ │ ├── lora_device_lib.lib │ │ ├── main.cpp │ │ ├── mbed_app.json │ │ └── readme.md │ └── targets │ │ ├── bm_lrwan1.mk │ │ ├── bm_wl55.mk │ │ ├── readme.md │ │ ├── rtos_sx126x.mk │ │ ├── rtos_sx1272.mk │ │ └── rtos_wl55.mk └── ruby │ ├── Gemfile │ ├── example.rb │ └── readme.md ├── history.md ├── include ├── ldl_aes.h ├── ldl_chip.h ├── ldl_cmac.h ├── ldl_ctr.h ├── ldl_debug.h ├── ldl_frame.h ├── ldl_internal.h ├── ldl_mac.h ├── ldl_mac_commands.h ├── ldl_mac_internal.h ├── ldl_ops.h ├── ldl_platform.h ├── ldl_radio.h ├── ldl_radio_defs.h ├── ldl_region.h ├── ldl_sm.h ├── ldl_sm_internal.h ├── ldl_stream.h ├── ldl_sx126x.h ├── ldl_sx127x.h └── ldl_system.h ├── ldl.gemspec ├── mbed_lib.json ├── pclint ├── environment │ ├── .gitignore │ └── co-gcc.mak ├── makefile ├── readme.md ├── report │ └── .gitignore └── settings │ ├── au-misra3.lnt │ ├── co-gcc.h │ └── co-gcc.lnt ├── porting.md ├── rakefile ├── readme.md ├── src ├── ldl_aes.c ├── ldl_cmac.c ├── ldl_ctr.c ├── ldl_frame.c ├── ldl_mac.c ├── ldl_mac_commands.c ├── ldl_ops.c ├── ldl_radio.c ├── ldl_region.c ├── ldl_sm.c ├── ldl_stream.c ├── ldl_sx126x.c └── ldl_sx127x.c ├── test ├── bin │ └── .gitignore ├── build │ └── .gitignore ├── debug_include.h ├── makefile ├── mock_ldl_system.c ├── mock_ldl_system.h ├── tc_aes.c ├── tc_cmac.c ├── tc_dummy.c ├── tc_frame.c ├── tc_frame_with_encryption.c ├── tc_mac_commands.c └── tc_timer.c ├── todo.md ├── vendor └── cmocka │ ├── .clang_complete │ ├── .gitignore │ ├── .ycm_extra_conf.py │ ├── AUTHORS │ ├── CMakeLists.txt │ ├── COPYING │ ├── CPackConfig.cmake │ ├── CTestConfig.cmake │ ├── ChangeLog │ ├── ConfigureChecks.cmake │ ├── DefineOptions.cmake │ ├── INSTALL │ ├── NEWS │ ├── README │ ├── cmake │ └── Modules │ │ ├── AddCMockaTest.cmake │ │ ├── COPYING-CMAKE-SCRIPTS │ │ ├── CheckCCompilerFlagSSP.cmake │ │ ├── DefineCMakeDefaults.cmake │ │ ├── DefineCompilerFlags.cmake │ │ ├── DefineInstallationPaths.cmake │ │ ├── DefinePlatformDefaults.cmake │ │ ├── FindNSIS.cmake │ │ ├── MacroEnsureOutOfSourceBuild.cmake │ │ └── UseDoxygen.cmake │ ├── cmocka-build-tree-settings.cmake.in │ ├── cmocka-config-version.cmake.in │ ├── cmocka-config.cmake.in │ ├── cmocka.pc.cmake │ ├── config.h.cmake │ ├── coverity │ ├── README │ ├── coverity_assert_model.c │ └── coverity_internal_model.c │ ├── doc │ ├── CMakeLists.txt │ ├── Doxyfile.in │ ├── index.html │ └── mainpage.dox │ ├── example │ ├── CMakeLists.txt │ ├── allocate_module.c │ ├── allocate_module_test.c │ ├── assert_macro.c │ ├── assert_macro.h │ ├── assert_macro_test.c │ ├── assert_module.c │ ├── assert_module.h │ ├── assert_module_test.c │ ├── calculator.c │ ├── calculator_test.c │ ├── chef_wrap │ │ ├── CMakeLists.txt │ │ ├── chef.c │ │ ├── chef.h │ │ ├── waiter_test_wrap.c │ │ └── waiter_test_wrap.h │ ├── customer_database.c │ ├── customer_database_test.c │ ├── database.h │ ├── key_value.c │ ├── key_value.h │ ├── key_value_test.c │ ├── product_database.c │ ├── product_database_test.c │ └── simple_test.c │ ├── include │ ├── CMakeLists.txt │ ├── cmocka.h │ ├── cmocka_pbc.h │ ├── cmocka_private.h │ └── cmockery │ │ ├── cmockery.h │ │ └── pbc.h │ ├── src │ ├── CMakeLists.txt │ ├── cmocka.c │ └── cmocka.def │ ├── test_ordering_fail.c │ └── tests │ ├── CMakeLists.txt │ ├── ctest-default.cmake │ ├── test_alloc.c │ ├── test_assert_macros.c │ ├── test_assert_macros_fail.c │ ├── test_basics.c │ ├── test_cmockery.c │ ├── test_exception_handler.c │ ├── test_fixtures.c │ ├── test_group_fixtures.c │ ├── test_group_setup_assert.c │ ├── test_group_setup_fail.c │ ├── test_groups.c │ ├── test_ordering.c │ ├── test_ordering_fail.c │ ├── test_returns.c │ ├── test_returns_fail.c │ ├── test_setup_fail.c │ └── test_skip.c ├── version └── wrappers ├── mbed ├── _device.h ├── default_sm.cpp ├── default_sm.h ├── default_store.h ├── device.cpp ├── hw │ ├── cmwx1zzabz.h │ ├── nucleo_wl55jc.h │ ├── readme.md │ ├── sx126xmb2xas.h │ └── sx1272mb2xas.h ├── mac.cpp ├── mac.h ├── mbed_ldl.h ├── mbed_ldl_port.cpp ├── mbed_ldl_port.h ├── radio.cpp ├── radio.h ├── readme.md ├── sm.cpp ├── sm.h ├── spi_radio.cpp ├── spi_radio.h ├── store.h ├── sx1261.h ├── sx1262.h ├── sx126x.cpp ├── sx126x.h ├── sx1272.h ├── sx1276.h ├── sx127x.cpp ├── sx127x.h ├── wl55.cpp └── wl55.h └── ruby ├── ext └── ldl │ └── ext_ldl │ ├── ext_ldl.c │ ├── ext_ldl.h │ ├── ext_mac.c │ ├── ext_mac.h │ ├── ext_radio.c │ ├── ext_radio.h │ ├── ext_sm.c │ ├── ext_sm.h │ ├── extconf.rb │ └── platform.h ├── lib ├── ldl.rb ├── ldl │ ├── clock.rb │ ├── composite_logger.rb │ ├── device.rb │ ├── error.rb │ ├── eui.rb │ ├── frame_logger.rb │ ├── gateway.rb │ ├── key.rb │ ├── location.rb │ ├── logger_methods.rb │ ├── lora_assert.rb │ ├── lora_error.rb │ ├── mac.rb │ ├── radio.rb │ ├── radio_model.rb │ ├── scenario.rb │ ├── semtech.rb │ ├── semtech │ │ ├── message.rb │ │ ├── pull_ack.rb │ │ ├── pull_data.rb │ │ ├── pull_resp.rb │ │ ├── push_ack.rb │ │ ├── push_data.rb │ │ ├── rx_packet.rb │ │ ├── semtech_forwarder_format.md │ │ ├── status_packet.rb │ │ ├── tx_ack.rb │ │ ├── tx_packet.rb │ │ └── tx_packet_ack.rb │ └── version.rb ├── small_event.rb ├── small_event │ └── version.rb ├── timeout_queue.rb └── timeout_queue │ └── version.rb └── test ├── clock_test.rb ├── gateway_test.rb ├── pull_ack_test.rb ├── pull_data_test.rb ├── pull_resp_test.rb ├── push_ack_test.rb ├── push_data_test.rb ├── rx_packet_test.rb ├── status_packet_test.rb ├── tx_ack_test.rb ├── tx_packet_ack_test.rb └── tx_packet_test.rb /.gitignore: -------------------------------------------------------------------------------- 1 | *.map 2 | *.elf 3 | *.gem 4 | *.o 5 | *.so 6 | *.dll 7 | *.sublime* 8 | tmp/* 9 | !.gitignore 10 | Gemfile.lock 11 | .yardoc 12 | secrets 13 | */**/.git 14 | doxygen/deploy 15 | BUILD 16 | mbed-os 17 | .mbed 18 | -------------------------------------------------------------------------------- /.mbedignore: -------------------------------------------------------------------------------- 1 | doxygen/* 2 | pclint/* 3 | secrets/* 4 | test/* 5 | vendor/* 6 | wrappers/ruby/* 7 | examples/* 8 | tmp/* 9 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | notifications: 2 | email: false 3 | language: C 4 | sudo: required 5 | branches: 6 | only: 7 | - master 8 | script: 9 | - cd $TRAVIS_BUILD_DIR/test && make build_and_run 10 | - cd $TRAVIS_BUILD_DIR/examples/doxygen && make example 11 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | gemspec 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017-2021 Cameron Harper 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | -------------------------------------------------------------------------------- /contributing.md: -------------------------------------------------------------------------------- 1 | Contribution Guidelines 2 | ======================= 3 | 4 | ## How Can I Contribute? 5 | 6 | ### Bug Reports and Fixes 7 | 8 | Raise an issue, and if you have a fix, make a pull request. 9 | 10 | ### Documentation Improvements 11 | 12 | Raise an issue if it's complicated. 13 | 14 | Make a pull request if it's simple. 15 | 16 | ### Feature Requests and Proposals 17 | 18 | Raise an issue. 19 | 20 | ### Questions / Clarifications 21 | 22 | Raise an issue. 23 | 24 | ### Feature Contributions 25 | 26 | It is important to find out if you contribution will be accepted before 27 | you spend time implementing it. 28 | 29 | Feature contributions are likely be rejected if: 30 | 31 | - They introduce significant complexity that must be maintained to support a niche usecase 32 | - They conflict with something already in development in a local branch 33 | 34 | ## Code Style 35 | 36 | Try your best to use the same style as the rest of your project. Contributions that 37 | have a significantly different style will be nitpicked. 38 | 39 | The following patterns are encouraged: 40 | 41 | - one return per function (although this is not always possible) 42 | - one break per loop (although this is not always possible) 43 | - do not allow switch cases to fall-through 44 | - always wrap blocks in braces (e.g. if, else, while) 45 | - configure your editor to remove trailing whitespace 46 | - goto is forbidden 47 | - spaces not tabs 48 | - four space indent 49 | - don't break long lines if they are more readable unbroken 50 | 51 | ## Pull Requests 52 | 53 | Pull requests should explain what the change is and why you've made it. 54 | 55 | Commit comments should describe the change that is made. 56 | 57 | In most cases multiple commits will be squashed prior to merging using 58 | the Github squash feature. 59 | 60 | ## Licensing 61 | 62 | All contributions shall be licensed the same as LDL (i.e. [MIT License](LICENSE)). 63 | 64 | -------------------------------------------------------------------------------- /design_goals.md: -------------------------------------------------------------------------------- 1 | Design Goals 2 | ============ 3 | 4 | LDL should be simple to use and port. 5 | 6 | LDL should provide minimal interfaces that line up with words used in the 7 | specification. More sophisticated interfaces should be implemented as wrappers. 8 | 9 | LDL should not repeat itself when implementing regions. All LoRaWAN regions are based on one of two patterns; fixed or 10 | programmable channels. LDL should take advantage of the overlap. 11 | 12 | It should be possible to wrap LDL in another programming language. 13 | 14 | It should be possible to run LDL with the hardware layer replaced by software. 15 | 16 | LDL should be able to share a single thread of execution with other tasks. It should: 17 | 18 | - not block 19 | - indicate when it requires prioritisation 20 | - indicate time until the next event 21 | - calculate how late it is to handling an event 22 | - compensate for timing jitter 23 | - push events to the application asynchronously 24 | 25 | LDL should fit into an existing system, the existing system should not 26 | have to fit into LDL. 27 | -------------------------------------------------------------------------------- /doxygen/.gitignore: -------------------------------------------------------------------------------- 1 | _build 2 | html 3 | -------------------------------------------------------------------------------- /doxygen/Doxyfile: -------------------------------------------------------------------------------- 1 | PROJECT_NAME = LDL 2 | PROJECT_NUMBER = $(LDL_VERSION) 3 | BRIEF_MEMBER_DESC = NO 4 | ALWAYS_DETAILED_SEC = YES 5 | FULL_PATH_NAMES = NO 6 | OPTIMIZE_OUTPUT_FOR_C = YES 7 | SORT_MEMBER_DOCS = NO 8 | SHOW_FILES = NO 9 | INPUT = ../include mainpage.md 10 | EXAMPLE_PATH = ../ 11 | USE_MDFILE_AS_MAINPAGE = mainpage.md 12 | HTML_HEADER = header.html 13 | HTML_FOOTER = footer.html 14 | HTML_STYLESHEET = style.css 15 | SEARCHENGINE = NO 16 | GENERATE_LATEX = NO 17 | PREDEFINED = DOXYGEN 18 | CLASS_DIAGRAMS = NO 19 | HAVE_DOT = NO 20 | CLASS_GRAPH = NO 21 | COLLABORATION_GRAPH = NO 22 | GROUP_GRAPHS = NO 23 | INLINE_SIMPLE_STRUCTS = YES 24 | HIDE_UNDOC_MEMBERS = YES 25 | HIDE_UNDOC_CLASSES = YES 26 | CASE_SENSE_NAMES = NO 27 | VERBATIM_HEADERS = NO 28 | SOURCE_TOOLTIPS = NO 29 | 30 | -------------------------------------------------------------------------------- /doxygen/Makefile: -------------------------------------------------------------------------------- 1 | DIR_ROOT := ../ 2 | SPACE := 3 | SPACE += 4 | 5 | SPHINXOPTS ?= 6 | SPHINXBUILD ?= sphinx-build 7 | SOURCEDIR = . 8 | BUILDDIR = _build 9 | 10 | VERSION := $(shell cat $(DIR_ROOT)/version) 11 | UMLS := $(notdir $(wildcard *.uml)) 12 | 13 | all: clean 14 | LDL_VERSION=$(VERSION) doxygen 15 | 16 | uml: $(UMLS:.uml=.png) 17 | 18 | %.png: %.uml 19 | plantuml $< 20 | 21 | clean: 22 | rm -rf html/* 23 | rm -rf _build/* 24 | 25 | deploy: all 26 | rm -rf deploy 27 | mkdir deploy 28 | git clone git@github.com:cjhdev/lora_device_lib_api.git deploy 29 | rm -r deploy/docs/* 30 | cp -r html/* deploy/docs/ 31 | git -C deploy add -A 32 | git -C deploy commit -m "update" 33 | git -C deploy push origin master 34 | 35 | help: 36 | $(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 37 | 38 | %: clean Makefile 39 | LDL_VERSION=$(VERSION) $(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 40 | 41 | .PHONY: all clean deploy help Makefile 42 | -------------------------------------------------------------------------------- /doxygen/conf.py: -------------------------------------------------------------------------------- 1 | # Configuration file for the Sphinx documentation builder. 2 | # 3 | # This file only contains a selection of the most common options. For a full 4 | # list see the documentation: 5 | # https://www.sphinx-doc.org/en/master/usage/configuration.html 6 | 7 | # -- Path setup -------------------------------------------------------------- 8 | 9 | # If extensions (or modules to document with autodoc) are in another directory, 10 | # add these directories to sys.path here. If the directory is relative to the 11 | # documentation root, use os.path.abspath to make it absolute, like shown here. 12 | # 13 | # import os 14 | # import sys 15 | # sys.path.insert(0, os.path.abspath('.')) 16 | 17 | #from sphinx.builders.html import StandaloneHTMLBuilder 18 | import subprocess, os 19 | 20 | subprocess.call('make all', shell=True) 21 | 22 | # -- Project information ----------------------------------------------------- 23 | 24 | project = 'LDL' 25 | copyright = '2021, Cameron Harper' 26 | author = 'Cameron Harper' 27 | 28 | 29 | # -- General configuration --------------------------------------------------- 30 | 31 | # Add any Sphinx extension module names here, as strings. They can be 32 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom 33 | # ones. 34 | extensions = [] 35 | 36 | # Add any paths that contain templates here, relative to this directory. 37 | templates_path = ['_templates'] 38 | 39 | # List of patterns, relative to source directory, that match files and 40 | # directories to ignore when looking for source files. 41 | # This pattern also affects html_static_path and html_extra_path. 42 | exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] 43 | 44 | highlight_language = 'C' 45 | 46 | html_extra_path = ['html'] 47 | 48 | 49 | # -- Options for HTML output ------------------------------------------------- 50 | 51 | # The theme to use for HTML and HTML Help pages. See the documentation for 52 | # a list of builtin themes. 53 | # 54 | html_theme = 'sphinx_rtd_theme' 55 | 56 | # Add any paths that contain custom static files (such as style sheets) here, 57 | # relative to this directory. They are copied after the builtin static files, 58 | # so a file named "default.css" will overwrite the builtin "default.css". 59 | html_static_path = [] 60 | 61 | -------------------------------------------------------------------------------- /doxygen/footer.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |