├── .github └── workflows │ ├── add_version.yml │ ├── build_apps.yml │ └── build_doc.yml ├── .gitignore ├── .gitmodules ├── LICENSE.txt ├── Readme.md ├── api ├── wms_advertiser.h ├── wms_app.h ├── wms_beacon_rx.h ├── wms_beacon_tx.h ├── wms_data.h ├── wms_hardware.h ├── wms_joining.h ├── wms_memory_area.h ├── wms_otap.h ├── wms_radio_config.h ├── wms_settings.h ├── wms_sleep.h ├── wms_state.h ├── wms_storage.h ├── wms_system.h └── wms_time.h ├── board ├── bgm220-ek4314a │ ├── board.h │ └── config.mk ├── board_init.c ├── board_init.h ├── efr32_template │ ├── board.h │ └── config.mk ├── makefile ├── mdbt50q_rx │ ├── board.h │ └── config.mk ├── nrf52832_mdk_v2 │ ├── board.h │ └── config.mk ├── nrf52_template │ ├── board.h │ └── config.mk ├── pan1780 │ ├── board.h │ └── config.mk ├── pca10040 │ ├── board.h │ └── config.mk ├── pca10056 │ ├── board.h │ └── config.mk ├── pca10059 │ ├── board.h │ ├── board_custom_init.c │ ├── config.mk │ └── makefile_board.mk ├── pca10100 │ ├── board.h │ └── config.mk ├── pca10112 │ ├── board.h │ ├── board_custom_init.c │ ├── config.mk │ ├── fem_driver_nrf21540.c │ └── makefile_board.mk ├── promistel_rpi_hat │ ├── board.h │ └── config.mk ├── ruuvitag │ ├── board.h │ └── config.mk ├── silabs_brd4180b │ ├── board.h │ └── config.mk ├── silabs_brd4181b │ ├── board.h │ └── config.mk ├── silabs_brd4184a │ ├── board.h │ └── config.mk ├── silabs_brd4210a │ ├── board.h │ └── config.mk ├── silabs_brd4253a │ ├── board.h │ └── config.mk ├── silabs_brd4254a │ ├── board.h │ └── config.mk ├── silabs_brd4312a │ ├── board.h │ └── config.mk ├── tbsense2 │ ├── board.h │ └── config.mk ├── ublox_b204 │ ├── board.h │ └── config.mk └── wuerth_261101102 │ ├── board.h │ └── config.mk ├── bootloader ├── bl_hardware.c ├── bl_hardware.h ├── early_init.c ├── early_init.h ├── external_flash.c ├── external_flash.h └── makefile ├── bootloader_test ├── api │ └── bl_interface.h ├── drivers │ ├── efr32 │ │ └── usart.c │ ├── nrf52 │ │ └── usart.c │ └── usart.h ├── linker │ ├── efr32 │ │ ├── gcc_bl_test_efr32xg12pxxxf1024.ld │ │ ├── gcc_bl_test_efr32xg12pxxxf512.ld │ │ ├── gcc_bl_test_efr32xg13pxxxf512.ld │ │ ├── gcc_bl_test_efr32xg21xxxxf1024.ld │ │ ├── gcc_bl_test_efr32xg22xxxxf512.ld │ │ └── gcc_bl_test_efr32xg23xxxxf512.ld │ └── nrf52 │ │ ├── gcc_bl_test_nrf52832.ld │ │ ├── gcc_bl_test_nrf52833.ld │ │ └── gcc_bl_test_nrf52840.ld ├── main.c ├── makefile ├── print │ ├── print.c │ ├── print.h │ └── syscalls.c ├── tests │ ├── test.h │ ├── test_info.c │ ├── test_memory_areas.c │ └── test_timings.c └── timing │ ├── timing.c │ └── timing.h ├── config.mk ├── doc_src_doxy ├── a1_sdk_environment.h ├── a2_how_to_develop.h ├── a3_operation_principle.h ├── a4_application_api.h ├── a5_application_examples.h └── doc.h ├── image └── readme.md ├── libraries ├── app_persistent │ ├── app_persistent.c │ └── app_persistent.h ├── config.mk ├── control_node │ ├── control_node.c │ ├── control_node.h │ ├── control_node_int.h │ ├── control_router.c │ ├── control_router.h │ └── readme.md ├── dualmcu │ ├── api │ │ ├── DualMcuAPI.md │ │ └── figures │ │ │ ├── Fig_GenFormat.png │ │ │ └── Fig_ReqConf_IndRes.png │ ├── drivers │ │ ├── efr32 │ │ │ ├── exti.c │ │ │ ├── io.c │ │ │ └── makefile │ │ ├── io.h │ │ ├── makefile │ │ └── nrf │ │ │ ├── exti.c │ │ │ ├── io.c │ │ │ └── makefile │ ├── dualmcu_lib.c │ ├── dualmcu_lib.h │ └── waps │ │ ├── comm │ │ ├── makefile │ │ ├── uart │ │ │ ├── waps_uart.c │ │ │ ├── waps_uart.h │ │ │ └── waps_uart_power.c │ │ └── waps_comm.h │ │ ├── makefile │ │ ├── protocol │ │ ├── makefile │ │ ├── uart │ │ │ ├── waps_uart_protocol.c │ │ │ └── waps_uart_protocol.h │ │ ├── waps_protocol.c │ │ ├── waps_protocol.h │ │ └── waps_protocol_private.h │ │ ├── sap │ │ ├── attribute_frames.h │ │ ├── csap.c │ │ ├── csap.h │ │ ├── csap_frames.h │ │ ├── dsap.c │ │ ├── dsap.h │ │ ├── dsap_frames.h │ │ ├── function_codes.c │ │ ├── function_codes.h │ │ ├── lock_bits.c │ │ ├── lock_bits.h │ │ ├── msap.c │ │ ├── msap.h │ │ ├── msap_frames.h │ │ ├── multicast.c │ │ ├── multicast.h │ │ ├── persistent.c │ │ └── persistent.h │ │ ├── waddr.c │ │ ├── waddr.h │ │ ├── waps.c │ │ ├── waps.h │ │ ├── waps_buffer_sizes.h │ │ ├── waps_frames.h │ │ ├── waps_item.c │ │ ├── waps_item.h │ │ └── waps_private.h ├── libraries_init.c ├── libraries_init.h ├── local_provisioning │ ├── backend_script │ │ └── local_provisioning_tool.py │ ├── local_provisioning.c │ ├── local_provisioning.h │ └── local_provisioning.md ├── makefile ├── positioning │ ├── docs │ │ └── PosLib_integration_guide.md │ ├── poslib.c │ ├── poslib.h │ └── poslib │ │ ├── poslib_ble_beacon.c │ │ ├── poslib_ble_beacon.h │ │ ├── poslib_control.c │ │ ├── poslib_control.h │ │ ├── poslib_da.c │ │ ├── poslib_da.h │ │ ├── poslib_decode.c │ │ ├── poslib_decode.h │ │ ├── poslib_event.c │ │ ├── poslib_event.h │ │ ├── poslib_mbcn.c │ │ ├── poslib_mbcn.h │ │ ├── poslib_measurement.c │ │ ├── poslib_measurement.h │ │ ├── poslib_tlv.c │ │ └── poslib_tlv.h ├── provisioning │ ├── data.c │ ├── joining.c │ ├── provisioning.c │ ├── provisioning.h │ ├── provisioning_int.h │ └── proxy.c ├── scheduler │ ├── app_scheduler.c │ └── app_scheduler.h ├── shared_appconfig │ ├── shared_appconfig.c │ ├── shared_appconfig.h │ └── shared_appconfig.md ├── shared_beacon │ ├── shared_beacon.c │ ├── shared_beacon.h │ └── shared_beacon.md ├── shared_data │ ├── shared_data.c │ └── shared_data.h ├── shared_libdata.h ├── shared_neighbors │ ├── shared_neighbors.c │ └── shared_neighbors.h ├── shared_offline │ ├── shared_offline.c │ └── shared_offline.h └── stack_state │ ├── stack_state.c │ └── stack_state.h ├── makefile ├── makefile_app.mk ├── makefile_bootloader.mk ├── makefile_bootloader_test.mk ├── makefile_common.mk ├── makefile_stack.mk ├── mcu ├── common │ ├── cmsis │ │ ├── arm_common_tables.h │ │ ├── arm_const_structs.h │ │ ├── arm_math.h │ │ ├── cmsis_armcc.h │ │ ├── cmsis_armclang.h │ │ ├── cmsis_compiler.h │ │ ├── cmsis_gcc.h │ │ ├── cmsis_iccarm.h │ │ ├── cmsis_version.h │ │ ├── core_armv8mbl.h │ │ ├── core_armv8mml.h │ │ ├── core_cm0.h │ │ ├── core_cm0plus.h │ │ ├── core_cm23.h │ │ ├── core_cm3.h │ │ ├── core_cm33.h │ │ ├── core_cm4.h │ │ ├── core_cm4_simd.h │ │ ├── core_cm7.h │ │ ├── core_cmFunc.h │ │ ├── core_cmInstr.h │ │ ├── core_sc000.h │ │ ├── core_sc300.h │ │ ├── mpu_armv7.h │ │ ├── mpu_armv8.h │ │ └── tz_context.h │ ├── entrypoint.s │ ├── makefile │ ├── radio │ │ ├── makefile │ │ └── radio.c │ └── start.c ├── efr │ ├── common │ │ ├── mcu.h │ │ └── vendor │ │ │ ├── efr32fg12 │ │ │ ├── efr32_gpio.h │ │ │ ├── efr32fg12p231f1024gl125.h │ │ │ ├── efr32fg12p231f1024gm48.h │ │ │ ├── efr32fg12p232f1024gl125.h │ │ │ ├── efr32fg12p232f1024gm48.h │ │ │ ├── efr32fg12p431f1024gl125.h │ │ │ ├── efr32fg12p431f1024gm48.h │ │ │ ├── efr32fg12p432f1024gl125.h │ │ │ ├── efr32fg12p432f1024gm48.h │ │ │ ├── efr32fg12p433f1024gl125.h │ │ │ ├── efr32fg12p433f1024gm48.h │ │ │ ├── efr32fg12p_acmp.h │ │ │ ├── efr32fg12p_adc.h │ │ │ ├── efr32fg12p_af_pins.h │ │ │ ├── efr32fg12p_af_ports.h │ │ │ ├── efr32fg12p_cmu.h │ │ │ ├── efr32fg12p_cryotimer.h │ │ │ ├── efr32fg12p_crypto.h │ │ │ ├── efr32fg12p_csen.h │ │ │ ├── efr32fg12p_devinfo.h │ │ │ ├── efr32fg12p_dma_descriptor.h │ │ │ ├── efr32fg12p_dmareq.h │ │ │ ├── efr32fg12p_emu.h │ │ │ ├── efr32fg12p_etm.h │ │ │ ├── efr32fg12p_fpueh.h │ │ │ ├── efr32fg12p_gpcrc.h │ │ │ ├── efr32fg12p_gpio.h │ │ │ ├── efr32fg12p_gpio_p.h │ │ │ ├── efr32fg12p_i2c.h │ │ │ ├── efr32fg12p_idac.h │ │ │ ├── efr32fg12p_ldma.h │ │ │ ├── efr32fg12p_ldma_ch.h │ │ │ ├── efr32fg12p_lesense.h │ │ │ ├── efr32fg12p_lesense_buf.h │ │ │ ├── efr32fg12p_lesense_ch.h │ │ │ ├── efr32fg12p_lesense_st.h │ │ │ ├── efr32fg12p_letimer.h │ │ │ ├── efr32fg12p_leuart.h │ │ │ ├── efr32fg12p_msc.h │ │ │ ├── efr32fg12p_pcnt.h │ │ │ ├── efr32fg12p_prs.h │ │ │ ├── efr32fg12p_prs_ch.h │ │ │ ├── efr32fg12p_prs_signals.h │ │ │ ├── efr32fg12p_rmu.h │ │ │ ├── efr32fg12p_romtable.h │ │ │ ├── efr32fg12p_rtcc.h │ │ │ ├── efr32fg12p_rtcc_cc.h │ │ │ ├── efr32fg12p_rtcc_ret.h │ │ │ ├── efr32fg12p_smu.h │ │ │ ├── efr32fg12p_timer.h │ │ │ ├── efr32fg12p_timer_cc.h │ │ │ ├── efr32fg12p_trng.h │ │ │ ├── efr32fg12p_usart.h │ │ │ ├── efr32fg12p_vdac.h │ │ │ ├── efr32fg12p_vdac_opa.h │ │ │ ├── efr32fg12p_wdog.h │ │ │ ├── efr32fg12p_wdog_pch.h │ │ │ ├── em_device_fg12.h │ │ │ ├── system_efr32fg12p.c │ │ │ └── system_efr32fg12p.h │ │ │ ├── efr32fg13 │ │ │ ├── efr32_gpio.h │ │ │ ├── efr32fg13p231f512gm32.h │ │ │ ├── efr32fg13p231f512gm48.h │ │ │ ├── efr32fg13p231f512im32.h │ │ │ ├── efr32fg13p231f512im48.h │ │ │ ├── efr32fg13p232f512gm32.h │ │ │ ├── efr32fg13p232f512gm48.h │ │ │ ├── efr32fg13p233f512gm48.h │ │ │ ├── efr32fg13p_acmp.h │ │ │ ├── efr32fg13p_adc.h │ │ │ ├── efr32fg13p_af_pins.h │ │ │ ├── efr32fg13p_af_ports.h │ │ │ ├── efr32fg13p_cmu.h │ │ │ ├── efr32fg13p_cryotimer.h │ │ │ ├── efr32fg13p_crypto.h │ │ │ ├── efr32fg13p_csen.h │ │ │ ├── efr32fg13p_devinfo.h │ │ │ ├── efr32fg13p_dma_descriptor.h │ │ │ ├── efr32fg13p_dmareq.h │ │ │ ├── efr32fg13p_emu.h │ │ │ ├── efr32fg13p_etm.h │ │ │ ├── efr32fg13p_fpueh.h │ │ │ ├── efr32fg13p_gpcrc.h │ │ │ ├── efr32fg13p_gpio.h │ │ │ ├── efr32fg13p_gpio_p.h │ │ │ ├── efr32fg13p_i2c.h │ │ │ ├── efr32fg13p_idac.h │ │ │ ├── efr32fg13p_ldma.h │ │ │ ├── efr32fg13p_ldma_ch.h │ │ │ ├── efr32fg13p_lesense.h │ │ │ ├── efr32fg13p_lesense_buf.h │ │ │ ├── efr32fg13p_lesense_ch.h │ │ │ ├── efr32fg13p_lesense_st.h │ │ │ ├── efr32fg13p_letimer.h │ │ │ ├── efr32fg13p_leuart.h │ │ │ ├── efr32fg13p_msc.h │ │ │ ├── efr32fg13p_pcnt.h │ │ │ ├── efr32fg13p_prs.h │ │ │ ├── efr32fg13p_prs_ch.h │ │ │ ├── efr32fg13p_prs_signals.h │ │ │ ├── efr32fg13p_rmu.h │ │ │ ├── efr32fg13p_romtable.h │ │ │ ├── efr32fg13p_rtcc.h │ │ │ ├── efr32fg13p_rtcc_cc.h │ │ │ ├── efr32fg13p_rtcc_ret.h │ │ │ ├── efr32fg13p_smu.h │ │ │ ├── efr32fg13p_timer.h │ │ │ ├── efr32fg13p_timer_cc.h │ │ │ ├── efr32fg13p_trng.h │ │ │ ├── efr32fg13p_usart.h │ │ │ ├── efr32fg13p_vdac.h │ │ │ ├── efr32fg13p_vdac_opa.h │ │ │ ├── efr32fg13p_wdog.h │ │ │ ├── efr32fg13p_wdog_pch.h │ │ │ ├── em_device_fg13.h │ │ │ ├── system_efr32fg13p.c │ │ │ └── system_efr32fg13p.h │ │ │ ├── efr32fg23 │ │ │ ├── Include │ │ │ │ ├── efr32fg23_acmp.h │ │ │ │ ├── efr32fg23_aes.h │ │ │ │ ├── efr32fg23_agc.h │ │ │ │ ├── efr32fg23_amuxcp.h │ │ │ │ ├── efr32fg23_bufc.h │ │ │ │ ├── efr32fg23_buram.h │ │ │ │ ├── efr32fg23_burtc.h │ │ │ │ ├── efr32fg23_cmu.h │ │ │ │ ├── efr32fg23_dcdc.h │ │ │ │ ├── efr32fg23_devinfo.h │ │ │ │ ├── efr32fg23_dma_descriptor.h │ │ │ │ ├── efr32fg23_dpll.h │ │ │ │ ├── efr32fg23_eca.h │ │ │ │ ├── efr32fg23_ecaifadc.h │ │ │ │ ├── efr32fg23_emu.h │ │ │ │ ├── efr32fg23_eusart.h │ │ │ │ ├── efr32fg23_frc.h │ │ │ │ ├── efr32fg23_fsrco.h │ │ │ │ ├── efr32fg23_gpcrc.h │ │ │ │ ├── efr32fg23_gpio.h │ │ │ │ ├── efr32fg23_gpio_port.h │ │ │ │ ├── efr32fg23_hfrco.h │ │ │ │ ├── efr32fg23_hfxo.h │ │ │ │ ├── efr32fg23_i2c.h │ │ │ │ ├── efr32fg23_iadc.h │ │ │ │ ├── efr32fg23_icache.h │ │ │ │ ├── efr32fg23_keyscan.h │ │ │ │ ├── efr32fg23_lcd.h │ │ │ │ ├── efr32fg23_lcdrf.h │ │ │ │ ├── efr32fg23_ldma.h │ │ │ │ ├── efr32fg23_ldmaxbar.h │ │ │ │ ├── efr32fg23_ldmaxbar_defines.h │ │ │ │ ├── efr32fg23_lesense.h │ │ │ │ ├── efr32fg23_letimer.h │ │ │ │ ├── efr32fg23_lfrco.h │ │ │ │ ├── efr32fg23_lfxo.h │ │ │ │ ├── efr32fg23_mailbox.h │ │ │ │ ├── efr32fg23_modem.h │ │ │ │ ├── efr32fg23_mpahbram.h │ │ │ │ ├── efr32fg23_msc.h │ │ │ │ ├── efr32fg23_pcnt.h │ │ │ │ ├── efr32fg23_pfmxpprf.h │ │ │ │ ├── efr32fg23_protimer.h │ │ │ │ ├── efr32fg23_prs.h │ │ │ │ ├── efr32fg23_prs_signals.h │ │ │ │ ├── efr32fg23_rac.h │ │ │ │ ├── efr32fg23_rfcrc.h │ │ │ │ ├── efr32fg23_scratchpad.h │ │ │ │ ├── efr32fg23_semailbox.h │ │ │ │ ├── efr32fg23_smu.h │ │ │ │ ├── efr32fg23_synth.h │ │ │ │ ├── efr32fg23_syscfg.h │ │ │ │ ├── efr32fg23_sysrtc.h │ │ │ │ ├── efr32fg23_timer.h │ │ │ │ ├── efr32fg23_ulfrco.h │ │ │ │ ├── efr32fg23_usart.h │ │ │ │ ├── efr32fg23_vdac.h │ │ │ │ ├── efr32fg23_wdog.h │ │ │ │ ├── efr32fg23a010f128gm40.h │ │ │ │ ├── efr32fg23a010f256gm40.h │ │ │ │ ├── efr32fg23a010f256gm48.h │ │ │ │ ├── efr32fg23a010f512gm40.h │ │ │ │ ├── efr32fg23a010f512gm48.h │ │ │ │ ├── efr32fg23a011f512gm40.h │ │ │ │ ├── efr32fg23a020f128gm40.h │ │ │ │ ├── efr32fg23a020f256gm40.h │ │ │ │ ├── efr32fg23a020f256gm48.h │ │ │ │ ├── efr32fg23a020f512gm40.h │ │ │ │ ├── efr32fg23a020f512gm48.h │ │ │ │ ├── efr32fg23a021f512gm40.h │ │ │ │ ├── efr32fg23b010f128gm40.h │ │ │ │ ├── efr32fg23b010f512gm48.h │ │ │ │ ├── efr32fg23b010f512im40.h │ │ │ │ ├── efr32fg23b010f512im48.h │ │ │ │ ├── efr32fg23b020f128gm40.h │ │ │ │ ├── efr32fg23b020f512im40.h │ │ │ │ ├── efr32fg23b020f512im48.h │ │ │ │ ├── em_device.h │ │ │ │ └── system_efr32fg23.h │ │ │ ├── Source │ │ │ │ ├── GCC │ │ │ │ │ ├── efr32fg23.ld │ │ │ │ │ ├── startup_efr32fg23.S │ │ │ │ │ └── startup_efr32fg23.c │ │ │ │ └── system_efr32fg23.c │ │ │ └── efr32_gpio.h │ │ │ ├── efr32mg21 │ │ │ ├── Include │ │ │ │ ├── efr32mg21_acmp.h │ │ │ │ ├── efr32mg21_aes.h │ │ │ │ ├── efr32mg21_agc.h │ │ │ │ ├── efr32mg21_amuxcp.h │ │ │ │ ├── efr32mg21_bufc.h │ │ │ │ ├── efr32mg21_buram.h │ │ │ │ ├── efr32mg21_burtc.h │ │ │ │ ├── efr32mg21_cmu.h │ │ │ │ ├── efr32mg21_devinfo.h │ │ │ │ ├── efr32mg21_dma_descriptor.h │ │ │ │ ├── efr32mg21_dpll.h │ │ │ │ ├── efr32mg21_emu.h │ │ │ │ ├── efr32mg21_frc.h │ │ │ │ ├── efr32mg21_fsrco.h │ │ │ │ ├── efr32mg21_gpcrc.h │ │ │ │ ├── efr32mg21_gpio.h │ │ │ │ ├── efr32mg21_gpio_port.h │ │ │ │ ├── efr32mg21_hfrco.h │ │ │ │ ├── efr32mg21_hfxo.h │ │ │ │ ├── efr32mg21_i2c.h │ │ │ │ ├── efr32mg21_iadc.h │ │ │ │ ├── efr32mg21_icache.h │ │ │ │ ├── efr32mg21_ldma.h │ │ │ │ ├── efr32mg21_ldmaxbar.h │ │ │ │ ├── efr32mg21_ldmaxbar_defines.h │ │ │ │ ├── efr32mg21_letimer.h │ │ │ │ ├── efr32mg21_lfrco.h │ │ │ │ ├── efr32mg21_lfxo.h │ │ │ │ ├── efr32mg21_lvgd.h │ │ │ │ ├── efr32mg21_modem.h │ │ │ │ ├── efr32mg21_msc.h │ │ │ │ ├── efr32mg21_protimer.h │ │ │ │ ├── efr32mg21_prs.h │ │ │ │ ├── efr32mg21_prs_signals.h │ │ │ │ ├── efr32mg21_rac.h │ │ │ │ ├── efr32mg21_rfcrc.h │ │ │ │ ├── efr32mg21_rtcc.h │ │ │ │ ├── efr32mg21_semailbox.h │ │ │ │ ├── efr32mg21_smu.h │ │ │ │ ├── efr32mg21_synth.h │ │ │ │ ├── efr32mg21_syscfg.h │ │ │ │ ├── efr32mg21_timer.h │ │ │ │ ├── efr32mg21_ulfrco.h │ │ │ │ ├── efr32mg21_usart.h │ │ │ │ ├── efr32mg21_wdog.h │ │ │ │ ├── efr32mg21a010f1024im32.h │ │ │ │ ├── efr32mg21a010f512im32.h │ │ │ │ ├── efr32mg21a010f768im32.h │ │ │ │ ├── efr32mg21a020f1024im32.h │ │ │ │ ├── efr32mg21a020f512im32.h │ │ │ │ ├── efr32mg21a020f768im32.h │ │ │ │ ├── efr32mg21b010f1024im32.h │ │ │ │ ├── efr32mg21b010f512im32.h │ │ │ │ ├── efr32mg21b010f768im32.h │ │ │ │ ├── efr32mg21b020f1024im32.h │ │ │ │ ├── efr32mg21b020f512im32.h │ │ │ │ ├── efr32mg21b020f768im32.h │ │ │ │ ├── em_device.h │ │ │ │ ├── rm21z000f1024im32.h │ │ │ │ └── system_efr32mg21.h │ │ │ ├── Source │ │ │ │ ├── GCC │ │ │ │ │ ├── efr32mg21.ld │ │ │ │ │ ├── startup_efr32mg21.S │ │ │ │ │ └── startup_efr32mg21.c │ │ │ │ └── system_efr32mg21.c │ │ │ └── efr32_gpio.h │ │ │ ├── efr32mg22 │ │ │ ├── Include │ │ │ │ ├── efr32mg22_aes.h │ │ │ │ ├── efr32mg22_agc.h │ │ │ │ ├── efr32mg22_amuxcp.h │ │ │ │ ├── efr32mg22_bufc.h │ │ │ │ ├── efr32mg22_buram.h │ │ │ │ ├── efr32mg22_burtc.h │ │ │ │ ├── efr32mg22_cmu.h │ │ │ │ ├── efr32mg22_cryptoacc.h │ │ │ │ ├── efr32mg22_dcdc.h │ │ │ │ ├── efr32mg22_devinfo.h │ │ │ │ ├── efr32mg22_dma_descriptor.h │ │ │ │ ├── efr32mg22_dpll.h │ │ │ │ ├── efr32mg22_emu.h │ │ │ │ ├── efr32mg22_eusart.h │ │ │ │ ├── efr32mg22_frc.h │ │ │ │ ├── efr32mg22_fsrco.h │ │ │ │ ├── efr32mg22_gpcrc.h │ │ │ │ ├── efr32mg22_gpio.h │ │ │ │ ├── efr32mg22_gpio_port.h │ │ │ │ ├── efr32mg22_hfrco.h │ │ │ │ ├── efr32mg22_hfxo.h │ │ │ │ ├── efr32mg22_i2c.h │ │ │ │ ├── efr32mg22_iadc.h │ │ │ │ ├── efr32mg22_icache.h │ │ │ │ ├── efr32mg22_ldma.h │ │ │ │ ├── efr32mg22_ldmaxbar.h │ │ │ │ ├── efr32mg22_ldmaxbar_defines.h │ │ │ │ ├── efr32mg22_letimer.h │ │ │ │ ├── efr32mg22_lfrco.h │ │ │ │ ├── efr32mg22_lfxo.h │ │ │ │ ├── efr32mg22_mailbox.h │ │ │ │ ├── efr32mg22_modem.h │ │ │ │ ├── efr32mg22_msc.h │ │ │ │ ├── efr32mg22_pdm.h │ │ │ │ ├── efr32mg22_protimer.h │ │ │ │ ├── efr32mg22_prs.h │ │ │ │ ├── efr32mg22_prs_signals.h │ │ │ │ ├── efr32mg22_rac.h │ │ │ │ ├── efr32mg22_rfcrc.h │ │ │ │ ├── efr32mg22_rfsense.h │ │ │ │ ├── efr32mg22_rtcc.h │ │ │ │ ├── efr32mg22_smu.h │ │ │ │ ├── efr32mg22_synth.h │ │ │ │ ├── efr32mg22_syscfg.h │ │ │ │ ├── efr32mg22_timer.h │ │ │ │ ├── efr32mg22_ulfrco.h │ │ │ │ ├── efr32mg22_usart.h │ │ │ │ ├── efr32mg22_wdog.h │ │ │ │ ├── efr32mg22a224f512im40.h │ │ │ │ ├── efr32mg22c224f512gn32.h │ │ │ │ ├── efr32mg22c224f512im32.h │ │ │ │ ├── efr32mg22c224f512im40.h │ │ │ │ ├── em_device.h │ │ │ │ └── system_efr32mg22.h │ │ │ ├── Source │ │ │ │ ├── GCC │ │ │ │ │ ├── efr32mg22.ld │ │ │ │ │ ├── startup_efr32mg22.S │ │ │ │ │ └── startup_efr32mg22.c │ │ │ │ └── system_efr32mg22.c │ │ │ └── efr32_gpio.h │ │ │ ├── em_adc.c │ │ │ ├── em_adc.h │ │ │ ├── em_assert.h │ │ │ ├── em_bus.h │ │ │ ├── em_chip.h │ │ │ ├── em_cmu.c │ │ │ ├── em_cmu.h │ │ │ ├── em_cmu_compat.h │ │ │ ├── em_common.h │ │ │ ├── em_core.c │ │ │ ├── em_core.h │ │ │ ├── em_device.h │ │ │ ├── em_emu.c │ │ │ ├── em_emu.h │ │ │ ├── em_gpio.c │ │ │ ├── em_gpio.h │ │ │ ├── em_iadc.c │ │ │ ├── em_iadc.h │ │ │ ├── em_ldma.c │ │ │ ├── em_ldma.h │ │ │ ├── em_prs.c │ │ │ ├── em_prs.h │ │ │ ├── em_ramfunc.h │ │ │ ├── em_system.h │ │ │ ├── em_usart.c │ │ │ ├── em_usart.h │ │ │ └── rail_lib │ │ │ ├── chip │ │ │ └── efr32 │ │ │ │ └── efr32xg2x │ │ │ │ └── rail_chip_specific.h │ │ │ └── common │ │ │ ├── rail_features.h │ │ │ └── rail_types.h │ ├── efr32 │ │ ├── config.mk │ │ ├── hal │ │ │ ├── board_usart.h │ │ │ ├── button.c │ │ │ ├── ds.c │ │ │ ├── hal.c │ │ │ ├── i2c.c │ │ │ ├── led.c │ │ │ ├── makefile │ │ │ ├── power.c │ │ │ ├── radio │ │ │ │ ├── radio_power_table_efr32xg12_19dBm.h │ │ │ │ ├── radio_power_table_efr32xg21_20dbm.h │ │ │ │ ├── radio_power_table_efr32xg23_13dbm.h │ │ │ │ ├── radio_power_table_efr32xg23_16dbm.h │ │ │ │ └── radio_power_table_efr32xg23_20dbm.h │ │ │ ├── uniqueId.h │ │ │ ├── usart.c │ │ │ ├── usart_dma.c │ │ │ └── voltage.c │ │ ├── ini_files │ │ │ ├── efr32xg12pxxxf1024_app.ini │ │ │ ├── efr32xg12pxxxf1024_wp.ini │ │ │ ├── efr32xg12pxxxf512_app.ini │ │ │ ├── efr32xg12pxxxf512_wp.ini │ │ │ ├── efr32xg21xxxxf1024_app.ini │ │ │ ├── efr32xg21xxxxf1024_wp.ini │ │ │ ├── efr32xg21xxxxf512_app.ini │ │ │ ├── efr32xg21xxxxf512_wp.ini │ │ │ ├── efr32xg21xxxxf768_app.ini │ │ │ ├── efr32xg21xxxxf768_wp.ini │ │ │ ├── efr32xg22xxxxf512_app.ini │ │ │ ├── efr32xg22xxxxf512_wp.ini │ │ │ ├── efr32xg23xxxxf512_app.ini │ │ │ └── efr32xg23xxxxf512_wp.ini │ │ └── linker │ │ │ ├── gcc_app_efr32xg12pxxxf1024.ld │ │ │ ├── gcc_app_efr32xg12pxxxf512.ld │ │ │ ├── gcc_app_efr32xg21xxxxf1024.ld │ │ │ ├── gcc_app_efr32xg21xxxxf512.ld │ │ │ ├── gcc_app_efr32xg21xxxxf768.ld │ │ │ ├── gcc_app_efr32xg22xxxxf512.ld │ │ │ ├── gcc_app_efr32xg23xxxxf512.ld │ │ │ ├── gcc_bl_efr32xg12pxxxf1024.ld │ │ │ ├── gcc_bl_efr32xg12pxxxf512.ld │ │ │ ├── gcc_bl_efr32xg21xxxxf1024.ld │ │ │ ├── gcc_bl_efr32xg21xxxxf512.ld │ │ │ ├── gcc_bl_efr32xg21xxxxf768.ld │ │ │ ├── gcc_bl_efr32xg22xxxxf512.ld │ │ │ └── gcc_bl_efr32xg23xxxxf512.ld │ └── makefile ├── hal_api │ ├── button.h │ ├── ds.h │ ├── hal_api.h │ ├── hw_delay.h │ ├── i2c.h │ ├── led.h │ ├── makefile │ ├── persistent.h │ ├── power.h │ ├── radio.h │ ├── spi.h │ ├── usart.h │ └── voltage.h └── nrf │ ├── common │ ├── hal │ │ ├── button.c │ │ ├── ds.c │ │ ├── hal.c │ │ ├── hw_delay.c │ │ ├── led.c │ │ ├── persistent.c │ │ └── spi.c │ ├── mcu.h │ └── vendor │ │ ├── drivers │ │ ├── nrfx_common.h │ │ └── nrfx_errors.h │ │ ├── get_vendor_files.py │ │ ├── get_vendor_files.sh │ │ ├── hal │ │ ├── nrf_common.h │ │ ├── nrf_gpio.h │ │ ├── nrf_gpiote.h │ │ ├── nrf_spim.h │ │ ├── nrf_timer.h │ │ └── nrf_uarte.h │ │ ├── mdk │ │ ├── compiler_abstraction.h │ │ ├── nrf.h │ │ ├── nrf51_to_nrf52.h │ │ ├── nrf51_to_nrf52840.h │ │ ├── nrf52.h │ │ ├── nrf52832_peripherals.h │ │ ├── nrf52833.h │ │ ├── nrf52833_bitfields.h │ │ ├── nrf52833_peripherals.h │ │ ├── nrf52840.h │ │ ├── nrf52840_bitfields.h │ │ ├── nrf52840_peripherals.h │ │ ├── nrf52_bitfields.h │ │ ├── nrf52_name_change.h │ │ ├── nrf52_to_nrf52833.h │ │ ├── nrf52_to_nrf52840.h │ │ ├── nrf9160.h │ │ ├── nrf9160_bitfields.h │ │ ├── nrf9160_name_change.h │ │ ├── nrf9160_peripherals.h │ │ ├── nrf_peripherals.h │ │ ├── system_nrf.h │ │ ├── system_nrf52.h │ │ ├── system_nrf52833.h │ │ ├── system_nrf52840.h │ │ └── system_nrf9160.h │ │ ├── nrfx.h │ │ └── templates │ │ ├── nrfx_config.h │ │ ├── nrfx_config_nrf52832.h │ │ ├── nrfx_config_nrf52833.h │ │ ├── nrfx_config_nrf52840.h │ │ ├── nrfx_config_nrf9160.h │ │ └── nrfx_glue.h │ ├── makefile │ ├── nrf52 │ ├── config.mk │ ├── hal │ │ ├── i2c.c │ │ ├── makefile │ │ ├── power.c │ │ ├── radio │ │ │ └── radio_power_table_nrf52840_4dBm.h │ │ ├── uniqueId.h │ │ ├── usart.c │ │ ├── usart_dma.c │ │ ├── usart_usb.c │ │ ├── usb_uart │ │ │ ├── dcd_nrf5x.c │ │ │ ├── makefile │ │ │ ├── tusb_config.h │ │ │ ├── usb_descriptors.c │ │ │ ├── usb_wrapper.c │ │ │ └── usb_wrapper.h │ │ ├── voltage_52832.c │ │ └── voltage_52833_52840.c │ ├── ini_files │ │ ├── nrf52832_app.ini │ │ ├── nrf52832_wp.ini │ │ ├── nrf52833_app.ini │ │ ├── nrf52833_wp.ini │ │ ├── nrf52840_app.ini │ │ └── nrf52840_wp.ini │ └── linker │ │ ├── gcc_app_nrf52832.ld │ │ ├── gcc_app_nrf52833.ld │ │ ├── gcc_app_nrf52840.ld │ │ ├── gcc_bl_nrf52832.ld │ │ ├── gcc_bl_nrf52833.ld │ │ └── gcc_bl_nrf52840.ld │ └── nrf91 │ ├── config.mk │ ├── hal │ ├── i2c.c │ ├── makefile │ ├── power.c │ ├── uniqueId.h │ └── usart_dma.c │ ├── ini_files │ ├── nrf9160_app.ini │ ├── nrf9160_platform.ini │ └── nrf9160_wp.ini │ └── linker │ ├── gcc_app_nrf9160.ld │ └── gcc_bl_nrf9160.ld ├── projects └── doxygen │ ├── Dockerfile │ ├── Doxyfile.template │ ├── DoxygenLayout.xml │ ├── footer.html │ ├── generate_doxy.sh │ ├── header.html │ ├── media │ ├── addressing.png │ ├── alert.jpg │ ├── communication_directions.png │ ├── image1.png │ ├── image3.png │ ├── image4.png │ ├── image5.png │ ├── image6.png │ ├── image7.png │ ├── image8.png │ ├── main_components.png │ └── small_logo.png │ ├── search.js │ ├── template │ ├── doc.tex │ ├── preamble.tex │ └── wm-logo.png │ └── wirepas_custom.css ├── source ├── Readme.md ├── example_apps │ ├── Readme.md │ ├── battery_voltage_read_app │ │ ├── Readme.md │ │ ├── app.c │ │ ├── config.mk │ │ └── makefile │ ├── ble_scanner │ │ ├── app.c │ │ ├── backend_scripts │ │ │ ├── beacon_scanner_config.py │ │ │ └── beacon_scanner_rx.py │ │ ├── ble_scanner.c │ │ ├── ble_scanner.h │ │ ├── config.mk │ │ ├── config_dualmcu.mk │ │ └── makefile │ ├── control_node │ │ ├── app.c │ │ ├── common.h │ │ ├── config.mk │ │ ├── makefile │ │ └── readme.md │ ├── control_router │ │ ├── app.c │ │ ├── config.mk │ │ ├── makefile │ │ └── readme.md │ ├── custom_app │ │ ├── app.c │ │ ├── config.mk │ │ └── makefile │ ├── evaluation_app │ │ ├── Readme.md │ │ ├── app.c │ │ ├── backend_scripts │ │ │ ├── Readme.md │ │ │ └── script_evaluation_app.py │ │ ├── config.mk │ │ └── makefile │ ├── low_latency_app │ │ ├── Readme.md │ │ ├── app.c │ │ ├── backend_scripts │ │ │ ├── Readme.md │ │ │ └── script_lowlatency_app.py │ │ ├── config.mk │ │ └── makefile │ ├── minimal_app │ │ ├── app.c │ │ ├── config.mk │ │ └── makefile │ └── ruuvi_evk │ │ ├── app.c │ │ ├── app_config.c │ │ ├── bme280_wrapper.c │ │ ├── config.mk │ │ ├── docs │ │ ├── Dockerfile │ │ ├── Doxyfile │ │ ├── censored_ruuvi_app_note.rst │ │ ├── generate_doxy.sh │ │ ├── ruuvi_application_note.pdf │ │ ├── ruuvi_evk.pdf │ │ ├── template │ │ │ ├── doc.tex │ │ │ ├── preamble.tex │ │ │ └── wm-logo.png │ │ └── wirepas_logo_2016_slogan_RGB.png │ │ ├── format_data.c │ │ ├── helpers │ │ ├── README.md │ │ ├── README.pdf │ │ ├── app_config_generator.py │ │ ├── appconfig.yaml │ │ └── requirements.txt │ │ ├── include │ │ ├── app_config.h │ │ ├── bme280_wrapper.h │ │ ├── format_data.h │ │ ├── lis2dh12_wrapper.h │ │ └── main_page.h │ │ ├── lis2dh12_wrapper.c │ │ └── makefile ├── reference_apps │ ├── Readme.md │ ├── dualmcu_app │ │ ├── app.c │ │ ├── config.mk │ │ ├── gencustomscratchpad.py │ │ └── makefile │ └── positioning_app │ │ ├── app.c │ │ ├── config.mk │ │ ├── docs │ │ └── PosApp_guide.md │ │ ├── gpio.h │ │ ├── gpio_efr32.c │ │ ├── gpio_nrf52.c │ │ ├── makefile │ │ ├── motion │ │ ├── acc_interface.h │ │ ├── lis2 │ │ │ ├── lis2_dev.h │ │ │ ├── lis2_dev_i2c.c │ │ │ ├── lis2_dev_spi.c │ │ │ ├── lis2dh12_wrapper.c │ │ │ ├── lis2dh12_wrapper.h │ │ │ ├── lis2dw12_wrapper.c │ │ │ └── lis2dw12_wrapper.h │ │ ├── makefile_motion.mk │ │ ├── motion.c │ │ └── motion.h │ │ ├── persistent_config │ │ ├── config.yml │ │ ├── config_v2.yml │ │ ├── genConfigHex.py │ │ ├── layout_v1.yml │ │ ├── layout_v2.yml │ │ └── requirements.txt │ │ ├── posapp_settings.c │ │ └── posapp_settings.h └── unitary_apps │ ├── Readme.md │ ├── aes │ ├── app.c │ ├── config.mk │ └── makefile │ ├── app_persistent │ ├── README.md │ ├── app.c │ ├── config.mk │ └── makefile │ ├── appconfig │ ├── app.c │ ├── config.mk │ └── makefile │ ├── basic_interrupt │ ├── app.c │ ├── config.mk │ └── makefile │ ├── ble_tx │ ├── app.c │ ├── config.mk │ └── makefile │ ├── blink │ ├── app.c │ ├── config.mk │ └── makefile │ ├── diradv │ ├── app.c │ ├── config.mk │ └── makefile │ ├── local_provisioning │ ├── app.c │ ├── config.mk │ └── makefile │ ├── nfc │ ├── app.c │ ├── config.mk │ ├── drivers │ │ ├── makefile │ │ └── nrf52 │ │ │ └── nfc_hw.c │ ├── lib │ │ ├── ndef.c │ │ ├── ndef.h │ │ ├── nfc_hw.h │ │ ├── t2_emulation.c │ │ ├── t2_emulation.h │ │ ├── tlv.c │ │ └── tlv.h │ └── makefile │ ├── provisioning_joining_node │ ├── app.c │ ├── config.mk │ ├── config.yml │ ├── config_insecure.yml │ ├── config_secure.yml │ ├── genConfigHex.py │ ├── makefile │ ├── storage.h │ ├── storage_chipid.c │ └── storage_memarea.c │ ├── provisioning_proxy │ ├── app.c │ ├── config.mk │ └── makefile │ ├── scheduler │ ├── app.c │ ├── config.mk │ └── makefile │ ├── shared_data │ ├── README.md │ ├── app.c │ ├── config.mk │ └── makefile │ └── tinycbor │ ├── app.c │ ├── config.mk │ └── makefile ├── tools ├── bootloader_config.py ├── check_python.py ├── dependency.json ├── firmware_selector.py ├── genhex.py ├── genscratchpad.py ├── hextoarray32.py ├── hextool.py ├── scratchpadinfo.py ├── sdk_builder.py ├── sdk_explorer.py └── sdk_wizard.py ├── util ├── aessw.c ├── aessw.h ├── api.c ├── api.h ├── bitfield.h ├── crc.c ├── crc.h ├── debug_log.h ├── doublebuffer.h ├── makefile ├── node_configuration.h ├── pack.c ├── pack.h ├── random.c ├── random.h ├── ringbuffer.h ├── sl_list.c ├── sl_list.h ├── syscalls.c ├── tinyaes │ ├── .gitignore │ ├── CMakeLists.txt │ ├── Makefile │ ├── README.md │ ├── aes.c │ ├── aes.h │ ├── aes.hpp │ ├── conanfile.py │ ├── library.json │ ├── test.c │ ├── test.cpp │ ├── test_package │ │ ├── CMakeLists.txt │ │ └── conanfile.py │ └── unlicense.txt ├── tinycbor │ ├── .appveyor.yml │ ├── .tag │ ├── .travis.yml │ ├── Doxyfile │ ├── LICENSE │ ├── Makefile │ ├── README │ ├── TODO │ ├── VERSION │ ├── examples │ │ ├── examples.pro │ │ ├── simplereader.c │ │ └── simplereader.pro │ ├── scripts │ │ ├── maketag.pl │ │ └── update-docs.sh │ ├── src │ │ ├── cbor.dox │ │ ├── cbor.h │ │ ├── cborencoder.c │ │ ├── cborencoder_close_container_checked.c │ │ ├── cborerrorstrings.c │ │ ├── cborinternal_p.h │ │ ├── cborjson.h │ │ ├── cborparser.c │ │ ├── cborparser_dup_string.c │ │ ├── cborpretty.c │ │ ├── cborpretty_stdio.c │ │ ├── cbortojson.c │ │ ├── cborvalidation.c │ │ ├── compilersupport_p.h │ │ ├── open_memstream.c │ │ ├── parsetags.pl │ │ ├── src.pri │ │ ├── tags.txt │ │ ├── tinycbor-version.h │ │ ├── tinycbor.pro │ │ └── utf8_p.h │ ├── tests │ │ ├── c90 │ │ │ ├── c90.pro │ │ │ └── tst_c90.c │ │ ├── cpp │ │ │ ├── cpp.pro │ │ │ └── tst_cpp.cpp │ │ ├── encoder │ │ │ ├── encoder.pro │ │ │ └── tst_encoder.cpp │ │ ├── parser │ │ │ ├── parser.pro │ │ │ └── tst_parser.cpp │ │ ├── tests.pro │ │ └── tojson │ │ │ ├── tojson.pro │ │ │ └── tst_tojson.cpp │ ├── tinycbor.pc.in │ └── tools │ │ ├── cbordump │ │ ├── cbordump.c │ │ └── cbordump.pro │ │ └── json2cbor │ │ ├── json2cbor.c │ │ └── json2cbor.pro ├── tlv.c ├── tlv.h ├── uart_print.c ├── uart_print.h ├── util.c └── util.h └── version.txt /.github/workflows/add_version.yml: -------------------------------------------------------------------------------- 1 | name: Commit version to master 2 | on: 3 | push: 4 | branches: [ master ] 5 | 6 | jobs: 7 | date: 8 | runs-on: ubuntu-latest 9 | steps: 10 | # Checkout the branch 11 | - name: checkout 12 | uses: actions/checkout@v2 13 | - name: save current date 14 | run: | 15 | # Add date to file 16 | date > version.txt 17 | # Add the sha1 of change that triggered this workflow 18 | echo $GITHUB_SHA >> version.txt 19 | - name: setup git config 20 | run: | 21 | git config user.name "GitHub Actions" 22 | git config user.email "<>" 23 | - name: commit 24 | run: | 25 | # Stage the file, commit and push 26 | git add version.txt 27 | git commit -m "Update version.txt to keep track of version when SDK is downloaded (without git)" 28 | git push origin master 29 | -------------------------------------------------------------------------------- /.github/workflows/build_apps.yml: -------------------------------------------------------------------------------- 1 | name: Build all apps 2 | 3 | on: 4 | push: 5 | branches: [ master ] 6 | pull_request: 7 | branches: [ master ] 8 | 9 | jobs: 10 | build: 11 | 12 | runs-on: ubuntu-latest 13 | container: 14 | image: wirepas/sdk-builder:v1.3 15 | options: --user 0 16 | 17 | steps: 18 | - uses: actions/checkout@v2 19 | - name: Accept license 20 | run: touch .license_accepted 21 | - name: Create dummy key file 22 | run: | 23 | touch custom_bootloader_keys.ini 24 | echo "[key:default]" >> custom_bootloader_keys.ini 25 | echo "auth = 01 02 03 04 05 06 07 08 01 02 03 04 05 06 07 08" >> custom_bootloader_keys.ini 26 | echo "encrypt = 01 02 03 04 05 06 07 08 01 02 03 04 05 06 07 08" >> custom_bootloader_keys.ini 27 | - name: Build all apps 28 | run: ./tools/sdk_builder.py --app_only 29 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | #exclude licensed wirepas binaries 2 | image/* 3 | 4 | #but include the README still 5 | !image/readme.md 6 | 7 | #exclude license acceptance 8 | .license_accepted 9 | 10 | #do not commit the build outputs 11 | build/ 12 | 13 | #don't commit sensitive bootoader keys 14 | custom_bootloader_keys.ini 15 | 16 | *.pyc 17 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "projects/doxygen/doxygen-awesome-css"] 2 | path = projects/doxygen/doxygen-awesome-css 3 | url = https://github.com/jothepro/doxygen-awesome-css.git 4 | -------------------------------------------------------------------------------- /board/bgm220-ek4314a/board.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | 7 | /** 8 | * @file 9 | * 10 | * Board definition for a Silabs' board named as "Explorer Kit BGM220 Module" 11 | * Part number BGM220-EK4314A 12 | */ 13 | #ifndef BOARD_BGM220_EK4314A_BOARD_H_ 14 | #define BOARD_BGM220_EK4314A_BOARD_H_ 15 | 16 | // Waps usart defines 17 | #define BOARD_USART_ID 0 18 | 19 | #define BOARD_USART_GPIO_PORT GPIO_PORTA 20 | #define BOARD_USART_TX_PIN 5 21 | #define BOARD_USART_RX_PIN 6 22 | 23 | // List of GPIO ports and pins for the LEDs on the board: 24 | #define BOARD_LED_PIN_LIST {{GPIO_PORTA, 4}} 25 | 26 | // Active high polarity for LEDs 27 | #define BOARD_LED_ACTIVE_LOW false 28 | 29 | // List of ext. ints, GPIO ports and pins for buttons on the board: 30 | // NOTE! EFR32xG22 can wake up from deep sleep (EM2) using GPIO input trigger 31 | // only from A or B ports. Having the button in port C prevents button 32 | // to be used for waking up from deep sleep. 33 | #define BOARD_BUTTON_PIN_LIST {{4, GPIO_PORTC, 7}} 34 | 35 | // Active low polarity for buttons 36 | #define BOARD_BUTTON_ACTIVE_LOW true 37 | 38 | // Board has external pull-up for buttons 39 | #define BOARD_BUTTON_INTERNAL_PULL false 40 | 41 | // Buttons use even external interrupts 42 | #define BOARD_BUTTON_USE_EVEN_INT true 43 | 44 | // Buttons use even external interrupts 45 | //#define BOARD_BUTTON_USE_EVEN_INT true 46 | 47 | #endif /* BOARD_BGM220_EK4314A_BOARD_H_ */ 48 | -------------------------------------------------------------------------------- /board/bgm220-ek4314a/config.mk: -------------------------------------------------------------------------------- 1 | # Mcu of the board 2 | MCU_FAMILY=efr 3 | MCU=efr32 4 | MCU_SUB=xg22 5 | MCU_MEM_VAR=xxxxf512 6 | 7 | # Radio of the module on the board 8 | radio=bgm220pc22hna 9 | 10 | # Hardware capabilities of the board 11 | ## Is 32kHz crystal mounted on the board. 12 | board_hw_crystal_32k=yes 13 | ## Is DCDC used on this board (must be yes for efr32xg22). 14 | board_hw_dcdc=yes 15 | ## HFXO crystal characteristics 16 | board_hw_hfxo_ctune=120 17 | ## LFXO crystal characteristics 18 | board_hw_lfxo_ctune=37 19 | board_hw_lfxo_gain=1 20 | -------------------------------------------------------------------------------- /board/board_init.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | #include "board_init.h" 7 | #include "board.h" 8 | #include "power.h" 9 | #include "radio.h" 10 | 11 | /* Declaration of weak a custom board initialization that 12 | * can be overwritten for each board under board//board_custom_init.c 13 | */ 14 | void Board_custom_init(void) __attribute__((weak)); 15 | 16 | void Board_init(void) 17 | { 18 | Board_custom_init(); 19 | 20 | /* Needed for nodes flashed prior SDK v1.2 (with bootloader < v7). */ 21 | #if defined(NRF52) 22 | Power_enableDCDC(); 23 | #endif 24 | 25 | Radio_init(); 26 | } 27 | -------------------------------------------------------------------------------- /board/board_init.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | 7 | #ifndef BOARD_INIT_H_ 8 | #define BOARD_INIT_H_ 9 | 10 | /** 11 | * \brief Generic Board initialization 12 | */ 13 | void Board_init(void); 14 | 15 | #endif /* POWER_H_ */ 16 | -------------------------------------------------------------------------------- /board/efr32_template/config.mk: -------------------------------------------------------------------------------- 1 | # This definition describes mcu family. 2 | MCU_FAMILY=efr 3 | 4 | # This definition describes processor architecture. 5 | # Valid value: efr32 for EFR32 based boards 6 | MCU=efr32 7 | 8 | # This describes the sub-architecture of the processor. Allowed values are 9 | # following: xg12,xg21,xg22 10 | MCU_SUB=xg12 11 | 12 | # This definitions describes the processor memory variant. It is only used when 13 | # @ref config_mk_mcu "MCU" is efr32. 14 | # Valid values are following: 15 | # - pxxxf512 For 512 kB flash memory variant (xg12) 16 | # - xxxxf512 For 512 kB flash memory variant (xg22) 17 | # - pxxxf1024 For 1024 kB flash memory variant (xg12) 18 | # - xxxxf1024 For 1024 kB flash memory variant (xg21) 19 | MCU_MEM_VAR=pxxxf1024 20 | 21 | # Which radio version to use (different stack binary) 22 | # Must be set only for xg21 and xg22 only 23 | # Allowed values are following for xg21: efr32xg21, bgm210pa22jia 24 | # Allowed values are following for xg22: efr32xg22, bgm220pc22hna 25 | # radio= 26 | 27 | # This describes the hardware capabilities of the board 28 | # (this is used to customize the hardware service of the bootloader). 29 | ## Is 32kHz crystal mounted on the board? default:yes, possible values:yes, no 30 | board_hw_crystal_32k=yes 31 | ## Is DCDC to be enabled on the board? default:yes, possible values:yes, no 32 | ## (it replaces MCU_NO_DCDC define in ./board/bootlaoder/early_init_efr32.c) 33 | board_hw_dcdc=yes 34 | ## HFXO crystal characteristics 35 | board_hw_hfxo_ctune=322 36 | ## LFXO crystal characteristics 37 | board_hw_lfxo_ctune=68 38 | board_hw_lfxo_gain=2 39 | -------------------------------------------------------------------------------- /board/makefile: -------------------------------------------------------------------------------- 1 | INCLUDES += -Iboard/ 2 | 3 | SRCS += board/board_init.c 4 | 5 | # Include custom board makefile, where board specific source files can be added 6 | # Does nothing, if file does not exist 7 | -include $(BOARD_FOLDER)/makefile_board.mk 8 | 9 | # HARDWARE CAPABILITIES # 10 | ## Is 32kHz crystal mounted on the board? default:yes, possible values:yes, no 11 | ifeq ("$(board_hw_crystal_32k)","yes") 12 | CFLAGS += -DBOARD_HW_CRYSTAL_32K=1 13 | else ifeq ("$(board_hw_crystal_32k)","no") 14 | CFLAGS += -DBOARD_HW_CRYSTAL_32K=0 15 | else 16 | $(error board_hw_crystal_32k must be defined to yes or no) 17 | endif 18 | 19 | ## Is DCDC used on this board? default:yes, possible values:yes, no 20 | ifeq ("$(board_hw_dcdc)","yes") 21 | CFLAGS += -DBOARD_HW_DCDC=1 22 | else ifeq ("$(board_hw_dcdc)","no") 23 | CFLAGS += -DBOARD_HW_DCDC=0 24 | else 25 | $(error board_hw_dcdc must be defined to yes or no) 26 | endif 27 | 28 | ## HFXO crystal characteristics on this board 29 | ifdef board_hw_hfxo_ctune 30 | CFLAGS += -DBOARD_HW_HFXO_CTUNE=$(board_hw_hfxo_ctune) 31 | endif 32 | 33 | ## LFXO crystal characteristics on this board 34 | ifdef board_hw_lfxo_ctune 35 | CFLAGS += -DBOARD_HW_LFXO_CTUNE=$(board_hw_lfxo_ctune) 36 | endif 37 | ifdef board_hw_lfxo_gain 38 | CFLAGS += -DBOARD_HW_LFXO_GAIN=$(board_hw_lfxo_gain) 39 | endif 40 | -------------------------------------------------------------------------------- /board/mdbt50q_rx/board.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | 7 | /** 8 | * @file 9 | * 10 | * Board definition for the 11 | * Raytac MDBT50Q-RX dongle 12 | */ 13 | #ifndef BOARD_MDBT50Q_RX_H_ 14 | #define BOARD_MDBT50Q_RX_H_ 15 | 16 | 17 | // Serial port 18 | // There is no serial port but a USB connection 19 | 20 | 21 | // List of GPIO pins for the LEDs on the board: LED 1 P1.13 to LED 2 P1.11 22 | #define BOARD_LED_PIN_LIST {45, 43} 23 | 24 | // Active low polarity for LEDs 25 | #define BOARD_LED_ACTIVE_LOW true 26 | 27 | // List of GPIO pins for buttons on the board: Button 1 to Button 4 28 | #define BOARD_BUTTON_PIN_LIST {15} 29 | 30 | // Active low polarity for buttons 31 | #define BOARD_BUTTON_ACTIVE_LOW true 32 | 33 | // Active internal pull-up for buttons 34 | #define BOARD_BUTTON_INTERNAL_PULL true 35 | 36 | // The board supports DCDC (#define BOARD_SUPPORT_DCDC) 37 | // Since SDK v1.2 (stack v5.1.x) this option has been move to 38 | // board//config.mk. Set board_hw_dcdc to yes to enable DCDC. 39 | #ifdef BOARD_SUPPORT_DCDC 40 | #error This option has been moved to board//config.mk 41 | #endif 42 | 43 | #endif /* BOARD_MDBT50Q_RX_H_ */ 44 | -------------------------------------------------------------------------------- /board/mdbt50q_rx/config.mk: -------------------------------------------------------------------------------- 1 | # Mcu of the board 2 | MCU_FAMILY=nrf 3 | MCU=nrf52 4 | MCU_SUB=840 5 | 6 | # Hardware capabilities of the board 7 | ## Is 32kHz crystal mounted on the board. 8 | board_hw_crystal_32k=yes 9 | ## Is DCDC used on this board. 10 | board_hw_dcdc=yes 11 | 12 | uart_use_usb=yes 13 | 14 | # To be changed 15 | usb_vid=0xf00d 16 | usb_manufacturer_str="Raytac Wirepas" 17 | usb_product_str="Raytac Wirepas Dongle" 18 | 19 | # Uncomment, and set path to custom power table here, if set, the custom power 20 | # table will be set during application startup, and the stack will use that 21 | # instead of the default 22 | # For convenience, an example of a +4dBm power table is provided, uncomment the 23 | # line below to use that instead of the default +8dBm power table 24 | #RADIO_CUSTOM_POWER_TABLE=mcu/nrf/nrf52/hal/radio/radio_power_table_nrf52840_4dBm.h 25 | -------------------------------------------------------------------------------- /board/nrf52832_mdk_v2/board.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | 7 | /** 8 | * @file 9 | * 10 | * Board definition for the 11 | * nrf52832-MDK V2 kit 12 | */ 13 | 14 | #ifndef _BOARD_NRF52832_MDK_V2_BOARD_H_ 15 | #define _BOARD_NRF52832_MDK_V2_BOARD_H_ 16 | 17 | // Serial port pins 18 | #define BOARD_USART_TX_PIN 20 19 | #define BOARD_USART_RX_PIN 19 20 | 21 | // List of GPIO pins for the LEDs on the board: LED R, G, B 22 | #define BOARD_LED_PIN_LIST {23, 22, 24} 23 | 24 | // Active low polarity for LEDs 25 | #define BOARD_LED_ACTIVE_LOW true 26 | 27 | // The board supports DCDC (#define BOARD_SUPPORT_DCDC) 28 | // Since SDK v1.2 (bootloader > v7) this option has been move to 29 | // board//config.mk. 30 | #ifdef BOARD_SUPPORT_DCDC 31 | #error This option has been moved to board//config.mk 32 | #endif 33 | 34 | #endif /* _BOARD_NRF52832_MDK_V2_BOARD_H_ */ 35 | -------------------------------------------------------------------------------- /board/nrf52832_mdk_v2/config.mk: -------------------------------------------------------------------------------- 1 | # Mcu of the board 2 | MCU_FAMILY=nrf 3 | MCU=nrf52 4 | MCU_SUB=832 5 | 6 | # Hardware capabilities of the board 7 | ## Is 32kHz crystal mounted on the board. 8 | board_hw_crystal_32k=yes 9 | ## Is DCDC used on this board. 10 | board_hw_dcdc=yes -------------------------------------------------------------------------------- /board/nrf52_template/config.mk: -------------------------------------------------------------------------------- 1 | # This definition describes mcu family. 2 | MCU_FAMILY=nrf 3 | 4 | # This definition describes processor architecture. 5 | # Valid value: nrf52 for nRF52 based boards 6 | MCU=nrf52 7 | 8 | # This describes the sub-architecture of the processor. Allowed values are 9 | # following: 832,840 10 | MCU_SUB=832 11 | 12 | # This describes the hardware capabilities of the board 13 | # (this is used to customize the hardware service of the bootloader). 14 | ## Is 32kHz crystal mounted on the board? default:yes, possible values:yes, no 15 | board_hw_crystal_32k=yes 16 | ## Is DCDC to be enabled on the board? default:yes, possible values:yes, no 17 | ## (it replaces BOARD_SUPPORT_DCDC define in board.h) 18 | board_hw_dcdc=yes 19 | -------------------------------------------------------------------------------- /board/pan1780/config.mk: -------------------------------------------------------------------------------- 1 | # Mcu of the board 2 | MCU_FAMILY=nrf 3 | MCU=nrf52 4 | MCU_SUB=840 5 | 6 | # Hardware capabilities of the board 7 | ## Is 32kHz crystal mounted on the board. 8 | board_hw_crystal_32k=yes 9 | ## Is DCDC used on this board. 10 | board_hw_dcdc=yes 11 | 12 | # Uncomment, and set path to custom power table here, if set, the custom power 13 | # table will be set during application startup, and the stack will use that 14 | # instead of the default 15 | # For convenience, an example of a +4dBm power table is provided, uncomment the 16 | # line below to use that instead of the default +8dBm power table 17 | #RADIO_CUSTOM_POWER_TABLE=mcu/nrf/nrf52/hal/radio/radio_power_table_nrf52840_4dBm.h 18 | -------------------------------------------------------------------------------- /board/pca10040/config.mk: -------------------------------------------------------------------------------- 1 | # Mcu of the board 2 | MCU_FAMILY=nrf 3 | MCU=nrf52 4 | MCU_SUB=832 5 | 6 | # Hardware capabilities of the board 7 | ## Is 32kHz crystal mounted on the board. 8 | board_hw_crystal_32k=yes 9 | ## Is DCDC used on this board. 10 | board_hw_dcdc=yes -------------------------------------------------------------------------------- /board/pca10056/config.mk: -------------------------------------------------------------------------------- 1 | # Mcu of the board 2 | MCU_FAMILY=nrf 3 | MCU=nrf52 4 | MCU_SUB=840 5 | 6 | # Hardware capabilities of the board 7 | ## Is 32kHz crystal mounted on the board. 8 | board_hw_crystal_32k=yes 9 | ## Is DCDC used on this board. 10 | board_hw_dcdc=yes 11 | 12 | # Uncomment, and set path to custom power table here, if set, the custom power 13 | # table will be set during application startup, and the stack will use that 14 | # instead of the default 15 | # For convenience, an example of a +4dBm power table is provided, uncomment the 16 | # line below to use that instead of the default +8dBm power table 17 | #RADIO_CUSTOM_POWER_TABLE=mcu/nrf/nrf52/hal/radio/radio_power_table_nrf52840_4dBm.h 18 | -------------------------------------------------------------------------------- /board/pca10059/board_custom_init.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | 7 | #include "api.h" 8 | 9 | void Board_custom_init() 10 | { 11 | // Mark two channels as reserved 12 | // In fact because of hardware issue, channels BLE #13 (2432 MHz) 13 | // and BLE #29 (2464 MHz) are unusable. 14 | // It corresponds to channel #14 and #30 in Wirepas space. 15 | 16 | // It doesn't prevent usage of those channels by other boards in the 17 | // network but at least this board will prevent the usage of those channels 18 | // for its own cluster channel. 19 | uint8_t res_chns[4]; 20 | 21 | // Channel 1 is bit 0 of byte 0 : 22 | // - channel 14 is bit 5 (14 mod 8) of byte 1 (14 / 8) 23 | // - channel 30 is bit 5 (30 mod 8) of byte 3 (30 / 8) 24 | 25 | res_chns[0] = 0; 26 | res_chns[1] = 1 << 5; 27 | res_chns[2] = 0; 28 | res_chns[3] = 1 << 5; 29 | 30 | lib_settings->setReservedChannels(res_chns, sizeof(res_chns)); 31 | } 32 | 33 | -------------------------------------------------------------------------------- /board/pca10059/config.mk: -------------------------------------------------------------------------------- 1 | # Mcu of the board 2 | MCU_FAMILY=nrf 3 | MCU=nrf52 4 | MCU_SUB=840 5 | 6 | # Hardware capabilities of the board 7 | ## Is 32kHz crystal mounted on the board. 8 | board_hw_crystal_32k=yes 9 | ## Is DCDC used on this board. 10 | board_hw_dcdc=yes 11 | 12 | # Uncomment, and set path to custom power table here, if set, the custom power 13 | # table will be set during application startup, and the stack will use that 14 | # instead of the default 15 | # For convenience, an example of a +4dBm power table is provided, uncomment the 16 | # line below to use that instead of the default +8dBm power table 17 | #RADIO_CUSTOM_POWER_TABLE=mcu/nrf/nrf52/hal/radio/radio_power_table_nrf52840_4dBm.h 18 | -------------------------------------------------------------------------------- /board/pca10059/makefile_board.mk: -------------------------------------------------------------------------------- 1 | # Add board specific sources here, if any 2 | SRCS += board/$(target_board)/board_custom_init.c 3 | -------------------------------------------------------------------------------- /board/pca10100/config.mk: -------------------------------------------------------------------------------- 1 | # Mcu of the board 2 | MCU_FAMILY=nrf 3 | MCU=nrf52 4 | MCU_SUB=833 5 | 6 | # Hardware capabilities of the board 7 | ## Is 32kHz crystal mounted on the board. 8 | board_hw_crystal_32k=yes 9 | ## Is DCDC used on this board. 10 | board_hw_dcdc=yes -------------------------------------------------------------------------------- /board/pca10112/board_custom_init.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | 7 | #include "mcu.h" 8 | #include "board.h" 9 | 10 | void Board_custom_init(void) 11 | { 12 | // This board requires FEM driver, as there is no bypass mode. The stack 13 | // _must_ control it for the RF to work. 14 | Fem_init(); 15 | } 16 | 17 | -------------------------------------------------------------------------------- /board/pca10112/config.mk: -------------------------------------------------------------------------------- 1 | # Mcu of the board 2 | MCU_FAMILY=nrf 3 | MCU=nrf52 4 | MCU_SUB=840 5 | 6 | # Hardware capabilities of the board 7 | ## Is 32kHz crystal mounted on the board. 8 | board_hw_crystal_32k=yes 9 | ## Is DCDC used on this board. 10 | board_hw_dcdc=yes 11 | -------------------------------------------------------------------------------- /board/pca10112/makefile_board.mk: -------------------------------------------------------------------------------- 1 | 2 | # Add board specific sources here, if any 3 | SRCS += board/$(target_board)/board_custom_init.c \ 4 | board/$(target_board)/fem_driver_nrf21540.c 5 | -------------------------------------------------------------------------------- /board/promistel_rpi_hat/config.mk: -------------------------------------------------------------------------------- 1 | # Mcu of the board 2 | MCU_FAMILY=nrf 3 | MCU=nrf52 4 | MCU_SUB=840 5 | 6 | # Hardware capabilities of the board 7 | ## Is 32kHz crystal mounted on the board. 8 | board_hw_crystal_32k=yes 9 | ## Is DCDC used on this board. 10 | board_hw_dcdc=yes -------------------------------------------------------------------------------- /board/ruuvitag/board.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | 7 | /** 8 | * @file 9 | * 10 | * Board definition for the 11 | * Ruuvitag device 12 | */ 13 | #ifndef BOARD_RUUVITAG_H_ 14 | #define BOARD_RUUVITAG_H_ 15 | 16 | // Define the SPI instance to use 17 | #define USE_SPI0 18 | // SPI Port pins 19 | #define BOARD_SPI_SCK_PIN 29 20 | #define BOARD_SPI_MOSI_PIN 25 21 | #define BOARD_SPI_MISO_PIN 28 22 | 23 | // SPI Chip Select for various sensor 24 | #define BOARD_SPI_LIS2DH12_CS_PIN 8 25 | #define BOARD_SPI_BME280_CS_PIN 3 26 | 27 | // INT pins 28 | #define BOARD_LIS2DH12_INT1_PIN 2 29 | //#define BOARD_LIS2DH12_INT2_PIN 6 30 | 31 | 32 | 33 | // List of GPIO pins for the LEDs on the board: LED1, LED2 34 | #define BOARD_LED_PIN_LIST {17, 19} 35 | 36 | // Active low polarity for LEDs 37 | #define BOARD_LED_ACTIVE_LOW true 38 | 39 | // List of GPIO pins for buttons on the board: Button1 40 | #define BOARD_BUTTON_PIN_LIST {13} 41 | 42 | // Active low polarity for buttons 43 | #define BOARD_BUTTON_ACTIVE_LOW true 44 | 45 | // Active internal pull-up for buttons 46 | #define BOARD_BUTTON_INTERNAL_PULL true 47 | 48 | // The board supports DCDC (#define BOARD_SUPPORT_DCDC) 49 | // Since SDK v1.2 (bootloader > v7) this option has been move to 50 | // board//config.mk. Set board_hw_dcdc to yes to enable DCDC. 51 | #ifdef BOARD_SUPPORT_DCDC 52 | #error This option has been moved to board//config.mk 53 | #endif 54 | 55 | 56 | #endif /* BOARD_RUUVITAG_H_ */ 57 | -------------------------------------------------------------------------------- /board/ruuvitag/config.mk: -------------------------------------------------------------------------------- 1 | # Mcu of the board 2 | MCU_FAMILY=nrf 3 | MCU=nrf52 4 | MCU_SUB=832 5 | 6 | # Hardware capabilities of the board 7 | ## Is 32kHz crystal mounted on the board. 8 | board_hw_crystal_32k=yes 9 | ## Is DCDC used on this board. 10 | board_hw_dcdc=yes -------------------------------------------------------------------------------- /board/silabs_brd4180b/config.mk: -------------------------------------------------------------------------------- 1 | # Mcu of the board 2 | MCU_FAMILY=efr 3 | MCU=efr32 4 | MCU_SUB=xg21 5 | MCU_MEM_VAR=xxxxf1024 6 | 7 | # Which radio to use 8 | radio=efr32xg21 9 | 10 | # Hardware capabilities of the board 11 | ## Is 32kHz crystal mounted on the board. 12 | board_hw_crystal_32k=yes 13 | ## Is DCDC used on this board. (must be no for efr32xg21). 14 | board_hw_dcdc=no 15 | ## HFXO crystal characteristics 16 | board_hw_hfxo_ctune=129 17 | ## LFXO crystal characteristics 18 | board_hw_lfxo_ctune=79 19 | board_hw_lfxo_gain=1 20 | 21 | # Uncomment, and set path to custom power table here, if set, the custom power 22 | # table will be set during application startup, and the stack will use that 23 | # instead of the default one. 24 | # For convenience, an example of a +20dBm power table is provided, uncomment the 25 | # line below to use that instead of the default +10dBm power table 26 | # NOTE! +20 dBm power level is usable only where US FCC regulation applies 27 | #RADIO_CUSTOM_POWER_TABLE=mcu/efr32/hal/radio/radio_power_table_efr32xg21_20dBm.h 28 | -------------------------------------------------------------------------------- /board/silabs_brd4181b/config.mk: -------------------------------------------------------------------------------- 1 | # Mcu of the board 2 | MCU_FAMILY=efr 3 | MCU=efr32 4 | MCU_SUB=xg21 5 | MCU_MEM_VAR=xxxxf1024 6 | 7 | # Which radio to use 8 | radio=efr32xg21 9 | 10 | # Hardware capabilities of the board 11 | ## Is 32kHz crystal mounted on the board. 12 | board_hw_crystal_32k=yes 13 | ## Is DCDC used on this board. (must be no for efr32xg21). 14 | board_hw_dcdc=no 15 | 16 | ## HFXO crystal characteristics 17 | board_hw_hfxo_ctune=133 18 | ## LFXO crystal characteristics 19 | board_hw_lfxo_ctune=37 20 | board_hw_lfxo_gain=1 21 | -------------------------------------------------------------------------------- /board/silabs_brd4184a/board.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2021 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | 7 | /** 8 | * @file 9 | * 10 | * Board definition for the 11 | * Silabs Thunderboard BG22 12 | */ 13 | #ifndef BOARD_SILABSBRD4184A_BOARD_H_ 14 | #define BOARD_SILABSBRD4184A_BOARD_H_ 15 | 16 | #define BOARD_USART_ID 0 17 | #define BOARD_USART_GPIO_PORT GPIO_PORTA 18 | #define BOARD_USART_TX_PIN 5 19 | #define BOARD_USART_RX_PIN 6 20 | 21 | // VCOM port only supports 115200 baudrate 22 | // This speed will be used independently of UART_BAUDRATE flag value 23 | #define BOARD_USART_FORCE_BAUDRATE 115200 24 | 25 | // List of GPIO ports and pins for the LEDs on the board: yellow LED 26 | #define BOARD_LED_PIN_LIST {{GPIO_PORTB, 0}} 27 | 28 | // Active high polarity for LEDs 29 | #define BOARD_LED_ACTIVE_LOW false 30 | 31 | // List of ext. ints, GPIO ports and pins for buttons on the board: BTN0 32 | #define BOARD_BUTTON_PIN_LIST {{0, GPIO_PORTB, 1}} 33 | 34 | // Active low polarity for buttons 35 | #define BOARD_BUTTON_ACTIVE_LOW true 36 | 37 | // Board has external pull-up for buttons 38 | #define BOARD_BUTTON_INTERNAL_PULL false 39 | 40 | // Buttons use even external interrupts 41 | #define BOARD_BUTTON_USE_EVEN_INT true 42 | 43 | 44 | #endif /* BOARD_SILABSBRD4184A_BOARD_H_ */ 45 | -------------------------------------------------------------------------------- /board/silabs_brd4184a/config.mk: -------------------------------------------------------------------------------- 1 | # Mcu of the board 2 | MCU_FAMILY=efr 3 | MCU=efr32 4 | MCU_SUB=xg22 5 | MCU_MEM_VAR=xxxxf512 6 | 7 | # Which radio to use 8 | radio=efr32xg22 9 | 10 | # Hardware capabilities of the board 11 | ## Is 32kHz crystal mounted on the board. 12 | board_hw_crystal_32k=yes 13 | ## Is DCDC used on this board (must be yes for efr32xg22). 14 | board_hw_dcdc=yes 15 | ## HFXO crystal characteristics 16 | board_hw_hfxo_ctune=120 17 | ## LFXO crystal characteristics 18 | board_hw_lfxo_ctune=37 19 | board_hw_lfxo_gain=1 20 | -------------------------------------------------------------------------------- /board/silabs_brd4210a/board.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | 7 | /** 8 | * @file 9 | * 10 | * Board definition for a board composed of a Wirepas Evaluation Kit mother board 11 | * and a silabs brd4210a radio module 12 | */ 13 | #ifndef BOARD_WIREPAS_BRD4210A_BOARD_H_ 14 | #define BOARD_WIREPAS_BRD4210A_BOARD_H_ 15 | 16 | // Waps usart defines 17 | #define BOARD_USART_ID 0 18 | 19 | #define BOARD_USART_GPIO_PORT GPIO_PORTA 20 | #define BOARD_USART_TX_PIN 8 21 | #define BOARD_USART_RX_PIN 9 22 | 23 | // Enadle vcom in silabs kit board 24 | #define BOARD_USART_VCOM_PORT GPIO_PORTB 25 | #define BOARD_USART_VCOM_PIN 0 26 | 27 | // List of GPIO ports and pins for the LEDs on the board: 28 | #define BOARD_LED_PIN_LIST {{GPIO_PORTB, 2}, {GPIO_PORTD, 3}} 29 | 30 | // Active high polarity for LEDs 31 | #define BOARD_LED_ACTIVE_LOW false 32 | 33 | // List of ext. ints, GPIO ports and pins for buttons on the board: PB0, PB1 34 | #define BOARD_BUTTON_PIN_LIST {{0, GPIO_PORTB, 1},{2, GPIO_PORTB, 3}} 35 | 36 | // Active low polarity for buttons 37 | #define BOARD_BUTTON_ACTIVE_LOW true 38 | 39 | // Board has external pull-up for buttons 40 | #define BOARD_BUTTON_INTERNAL_PULL false 41 | 42 | // Buttons use even external interrupts 43 | #define BOARD_BUTTON_USE_EVEN_INT true 44 | 45 | #endif /* BOARD_WIREPAS_BRD4210A_BOARD_H_ */ 46 | -------------------------------------------------------------------------------- /board/silabs_brd4210a/config.mk: -------------------------------------------------------------------------------- 1 | # Mcu of the board 2 | MCU_FAMILY=efr 3 | MCU=efr32 4 | MCU_SUB=xg23 5 | MCU_MEM_VAR=xxxxf512 6 | 7 | # Which radio to use 8 | radio=efr32xg23 9 | # Radio Configuration aus915 or india865 10 | #radio_config=aus915 11 | radio_config=india865 12 | mac_profile=subg 13 | 14 | # Hardware capabilities of the board 15 | ## Is 32kHz crystal mounted on the board. 16 | board_hw_crystal_32k=no 17 | ## Is DCDC used on this board. 18 | board_hw_dcdc=yes 19 | ## HFXO crystal characteristics 20 | board_hw_hfxo_ctune=106 21 | ## LFXO crystal characteristics 22 | board_hw_lfxo_ctune=63 23 | board_hw_lfxo_gain=2 24 | 25 | # Custom power table 26 | # if set, the custom power table will be set during application startup, 27 | # and the stack will use that instead of the default one. 28 | # For convenience, +13dBm, +16dBm and +20dBm power tables are provided as examples. 29 | # - mcu/efr/efr32/hal/radio/radio_power_table_efr32xg23_13dbm.h 30 | # - mcu/efr/efr32/hal/radio/radio_power_table_efr32xg23_16dbm.h 31 | # - mcu/efr/efr32/hal/radio/radio_power_table_efr32xg23_20dbm.h 32 | # If predefined custom power table shall be used, 33 | # provide radio_power_table=13/16/20 as build parameter. 34 | ifneq ("$(radio_power_table)", "") 35 | RADIO_CUSTOM_POWER_TABLE=mcu/efr/efr32/hal/radio/radio_power_table_efr32xg23_$(radio_power_table)dbm.h 36 | endif 37 | -------------------------------------------------------------------------------- /board/silabs_brd4253a/config.mk: -------------------------------------------------------------------------------- 1 | # Mcu of the board 2 | MCU_FAMILY=efr 3 | MCU=efr32 4 | MCU_SUB=xg12 5 | MCU_MEM_VAR=pxxxf1024 6 | 7 | # Hardware capabilities of the board 8 | ## Is 32kHz crystal mounted on the board. 9 | board_hw_crystal_32k=yes 10 | ## Is DCDC used on this board. 11 | board_hw_dcdc=yes 12 | ## HFXO crystal characteristics 13 | board_hw_hfxo_ctune=322 14 | ## LFXO crystal characteristics 15 | board_hw_lfxo_ctune=68 16 | board_hw_lfxo_gain=2 17 | 18 | # Uncomment, and set path to custom power table here, if set, the custom power 19 | # table will be set during application startup, and the stack will use that 20 | # instead of the default 21 | # For convenience, an example of a +19dBm power table is provided, uncomment the 22 | # line below to use that instead of the default +10dBm power table 23 | # NOTE! +19 dBm power level is usable only where US FCC regulation applies 24 | #RADIO_CUSTOM_POWER_TABLE=mcu/efr/efr32/hal/radio/radio_power_table_efr32xg12_19dBm.h 25 | -------------------------------------------------------------------------------- /board/silabs_brd4254a/config.mk: -------------------------------------------------------------------------------- 1 | # Mcu of the board 2 | MCU_FAMILY=efr 3 | MCU=efr32 4 | MCU_SUB=xg12 5 | MCU_MEM_VAR=pxxxf1024 6 | 7 | # Hardware capabilities of the board 8 | ## Is 32kHz crystal mounted on the board. 9 | board_hw_crystal_32k=yes 10 | ## Is DCDC used on this board. 11 | board_hw_dcdc=yes 12 | ## HFXO crystal characteristics 13 | board_hw_hfxo_ctune=322 14 | ## LFXO crystal characteristics 15 | board_hw_lfxo_ctune=68 16 | board_hw_lfxo_gain=2 17 | -------------------------------------------------------------------------------- /board/silabs_brd4312a/config.mk: -------------------------------------------------------------------------------- 1 | # Mcu of the board 2 | MCU_FAMILY=efr 3 | MCU=efr32 4 | MCU_SUB=xg22 5 | MCU_MEM_VAR=xxxxf512 6 | 7 | # Radio of the module on the board 8 | radio=bgm220sc22hna 9 | 10 | # Hardware capabilities of the board 11 | ## Is 32kHz crystal mounted on the board. 12 | board_hw_crystal_32k=yes 13 | ## Is DCDC used on this board (must be yes for efr32gx22). 14 | board_hw_dcdc=yes 15 | ## HFXO crystal characteristics 16 | board_hw_hfxo_ctune=120 17 | ## LFXO crystal characteristics 18 | board_hw_lfxo_ctune=37 19 | board_hw_lfxo_gain=1 20 | -------------------------------------------------------------------------------- /board/tbsense2/config.mk: -------------------------------------------------------------------------------- 1 | # Mcu of the board 2 | MCU_FAMILY=efr 3 | MCU=efr32 4 | MCU_SUB=xg12 5 | MCU_MEM_VAR=pxxxf1024 6 | 7 | # Hardware capabilities of the board 8 | ## Is 32kHz crystal mounted on the board. 9 | board_hw_crystal_32k=yes 10 | ## Is DCDC used on this board. 11 | board_hw_dcdc=yes 12 | ## HFXO crystal characteristics 13 | board_hw_hfxo_ctune=322 14 | ## LFXO crystal characteristics 15 | board_hw_lfxo_ctune=68 16 | board_hw_lfxo_gain=2 17 | -------------------------------------------------------------------------------- /board/ublox_b204/board.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | 7 | /** 8 | * @file 9 | * 10 | * Board definition for the 11 | * Ublox b204 dongle 12 | */ 13 | #ifndef BOARD_UBLOX_B204_H_ 14 | #define BOARD_UBLOX_B204_H_ 15 | 16 | // Serial port pins 17 | #define BOARD_USART_TX_PIN 6 18 | #define BOARD_USART_RX_PIN 5 19 | #define BOARD_USART_CTS_PIN 7 /* For USE_USART_HW_FLOW_CONTROL */ 20 | #define BOARD_USART_RTS_PIN 31 /* For USE_USART_HW_FLOW_CONTROL */ 21 | 22 | /* List of GPIO pins for the LEDs on the B204 board: 23 | LED B204 / nrf52832 pin 24 | GREEN: GPIO_7 / P0.16 25 | RED: GPIO_1 / P0.08 26 | BLUE: GPIO_8 / P0.18 27 | */ 28 | #define BOARD_LED_PIN_LIST {16, 8, 18} 29 | 30 | // The board supports DCDC (#define BOARD_SUPPORT_DCDC) 31 | // Since SDK v1.2 (bootloader > v7) this option has been move to 32 | // board//config.mk. Set board_hw_dcdc to yes to enable DCDC. 33 | #ifdef BOARD_SUPPORT_DCDC 34 | #error This option has been moved to board//config.mk 35 | #endif 36 | 37 | 38 | #endif /* BOARD_UBLOX_B204_H_ */ 39 | -------------------------------------------------------------------------------- /board/ublox_b204/config.mk: -------------------------------------------------------------------------------- 1 | # Mcu of the board 2 | MCU_FAMILY=nrf 3 | MCU=nrf52 4 | MCU_SUB=832 5 | 6 | # Hardware capabilities of the board 7 | ## Is 32kHz crystal mounted on the board. 8 | board_hw_crystal_32k=yes 9 | ## Is DCDC used on this board. 10 | board_hw_dcdc=yes -------------------------------------------------------------------------------- /board/wuerth_261101102/config.mk: -------------------------------------------------------------------------------- 1 | # Mcu of the board 2 | MCU_FAMILY=nrf 3 | MCU=nrf52 4 | MCU_SUB=840 5 | 6 | # Hardware capabilities of the board 7 | ## Is 32kHz crystal mounted on the board. 8 | board_hw_crystal_32k=yes 9 | ## Is DCDC used on this board. 10 | board_hw_dcdc=yes 11 | 12 | # Uncomment, and set path to custom power table here, if set, the custom power 13 | # table will be set during application startup, and the stack will use that 14 | # instead of the default 15 | # For convenience, an example of a +4dBm power table is provided, uncomment the 16 | # line below to use that instead of the default +8dBm power table 17 | #RADIO_CUSTOM_POWER_TABLE=mcu/nrf/nrf52/hal/radio/radio_power_table_nrf52840_4dBm.h 18 | -------------------------------------------------------------------------------- /bootloader/early_init.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | 7 | #include "early_init.h" 8 | #include "power.h" 9 | 10 | 11 | /* Declaration of a weak custom early init that can be overwritten for each 12 | * board under board//bootloader/custom_early_init.c 13 | */ 14 | void custom_early_init(void) __attribute__((weak)); 15 | 16 | /* Declaration of a weak custom early init that can be overwritten for each 17 | * app under $(APP_SRCS_PATH)/bootloader/app_early_init.c 18 | */ 19 | void app_early_init(void) __attribute__((weak)); 20 | 21 | void early_init() 22 | { 23 | Power_enableDCDC(); 24 | 25 | custom_early_init(); 26 | 27 | app_early_init(); 28 | } 29 | 30 | /* This is the default implementation of the first_boot function. It is defined 31 | * as weak symbol and can be redifined in the application. 32 | */ 33 | void __attribute((weak)) first_boot(void) 34 | { 35 | } 36 | -------------------------------------------------------------------------------- /bootloader/early_init.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | 7 | #ifndef EARLY_INIT_H_ 8 | #define EARLY_INIT_H_ 9 | 10 | /** 11 | * \brief Function called early in the boot process. 12 | * It can be used to configure I/Os just after power-up. 13 | */ 14 | void early_init(void); 15 | 16 | /** 17 | * \brief Function called on time before the flash is locked. 18 | * It can be used to configure register that are not accessible 19 | * otherwise. 20 | * \note Global variables can't be used as .bss and .data are not initialized 21 | * at this stage. 22 | */ 23 | void first_boot(void); 24 | 25 | #endif //EARLY_INIT_H_ 26 | -------------------------------------------------------------------------------- /bootloader/external_flash.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | 7 | #include "external_flash.h" 8 | 9 | /* Dummy external flash driver that does nothing. 10 | * It is defined as weak symbol and can be overwritten in the board specific 11 | * folder (e.g board/pca10040/bootloader/). 12 | */ 13 | 14 | 15 | extFlash_res_e __attribute__((weak)) externalFlash_init(void) 16 | { 17 | /* external flash driver is optional. So return OK even if there 18 | * is no driver. 19 | */ 20 | return EXTFLASH_RES_OK; 21 | } 22 | 23 | extFlash_res_e __attribute__((weak)) 24 | externalFlash_startRead(void * to, const void * from, size_t amount) 25 | { 26 | (void)to; 27 | (void)from; 28 | (void)amount; 29 | 30 | return EXTFLASH_RES_NODRIVER; 31 | } 32 | 33 | extFlash_res_e __attribute__((weak)) 34 | externalFlash_startWrite(void * to, const void * from, size_t amount) 35 | { 36 | (void)to; 37 | (void)from; 38 | (void)amount; 39 | 40 | return EXTFLASH_RES_NODRIVER; 41 | } 42 | 43 | extFlash_res_e __attribute__((weak)) 44 | externalFlash_startErase(size_t * sector_base, size_t * number_of_sector) 45 | { 46 | (void)sector_base; 47 | (void)number_of_sector; 48 | 49 | return EXTFLASH_RES_NODRIVER; 50 | } 51 | 52 | bool __attribute__((weak)) externalFlash_isBusy(void) 53 | { 54 | return false; 55 | } 56 | 57 | extFlash_res_e __attribute__((weak)) externalFlash_getInfo(flash_info_t * info) 58 | { 59 | (void)info; 60 | 61 | return EXTFLASH_RES_NODRIVER; 62 | } 63 | -------------------------------------------------------------------------------- /bootloader/makefile: -------------------------------------------------------------------------------- 1 | # You can add more sources here if needed 2 | SRCS += bootloader/early_init.c 3 | SRCS += bootloader/external_flash.c 4 | SRCS += bootloader/bl_hardware.c 5 | 6 | INCLUDES += -Ibootloader/ 7 | 8 | ifneq ("$(wildcard $(BOARD_FOLDER)/bootloader/custom_early_init.c)","") 9 | SRCS += $(BOARD_FOLDER)/bootloader/custom_early_init.c 10 | endif 11 | 12 | ifneq ("$(wildcard $(BOARD_FOLDER)/bootloader/makefile)","") 13 | include $(BOARD_FOLDER)/bootloader/makefile 14 | endif 15 | 16 | ifneq ("$(wildcard $(APP_SRCS_PATH)/bootloader/app_early_init.c)","") 17 | SRCS += $(APP_SRCS_PATH)/bootloader/app_early_init.c 18 | endif 19 | 20 | ifneq ("$(wildcard $(APP_SRCS_PATH)/bootloader/makefile)","") 21 | include $(APP_SRCS_PATH)/bootloader/makefile 22 | endif 23 | -------------------------------------------------------------------------------- /bootloader_test/drivers/usart.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | 7 | #ifndef USART_H_ 8 | #define USART_H_ 9 | 10 | #include 11 | #include 12 | 13 | /** 14 | * \brief Initialize all USART blocks 15 | * Enables peripheral clocks and disables peripherals 16 | * for the duration of the initialization procedure. 17 | * Clears all internal variables: 18 | * Callback handlers 19 | * Transfer busy flags 20 | * After the initialization procedure is complete, it enables 21 | * all peripherals, but leaves peripheral clocks disabled 22 | * \param baudrate 23 | * Baudrate to be used 24 | * \return none 25 | */ 26 | void Usart_init(uint32_t baudrate); 27 | 28 | /** 29 | * \brief Send a buffer to USART 30 | * \param buf 31 | * Buffer to send 32 | * \param len 33 | * Size of buffer to send 34 | * \note This method will either send the whole buffer or nothing at all 35 | * \return Number of bytes written (zero or len) 36 | */ 37 | uint32_t Usart_sendBuffer(const void * buf, uint32_t len); 38 | 39 | #endif /* USART_H_ */ 40 | -------------------------------------------------------------------------------- /bootloader_test/makefile: -------------------------------------------------------------------------------- 1 | SRCS += bootloader_test/tests/test_memory_areas.c 2 | SRCS += bootloader_test/tests/test_info.c 3 | SRCS += bootloader_test/tests/test_timings.c 4 | SRCS += bootloader_test/main.c 5 | SRCS += bootloader_test/print/print.c 6 | SRCS += bootloader_test/print/syscalls.c 7 | SRCS += bootloader_test/drivers/$(MCU)/usart.c 8 | SRCS += bootloader_test/timing/timing.c 9 | 10 | CFLAGS += -Ibootloader_test/api/ 11 | CFLAGS += -Ibootloader_test/print/ 12 | CFLAGS += -Ibootloader_test/timing/ 13 | CFLAGS += -Ibootloader_test/drivers/ 14 | CFLAGS += -Ibootloader_test/tests/ 15 | CFLAGS += -Ibootloader_test/ 16 | -------------------------------------------------------------------------------- /bootloader_test/print/print.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #include "print.h" 13 | /* USART driver */ 14 | #include "usart.h" 15 | 16 | /* Storage for debug messages */ 17 | #define BUFFER_SIZE 128ul 18 | static uint8_t m_buffer[BUFFER_SIZE]; 19 | 20 | void Print_init(void) 21 | { 22 | /* Initialize the hardware module */ 23 | Usart_init(115200); 24 | } 25 | 26 | int Print_printf(const char * fmt, ...) 27 | { 28 | uint32_t len; 29 | va_list arg; 30 | 31 | va_start(arg, fmt); 32 | len = vsnprintf((char *)&m_buffer[0], BUFFER_SIZE, fmt, arg); 33 | /* Try sending */ 34 | len = Usart_sendBuffer(m_buffer, len); 35 | va_end(arg); 36 | 37 | return len; 38 | } 39 | -------------------------------------------------------------------------------- /bootloader_test/print/print.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | 7 | #ifndef _PRINT_H_ 8 | #define _PRINT_H_ 9 | 10 | #include 11 | 12 | /** 13 | * \brief Initialize the print module 14 | */ 15 | void Print_init(void); 16 | 17 | /** 18 | * \brief printf functionality 19 | * \param fmt 20 | * Formatted text to print 21 | * \param ... 22 | * Argument list for formatted text 23 | * \return Amount of characters written to standard output 24 | */ 25 | int Print_printf(const char * fmt, ...); 26 | 27 | #endif /* _PRINT_H_ */ 28 | -------------------------------------------------------------------------------- /bootloader_test/print/syscalls.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | /* 13 | * Stub methods for malloc(), free() and realloc() for newlib. 14 | * The purpose of these stubs is to minimize the amount of code 15 | * imported from newlib and also to make sure newlib code 16 | * doesn't secretly call malloc. 17 | */ 18 | 19 | void * _malloc_r(size_t size) 20 | { 21 | (void)size; 22 | return NULL; 23 | } 24 | 25 | void _free_r(void * ptr) 26 | { 27 | (void)ptr; 28 | return; 29 | } 30 | 31 | void * _realloc_r(struct _reent * a, void * b, size_t c) 32 | { 33 | (void)a; 34 | (void)b; 35 | (void)c; 36 | return NULL; 37 | } 38 | -------------------------------------------------------------------------------- /bootloader_test/tests/test.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | 7 | #include "../../bootloader_test/api/bl_interface.h" 8 | 9 | #ifndef _TEST_H_ 10 | #define _TEST_H_ 11 | 12 | /* Macro to print test startup */ 13 | #define START_TEST(_name_, _desc_) Print_printf("\nTEST [%s]: %s\n", \ 14 | #_name_, #_desc_); 15 | 16 | /* Macro to print test result */ 17 | #define END_TEST(_name_, _res_) Print_printf("TEST [%s]: %s\n", \ 18 | #_name_, _res_ ? "OK" : "FAIL"); 19 | 20 | /** 21 | * \brief Tests that prints informations about memory area and flash. 22 | */ 23 | bool Tests_info(bl_interface_t * interface); 24 | 25 | /** 26 | * \brief Test read/write/erase in memory areas. 27 | */ 28 | bool Tests_areas(bl_interface_t * interface); 29 | 30 | /** 31 | * \brief Test flash read/write/erase timings. 32 | */ 33 | bool Tests_timings(bl_interface_t * interface); 34 | 35 | /** 36 | * \brief Tests scratchpad library. 37 | */ 38 | bool Tests_test_scratchpad(const scratchpad_services_t * scrat_services); 39 | 40 | #endif /* _TEST_H_ */ 41 | -------------------------------------------------------------------------------- /bootloader_test/timing/timing.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | 7 | #include "timing.h" 8 | #include "string.h" 9 | #include "mcu.h" 10 | 11 | void Timing_init(void) 12 | { 13 | CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk; 14 | DWT->CYCCNT = 0; 15 | DWT->CTRL |= DWT_CTRL_CYCCNTENA_Msk; 16 | } 17 | 18 | void Timing_reset(timing_handle_t * h) 19 | { 20 | memset(h,0,sizeof(timing_handle_t)); 21 | h->min = UINT32_MAX; 22 | } 23 | 24 | void Timing_start(timing_handle_t * h) 25 | { 26 | h->start = DWT->CYCCNT; 27 | } 28 | 29 | void Timing_stop(timing_handle_t * h) 30 | { 31 | uint32_t cycles; 32 | 33 | h->stop = DWT->CYCCNT; 34 | h->cnt++; 35 | 36 | if(h->stop > h->start) 37 | { 38 | cycles = h->stop - h->start; 39 | } 40 | else 41 | { 42 | cycles = UINT32_MAX - h->start + h->stop; 43 | } 44 | 45 | if(cycles < h->min) 46 | { 47 | h->min = cycles; 48 | } 49 | 50 | if(cycles > h->max) 51 | { 52 | h->max = cycles; 53 | } 54 | 55 | h->sum += cycles; 56 | h->avg = h->sum / h->cnt; 57 | } 58 | -------------------------------------------------------------------------------- /bootloader_test/timing/timing.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | 7 | #ifndef _TIMING_H_ 8 | #define _TIMING_H_ 9 | 10 | #include "stdint.h" 11 | 12 | /** \brief Handle containing timing informations */ 13 | typedef struct 14 | { 15 | uint32_t min; /** Minimum time measured since reset (in CPU ticks) */ 16 | uint32_t max; /** Maximum time measured since reset (in CPU ticks) */ 17 | uint32_t avg; /** Average time measured since reset (in CPU ticks) */ 18 | uint32_t cnt; /** Number of measurement done since reset (in CPU ticks) */ 19 | uint32_t start; /** Internal use */ 20 | uint32_t stop; /** Internal use */ 21 | uint32_t sum; /** Internal use */ 22 | } timing_handle_t; 23 | 24 | /** 25 | * \brief Initialize the timing module 26 | */ 27 | void Timing_init(void); 28 | 29 | /** 30 | * \brief Resets measurements of the handle 31 | * \param h 32 | * pointer to the timing handle 33 | */ 34 | void Timing_reset(timing_handle_t * h); 35 | 36 | /** 37 | * \brief Starts a timing measurement for the specified handle. 38 | * \param h 39 | * pointer to the timing handle 40 | */ 41 | void Timing_start(timing_handle_t * h); 42 | 43 | /** 44 | * \brief Stopts a timing measurement for the specified handle. 45 | * \param h 46 | * pointer to the timing handle 47 | */ 48 | void Timing_stop(timing_handle_t * h); 49 | 50 | #endif //_TIMING_H_ 51 | -------------------------------------------------------------------------------- /config.mk: -------------------------------------------------------------------------------- 1 | # Name of your app. It is used to name the produced files 2 | # It has to be the same as the app directory name under source 3 | # It can be overwritten on command line "make app_name=<...>" 4 | app_name=custom_app 5 | 6 | # Name of the board to build your application 7 | # If build is always with same board, it can be set here 8 | # It can be overwritten on command line "make target_board=<...>" 9 | target_board= 10 | 11 | # Version of the SDK 12 | sdk_major=1 13 | sdk_minor=4 14 | sdk_maintenance=2 15 | sdk_development=0 16 | 17 | 18 | # Specify the arm toolchain to use (leave it blank if already set in your PATH) 19 | arm_toolchain= 20 | 21 | # Only set this value if python interpreter is not found. Python3 is preferred. 22 | # Python2 is end of life and support will be removed in the future. 23 | # Leaving value empty uses the shebang value of the script, which is #!/usr/bin/env python3 24 | # and fallback to "python" cmd 25 | python_interpreter= 26 | 27 | -------------------------------------------------------------------------------- /image/readme.md: -------------------------------------------------------------------------------- 1 | Unpack your Wirepas binaries here. 2 | -------------------------------------------------------------------------------- /libraries/control_node/control_router.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | #ifndef _CONTROL_ROUTER_H_ 7 | #define _CONTROL_ROUTER_H_ 8 | 9 | #include "wms_advertiser.h" 10 | #include "control_node_int.h" 11 | 12 | 13 | /** 14 | * \brief Configuration structure for Control node router. 15 | */ 16 | typedef struct 17 | { 18 | /** Sets callback function to be called when ack is generated as a 19 | * response for advertiser device transmission. 20 | */ 21 | app_llhead_acklistener_f ack_gen_cb; 22 | } control_router_conf_t; 23 | 24 | /** 25 | * \brief Initialize Directed Advertiser libray for router node. 26 | * \param[in] conf 27 | * Pointer to the configuration structure. 28 | * \return Result code, normally \ref CONTROL_RET_OK. See 29 | * \ref lib_control_node_ret_e for other return code. 30 | */ 31 | control_node_ret_e Control_Router_init(control_router_conf_t * conf); 32 | 33 | #endif //_CONTROL_ROUTER_H_ 34 | -------------------------------------------------------------------------------- /libraries/dualmcu/api/figures/Fig_GenFormat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wirepas/wm-sdk/7305a2625220f6e8f42b6fba84b7d2c3e4db9d17/libraries/dualmcu/api/figures/Fig_GenFormat.png -------------------------------------------------------------------------------- /libraries/dualmcu/api/figures/Fig_ReqConf_IndRes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wirepas/wm-sdk/7305a2625220f6e8f42b6fba84b7d2c3e4db9d17/libraries/dualmcu/api/figures/Fig_ReqConf_IndRes.png -------------------------------------------------------------------------------- /libraries/dualmcu/drivers/efr32/io.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | 7 | 8 | #include "hal_api.h" 9 | #include "io.h" 10 | #include "board.h" 11 | 12 | #if defined(BOARD_UART_INT_PIN) && defined(BOARD_UART_INT_PORT) 13 | 14 | void Io_init(void) 15 | { 16 | // /* Enable clocks */ 17 | CMU->HFBUSCLKEN0 |= CMU_HFBUSCLKEN0_GPIO; 18 | 19 | hal_gpio_set_mode(BOARD_UART_INT_PORT, 20 | BOARD_UART_INT_PIN, 21 | GPIO_MODE_DISABLED); 22 | hal_gpio_clear(BOARD_UART_INT_PORT, 23 | BOARD_UART_INT_PIN); 24 | } 25 | 26 | void Io_enableUartIrq(void) 27 | { 28 | 29 | hal_gpio_set_mode(BOARD_UART_INT_PORT, 30 | BOARD_UART_INT_PIN, 31 | GPIO_MODE_OUT_PP); 32 | } 33 | 34 | void Io_setUartIrq(void) 35 | { 36 | // Active low IRQ pin 37 | hal_gpio_clear(BOARD_UART_INT_PORT, 38 | BOARD_UART_INT_PIN); 39 | } 40 | 41 | void Io_clearUartIrq(void) 42 | { 43 | // To clear we pull pin up 44 | hal_gpio_set(BOARD_UART_INT_PORT, 45 | BOARD_UART_INT_PIN); 46 | } 47 | 48 | void Io_setModeDisabled(void) 49 | { 50 | // Disable pin 51 | hal_gpio_set_mode(BOARD_UART_INT_PORT, 52 | BOARD_UART_INT_PIN, 53 | GPIO_MODE_DISABLED); 54 | } 55 | 56 | #else 57 | // IRQ pin not defined, no functionality 58 | void Io_init(void) 59 | { 60 | } 61 | 62 | void Io_enableUartIrq(void) 63 | { 64 | } 65 | 66 | void Io_setUartIrq(void) 67 | { 68 | } 69 | 70 | void Io_clearUartIrq(void) 71 | { 72 | } 73 | #endif 74 | -------------------------------------------------------------------------------- /libraries/dualmcu/drivers/efr32/makefile: -------------------------------------------------------------------------------- 1 | EFR32_DRIVERS_PREFIX := $(DRIVERS_PREFIX)efr32/ 2 | 3 | SRCS += $(EFR32_DRIVERS_PREFIX)exti.c \ 4 | $(EFR32_DRIVERS_PREFIX)io.c 5 | -------------------------------------------------------------------------------- /libraries/dualmcu/drivers/makefile: -------------------------------------------------------------------------------- 1 | 2 | DRIVERS_PREFIX := $(WP_LIB_PATH)dualmcu/drivers/ 3 | 4 | INCLUDES += -I$(DRIVERS_PREFIX) 5 | 6 | ifneq (,$(filter $(MCU), nrf52 nrf91)) 7 | include $(DRIVERS_PREFIX)nrf/makefile 8 | else ifeq ($(MCU),efr32) 9 | include $(DRIVERS_PREFIX)efr32/makefile 10 | else 11 | $(error Cannot determine MCU for drivers) 12 | endif 13 | -------------------------------------------------------------------------------- /libraries/dualmcu/drivers/nrf/io.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | 7 | 8 | #include "hal_api.h" 9 | #include "board.h" 10 | 11 | #ifdef BOARD_UART_IRQ_PIN 12 | 13 | void Io_init(void) 14 | { 15 | // Disconnect uart_irq_pin 16 | nrf_gpio_cfg_default(BOARD_UART_IRQ_PIN); 17 | // But set light pull-up 18 | nrf_gpio_pin_set(BOARD_UART_IRQ_PIN); 19 | } 20 | 21 | void Io_enableUartIrq(void) 22 | { 23 | nrf_gpio_cfg(BOARD_UART_IRQ_PIN, 24 | NRF_GPIO_PIN_DIR_OUTPUT, 25 | NRF_GPIO_PIN_INPUT_CONNECT, 26 | NRF_GPIO_PIN_NOPULL, 27 | NRF_GPIO_PIN_S0S1, 28 | NRF_GPIO_PIN_NOSENSE); 29 | } 30 | 31 | void Io_setUartIrq(void) 32 | { 33 | // Active low IRQ pin 34 | nrf_gpio_pin_clear(BOARD_UART_IRQ_PIN); 35 | } 36 | 37 | void Io_clearUartIrq(void) 38 | { 39 | // To clear we pull pin up 40 | nrf_gpio_pin_set(BOARD_UART_IRQ_PIN); 41 | } 42 | 43 | #else 44 | 45 | // IRQ pin not defined, no functionality 46 | void Io_init(void) 47 | { 48 | } 49 | 50 | void Io_enableUartIrq(void) 51 | { 52 | } 53 | 54 | void Io_setUartIrq(void) 55 | { 56 | } 57 | 58 | void Io_clearUartIrq(void) 59 | { 60 | } 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /libraries/dualmcu/drivers/nrf/makefile: -------------------------------------------------------------------------------- 1 | NRF_DRIVERS_PREFIX := $(DRIVERS_PREFIX)nrf/ 2 | 3 | SRCS += $(NRF_DRIVERS_PREFIX)exti.c \ 4 | $(NRF_DRIVERS_PREFIX)io.c \ 5 | -------------------------------------------------------------------------------- /libraries/dualmcu/dualmcu_lib.c: -------------------------------------------------------------------------------- 1 | #include "dualmcu_lib.h" 2 | #include "io.h" 3 | #include "waps.h" 4 | 5 | dualmcu_lib_res_e Dualmcu_lib_init(uint32_t baudrate, bool flow_ctrl) 6 | { 7 | // Initialize IO's (enable clock and initialize pins) 8 | Io_init(); 9 | 10 | // Initialize the Dual-MCU API protocol 11 | if (Waps_init(baudrate, flow_ctrl)) 12 | { 13 | return DUALMCU_LIB_RES_OK; 14 | } 15 | else 16 | { 17 | return DUALMCU_LIB_RES_INTERNAL_ERROR; 18 | } 19 | } -------------------------------------------------------------------------------- /libraries/dualmcu/dualmcu_lib.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2021 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | 7 | /** 8 | * @file dualmcu_lib.h 9 | * 10 | */ 11 | 12 | #ifndef _DUALMCU_LIB_H_ 13 | #define _DUALMCU_LIB_H_ 14 | 15 | #include 16 | #include 17 | 18 | /** 19 | * \brief List of return code 20 | */ 21 | typedef enum 22 | { 23 | /** Operation is successful */ 24 | DUALMCU_LIB_RES_OK = 0, 25 | /** Something went wrong */ 26 | DUALMCU_LIB_RES_INTERNAL_ERROR = 1, 27 | } dualmcu_lib_res_e; 28 | 29 | 30 | /** 31 | * \brief Initialize Dualmcu_lib 32 | * \param baudrate 33 | * Baudrate for the uart 34 | * \param flow_ctrl 35 | * Is hardware flow control enabled 36 | * \return Return code of the operation 37 | */ 38 | dualmcu_lib_res_e Dualmcu_lib_init(uint32_t baudrate, bool flow_ctrl); 39 | 40 | 41 | #endif //_DUALMCU_LIB_H_ 42 | -------------------------------------------------------------------------------- /libraries/dualmcu/waps/comm/makefile: -------------------------------------------------------------------------------- 1 | COMM_PREFIX := $(WAPS_PREFIX)comm/ 2 | 3 | SRCS += $(COMM_PREFIX)uart/waps_uart.c \ 4 | $(COMM_PREFIX)uart/waps_uart_power.c 5 | 6 | ifeq ($(waps_diagnostics),yes) 7 | $(info PROFILE: waps diagnostics) 8 | CFLAGS += -DWAPS_DIAGNOSTICS 9 | endif 10 | -------------------------------------------------------------------------------- /libraries/dualmcu/waps/comm/waps_comm.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | 7 | #ifndef WAPS_COMM_H_ 8 | #define WAPS_COMM_H_ 9 | 10 | #include 11 | #include 12 | 13 | /** Callback for a valid looking frame */ 14 | typedef bool(*new_frame_cb_f)(void *, uint32_t); 15 | 16 | #include "uart/waps_uart.h" 17 | 18 | #endif /* WAPS_COMM_H_ */ 19 | -------------------------------------------------------------------------------- /libraries/dualmcu/waps/makefile: -------------------------------------------------------------------------------- 1 | WAPS_PREFIX := $(WP_LIB_PATH)dualmcu/waps/ 2 | 3 | # Define WAPS version here 4 | # 12 -> 13 (OTAP_Remote calls not suported anymore) 5 | # 13 -> 14 (Change type and composition of RSSI,TX,RX power in getNeighbors()) 6 | # 14 -> 15 (- add Read/Write Target OTAP 7 | # - remove deprecated otap services (remote) 8 | # - add quality indicator) 9 | # 15 -> 16 (- use new single mcu api to set app config diag interval 10 | # so sequence become obsolete) 11 | # 16 -> 17 (- Add support for fragmented packet (TX and RX)) 12 | # 17 -> 18 (- add scratchpad read primitive 13 | # - add read-only MSAP attribute 14 for stored scratchpad size) 14 | 15 | CFLAGS += -DWAPS_VERSION=18 16 | 17 | INCLUDES += -I$(WAPS_PREFIX) 18 | 19 | include $(WAPS_PREFIX)comm/makefile 20 | include $(WAPS_PREFIX)protocol/makefile 21 | 22 | SRCS += $(WAPS_PREFIX)waps.c \ 23 | $(WAPS_PREFIX)waps_item.c \ 24 | $(WAPS_PREFIX)waddr.c \ 25 | $(WAPS_PREFIX)sap/function_codes.c \ 26 | $(WAPS_PREFIX)sap/csap.c \ 27 | $(WAPS_PREFIX)sap/dsap.c \ 28 | $(WAPS_PREFIX)sap/msap.c \ 29 | $(WAPS_PREFIX)sap/lock_bits.c \ 30 | $(WAPS_PREFIX)sap/persistent.c \ 31 | $(WAPS_PREFIX)sap/multicast.c -------------------------------------------------------------------------------- /libraries/dualmcu/waps/protocol/makefile: -------------------------------------------------------------------------------- 1 | PROT_PREFIX := $(WAPS_PREFIX)protocol/ 2 | 3 | SRCS += $(PROT_PREFIX)waps_protocol.c \ 4 | $(PROT_PREFIX)uart/waps_uart_protocol.c 5 | -------------------------------------------------------------------------------- /libraries/dualmcu/waps/protocol/uart/waps_uart_protocol.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | 7 | #ifndef WAPS_UART_PROTOCOL_H_ 8 | #define WAPS_UART_PROTOCOL_H_ 9 | 10 | #include 11 | #include "waps_item.h" 12 | 13 | /** 14 | * \brief (Re-)Send reply 15 | */ 16 | void Waps_protUart_sendReply(void); 17 | 18 | /** 19 | * \brief Tell protocol that a frame has been removed (invalid) 20 | */ 21 | void Waps_protUart_frameRemoved(void); 22 | 23 | /** 24 | * \brief Process response and send indication if necessary 25 | * \return true 26 | * Frame is a response frame 27 | * false 28 | * Frame is not a response frame 29 | */ 30 | bool Waps_protUart_processResponse(waps_item_t * item); 31 | 32 | #endif /* WAPS_UART_PROTOCOL_H_ */ 33 | -------------------------------------------------------------------------------- /libraries/dualmcu/waps/protocol/waps_protocol_private.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | 7 | #ifndef WAPS_PROTOCOL_PRIVATE_H_ 8 | #define WAPS_PROTOCOL_PRIVATE_H_ 9 | 10 | bool prot_send_item(waps_item_t * item); 11 | 12 | /** Current reply frame */ 13 | extern waps_item_t * prot_reply; 14 | 15 | /** Last indication information */ 16 | extern waps_item_t * prot_indication; 17 | extern uint8_t prot_seq; 18 | 19 | #endif /* WAPS_PROTOCOL_PRIVATE_H_ */ 20 | -------------------------------------------------------------------------------- /libraries/dualmcu/waps/sap/csap.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | 7 | #ifndef WAPS_CSAP_H_ 8 | #define WAPS_CSAP_H_ 9 | 10 | #include 11 | #include "waps_item.h" 12 | 13 | /** 14 | * \brief Process received request 15 | * \param item 16 | * Structure containing the received request frame 17 | * \return True, if a response was generated 18 | */ 19 | bool Csap_handleFrame(waps_item_t * item); 20 | 21 | #endif /* WAPS_CSAP_H_ */ 22 | -------------------------------------------------------------------------------- /libraries/dualmcu/waps/sap/lock_bits.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | 7 | #include // For NULL 8 | #include // For uint32_t 9 | 10 | #include "lock_bits.h" 11 | #include "api.h" 12 | 13 | bool LockBits_isKeySet(void) 14 | { 15 | return (lib_settings->getFeatureLockKey(NULL)) == APP_RES_OK; 16 | } 17 | 18 | bool LockBits_isFeaturePermitted(uint32_t lock_bits) 19 | { 20 | if (!LockBits_isKeySet()) 21 | { 22 | // No key set, so all requested features unlocked 23 | return true; 24 | } 25 | 26 | uint32_t active_lock_bits = UINT32_MAX; 27 | lib_settings->getFeatureLockBits(&active_lock_bits); 28 | 29 | if ((active_lock_bits & lock_bits) == lock_bits) 30 | { 31 | // All requested features unlocked 32 | return true; 33 | } 34 | 35 | // One or more requested features locked 36 | return false; 37 | } 38 | -------------------------------------------------------------------------------- /libraries/dualmcu/waps/sap/msap.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | 7 | #ifndef WAPS_MSAP_H_ 8 | #define WAPS_MSAP_H_ 9 | 10 | #include "waps_item.h" 11 | #include "api.h" 12 | 13 | /** 14 | * \brief Process received request 15 | * \param item 16 | * Structure containing the received request frame 17 | * \return True, if a response was generated 18 | */ 19 | bool Msap_handleFrame(waps_item_t * item); 20 | 21 | /** 22 | * \brief Used to generate an indication when stack reboots 23 | * \return waps_item containing stack status 24 | */ 25 | waps_item_t * Msap_getStackStatusIndication(void); 26 | 27 | /** 28 | * \brief Create new app config indication 29 | * \note This should only be called when new DREQ are received 30 | * \param seq 31 | * Application config sequence 32 | * \param config 33 | * New application config data 34 | * \param interval 35 | * Diagnostic interval in seconds 36 | * \param item 37 | * Memory area where indication is constructed to 38 | */ 39 | void Msap_handleAppConfig(uint8_t seq, 40 | const uint8_t * config, 41 | uint16_t interval, 42 | waps_item_t * item); 43 | 44 | /** 45 | * \brief Generate an indication after to scan neighbors is done 46 | * \param item 47 | * Where the indication is generated 48 | */ 49 | void Msap_onScannedNbors(waps_item_t * item); 50 | 51 | #endif /* WAPS_MSAP_H_ */ 52 | -------------------------------------------------------------------------------- /libraries/dualmcu/waps/sap/multicast.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | #ifndef _MULTICAST_H_ 7 | #define _MULTICAST_H_ 8 | 9 | #include "api.h" 10 | 11 | // Amount of multicast addresses supported. Must fit to storage. 12 | #define MULTICAST_ADDRESS_AMOUNT 10 13 | 14 | // Definition for multicast address 15 | typedef struct __attribute__ ((__packed__)) 16 | { 17 | uint8_t addr[3]; // LSB first 18 | } multicast_group_addr_t; 19 | 20 | /** 21 | * \brief Callback for querying group callback 22 | * \param group_addr 23 | * Address of the group 24 | * \return true: Is part of this group, false: Is not part of this group 25 | */ 26 | bool Multicast_isGroupCb(app_addr_t group_addr); 27 | 28 | /** 29 | * \brief Set multicast groups 30 | * \param groups 31 | * Pointer to the groups (non-aligned pointer) 32 | * \return Result of the operation 33 | */ 34 | app_res_e Multicast_setGroups(const uint8_t * groups); 35 | 36 | /** 37 | * \brief Get multicast groups 38 | * \param groups 39 | * Out: Pointer to the groups (non-aligned pointer). Note, value 0 is 40 | * used for replacement value of 0xffffffff (factory reset) 41 | * \return Result of the operation 42 | */ 43 | app_res_e Multicast_getGroups(uint8_t * groups); 44 | 45 | #endif /* SOURCE_DUALMCU_APP_WAPS_SAP_MULTICAST_H_ */ 46 | -------------------------------------------------------------------------------- /libraries/dualmcu/waps/waddr.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | 7 | #include "waddr.h" 8 | 9 | app_addr_t Waddr_to_Addr(w_addr_t waddr) 10 | { 11 | if(waddr == WADDR_BCAST) 12 | { 13 | return APP_ADDR_BROADCAST; 14 | } 15 | else if((waddr == 0) || (waddr == WADDR_ANYSINK)) 16 | { 17 | // Handle legacy anysink address (0) here as well 18 | return APP_ADDR_ANYSINK; 19 | } 20 | // No domain conversion is necessary 21 | return waddr; 22 | } 23 | 24 | w_addr_t Addr_to_Waddr(app_addr_t app_addr) 25 | { 26 | if(app_addr == APP_ADDR_BROADCAST) 27 | { 28 | return WADDR_BCAST; 29 | } 30 | else if(app_addr == APP_ADDR_ANYSINK) 31 | { 32 | // This is never executed. For data RX, the sink's unicast address is 33 | // always used instead. 34 | return WADDR_ANYSINK; 35 | } 36 | // No domain conversion is necessary 37 | return app_addr; 38 | } 39 | -------------------------------------------------------------------------------- /libraries/dualmcu/waps/waps_buffer_sizes.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | 7 | #ifndef WAPS_BUFFER_SIZES_H_ 8 | #define WAPS_BUFFER_SIZES_H_ 9 | 10 | #include "waps_frames.h" // For frame min/max length constants 11 | #include "crc.h" 12 | 13 | /** Worst case is _every_ WAPS UART frame character must be escaped */ 14 | #define WAPS_TX_BUFFER_SIZE ((2 * WAPS_MAX_FRAME_LENGTH) + 2 * sizeof(crc_t) + 2) 15 | #define WAPS_RX_BUFFER_SIZE ((WAPS_MAX_FRAME_LENGTH + sizeof(crc_t) + 2)) 16 | 17 | #endif /* WAPS_BUFFER_SIZES_H_ */ 18 | -------------------------------------------------------------------------------- /libraries/dualmcu/waps/waps_private.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | 7 | #ifndef SOURCE_WAPS_APP_WAPS_WAPS_PRIVATE_H_ 8 | #define SOURCE_WAPS_APP_WAPS_WAPS_PRIVATE_H_ 9 | 10 | #include 11 | 12 | #include "wms_settings.h" 13 | 14 | /** 15 | * \brief Get information about queued indications 16 | * \return 1 if indications queued 17 | * 0 if indications not queued 18 | */ 19 | uint8_t queued_indications(void); 20 | 21 | /** 22 | * \brief Wake WAPS up (something to do) 23 | */ 24 | void wakeup_task(void); 25 | 26 | /** 27 | * \brief Get number of channels available 28 | * \return Number of channels 29 | * \note Value is cached on startup 30 | */ 31 | app_lib_settings_net_channel_t get_num_channels(void); 32 | 33 | #endif /* SOURCE_WAPS_APP_WAPS_WAPS_PRIVATE_H_ */ 34 | -------------------------------------------------------------------------------- /libraries/libraries_init.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2021 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | 7 | #ifndef LIBRARIES_INIT_H_ 8 | #define LIBRARIES_INIT_H_ 9 | 10 | /** 11 | * \brief Generic Libraries initialization 12 | * \note Libraries must have an init function without parameter 13 | * And for backward compatibility reason, libraries should 14 | * behave correctly in case of multiple call to init 15 | */ 16 | void Libraries_init(void); 17 | 18 | #endif /* LIBRARIES_INIT_H_ */ 19 | -------------------------------------------------------------------------------- /libraries/positioning/poslib/poslib_da.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file poslib_da.h 3 | * @brief Header file for poslib_da.c 4 | * @copyright Wirepas Ltd 2021 5 | */ 6 | 7 | #ifndef _POSLIB_DA_H_ 8 | #define _POSLIB_DA_H_ 9 | 10 | #define POSLIB_DA_SRC_EP POS_SOURCE_ENDPOINT 11 | #define POSLIB_DA_DEST_EP POS_DESTINATION_ENDPOINT 12 | 13 | /** 14 | * @brief Starts the DA module with functionality required by node positioning mode 15 | * @param void 16 | * @return bool 17 | * true: DA started succesfully ; false: error occured 18 | */ 19 | bool PosLibDa_start(poslib_settings_t * settings); 20 | 21 | /** 22 | * @brief Stops the DA module 23 | * @param void 24 | * @return void 25 | * 26 | */ 27 | void PosLibDa_stop(); 28 | 29 | /** 30 | * @brief Sends data for DA tags 31 | * @param data pointer to data to sent \ref app_lib_data_to_send_t 32 | * sent_cb data sent callback 33 | * @return sent result code. see \ref app_lib_data_send_res_e 34 | */ 35 | app_lib_data_send_res_e PosLibDa_sendData(app_lib_data_to_send_t * data, 36 | app_lib_data_data_sent_cb_f sent_cb); 37 | #endif -------------------------------------------------------------------------------- /libraries/positioning/poslib/poslib_decode.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file poslib_decode.h 3 | * @brief Header file for poslib_decode.c 4 | * @copyright Wirepas Ltd 2021 5 | */ 6 | 7 | #ifndef _POSLIB_DECODE_H_ 8 | #define _POSLIB_DECODE_H_ 9 | 10 | /** 11 | * @brief defines the available app-config commands. 12 | */ 13 | typedef enum 14 | { 15 | POSLIB_MEASUREMENT_RATE_STATIC = 0x01, 16 | POSLIB_OPERATING_MODE = 0x02, 17 | POSLIB_MEASUREMENT_RATE_DYNAMIC = 0x03, 18 | POSLIB_OTAP = 0x04, 19 | POSLIB_MEASUREMENT_RATE_OFFLINE = 0x05, 20 | POSLIB_NODE_ADDR_SELECTION = 0x06, 21 | POSLIB_BEACON = 0x08, 22 | POSLIB_DEVICE_CLASS_CHANGE = 0x0A, 23 | POSLIB_MOTION_THRESHOLD = 0x0B, 24 | POSLIB_MOTION_DURATION = 0x0C, 25 | POSLIB_LED_ON_DURATION = 0x0E, 26 | POSLIB_LED_CMD_SEQ = 0x0F, 27 | } poslib_decode_msg_e; 28 | 29 | /** 30 | * @brief Decodes received configuration. 31 | * @param bytes 32 | * Pointer to configuration 33 | * @param num_bytes 34 | * Length of the configuration 35 | * @param settings 36 | * Pointer to a poslib_settings_t structure where 37 | * decoded settings will be stored 38 | * @return bool 39 | * true: decoding succesfull; false: decoding error 40 | */ 41 | bool PosLibDecode_config(const uint8_t * buffer, uint32_t length, 42 | poslib_settings_t * settings, poslib_aux_settings_t * aux); 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /libraries/positioning/poslib/poslib_mbcn.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file poslib_mbcn.h 3 | * @brief Header file for the poslib mini-beacon module 4 | * @copyright Wirepas Ltd. 2021 5 | */ 6 | 7 | #ifndef _POSLIB_MBCN_H_ 8 | #define _POSLIB_MBCN_H_ 9 | 10 | #include "poslib.h" 11 | #define PACKED_STRUCT struct __attribute__((__packed__)) 12 | 13 | /** 14 | @brief Mini-beacon payload struct 15 | */ 16 | typedef PACKED_STRUCT 17 | { 18 | uint16_t seq; 19 | uint8_t data[102 - sizeof(uint16_t)]; //FixME: replace 102 with define if exists! 20 | } poslib_mbcn_payload_t; 21 | 22 | /** 23 | @brief Starts sending periodic mini-beacons 24 | @param mbcn Pointer to poslib_mbcn_config_t structure with configuration. 25 | @return true: mini-beacons started, false: mini-beacons not started 26 | */ 27 | bool PosLibMbcn_start(poslib_mbcn_config_t * ); 28 | 29 | /** 30 | @brief Stops periodic mini-beacons 31 | @return void 32 | */ 33 | void PosLibMbcn_stop(); 34 | 35 | 36 | /** 37 | @brief Decodes the mini-beacon payload 38 | @param[in] buf Pointer to the received payload. 39 | @param[in] length length of the received payload buffer 40 | @param[out] mbcn pointer to a poslib_mbcn_data_t structure where decoded data will be stored 41 | @return true: decoding sucesfull, false: decoding error, data is invalid 42 | */ 43 | bool PosLibMbcn_decode(uint8_t * buf, uint8_t length, poslib_mbcn_data_t * mbcn); 44 | 45 | #endif /* _POSLIB_MBCN_H_ */ 46 | -------------------------------------------------------------------------------- /libraries/shared_libdata.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | 7 | /** 8 | * @file shared_libdata.h 9 | * 10 | * Shared_LibData library has been renamed Shared_Data. 11 | * 12 | * Please change the following in your code to be compatible with the new 13 | * library name: 14 | * - #include "shared_data.h" instead of #include "shared_libdata.h" 15 | * - Shared_Data_init(); instead of Shared_LibData_init(); 16 | * - Shared_Data_addDataReceivedCb(...); instead of 17 | * Shared_LibData_addDataReceivedCb(); 18 | * - Shared_Data_removeDataReceivedCb(...); instead of 19 | * Shared_LibData_removeDataReceivedCb(); 20 | * - Shared_Data_sendData(...); instead of Shared_LibData_sendData(...) 21 | * 22 | * Note also that Multicast packet filtering has changed to make it simpler 23 | * to manage large number of multicast groups. 24 | */ 25 | 26 | #ifndef _SHARED_LIBDATA_H_ 27 | #define _SHARED_LIBDATA_H_ 28 | 29 | #error "Shared_LibData library as been renamed, please see libraries/shared_libdata.h for an explanation." 30 | 31 | #endif //_SHARED_LIBDATA_H_ 32 | -------------------------------------------------------------------------------- /libraries/shared_neighbors/shared_neighbors.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | #ifndef _SHARED_NEIGHBORS_H_ 7 | #define _SHARED_NEIGHBORS_H_ 8 | 9 | #include "api.h" 10 | 11 | /** 12 | * @brief Initialize the shared neighbors library. 13 | * @note If shared state library is used in application, the 14 | * @ref app_lib_state_set_on_beacon_cb_f "lib_state->setOnBeaconCb()", 15 | * @ref app_lib_state_set_on_scan_nbors_with_type_cb_f "lib_state->setOnScanNborsCb()", 16 | * functions offered by state library MUST NOT be used outside of this module. 17 | * @return \ref APP_RES_OK. 18 | */ 19 | app_res_e Shared_Neighbors_init(void); 20 | 21 | /** 22 | * @brief Add a new callback about beacon received. 23 | * @param cb_scanned_neighbor 24 | * New callback to set 25 | * @param cb_id 26 | * id to be used with @ref Shared_State_removeBeaconCb. 27 | * Set only if return code is APP_RES_OK. 28 | * @return APP_RES_OK if ok. See \ref app_res_e for 29 | * other result codes. 30 | */ 31 | app_res_e Shared_Neighbors_addOnBeaconCb(app_lib_state_on_beacon_cb_f cb_scanned_neighbor, 32 | uint16_t * cb_id); 33 | 34 | /** 35 | * @brief Remove a received beacon item from the list. 36 | * Removed item fields are all set to 0. 37 | * @param cb_id 38 | * item to remove. 39 | */ 40 | app_res_e Shared_Neighbors_removeBeaconCb(uint16_t cb_id); 41 | 42 | #endif //_SHARED_NEIGHBORS_H_ 43 | -------------------------------------------------------------------------------- /makefile_bootloader_test.mk: -------------------------------------------------------------------------------- 1 | include makefile_common.mk 2 | 3 | .DEFAULT_GOAL := all 4 | 5 | 6 | # Linker for the bootloader 7 | LDSCRIPT := bootloader_test/linker/$(MCU)/gcc_bl_test_$(MCU)$(MCU_SUB)$(MCU_MEM_VAR).ld 8 | 9 | BOOTLOADER_TEST_ELF := $(BUILDPREFIX_TEST_BOOTLOADER)bootloader_test.elf 10 | 11 | # Include bootloader test makefile 12 | -include bootloader_test/makefile 13 | 14 | OBJS_ = $(SRCS:.c=.o) 15 | OBJS = $(addprefix $(BUILDPREFIX_TEST_BOOTLOADER), $(OBJS_)) 16 | 17 | $(BUILDPREFIX_TEST_BOOTLOADER)%.o : %.c 18 | $(MKDIR) $(@D) 19 | $(CC) $(INCLUDES) $(CFLAGS) -c $< -o $@ 20 | 21 | $(BOOTLOADER_TEST_ELF): $(OBJS) 22 | $(MKDIR) $(@D) 23 | $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ \ 24 | -Wl,-Map=$(BUILDPREFIX_TEST_BOOTLOADER)bootloader_test.map \ 25 | -Wl,-T,$(LDSCRIPT) $(LIBS) 26 | 27 | 28 | $(BOOTLOADER_TEST_HEX): $(BOOTLOADER_TEST_ELF) 29 | $(MKDIR) $(@D) 30 | $(OBJCOPY) $(BOOTLOADER_TEST_ELF) -O ihex $@ 31 | 32 | .PHONY: all 33 | all: $(BOOTLOADER_TEST_HEX) 34 | 35 | clean: 36 | $(RM) $(BOOTLOADER_TEST_HEX) 37 | -------------------------------------------------------------------------------- /makefile_stack.mk: -------------------------------------------------------------------------------- 1 | include makefile_common.mk 2 | 3 | .DEFAULT_GOAL := all 4 | 5 | 6 | stack_mode?=normal 7 | 8 | $(STACK_HEX): FORCE 9 | # Get the right stack from the image folder 10 | $(MKDIR) $(@D) 11 | @$(FMW_SEL) --firmware_path=$(IMAGE_PATH)\ 12 | --firmware_type="wp_stack"\ 13 | --output_path=$(@D)\ 14 | --output_name="wpc_stack"\ 15 | --mcu=$(MCU)\ 16 | --mcu_sub=$(MCU_SUB)\ 17 | --mcu_mem_var=$(MCU_MEM_VAR)\ 18 | --mac_profile=$(mac_profile)\ 19 | --mac_profileid=$(mac_profileid)\ 20 | --mode=$(stack_mode)\ 21 | --radio=$(radio)\ 22 | --radio_config=$(radio_config)\ 23 | --version=$(MIN_STACK_VERSION) 24 | 25 | .PHONY: all 26 | all: $(STACK_HEX) 27 | 28 | clean: 29 | $(RM) -rf $(STACK_HEX) 30 | 31 | # Special ruel to force other rule to run every time 32 | FORCE: 33 | -------------------------------------------------------------------------------- /mcu/common/entrypoint.s: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | 7 | /* Application entry point */ 8 | 9 | .syntax unified 10 | .arch armv6-m 11 | 12 | .section .entrypoint 13 | .thumb 14 | 15 | entrypoint: 16 | /* Branch directly to _start(), in start.c */ 17 | push {r0, r1} 18 | ldr r0, 1f 19 | str r0, [sp, #4] 20 | pop {r0, pc} 21 | .align 2 22 | 1: 23 | .word _start 24 | .word 0 25 | 26 | bl_info_header: 27 | /* Filled in by the bootloader */ 28 | .long 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff 29 | 30 | __for_future_use__: 31 | .long 0xffffffff, 0xffffffff, 0xffffffff 32 | 33 | /* 34 | * The linker will place the application tag and information 35 | * header (app_header in start.c) 48 bytes after the entrypoint 36 | */ 37 | -------------------------------------------------------------------------------- /mcu/common/makefile: -------------------------------------------------------------------------------- 1 | 2 | MCU_COMMON_SRCS_PATH := $(MCU_PATH)common/ 3 | 4 | ASM_SRCS += $(MCU_COMMON_SRCS_PATH)entrypoint.s 5 | SRCS += $(MCU_COMMON_SRCS_PATH)start.c 6 | 7 | include $(MCU_COMMON_SRCS_PATH)radio/makefile 8 | -------------------------------------------------------------------------------- /mcu/common/radio/makefile: -------------------------------------------------------------------------------- 1 | 2 | RADIO_PATH := $(MCU_COMMON_SRCS_PATH)radio/ 3 | 4 | # include power tables if defined 5 | ifneq ($(RADIO_CUSTOM_POWER_TABLE), ) 6 | SRCS += $(RADIO_PATH)radio.c 7 | CFLAGS += -DRADIO_CUSTOM_POWER_TABLE_H=\"$(RADIO_CUSTOM_POWER_TABLE)\" 8 | endif -------------------------------------------------------------------------------- /mcu/common/radio/radio.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | #include "board.h" 7 | #include "mcu.h" 8 | #include "api.h" 9 | 10 | // Include custom power table 11 | #if defined RADIO_CUSTOM_POWER_TABLE_H 12 | #include RADIO_CUSTOM_POWER_TABLE_H 13 | #endif 14 | 15 | void Radio_setPowerTable(const app_lib_radio_cfg_power_t * power_table) 16 | { 17 | if (lib_radio_cfg) 18 | { 19 | lib_radio_cfg->powerSetup(power_table); 20 | } 21 | } 22 | 23 | void Radio_setPA(const void * pa_cfg) 24 | { 25 | if (lib_radio_cfg) 26 | { 27 | lib_radio_cfg->paSetup(pa_cfg); 28 | } 29 | } 30 | 31 | // Perform application level radio init, i.e. set custom power table if any 32 | void Radio_init(void) 33 | { 34 | #if defined RADIO_CUSTOM_POWER_TABLE_H 35 | Radio_setPowerTable(get_custom_power_table()); 36 | #if defined RADIO_CUSTOM_PA_CONFIG 37 | Radio_setPA(get_custom_pa_config()); 38 | #endif 39 | #endif 40 | 41 | } 42 | -------------------------------------------------------------------------------- /mcu/efr/common/mcu.h: -------------------------------------------------------------------------------- 1 | #ifndef MCU_H_ 2 | #define MCU_H_ 3 | 4 | #include "em_bus.h" 5 | #include "em_device.h" 6 | #include "em_system.h" 7 | #include "em_emu.h" 8 | #ifdef EFR32FG12 9 | #include "efr32fg12/efr32_gpio.h" 10 | #elif defined EFR32FG13 11 | #include "efr32fg13/efr32_gpio.h" 12 | #elif defined EFR32MG21 13 | #include "efr32mg21/Include/efr32mg21_gpio.h" 14 | #include "efr32mg21/efr32_gpio.h" 15 | #elif defined EFR32MG22 16 | #include "efr32mg22/Include/efr32mg22_gpio.h" 17 | #include "efr32mg22/efr32_gpio.h" 18 | #elif defined EFR32FG23 19 | #include "efr32fg23/Include/efr32fg23_gpio.h" 20 | #include "efr32fg23/efr32_gpio.h" 21 | #elif defined EFR32MG12 22 | 23 | #else 24 | #error("EFR32FG12, EFR32MG12, EFR32FG13, EFR32MG21, EFR32MG22 or EFR32FG23 must be defined") 25 | #endif 26 | 27 | #endif /* MCU_H_ */ 28 | -------------------------------------------------------------------------------- /mcu/efr/common/vendor/em_device.h: -------------------------------------------------------------------------------- 1 | /* 2 | * em_device.h 3 | * 4 | * Chip variant include file selection. 5 | */ 6 | 7 | #ifndef EM_DEVICE_H_ 8 | #define EM_DEVICE_H_ 9 | 10 | #if defined(EFR32FG13) 11 | #include "efr32fg13/em_device_fg13.h" 12 | #define GPIO_PORT_MAX 5 13 | #elif defined(EFR32FG12) 14 | #include "efr32fg12/em_device_fg12.h" 15 | #define GPIO_PORT_MAX 10 16 | #elif defined(EFR32MG21) 17 | #include "efr32mg21/Include/em_device.h" 18 | #define GPIO_PORT_MAX 3 19 | #elif defined(EFR32MG22) 20 | #include "efr32mg22/Include/em_device.h" 21 | #define GPIO_PORT_MAX 3 22 | #elif defined(EFR32FG23) 23 | #include "efr32fg23/Include/em_device.h" 24 | #define GPIO_PORT_MAX 3 25 | #else 26 | #error "em_device.h: Unknown EFR32 PART" 27 | #endif 28 | 29 | #ifndef __SYSTEM_CLOCK 30 | #define __SYSTEM_CLOCK (38400000UL) 31 | #endif 32 | 33 | #endif /* EM_DEVICE_H_ */ 34 | -------------------------------------------------------------------------------- /mcu/efr/efr32/hal/ds.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | 7 | 8 | #include 9 | #include "hal_api.h" 10 | #include "api.h" 11 | 12 | // Bitmask holding different sleep control bits 13 | static volatile uint32_t m_sleep_mask = 0; 14 | 15 | void DS_Init(void) 16 | { 17 | m_sleep_mask = 0; 18 | } 19 | 20 | void DS_Enable(uint32_t source) 21 | { 22 | // Atomic operation 23 | Sys_enterCriticalSection(); 24 | // Clear bit 25 | m_sleep_mask &= ~source; 26 | // If mask is clear, enable deep sleep 27 | if(m_sleep_mask == 0) 28 | { 29 | // Enable deep sleep 30 | Sys_disableDs(false); 31 | } 32 | Sys_exitCriticalSection(); 33 | } 34 | 35 | void DS_Disable(uint32_t source) 36 | { 37 | // Atomic operation 38 | Sys_enterCriticalSection(); 39 | // Set bit 40 | m_sleep_mask |= source; 41 | // Disable deep sleep 42 | Sys_disableDs(true); 43 | Sys_exitCriticalSection(); 44 | } 45 | -------------------------------------------------------------------------------- /mcu/efr/efr32/hal/hal.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | #include "hal_api.h" 7 | 8 | /* Status of module */ 9 | static bool m_opened; 10 | 11 | bool HAL_Open(void) 12 | { 13 | if(!m_opened) 14 | { 15 | // Initialize deep sleep control module 16 | DS_Init(); 17 | m_opened = true; 18 | } 19 | return true; 20 | } 21 | -------------------------------------------------------------------------------- /mcu/efr/efr32/hal/radio/radio_power_table_efr32xg12_19dBm.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | #ifndef RADIO_POWER_TABLE_EFR32XG12_19DBM_H_ 7 | #define RADIO_POWER_TABLE_EFR32XG12_19DBM_H_ 8 | 9 | // +19 dBm power table for efr32xg12, with 8 power levels 10 | const app_lib_radio_cfg_power_t power_table_efr32xg12_19dBm = 11 | { 12 | .rx_current = 100, // 10 mA RX current 13 | .rx_gain_dbm = 0, // 0 dBm RX gain 14 | .power_count = 8, // 8 power levels 15 | .powers = 16 | { 17 | {5, -15, 1, 99}, 18 | {9, -10, 1, 114}, 19 | {15, -5, 1, 136}, 20 | {28, 0, 1, 183}, 21 | {46, 5, 1, 268}, 22 | {83, 10, 1, 439}, 23 | {150, 15, 1, 732}, 24 | {255, 19, 1, 1160}, 25 | }, 26 | }; 27 | 28 | #if defined RADIO_CUSTOM_POWER_TABLE_H 29 | __STATIC_INLINE const app_lib_radio_cfg_power_t * get_custom_power_table(void) 30 | { 31 | return &power_table_efr32xg12_19dBm; 32 | } 33 | #endif 34 | 35 | #endif /* RADIO_POWER_TABLE_EFR32XG12_19DBM_H_ */ 36 | -------------------------------------------------------------------------------- /mcu/efr/efr32/hal/radio/radio_power_table_efr32xg23_13dbm.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2022 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | #ifndef RADIO_POWER_TABLE_EFR32XG23_13DBM_H_ 7 | #define RADIO_POWER_TABLE_EFR32XG23_13DBM_H_ 8 | 9 | #include "rail_chip_specific.h" 10 | 11 | /** 12 | * Power table for efr32xg23 +13dBm. 13 | * */ 14 | const app_lib_radio_cfg_power_t power_table_efr32xg23_13dBm = 15 | { 16 | .rx_current = 69, // 6.9 mA RX current 17 | .rx_gain_dbm = 0, // 0 dBm RX gain 18 | .power_count = 8, // 8 power levels 19 | .powers = 20 | { 21 | { 2, -15, 1, 100 }, // -15.46 dBm, 10 mA 22 | { 5, -7, 1, 120 }, // -6.72 dBm, 12 mA 23 | { 7, -4, 1, 140 }, // -3.81 dBm, 14 mA 24 | { 11, 0, 1, 160 }, // -0.18 dBm, 16 mA 25 | { 18, 4, 1, 210 }, // 3.81 dBm, 21 mA 26 | { 30, 8, 1, 300 }, // 7.93 dBm, 30 mA 27 | { 45, 11, 1, 390 }, // 11.13 dBm, 39 mA 28 | { 55, 13, 1, 460 }, // 12.94 dBm, 46 mA 29 | }, 30 | }; 31 | 32 | #if defined RADIO_CUSTOM_POWER_TABLE_H 33 | __STATIC_INLINE const app_lib_radio_cfg_power_t * get_custom_power_table(void) 34 | { 35 | return &power_table_efr32xg23_13dBm; 36 | } 37 | #endif 38 | 39 | #endif /* RADIO_POWER_TABLE_EFR32XG23_13DBM_H_ */ 40 | -------------------------------------------------------------------------------- /mcu/efr/efr32/hal/radio/radio_power_table_efr32xg23_16dbm.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2022 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | #ifndef RADIO_POWER_TABLE_EFR32XG23_16DBM_H_ 7 | #define RADIO_POWER_TABLE_EFR32XG23_16DBM_H_ 8 | 9 | #include "rail_chip_specific.h" 10 | 11 | /** 12 | * Power table for efr32xg23 +16dBm. 13 | * */ 14 | const app_lib_radio_cfg_power_t power_table_efr32xg23_16dBm = 15 | { 16 | .rx_current = 69, // 6.9 mA RX current 17 | .rx_gain_dbm = 0, // 0 dBm RX gain 18 | .power_count = 8, // 8 power levels 19 | .powers = 20 | { 21 | { 2, -15, 1, 100 }, // -15.46 dBm, 10 mA 22 | { 5, -7, 1, 120 }, // -6.72 dBm, 12 mA 23 | { 7, -4, 1, 140 }, // -3.81 dBm, 14 mA 24 | { 11, 0, 1, 160 }, // -0.18 dBm, 16 mA 25 | { 18, 4, 1, 210 }, // 3.81 dBm, 21 mA 26 | { 30, 8, 1, 300 }, // 7.93 dBm, 30 mA 27 | { 50, 12, 1, 410 }, // 12.08 dBm, 41 mA 28 | { 91, 16, 1, 600 }, // 15.99 dBm, 60 mA 29 | }, 30 | }; 31 | 32 | #if defined RADIO_CUSTOM_POWER_TABLE_H 33 | __STATIC_INLINE const app_lib_radio_cfg_power_t * get_custom_power_table(void) 34 | { 35 | return &power_table_efr32xg23_16dBm; 36 | } 37 | #endif 38 | 39 | #endif /* RADIO_POWER_TABLE_EFR32XG23_16DBM_H_ */ 40 | -------------------------------------------------------------------------------- /mcu/efr/efr32/hal/radio/radio_power_table_efr32xg23_20dbm.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2022 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | #ifndef RADIO_POWER_TABLE_EFR32XG23_20DBM_H_ 7 | #define RADIO_POWER_TABLE_EFR32XG23_20DBM_H_ 8 | 9 | #include "rail_chip_specific.h" 10 | 11 | /** 12 | * Power table for efr32xg23 +20dBm. 13 | * */ 14 | const app_lib_radio_cfg_power_t power_table_efr32xg23_20dBm = 15 | { 16 | .rx_current = 69, // 6.9 mA RX current 17 | .rx_gain_dbm = 0, // 0 dBm RX gain 18 | .power_count = 8, // 8 power levels 19 | .powers = 20 | { 21 | { 3, -12, 1, 110 }, // -11.89 dBm, 11 mA 22 | { 6, -5, 1, 130 }, // -5.31 dBm, 13 mA 23 | { 11, 0, 1, 160 }, // -0.18 dBm, 16 mA 24 | { 18, 4, 1, 210 }, // 3.81 dBm, 21 mA 25 | { 30, 8, 1, 300 }, // 7.93 dBm, 30 mA 26 | { 50, 12, 1, 410 }, // 12.08 dBm, 41 mA 27 | { 91, 16, 1, 600 }, // 15.99 dBm, 60 mA 28 | { 214, 20, 1, 910 }, // 20.00 dBm, 91 mA 29 | }, 30 | }; 31 | 32 | #if defined RADIO_CUSTOM_POWER_TABLE_H 33 | __STATIC_INLINE const app_lib_radio_cfg_power_t * get_custom_power_table(void) 34 | { 35 | return &power_table_efr32xg23_20dBm; 36 | } 37 | #endif 38 | 39 | #endif /* RADIO_POWER_TABLE_EFR32XG23_20DBM_H_ */ 40 | -------------------------------------------------------------------------------- /mcu/efr/efr32/hal/uniqueId.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | 7 | #ifndef UNIQUEID_H 8 | #define UNIQUEID_H 9 | 10 | #include "mcu.h" 11 | 12 | static inline uint32_t getUniqueId() 13 | { 14 | return (uint32_t) SYSTEM_GetUnique(); 15 | } 16 | #endif 17 | -------------------------------------------------------------------------------- /mcu/efr/makefile: -------------------------------------------------------------------------------- 1 | MCU_PREFIX := $(MCU_PATH)$(MCU_FAMILY)/$(MCU)/ 2 | MCU_CONFIG := $(MCU_PREFIX)/config.mk 3 | MCU_COMMON := $(MCU_PATH)$(MCU_FAMILY)/common 4 | 5 | # Add include path for nrfx vendor files 6 | INCLUDES += -I$(MCU_COMMON)/vendor/ 7 | 8 | # Add include path for efr common header files 9 | INCLUDES += -I$(MCU_COMMON)/ 10 | 11 | # Include mcu specific configuration 12 | -include $(MCU_CONFIG) 13 | 14 | 15 | # Include MCU specific HAL drivers 16 | -include $(MCU_PREFIX)/hal/makefile 17 | 18 | -------------------------------------------------------------------------------- /mcu/hal_api/ds.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | 7 | #ifndef SOURCE_WAPS_APP_DRIVERS_DS_H_ 8 | #define SOURCE_WAPS_APP_DRIVERS_DS_H_ 9 | 10 | /** 11 | * \brief Initialize deep sleep control module 12 | */ 13 | void DS_Init(void); 14 | 15 | /** 16 | * \brief Enable deep sleep 17 | */ 18 | void DS_Enable(uint32_t source); 19 | 20 | /** 21 | * \brief Disable deep sleep 22 | */ 23 | void DS_Disable(uint32_t source); 24 | 25 | // Bitmasks for deep sleep disable bits 26 | #define DS_SOURCE_USART 0x00000001 27 | #define DS_SOURCE_USART_POWER 0x00000002 28 | #define DS_SOURCE_DEBUG 0x00000004 29 | #define DS_SOURCE_INIT 0x00000008 30 | 31 | #endif /* SOURCE_WAPS_APP_DRIVERS_DS_H_ */ 32 | -------------------------------------------------------------------------------- /mcu/hal_api/hal_api.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | 7 | /** 8 | * \file hal_api.h 9 | * 10 | * \brief Collection of common interfaces that Wirepas HAL implements. 11 | * 12 | */ 13 | 14 | #ifndef HAL_API_H_ 15 | #define HAL_API_H_ 16 | 17 | #include 18 | 19 | // Access to MCU 20 | #include "mcu.h" 21 | 22 | // USART driver 23 | #include "usart.h" 24 | 25 | // Deep sleep control 26 | #include "ds.h" 27 | 28 | // Voltage measurements examples 29 | #include "voltage.h" 30 | 31 | /** 32 | * \brief Initialize HAL 33 | * \return Status of operation 34 | */ 35 | bool HAL_Open(void); 36 | 37 | #endif /* HAL_API_H_ */ 38 | -------------------------------------------------------------------------------- /mcu/hal_api/makefile: -------------------------------------------------------------------------------- 1 | CFLAGS += -I$(HAL_API_PATH) 2 | 3 | # include drivers 4 | #MCU_PREFIX := $(MCU_PATH)$(MCU_FAMILY)/$(MCU)/ 5 | #include $(MCU_PREFIX)hal/makefile 6 | include $(MCU_PATH)$(MCU_FAMILY)/makefile -------------------------------------------------------------------------------- /mcu/hal_api/power.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | 7 | /** 8 | * \brief Generic power codes. 9 | */ 10 | #ifndef POWER_H_ 11 | #define POWER_H_ 12 | 13 | /** 14 | * \brief Enable DCDC converter. 15 | * 16 | * @note This function is only called from bootloader early_init 17 | * function. There is no need to call this explicitly if 18 | * @ref board_folder "board" has been defined correctly. 19 | * 20 | * @note This function is also called from board_init on nRF52 architectures 21 | * for legacy purposes. 22 | */ 23 | void Power_enableDCDC(); 24 | 25 | #endif /* POWER_H_ */ 26 | -------------------------------------------------------------------------------- /mcu/hal_api/radio.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | #ifndef RADIO_H_ 7 | #define RADIO_H_ 8 | 9 | /** 10 | * @brief Perform application level initialization of radio 11 | * 12 | * @note This function is only called from low level board initialization 13 | * functions. There is no need to call this explicitly if 14 | * @ref board_folder "board" has been defined correctly. 15 | * 16 | */ 17 | extern void Radio_init() __attribute__((weak)); 18 | 19 | #endif /* RADIO_H_ */ 20 | -------------------------------------------------------------------------------- /mcu/hal_api/voltage.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2021 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | 7 | /** 8 | * @file voltage.h 9 | * 10 | * @brief Voltage measurement *examples* for various processors. 11 | * 12 | * @note Voltage measurements are only *examples*. It should be verified 13 | * whether given measurement mechanism applies to hardware design or not. 14 | */ 15 | 16 | #ifndef _HAL_VOLTAGE_H_ 17 | #define _HAL_VOLTAGE_H_ 18 | 19 | #include 20 | 21 | /** 22 | * @brief Initialize voltage measurement mechanisms. Need to do once before 23 | * measurements. 24 | */ 25 | void Mcu_voltageInit(void); 26 | 27 | /** 28 | * @brief Measure processor voltage. What is measured depends on processor 29 | * type 30 | * 31 | * @return Voltage in millivolts 32 | * 33 | * @note Voltage measurements are only *examples*. It should be verified 34 | * whether given measurement mechanism applies to hardware design or not. 35 | * 36 | */ 37 | uint16_t Mcu_voltageGet(void); 38 | 39 | #endif /* _HAL_VOLTAGE_H_ */ 40 | -------------------------------------------------------------------------------- /mcu/nrf/common/hal/ds.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | 7 | 8 | #include 9 | #include "ds.h" 10 | #include "api.h" 11 | 12 | // Bitmask holding different sleep control bits 13 | static volatile uint32_t m_sleep_mask = 0; 14 | 15 | void DS_Init(void) 16 | { 17 | m_sleep_mask = 0; 18 | } 19 | 20 | void DS_Enable(uint32_t source) 21 | { 22 | // Atomic operation 23 | Sys_enterCriticalSection(); 24 | // Clear bit 25 | m_sleep_mask &= ~source; 26 | // If mask is clear, enable deep sleep 27 | if(m_sleep_mask == 0) 28 | { 29 | // Enable deep sleep 30 | Sys_disableDs(false); 31 | } 32 | Sys_exitCriticalSection(); 33 | } 34 | 35 | void DS_Disable(uint32_t source) 36 | { 37 | // Atomic operation 38 | Sys_enterCriticalSection(); 39 | // Some sources are declared NIL on this platform 40 | if(source == DS_SOURCE_USART_POWER) 41 | { 42 | // Usart power-up procedure does not need ds disable as the system 43 | // is very fast to wake up from deep sleep 44 | goto exit_no_change; 45 | } 46 | // Set bit 47 | m_sleep_mask |= source; 48 | // Disable deep sleep 49 | Sys_disableDs(true); 50 | exit_no_change: 51 | Sys_exitCriticalSection(); 52 | } 53 | -------------------------------------------------------------------------------- /mcu/nrf/common/hal/hal.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | #include "hal_api.h" 7 | 8 | /* For reading back cleared interrupt events in NRF52 */ 9 | __IO uint32_t EVENT_READBACK; /* declared in nrf.h */ 10 | 11 | /* Status of module */ 12 | static bool m_opened; 13 | 14 | bool HAL_Open(void) 15 | { 16 | if(!m_opened) 17 | { 18 | // Initialize deep sleep control module 19 | DS_Init(); 20 | m_opened = true; 21 | } 22 | return true; 23 | } 24 | -------------------------------------------------------------------------------- /mcu/nrf/common/mcu.h: -------------------------------------------------------------------------------- 1 | #ifndef MCU_H_ 2 | #define MCU_H_ 3 | 4 | #define NRF_STATIC_INLINE __STATIC_INLINE 5 | 6 | #if MCU_SUB == 832 7 | #define NRF52832_XXAA 8 | //#include "nrf52832_peripherals.h" 9 | #elif MCU_SUB == 840 10 | #undef NRF52 11 | #define NRF52840_XXAA 12 | //#include "nrf52840_peripherals.h" 13 | #elif MCU_SUB == 833 14 | #undef NRF52 15 | #define NRF52833_XXAA 16 | //#include "nrf52833_peripherals.h" 17 | #elif MCU_SUB == 60 18 | #define NRF9160_XXAA 19 | /** Define NRF_GPIO and GPIOTE_IRQn for nrf9160. */ 20 | #define NRF_GPIO NRF_P0 21 | #define GPIOTE_IRQn GPIOTE0_IRQn 22 | #define UART0_IRQn UARTE0_SPIM0_SPIS0_TWIM0_TWIS0_IRQn 23 | /** Define the last IRQ number in the interrupt vector */ 24 | #else 25 | #error SUB_MCU Must be 832 or 840 or 60 26 | #endif 27 | 28 | #include "nrfx.h" 29 | #include "mdk/nrf.h" 30 | #include "hal/nrf_gpio.h" 31 | #include "hal/nrf_gpiote.h" 32 | #include "hal/nrf_uarte.h" 33 | #include "hal/nrf_timer.h" 34 | 35 | extern __IO uint32_t EVENT_READBACK; 36 | 37 | #endif /* MCU_H_ */ 38 | -------------------------------------------------------------------------------- /mcu/nrf/common/vendor/get_vendor_files.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | python get_vendor_files.py 4 | 5 | -------------------------------------------------------------------------------- /mcu/nrf/common/vendor/mdk/system_nrf.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2009-2021 ARM Limited. All rights reserved. 4 | 5 | SPDX-License-Identifier: Apache-2.0 6 | 7 | Licensed under the Apache License, Version 2.0 (the License); you may 8 | not use this file except in compliance with the License. 9 | You may obtain a copy of the License at 10 | 11 | www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, software 14 | distributed under the License is distributed on an AS IS BASIS, WITHOUT 15 | WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | See the License for the specific language governing permissions and 17 | limitations under the License. 18 | 19 | NOTICE: This file has been modified by Nordic Semiconductor ASA. 20 | 21 | */ 22 | 23 | #ifndef SYSTEM_NRF_H 24 | #define SYSTEM_NRF_H 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | #include 31 | 32 | 33 | extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ 34 | 35 | /** 36 | * Initialize the system 37 | * 38 | * @param none 39 | * @return none 40 | * 41 | * @brief Setup the microcontroller system. 42 | * Initialize the System and update the SystemCoreClock variable. 43 | */ 44 | extern void SystemInit (void); 45 | 46 | /** 47 | * Update SystemCoreClock variable 48 | * 49 | * @param none 50 | * @return none 51 | * 52 | * @brief Updates the SystemCoreClock with current core Clock 53 | * retrieved from cpu registers. 54 | */ 55 | extern void SystemCoreClockUpdate (void); 56 | 57 | #ifdef __cplusplus 58 | } 59 | #endif 60 | 61 | #endif /* SYSTEM_NRF_H */ 62 | -------------------------------------------------------------------------------- /mcu/nrf/makefile: -------------------------------------------------------------------------------- 1 | MCU_PREFIX := $(MCU_PATH)$(MCU_FAMILY)/$(MCU)/ 2 | MCU_CONFIG := $(MCU_PREFIX)config.mk 3 | VENDOR_PREFIX := $(MCU_PATH)$(MCU_FAMILY)/common/vendor/ 4 | NRF_FAMILY_HAL_PREFIX := $(MCU_PATH)$(MCU_FAMILY)/common/hal/ 5 | 6 | # Add include path for nrfx vendor files 7 | INCLUDES += -I$(VENDOR_PREFIX) 8 | INCLUDES += -I$(VENDOR_PREFIX)mdk/ 9 | INCLUDES += -I$(VENDOR_PREFIX)templates/ 10 | INCLUDES += -I$(VENDOR_PREFIX)drivers/ 11 | 12 | # Add include path for nrfx common header files 13 | INCLUDES += -I$(MCU_PATH)$(MCU_FAMILY)/common/ 14 | 15 | # Include mcu specific configuration 16 | -include $(MCU_CONFIG) 17 | 18 | # Include MCU specific HAL drivers 19 | -include $(MCU_PREFIX)hal/makefile 20 | 21 | # Build common HAL drivers for nrf-family 22 | ifeq ($(HAL_SPI), yes) 23 | SRCS += $(NRF_FAMILY_HAL_PREFIX)spi.c 24 | endif 25 | 26 | ifeq ($(HAL_BUTTON), yes) 27 | SRCS += $(NRF_FAMILY_HAL_PREFIX)button.c 28 | endif 29 | 30 | ifeq ($(HAL_LED), yes) 31 | SRCS += $(NRF_FAMILY_HAL_PREFIX)led.c 32 | endif 33 | 34 | ifeq ($(HAL_PERSISTENT_MEMORY), yes) 35 | SRCS += $(NRF_FAMILY_HAL_PREFIX)persistent.c 36 | endif 37 | 38 | ifeq ($(HAL_HW_DELAY), yes) 39 | SRCS += $(NRF_FAMILY_HAL_PREFIX)hw_delay.c 40 | endif 41 | SRCS += $(NRF_FAMILY_HAL_PREFIX)ds.c \ 42 | $(NRF_FAMILY_HAL_PREFIX)hal.c -------------------------------------------------------------------------------- /mcu/nrf/nrf52/config.mk: -------------------------------------------------------------------------------- 1 | # Mcu instruction set 2 | ARCH=armv7e-m 3 | 4 | # This mcu has a bootloader (enough memory) 5 | HAS_BOOTLOADER=yes 6 | 7 | CFLAGS += -DNRF52_PLATFORM 8 | 9 | ifeq ($(MCU_SUB),832) 10 | # Hardware magic used for this architecture 11 | HW_MAGIC=03 12 | HW_VARIANT_ID=03 13 | else ifeq ($(MCU_SUB),840) 14 | # Hardware magic used for this architecture 15 | HW_MAGIC=06 16 | HW_VARIANT_ID=06 17 | else ifeq ($(MCU_SUB),833) 18 | # Hardware magic used for this architecture 19 | HW_MAGIC=09 20 | HW_VARIANT_ID=09 21 | else 22 | $(error "Invalid MCU_SUB for nrf52! $(MCU_SUB) only 832, 833 and 840 supported") 23 | endif 24 | 25 | # Add custom flags 26 | # Remove the -Wunused-parameter flag added by -Wextra as some cortex M4 header do not respect it 27 | CFLAGS += -Wno-unused-parameter 28 | 29 | # This mcu uses the version 3 of the bootloader (with external flash support) 30 | BOOTLOADER_VERSION=v3 31 | -------------------------------------------------------------------------------- /mcu/nrf/nrf52/hal/makefile: -------------------------------------------------------------------------------- 1 | NRF52_HAL_PREFIX := $(MCU_PREFIX)hal/ 2 | 3 | # Add include path for nrf52 specific HAL header files 4 | INCLUDES += -I$(NRF52_HAL_PREFIX) 5 | 6 | # Build nrf52 specific HAL drivers 7 | ifeq ($(HAL_UART), yes) 8 | # Check version 9 | ifeq ($(UART_USE_DMA), yes) 10 | SRCS += $(NRF52_HAL_PREFIX)usart_dma.c 11 | else ifeq ($(UART_USE_USB), yes) 12 | ifeq ($(filter 833 840,$(MCU_SUB)),) 13 | $(error Board $(target_board) doesn't support USB (only nrf52833 or nrf52840)) 14 | else 15 | $(info Uart used with USB) 16 | endif 17 | include $(NRF52_HAL_PREFIX)usb_uart/makefile 18 | SRCS += $(NRF52_HAL_PREFIX)usart_usb.c 19 | else 20 | SRCS += $(NRF52_HAL_PREFIX)usart.c 21 | endif 22 | endif 23 | 24 | ifeq ($(HAL_I2C), yes) 25 | SRCS += $(NRF52_HAL_PREFIX)i2c.c 26 | endif 27 | 28 | ifeq ($(HAL_VOLTAGE), yes) 29 | # Different subprocessors have different 30 | ifeq ($(MCU_SUB), 832) 31 | SRCS += $(NRF52_HAL_PREFIX)voltage_52832.c 32 | else 33 | SRCS += $(NRF52_HAL_PREFIX)voltage_52833_52840.c 34 | endif 35 | endif 36 | 37 | SRCS += $(NRF52_HAL_PREFIX)power.c -------------------------------------------------------------------------------- /mcu/nrf/nrf52/hal/power.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | #include "board.h" 7 | #include "power.h" 8 | 9 | #include "mcu.h" 10 | 11 | void Power_enableDCDC() 12 | { 13 | #if BOARD_HW_DCDC 14 | NRF_POWER->DCDCEN = POWER_DCDCEN_DCDCEN_Enabled << POWER_DCDCEN_DCDCEN_Pos; 15 | #endif 16 | } 17 | -------------------------------------------------------------------------------- /mcu/nrf/nrf52/hal/radio/radio_power_table_nrf52840_4dBm.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | #ifndef RADIO_POWER_TABLE_NRF52840_4DBM_H_ 7 | #define RADIO_POWER_TABLE_NRF52840_4DBM_H_ 8 | 9 | // For RADIO_TX_POWER_XXX 10 | #include "mcu/nrf/common/vendor/mdk/nrf52840_bitfields.h" 11 | 12 | // +4 dBm power table for nrf52840, with 8 power levels 13 | const app_lib_radio_cfg_power_t power_table_nrf52840_4dBm = 14 | { 15 | .rx_current = 46, // 4.6 mA RX current 16 | .rx_gain_dbm = 0, // 0 dBm RX gain 17 | .power_count = 8, // 8 power levels 18 | .powers = 19 | { 20 | {RADIO_TXPOWER_TXPOWER_Neg40dBm, -40, 1, 23}, 21 | {RADIO_TXPOWER_TXPOWER_Neg20dBm, -20, 1, 27}, 22 | {RADIO_TXPOWER_TXPOWER_Neg16dBm, -16, 1, 28}, 23 | {RADIO_TXPOWER_TXPOWER_Neg12dBm, -12, 1, 30}, 24 | {RADIO_TXPOWER_TXPOWER_Neg8dBm, -8, 1, 33}, 25 | {RADIO_TXPOWER_TXPOWER_Neg4dBm, -4, 1, 37}, 26 | {RADIO_TXPOWER_TXPOWER_0dBm, 0, 1, 48}, 27 | {RADIO_TXPOWER_TXPOWER_Pos4dBm, 4, 1, 96}, 28 | }, 29 | }; 30 | 31 | #if defined RADIO_CUSTOM_POWER_TABLE_H 32 | __STATIC_INLINE const app_lib_radio_cfg_power_t * get_custom_power_table(void) 33 | { 34 | return &power_table_nrf52840_4dBm; 35 | } 36 | #endif 37 | 38 | #endif /* RADIO_POWER_TABLE_NRF52840_4DBM_H_ */ 39 | -------------------------------------------------------------------------------- /mcu/nrf/nrf52/hal/uniqueId.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | 7 | #ifndef UNIQUEID_H 8 | #define UNIQUEID_H 9 | 10 | #include "mcu.h" 11 | 12 | static inline uint32_t getUniqueId() 13 | { 14 | return NRF_FICR->DEVICEID[0]; 15 | } 16 | #endif 17 | -------------------------------------------------------------------------------- /mcu/nrf/nrf52/hal/usart_usb.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | #include 7 | #include 8 | #include 9 | 10 | #include "board.h" 11 | #include "hal_api.h" 12 | #include "api.h" 13 | #include "usb_wrapper.h" 14 | 15 | 16 | static serial_rx_callback_f m_cb; 17 | 18 | static void usb_cb(uint8_t * ch, size_t n) 19 | { 20 | if (m_cb != NULL) 21 | { 22 | m_cb(ch, n); 23 | } 24 | } 25 | 26 | bool Usart_init(uint32_t baudrate, uart_flow_control_e flow_control) 27 | { 28 | (void) baudrate; 29 | (void) flow_control; 30 | return Usb_wrapper_init(usb_cb); 31 | } 32 | 33 | void Usart_setEnabled(bool enabled) 34 | { 35 | 36 | } 37 | 38 | void Usart_receiverOn(void) 39 | { 40 | 41 | } 42 | 43 | void Usart_receiverOff(void) 44 | { 45 | 46 | } 47 | 48 | bool Usart_setFlowControl(uart_flow_control_e flow) 49 | { 50 | (void) flow; 51 | return true; 52 | } 53 | 54 | 55 | uint32_t Usart_sendBuffer(const void * buffer, uint32_t length) 56 | { 57 | return Usb_wrapper_sendBuffer(buffer, length); 58 | } 59 | 60 | void Usart_enableReceiver(serial_rx_callback_f rx_callback) 61 | { 62 | m_cb = rx_callback; 63 | } 64 | 65 | uint32_t Usart_getMTUSize(void) 66 | { 67 | return 512; 68 | } 69 | 70 | void Usart_flush(void) 71 | { 72 | // Flush is mainly called before a reboot (stop stack) 73 | // Just wait a bit for transfert to be finish toward the host 74 | volatile uint32_t timeout = 20000; 75 | while(timeout > 0) 76 | { 77 | timeout--; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /mcu/nrf/nrf52/hal/usb_uart/usb_wrapper.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | 7 | /* 8 | * \file usb_wrapper.h 9 | * \brief This file is the Wirepas wrapper for tinyusb stack 10 | */ 11 | 12 | #include 13 | 14 | /** 15 | * \brief Callback to be called when bytes are received 16 | */ 17 | typedef void (*Usb_wrapper_rx_callback_f)(uint8_t * ch, size_t n); 18 | 19 | /** 20 | * \brief Send a buffer 21 | * \param buffer 22 | * Buffer to send 23 | * \param length 24 | * Size of the buffer 25 | */ 26 | uint32_t Usb_wrapper_sendBuffer(const void * buffer, uint32_t length); 27 | 28 | /** 29 | * \brief Initialize the tiny usb wrapper 30 | * \param cb 31 | * Callback to be called when bytes are received 32 | * \return True if successful, false otherwise 33 | */ 34 | bool Usb_wrapper_init(Usb_wrapper_rx_callback_f cb); 35 | 36 | -------------------------------------------------------------------------------- /mcu/nrf/nrf91/config.mk: -------------------------------------------------------------------------------- 1 | # Mcu instruction set 2 | ARCH=armv8-m.main 3 | CFLAGS += -mfloat-abi=hard -mfpu=fpv5-sp-d16 4 | # Libraries to be build for Cortex-M33 5 | CM33 := yes 6 | CFLAGS += -DARM_MATH_ARMV8MML 7 | # This mcu has a bootloader (enough memory) 8 | HAS_BOOTLOADER=yes 9 | 10 | CFLAGS += -DNRF91_PLATFORM 11 | mac_profile?=dect_nr_19_ghz 12 | radio?=none 13 | ifeq ($(MCU_SUB),60) 14 | # Hardware magic used for this architecture 15 | HW_MAGIC=12 16 | HW_VARIANT_ID=12 17 | else 18 | $(error "Invalid MCU_SUB for nrf91! $(MCU_SUB) only 60 supported") 19 | endif 20 | 21 | # Add custom flags 22 | # Remove the -Wunused-parameter flag added by -Wextra as some cortex M4 header do not respect it 23 | CFLAGS += -Wno-unused-parameter 24 | 25 | # This mcu uses the version 3 of the bootloader (with external flash support) 26 | BOOTLOADER_VERSION=v3 27 | -------------------------------------------------------------------------------- /mcu/nrf/nrf91/hal/makefile: -------------------------------------------------------------------------------- 1 | NRF91_HAL_PREFIX := $(MCU_PREFIX)hal/ 2 | 3 | # Add include path for nrf91 specific HAL header files 4 | INCLUDES += -I$(NRF91_HAL_PREFIX) 5 | 6 | # Build nrf91 specific HAL drivers 7 | ifeq ($(HAL_UART), yes) 8 | # Check version 9 | ifeq ($(UART_USE_USB), yes) 10 | $(error Board $(target_board) doesn't support USB currently) 11 | else 12 | SRCS += $(NRF91_HAL_PREFIX)usart_dma.c 13 | endif 14 | endif 15 | 16 | ifeq ($(HAL_I2C), yes) 17 | SRCS += $(NRF91_HAL_PREFIX)i2c.c 18 | endif 19 | 20 | SRCS += $(NRF91_HAL_PREFIX)power.c 21 | -------------------------------------------------------------------------------- /mcu/nrf/nrf91/hal/power.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2021 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | #include "board.h" 7 | #include "power.h" 8 | 9 | #include "mcu.h" 10 | 11 | void Power_enableDCDC() 12 | { 13 | #if BOARD_HW_DCDC 14 | NRF_REGULATORS->DCDCEN = REGULATORS_DCDCEN_DCDCEN_Enabled << REGULATORS_DCDCEN_DCDCEN_Pos; 15 | #endif 16 | } 17 | -------------------------------------------------------------------------------- /mcu/nrf/nrf91/hal/uniqueId.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2021 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | 7 | #ifndef UNIQUEID_H 8 | #define UNIQUEID_H 9 | 10 | #include "mcu.h" 11 | 12 | static inline uint32_t getUniqueId() 13 | { 14 | return NRF_FICR->INFO.DEVICEID[0]; 15 | } 16 | #endif 17 | -------------------------------------------------------------------------------- /mcu/nrf/nrf91/ini_files/nrf9160_platform.ini: -------------------------------------------------------------------------------- 1 | ; Platform configuration for genscratchpad.py 2 | ; 3 | ; Comments begin with ";" and are ignored. 4 | ; 5 | ; Nordic Semiconductor nRF9160 with AES crypto library 6 | 7 | ; 8 | [platform] 9 | aes_little_endian = False ; AES CTR endianess -------------------------------------------------------------------------------- /projects/doxygen/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:18.04 2 | 3 | 4 | FROM ubuntu:18.04 as builder 5 | 6 | ENV USER=wirepas 7 | ENV HOME=/home/wirepas 8 | ENV APP_HOME=${HOME}/app 9 | 10 | RUN groupadd -r ${USER} --gid 1000 \ 11 | && useradd --uid 1000 -r -g ${USER} ${USER} 12 | 13 | RUN apt-get update \ 14 | && DEBIAN_FRONTEND=noninteractive apt-get install -y \ 15 | doxygen graphviz nano git\ 16 | && rm -rf /var/lib/apt/lists/* 17 | 18 | WORKDIR ${APP_HOME} 19 | RUN chown ${USER}:${USER} -R ${HOME} 20 | USER wirepas 21 | 22 | CMD ["doxygen", "docs/Doxyfile"] 23 | -------------------------------------------------------------------------------- /projects/doxygen/footer.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /projects/doxygen/media/addressing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wirepas/wm-sdk/7305a2625220f6e8f42b6fba84b7d2c3e4db9d17/projects/doxygen/media/addressing.png -------------------------------------------------------------------------------- /projects/doxygen/media/alert.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wirepas/wm-sdk/7305a2625220f6e8f42b6fba84b7d2c3e4db9d17/projects/doxygen/media/alert.jpg -------------------------------------------------------------------------------- /projects/doxygen/media/communication_directions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wirepas/wm-sdk/7305a2625220f6e8f42b6fba84b7d2c3e4db9d17/projects/doxygen/media/communication_directions.png -------------------------------------------------------------------------------- /projects/doxygen/media/image1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wirepas/wm-sdk/7305a2625220f6e8f42b6fba84b7d2c3e4db9d17/projects/doxygen/media/image1.png -------------------------------------------------------------------------------- /projects/doxygen/media/image3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wirepas/wm-sdk/7305a2625220f6e8f42b6fba84b7d2c3e4db9d17/projects/doxygen/media/image3.png -------------------------------------------------------------------------------- /projects/doxygen/media/image4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wirepas/wm-sdk/7305a2625220f6e8f42b6fba84b7d2c3e4db9d17/projects/doxygen/media/image4.png -------------------------------------------------------------------------------- /projects/doxygen/media/image5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wirepas/wm-sdk/7305a2625220f6e8f42b6fba84b7d2c3e4db9d17/projects/doxygen/media/image5.png -------------------------------------------------------------------------------- /projects/doxygen/media/image6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wirepas/wm-sdk/7305a2625220f6e8f42b6fba84b7d2c3e4db9d17/projects/doxygen/media/image6.png -------------------------------------------------------------------------------- /projects/doxygen/media/image7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wirepas/wm-sdk/7305a2625220f6e8f42b6fba84b7d2c3e4db9d17/projects/doxygen/media/image7.png -------------------------------------------------------------------------------- /projects/doxygen/media/image8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wirepas/wm-sdk/7305a2625220f6e8f42b6fba84b7d2c3e4db9d17/projects/doxygen/media/image8.png -------------------------------------------------------------------------------- /projects/doxygen/media/main_components.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wirepas/wm-sdk/7305a2625220f6e8f42b6fba84b7d2c3e4db9d17/projects/doxygen/media/main_components.png -------------------------------------------------------------------------------- /projects/doxygen/media/small_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wirepas/wm-sdk/7305a2625220f6e8f42b6fba84b7d2c3e4db9d17/projects/doxygen/media/small_logo.png -------------------------------------------------------------------------------- /projects/doxygen/template/doc.tex: -------------------------------------------------------------------------------- 1 | % WIREPAS_LATEX.TEX 2 | % 3 | % Based on REFMAN.CLS (LaTeX2e) 4 | % 5 | % Author 6 | % Pedro Silva 7 | 8 | \documentclass[a4paper]{article} 9 | 10 | %%% Set Author, Version Number and Title 11 | \newcommand{\myauthor}{Tobias} 12 | \newcommand{\docclass}{Reference Manual} 13 | \newcommand{\docstatus}{Confidential} 14 | \newcommand{\vnum}{#DOCUMENT_VERSION} 15 | \newcommand{\mytitle}{#DOCUMENT_TITLE - \vnum} 16 | 17 | \newcommand{\mycustomref}[1]{\textbf{Fig. \ref{#1}}} 18 | 19 | %% Generic packages 20 | \input{preamble} 21 | 22 | \begin{document} 23 | \thispagestyle{empty} 24 | 25 | \vspace*{2cm} 26 | \includegraphics[width=\linewidth]{wm-logo.png} 27 | 28 | \vspace*{2.5cm} 29 | 30 | \begin{LARGE} 31 | \mytitle 32 | \end{LARGE} 33 | 34 | \vspace*{2.5cm} 35 | 36 | \begin{Large} 37 | \docclass 38 | \end{Large} 39 | 40 | \vspace*{1cm} 41 | 42 | Version: \vnum 43 | 44 | #DOCUMENT_DESCRIPTION 45 | 46 | \vspace*{2.5cm} 47 | 48 | \begin{Huge} 49 | \docstatus 50 | \end{Huge} 51 | 52 | \newpage 53 | 54 | \tableofcontents 55 | 56 | \newpage 57 | 58 | %%% Sections and end of file to be appended 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /projects/doxygen/template/wm-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wirepas/wm-sdk/7305a2625220f6e8f42b6fba84b7d2c3e4db9d17/projects/doxygen/template/wm-logo.png -------------------------------------------------------------------------------- /source/Readme.md: -------------------------------------------------------------------------------- 1 | # Application folder 2 | 3 | Multiple applications are provided in the SDK. They are classified in 4 | different folders depending on their purpose. 5 | 6 | ## [Reference apps](reference_apps/Readme.md) 7 | 8 | These applications are reference application which are heavily tested by Wirepas. 9 | They can be a strong foundation to be used in a product with minimal adaptation. 10 | 11 | ## [Example apps](example_apps/Readme.md) 12 | 13 | These applications demonstrate a feature or a use case example. 14 | They are more complete application examples but require most of the time modifications. 15 | 16 | ## [Unitary apps](./unitary_apps/Readme.md) 17 | 18 | These applications demonstrate a single feature or a Wirepas library. They are not 19 | full application and are not doing anything useful except demonstrating the 20 | usage of a feature. 21 | 22 | -------------------------------------------------------------------------------- /source/example_apps/Readme.md: -------------------------------------------------------------------------------- 1 | # Example applications -------------------------------------------------------------------------------- /source/example_apps/battery_voltage_read_app/config.mk: -------------------------------------------------------------------------------- 1 | # Boards compatible with this app 2 | TARGET_BOARDS := pca10056 pca10100 pca10040 ruuvitag silabs_brd4254a tbsense2 silabs_brd4253a silabs_brd4180b silabs_brd4184a silabs_brd4181b 3 | # 4 | # Network default settings configuration 5 | # 6 | 7 | # This is only implemented for couple of boards 8 | 9 | # If this section is removed, node has to be configured in 10 | # a different way 11 | default_network_address ?= 0x2ebe92 12 | default_network_channel ?= 27 13 | # !HIGHLY RECOMMENDED! : To enable security keys please un-comment the lines below and fill with a 14 | # randomly generated authentication & encryption keys (exactly 16 bytes) 15 | #default_network_cipher_key ?= 0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x?? 16 | #default_network_authen_key ?= 0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x?? 17 | 18 | # 19 | # App specific configuration 20 | # 21 | 22 | # Define a specific application area_id 23 | app_specific_area_id=0x0dc9ed 24 | 25 | # App version 26 | app_major=1 27 | app_minor=0 28 | app_maintenance=0 29 | app_development=1 30 | -------------------------------------------------------------------------------- /source/example_apps/battery_voltage_read_app/makefile: -------------------------------------------------------------------------------- 1 | # Uses app scheduler 2 | APP_SCHEDULER=yes 3 | APP_SCHEDULER_TASKS=1 4 | 5 | #Uses app printing 6 | APP_PRINTING=yes 7 | 8 | #Uses tinyCBOR 9 | TINY_CBOR=yes 10 | 11 | # And HAL voltage measurement examples 12 | HAL_VOLTAGE=yes 13 | -------------------------------------------------------------------------------- /source/example_apps/ble_scanner/config.mk: -------------------------------------------------------------------------------- 1 | # Boards compatible with this app 2 | TARGET_BOARDS := silabs_brd4254a pca10056 promistel_rpi_hat pca10100 ublox_b204 tbsense2 pca10040 3 | # 4 | # Network default settings configuration 5 | # 6 | 7 | # If this section is removed, node has to be configured in 8 | # a different way 9 | default_network_address ?= 0xefd4a2 10 | default_network_channel ?= 2 11 | # !HIGHLY RECOMMENDED! : To enable security keys please un-comment the lines below and fill with a 12 | # randomly generated authentication & encryption keys (exactly 16 bytes) 13 | #default_network_cipher_key ?= 0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x?? 14 | #default_network_authen_key ?= 0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x?? 15 | 16 | # 17 | # App specific configuration 18 | # 19 | 20 | # Define a specific application area_id 21 | app_specific_area_id=0x5bde2a 22 | 23 | # App version 24 | app_major=2 25 | app_minor=0 26 | app_maintenance=0 27 | app_development=0 28 | -------------------------------------------------------------------------------- /source/example_apps/ble_scanner/config_dualmcu.mk: -------------------------------------------------------------------------------- 1 | # Boards compatible with this app 2 | TARGET_BOARDS := silabs_brd4254a pca10056 promistel_rpi_hat pca10100 ublox_b204 tbsense2 pca10040 3 | include $(APP_SRCS_PATH)/config.mk 4 | 5 | # Target board must be redefined even if same as included base config 6 | 7 | # In this alternate config, include dualmcu interface 8 | dualmcu_interface=yes 9 | -------------------------------------------------------------------------------- /source/example_apps/ble_scanner/makefile: -------------------------------------------------------------------------------- 1 | # Adding ble scanner module 2 | SRCS += $(SRCS_PATH)ble_scanner.c 3 | INCLUDES += -I$(SRCS_PATH) 4 | 5 | # Two tasks are needed for the scanner part 6 | APP_SCHEDULER=yes 7 | APP_SCHEDULER_TASKS=2 8 | 9 | SHARED_DATA=yes 10 | STACK_STATE_LIB=yes 11 | 12 | HAL_LED=yes 13 | 14 | ifeq ($(dualmcu_interface), yes) 15 | # Enable dualmcu with UART and 16 | # and dma to support high baudrate 17 | HAL_UART=yes 18 | UART_USE_DMA=yes 19 | DUALMCU_LIB=yes 20 | CFLAGS += -DDUALMCU_INTERFACE 21 | else 22 | APP_PRINTING=yes 23 | endif 24 | -------------------------------------------------------------------------------- /source/example_apps/control_node/config.mk: -------------------------------------------------------------------------------- 1 | # Boards compatible with this app 2 | TARGET_BOARDS := silabs_brd4254a efr32_template pca10059 silabs_brd4180b pca10056 nrf52_template silabs_brd4184a silabs_brd4181b promistel_rpi_hat pca10100 ublox_b204 tbsense2 pca10112 pca10040 bgm220-ek4314a wuerth_261101102 silabs_brd4210a mdbt50q_rx nrf52832_mdk_v2 ruuvitag pan1780 silabs_brd4312a silabs_brd4253a 3 | # 4 | # Network default settings configuration 5 | # 6 | 7 | # If this section is removed, node has to be configured in 8 | # a different way 9 | default_network_address ?= 0xB689E6 10 | default_network_channel ?= 3 11 | 12 | # !HIGHLY RECOMMENDED! : To enable security keys please un-comment the lines below and fill with a 13 | # randomly generated authentication & encryption keys (exactly 16 bytes) 14 | #default_network_cipher_key ?= 0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x?? 15 | #default_network_authen_key ?= 0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x?? 16 | 17 | # 18 | # App specific configuration 19 | # 20 | 21 | # Define a specific application area_id 22 | app_specific_area_id=0x8030B2 23 | 24 | # Control node app default settings 25 | # The diagnostic period is low for more reactivity during tests. 26 | # A value of 12 hours is recommended for production. 27 | default_diag_period_ms=60000 28 | default_packet_ttl_ms=250 29 | 30 | # App version 31 | app_major=$(sdk_major) 32 | app_minor=$(sdk_minor) 33 | app_maintenance=$(sdk_maintenance) 34 | app_development=1 -------------------------------------------------------------------------------- /source/example_apps/control_node/makefile: -------------------------------------------------------------------------------- 1 | 2 | # Control node app default settings (set in config.mk) 3 | CFLAGS += -DCONF_DIAG_PERIOD_MS=$(default_diag_period_ms) 4 | CFLAGS += -DCONF_PKT_TTL_MS=$(default_packet_ttl_ms) 5 | 6 | # This application use HAL for buttons 7 | HAL_BUTTON=yes 8 | 9 | APP_SCHEDULER=yes 10 | APP_SCHEDULER_TASKS=1 11 | 12 | # Enable Control library 13 | CONTROL_NODE=yes 14 | 15 | # Uncomment to enable debug logs (has no effect on board without serial port) 16 | # Note: This is disabled by default to avoid overconsumption. 17 | # APP_PRINTING=yes 18 | -------------------------------------------------------------------------------- /source/example_apps/control_router/config.mk: -------------------------------------------------------------------------------- 1 | # Boards compatible with this app 2 | TARGET_BOARDS := silabs_brd4254a efr32_template pca10059 silabs_brd4180b pca10056 nrf52_template silabs_brd4184a silabs_brd4181b promistel_rpi_hat pca10100 ublox_b204 tbsense2 pca10112 pca10040 bgm220-ek4314a wuerth_261101102 silabs_brd4210a mdbt50q_rx nrf52832_mdk_v2 ruuvitag pan1780 silabs_brd4312a silabs_brd4253a 3 | # 4 | # Network default settings configuration 5 | # 6 | 7 | # If this section is removed, node has to be configured in 8 | # a different way 9 | default_network_address ?= 0xB689E6 10 | default_network_channel ?= 3 11 | # !HIGHLY RECOMMENDED! : To enable security keys please un-comment the lines below and fill with a 12 | # randomly generated authentication & encryption keys (exactly 16 bytes) 13 | #default_network_cipher_key ?= 0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x?? 14 | #default_network_authen_key ?= 0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x?? 15 | 16 | # 17 | # App specific configuration 18 | # 19 | 20 | # Define a specific application area_id 21 | app_specific_area_id=0x8030B3 22 | 23 | # App version 24 | app_major=$(sdk_major) 25 | app_minor=$(sdk_minor) 26 | app_maintenance=$(sdk_maintenance) 27 | app_development=1 -------------------------------------------------------------------------------- /source/example_apps/control_router/makefile: -------------------------------------------------------------------------------- 1 | # Enable shared data library (needed by control library) 2 | SHARED_DATA=yes 3 | 4 | # Enable Control library (for router) 5 | CONTROL_ROUTER=yes 6 | 7 | # Enable shared appconfig (needed by app) 8 | SHARED_APP_CONFIG=yes 9 | SHARED_APP_CONFIG_FILTERS=1 10 | 11 | # Enable App scheduler (needed by app) 12 | APP_SCHEDULER=yes 13 | APP_SCHEDULER_TASKS=1 14 | 15 | # This application use HAL for leds 16 | HAL_LED=yes 17 | 18 | # Enable the debug logs (has no effect on board without serial port) 19 | APP_PRINTING=yes -------------------------------------------------------------------------------- /source/example_apps/custom_app/config.mk: -------------------------------------------------------------------------------- 1 | # Boards compatible with this app 2 | TARGET_BOARDS := silabs_brd4254a efr32_template pca10059 silabs_brd4180b pca10056 nrf52_template silabs_brd4184a silabs_brd4181b promistel_rpi_hat pca10100 ublox_b204 tbsense2 pca10112 pca10040 bgm220-ek4314a wuerth_261101102 silabs_brd4210a mdbt50q_rx nrf52832_mdk_v2 ruuvitag pan1780 silabs_brd4312a silabs_brd4253a 3 | # 4 | # Network default settings configuration 5 | # 6 | 7 | # If this section is removed, node has to be configured in 8 | # a different way 9 | default_network_address ?= 0xA1B2C3 10 | default_network_channel ?= 2 11 | # !HIGHLY RECOMMENDED! : To enable security keys please un-comment the lines below and fill with a 12 | # randomly generated authentication & encryption keys (exactly 16 bytes) 13 | #default_network_cipher_key ?= 0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x?? 14 | #default_network_authen_key ?= 0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x?? 15 | 16 | # 17 | # App specific configuration 18 | # 19 | 20 | # Define a specific application area_id 21 | app_specific_area_id=0x83744C 22 | 23 | # App version 24 | app_major=2 25 | app_minor=0 26 | app_maintenance=0 27 | app_development=0 28 | -------------------------------------------------------------------------------- /source/example_apps/custom_app/makefile: -------------------------------------------------------------------------------- 1 | # You can add more sources here and libraries if needed 2 | SRCS += 3 | INCLUDES += 4 | LIBS += 5 | LDFLAGS += 6 | 7 | # Example: 8 | # SRCS += $(APP_SRCS_PATH)my_driver.c 9 | # LIBS += my_lib.a 10 | # include math.h lib 11 | # LDFLAGS += -lm 12 | 13 | # Use Shared Data 14 | SHARED_DATA=yes 15 | 16 | APP_PRINTING=yes 17 | 18 | # Use App Scheduler and configure it 19 | APP_SCHEDULER=yes 20 | APP_SCHEDULER_TASKS=1 -------------------------------------------------------------------------------- /source/example_apps/evaluation_app/config.mk: -------------------------------------------------------------------------------- 1 | # Boards compatible with this app 2 | TARGET_BOARDS := pca10056 pca10100 tbsense2 pca10040 ruuvitag pan1780 3 | # Boards compatible with this app 4 | # 5 | # Network default settings configuration 6 | # 7 | 8 | # If this section is removed, node has to be configured in 9 | # a different way 10 | default_network_address ?= 0xD8D42B 11 | default_network_channel ?= 9 12 | 13 | # !HIGHLY RECOMMENDED! : To enable security keys please un-comment the lines below and fill with a 14 | # randomly generated authentication & encryption keys (exactly 16 bytes) 15 | #default_network_cipher_key ?= 0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x?? 16 | #default_network_authen_key ?= 0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x?? 17 | 18 | # 19 | # App specific configuration 20 | # 21 | 22 | # Define a specific application area_id 23 | app_specific_area_id=0x80597B 24 | 25 | #define node operating mode (i.e low-energy or low-latency : 0 => low-energy / 1 => low-latency) 26 | default_operating_mode ?= 0 27 | 28 | # App version 29 | app_major=1 30 | app_minor=1 31 | app_maintenance=1 32 | app_development=0 33 | -------------------------------------------------------------------------------- /source/example_apps/evaluation_app/makefile: -------------------------------------------------------------------------------- 1 | #Set node operating mode (i.e low-energy or low-latency) 2 | ifneq ($(default_operating_mode),0) 3 | CFLAGS+= -DENABLE_LOW_LATENCY_MODE 4 | endif 5 | 6 | # Use Shared Data 7 | SHARED_DATA=yes 8 | 9 | # Use App Scheduler and configure it 10 | APP_SCHEDULER=yes 11 | APP_SCHEDULER_TASKS=2 12 | 13 | APP_PRINTING=yes 14 | 15 | SHARED_APP_CONFIG=yes 16 | SHARED_APP_CONFIG_FILTERS=2 17 | 18 | # This application use HAL for buttons and leds 19 | HAL_BUTTON=yes 20 | HAL_LED=yes 21 | -------------------------------------------------------------------------------- /source/example_apps/low_latency_app/config.mk: -------------------------------------------------------------------------------- 1 | # Boards compatible with this app 2 | TARGET_BOARDS := pca10056 pca10100 tbsense2 pca10040 pan1780 3 | # Boards compatible with this app 4 | # 5 | # Network default settings configuration 6 | # 7 | 8 | # If this section is removed, node has to be configured in 9 | # a different way 10 | default_network_address ?= 0x6FCA8 11 | default_network_channel ?= 6 12 | # default_multicast_address ?= 13 | # !HIGHLY RECOMMENDED! : To enable security keys please un-comment the lines below and fill with a 14 | # randomly generated authentication & encryption keys (exactly 16 bytes) 15 | #default_network_cipher_key ?= 0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x?? 16 | #default_network_authen_key ?= 0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x?? 17 | 18 | # 19 | # App specific configuration 20 | # 21 | APP_PERSISTENT=yes 22 | 23 | # Define a specific application area_id 24 | app_specific_area_id=0x80597C 25 | 26 | # App version 27 | app_major=1 28 | app_minor=0 29 | app_maintenance=0 30 | app_development=1 31 | -------------------------------------------------------------------------------- /source/example_apps/low_latency_app/makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(default_operating_mode),0) 2 | CFLAGS+= -DENABLE_LOW_LATENCY_MODE 3 | endif 4 | 5 | # Use Shared Data 6 | SHARED_DATA=yes 7 | 8 | # Use App Scheduler and configure it 9 | APP_SCHEDULER=yes 10 | APP_SCHEDULER_TASKS=1 11 | 12 | APP_PRINTING=yes 13 | # This application use HAL for buttons and leds 14 | HAL_BUTTON=yes 15 | HAL_LED=yes -------------------------------------------------------------------------------- /source/example_apps/minimal_app/app.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | 7 | /* 8 | * \file app.c 9 | * \brief This file is a minimal app to start the stack 10 | */ 11 | 12 | #include 13 | 14 | #include "api.h" 15 | #include "node_configuration.h" 16 | 17 | /** 18 | * \brief Initialization callback for application 19 | * 20 | * This function is called after hardware has been initialized but the 21 | * stack is not yet running. 22 | * 23 | */ 24 | void App_init(const app_global_functions_t * functions) 25 | { 26 | // Basic configuration of the node with a unique node address 27 | if (configureNodeFromBuildParameters() != APP_RES_OK) 28 | { 29 | // Could not configure the node 30 | // It should not happen except if one of the config value is invalid 31 | return; 32 | } 33 | 34 | /* 35 | * Start the stack. 36 | * This is really important step, otherwise the stack will stay stopped and 37 | * will not be part of any network. So the device will not be reachable 38 | * without reflashing it 39 | */ 40 | lib_state->startStack(); 41 | } 42 | 43 | -------------------------------------------------------------------------------- /source/example_apps/minimal_app/config.mk: -------------------------------------------------------------------------------- 1 | # Boards compatible with this app 2 | TARGET_BOARDS := silabs_brd4254a efr32_template pca10059 silabs_brd4180b pca10056 nrf52_template silabs_brd4184a silabs_brd4181b promistel_rpi_hat pca10100 ublox_b204 tbsense2 pca10112 pca10040 bgm220-ek4314a wuerth_261101102 silabs_brd4210a mdbt50q_rx nrf52832_mdk_v2 ruuvitag pan1780 silabs_brd4312a silabs_brd4253a 3 | # 4 | # Network default settings configuration 5 | # 6 | 7 | # If this section is removed, node has to be configured in 8 | # a different way 9 | default_network_address ?= 0x567DEF 10 | default_network_channel ?= 2 11 | # !HIGHLY RECOMMENDED! : To enable security keys please un-comment the lines below and fill with a 12 | # randomly generated authentication & encryption keys (exactly 16 bytes) 13 | #default_network_cipher_key ?= 0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x?? 14 | #default_network_authen_key ?= 0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x?? 15 | 16 | # 17 | # App specific configuration 18 | # 19 | 20 | # Define a specific application area_id 21 | app_specific_area_id=0x8CEC79 22 | 23 | # App version 24 | app_major=1 25 | app_minor=0 26 | app_maintenance=0 27 | app_development=0 28 | -------------------------------------------------------------------------------- /source/example_apps/minimal_app/makefile: -------------------------------------------------------------------------------- 1 | # You can add more sources here and libraries if needed 2 | SRCS += 3 | INCLUDES += 4 | LIBS += 5 | LDFLAGS += 6 | 7 | # Example: 8 | # SRCS += $(APP_SRCS_PATH)my_driver.c 9 | # LIBS += my_lib.a 10 | # include math.h lib 11 | # LDFLAGS += -lm 12 | -------------------------------------------------------------------------------- /source/example_apps/ruuvi_evk/config.mk: -------------------------------------------------------------------------------- 1 | # Boards compatible with this app 2 | TARGET_BOARDS := ruuvitag 3 | # 4 | # Network default settings configuration 5 | # 6 | 7 | # If this section is removed, node has to be configured in 8 | # a different way 9 | default_network_address ?= 0xD8D42B 10 | default_network_channel ?= 9 11 | # !HIGHLY RECOMMENDED! : To enable security keys please un-comment the lines below and fill with a 12 | # randomly generated authentication & encryption keys (exactly 16 bytes) 13 | #default_network_cipher_key ?= 0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x?? 14 | #default_network_authen_key ?= 0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x?? 15 | 16 | # 17 | # App specific configuration 18 | # 19 | 20 | # Define a specific application area_id 21 | app_specific_area_id=0x8428B9 22 | 23 | # App version 24 | app_major=4 25 | app_minor=0 26 | app_maintenance=1 27 | app_development=0 28 | -------------------------------------------------------------------------------- /source/example_apps/ruuvi_evk/docs/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:18.04 2 | 3 | 4 | FROM ubuntu:18.04 as builder 5 | 6 | ENV USER=wirepas 7 | ENV HOME=/home/wirepas 8 | ENV APP_HOME=${HOME}/app 9 | 10 | RUN groupadd -r ${USER} --gid 1000 \ 11 | && useradd --uid 1000 -r -g ${USER} ${USER} 12 | 13 | RUN apt-get update \ 14 | && DEBIAN_FRONTEND=noninteractive apt-get install -y \ 15 | doxygen graphviz nano git\ 16 | && rm -rf /var/lib/apt/lists/* 17 | 18 | WORKDIR ${APP_HOME} 19 | RUN chown ${USER}:${USER} -R ${HOME} 20 | USER wirepas 21 | 22 | CMD ["doxygen", "docs/Doxyfile"] 23 | -------------------------------------------------------------------------------- /source/example_apps/ruuvi_evk/docs/ruuvi_application_note.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wirepas/wm-sdk/7305a2625220f6e8f42b6fba84b7d2c3e4db9d17/source/example_apps/ruuvi_evk/docs/ruuvi_application_note.pdf -------------------------------------------------------------------------------- /source/example_apps/ruuvi_evk/docs/ruuvi_evk.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wirepas/wm-sdk/7305a2625220f6e8f42b6fba84b7d2c3e4db9d17/source/example_apps/ruuvi_evk/docs/ruuvi_evk.pdf -------------------------------------------------------------------------------- /source/example_apps/ruuvi_evk/docs/template/doc.tex: -------------------------------------------------------------------------------- 1 | % WIREPAS_LATEX.TEX 2 | % 3 | % Based on REFMAN.CLS (LaTeX2e) 4 | % 5 | % Author 6 | % Pedro Silva 7 | 8 | \documentclass[a4paper]{article} 9 | 10 | %%% Set Author, Version Number and Title 11 | \newcommand{\myauthor}{Tobias} 12 | \newcommand{\docclass}{Reference Manual} 13 | \newcommand{\docstatus}{Confidential} 14 | \newcommand{\vnum}{#DOCUMENT_VERSION} 15 | \newcommand{\mytitle}{#DOCUMENT_TITLE - \vnum} 16 | 17 | \newcommand{\mycustomref}[1]{\textbf{Fig. \ref{#1}}} 18 | 19 | %% Generic packages 20 | \input{preamble} 21 | 22 | \begin{document} 23 | \thispagestyle{empty} 24 | 25 | \vspace*{2cm} 26 | \includegraphics[width=\linewidth]{wm-logo.png} 27 | 28 | \vspace*{2.5cm} 29 | 30 | \begin{LARGE} 31 | \mytitle 32 | \end{LARGE} 33 | 34 | \vspace*{2.5cm} 35 | 36 | \begin{Large} 37 | \docclass 38 | \end{Large} 39 | 40 | \vspace*{1cm} 41 | 42 | Version: \vnum 43 | 44 | #DOCUMENT_DESCRIPTION 45 | 46 | \vspace*{2.5cm} 47 | 48 | \begin{Huge} 49 | \docstatus 50 | \end{Huge} 51 | 52 | \newpage 53 | 54 | \tableofcontents 55 | 56 | \newpage 57 | 58 | %%% Sections and end of file to be appended 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /source/example_apps/ruuvi_evk/docs/template/wm-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wirepas/wm-sdk/7305a2625220f6e8f42b6fba84b7d2c3e4db9d17/source/example_apps/ruuvi_evk/docs/template/wm-logo.png -------------------------------------------------------------------------------- /source/example_apps/ruuvi_evk/docs/wirepas_logo_2016_slogan_RGB.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wirepas/wm-sdk/7305a2625220f6e8f42b6fba84b7d2c3e4db9d17/source/example_apps/ruuvi_evk/docs/wirepas_logo_2016_slogan_RGB.png -------------------------------------------------------------------------------- /source/example_apps/ruuvi_evk/helpers/README.md: -------------------------------------------------------------------------------- 1 | # AppConfig helper 2 | 3 | The app_config_generator.py is a small python script to generate appconfig 4 | payload based on the values defined in appconfig.yaml. 5 | 6 | To customize the behaviour of your network, please onpen appconfig.yaml and 7 | set the values you wish for each sensor type. 8 | 9 | ## Installation 10 | 11 | Please ensure you have Python >3.6 on your system with: 12 | 13 | ``` 14 | python --version 15 | ``` 16 | 17 | Install the requirements under you python environment with: 18 | 19 | ``` 20 | pip install -r requirements.txt 21 | ``` 22 | 23 | Once the installation of the dependencies is over, run the script with: 24 | 25 | ``` 26 | python app_config_generator.py 27 | ``` 28 | -------------------------------------------------------------------------------- /source/example_apps/ruuvi_evk/helpers/README.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wirepas/wm-sdk/7305a2625220f6e8f42b6fba84b7d2c3e4db9d17/source/example_apps/ruuvi_evk/helpers/README.pdf -------------------------------------------------------------------------------- /source/example_apps/ruuvi_evk/helpers/appconfig.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | #Wirepas Oy 2019 3 | 4 | version: 1 5 | commands: 6 | 7 | enable_sensors: 8 | type: 1 9 | length: 6 10 | fields: 11 | temperature_enable: 1 12 | humidity_enable: 1 13 | presure_enable: 1 14 | accel_x_enable: 1 15 | accel_y_enable: 1 16 | accel_z_enable: 1 17 | format: '=3.13 2 | -------------------------------------------------------------------------------- /source/example_apps/ruuvi_evk/include/app_config.h: -------------------------------------------------------------------------------- 1 | /** 2 | @file app_config.h 3 | @brief This module manages the application configuration. 4 | @copyright Wirepas Oy 2019 5 | */ 6 | #ifndef APP_CONFIG_H_ 7 | #define APP_CONFIG_H_ 8 | 9 | #include 10 | #include 11 | 12 | /** 13 | @brief Structure containing the application configuration. 14 | */ 15 | typedef struct 16 | { 17 | bool temperature_enable; /**< Enable temperature sensor. */ 18 | bool humidity_enable; /**< Enable humidity sensor. */ 19 | bool pressure_enable; /**< Enable pressure sensor. */ 20 | bool accel_x_enable; /**< Enable X-axis acceleration sensor. */ 21 | bool accel_y_enable; /**< Enable Y-axis acceleration sensor. */ 22 | bool accel_z_enable; /**< Enable Z-axis acceleration sensor. */ 23 | uint32_t sensors_period_ms; /**< Period in ms at wich rate sensor data are 24 | sent to the Sink. */ 25 | } app_config_t; 26 | 27 | /** 28 | @brief Function type config change callback. 29 | */ 30 | typedef void (*on_config_change_cb_f)(void); 31 | 32 | /** 33 | @brief Initialize the App Config module. 34 | @param[in] cb Pointer to a callback function. NULL if not used. 35 | */ 36 | void App_Config_init(on_config_change_cb_f cb); 37 | 38 | /** 39 | @brief Returns a pointer to the configuration structure. 40 | */ 41 | const app_config_t * App_Config_get(void); 42 | 43 | #endif /* APP_CONFIG_H_ */ 44 | -------------------------------------------------------------------------------- /source/example_apps/ruuvi_evk/include/lis2dh12_wrapper.h: -------------------------------------------------------------------------------- 1 | /** 2 | @file lis2dh12_wrapper.h 3 | @brief Wrapper on top of LIS2DH12 driver from STMicroelectronics GitHub. 4 | 5 | This file is the wrapper to expose a simple API for getting the acceleration 6 | from lis2dh12 device. It makes the glue between the ST driver and Wirepas 7 | SPI driver and staticaly configure the sensor. 8 | 9 | @copyright Wirepas Oy 2019 10 | */ 11 | #ifndef LIS2DH12_WRAPPER_H_ 12 | #define LIS2DH12_WRAPPER_H_ 13 | 14 | /** 15 | @brief Structure containing acceleration measurements. 16 | */ 17 | typedef struct 18 | { 19 | int32_t accel_x; /**< Acceleration on X axis in mg [-2g / +2g]. */ 20 | int32_t accel_y; /**< Acceleration on Y axis in mg [-2g / +2g]. */ 21 | int32_t accel_z; /**< Acceleration on Z axis in mg [-2g / +2g]. */ 22 | } lis2dh12_wrapper_measurement_t; 23 | 24 | /** 25 | @brief Initialize the LIS2DH12 wrapper library. 26 | @return True if successfully initialized, false otherwise. 27 | */ 28 | bool LIS2DH12_wrapper_init(void); 29 | 30 | /** 31 | @brief Start a measurement. 32 | @return The time in ms to wait before the measurement is ready. 33 | */ 34 | uint32_t LIS2DH12_wrapper_startMeasurement(void); 35 | 36 | /** 37 | @brief Get a measurement previously asked by a start measurement. 38 | @param[in] measurement The measurement read out from the sensor. 39 | @return false if a problem occured, true otherwise. 40 | */ 41 | bool LIS2DH12_wrapper_readMeasurement( 42 | lis2dh12_wrapper_measurement_t * measurement); 43 | 44 | #endif /* LIS2DH12_WRAPPER_H_ */ 45 | -------------------------------------------------------------------------------- /source/example_apps/ruuvi_evk/makefile: -------------------------------------------------------------------------------- 1 | SRCS += $(APP_SRCS_PATH)BME280_driver/bme280.c 2 | SRCS += $(APP_SRCS_PATH)bme280_wrapper.c 3 | SRCS += $(APP_SRCS_PATH)LIS2DH12_driver/lis2dh12_STdC/driver/lis2dh12_reg.c 4 | SRCS += $(APP_SRCS_PATH)lis2dh12_wrapper.c 5 | SRCS += $(APP_SRCS_PATH)app_config.c 6 | SRCS += $(APP_SRCS_PATH)format_data.c 7 | INCLUDES += -I$(APP_SRCS_PATH)BME280_driver/ 8 | INCLUDES += -I$(APP_SRCS_PATH)LIS2DH12_driver/lis2dh12_STdC/driver/ 9 | 10 | HAL_SPI=yes 11 | 12 | # Use App Scheduler and configure it 13 | APP_SCHEDULER=yes 14 | APP_SCHEDULER_TASKS=4 15 | 16 | # Use the 32bits integer data format for BME280 driver. 17 | CFLAGS += -DBME280_32BIT_ENABLE 18 | 19 | # Define a specific target to clone the Bosh and ST Libraries 20 | # DEFAULT_GOAL is define as this target will be declared as the first one in global makefile 21 | # and would become the default target without explicitely defining it 22 | .DEFAULT_GOAL := all 23 | $(SRCS_PATH)BME280_driver/bme280.c: 24 | $(shell git clone https://github.com/BoschSensortec/BME280_driver.git $(SRCS_PATH)BME280_driver \ 25 | && cd $(SRCS_PATH)BME280_driver && git checkout bme280_v3.4.3 -b bme280_v3.4.3) 26 | $(SRCS_PATH)LIS2DH12_driver/lis2dh12_STdC/driver/lis2dh12_reg.c: 27 | $(shell git clone https://github.com/STMicroelectronics/STMems_Standard_C_drivers.git $(SRCS_PATH)LIS2DH12_driver \ 28 | && cd $(SRCS_PATH)LIS2DH12_driver && git checkout v1.01 -b v1.01) 29 | -------------------------------------------------------------------------------- /source/reference_apps/Readme.md: -------------------------------------------------------------------------------- 1 | # Reference applications -------------------------------------------------------------------------------- /source/reference_apps/dualmcu_app/app.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | 7 | /* 8 | * \file app.c 9 | * \brief This file is a template to Dual MCU API app for all paltforms 10 | */ 11 | #include 12 | 13 | #include "local_provisioning.h" 14 | #include "dualmcu_lib.h" 15 | 16 | 17 | /** 18 | * \brief Initialization callback for application 19 | * 20 | * This function is called after hardware has been initialized but the 21 | * stack is not yet running. 22 | * 23 | */ 24 | void App_init(const app_global_functions_t * functions) 25 | { 26 | Local_provisioning_init(NULL, NULL); 27 | 28 | Dualmcu_lib_init(UART_BAUDRATE, UART_FLOWCONTROL); 29 | } 30 | -------------------------------------------------------------------------------- /source/reference_apps/dualmcu_app/config.mk: -------------------------------------------------------------------------------- 1 | # Boards compatible with this app 2 | TARGET_BOARDS := pca10059 pca10056 promistel_rpi_hat pca10100 ublox_b204 pca10040 wuerth_261101102 mdbt50q_rx nrf52832_mdk_v2 silabs_brd4254a tbsense2 silabs_brd4253a silabs_brd4180b silabs_brd4184a silabs_brd4181b bgm220-ek4314a silabs_brd4312a silabs_brd4210a pan1780 3 | # Define a specific application area_id 4 | app_specific_area_id=0x846B74 5 | 6 | # App version 7 | app_major=$(sdk_major) 8 | app_minor=$(sdk_minor) 9 | app_maintenance=$(sdk_maintenance) 10 | app_development=$(sdk_development) 11 | 12 | # Uncomment to allow reading scratchpad via dual-MCU API 13 | #allow_scratchpad_read=yes 14 | -------------------------------------------------------------------------------- /source/reference_apps/dualmcu_app/makefile: -------------------------------------------------------------------------------- 1 | # Dual MCU app needs UART 2 | HAL_UART=yes 3 | ifeq ($(uart_use_usb),yes) 4 | UART_USE_DMA=no 5 | UART_USE_USB=yes 6 | CFLAGS += -DUART_USE_USB 7 | else ifeq ($(uart_use_dma),no) 8 | UART_USE_DMA=no 9 | UART_USE_USB=no 10 | else 11 | # dma uart is used by default if not explicitly set to no 12 | UART_USE_DMA=yes 13 | UART_USE_USB=no 14 | endif 15 | 16 | # Define default baudrate and hardware flow control settings 17 | uart_br ?= 125000 18 | uart_fc ?= false 19 | 20 | CFLAGS += -DUART_BAUDRATE=$(uart_br) 21 | CFLAGS += -DUART_FLOWCONTROL=$(uart_fc) 22 | 23 | # Force Otap action to LEGACY at firstboot (flash or otap) 24 | otap_force_legacy ?= no 25 | ifeq ($(otap_force_legacy),yes) 26 | CFLAGS += -DOTAP_FORCE_LEGACY 27 | endif 28 | 29 | DUALMCU_LIB=yes 30 | 31 | # Enable local provisioning 32 | LOCAL_PROVISIONING=yes 33 | 34 | # Enable to allow reading scratchpad via dual-MCU API 35 | allow_scratchpad_read ?= no 36 | ifeq ($(allow_scratchpad_read),yes) 37 | CFLAGS += -DALLOW_SCRATCHPAD_READ 38 | endif 39 | -------------------------------------------------------------------------------- /source/reference_apps/positioning_app/motion/lis2/lis2_dev.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lis2_dev.h 3 | * @brief Defines the interface for STMems device. 4 | * @copyright Wirepas Ltd 2021 5 | */ 6 | #ifndef _LIS2_DEV_H_ 7 | #define _LIS2_DEV_H_ 8 | 9 | #ifdef LIS2DH12 10 | #include "lis2dh12_reg.h" 11 | 12 | #ifdef LIS2DH12_I2C 13 | 14 | #elif defined LIS2DH12_SPI 15 | #define BOARD_SPI_LIS2_CS_PIN BOARD_SPI_LIS2DH12_CS_PIN 16 | #endif 17 | #endif 18 | 19 | #ifdef LIS2DW12 20 | #include "lis2dw12_reg.h" 21 | 22 | #ifdef LIS2DW12_I2C 23 | 24 | #elif defined LIS2DW12_SPI 25 | #define BOARD_SPI_LIS2_CS_PIN BOARD_SPI_LIS2DW12_CS_PIN 26 | #endif 27 | #endif 28 | 29 | void LIS2_dev_init(stmdev_ctx_t * dev); 30 | 31 | #endif /* _LIS2_DEV_H_ */ -------------------------------------------------------------------------------- /source/reference_apps/positioning_app/motion/lis2/lis2dh12_wrapper.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lis2dh12_wrapper.h 3 | * @brief Wrapper on top of LIS2DH12 driver from STMicroelectronics GitHub 4 | * This file is the wrapper to expose a simple API for getting the acceleration 5 | * from lis2dh12 device. It makes the glue between the ST driver and Wirepas 6 | * i2c driver. 7 | * 8 | * @copyright Wirepas Ltd 2021 9 | */ 10 | #ifndef _LIS2DH12_WRAPPER_H_ 11 | #define _LIS2DH12_WRAPPER_H_ 12 | #include "board.h" 13 | 14 | /** LIS2DH12 interrupt pin for motion monitoring, @note Only one pin shall be defined in board.h */ 15 | #ifdef BOARD_LIS2DH12_INT1_PIN 16 | #define LIS2DH12_MOTION_USE_INT1 17 | #define MOTION_MON_INT_PIN BOARD_LIS2DH12_INT1_PIN 18 | #elif defined BOARD_LIS2DH12_INT2_PIN 19 | #define LIS2DH12_MOTION_USE_INT2 20 | #define MOTION_MON_INT_PIN BOARD_LIS2DH12_INT2_PIN 21 | #endif 22 | 23 | /** LIS2DH12 montion monitoring sampling rate */ 24 | #define LIS2DH12_INT_DURATION LIS2DH12_ODR_10Hz 25 | 26 | /** LIS2DH12 motion monitoring sampling precision */ 27 | #define LIS2DH12_INT_OPPERATING_MODE LIS2DH12_LP_8bit 28 | 29 | 30 | /** Time to get first measure from POWER DOWN @1Hz, with 50% margin. */ 31 | #define LIS2DH12_WAKE_UP_TIME_MS (7*1.5) 32 | 33 | /** Time to get the measurement if motion monitoring is activated */ 34 | #define LIS2DH12_WAKE_UP_TIME_MON_MS (1) 35 | 36 | #endif /* _LIS2DH12_WRAPPER_H_ */ 37 | -------------------------------------------------------------------------------- /source/reference_apps/positioning_app/motion/lis2/lis2dw12_wrapper.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lis2dw12_wrapper.h 3 | * @brief Wrapper on top of LIS2DW12 driver from STMicroelectronics GitHub 4 | * This file is the wrapper to expose a simple API for getting the acceleration 5 | * from lis2dw12 device. It makes the glue between the ST driver and Wirepas 6 | * i2c driver. 7 | * 8 | * @copyright Wirepas Ltd 2021 9 | */ 10 | #ifndef _LIS2DW12_WRAPPER_H_ 11 | #define _LIS2DW12_WRAPPER_H_ 12 | #include "board.h" 13 | 14 | /** LIS2DW12 interrupt pin for motion monitoring, @note Only one pin shall be defined in board.h */ 15 | #ifdef BOARD_LIS2DW12_INT1_PIN 16 | #define LIS2DW12_MOTION_USE_INT1 17 | #define MOTION_MON_INT_PIN BOARD_LIS2DW12_INT1_PIN 18 | #elif defined BOARD_LIS2DW12_INT2_PIN 19 | #define LIS2DW12_MOTION_USE_INT2 20 | #define MOTION_MON_INT_PIN BOARD_LIS2DW12_INT2_PIN 21 | #endif 22 | 23 | /** LIS2DW12 montion monitoring sampling rate */ 24 | #define LIS2DW12_INT_DURATION LIS2DW12_XL_ODR_12Hz5 25 | 26 | /** LIS2DW12 motion monitoring sampling precision */ 27 | #define LIS2DW12_INT_OPPERATING_MODE LIS2DW12_CONT_LOW_PWR_12bit 28 | 29 | 30 | /** Time to get first measure from POWER DOWN @1Hz, with 50% margin. */ 31 | #define LIS2DW12_WAKE_UP_TIME_MS (7*1.5) 32 | 33 | /** Time to get the measurement if motion monitoring is activated */ 34 | #define LIS2DW12_WAKE_UP_TIME_MON_MS (1) 35 | 36 | #endif /* _LIS2DW12_WRAPPER_H_ */ 37 | -------------------------------------------------------------------------------- /source/reference_apps/positioning_app/persistent_config/config.yml: -------------------------------------------------------------------------------- 1 | # This is an example file to customize a node running the positioning appliation 2 | 3 | node_persistent_settings: 4 | address: 4294967293 5 | network_address: 16777214 6 | network_channel: 40 7 | role: 2 8 | 9 | poslib_persistent_settings: 10 | node_mode: 1 11 | node_class: 248 12 | update_period_static_s: 300 13 | update_period_dynamic_s: 60 14 | update_period_offline_s: 600 15 | ble_type: 1 16 | ble_mode: 0 17 | ble_activation_delay_s: 0 18 | ble_eddystone_tx_power: 0 19 | ble_eddystone_channels: 0 20 | ble_eddystone_tx_interval_ms: 100 21 | ble_ibeacon_tx_power: 0 22 | ble_ibeacon_channels: 0 23 | ble_ibeacon_tx_interval_ms: 100 24 | motion_enabled: false 25 | motion_threshold_mg: 300 26 | motion_duration_ms: 0 27 | -------------------------------------------------------------------------------- /source/reference_apps/positioning_app/persistent_config/config_v2.yml: -------------------------------------------------------------------------------- 1 | # This is an example file to customize a node running the positioning appliation 2 | 3 | node_persistent_settings: 4 | address: 4294967293 5 | network_address: 16777214 6 | network_channel: 40 7 | role: 1 8 | 9 | poslib_persistent_settings: 10 | node_mode: 4 11 | node_class: 248 12 | update_period_static_s: 300 13 | update_period_dynamic_s: 60 14 | update_period_offline_s: 600 15 | ble_type: 1 16 | ble_mode: 0 17 | ble_activation_delay_s: 0 18 | ble_eddystone_tx_power: 0 19 | ble_eddystone_channels: 0 20 | ble_eddystone_tx_interval_ms: 100 21 | ble_ibeacon_tx_power: 0 22 | ble_ibeacon_channels: 0 23 | ble_ibeacon_tx_interval_ms: 100 24 | motion_enabled: false 25 | motion_threshold_mg: 300 26 | motion_duration_ms: 0 27 | mbcn_enabled: false 28 | mbcn_tx_interval_ms: 1000 29 | # mbcn record 0 30 | mbcn_records_type0: 3 31 | mbcn_records_length0: 3 32 | mbcn_records_value0: [0, 2, 3] 33 | # mbcn record 1 34 | mbcn_records_type1: 0 35 | mbcn_records_length1: 0 36 | mbcn_records_value1: [0] 37 | # mbcn record 2,3,4...7 38 | da_routing_enabled: false 39 | da_follow_network: false 40 | -------------------------------------------------------------------------------- /source/reference_apps/positioning_app/persistent_config/requirements.txt: -------------------------------------------------------------------------------- 1 | pyYAML 2 | -------------------------------------------------------------------------------- /source/unitary_apps/Readme.md: -------------------------------------------------------------------------------- 1 | # Unitary applications -------------------------------------------------------------------------------- /source/unitary_apps/aes/config.mk: -------------------------------------------------------------------------------- 1 | # Boards compatible with this app 2 | TARGET_BOARDS := silabs_brd4254a efr32_template pca10059 silabs_brd4180b pca10056 nrf52_template silabs_brd4184a silabs_brd4181b promistel_rpi_hat pca10100 ublox_b204 tbsense2 pca10112 pca10040 bgm220-ek4314a wuerth_261101102 silabs_brd4210a mdbt50q_rx nrf52832_mdk_v2 ruuvitag pan1780 silabs_brd4312a silabs_brd4253a 3 | # Define a specific application area_id 4 | app_specific_area_id=0x8cad1b 5 | 6 | # App version 7 | app_major=1 8 | app_minor=0 9 | app_maintenance=0 10 | app_development=0 11 | -------------------------------------------------------------------------------- /source/unitary_apps/aes/makefile: -------------------------------------------------------------------------------- 1 | # Custom logs to have High precision time 2 | CFLAGS += -DDEBUG_LOG_CUSTOM 3 | CFLAGS += -DDEBUG_LOG_PRINT_MODULE_NAME 4 | CFLAGS += -DDEBUG_LOG_PRINT_TIME_HP 5 | CFLAGS += -DDEBUG_LOG_PRINT_LEVEL 6 | 7 | # Enable software AES 8 | SW_AES=yes 9 | 10 | # Enable the debug logs (has no effect on board without serial port) 11 | APP_PRINTING=yes -------------------------------------------------------------------------------- /source/unitary_apps/app_persistent/README.md: -------------------------------------------------------------------------------- 1 | # Application persistent 2 | 3 | ## Application scope 4 | 5 | This application demonstrates how to read and write in the persistent memory freely available to the user application. 6 | 7 | ## Application API 8 | 9 | This application demonstrate the following functionalities: 10 | - Check if app_persistent area is present 11 | - Write content to persistent area 12 | - Read it back 13 | - Check if content read back matches with what is expected. 14 | 15 | ## SDK libraries used in this application 16 | 17 | It uses the [app_persistent library](../../../libraries/app_persistent/app_persistent.h). 18 | 19 | ## Customization 20 | This application can be used to save some data in the persistent memory of a node. 21 | For example, it is done for the multicast group in the [Low_latency application](https://developer.wirepas.com/support/solutions/articles/77000509314-getting-started-with-low-latency-application). 22 | 23 | 24 | -------------------------------------------------------------------------------- /source/unitary_apps/app_persistent/config.mk: -------------------------------------------------------------------------------- 1 | # Boards compatible with this app 2 | TARGET_BOARDS := silabs_brd4254a efr32_template pca10059 silabs_brd4180b pca10056 nrf52_template silabs_brd4184a silabs_brd4181b promistel_rpi_hat pca10100 ublox_b204 tbsense2 pca10112 pca10040 bgm220-ek4314a wuerth_261101102 silabs_brd4210a mdbt50q_rx nrf52832_mdk_v2 ruuvitag pan1780 silabs_brd4312a silabs_brd4253a 3 | # 4 | # Network default settings configuration 5 | # 6 | 7 | # If this section is removed, node has to be configured in 8 | # a different way 9 | default_network_address ?= 0x12A205 10 | default_network_channel ?= 17 11 | # !HIGHLY RECOMMENDED! : To enable security keys please un-comment the lines below and fill with a 12 | # randomly generated authentication & encryption keys (exactly 16 bytes) 13 | #default_network_cipher_key ?= 0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x?? 14 | #default_network_authen_key ?= 0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x?? 15 | 16 | # 17 | # App specific configuration 18 | # 19 | 20 | # Define a specific application area_id 21 | app_specific_area_id=0x12A205 22 | 23 | # App version 24 | app_major=1 25 | app_minor=0 26 | app_maintenance=0 27 | app_development=0 28 | -------------------------------------------------------------------------------- /source/unitary_apps/app_persistent/makefile: -------------------------------------------------------------------------------- 1 | # This application use HAL for leds 2 | HAL_LED=yes 3 | 4 | # Use App Scheduler and configure it 5 | APP_PERSISTENT=yes 6 | 7 | # Enable the debug logs (has no effect on board without serial port) 8 | APP_PRINTING=yes 9 | -------------------------------------------------------------------------------- /source/unitary_apps/appconfig/config.mk: -------------------------------------------------------------------------------- 1 | # Boards compatible with this app 2 | TARGET_BOARDS := silabs_brd4254a efr32_template pca10059 silabs_brd4180b pca10056 nrf52_template silabs_brd4184a silabs_brd4181b promistel_rpi_hat pca10100 ublox_b204 tbsense2 pca10112 pca10040 bgm220-ek4314a wuerth_261101102 silabs_brd4210a mdbt50q_rx nrf52832_mdk_v2 ruuvitag pan1780 silabs_brd4312a silabs_brd4253a 3 | # 4 | # Network default settings configuration 5 | # 6 | 7 | # If this section is removed, node has to be configured in 8 | # a different way 9 | default_network_address ?= 0xA1B2C3 10 | default_network_channel ?= 2 11 | # !HIGHLY RECOMMENDED! : To enable security keys please un-comment the lines below and fill with a 12 | # randomly generated authentication & encryption keys (exactly 16 bytes) 13 | #default_network_cipher_key ?= 0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x?? 14 | #default_network_authen_key ?= 0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x?? 15 | 16 | # 17 | # App specific configuration 18 | # 19 | 20 | # Define a specific application area_id 21 | app_specific_area_id=0x84BEBD 22 | 23 | # App version 24 | app_major=1 25 | app_minor=0 26 | app_maintenance=0 27 | app_development=0 28 | -------------------------------------------------------------------------------- /source/unitary_apps/appconfig/makefile: -------------------------------------------------------------------------------- 1 | # Use App Scheduler and configure it 2 | APP_SCHEDULER=yes 3 | APP_SCHEDULER_TASKS=1 4 | 5 | SHARED_APP_CONFIG=yes 6 | SHARED_APP_CONFIG_FILTERS=3 7 | 8 | # Use Shared Data 9 | SHARED_DATA=yes 10 | 11 | # Enable the debug logs (has no effect on board without serial port) 12 | APP_PRINTING=yes 13 | -------------------------------------------------------------------------------- /source/unitary_apps/basic_interrupt/config.mk: -------------------------------------------------------------------------------- 1 | # Boards compatible with this app 2 | TARGET_BOARDS := pca10056 promistel_rpi_hat pca10100 ublox_b204 pca10040 3 | # 4 | # Network default settings configuration 5 | # 6 | 7 | # If this section is removed, node has to be configured in 8 | # a different way 9 | default_network_address ?= 0xABCDEF 10 | default_network_channel ?= 2 11 | # !HIGHLY RECOMMENDED! : To enable security keys please un-comment the lines below and fill with a 12 | # randomly generated authentication & encryption keys (exactly 16 bytes) 13 | #default_network_cipher_key ?= 0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x?? 14 | #default_network_authen_key ?= 0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x?? 15 | 16 | # 17 | # App specific configuration 18 | # 19 | 20 | # Define a specific application area_id 21 | app_specific_area_id=0x81FD41 22 | 23 | # App version 24 | app_major=2 25 | app_minor=0 26 | app_maintenance=0 27 | app_development=0 28 | -------------------------------------------------------------------------------- /source/unitary_apps/basic_interrupt/makefile: -------------------------------------------------------------------------------- 1 | # Use Shared Data 2 | SHARED_DATA=yes 3 | 4 | # Use App Scheduler and configure it 5 | APP_SCHEDULER=yes 6 | APP_SCHEDULER_TASKS=1 7 | -------------------------------------------------------------------------------- /source/unitary_apps/ble_tx/config.mk: -------------------------------------------------------------------------------- 1 | # Boards compatible with this app 2 | TARGET_BOARDS := silabs_brd4254a pca10056 promistel_rpi_hat pca10100 ublox_b204 tbsense2 pca10040 3 | # 4 | # Network default settings configuration 5 | # 6 | 7 | # If this section is removed, node has to be configured in 8 | # a different way 9 | default_network_address ?= 0x59F791 10 | default_network_channel ?= 7 11 | # !HIGHLY RECOMMENDED! : To enable security keys please un-comment the lines below and fill with a 12 | # randomly generated authentication & encryption keys (exactly 16 bytes) 13 | #default_network_cipher_key ?= 0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x?? 14 | #default_network_authen_key ?= 0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x?? 15 | 16 | # 17 | # App specific configuration 18 | # 19 | 20 | # Define a specific application area_id 21 | app_specific_area_id=0x823FCA 22 | 23 | # App version 24 | app_major=1 25 | app_minor=0 26 | app_maintenance=0 27 | app_development=0 28 | -------------------------------------------------------------------------------- /source/unitary_apps/ble_tx/makefile: -------------------------------------------------------------------------------- 1 | # Use Shared Data 2 | SHARED_DATA=yes 3 | -------------------------------------------------------------------------------- /source/unitary_apps/blink/config.mk: -------------------------------------------------------------------------------- 1 | # Boards compatible with this app 2 | TARGET_BOARDS := pca10059 pca10056 pca10100 pca10040 promistel_rpi_hat ruuvitag silabs_brd4254a tbsense2 silabs_brd4180b silabs_brd4184a silabs_brd4181b bgm220-ek4314a silabs_brd4210a silabs_brd4312a 3 | # 4 | # Network default settings configuration 5 | # 6 | 7 | # If this section is removed, node has to be configured in 8 | # a different way 9 | default_network_address ?= 0x5A127B 10 | default_network_channel ?= 12 11 | # !HIGHLY RECOMMENDED! : To enable security keys please un-comment the lines below and fill with a 12 | # randomly generated authentication & encryption keys (exactly 16 bytes) 13 | #default_network_cipher_key ?= 0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x?? 14 | #default_network_authen_key ?= 0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x?? 15 | 16 | # 17 | # App specific configuration 18 | # 19 | 20 | # Define a specific application area_id 21 | app_specific_area_id=0x824076 22 | 23 | # App version 24 | app_major=1 25 | app_minor=1 26 | app_maintenance=0 27 | app_development=0 28 | -------------------------------------------------------------------------------- /source/unitary_apps/blink/makefile: -------------------------------------------------------------------------------- 1 | APP_PRINTING=yes 2 | 3 | # Use App Scheduler and configure it 4 | APP_SCHEDULER=yes 5 | APP_SCHEDULER_TASKS=1 6 | 7 | # This application use HAL for buttons and leds 8 | HAL_BUTTON=yes 9 | HAL_LED=yes 10 | 11 | 12 | -------------------------------------------------------------------------------- /source/unitary_apps/diradv/config.mk: -------------------------------------------------------------------------------- 1 | # Boards compatible with this app 2 | TARGET_BOARDS := pca10056 pca10040 3 | # Specify supported target boards here 4 | 5 | # 6 | # Network default settings configuration 7 | # 8 | 9 | # If this section is removed, node has to be configured in 10 | # a different way 11 | default_network_address ?= 0x48bf6c 12 | default_network_channel ?= 3 13 | 14 | # !HIGHLY RECOMMENDED! : To enable security keys please un-comment the lines below and fill with a 15 | # randomly generated authentication & encryption keys (exactly 16 bytes) 16 | #default_network_cipher_key ?= 0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x?? 17 | #default_network_authen_key ?= 0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x?? 18 | 19 | # 20 | # App specific configuration 21 | # 22 | 23 | # Define a specific application area_id 24 | app_specific_area_id=0xb7318d 25 | 26 | # App version 27 | app_major=1 28 | app_minor=0 29 | app_maintenance=0 30 | app_development=0 31 | -------------------------------------------------------------------------------- /source/unitary_apps/diradv/makefile: -------------------------------------------------------------------------------- 1 | # Use App Scheduler and configure it 2 | APP_SCHEDULER=yes 3 | APP_SCHEDULER_TASKS=1 4 | 5 | #Use Shared data 6 | SHARED_DATA=yes 7 | 8 | # This application use HAL for buttons and leds 9 | HAL_BUTTON=yes 10 | HAL_LED=yes 11 | 12 | # Enabled shared Shutdown library 13 | STACK_STATE_LIB=yes 14 | STACK_STATE_CBS=1 15 | -------------------------------------------------------------------------------- /source/unitary_apps/local_provisioning/config.mk: -------------------------------------------------------------------------------- 1 | # Boards compatible with this app 2 | TARGET_BOARDS := silabs_brd4254a efr32_template pca10059 silabs_brd4180b pca10056 nrf52_template silabs_brd4184a silabs_brd4181b promistel_rpi_hat pca10100 ublox_b204 tbsense2 pca10112 pca10040 bgm220-ek4314a wuerth_261101102 silabs_brd4210a mdbt50q_rx nrf52832_mdk_v2 ruuvitag pan1780 silabs_brd4312a silabs_brd4253a 3 | # App specific configuration 4 | # 5 | 6 | # Define a specific application area_id 7 | app_specific_area_id=0x83e789 8 | 9 | # App version 10 | # 1.0.0.0 -> 2.0.0.0: Use of default persistent area to store data 11 | app_major=1 12 | app_minor=0 13 | app_maintenance=0 14 | app_development=0 15 | -------------------------------------------------------------------------------- /source/unitary_apps/local_provisioning/makefile: -------------------------------------------------------------------------------- 1 | # Use App Scheduler and configure it 2 | APP_SCHEDULER=yes 3 | APP_SCHEDULER_TASKS=1 4 | 5 | # Enable Local Provisioning library 6 | LOCAL_PROVISIONING=yes 7 | STACK_STATE_LIB=yes 8 | 9 | # HAL button functions 10 | HAL_BUTTON=yes 11 | 12 | # HAL led functions 13 | HAL_LED=yes 14 | 15 | # Enable the debug logs (has no effect on board without serial port) 16 | APP_PRINTING=yes 17 | -------------------------------------------------------------------------------- /source/unitary_apps/nfc/config.mk: -------------------------------------------------------------------------------- 1 | # Boards compatible with this app 2 | TARGET_BOARDS := pca10056 pca10040 3 | # 4 | # Network default settings configuration 5 | # 6 | 7 | # If this section is removed, node has to be configured in 8 | # a different way 9 | default_network_address ?= 0x638C35 10 | default_network_channel ?= 12 11 | # !HIGHLY RECOMMENDED! : To enable security keys please un-comment the lines below and fill with a 12 | # randomly generated authentication & encryption keys (exactly 16 bytes) 13 | #default_network_cipher_key ?= 0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x?? 14 | #default_network_authen_key ?= 0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x?? 15 | 16 | # 17 | # App specific configuration 18 | # 19 | # Define a specific application area_id 20 | app_specific_area_id=0x81FAB8 21 | 22 | # App version 23 | app_major=1 24 | app_minor=0 25 | app_maintenance=0 26 | app_development=0 27 | -------------------------------------------------------------------------------- /source/unitary_apps/nfc/drivers/makefile: -------------------------------------------------------------------------------- 1 | DRIVERS_PREFIX := $(SRCS_PATH)drivers/ 2 | 3 | ifeq ($(MCU),nrf52) 4 | SRCS += $(SRCS_PATH)drivers/$(MCU)/nfc_hw.c 5 | else 6 | $(error Cannot determine MCU for drivers) 7 | endif 8 | -------------------------------------------------------------------------------- /source/unitary_apps/nfc/lib/tlv.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | 7 | /** 8 | * \file tlv.h 9 | * 10 | */ 11 | 12 | #ifndef __TLV_H__ 13 | #define __TLV_H__ 14 | 15 | /** 16 | * Structure to describe a TLV Message 17 | */ 18 | typedef struct 19 | { 20 | uint16_t len; 21 | uint16_t offset; 22 | } tlv_msg_t; 23 | 24 | /** Return codes of TLV functions */ 25 | typedef enum 26 | { 27 | TLV_RES_ERR = 0, /* Not a TLV block */ 28 | TLV_RES_BLOCK = 1, /* TLV Block */ 29 | TLV_RES_TERMINATOR = 2 /* TLV Terminator */ 30 | } tlv_res_e; 31 | 32 | /** 33 | * \brief Encapsulate payload inside a TLV message 34 | * \param msg 35 | * Pointer to the payload 36 | * \param tagData 37 | * Pointer to the destination. 38 | * (by exemple Type 2 Tag simulated user memory) 39 | * \param msgLength 40 | * Number of bytes in the payload 41 | */ 42 | void tlv_encode(uint8_t *msg, uint16_t msgLength, uint8_t *tagData); 43 | 44 | /** 45 | * \brief Check a valid TLV block 46 | * \param tlv 47 | * Pointer to a structure that will return offset to 48 | * tagData and len of a valid TLV block 49 | * \param tagData 50 | * Pointer to the Type 2 Tag simulated user memory. 51 | * \param tagDataLength 52 | * num of bytes until end of Type 2 Tag simulated memory 53 | * \return tlv_res_e 54 | */ 55 | tlv_res_e tlv_decode(uint8_t *tagData, uint16_t tagDataLength, tlv_msg_t *tlv); 56 | 57 | #endif /* __TLV_H__ */ 58 | -------------------------------------------------------------------------------- /source/unitary_apps/nfc/makefile: -------------------------------------------------------------------------------- 1 | # You can add more sources here and libraries if needed 2 | include $(APP_SRCS_PATH)drivers/makefile 3 | SRCS += $(APP_SRCS_PATH)lib/t2_emulation.c 4 | SRCS += $(APP_SRCS_PATH)lib/tlv.c 5 | SRCS += $(APP_SRCS_PATH)lib/ndef.c 6 | INCLUDES += -I$(APP_SRCS_PATH)lib 7 | 8 | HAL_HW_DELAY=yes 9 | 10 | # Use App Scheduler and configure it 11 | APP_SCHEDULER=yes 12 | APP_SCHEDULER_TASKS=4 13 | -------------------------------------------------------------------------------- /source/unitary_apps/provisioning_joining_node/config.mk: -------------------------------------------------------------------------------- 1 | # Boards compatible with this app 2 | TARGET_BOARDS := silabs_brd4254a efr32_template pca10059 silabs_brd4180b pca10056 nrf52_template silabs_brd4184a silabs_brd4181b promistel_rpi_hat pca10100 ublox_b204 tbsense2 pca10112 pca10040 bgm220-ek4314a wuerth_261101102 silabs_brd4210a mdbt50q_rx nrf52832_mdk_v2 ruuvitag pan1780 silabs_brd4312a silabs_brd4253a 3 | # 4 | # Network default settings configuration 5 | # 6 | 7 | # If this section is removed, node has to be configured in 8 | # a different way 9 | # Network address/channel differs from proxy node. 10 | default_network_address ?= 0xABCDE 11 | default_network_channel ?= 5 12 | # !HIGHLY RECOMMENDED! : To enable security keys please un-comment the lines below and fill with a 13 | # randomly generated authentication & encryption keys (exactly 16 bytes) 14 | #default_network_cipher_key ?= 0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x?? 15 | #default_network_authen_key ?= 0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x?? 16 | 17 | # 18 | # App specific configuration 19 | # 20 | 21 | # Define a specific application area_id 22 | app_specific_area_id=0x82f599 23 | 24 | # UID/Key storage (chipid, memarea) 25 | storage=memarea 26 | 27 | # App version 28 | # 1.0.0.0 -> 2.0.0.0: Use of default persistent area to store data 29 | app_major=2 30 | app_minor=0 31 | app_maintenance=0 32 | app_development=0 33 | -------------------------------------------------------------------------------- /source/unitary_apps/provisioning_joining_node/config_insecure.yml: -------------------------------------------------------------------------------- 1 | # This is an example file to customize a node running the provisioning joining node appliation 2 | # using the insecure method. 3 | 4 | # Hex array must start with 0x otherwise it is treated as a string. 5 | 6 | # Format is: 7 | # 8 | # provisioning : 9 | # uid: (bytes string, less than 79 bytes long) 10 | # method : (Unsecured:0, Secured:1, Extended:3) Ex: 0 11 | 12 | provisioning: 13 | uid: 0x41 0xb1 0x85 0x7a 0x0f 0xb6 0xb1 0x48 0xa5 0xe4 0xb9 0xb6 0x03 0x53 0x1b 0x3b 14 | method: 0x00 15 | -------------------------------------------------------------------------------- /source/unitary_apps/provisioning_joining_node/config_secure.yml: -------------------------------------------------------------------------------- 1 | # This is an example file to customize a node running the provisioning joining node appliation 2 | # using the secure method. 3 | 4 | # Hex array must start with 0x otherwise it is treated as a string. 5 | 6 | # Format is: 7 | # 8 | # provisioning : 9 | # uid: (bytes string, less than 79 bytes long) 10 | # factory_key : (32 bytes string, [0:15 Auth key][16:31 Enc Key]) Needed for secured method. 11 | # method : (Unsecured:0, Secured:1, Extended:3) Ex: 0 12 | 13 | provisioning: 14 | uid: 0x58 0xc8 0x12 0xad 0x37 0xe8 0x36 0x4a 0xa1 0x1f 0x1c 0xbc 0x63 0x3e 0x8e 0x34 15 | factory_key : 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0X09 0X0A 0X0B 0X0C 0X0D 0X0E 0X0F 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0X09 0X0A 0X0B 0X0C 0X0D 0X0E 0X0F 16 | method: 0x01 17 | -------------------------------------------------------------------------------- /source/unitary_apps/provisioning_joining_node/makefile: -------------------------------------------------------------------------------- 1 | CFLAGS += -DSTORAGE_TYPE=$(storage) 2 | 3 | # Enable Provisioning library 4 | PROVISIONING=yes 5 | 6 | # HAL button functions 7 | HAL_BUTTON=yes 8 | 9 | # Enable the debug logs (has no effect on board without serial port) 10 | APP_PRINTING=yes 11 | 12 | ifeq ($(storage),chipid) 13 | SRCS += $(SRCS_PATH)storage_chipid.c 14 | else ifeq ($(storage),memarea) 15 | SRCS += $(SRCS_PATH)storage_memarea.c 16 | else 17 | $(error Select one storage method.) 18 | endif 19 | -------------------------------------------------------------------------------- /source/unitary_apps/provisioning_joining_node/storage.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | 7 | /* 8 | * \file storage.h 9 | * \brief This file provides examples for persistant storage of provisioning 10 | * parameters. 11 | */ 12 | #ifndef _STORAGE_H_ 13 | #define _STORAGE_H_ 14 | 15 | #include 16 | #include 17 | #include "provisioning.h" 18 | 19 | /** 20 | * \brief Initialize the storage module. 21 | * \note Select storage method (chipid or memarea) by setting storage 22 | * variable in config.mk. 23 | * \return false if an error occured, true otherwise. 24 | */ 25 | bool Storage_init(); 26 | 27 | /** 28 | * \brief Get a pointer to the stored UID. 29 | * \param uid 30 | * A pointer to an uint8_t array. 31 | * \return The length of the UID. 32 | * \note Returning an int8_t is ok because UID fit in a 102 bytes packet. 33 | */ 34 | int8_t Storage_getUID(const uint8_t ** uid); 35 | 36 | /** 37 | * \brief Get a pointer to the stored KEY. 38 | * \param key 39 | * A pointer to an uint8_t array. 40 | * \return The length of the KEY. 41 | * \note Returning an int8_t is ok because KEY fit in a 102 bytes packet. 42 | */ 43 | int8_t Storage_getKey(const uint8_t ** key); 44 | 45 | /** 46 | * \brief Get the provisioning method. 47 | * \return The provisioning method. 48 | */ 49 | provisioning_method_e Storage_getMethod(); 50 | 51 | #endif //_STORAGE_H_ 52 | -------------------------------------------------------------------------------- /source/unitary_apps/provisioning_joining_node/storage_chipid.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | 7 | /* 8 | * \file storage_chipid.c 9 | * \brief This file provides example for persistant storage of provisioning 10 | * parameters. The chipset ID is used for the Unique ID. Only 11 | * supported provisioning method is \ref PROV_METHOD_UNSECURED as 12 | * there is no storage for the shared key. 13 | */ 14 | 15 | #include "storage.h" 16 | #include "mcu.h" 17 | 18 | bool Storage_init() 19 | { 20 | /* Nothing to do. */ 21 | return true; 22 | } 23 | 24 | int8_t Storage_getUID(const uint8_t ** uid) 25 | { 26 | #if defined(NRF52_PLATFORM) 27 | *uid = (uint8_t *)&NRF_FICR->DEVICEID[0]; 28 | #elif defined(NRF91_PLATFORM) 29 | *uid = (uint8_t *)&NRF_FICR->DEVICEID[0]; 30 | #elif defined (EFR32MG21) || defined (EFR32MG22) 31 | *uid = (uint8_t *)DEVINFO->EUI64L; 32 | #elif defined (EFR32FG12) || defined (EFR32FG13) 33 | *uid = (uint8_t *)&DEVINFO->UNIQUEL; 34 | #else 35 | #error MCU not supported. 36 | #endif 37 | 38 | /* Chip Unique Id is 64bits. */ 39 | return 8; 40 | } 41 | 42 | int8_t Storage_getKey(const uint8_t ** key) 43 | { 44 | *key = NULL; 45 | 46 | return 0; 47 | } 48 | 49 | provisioning_method_e Storage_getMethod() 50 | { 51 | return PROV_METHOD_UNSECURED; 52 | } 53 | -------------------------------------------------------------------------------- /source/unitary_apps/provisioning_proxy/config.mk: -------------------------------------------------------------------------------- 1 | # Boards compatible with this app 2 | TARGET_BOARDS := silabs_brd4254a efr32_template pca10059 silabs_brd4180b pca10056 nrf52_template silabs_brd4184a silabs_brd4181b promistel_rpi_hat pca10100 ublox_b204 tbsense2 pca10112 pca10040 bgm220-ek4314a wuerth_261101102 silabs_brd4210a mdbt50q_rx nrf52832_mdk_v2 ruuvitag pan1780 silabs_brd4312a silabs_brd4253a 3 | # 4 | # Network default settings configuration 5 | # 6 | 7 | # If this section is removed, node has to be configured in 8 | # a different way 9 | default_network_address ?= 0x1012EE 10 | default_network_channel ?= 2 11 | # !HIGHLY RECOMMENDED! : To enable security keys please un-comment the lines below and fill with a 12 | # randomly generated authentication & encryption keys (exactly 16 bytes) 13 | default_network_cipher_key ?= 0x10,0x0f,0x0e,0x0d,0x0c,0x0b,0x0a,0x09,0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01 14 | default_network_authen_key ?= 0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10 15 | 16 | # 17 | # App specific configuration 18 | # 19 | 20 | # Define a specific application area_id 21 | app_specific_area_id=0x8A2336 22 | 23 | # App version 24 | app_major=0 25 | app_minor=0 26 | app_maintenance=1 27 | app_development=0 28 | -------------------------------------------------------------------------------- /source/unitary_apps/provisioning_proxy/makefile: -------------------------------------------------------------------------------- 1 | # Enable shared data library (needed by provisioning proxy library) 2 | SHARED_DATA=yes 3 | 4 | # Enable CBOR library (needed by provisioning proxy library) 5 | TINY_CBOR=yes 6 | 7 | # Enable software AES (needed by provisioning proxy library) 8 | SW_AES=yes 9 | 10 | # Enable Provisioning Proxy library 11 | PROVISIONING_PROXY=yes 12 | 13 | # HAL button functions 14 | HAL_BUTTON=yes 15 | 16 | # Enable the debug logs (has no effect on board without serial port) 17 | APP_PRINTING=yes 18 | -------------------------------------------------------------------------------- /source/unitary_apps/scheduler/config.mk: -------------------------------------------------------------------------------- 1 | # Boards compatible with this app 2 | TARGET_BOARDS := silabs_brd4254a efr32_template pca10059 silabs_brd4180b pca10056 nrf52_template silabs_brd4184a silabs_brd4181b promistel_rpi_hat pca10100 ublox_b204 tbsense2 pca10112 pca10040 bgm220-ek4314a wuerth_261101102 silabs_brd4210a mdbt50q_rx nrf52832_mdk_v2 ruuvitag pan1780 silabs_brd4312a silabs_brd4253a 3 | # 4 | # Network default settings configuration 5 | # 6 | 7 | # If this section is removed, node has to be configured in 8 | # a different way 9 | default_network_address ?= 0x12A205 10 | default_network_channel ?= 17 11 | # !HIGHLY RECOMMENDED! : To enable security keys please un-comment the lines below and fill with a 12 | # randomly generated authentication & encryption keys (exactly 16 bytes) 13 | #default_network_cipher_key ?= 0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x?? 14 | #default_network_authen_key ?= 0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x?? 15 | 16 | # 17 | # App specific configuration 18 | # 19 | 20 | # Define a specific application area_id 21 | app_specific_area_id=0x12A205 22 | 23 | # App version 24 | app_major=1 25 | app_minor=0 26 | app_maintenance=0 27 | app_development=0 28 | -------------------------------------------------------------------------------- /source/unitary_apps/scheduler/makefile: -------------------------------------------------------------------------------- 1 | # This application use HAL for buttons and leds 2 | HAL_BUTTON=yes 3 | HAL_LED=yes 4 | 5 | # Use App Scheduler and configure it 6 | APP_SCHEDULER=yes 7 | APP_SCHEDULER_TASKS=4 8 | 9 | # Enable the debug logs (has no effect on board without serial port) 10 | APP_PRINTING=yes 11 | -------------------------------------------------------------------------------- /source/unitary_apps/shared_data/README.md: -------------------------------------------------------------------------------- 1 | # Shared_data 2 | 3 | ## Application scope 4 | 5 | This application can be used to demonstrate how to use the Shared data library, which is made to share send and receive functions/callback between multiple modules in the application. 6 | 7 | ## Application API 8 | 9 | The following packet filters are present in this application : 10 | - Unicast packet on endpoints [10:10] 11 | - All types of packet (Unicast/Multicast/Broadcast) on endpoints [20:20] 12 | - Multicast packets on group#2 (0x80000002) on any endpoints. 13 | 14 | Each packets sent on endpoints [20:20] will modify filter to [30:30] and vice-versa. 15 | 16 | ## SDK libraries used in this application 17 | 18 | This application uses the [shared_data](../../../libraries/shared_data/shared_data.h) library. 19 | 20 | It also uses the [app_scheduler library](../../../libraries/scheduler/app_scheduler.h) library. 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /source/unitary_apps/shared_data/config.mk: -------------------------------------------------------------------------------- 1 | # Boards compatible with this app 2 | TARGET_BOARDS := silabs_brd4254a efr32_template pca10059 silabs_brd4180b pca10056 nrf52_template silabs_brd4184a silabs_brd4181b promistel_rpi_hat pca10100 ublox_b204 tbsense2 pca10112 pca10040 bgm220-ek4314a wuerth_261101102 silabs_brd4210a mdbt50q_rx nrf52832_mdk_v2 ruuvitag pan1780 silabs_brd4312a silabs_brd4253a 3 | # 4 | # Network default settings configuration 5 | # 6 | 7 | # If this section is removed, node has to be configured in 8 | # a different way 9 | default_network_address ?= 0x12C03A 10 | default_network_channel ?= 3 11 | # !HIGHLY RECOMMENDED! : To enable security keys please un-comment the lines below and fill with a 12 | # randomly generated authentication & encryption keys (exactly 16 bytes) 13 | #default_network_cipher_key ?= 0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x?? 14 | #default_network_authen_key ?= 0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x?? 15 | 16 | # 17 | # App specific configuration 18 | # 19 | 20 | # Define a specific application area_id 21 | app_specific_area_id=0x83f161 22 | 23 | # App version 24 | app_major=1 25 | app_minor=0 26 | app_maintenance=0 27 | app_development=0 28 | -------------------------------------------------------------------------------- /source/unitary_apps/shared_data/makefile: -------------------------------------------------------------------------------- 1 | # Enable the debug logs (has no effect on board without serial port) 2 | APP_PRINTING=yes 3 | 4 | # Use Shared Data 5 | SHARED_DATA=yes 6 | 7 | # Use app scheduler 8 | APP_SCHEDULER=yes 9 | APP_SCHEDULER_TASKS=1 10 | 11 | -------------------------------------------------------------------------------- /source/unitary_apps/tinycbor/config.mk: -------------------------------------------------------------------------------- 1 | # Boards compatible with this app 2 | TARGET_BOARDS := silabs_brd4254a efr32_template pca10059 silabs_brd4180b pca10056 nrf52_template silabs_brd4184a silabs_brd4181b promistel_rpi_hat pca10100 ublox_b204 tbsense2 pca10112 pca10040 bgm220-ek4314a wuerth_261101102 silabs_brd4210a mdbt50q_rx nrf52832_mdk_v2 ruuvitag pan1780 silabs_brd4312a silabs_brd4253a 3 | # 4 | # Network default settings configuration 5 | # 6 | 7 | # If this section is removed, node has to be configured in 8 | # a different way 9 | default_network_address ?= 0x12C03A 10 | default_network_channel ?= 3 11 | # !HIGHLY RECOMMENDED! : To enable security keys please un-comment the lines below and fill with a 12 | # randomly generated authentication & encryption keys (exactly 16 bytes) 13 | #default_network_cipher_key ?= 0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x?? 14 | #default_network_authen_key ?= 0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x??,0x?? 15 | 16 | # 17 | # App specific configuration 18 | # 19 | 20 | # Define a specific application area_id 21 | app_specific_area_id=0x82FCEA 22 | 23 | # App version 24 | app_major=1 25 | app_minor=0 26 | app_maintenance=0 27 | app_development=0 28 | -------------------------------------------------------------------------------- /source/unitary_apps/tinycbor/makefile: -------------------------------------------------------------------------------- 1 | # Enable CBOR library 2 | TINY_CBOR=yes 3 | 4 | # Enable the debug logs (has no effect on board without serial port) 5 | APP_PRINTING=yes 6 | -------------------------------------------------------------------------------- /tools/check_python.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | 4 | # check_python.py - A tool to check python version 5 | # 6 | 7 | import sys 8 | 9 | if __name__ == '__main__': 10 | print(sys.version_info.major) 11 | -------------------------------------------------------------------------------- /tools/dependency.json: -------------------------------------------------------------------------------- 1 | { "low-energy-arm": "master", "segger-rtt": "master"} 2 | -------------------------------------------------------------------------------- /tools/hextoarray32.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | 4 | # hextoarray32.py - A tool to convert an hex file to an array of 32-bit numbers 5 | 6 | import sys 7 | import os 8 | import struct 9 | import hextool 10 | 11 | LINE_INDENT = " " 12 | LINE_LENGTH = 72 13 | 14 | 15 | # Open hex file and convert it to byte array 16 | memory = hextool.Memory() 17 | hextool.load_intel_hex(memory, filename = sys.argv[1]) 18 | # For EFR32 delete range in special registers [0xfe04000-0xfe04200] 19 | del memory[0xfe04000:0xfe04200] 20 | data = memory[memory.min_address:memory.max_address] 21 | 22 | # Open outfile and write uint32 array 23 | with open(sys.argv[2], "w") as f: 24 | line = LINE_INDENT 25 | 26 | for pos in range(0, len(data), 4): 27 | if pos != 0: 28 | line += ", " 29 | 30 | if len(line) >= LINE_LENGTH: 31 | f.write(line) 32 | f.write("\n") 33 | line = LINE_INDENT 34 | 35 | line += "0x%08x" % struct.unpack(" clear the 1st bit in array "table" 12 | #define BITFIELD_CLEAR(arr, bit) \ 13 | ((arr)[ ((bit) / BITFIELD_T_SIZE ) ]) &= ~(1 << ((bit) % BITFIELD_T_SIZE)) 14 | 15 | #define BITFIELD_GET(arr, bit) \ 16 | (((arr)[ ((bit) / BITFIELD_T_SIZE) ]) & (1 << ((bit) % BITFIELD_T_SIZE))) 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /util/makefile: -------------------------------------------------------------------------------- 1 | # Build generic utility functions 2 | SRCS += $(UTIL_PATH)crc.c \ 3 | $(UTIL_PATH)sl_list.c \ 4 | $(UTIL_PATH)util.c \ 5 | $(UTIL_PATH)api.c \ 6 | $(UTIL_PATH)pack.c \ 7 | $(UTIL_PATH)random.c \ 8 | $(UTIL_PATH)tlv.c 9 | 10 | ifeq ($(APP_PRINTING), yes) 11 | CFLAGS += -DAPP_PRINTING 12 | HAL_UART=yes 13 | SRCS += $(UTIL_PATH)syscalls.c 14 | SRCS += $(UTIL_PATH)uart_print.c 15 | endif 16 | 17 | ifeq ($(TINY_CBOR), yes) 18 | CBOR_PATH = $(UTIL_PATH)tinycbor/src/ 19 | SRCS += $(CBOR_PATH)cborencoder.c \ 20 | $(CBOR_PATH)cborencoder_close_container_checked.c \ 21 | $(CBOR_PATH)cborerrorstrings.c \ 22 | $(CBOR_PATH)cborparser.c \ 23 | $(CBOR_PATH)cborparser_dup_string.c \ 24 | $(CBOR_PATH)cborpretty.c \ 25 | $(CBOR_PATH)cborpretty_stdio.c \ 26 | $(CBOR_PATH)cbortojson.c \ 27 | $(CBOR_PATH)cborvalidation.c 28 | INCLUDES += -I$(CBOR_PATH) 29 | CFLAGS += -DNDEBUG 30 | endif 31 | 32 | ifeq ($(SW_AES), yes) 33 | AES_PATH = $(UTIL_PATH)tinyaes/ 34 | SRCS += $(AES_PATH)aes.c \ 35 | $(UTIL_PATH)aessw.c 36 | INCLUDES += -I$(AES_PATH) 37 | endif -------------------------------------------------------------------------------- /util/pack.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | 7 | #include "pack.h" 8 | 9 | uint32_t Pack_unpackLe(const uint8_t * bytes, size_t num_bytes) 10 | { 11 | const uint8_t * p = bytes + num_bytes; 12 | uint32_t result = 0; 13 | 14 | for (; num_bytes > 0; num_bytes--) 15 | { 16 | result <<= 8; 17 | result |= *(--p); // Little endian 18 | } 19 | 20 | return result; 21 | } 22 | 23 | void Pack_packLe(void * bytes, uint32_t value, size_t num_bytes) 24 | { 25 | uint8_t * p = (uint8_t *)bytes; 26 | 27 | for (; num_bytes > 0; num_bytes--) 28 | { 29 | *(p++) = (uint8_t)(value & 0xff); // Little endian 30 | value >>= 8; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /util/pack.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | 7 | /** 8 | * 9 | * \file pack.h 10 | * 11 | * Bytes to native integers packing and unpacking 12 | */ 13 | 14 | #ifndef PACK_H_ 15 | #define PACK_H_ 16 | 17 | #include 18 | #include 19 | 20 | /** 21 | * \brief Convert 1 to 4 little endian bytes to a native unsigned integer 22 | * \param bytes 23 | * Pointer to bytes to unpack 24 | * \param num_bytes 25 | * Number of bytes to unpack, up to 4 26 | * \returns Unpacked little endian value 27 | */ 28 | uint32_t Pack_unpackLe(const uint8_t * bytes, size_t num_bytes); 29 | /** 30 | * \brief Convert native unsigned integer to 1 to 4 little endian bytes 31 | * \param bytes 32 | * Pointer to bytes to pack 33 | * \param value 34 | * Value to pack 35 | * \param num_bytes 36 | * Number of bytes to pack, up to 4 37 | */ 38 | void Pack_packLe(void * bytes, uint32_t value, size_t num_bytes); 39 | 40 | #endif // PACK_H_ 41 | -------------------------------------------------------------------------------- /util/random.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | 7 | #ifndef RANDOM_H 8 | #define RANDOM_H 9 | 10 | #include 11 | 12 | /** 13 | * \brief Initialize the random generator 14 | * \param seed 15 | * Initialization seed 16 | */ 17 | void Random_init(uint32_t seed); 18 | 19 | // Macro to get default random value 20 | #define Random_get() Random_get8() 21 | 22 | /** 23 | * \brief Get random number with u8 range 24 | * \return Random number between [0...U8_MAX] 25 | */ 26 | uint8_t Random_get8(void); 27 | 28 | /** 29 | * \brief Get random number with u16 range 30 | * \return Random number between [0...U16_MAX] 31 | */ 32 | uint16_t Random_get16(void); 33 | 34 | /** 35 | * \brief Get random number with u32 range 36 | * \return Random number between [0...U32_MAX] 37 | */ 38 | uint32_t Random_get32(void); 39 | 40 | /** 41 | * \brief Generate random jitter 42 | * \param x 43 | * Jitter value 44 | * \return Jitter between 0 ... x 45 | */ 46 | #define Random_jitter(x) (Random_get32() % (((x) + 1 ) & 0xFFFFFFF)) 47 | 48 | #endif // RANDOM_H 49 | 50 | -------------------------------------------------------------------------------- /util/syscalls.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | /* 12 | * Stub methods for malloc(), free() and realloc() for newlib. 13 | * The purpose of these stubs is to minimize the amount of code 14 | * imported from newlib and also to make sure newlib code 15 | * doesn't secretly call malloc. 16 | */ 17 | 18 | void * _malloc_r(size_t size) 19 | { 20 | (void)size; 21 | return NULL; 22 | } 23 | 24 | void _free_r(void * ptr) 25 | { 26 | (void)ptr; 27 | return; 28 | } 29 | 30 | void * _realloc_r(struct _reent * a, void * b, size_t c) 31 | { 32 | (void)a; 33 | (void)b; 34 | (void)c; 35 | return NULL; 36 | } 37 | -------------------------------------------------------------------------------- /util/tinyaes/.gitignore: -------------------------------------------------------------------------------- 1 | /*.o 2 | /test.elf 3 | /test.map 4 | test_package/build 5 | -------------------------------------------------------------------------------- /util/tinyaes/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.12) 2 | 3 | project(tinyaes C ASM) 4 | 5 | add_library(tiny-aes 6 | aes.c 7 | ) 8 | 9 | target_include_directories(tiny-aes PRIVATE tiny-AES-c/) 10 | -------------------------------------------------------------------------------- /util/tinyaes/Makefile: -------------------------------------------------------------------------------- 1 | #CC = avr-gcc 2 | #CFLAGS = -Wall -mmcu=atmega16 -Os -Wl,-Map,test.map 3 | #OBJCOPY = avr-objcopy 4 | CC = gcc 5 | LD = gcc 6 | AR = ar 7 | ARFLAGS = rcs 8 | CFLAGS = -Wall -Os -c 9 | LDFLAGS = -Wall -Os -Wl,-Map,test.map 10 | ifdef AES192 11 | CFLAGS += -DAES192=1 12 | endif 13 | ifdef AES256 14 | CFLAGS += -DAES256=1 15 | endif 16 | 17 | OBJCOPYFLAGS = -j .text -O ihex 18 | OBJCOPY = objcopy 19 | 20 | # include path to AVR library 21 | INCLUDE_PATH = /usr/lib/avr/include 22 | # splint static check 23 | SPLINT = splint test.c aes.c -I$(INCLUDE_PATH) +charindex -unrecog 24 | 25 | default: test.elf 26 | 27 | .SILENT: 28 | .PHONY: lint clean 29 | 30 | test.hex : test.elf 31 | echo copy object-code to new image and format in hex 32 | $(OBJCOPY) ${OBJCOPYFLAGS} $< $@ 33 | 34 | test.o : test.c aes.h aes.o 35 | echo [CC] $@ $(CFLAGS) 36 | $(CC) $(CFLAGS) -o $@ $< 37 | 38 | aes.o : aes.c aes.h 39 | echo [CC] $@ $(CFLAGS) 40 | $(CC) $(CFLAGS) -o $@ $< 41 | 42 | test.elf : aes.o test.o 43 | echo [LD] $@ 44 | $(LD) $(LDFLAGS) -o $@ $^ 45 | 46 | aes.a : aes.o 47 | echo [AR] $@ 48 | $(AR) $(ARFLAGS) $@ $^ 49 | 50 | lib : aes.a 51 | 52 | clean: 53 | rm -f *.OBJ *.LST *.o *.gch *.out *.hex *.map *.elf *.a 54 | 55 | test: 56 | make clean && make && ./test.elf 57 | make clean && make AES192=1 && ./test.elf 58 | make clean && make AES256=1 && ./test.elf 59 | 60 | lint: 61 | $(call SPLINT) 62 | -------------------------------------------------------------------------------- /util/tinyaes/aes.hpp: -------------------------------------------------------------------------------- 1 | #ifndef _AES_HPP_ 2 | #define _AES_HPP_ 3 | 4 | #ifndef __cplusplus 5 | #error Do not include the hpp header in a c project! 6 | #endif //__cplusplus 7 | 8 | extern "C" { 9 | #include "aes.h" 10 | } 11 | 12 | #endif //_AES_HPP_ 13 | -------------------------------------------------------------------------------- /util/tinyaes/library.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tiny-AES-c", 3 | "keywords": "cryptography, aes", 4 | "description": "Small portable AES128/192/256 in C", 5 | "repository": 6 | { 7 | "type": "git", 8 | "url": "https://github.com/kokke/tiny-AES-c.git" 9 | }, 10 | "frameworks": "*", 11 | "platforms": "*", 12 | "examples": "test.c" 13 | } 14 | -------------------------------------------------------------------------------- /util/tinyaes/test.cpp: -------------------------------------------------------------------------------- 1 | #include "aes.hpp" 2 | #include "test.c" 3 | -------------------------------------------------------------------------------- /util/tinyaes/test_package/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.12) 2 | project(TinyAesPackageTest C CXX) 3 | 4 | include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) 5 | conan_basic_setup() 6 | 7 | add_executable(example ../test.c) 8 | add_executable(example_cpp ../test.cpp) 9 | 10 | target_link_libraries(example ${CONAN_LIBS}) 11 | target_link_libraries(example_cpp ${CONAN_LIBS}) -------------------------------------------------------------------------------- /util/tinyaes/test_package/conanfile.py: -------------------------------------------------------------------------------- 1 | from conans import ConanFile, CMake, tools 2 | import os 3 | 4 | 5 | class TinyAesCTestConan(ConanFile): 6 | settings = "os", "compiler", "build_type", "arch" 7 | generators = "cmake" 8 | 9 | def build(self): 10 | cmake = CMake(self) 11 | cmake.configure() 12 | cmake.build() 13 | 14 | def test(self): 15 | if not tools.cross_building(self.settings): 16 | os.chdir("bin") 17 | self.run(".%sexample" % os.sep) 18 | -------------------------------------------------------------------------------- /util/tinyaes/unlicense.txt: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /util/tinycbor/.appveyor.yml: -------------------------------------------------------------------------------- 1 | version: 0.5.3-build-{build} 2 | pull_requests: 3 | do_not_increment_build_number: true 4 | image: 5 | - Visual Studio 2015 6 | - Visual Studio 2013 7 | - Visual Studio 2017 8 | install: 9 | - cmd: >- 10 | set tests=1 11 | 12 | if /i "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2013" (call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64) & (set tests=0) 13 | 14 | if /i "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2015" (call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86) & (set QTDIR=C:\Qt\5.9\msvc2015) 15 | 16 | if /i "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2017" (call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x64) & (set QTDIR=C:\Qt\5.9\msvc2017_64) 17 | 18 | set path=%PATH%;%QTDIR%\bin 19 | build_script: 20 | - cmd: >- 21 | nmake -f Makefile.nmake -nologo CFLAGS="-W3 -Os -MDd" 22 | 23 | cd tests 24 | 25 | if /i "%tests%"=="1" qmake CONFIG-=release CONFIG+=debug 26 | 27 | if /i "%tests%"=="1" nmake -nologo -s 28 | test_script: 29 | - cmd: >- 30 | if /i "%tests%"=="1" nmake -s -nologo check 31 | 32 | if /i "%tests%"=="0" echo Tests skipped. 33 | artifacts: 34 | - path: lib\tinycbor.lib 35 | deploy: off 36 | -------------------------------------------------------------------------------- /util/tinycbor/.tag: -------------------------------------------------------------------------------- 1 | 7305a2625220f6e8f42b6fba84b7d2c3e4db9d17 2 | -------------------------------------------------------------------------------- /util/tinycbor/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Intel Corporation 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /util/tinycbor/README: -------------------------------------------------------------------------------- 1 | Concise Binary Object Representation (CBOR) Library 2 | --------------------------------------------------- 3 | 4 | To build TinyCBOR: 5 | 6 | make 7 | 8 | If you want to change the compiler or pass extra compiler flags: 9 | 10 | make CC=clang CFLAGS="-m32 -Oz" LDFLAGS="-m32" 11 | 12 | Documentation: https://intel.github.io/tinycbor/current/ 13 | 14 | -------------------------------------------------------------------------------- /util/tinycbor/TODO: -------------------------------------------------------------------------------- 1 | ==== To Do list for libcbor ==== 2 | === General === 3 | * API review 4 | * Benchmark 5 | * Write examples 6 | ** Simple decoder 7 | ** Decoder to JSON 8 | ** Windowed encoding/decoding (limited memory) 9 | 10 | === Encoder === 11 | * Write API docs 12 | * Add API for creating indeterminate-length arrays and maps 13 | * Add API for creating indeterminate-length strings 14 | * Add API for relaxing doubles to floats and to integers 15 | * Add length-checking of the sub-containers (#ifndef CBOR_ENCODER_NO_USER_CHECK) 16 | * Decide how to indicate number of bytes needed 17 | ** Suggestion: return negative number from the functions 18 | 19 | === Decoder === 20 | * Write functions not yet implemented 21 | * Add API for stream-decoding strings 22 | * Add API for checking known tags and simple types 23 | * (unlikely) Add API for checking the pairing of a tag and the tagged type 24 | * Write tests for error conditions 25 | * Fuzzy-test the decoder 26 | -------------------------------------------------------------------------------- /util/tinycbor/VERSION: -------------------------------------------------------------------------------- 1 | 0.5.3 2 | -------------------------------------------------------------------------------- /util/tinycbor/examples/examples.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | SUBDIRS = simplereader.pro 3 | -------------------------------------------------------------------------------- /util/tinycbor/examples/simplereader.pro: -------------------------------------------------------------------------------- 1 | CONFIG -= qt 2 | SOURCES = simplereader.c 3 | include(../src/src.pri) 4 | -------------------------------------------------------------------------------- /util/tinycbor/src/src.pri: -------------------------------------------------------------------------------- 1 | SOURCES += \ 2 | $$PWD/cborencoder.c \ 3 | $$PWD/cborencoder_close_container_checked.c \ 4 | $$PWD/cborerrorstrings.c \ 5 | $$PWD/cborparser.c \ 6 | $$PWD/cborparser_dup_string.c \ 7 | $$PWD/cborpretty.c \ 8 | $$PWD/cbortojson.c \ 9 | $$PWD/cborvalidation.c \ 10 | 11 | HEADERS += $$PWD/cbor.h $$PWD/tinycbor-version.h 12 | 13 | QMAKE_CFLAGS *= $$QMAKE_CFLAGS_SPLIT_SECTIONS 14 | QMAKE_LFLAGS *= $$QMAKE_LFLAGS_GCSECTIONS 15 | INCLUDEPATH += $$PWD 16 | CONFIG(release, debug|release): DEFINES += NDEBUG 17 | -------------------------------------------------------------------------------- /util/tinycbor/src/tags.txt: -------------------------------------------------------------------------------- 1 | # Tag number; Tag ID; Applicable types (comma-separated); Semantics 2 | 0;DateTimeString;TextString;Standard date/time string 3 | 1;UnixTime_t;Integer;Epoch-based date/time 4 | 2;PositiveBignum;ByteString;Positive bignum 5 | 3;NegativeBignum;ByteString;Negative bignum 6 | 4;Decimal;Array;Decimal fraction 7 | 5;Bigfloat;Array;Bigfloat 8 | 16;COSE_Encrypt0;Array;COSE Single Recipient Encrypted Data Object (RFC 8152) 9 | 17;COSE_Mac0;Array;COSE Mac w/o Recipients Object (RFC 8152) 10 | 18;COSE_Sign1;Array;COSE Single Signer Data Object (RFC 8162) 11 | 21;ExpectedBase64url;ByteString,Array,Map;Expected conversion to base64url encoding 12 | 22;ExpectedBase64;ByteString,Array,Map;Expected conversion to base64 encoding 13 | 23;ExpectedBase16;ByteString,Array,Map;Expected conversion to base16 encoding 14 | 24;EncodedCbor;ByteString;Encoded CBOR data item 15 | 32;Url;TextString;URI 16 | 33;Base64url;TextString;base64url 17 | 34;Base64;TextString;base64 18 | 35;RegularExpression;TextString;Regular expression 19 | 36;MimeMessage;TextString;MIME message 20 | 96;COSE_Encrypt;Array;COSE Encrypted Data Object (RFC 8152) 21 | 97;COSE_Mac;Array;COSE MACed Data Object (RFC 8152) 22 | 98;COSE_Sign;Array;COSE Signed Data Object (RFC 8152) 23 | 55799;Signature;;Self-describe CBOR 24 | -------------------------------------------------------------------------------- /util/tinycbor/src/tinycbor-version.h: -------------------------------------------------------------------------------- 1 | #define TINYCBOR_VERSION_MAJOR 0 2 | #define TINYCBOR_VERSION_MINOR 5 3 | #define TINYCBOR_VERSION_PATCH 3 4 | -------------------------------------------------------------------------------- /util/tinycbor/src/tinycbor.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = lib 2 | CONFIG += static 3 | CONFIG -= qt 4 | DESTDIR = ../lib 5 | 6 | include(src.pri) 7 | -------------------------------------------------------------------------------- /util/tinycbor/tests/c90/c90.pro: -------------------------------------------------------------------------------- 1 | CONFIG += testcase parallel_test console 2 | CONFIG -= qt app_bundle 3 | gcc: QMAKE_CFLAGS += -std=c90 -pedantic-errors -Wall -Wextra -Werror 4 | darwin: QMAKE_CFLAGS += -Wno-long-long 5 | 6 | SOURCES += tst_c90.c 7 | INCLUDEPATH += ../../src 8 | -------------------------------------------------------------------------------- /util/tinycbor/tests/c90/tst_c90.c: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2018 Intel Corporation 4 | ** 5 | ** Permission is hereby granted, free of charge, to any person obtaining a copy 6 | ** of this software and associated documentation files (the "Software"), to deal 7 | ** in the Software without restriction, including without limitation the rights 8 | ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | ** copies of the Software, and to permit persons to whom the Software is 10 | ** furnished to do so, subject to the following conditions: 11 | ** 12 | ** The above copyright notice and this permission notice shall be included in 13 | ** all copies or substantial portions of the Software. 14 | ** 15 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | ** THE SOFTWARE. 22 | ** 23 | ****************************************************************************/ 24 | 25 | #include "cbor.h" 26 | 27 | int main() 28 | { 29 | return 0; 30 | } 31 | -------------------------------------------------------------------------------- /util/tinycbor/tests/cpp/cpp.pro: -------------------------------------------------------------------------------- 1 | CONFIG += testcase parallel_test c++11 2 | QT = core testlib 3 | 4 | SOURCES = tst_cpp.cpp 5 | INCLUDEPATH += ../../src 6 | -------------------------------------------------------------------------------- /util/tinycbor/tests/encoder/encoder.pro: -------------------------------------------------------------------------------- 1 | SOURCES += tst_encoder.cpp 2 | 3 | CONFIG += testcase parallel_test c++11 4 | QT = core testlib 5 | 6 | INCLUDEPATH += ../../src 7 | msvc: POST_TARGETDEPS = ../../lib/tinycbor.lib 8 | else: POST_TARGETDEPS += ../../lib/libtinycbor.a 9 | LIBS += $$POST_TARGETDEPS 10 | -------------------------------------------------------------------------------- /util/tinycbor/tests/parser/parser.pro: -------------------------------------------------------------------------------- 1 | SOURCES += tst_parser.cpp ../../src/cborparser.c 2 | 3 | CONFIG += testcase parallel_test c++11 4 | QT = core testlib 5 | DEFINES += CBOR_PARSER_MAX_RECURSIONS=16 6 | 7 | INCLUDEPATH += ../../src 8 | msvc: POST_TARGETDEPS = ../../lib/tinycbor.lib 9 | else: POST_TARGETDEPS += ../../lib/libtinycbor.a 10 | LIBS += $$POST_TARGETDEPS 11 | -------------------------------------------------------------------------------- /util/tinycbor/tests/tests.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | SUBDIRS = parser encoder c90 cpp tojson 3 | msvc: SUBDIRS -= tojson 4 | -------------------------------------------------------------------------------- /util/tinycbor/tests/tojson/tojson.pro: -------------------------------------------------------------------------------- 1 | CONFIG += testcase parallel_test c++11 2 | QT = core testlib 3 | 4 | SOURCES += tst_tojson.cpp 5 | INCLUDEPATH += ../../src 6 | msvc: POST_TARGETDEPS = ../../lib/tinycbor.lib 7 | else: POST_TARGETDEPS += ../../lib/libtinycbor.a 8 | LIBS += $$POST_TARGETDEPS 9 | -------------------------------------------------------------------------------- /util/tinycbor/tinycbor.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: TinyCBOR 7 | Description: A tiny CBOR encoder and decoder library 8 | Version: @version@ 9 | Libs: -L${libdir} -ltinycbor 10 | Libs.private: -lm 11 | Cflags: -I${includedir}/tinycbor 12 | -------------------------------------------------------------------------------- /util/tinycbor/tools/cbordump/cbordump.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = app 2 | CONFIG += console 3 | CONFIG -= app_bundle 4 | CONFIG -= qt 5 | DESTDIR = ../../bin 6 | 7 | CBORDIR = $$PWD/../../src 8 | INCLUDEPATH += $$CBORDIR 9 | SOURCES += cbordump.c 10 | LIBS += ../../lib/libtinycbor.a 11 | -------------------------------------------------------------------------------- /util/tinycbor/tools/json2cbor/json2cbor.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = app 2 | CONFIG += console 3 | CONFIG -= app_bundle 4 | CONFIG -= qt 5 | DESTDIR = ../../bin 6 | 7 | CBORDIR = $$PWD/../../src 8 | INCLUDEPATH += $$CBORDIR 9 | SOURCES += json2cbor.c 10 | LIBS += ../../lib/libtinycbor.a 11 | 12 | CJSONDIR = . 13 | !exists($$CJSONDIR/cJSON.h): CJSONDIR = $$CBORDIR/cjson 14 | exists($$CJSONDIR/cJSON.h) { 15 | INCLUDEPATH += $$CJSONDIR 16 | SOURCES += $$CJSONDIR/cJSON.c 17 | } else { 18 | message("cJSON not found, not building json2cbor.") 19 | TEMPLATE = aux 20 | } 21 | -------------------------------------------------------------------------------- /util/uart_print.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #include "uart_print.h" 13 | 14 | // Storage for debug messages. 15 | #define BUFFER_SIZE 128ul 16 | static uint8_t m_buffer[BUFFER_SIZE]; 17 | 18 | #include "hal_api.h" 19 | 20 | static ssize_t _write(char * ptr, size_t len) 21 | { 22 | // Check that size is not too large for the ring buffer in usart-driver 23 | if(len > Usart_getMTUSize()) 24 | { 25 | return 0; 26 | } 27 | // Write data to the usart port and return number of bytes written 28 | return Usart_sendBuffer(ptr, len); 29 | } 30 | 31 | void UartPrint_init(uint32_t baudrate) 32 | { 33 | // Open HAL 34 | HAL_Open(); 35 | // Initialize the hardware module 36 | Usart_init(baudrate, false); 37 | // And set power on (do not power down UART between writing frames) 38 | Usart_setEnabled(true); 39 | } 40 | 41 | int UartPrint_printf(const char * fmt, ...) 42 | { 43 | int len; 44 | va_list args; 45 | 46 | va_start(args, fmt); 47 | 48 | len = vsnprintf((char *)&m_buffer[0], BUFFER_SIZE, fmt, args); 49 | // Try sending 50 | len = _write((char *)m_buffer, len); 51 | 52 | va_end(args); 53 | 54 | return len; 55 | } -------------------------------------------------------------------------------- /util/uart_print.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 Wirepas Ltd. All Rights Reserved. 2 | * 3 | * See file LICENSE.txt for full license details. 4 | * 5 | */ 6 | 7 | 8 | #ifndef UART_PRINT_H_ 9 | #define UART_PRINT_H_ 10 | #include 11 | 12 | #ifdef APP_PRINTING 13 | 14 | /** 15 | * \brief Initialize the uart print module 16 | * \param baudrate 17 | * Baudrate to be used; min 115200 bits/s 18 | * \note Uart pins are define in board.h 19 | */ 20 | void UartPrint_init(uint32_t baudrate); 21 | 22 | /** 23 | * \brief printf functionality 24 | * \param fmt 25 | * Formatted text to print 26 | * \param ... 27 | * Argument list for formatted text 28 | * \return Amount of characters written to standard output 29 | */ 30 | int UartPrint_printf(const char * fmt, ...); 31 | 32 | #else 33 | #define UartPrint_init(baudrate) 34 | #define UartPrint_printf(fmt, ...) 35 | #endif 36 | 37 | #endif /* UART_PRINT_H_ */ 38 | -------------------------------------------------------------------------------- /util/util.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "util.h" 3 | #include "crc.h" 4 | 5 | //--------------------------------------------------------------------------- 6 | // Comparison functions 7 | 8 | bool Util_isLtUint32(uint32_t a, uint32_t b) 9 | { 10 | return ((int32_t) ((a) - (b)) < 0); 11 | } 12 | 13 | bool Util_isSmallest(const uint32_t a, const uint32_t b, const uint32_t c) 14 | { 15 | return (Util_isLtUint32(a, b) && 16 | Util_isLtUint32(b, c)); 17 | } 18 | 19 | bool Util_inBetween(const uint32_t a, const uint32_t b, const uint32_t c) 20 | { 21 | return ( Util_isGtOrEqUint32(b, a) && 22 | Util_isGtOrEqUint32(c, b)); 23 | } 24 | 25 | uint8_t Util_bitCountU8(uint8_t value) 26 | { 27 | uint8_t count = 0; 28 | 29 | for (count = 0; value; value >>= 1) 30 | { 31 | count += (value & 1); 32 | } 33 | 34 | return count; 35 | } 36 | -------------------------------------------------------------------------------- /version.txt: -------------------------------------------------------------------------------- 1 | Thu Nov 9 12:37:30 UTC 2023 2 | 75db2205251a9d3c44c7020be42c5b1318da40fb 3 | --------------------------------------------------------------------------------