├── .clang-format ├── .gitattributes ├── .github └── workflows │ ├── cmake-arm.yml │ ├── cmake-native.yml │ ├── codeql-analysis.yml │ └── platform-io.yml ├── .gitignore ├── .readthedocs.yaml ├── CMakeLists.txt ├── LICENSE ├── README.md ├── doc ├── CC1101-868mhz-radio-module-pinout.jpg ├── Doxyfile ├── Makefile ├── conf.py ├── example_list.h ├── index.rst ├── knx_cemi_notes.md ├── knx_coupler_notes.md ├── knx_data_secure_notes.md ├── knx_rf_notes.md ├── references.bib └── requirements.txt ├── examples ├── knx-433Dio │ ├── KNXto433.xml │ ├── README.md │ ├── knx-433.knxprod │ └── knx-433Dio.ino ├── knx-bme680 │ ├── bme680.knxprod │ ├── bme680.xml │ └── knx-bme680.ino ├── knx-cc1310 │ ├── Board.h │ ├── CC1310_LAUNCHXL.c │ ├── CC1310_LAUNCHXL.h │ ├── CC1310_LAUNCHXL_NoRTOS.lds │ ├── CC1310_LAUNCHXL_fxns.c │ ├── CMakeLists.txt │ ├── README.md │ ├── RTT │ │ ├── SEGGER_RTT.c │ │ ├── SEGGER_RTT.h │ │ ├── SEGGER_RTT_ASM_ARMv7M.S │ │ ├── SEGGER_RTT_Conf.h │ │ ├── SEGGER_RTT_Syscalls_GCC.c │ │ └── SEGGER_RTT_printf.c │ ├── build.sh │ ├── ccfg.c │ ├── ccs │ │ ├── .ccsproject │ │ ├── .cproject │ │ ├── .project │ │ └── README.md │ ├── cmake │ │ ├── FindSimpleLinkCC13X0SDKnortos.cmake │ │ ├── binutils-arm-none-eabi.cmake │ │ ├── cc13xx.cmake │ │ └── toolchain-arm-none-eabi.cmake │ ├── coresdk_cc13xx_cc26xx │ │ ├── LICENSE │ │ ├── kernel │ │ │ └── nortos │ │ │ │ ├── NoRTOS.c │ │ │ │ ├── NoRTOS.h │ │ │ │ ├── dpl │ │ │ │ ├── ClockPTimer_nortos.c │ │ │ │ ├── DebugP_nortos.c │ │ │ │ ├── HwiPCC26XX_nortos.c │ │ │ │ ├── MutexP_nortos.c │ │ │ │ ├── PowerCC26X2_nortos.c │ │ │ │ ├── PowerCC26XX_nortos.c │ │ │ │ ├── QueueP.h │ │ │ │ ├── QueueP_nortos.c │ │ │ │ ├── SemaphoreP_nortos.c │ │ │ │ ├── SwiP_nortos.c │ │ │ │ ├── SystemP_nortos.c │ │ │ │ ├── TimerP.h │ │ │ │ ├── TimerPCC26XX_nortos.c │ │ │ │ └── posix_sleep.c │ │ │ │ ├── lib │ │ │ │ ├── nortos_cc13x0.am3g │ │ │ │ ├── nortos_cc13x0.arm3 │ │ │ │ ├── nortos_cc13x2.am4fg │ │ │ │ ├── nortos_cc13x2.arm4f │ │ │ │ ├── nortos_cc26x0.am3g │ │ │ │ ├── nortos_cc26x0.arm3 │ │ │ │ ├── nortos_cc26x2.am4fg │ │ │ │ └── nortos_cc26x2.arm4f │ │ │ │ ├── posix │ │ │ │ ├── sys │ │ │ │ │ └── types.h │ │ │ │ └── unistd.h │ │ │ │ └── startup │ │ │ │ ├── startup_cc13xx_cc26xx_gcc.c │ │ │ │ └── startup_cc13xx_cc26xx_iar.c │ │ └── source │ │ │ └── ti │ │ │ ├── devices │ │ │ ├── DeviceFamily.h │ │ │ ├── cc13x0 │ │ │ │ ├── driverlib │ │ │ │ │ ├── adi.c │ │ │ │ │ ├── adi.h │ │ │ │ │ ├── adi_doc.h │ │ │ │ │ ├── aes.c │ │ │ │ │ ├── aes.h │ │ │ │ │ ├── aon_batmon.c │ │ │ │ │ ├── aon_batmon.h │ │ │ │ │ ├── aon_event.c │ │ │ │ │ ├── aon_event.h │ │ │ │ │ ├── aon_event_doc.h │ │ │ │ │ ├── aon_ioc.c │ │ │ │ │ ├── aon_ioc.h │ │ │ │ │ ├── aon_ioc_doc.h │ │ │ │ │ ├── aon_rtc.c │ │ │ │ │ ├── aon_rtc.h │ │ │ │ │ ├── aon_rtc_doc.h │ │ │ │ │ ├── aon_wuc.c │ │ │ │ │ ├── aon_wuc.h │ │ │ │ │ ├── aux_adc.c │ │ │ │ │ ├── aux_adc.h │ │ │ │ │ ├── aux_smph.c │ │ │ │ │ ├── aux_smph.h │ │ │ │ │ ├── aux_tdc.c │ │ │ │ │ ├── aux_tdc.h │ │ │ │ │ ├── aux_timer.c │ │ │ │ │ ├── aux_timer.h │ │ │ │ │ ├── aux_wuc.c │ │ │ │ │ ├── aux_wuc.h │ │ │ │ │ ├── bin │ │ │ │ │ │ ├── gcc │ │ │ │ │ │ │ └── driverlib.lib │ │ │ │ │ │ └── iar │ │ │ │ │ │ │ └── driverlib.lib │ │ │ │ │ ├── ccfgread.c │ │ │ │ │ ├── ccfgread.h │ │ │ │ │ ├── ccfgread_doc.h │ │ │ │ │ ├── chipinfo.c │ │ │ │ │ ├── chipinfo.h │ │ │ │ │ ├── cpu.c │ │ │ │ │ ├── cpu.h │ │ │ │ │ ├── cpu_doc.h │ │ │ │ │ ├── crypto.c │ │ │ │ │ ├── crypto.h │ │ │ │ │ ├── ddi.c │ │ │ │ │ ├── ddi.h │ │ │ │ │ ├── ddi_doc.h │ │ │ │ │ ├── debug.c │ │ │ │ │ ├── debug.h │ │ │ │ │ ├── driverlib_release.c │ │ │ │ │ ├── driverlib_release.h │ │ │ │ │ ├── event.c │ │ │ │ │ ├── event.h │ │ │ │ │ ├── event_doc.h │ │ │ │ │ ├── flash.c │ │ │ │ │ ├── flash.h │ │ │ │ │ ├── gpio.c │ │ │ │ │ ├── gpio.h │ │ │ │ │ ├── gpio_doc.h │ │ │ │ │ ├── group_analog_doc.h │ │ │ │ │ ├── group_aon_doc.h │ │ │ │ │ ├── group_aux_doc.h │ │ │ │ │ ├── i2c.c │ │ │ │ │ ├── i2c.h │ │ │ │ │ ├── i2c_doc.h │ │ │ │ │ ├── i2s.c │ │ │ │ │ ├── i2s.h │ │ │ │ │ ├── i2s_doc.h │ │ │ │ │ ├── interrupt.c │ │ │ │ │ ├── interrupt.h │ │ │ │ │ ├── interrupt_doc.h │ │ │ │ │ ├── ioc.c │ │ │ │ │ ├── ioc.h │ │ │ │ │ ├── ioc_doc.h │ │ │ │ │ ├── osc.c │ │ │ │ │ ├── osc.h │ │ │ │ │ ├── prcm.c │ │ │ │ │ ├── prcm.h │ │ │ │ │ ├── pwr_ctrl.c │ │ │ │ │ ├── pwr_ctrl.h │ │ │ │ │ ├── rf_ble_cmd.h │ │ │ │ │ ├── rf_ble_mailbox.h │ │ │ │ │ ├── rf_common_cmd.h │ │ │ │ │ ├── rf_data_entry.h │ │ │ │ │ ├── rf_hs_cmd.h │ │ │ │ │ ├── rf_hs_mailbox.h │ │ │ │ │ ├── rf_mailbox.h │ │ │ │ │ ├── rf_prop_cmd.h │ │ │ │ │ ├── rf_prop_mailbox.h │ │ │ │ │ ├── rfc.c │ │ │ │ │ ├── rfc.h │ │ │ │ │ ├── rom.h │ │ │ │ │ ├── rom_crypto.c │ │ │ │ │ ├── rom_crypto.h │ │ │ │ │ ├── setup.c │ │ │ │ │ ├── setup.h │ │ │ │ │ ├── setup_doc.h │ │ │ │ │ ├── setup_rom.c │ │ │ │ │ ├── setup_rom.h │ │ │ │ │ ├── setup_rom_doc.h │ │ │ │ │ ├── smph.c │ │ │ │ │ ├── smph.h │ │ │ │ │ ├── smph_doc.h │ │ │ │ │ ├── ssi.c │ │ │ │ │ ├── ssi.h │ │ │ │ │ ├── sw_chacha.c │ │ │ │ │ ├── sw_ecrypt-config.h │ │ │ │ │ ├── sw_ecrypt-machine.h │ │ │ │ │ ├── sw_ecrypt-portable.h │ │ │ │ │ ├── sw_ecrypt-sync.h │ │ │ │ │ ├── sw_poly1305-donna-32.h │ │ │ │ │ ├── sw_poly1305-donna.c │ │ │ │ │ ├── sw_poly1305-donna.h │ │ │ │ │ ├── sys_ctrl.c │ │ │ │ │ ├── sys_ctrl.h │ │ │ │ │ ├── systick.c │ │ │ │ │ ├── systick.h │ │ │ │ │ ├── systick_doc.h │ │ │ │ │ ├── timer.c │ │ │ │ │ ├── timer.h │ │ │ │ │ ├── timer_doc.h │ │ │ │ │ ├── trng.c │ │ │ │ │ ├── trng.h │ │ │ │ │ ├── uart.c │ │ │ │ │ ├── uart.h │ │ │ │ │ ├── uart_doc.h │ │ │ │ │ ├── udma.c │ │ │ │ │ ├── udma.h │ │ │ │ │ ├── vims.c │ │ │ │ │ ├── vims.h │ │ │ │ │ ├── watchdog.c │ │ │ │ │ ├── watchdog.h │ │ │ │ │ └── watchdog_doc.h │ │ │ │ ├── inc │ │ │ │ │ ├── asmdefs.h │ │ │ │ │ ├── hw_adi.h │ │ │ │ │ ├── hw_adi_2_refsys.h │ │ │ │ │ ├── hw_adi_3_refsys.h │ │ │ │ │ ├── hw_adi_4_aux.h │ │ │ │ │ ├── hw_aon_batmon.h │ │ │ │ │ ├── hw_aon_event.h │ │ │ │ │ ├── hw_aon_ioc.h │ │ │ │ │ ├── hw_aon_rtc.h │ │ │ │ │ ├── hw_aon_sysctl.h │ │ │ │ │ ├── hw_aon_wuc.h │ │ │ │ │ ├── hw_aux_aiodio.h │ │ │ │ │ ├── hw_aux_anaif.h │ │ │ │ │ ├── hw_aux_evctl.h │ │ │ │ │ ├── hw_aux_sce.h │ │ │ │ │ ├── hw_aux_smph.h │ │ │ │ │ ├── hw_aux_tdc.h │ │ │ │ │ ├── hw_aux_timer.h │ │ │ │ │ ├── hw_aux_wuc.h │ │ │ │ │ ├── hw_ccfg.h │ │ │ │ │ ├── hw_ccfg_simple_struct.h │ │ │ │ │ ├── hw_chip_def.h │ │ │ │ │ ├── hw_cpu_dwt.h │ │ │ │ │ ├── hw_cpu_fpb.h │ │ │ │ │ ├── hw_cpu_itm.h │ │ │ │ │ ├── hw_cpu_rom_table.h │ │ │ │ │ ├── hw_cpu_scs.h │ │ │ │ │ ├── hw_cpu_tiprop.h │ │ │ │ │ ├── hw_cpu_tpiu.h │ │ │ │ │ ├── hw_crypto.h │ │ │ │ │ ├── hw_ddi.h │ │ │ │ │ ├── hw_ddi_0_osc.h │ │ │ │ │ ├── hw_device.h │ │ │ │ │ ├── hw_event.h │ │ │ │ │ ├── hw_fcfg1.h │ │ │ │ │ ├── hw_flash.h │ │ │ │ │ ├── hw_gpio.h │ │ │ │ │ ├── hw_gpt.h │ │ │ │ │ ├── hw_i2c.h │ │ │ │ │ ├── hw_i2s.h │ │ │ │ │ ├── hw_ints.h │ │ │ │ │ ├── hw_ioc.h │ │ │ │ │ ├── hw_memmap.h │ │ │ │ │ ├── hw_nvic.h │ │ │ │ │ ├── hw_prcm.h │ │ │ │ │ ├── hw_rfc_dbell.h │ │ │ │ │ ├── hw_rfc_pwr.h │ │ │ │ │ ├── hw_rfc_rat.h │ │ │ │ │ ├── hw_smph.h │ │ │ │ │ ├── hw_ssi.h │ │ │ │ │ ├── hw_sysctl.h │ │ │ │ │ ├── hw_trng.h │ │ │ │ │ ├── hw_types.h │ │ │ │ │ ├── hw_uart.h │ │ │ │ │ ├── hw_udma.h │ │ │ │ │ ├── hw_vims.h │ │ │ │ │ └── hw_wdt.h │ │ │ │ ├── rf_patches │ │ │ │ │ ├── rf_patch_cpe_ant_div.h │ │ │ │ │ ├── rf_patch_cpe_ble.h │ │ │ │ │ ├── rf_patch_cpe_ble_priv_1_2.h │ │ │ │ │ ├── rf_patch_cpe_brepeat.h │ │ │ │ │ ├── rf_patch_cpe_genfsk.h │ │ │ │ │ ├── rf_patch_cpe_genook.h │ │ │ │ │ ├── rf_patch_cpe_ghs.h │ │ │ │ │ ├── rf_patch_cpe_lrm.h │ │ │ │ │ ├── rf_patch_cpe_sl_longrange.h │ │ │ │ │ ├── rf_patch_cpe_wb_dsss.h │ │ │ │ │ ├── rf_patch_cpe_wmbus_ctmode.h │ │ │ │ │ ├── rf_patch_cpe_wmbus_smode.h │ │ │ │ │ ├── rf_patch_mce_brepeat.h │ │ │ │ │ ├── rf_patch_mce_genfsk.h │ │ │ │ │ ├── rf_patch_mce_genfsk_ant_div_pqt.h │ │ │ │ │ ├── rf_patch_mce_genfsk_fec_cc1101.h │ │ │ │ │ ├── rf_patch_mce_genook.h │ │ │ │ │ ├── rf_patch_mce_ghs.h │ │ │ │ │ ├── rf_patch_mce_hsp_4mbps.h │ │ │ │ │ ├── rf_patch_mce_iqdump.h │ │ │ │ │ ├── rf_patch_mce_sl_longrange.h │ │ │ │ │ ├── rf_patch_mce_wb_dsss.h │ │ │ │ │ ├── rf_patch_mce_wmbus_ctmode.h │ │ │ │ │ ├── rf_patch_mce_wmbus_smode.h │ │ │ │ │ ├── rf_patch_rfe_ble.h │ │ │ │ │ ├── rf_patch_rfe_brepeat.h │ │ │ │ │ ├── rf_patch_rfe_genfsk.h │ │ │ │ │ ├── rf_patch_rfe_genfsk_ant_div.h │ │ │ │ │ ├── rf_patch_rfe_genook.h │ │ │ │ │ ├── rf_patch_rfe_ghs.h │ │ │ │ │ ├── rf_patch_rfe_hsp_4mbps.h │ │ │ │ │ ├── rf_patch_rfe_lrm.h │ │ │ │ │ ├── rf_patch_rfe_sl_longrange.h │ │ │ │ │ ├── rf_patch_rfe_wb_dsss.h │ │ │ │ │ ├── rf_patch_rfe_wmbus_ctmode.h │ │ │ │ │ └── rf_patch_rfe_wmbus_smode.h │ │ │ │ ├── rom │ │ │ │ │ ├── driverlib.c │ │ │ │ │ ├── driverlib.elf │ │ │ │ │ └── readme.txt │ │ │ │ └── startup_files │ │ │ │ │ └── ccfg.c │ │ │ ├── cc13x2_cc26x2 │ │ │ │ ├── driverlib │ │ │ │ │ ├── adi.c │ │ │ │ │ ├── adi.h │ │ │ │ │ ├── adi_doc.h │ │ │ │ │ ├── aes.c │ │ │ │ │ ├── aes.h │ │ │ │ │ ├── aes_doc.h │ │ │ │ │ ├── aon_batmon.c │ │ │ │ │ ├── aon_batmon.h │ │ │ │ │ ├── aon_event.c │ │ │ │ │ ├── aon_event.h │ │ │ │ │ ├── aon_event_doc.h │ │ │ │ │ ├── aon_ioc.c │ │ │ │ │ ├── aon_ioc.h │ │ │ │ │ ├── aon_ioc_doc.h │ │ │ │ │ ├── aon_pmctl.c │ │ │ │ │ ├── aon_pmctl.h │ │ │ │ │ ├── aon_pmctl_doc.h │ │ │ │ │ ├── aon_rtc.c │ │ │ │ │ ├── aon_rtc.h │ │ │ │ │ ├── aon_rtc_doc.h │ │ │ │ │ ├── aux_adc.c │ │ │ │ │ ├── aux_adc.h │ │ │ │ │ ├── aux_smph.c │ │ │ │ │ ├── aux_smph.h │ │ │ │ │ ├── aux_sysif.c │ │ │ │ │ ├── aux_sysif.h │ │ │ │ │ ├── aux_tdc.c │ │ │ │ │ ├── aux_tdc.h │ │ │ │ │ ├── bin │ │ │ │ │ │ ├── gcc │ │ │ │ │ │ │ └── driverlib.lib │ │ │ │ │ │ └── iar │ │ │ │ │ │ │ └── driverlib.lib │ │ │ │ │ ├── ccfgread.c │ │ │ │ │ ├── ccfgread.h │ │ │ │ │ ├── ccfgread_doc.h │ │ │ │ │ ├── chipinfo.c │ │ │ │ │ ├── chipinfo.h │ │ │ │ │ ├── cpu.c │ │ │ │ │ ├── cpu.h │ │ │ │ │ ├── cpu_doc.h │ │ │ │ │ ├── crypto.c │ │ │ │ │ ├── crypto.h │ │ │ │ │ ├── ddi.c │ │ │ │ │ ├── ddi.h │ │ │ │ │ ├── ddi_doc.h │ │ │ │ │ ├── debug.c │ │ │ │ │ ├── debug.h │ │ │ │ │ ├── driverlib_release.c │ │ │ │ │ ├── driverlib_release.h │ │ │ │ │ ├── event.c │ │ │ │ │ ├── event.h │ │ │ │ │ ├── event_doc.h │ │ │ │ │ ├── flash.c │ │ │ │ │ ├── flash.h │ │ │ │ │ ├── gpio.c │ │ │ │ │ ├── gpio.h │ │ │ │ │ ├── gpio_doc.h │ │ │ │ │ ├── group_analog_doc.h │ │ │ │ │ ├── group_aon_doc.h │ │ │ │ │ ├── group_aux_doc.h │ │ │ │ │ ├── i2c.c │ │ │ │ │ ├── i2c.h │ │ │ │ │ ├── i2c_doc.h │ │ │ │ │ ├── i2s.c │ │ │ │ │ ├── i2s.h │ │ │ │ │ ├── i2s_doc.h │ │ │ │ │ ├── interrupt.c │ │ │ │ │ ├── interrupt.h │ │ │ │ │ ├── interrupt_doc.h │ │ │ │ │ ├── ioc.c │ │ │ │ │ ├── ioc.h │ │ │ │ │ ├── ioc_doc.h │ │ │ │ │ ├── osc.c │ │ │ │ │ ├── osc.h │ │ │ │ │ ├── pka.c │ │ │ │ │ ├── pka.h │ │ │ │ │ ├── pka_doc.h │ │ │ │ │ ├── prcm.c │ │ │ │ │ ├── prcm.h │ │ │ │ │ ├── pwr_ctrl.c │ │ │ │ │ ├── pwr_ctrl.h │ │ │ │ │ ├── rf_ble_cmd.h │ │ │ │ │ ├── rf_ble_mailbox.h │ │ │ │ │ ├── rf_common_cmd.h │ │ │ │ │ ├── rf_data_entry.h │ │ │ │ │ ├── rf_hs_cmd.h │ │ │ │ │ ├── rf_hs_mailbox.h │ │ │ │ │ ├── rf_ieee_cmd.h │ │ │ │ │ ├── rf_ieee_mailbox.h │ │ │ │ │ ├── rf_mailbox.h │ │ │ │ │ ├── rf_prop_cmd.h │ │ │ │ │ ├── rf_prop_mailbox.h │ │ │ │ │ ├── rfc.c │ │ │ │ │ ├── rfc.h │ │ │ │ │ ├── rom.h │ │ │ │ │ ├── rom_crypto.c │ │ │ │ │ ├── rom_crypto.h │ │ │ │ │ ├── setup.c │ │ │ │ │ ├── setup.h │ │ │ │ │ ├── setup_doc.h │ │ │ │ │ ├── setup_rom.c │ │ │ │ │ ├── setup_rom.h │ │ │ │ │ ├── setup_rom_doc.h │ │ │ │ │ ├── sha2.c │ │ │ │ │ ├── sha2.h │ │ │ │ │ ├── sha2_doc.h │ │ │ │ │ ├── smph.c │ │ │ │ │ ├── smph.h │ │ │ │ │ ├── smph_doc.h │ │ │ │ │ ├── ssi.c │ │ │ │ │ ├── ssi.h │ │ │ │ │ ├── sw_chacha.c │ │ │ │ │ ├── sw_ecrypt-config.h │ │ │ │ │ ├── sw_ecrypt-machine.h │ │ │ │ │ ├── sw_ecrypt-portable.h │ │ │ │ │ ├── sw_ecrypt-sync.h │ │ │ │ │ ├── sw_poly1305-donna-32.h │ │ │ │ │ ├── sw_poly1305-donna.c │ │ │ │ │ ├── sw_poly1305-donna.h │ │ │ │ │ ├── sys_ctrl.c │ │ │ │ │ ├── sys_ctrl.h │ │ │ │ │ ├── systick.c │ │ │ │ │ ├── systick.h │ │ │ │ │ ├── systick_doc.h │ │ │ │ │ ├── timer.c │ │ │ │ │ ├── timer.h │ │ │ │ │ ├── timer_doc.h │ │ │ │ │ ├── trng.c │ │ │ │ │ ├── trng.h │ │ │ │ │ ├── uart.c │ │ │ │ │ ├── uart.h │ │ │ │ │ ├── uart_doc.h │ │ │ │ │ ├── udma.c │ │ │ │ │ ├── udma.h │ │ │ │ │ ├── vims.c │ │ │ │ │ ├── vims.h │ │ │ │ │ ├── watchdog.c │ │ │ │ │ ├── watchdog.h │ │ │ │ │ └── watchdog_doc.h │ │ │ │ ├── inc │ │ │ │ │ ├── asmdefs.h │ │ │ │ │ ├── hw_adi.h │ │ │ │ │ ├── hw_adi_2_refsys.h │ │ │ │ │ ├── hw_adi_3_refsys.h │ │ │ │ │ ├── hw_adi_4_aux.h │ │ │ │ │ ├── hw_aon_batmon.h │ │ │ │ │ ├── hw_aon_event.h │ │ │ │ │ ├── hw_aon_ioc.h │ │ │ │ │ ├── hw_aon_pmctl.h │ │ │ │ │ ├── hw_aon_rtc.h │ │ │ │ │ ├── hw_aux_aiodio.h │ │ │ │ │ ├── hw_aux_anaif.h │ │ │ │ │ ├── hw_aux_evctl.h │ │ │ │ │ ├── hw_aux_mac.h │ │ │ │ │ ├── hw_aux_ram.h │ │ │ │ │ ├── hw_aux_sce.h │ │ │ │ │ ├── hw_aux_smph.h │ │ │ │ │ ├── hw_aux_spim.h │ │ │ │ │ ├── hw_aux_sysif.h │ │ │ │ │ ├── hw_aux_tdc.h │ │ │ │ │ ├── hw_aux_timer01.h │ │ │ │ │ ├── hw_aux_timer2.h │ │ │ │ │ ├── hw_ccfg.h │ │ │ │ │ ├── hw_ccfg_simple_struct.h │ │ │ │ │ ├── hw_chip_def.h │ │ │ │ │ ├── hw_cpu_dwt.h │ │ │ │ │ ├── hw_cpu_fpb.h │ │ │ │ │ ├── hw_cpu_itm.h │ │ │ │ │ ├── hw_cpu_rom_table.h │ │ │ │ │ ├── hw_cpu_scs.h │ │ │ │ │ ├── hw_cpu_tiprop.h │ │ │ │ │ ├── hw_cpu_tpiu.h │ │ │ │ │ ├── hw_crypto.h │ │ │ │ │ ├── hw_ddi.h │ │ │ │ │ ├── hw_ddi_0_osc.h │ │ │ │ │ ├── hw_event.h │ │ │ │ │ ├── hw_fcfg1.h │ │ │ │ │ ├── hw_flash.h │ │ │ │ │ ├── hw_gpio.h │ │ │ │ │ ├── hw_gpram.h │ │ │ │ │ ├── hw_gpt.h │ │ │ │ │ ├── hw_i2c.h │ │ │ │ │ ├── hw_i2s.h │ │ │ │ │ ├── hw_ints.h │ │ │ │ │ ├── hw_ioc.h │ │ │ │ │ ├── hw_memmap.h │ │ │ │ │ ├── hw_nvic.h │ │ │ │ │ ├── hw_pka.h │ │ │ │ │ ├── hw_pka_int.h │ │ │ │ │ ├── hw_pka_ram.h │ │ │ │ │ ├── hw_prcm.h │ │ │ │ │ ├── hw_rfc_dbell.h │ │ │ │ │ ├── hw_rfc_pwr.h │ │ │ │ │ ├── hw_rfc_rat.h │ │ │ │ │ ├── hw_rfc_ullram.h │ │ │ │ │ ├── hw_smph.h │ │ │ │ │ ├── hw_sram_mmr.h │ │ │ │ │ ├── hw_ssi.h │ │ │ │ │ ├── hw_sysctl.h │ │ │ │ │ ├── hw_trng.h │ │ │ │ │ ├── hw_types.h │ │ │ │ │ ├── hw_uart.h │ │ │ │ │ ├── hw_udma.h │ │ │ │ │ ├── hw_vims.h │ │ │ │ │ └── hw_wdt.h │ │ │ │ ├── rf_patches │ │ │ │ │ ├── rf_patch_cpe_bt5.h │ │ │ │ │ ├── rf_patch_cpe_ieee_802_15_4.h │ │ │ │ │ ├── rf_patch_cpe_multi_protocol.h │ │ │ │ │ ├── rf_patch_cpe_multi_protocol_rtls.h │ │ │ │ │ ├── rf_patch_cpe_prop.h │ │ │ │ │ ├── rf_patch_mce_iqdump.h │ │ │ │ │ ├── rf_patch_mce_tof.h │ │ │ │ │ └── rf_patch_rfe_tof.h │ │ │ │ ├── rom │ │ │ │ │ ├── driverlib.c │ │ │ │ │ ├── driverlib.elf │ │ │ │ │ └── readme.txt │ │ │ │ └── startup_files │ │ │ │ │ └── ccfg.c │ │ │ └── cc26x0 │ │ │ │ ├── driverlib │ │ │ │ ├── adi.c │ │ │ │ ├── adi.h │ │ │ │ ├── adi_doc.h │ │ │ │ ├── aes.c │ │ │ │ ├── aes.h │ │ │ │ ├── aon_batmon.c │ │ │ │ ├── aon_batmon.h │ │ │ │ ├── aon_event.c │ │ │ │ ├── aon_event.h │ │ │ │ ├── aon_event_doc.h │ │ │ │ ├── aon_ioc.c │ │ │ │ ├── aon_ioc.h │ │ │ │ ├── aon_ioc_doc.h │ │ │ │ ├── aon_rtc.c │ │ │ │ ├── aon_rtc.h │ │ │ │ ├── aon_rtc_doc.h │ │ │ │ ├── aon_wuc.c │ │ │ │ ├── aon_wuc.h │ │ │ │ ├── aux_adc.c │ │ │ │ ├── aux_adc.h │ │ │ │ ├── aux_smph.c │ │ │ │ ├── aux_smph.h │ │ │ │ ├── aux_tdc.c │ │ │ │ ├── aux_tdc.h │ │ │ │ ├── aux_timer.c │ │ │ │ ├── aux_timer.h │ │ │ │ ├── aux_wuc.c │ │ │ │ ├── aux_wuc.h │ │ │ │ ├── bin │ │ │ │ │ ├── gcc │ │ │ │ │ │ └── driverlib.lib │ │ │ │ │ └── iar │ │ │ │ │ │ └── driverlib.lib │ │ │ │ ├── ccfgread.c │ │ │ │ ├── ccfgread.h │ │ │ │ ├── ccfgread_doc.h │ │ │ │ ├── chipinfo.c │ │ │ │ ├── chipinfo.h │ │ │ │ ├── cpu.c │ │ │ │ ├── cpu.h │ │ │ │ ├── cpu_doc.h │ │ │ │ ├── crypto.c │ │ │ │ ├── crypto.h │ │ │ │ ├── ddi.c │ │ │ │ ├── ddi.h │ │ │ │ ├── ddi_doc.h │ │ │ │ ├── debug.c │ │ │ │ ├── debug.h │ │ │ │ ├── driverlib_release.c │ │ │ │ ├── driverlib_release.h │ │ │ │ ├── event.c │ │ │ │ ├── event.h │ │ │ │ ├── event_doc.h │ │ │ │ ├── flash.c │ │ │ │ ├── flash.h │ │ │ │ ├── gpio.c │ │ │ │ ├── gpio.h │ │ │ │ ├── gpio_doc.h │ │ │ │ ├── group_analog_doc.h │ │ │ │ ├── group_aon_doc.h │ │ │ │ ├── group_aux_doc.h │ │ │ │ ├── i2c.c │ │ │ │ ├── i2c.h │ │ │ │ ├── i2c_doc.h │ │ │ │ ├── i2s.c │ │ │ │ ├── i2s.h │ │ │ │ ├── i2s_doc.h │ │ │ │ ├── interrupt.c │ │ │ │ ├── interrupt.h │ │ │ │ ├── interrupt_doc.h │ │ │ │ ├── ioc.c │ │ │ │ ├── ioc.h │ │ │ │ ├── ioc_doc.h │ │ │ │ ├── osc.c │ │ │ │ ├── osc.h │ │ │ │ ├── prcm.c │ │ │ │ ├── prcm.h │ │ │ │ ├── pwr_ctrl.c │ │ │ │ ├── pwr_ctrl.h │ │ │ │ ├── rf_ble_cmd.h │ │ │ │ ├── rf_ble_mailbox.h │ │ │ │ ├── rf_common_cmd.h │ │ │ │ ├── rf_data_entry.h │ │ │ │ ├── rf_ieee_cmd.h │ │ │ │ ├── rf_ieee_mailbox.h │ │ │ │ ├── rf_mailbox.h │ │ │ │ ├── rf_prop_cmd.h │ │ │ │ ├── rf_prop_mailbox.h │ │ │ │ ├── rfc.c │ │ │ │ ├── rfc.h │ │ │ │ ├── rom.h │ │ │ │ ├── rom_crypto.c │ │ │ │ ├── rom_crypto.h │ │ │ │ ├── setup.c │ │ │ │ ├── setup.h │ │ │ │ ├── setup_doc.h │ │ │ │ ├── setup_rom.c │ │ │ │ ├── setup_rom.h │ │ │ │ ├── setup_rom_doc.h │ │ │ │ ├── smph.c │ │ │ │ ├── smph.h │ │ │ │ ├── smph_doc.h │ │ │ │ ├── ssi.c │ │ │ │ ├── ssi.h │ │ │ │ ├── sw_chacha.c │ │ │ │ ├── sw_ecrypt-config.h │ │ │ │ ├── sw_ecrypt-machine.h │ │ │ │ ├── sw_ecrypt-portable.h │ │ │ │ ├── sw_ecrypt-sync.h │ │ │ │ ├── sw_poly1305-donna-32.h │ │ │ │ ├── sw_poly1305-donna.c │ │ │ │ ├── sw_poly1305-donna.h │ │ │ │ ├── sys_ctrl.c │ │ │ │ ├── sys_ctrl.h │ │ │ │ ├── systick.c │ │ │ │ ├── systick.h │ │ │ │ ├── systick_doc.h │ │ │ │ ├── timer.c │ │ │ │ ├── timer.h │ │ │ │ ├── timer_doc.h │ │ │ │ ├── trng.c │ │ │ │ ├── trng.h │ │ │ │ ├── uart.c │ │ │ │ ├── uart.h │ │ │ │ ├── uart_doc.h │ │ │ │ ├── udma.c │ │ │ │ ├── udma.h │ │ │ │ ├── vims.c │ │ │ │ ├── vims.h │ │ │ │ ├── watchdog.c │ │ │ │ ├── watchdog.h │ │ │ │ └── watchdog_doc.h │ │ │ │ ├── inc │ │ │ │ ├── asmdefs.h │ │ │ │ ├── hw_adi.h │ │ │ │ ├── hw_adi_2_refsys.h │ │ │ │ ├── hw_adi_3_refsys.h │ │ │ │ ├── hw_adi_4_aux.h │ │ │ │ ├── hw_aon_batmon.h │ │ │ │ ├── hw_aon_event.h │ │ │ │ ├── hw_aon_ioc.h │ │ │ │ ├── hw_aon_rtc.h │ │ │ │ ├── hw_aon_sysctl.h │ │ │ │ ├── hw_aon_wuc.h │ │ │ │ ├── hw_aux_aiodio.h │ │ │ │ ├── hw_aux_anaif.h │ │ │ │ ├── hw_aux_evctl.h │ │ │ │ ├── hw_aux_sce.h │ │ │ │ ├── hw_aux_smph.h │ │ │ │ ├── hw_aux_tdc.h │ │ │ │ ├── hw_aux_timer.h │ │ │ │ ├── hw_aux_wuc.h │ │ │ │ ├── hw_ccfg.h │ │ │ │ ├── hw_ccfg_simple_struct.h │ │ │ │ ├── hw_chip_def.h │ │ │ │ ├── hw_cpu_dwt.h │ │ │ │ ├── hw_cpu_fpb.h │ │ │ │ ├── hw_cpu_itm.h │ │ │ │ ├── hw_cpu_rom_table.h │ │ │ │ ├── hw_cpu_scs.h │ │ │ │ ├── hw_cpu_tiprop.h │ │ │ │ ├── hw_cpu_tpiu.h │ │ │ │ ├── hw_crypto.h │ │ │ │ ├── hw_ddi.h │ │ │ │ ├── hw_ddi_0_osc.h │ │ │ │ ├── hw_device.h │ │ │ │ ├── hw_event.h │ │ │ │ ├── hw_fcfg1.h │ │ │ │ ├── hw_flash.h │ │ │ │ ├── hw_gpio.h │ │ │ │ ├── hw_gpt.h │ │ │ │ ├── hw_i2c.h │ │ │ │ ├── hw_i2s.h │ │ │ │ ├── hw_ints.h │ │ │ │ ├── hw_ioc.h │ │ │ │ ├── hw_memmap.h │ │ │ │ ├── hw_nvic.h │ │ │ │ ├── hw_prcm.h │ │ │ │ ├── hw_rfc_dbell.h │ │ │ │ ├── hw_rfc_pwr.h │ │ │ │ ├── hw_rfc_rat.h │ │ │ │ ├── hw_smph.h │ │ │ │ ├── hw_ssi.h │ │ │ │ ├── hw_sysctl.h │ │ │ │ ├── hw_trng.h │ │ │ │ ├── hw_types.h │ │ │ │ ├── hw_uart.h │ │ │ │ ├── hw_udma.h │ │ │ │ ├── hw_vims.h │ │ │ │ └── hw_wdt.h │ │ │ │ ├── rf_patches │ │ │ │ ├── rf_patch_cpe_ble.h │ │ │ │ ├── rf_patch_cpe_ble_priv_1_2.h │ │ │ │ ├── rf_patch_cpe_genfsk.h │ │ │ │ ├── rf_patch_cpe_ieee.h │ │ │ │ ├── rf_patch_mce_genfsk.h │ │ │ │ ├── rf_patch_mce_ieee_s.h │ │ │ │ ├── rf_patch_rfe_ble.h │ │ │ │ ├── rf_patch_rfe_genfsk.h │ │ │ │ ├── rf_patch_rfe_ieee.h │ │ │ │ └── rf_patch_rfe_ieee_s.h │ │ │ │ ├── rom │ │ │ │ ├── driverlib.c │ │ │ │ ├── driverlib.elf │ │ │ │ └── readme.txt │ │ │ │ └── startup_files │ │ │ │ └── ccfg.c │ │ │ ├── drivers │ │ │ ├── ADC.c │ │ │ ├── ADC.h │ │ │ ├── ADCBuf.c │ │ │ ├── ADCBuf.h │ │ │ ├── AESCBC.c │ │ │ ├── AESCBC.h │ │ │ ├── AESCCM.c │ │ │ ├── AESCCM.h │ │ │ ├── AESCTR.c │ │ │ ├── AESCTR.h │ │ │ ├── AESCTRDRBG.c │ │ │ ├── AESCTRDRBG.h │ │ │ ├── AESECB.c │ │ │ ├── AESECB.h │ │ │ ├── AESGCM.c │ │ │ ├── AESGCM.h │ │ │ ├── Board.h │ │ │ ├── ECDH.c │ │ │ ├── ECDH.h │ │ │ ├── ECDSA.c │ │ │ ├── ECDSA.h │ │ │ ├── ECJPAKE.c │ │ │ ├── ECJPAKE.h │ │ │ ├── GPIO.h │ │ │ ├── I2C.c │ │ │ ├── I2C.h │ │ │ ├── I2S.c │ │ │ ├── I2S.h │ │ │ ├── NVS.c │ │ │ ├── NVS.h │ │ │ ├── PIN.h │ │ │ ├── PWM.c │ │ │ ├── PWM.h │ │ │ ├── Power.h │ │ │ ├── SD.c │ │ │ ├── SD.h │ │ │ ├── SDFatFS.c │ │ │ ├── SDFatFS.h │ │ │ ├── SHA2.c │ │ │ ├── SHA2.h │ │ │ ├── SPI.c │ │ │ ├── SPI.h │ │ │ ├── TRNG.c │ │ │ ├── TRNG.h │ │ │ ├── UART.c │ │ │ ├── UART.h │ │ │ ├── Watchdog.c │ │ │ ├── Watchdog.h │ │ │ ├── adc │ │ │ │ ├── ADCCC26XX.c │ │ │ │ └── ADCCC26XX.h │ │ │ ├── adcbuf │ │ │ │ ├── ADCBufCC26X2.c │ │ │ │ ├── ADCBufCC26X2.h │ │ │ │ ├── ADCBufCC26XX.c │ │ │ │ └── ADCBufCC26XX.h │ │ │ ├── aescbc │ │ │ │ ├── AESCBCCC26XX.c │ │ │ │ └── AESCBCCC26XX.h │ │ │ ├── aesccm │ │ │ │ ├── AESCCMCC26XX.c │ │ │ │ └── AESCCMCC26XX.h │ │ │ ├── aesctr │ │ │ │ ├── AESCTRCC26XX.c │ │ │ │ └── AESCTRCC26XX.h │ │ │ ├── aesctrdrbg │ │ │ │ ├── AESCTRDRBGXX.c │ │ │ │ └── AESCTRDRBGXX.h │ │ │ ├── aesecb │ │ │ │ ├── AESECBCC26XX.c │ │ │ │ └── AESECBCC26XX.h │ │ │ ├── aesgcm │ │ │ │ ├── AESGCMCC26XX.c │ │ │ │ └── AESGCMCC26XX.h │ │ │ ├── crypto │ │ │ │ ├── CryptoCC26XX.c │ │ │ │ └── CryptoCC26XX.h │ │ │ ├── cryptoutils │ │ │ │ ├── cryptokey │ │ │ │ │ ├── CryptoKey.h │ │ │ │ │ ├── CryptoKeyPlaintext.h │ │ │ │ │ └── CryptoKeyPlaintextCC26XX.c │ │ │ │ ├── ecc │ │ │ │ │ ├── ECCParams.h │ │ │ │ │ └── ECCParamsCC26X2.c │ │ │ │ └── sharedresources │ │ │ │ │ ├── CryptoResourceCC26XX.c │ │ │ │ │ ├── CryptoResourceCC26XX.h │ │ │ │ │ ├── PKAResourceCC26XX.c │ │ │ │ │ └── PKAResourceCC26XX.h │ │ │ ├── dma │ │ │ │ ├── UDMACC26XX.c │ │ │ │ └── UDMACC26XX.h │ │ │ ├── dpl │ │ │ │ ├── ClockP.h │ │ │ │ ├── DebugP.h │ │ │ │ ├── HwiP.h │ │ │ │ ├── MutexP.h │ │ │ │ ├── SemaphoreP.h │ │ │ │ ├── SwiP.h │ │ │ │ └── SystemP.h │ │ │ ├── ecdh │ │ │ │ ├── ECDHCC26X2.c │ │ │ │ └── ECDHCC26X2.h │ │ │ ├── ecdsa │ │ │ │ ├── ECDSACC26X2.c │ │ │ │ └── ECDSACC26X2.h │ │ │ ├── ecjpake │ │ │ │ ├── ECJPAKECC26X2.c │ │ │ │ └── ECJPAKECC26X2.h │ │ │ ├── gpio │ │ │ │ ├── GPIOCC26XX.c │ │ │ │ └── GPIOCC26XX.h │ │ │ ├── i2c │ │ │ │ ├── I2CCC26XX.c │ │ │ │ └── I2CCC26XX.h │ │ │ ├── i2s │ │ │ │ ├── I2SCC26XX.c │ │ │ │ └── I2SCC26XX.h │ │ │ ├── lib │ │ │ │ ├── drivers_cc13x0.am3g │ │ │ │ ├── drivers_cc13x0.arm3 │ │ │ │ ├── drivers_cc13x2.am4fg │ │ │ │ ├── drivers_cc13x2.arm4f │ │ │ │ ├── drivers_cc26x0.am3g │ │ │ │ ├── drivers_cc26x0.arm3 │ │ │ │ ├── drivers_cc26x2.am4fg │ │ │ │ └── drivers_cc26x2.arm4f │ │ │ ├── nvs │ │ │ │ ├── NVSCC26XX.c │ │ │ │ ├── NVSCC26XX.h │ │ │ │ ├── NVSRAM.c │ │ │ │ ├── NVSRAM.h │ │ │ │ ├── NVSSPI25X.c │ │ │ │ └── NVSSPI25X.h │ │ │ ├── pin │ │ │ │ ├── PINCC26XX.c │ │ │ │ └── PINCC26XX.h │ │ │ ├── power │ │ │ │ ├── PowerCC26X2.c │ │ │ │ ├── PowerCC26X2.h │ │ │ │ ├── PowerCC26X2_calibrateRCOSC.c │ │ │ │ ├── PowerCC26XX.c │ │ │ │ ├── PowerCC26XX.h │ │ │ │ └── PowerCC26XX_calibrateRCOSC.c │ │ │ ├── pwm │ │ │ │ ├── PWMTimerCC26XX.c │ │ │ │ └── PWMTimerCC26XX.h │ │ │ ├── rf │ │ │ │ ├── RF.h │ │ │ │ ├── RFCC26X2_multiMode.c │ │ │ │ ├── RFCC26XX_multiMode.c │ │ │ │ ├── RFCC26XX_singleMode.c │ │ │ │ └── lib │ │ │ │ │ ├── rf_multiMode_cc13x0.am3g │ │ │ │ │ ├── rf_multiMode_cc13x0.arm3 │ │ │ │ │ ├── rf_multiMode_cc13x2.am4fg │ │ │ │ │ ├── rf_multiMode_cc13x2.arm4f │ │ │ │ │ ├── rf_multiMode_cc26x0.am3g │ │ │ │ │ ├── rf_multiMode_cc26x0.arm3 │ │ │ │ │ ├── rf_multiMode_cc26x2.am4fg │ │ │ │ │ ├── rf_multiMode_cc26x2.arm4f │ │ │ │ │ ├── rf_singleMode_cc13x0.am3g │ │ │ │ │ ├── rf_singleMode_cc13x0.arm3 │ │ │ │ │ ├── rf_singleMode_cc26x0.am3g │ │ │ │ │ └── rf_singleMode_cc26x0.arm3 │ │ │ ├── sd │ │ │ │ ├── SDSPI.c │ │ │ │ └── SDSPI.h │ │ │ ├── sha2 │ │ │ │ ├── SHA2CC26X2.c │ │ │ │ └── SHA2CC26X2.h │ │ │ ├── spi │ │ │ │ ├── SPICC26X2DMA.c │ │ │ │ ├── SPICC26X2DMA.h │ │ │ │ ├── SPICC26XXDMA.c │ │ │ │ └── SPICC26XXDMA.h │ │ │ ├── timer │ │ │ │ ├── GPTimerCC26XX.c │ │ │ │ └── GPTimerCC26XX.h │ │ │ ├── trng │ │ │ │ ├── TRNGCC26XX.c │ │ │ │ └── TRNGCC26XX.h │ │ │ ├── uart │ │ │ │ ├── UARTCC26X0.c │ │ │ │ ├── UARTCC26X0.h │ │ │ │ ├── UARTCC26X2.c │ │ │ │ ├── UARTCC26X2.h │ │ │ │ ├── UARTCC26XX.c │ │ │ │ └── UARTCC26XX.h │ │ │ ├── utils │ │ │ │ ├── List.c │ │ │ │ ├── List.h │ │ │ │ ├── Random.c │ │ │ │ ├── Random.h │ │ │ │ ├── RingBuf.c │ │ │ │ └── RingBuf.h │ │ │ └── watchdog │ │ │ │ ├── WatchdogCC26XX.c │ │ │ │ └── WatchdogCC26XX.h │ │ │ └── posix │ │ │ ├── gcc │ │ │ ├── errno.h │ │ │ ├── mqueue.h │ │ │ ├── pthread.h │ │ │ ├── sched.h │ │ │ ├── semaphore.h │ │ │ ├── signal.h │ │ │ ├── sys │ │ │ │ ├── _internal.h │ │ │ │ └── types.h │ │ │ ├── time.h │ │ │ └── unistd.h │ │ │ └── iar │ │ │ ├── errno.h │ │ │ ├── mqueue.h │ │ │ ├── pthread.h │ │ │ ├── sched.h │ │ │ ├── semaphore.h │ │ │ ├── signal.h │ │ │ ├── sys │ │ │ ├── _internal.h │ │ │ ├── time.h │ │ │ └── types.h │ │ │ ├── time.h │ │ │ └── unistd.h │ ├── knx_wrapper.cpp │ ├── knx_wrapper.h │ ├── main_nortos.c │ ├── smartrf_settings │ │ ├── smartrf_settings.c │ │ └── smartrf_settings.h │ ├── startup_cc13xx_cc26xx_gcc.c │ └── vscode │ │ └── launch.json.example ├── knx-demo-coupler │ ├── knx-demo-coupler.ino │ ├── platformio-ci.ini │ └── platformio.ini ├── knx-demo-diy │ ├── .gitignore │ ├── knx-demo-diy-tp.knxprod │ ├── knx-demo-diy-tp.xml │ ├── knx-demo-diy.ino │ ├── platformio-ci.ini │ └── platformio.ini ├── knx-demo-smal-go │ ├── knx-demo.ino │ └── platformio.ini ├── knx-demo │ ├── knx-demo-ip.knxprod │ ├── knx-demo-ip.xml │ ├── knx-demo-rf.knxprod │ ├── knx-demo-rf.xml │ ├── knx-demo-tp.knxprod │ ├── knx-demo-tp.xml │ ├── knx-demo.ino │ ├── platformio-ci.ini │ └── platformio.ini ├── knx-h8i8o │ ├── knx-h8i8o.ino │ ├── knx-h8i8o.knxprod │ ├── knx-h8i8o.xml │ └── platformio.ini ├── knx-hdc1008 │ ├── hdc1008.xml │ └── knx-hdc1008.ino ├── knx-linux-coupler │ ├── CMakeLists.txt │ ├── fdsk.cpp │ ├── fdsk.h │ └── main.cpp ├── knx-linux │ ├── .vscode │ │ └── c_cpp_properties.json │ ├── CMakeLists.txt │ ├── fdsk.cpp │ ├── fdsk.h │ └── main.cpp ├── knx-pzem004 │ ├── knx-pzem0004t.xml │ ├── knx-pzem004t.knxprod │ └── pzem-004t-v30.ino ├── knx-sonoffS20 │ ├── knx-sonoffS20.ino │ ├── knx-sonoffS20.knxprod │ └── knx-sonoffS20.xml ├── knx-usb │ ├── .gitignore │ ├── .vscode │ │ └── extensions.json │ ├── custom_hwids.py │ ├── platformio-ci.ini │ ├── platformio.ini │ └── src │ │ └── main.cpp ├── knxPython │ ├── CMakeLists.txt │ ├── Manifest.in │ ├── VERSION │ ├── knxmodule.cpp │ ├── pybind11 │ │ ├── .appveyor.yml │ │ ├── .clang-tidy │ │ ├── .cmake-format.yaml │ │ ├── .github │ │ │ ├── CONTRIBUTING.md │ │ │ ├── ISSUE_TEMPLATE │ │ │ │ ├── bug-report.md │ │ │ │ ├── config.yml │ │ │ │ ├── feature-request.md │ │ │ │ └── question.md │ │ │ ├── dependabot.yml │ │ │ ├── labeler.yml │ │ │ ├── labeler_merged.yml │ │ │ ├── pull_request_template.md │ │ │ └── workflows │ │ │ │ ├── ci.yml │ │ │ │ ├── configure.yml │ │ │ │ ├── format.yml │ │ │ │ ├── labeler.yml │ │ │ │ └── pip.yml │ │ ├── .gitignore │ │ ├── .pre-commit-config.yaml │ │ ├── CMakeLists.txt │ │ ├── LICENSE │ │ ├── MANIFEST.in │ │ ├── README.rst │ │ ├── docs │ │ │ ├── Doxyfile │ │ │ ├── Makefile │ │ │ ├── advanced │ │ │ │ ├── cast │ │ │ │ │ ├── chrono.rst │ │ │ │ │ ├── custom.rst │ │ │ │ │ ├── eigen.rst │ │ │ │ │ ├── index.rst │ │ │ │ │ ├── overview.rst │ │ │ │ │ └── stl.rst │ │ │ │ ├── classes.rst │ │ │ │ ├── embedding.rst │ │ │ │ ├── exceptions.rst │ │ │ │ ├── functions.rst │ │ │ │ ├── misc.rst │ │ │ │ └── pycpp │ │ │ │ │ ├── numpy.rst │ │ │ │ │ ├── object.rst │ │ │ │ │ └── utilities.rst │ │ │ ├── basics.rst │ │ │ ├── benchmark.py │ │ │ ├── benchmark.rst │ │ │ ├── changelog.rst │ │ │ ├── classes.rst │ │ │ ├── cmake │ │ │ │ └── index.rst │ │ │ ├── compiling.rst │ │ │ ├── conf.py │ │ │ ├── faq.rst │ │ │ ├── index.rst │ │ │ ├── installing.rst │ │ │ ├── limitations.rst │ │ │ ├── reference.rst │ │ │ ├── release.rst │ │ │ ├── requirements.txt │ │ │ └── upgrade.rst │ │ ├── include │ │ │ └── pybind11 │ │ │ │ ├── attr.h │ │ │ │ ├── buffer_info.h │ │ │ │ ├── cast.h │ │ │ │ ├── chrono.h │ │ │ │ ├── complex.h │ │ │ │ ├── detail │ │ │ │ ├── class.h │ │ │ │ ├── common.h │ │ │ │ ├── descr.h │ │ │ │ ├── init.h │ │ │ │ ├── internals.h │ │ │ │ └── typeid.h │ │ │ │ ├── eigen.h │ │ │ │ ├── embed.h │ │ │ │ ├── eval.h │ │ │ │ ├── functional.h │ │ │ │ ├── iostream.h │ │ │ │ ├── numpy.h │ │ │ │ ├── operators.h │ │ │ │ ├── options.h │ │ │ │ ├── pybind11.h │ │ │ │ ├── pytypes.h │ │ │ │ ├── stl.h │ │ │ │ └── stl_bind.h │ │ ├── pybind11 │ │ │ ├── __init__.py │ │ │ ├── __main__.py │ │ │ ├── _version.py │ │ │ ├── _version.pyi │ │ │ ├── commands.py │ │ │ ├── py.typed │ │ │ ├── setup_helpers.py │ │ │ └── setup_helpers.pyi │ │ ├── pyproject.toml │ │ ├── setup.cfg │ │ ├── setup.py │ │ ├── tests │ │ │ ├── CMakeLists.txt │ │ │ ├── conftest.py │ │ │ ├── constructor_stats.h │ │ │ ├── cross_module_gil_utils.cpp │ │ │ ├── env.py │ │ │ ├── extra_python_package │ │ │ │ ├── pytest.ini │ │ │ │ └── test_files.py │ │ │ ├── extra_setuptools │ │ │ │ ├── pytest.ini │ │ │ │ └── test_setuphelper.py │ │ │ ├── local_bindings.h │ │ │ ├── pybind11_tests.cpp │ │ │ ├── pybind11_tests.h │ │ │ ├── pytest.ini │ │ │ ├── requirements.txt │ │ │ ├── test_async.cpp │ │ │ ├── test_async.py │ │ │ ├── test_buffers.cpp │ │ │ ├── test_buffers.py │ │ │ ├── test_builtin_casters.cpp │ │ │ ├── test_builtin_casters.py │ │ │ ├── test_call_policies.cpp │ │ │ ├── test_call_policies.py │ │ │ ├── test_callbacks.cpp │ │ │ ├── test_callbacks.py │ │ │ ├── test_chrono.cpp │ │ │ ├── test_chrono.py │ │ │ ├── test_class.cpp │ │ │ ├── test_class.py │ │ │ ├── test_cmake_build │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── embed.cpp │ │ │ │ ├── installed_embed │ │ │ │ │ └── CMakeLists.txt │ │ │ │ ├── installed_function │ │ │ │ │ └── CMakeLists.txt │ │ │ │ ├── installed_target │ │ │ │ │ └── CMakeLists.txt │ │ │ │ ├── subdirectory_embed │ │ │ │ │ └── CMakeLists.txt │ │ │ │ ├── subdirectory_function │ │ │ │ │ └── CMakeLists.txt │ │ │ │ ├── subdirectory_target │ │ │ │ │ └── CMakeLists.txt │ │ │ │ └── test.py │ │ │ ├── test_constants_and_functions.cpp │ │ │ ├── test_constants_and_functions.py │ │ │ ├── test_copy_move.cpp │ │ │ ├── test_copy_move.py │ │ │ ├── test_custom_type_casters.cpp │ │ │ ├── test_custom_type_casters.py │ │ │ ├── test_docstring_options.py │ │ │ ├── test_eigen.cpp │ │ │ ├── test_eigen.py │ │ │ ├── test_embed │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── test_interpreter.cpp │ │ │ │ └── test_interpreter.py │ │ │ ├── test_enum.cpp │ │ │ ├── test_enum.py │ │ │ ├── test_eval.cpp │ │ │ ├── test_eval.py │ │ │ ├── test_eval_call.py │ │ │ ├── test_exceptions.cpp │ │ │ ├── test_exceptions.py │ │ │ ├── test_factory_constructors.cpp │ │ │ ├── test_factory_constructors.py │ │ │ ├── test_gil_scoped.cpp │ │ │ ├── test_gil_scoped.py │ │ │ ├── test_iostream.cpp │ │ │ ├── test_iostream.py │ │ │ ├── test_kwargs_and_defaults.cpp │ │ │ ├── test_kwargs_and_defaults.py │ │ │ ├── test_local_bindings.cpp │ │ │ ├── test_local_bindings.py │ │ │ ├── test_methods_and_attributes.cpp │ │ │ ├── test_methods_and_attributes.py │ │ │ ├── test_modules.cpp │ │ │ ├── test_modules.py │ │ │ ├── test_multiple_inheritance.cpp │ │ │ ├── test_multiple_inheritance.py │ │ │ ├── test_numpy_array.cpp │ │ │ ├── test_numpy_array.py │ │ │ ├── test_numpy_dtypes.cpp │ │ │ ├── test_numpy_dtypes.py │ │ │ ├── test_numpy_vectorize.cpp │ │ │ ├── test_numpy_vectorize.py │ │ │ ├── test_opaque_types.cpp │ │ │ ├── test_opaque_types.py │ │ │ ├── test_operator_overloading.cpp │ │ │ ├── test_operator_overloading.py │ │ │ ├── test_pickling.py │ │ │ ├── test_pytypes.cpp │ │ │ ├── test_pytypes.py │ │ │ ├── test_sequences_and_iterators.cpp │ │ │ ├── test_sequences_and_iterators.py │ │ │ ├── test_smart_ptr.cpp │ │ │ ├── test_smart_ptr.py │ │ │ ├── test_stl.cpp │ │ │ ├── test_stl.py │ │ │ ├── test_stl_binders.cpp │ │ │ ├── test_stl_binders.py │ │ │ ├── test_tagbased_polymorphic.cpp │ │ │ ├── test_tagbased_polymorphic.py │ │ │ ├── test_union.cpp │ │ │ ├── test_union.py │ │ │ ├── test_virtual_functions.cpp │ │ │ └── test_virtual_functions.py │ │ └── tools │ │ │ ├── FindCatch.cmake │ │ │ ├── FindEigen3.cmake │ │ │ ├── FindPythonLibsNew.cmake │ │ │ ├── check-style.sh │ │ │ ├── cmake_uninstall.cmake.in │ │ │ ├── libsize.py │ │ │ ├── pybind11Common.cmake │ │ │ ├── pybind11Config.cmake.in │ │ │ ├── pybind11NewTools.cmake │ │ │ ├── pybind11Tools.cmake │ │ │ ├── pyproject.toml │ │ │ ├── setup_global.py.in │ │ │ └── setup_main.py.in │ ├── setup.py │ └── write_version_info.py └── scripts │ └── stm32rdu.py ├── library.json ├── library.properties ├── platformio.ini └── src ├── arduino_platform.cpp ├── arduino_platform.h ├── cc1310_platform.cpp ├── cc1310_platform.h ├── esp32_platform.cpp ├── esp32_platform.h ├── esp_platform.cpp ├── esp_platform.h ├── knx.h ├── knx ├── address_table_object.cpp ├── address_table_object.h ├── aes.c ├── aes.h ├── aes.hpp ├── apdu.cpp ├── apdu.h ├── application_layer.cpp ├── application_layer.h ├── application_program_object.cpp ├── application_program_object.h ├── association_table_object.cpp ├── association_table_object.h ├── bau.cpp ├── bau.h ├── bau07B0.cpp ├── bau07B0.h ├── bau091A.cpp ├── bau091A.h ├── bau27B0.cpp ├── bau27B0.h ├── bau2920.cpp ├── bau2920.h ├── bau57B0.cpp ├── bau57B0.h ├── bau_systemB.cpp ├── bau_systemB.h ├── bau_systemB_coupler.cpp ├── bau_systemB_coupler.h ├── bau_systemB_device.cpp ├── bau_systemB_device.h ├── bits.cpp ├── bits.h ├── callback_property.h ├── cemi_frame.cpp ├── cemi_frame.h ├── cemi_server.cpp ├── cemi_server.h ├── cemi_server_object.cpp ├── cemi_server_object.h ├── config.h ├── data_link_layer.cpp ├── data_link_layer.h ├── data_property.cpp ├── data_property.h ├── datapoint_types.cpp ├── datapoint_types.h ├── device_object.cpp ├── device_object.h ├── dpt.cpp ├── dpt.h ├── dptconvert.cpp ├── dptconvert.h ├── function_property.h ├── group_object.cpp ├── group_object.h ├── group_object_table_object.cpp ├── group_object_table_object.h ├── interface_object.cpp ├── interface_object.h ├── ip_data_link_layer.cpp ├── ip_data_link_layer.h ├── ip_host_protocol_address_information.cpp ├── ip_host_protocol_address_information.h ├── ip_parameter_object.cpp ├── ip_parameter_object.h ├── knx_ip_device_information_dib.cpp ├── knx_ip_device_information_dib.h ├── knx_ip_dib.cpp ├── knx_ip_dib.h ├── knx_ip_frame.cpp ├── knx_ip_frame.h ├── knx_ip_routing_indication.cpp ├── knx_ip_routing_indication.h ├── knx_ip_search_request.cpp ├── knx_ip_search_request.h ├── knx_ip_search_response.cpp ├── knx_ip_search_response.h ├── knx_ip_supported_service_dib.cpp ├── knx_ip_supported_service_dib.h ├── knx_types.h ├── knx_value.cpp ├── knx_value.h ├── memory.cpp ├── memory.h ├── network_layer.cpp ├── network_layer.h ├── network_layer_coupler.cpp ├── network_layer_coupler.h ├── network_layer_device.cpp ├── network_layer_device.h ├── network_layer_entity.cpp ├── network_layer_entity.h ├── npdu.cpp ├── npdu.h ├── platform.cpp ├── platform.h ├── property.cpp ├── property.h ├── rf_data_link_layer.cpp ├── rf_data_link_layer.h ├── rf_medium_object.cpp ├── rf_medium_object.h ├── rf_physical_layer.h ├── rf_physical_layer_cc1101.cpp ├── rf_physical_layer_cc1101.h ├── rf_physical_layer_cc1310.cpp ├── rf_physical_layer_cc1310.h ├── router_object.cpp ├── router_object.h ├── save_restore.h ├── secure_application_layer.cpp ├── secure_application_layer.h ├── security_interface_object.cpp ├── security_interface_object.h ├── simple_map.h ├── table_object.cpp ├── table_object.h ├── tp_frame.h ├── tpdu.cpp ├── tpdu.h ├── tpuart_data_link_layer.cpp ├── tpuart_data_link_layer.h ├── transport_layer.cpp ├── transport_layer.h ├── usb_tunnel_interface.cpp └── usb_tunnel_interface.h ├── knx_facade.cpp ├── knx_facade.h ├── linux_platform.cpp ├── linux_platform.h ├── rp2040_arduino_platform.cpp ├── rp2040_arduino_platform.h ├── samd_platform.cpp ├── samd_platform.h ├── stm32_platform.cpp └── stm32_platform.h /.clang-format: -------------------------------------------------------------------------------- 1 | #Generated from Visual Studio settings 2 | --- 3 | BasedOnStyle: llvm 4 | BraceWrapping: 5 | AfterClass: true 6 | AfterControlStatement: true 7 | AfterEnum: true 8 | AfterFunction: true 9 | AfterNamespace: true 10 | AfterStruct: true 11 | AfterUnion: true 12 | BeforeCatch: true 13 | BeforeElse: true 14 | SplitEmptyFunction: false 15 | IndentBraces: false 16 | BreakBeforeBraces: Custom 17 | ColumnLimit: 0 18 | IndentWidth: 4 19 | NamespaceIndentation: All 20 | TabWidth: 4 21 | DerivePointerAlignment: true 22 | IndentCaseLabels: true 23 | AllowShortFunctionsOnASingleLine: InlineOnly 24 | ConstructorInitializerIndentWidth: 4 25 | ContinuationIndentWidth: 4 26 | UseTab: Never 27 | ... 28 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.knxprod binary 2 | -------------------------------------------------------------------------------- /.github/workflows/cmake-native.yml: -------------------------------------------------------------------------------- 1 | name: CMake-native 2 | 3 | on: [push, pull_request] 4 | 5 | env: 6 | # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) 7 | BUILD_TYPE: Release 8 | 9 | jobs: 10 | build: 11 | # The CMake configure and build commands are platform agnostic and should work equally 12 | # well on Windows or Mac. You can convert this to a matrix build if you need 13 | # cross-platform coverage. 14 | # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix 15 | runs-on: ubuntu-latest 16 | 17 | steps: 18 | - uses: actions/checkout@v2 19 | 20 | - name: Create Build Environment 21 | # Some projects don't allow in-source building, so create a separate build directory 22 | # We'll use this as our working directory for all subsequent commands 23 | run: cmake -E make_directory ${{runner.workspace}}/build 24 | 25 | - name: Configure CMake 26 | # Use a bash shell so we can use the same syntax for environment variable 27 | # access regardless of the host operating system 28 | shell: bash 29 | working-directory: ${{runner.workspace}}/build 30 | # Note the current convention is to use the -S and -B options here to specify source 31 | # and build directories, but this is only available with CMake 3.13 and higher. 32 | # The CMake binaries on the Github Actions machines are (as of this writing) 3.12 33 | run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE 34 | 35 | - name: Build 36 | working-directory: ${{runner.workspace}}/build 37 | shell: bash 38 | # Execute the build. You can specify a specific target with "--target " 39 | run: cmake --build . --config $BUILD_TYPE 40 | 41 | # - name: Test 42 | # working-directory: ${{runner.workspace}}/build 43 | # shell: bash 44 | # Execute tests defined by the CMake configuration. 45 | # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail 46 | # run: ctest -C $BUILD_TYPE 47 | -------------------------------------------------------------------------------- /.github/workflows/platform-io.yml: -------------------------------------------------------------------------------- 1 | name: PlatformIO CI 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | build: 7 | 8 | runs-on: ubuntu-latest 9 | # strategy: 10 | # matrix: 11 | # example: [path/to/test/file.c, examples/file.ino, path/to/test/directory] 12 | 13 | steps: 14 | - uses: actions/checkout@v1 15 | - name: Set up Python 16 | uses: actions/setup-python@v1 17 | - name: Install dependencies 18 | run: | 19 | python -m pip install --upgrade pip 20 | pip install platformio 21 | - name: Build knx-usb 22 | run: platformio ci --lib="." --project-conf=examples/knx-usb/platformio-ci.ini examples/knx-usb/src/main.cpp 23 | - name: Build knx-demo 24 | run: platformio ci --lib="." --project-conf=examples/knx-demo/platformio-ci.ini examples/knx-demo/knx-demo.ino 25 | - name: Build knx-demo-coupler 26 | run: platformio ci --lib="." --project-conf=examples/knx-demo-coupler/platformio-ci.ini examples/knx-demo-coupler/knx-demo-coupler.ino 27 | # - name: Run PlatformIO 28 | # run: pio ci --board= --board= --board= 29 | # env: 30 | # PLATFORMIO_CI_SRC: ${{ matrix.example }} 31 | -------------------------------------------------------------------------------- /.readthedocs.yaml: -------------------------------------------------------------------------------- 1 | # Read the Docs configuration file for Sphinx projects 2 | # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details 3 | 4 | # Required 5 | version: 2 6 | 7 | # Set the OS, Python version and other tools you might need 8 | build: 9 | os: ubuntu-22.04 10 | tools: 11 | python: "3.11" 12 | # You can also specify other tool versions: 13 | # nodejs: "20" 14 | # rust: "1.70" 15 | # golang: "1.20" 16 | 17 | # Build documentation in the "docs/" directory with Sphinx 18 | sphinx: 19 | configuration: doc/conf.py 20 | # You can configure Sphinx to use a different builder, for instance use the dirhtml builder for simpler URLs 21 | # builder: "dirhtml" 22 | # Fail on all warnings to avoid broken references 23 | # fail_on_warning: true 24 | 25 | # Optionally build your docs in additional formats such as PDF and ePub 26 | # formats: 27 | # - pdf 28 | # - epub 29 | 30 | # Optional but recommended, declare the Python requirements required 31 | # to build your documentation 32 | # See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html 33 | python: 34 | install: 35 | - requirements: doc/requirements.txt 36 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(examples/knx-linux) 2 | add_subdirectory(examples/knx-linux-coupler) 3 | add_subdirectory(examples/knxPython) -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # knx 2 | 3 | This is a fork of the thelsing/knx stack from Thomas Kunze for and by the OpenKNX Team. 4 | 5 | While we did not remove support for any plattform, the testing focus is on RP2040 (main), ESP32 (experimental) and SAMD21(deprecated). 6 | 7 | This projects provides a knx-device stack for arduino (ESP8266, ESP32, SAMD21, RP2040, STM32), CC1310 and linux. (more are quite easy to add) 8 | It implements most of System-B specification and can be configured with ETS. 9 | The necessary knxprod-files can be generated with the [Kaenx-Creator](https://github.com/OpenKNX/Kaenx-Creator) tool. 10 | 11 | 12 | ## Usage 13 | See the examples for basic usage options 14 | 15 | 16 | ## Changelog 17 | 18 | ### V2.1.2 - 2024-12-09 19 | - adds unicast auto ack 20 | 21 | ### V2.1.1 - 2024-09-16 22 | - fix minor bug in TP-Uart Driver (RX queue out of boundary) 23 | 24 | ### V2.1.0 - 2024-07-03 25 | - complete rework of the TPUart DataLinkLayer with support interrupt-based handling and optimized queue handling 26 | - added DMA support for RP2040 platform 27 | - fix some issues with continous integration causing github actions to fail 28 | - added rp2040 plattform to knx-demo example 29 | - added bool GroupObject::valueCompare method for only sending the value when it has changed 30 | 31 | ### V2.0.0 - 2024-02-13 32 | - first OpenKNX version -------------------------------------------------------------------------------- /doc/CC1101-868mhz-radio-module-pinout.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/knx/764900e0c5251003eca22715991875ec88c45f64/doc/CC1101-868mhz-radio-module-pinout.jpg -------------------------------------------------------------------------------- /doc/example_list.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @example main.cpp 3 | * @example knx-demo.ino 4 | * @example knx-hdc1008.ino 5 | * @example knx-bme680.ino 6 | * 7 | **/ -------------------------------------------------------------------------------- /doc/index.rst: -------------------------------------------------------------------------------- 1 | .. knx documentation master file, created by 2 | sphinx-quickstart on Wed Jun 26 20:52:45 2019. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Welcome to knx's documentation! 7 | =============================== 8 | 9 | Contents: 10 | 11 | .. toctree:: 12 | :maxdepth: 2 13 | 14 | api/library_root 15 | 16 | 17 | `Doxgen documentation `_ is also available. 18 | 19 | 20 | Indices and tables 21 | ================== 22 | 23 | * :ref:`genindex` 24 | * :ref:`modindex` 25 | * :ref:`search` 26 | 27 | -------------------------------------------------------------------------------- /doc/knx_cemi_notes.md: -------------------------------------------------------------------------------- 1 | KNX cEMI Server 2 | =============== 3 | 4 | Implementation Notes 5 | -------------------- 6 | * currently only implemented for KNX USB Data Interface (Tunnel) and not KNXnet/IP for now 7 | 8 | * basically provides a complete KNX device (TP or RF) that also has a USB interface built-in which can be used to program either the local device stack or 9 | remote devices via the attached medium (TP or RF). 10 | * tested with ETS 5.7.x 11 | * tested with Net'N'Node 12 | * **Be careful when using this with TP as your HW setup might not have a galvanic isolation between the KNX bus and USB!** 13 | * An [USB isolator](https://www.olimex.com/Products/USB-Modules/USB-ISO/) might be the easiest option. Not tested! 14 | * ToDo: How is this realized in commercial KNX USB Data Interfaces? 15 | 16 | * cEMI client address (e.g. ETS) is based on KNX physical address of the local device stack +1 17 | * Example: local device: 1.2.10 -> cEMI client address: 1.2.11 18 | * PropertyWrite commands to change the cEMI client address are only temporary until next device restart 19 | 20 | * requires a USB stack which properly work with USB HID and provides interrupt IN/OUT endpoints for KNX HID reports. 21 | * normal Arduino USB device stack does NOT work as it is missing required functionality 22 | * TinyUSB stack is used instead, therefore the Adafruit SAMD core with TinyUSB enabled is used as the Arduino core 23 | 24 | Development environment 25 | ----------------------- 26 | * PlatformIO 27 | * Segger J-Link EDU 28 | * [GY-SAMD21 Board](https://eckstein-shop.de/GY-SAMD21-Mini-Breakout-fuer-Arduino), compatible to [Adafruit Feather M0](https://www.adafruit.com/product/2772) 29 | 30 | -------------------------------------------------------------------------------- /doc/knx_coupler_notes.md: -------------------------------------------------------------------------------- 1 | KNX Coupler 2 | =========== 3 | 4 | Implementation Notes 5 | -------------------- 6 | * Add support for coupler model 1.x and coupler model 2.0 (only used for TP1/RF coupler so far) 7 | * currently implemented mask versions: 091A (IP/TP1 coupler) and 2920 (TP1/RF coupler) 8 | 9 | ToDo: 10 | ----- 11 | * class NetworkLayerCoupler: add support for all ACK modes for medium TP1, currently ALL received frames are ACK'ed (mode 2). 12 | * handle MasterReset according to spec. for router object 13 | 14 | Development environment 15 | ----------------------- 16 | * see linux coupler example 17 | 18 | -------------------------------------------------------------------------------- /doc/knx_data_secure_notes.md: -------------------------------------------------------------------------------- 1 | KNX Data Secure 2 | =============== 3 | 4 | Implementation Notes 5 | -------------------- 6 | * Implementation based on application note AN158 v07 KNX Data Security 7 | * AES-128 is implemented in software, no hardware acceleration used currently 8 | * Secure device setup with ETS-5.7.x tested and working 9 | * Secure group communication needs more testing 10 | * Support for FDSK generation 11 | * Support for P2P mode prepared 12 | * No support for LTE-mode[T_Data_Tag_Group] (zone key table is already there) currently 13 | * No support roles (and no plan to implement this in the near future) 14 | 15 | ToDo: 16 | ----- 17 | * Add support for AN192 v04 Coupler security extensions (a.k.a. Secure Proxy which translates between unsecured and secured devices) 18 | * Handle S-A_Sync Service when initially the last valid sequence nummer is not known during runtime, i.e. group communication 19 | * handle MasterReset according to spec. for security interface object 20 | 21 | Development environment 22 | ----------------------- 23 | * see linux example on how to generate the FDSK string which needs to be entered in the ETS 24 | * use BAU57B0, but fake the mask by setting _deviceObj.maskVersion(0x07B0). This "emulates" a TP1 device which is reachable over an IP router 25 | * To generate a KNX ETS product database with support for KNX Data Secure, use the latest version of the CreateKnxProd tool which supports schema version 20. 26 | -------------------------------------------------------------------------------- /doc/references.bib: -------------------------------------------------------------------------------- 1 | @manual{knx:3/3/4, 2 | organization = "KNX Association", 3 | title = "KNX System Specifications Chapter 3/3/7 Application Layer", 4 | year = 2013, 5 | month = 11, 6 | note = "v01.02.02" 7 | } 8 | 9 | @manual{knx:3/3/7, 10 | organization = "KNX Association", 11 | title = "KNX System Specifications Chapter 3/3/7 Application Layer", 12 | year = 2013, 13 | month = 12, 14 | note = "v01.06.02" 15 | } 16 | 17 | @manual{knx:3/4/1, 18 | organization = "KNX Association", 19 | title = "KNX System Specifications Chapter 3/4/1 Application Interface Layer", 20 | year = 2013, 21 | month = 12, 22 | note = "v01.01.02" 23 | } 24 | 25 | @manual{knx:3/5/1, 26 | organization = "KNX Association", 27 | title = "KNX System Specifications Chapter 3/5/1 Resources", 28 | year = 2013, 29 | month = 12, 30 | note = "v01.09.03" 31 | } 32 | 33 | @manual{knx:3/7/3, 34 | organization = "KNX Association", 35 | title = "KNX System Specifications Chapter 3/7/3 Standardized Identifier Tables", 36 | year = 2013, 37 | month = 12, 38 | note = "v01.03.01" 39 | } 40 | -------------------------------------------------------------------------------- /doc/requirements.txt: -------------------------------------------------------------------------------- 1 | exhale 2 | breathe 3 | sphinx>=2.1.2 -------------------------------------------------------------------------------- /examples/knx-433Dio/README.md: -------------------------------------------------------------------------------- 1 | Control Chacon/DIO 433Mhz plug like that: (not an affiliated link just for info) 2 | https://www.amazon.fr/DiO-Connected-Home-t%C3%A9l%C3%A9command%C3%A9es-t%C3%A9l%C3%A9commande/dp/B005LKMAW0 3 | 4 | 5 | Hardware: 6 | - Samd21 (gy-samd21) 7 | - FS 1000A (cheap 433 transmitter) 8 | - TpUart KNX 9 | - logic level converter 10 | - Chacon/DIO 433Mhz plug (must work with every dumb 433mhz plug/remote that support the HomeEasy protocol) 11 | 12 | Software 13 | - change the rfPin variable, compile and tranfert into the samd21 (or any microcontroller) 14 | - (maybe) adapt THIGH and TLOW in rfCode class for your case. 15 | 16 | Before configuring ETS, you need to receive the 433mhz code for each button of your remote. 17 | Take an arduino UNO, plug the FS1000a receiver, look on github/google to receive the code rc-switch or https://charleslabs.fr/fr/project-Contr%C3%B4le+de+prises+DiO+avec+Arduino (in french), or https://caron.ws/diy-cartes-microcontroleurs/piloter-vos-prises-chacon-rf433mhz-arduino/ ( in french too) 18 | 19 | 20 | for me it's : 1806947472 and 1806947456 for the channel 1 on/off, etc... 21 | 22 | Now in ETS put the received 433Mhz code into parameters. 23 | -> Full Download in ETS and enjoy. 24 | 25 | 26 | 27 | Feature: 28 | This code is delay() free, blocking code free (ie: no long while or for loop), to call the knx.loop() as fast as possible. 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /examples/knx-433Dio/knx-433.knxprod: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/knx/764900e0c5251003eca22715991875ec88c45f64/examples/knx-433Dio/knx-433.knxprod -------------------------------------------------------------------------------- /examples/knx-bme680/bme680.knxprod: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/knx/764900e0c5251003eca22715991875ec88c45f64/examples/knx-bme680/bme680.knxprod -------------------------------------------------------------------------------- /examples/knx-cc1310/README.md: -------------------------------------------------------------------------------- 1 | Example for Texas Instruments LaunchPad LAUNCHXL-CC1310 2 | === 3 | 4 | Requirements: 5 | * Texas Instruments LaunchPad [LAUNCHXL-CC1310](https://www.ti.com/tool/LAUNCHXL-CC1310) 6 | * Optional: Segger J-Link 7 | 8 | Button0 (BTN-1, DIO13): Programming Mode on/off 9 | Button1 (BTN-2, DIO14): Press and hold while starting the board to erase the flash 10 | LED0 (RED, DIO6): Programming mode 11 | LED1 (GREEN, DIO7): If flashing with 500ms together with LED0 a fatal error occured and the system is halted 12 | 13 | 14 | -------------------------------------------------------------------------------- /examples/knx-cc1310/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | [ -d build ] || mkdir build 4 | 5 | cd build 6 | 7 | #create Makefile 8 | cmake -DCMAKE_BUILD_TYPE=Debug .. 9 | 10 | #Run make 11 | cmake --build . -j4 12 | -------------------------------------------------------------------------------- /examples/knx-cc1310/ccs/.ccsproject: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /examples/knx-cc1310/ccs/README.md: -------------------------------------------------------------------------------- 1 | The folder contains the project files for TI Code Composer 10. 2 | Just import this folder into your workspace. 3 | 4 | * tested with TI Code Composer Version: 10.1.1.00004 5 | * TI LaunchPadXL CC1310 with integrated XDS110 debug probe 6 | 7 | Additional installation of an SDK is not required as the CC1310 SDK is already included as GIT subtree within this repository. 8 | -------------------------------------------------------------------------------- /examples/knx-cc1310/cmake/binutils-arm-none-eabi.cmake: -------------------------------------------------------------------------------- 1 | ## 2 | ## Author: Johannes Bruder 3 | ## License: See LICENSE.TXT file included in the project 4 | ## 5 | ## CMake arm-none-eabi binutils integration and helper functions 6 | ## 7 | 8 | 9 | #--------------------------------------------------------------------------------------- 10 | # Set tools 11 | #--------------------------------------------------------------------------------------- 12 | set(CMAKE_OBJCOPY ${TOOLCHAIN_BIN_DIR}/${TOOLCHAIN}-objcopy${TOOLCHAIN_EXT}) 13 | set(CMAKE_OBJDUMP ${TOOLCHAIN_BIN_DIR}/${TOOLCHAIN}-objdump${TOOLCHAIN_EXT}) 14 | set(CMAKE_SIZE ${TOOLCHAIN_BIN_DIR}/${TOOLCHAIN}-size${TOOLCHAIN_EXT}) 15 | 16 | 17 | #--------------------------------------------------------------------------------------- 18 | # Prints the section sizes 19 | #--------------------------------------------------------------------------------------- 20 | function(print_section_sizes TARGET) 21 | add_custom_command(TARGET ${TARGET} POST_BUILD COMMAND ${CMAKE_SIZE} ${TARGET}) 22 | endfunction() 23 | 24 | #--------------------------------------------------------------------------------------- 25 | # Creates output in hex format 26 | #--------------------------------------------------------------------------------------- 27 | function(create_hex_output TARGET) 28 | add_custom_target(${TARGET}.hex ALL DEPENDS ${TARGET} COMMAND ${CMAKE_OBJCOPY} -Oihex ${TARGET} ${TARGET}.hex) 29 | endfunction() 30 | 31 | #--------------------------------------------------------------------------------------- 32 | # Creates output in binary format 33 | #--------------------------------------------------------------------------------------- 34 | function(create_bin_output TARGET) 35 | add_custom_target(${TARGET}.bin ALL DEPENDS ${TARGET} COMMAND ${CMAKE_OBJCOPY} -Obinary ${TARGET} ${TARGET}.bin) 36 | endfunction() 37 | -------------------------------------------------------------------------------- /examples/knx-cc1310/coresdk_cc13xx_cc26xx/LICENSE: -------------------------------------------------------------------------------- 1 | BSD-3-Clause 2 | ------------------ 3 | Copyright (c) 2018-2019, Texas Instruments Incorporated 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | 13 | Redistributions in binary form must reproduce the above copyright 14 | notice, this list of conditions and the following disclaimer in the 15 | documentation and/or other materials provided with the distribution. 16 | 17 | Neither the name of Texas Instruments Incorporated nor the names of 18 | its contributors may be used to endorse or promote products derived 19 | from this software without specific prior written permission. 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 23 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 24 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 25 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 26 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 27 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 28 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 29 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 30 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 31 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | -------------------------------------------------------------------------------- /examples/knx-cc1310/coresdk_cc13xx_cc26xx/kernel/nortos/dpl/posix_sleep.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Texas Instruments Incorporated 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * * Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 12 | * * Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * 16 | * * Neither the name of Texas Instruments Incorporated nor the names of 17 | * its contributors may be used to endorse or promote products derived 18 | * from this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 22 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 27 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 28 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 29 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 30 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | /* 33 | * ======== posix_sleep.c ======== 34 | */ 35 | 36 | #include 37 | 38 | /* 39 | * ======== sleep ======== 40 | */ 41 | void sleep(uint32_t sec) 42 | { 43 | ClockP_sleep(sec); 44 | } 45 | 46 | /* 47 | * ======== usleep ======== 48 | */ 49 | void usleep(uint32_t usec) 50 | { 51 | ClockP_usleep(usec); 52 | } 53 | -------------------------------------------------------------------------------- /examples/knx-cc1310/coresdk_cc13xx_cc26xx/kernel/nortos/lib/nortos_cc13x0.am3g: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/knx/764900e0c5251003eca22715991875ec88c45f64/examples/knx-cc1310/coresdk_cc13xx_cc26xx/kernel/nortos/lib/nortos_cc13x0.am3g -------------------------------------------------------------------------------- /examples/knx-cc1310/coresdk_cc13xx_cc26xx/kernel/nortos/lib/nortos_cc13x0.arm3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/knx/764900e0c5251003eca22715991875ec88c45f64/examples/knx-cc1310/coresdk_cc13xx_cc26xx/kernel/nortos/lib/nortos_cc13x0.arm3 -------------------------------------------------------------------------------- /examples/knx-cc1310/coresdk_cc13xx_cc26xx/kernel/nortos/lib/nortos_cc13x2.am4fg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/knx/764900e0c5251003eca22715991875ec88c45f64/examples/knx-cc1310/coresdk_cc13xx_cc26xx/kernel/nortos/lib/nortos_cc13x2.am4fg -------------------------------------------------------------------------------- /examples/knx-cc1310/coresdk_cc13xx_cc26xx/kernel/nortos/lib/nortos_cc13x2.arm4f: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/knx/764900e0c5251003eca22715991875ec88c45f64/examples/knx-cc1310/coresdk_cc13xx_cc26xx/kernel/nortos/lib/nortos_cc13x2.arm4f -------------------------------------------------------------------------------- /examples/knx-cc1310/coresdk_cc13xx_cc26xx/kernel/nortos/lib/nortos_cc26x0.am3g: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/knx/764900e0c5251003eca22715991875ec88c45f64/examples/knx-cc1310/coresdk_cc13xx_cc26xx/kernel/nortos/lib/nortos_cc26x0.am3g -------------------------------------------------------------------------------- /examples/knx-cc1310/coresdk_cc13xx_cc26xx/kernel/nortos/lib/nortos_cc26x0.arm3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/knx/764900e0c5251003eca22715991875ec88c45f64/examples/knx-cc1310/coresdk_cc13xx_cc26xx/kernel/nortos/lib/nortos_cc26x0.arm3 -------------------------------------------------------------------------------- /examples/knx-cc1310/coresdk_cc13xx_cc26xx/kernel/nortos/lib/nortos_cc26x2.am4fg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/knx/764900e0c5251003eca22715991875ec88c45f64/examples/knx-cc1310/coresdk_cc13xx_cc26xx/kernel/nortos/lib/nortos_cc26x2.am4fg -------------------------------------------------------------------------------- /examples/knx-cc1310/coresdk_cc13xx_cc26xx/kernel/nortos/lib/nortos_cc26x2.arm4f: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/knx/764900e0c5251003eca22715991875ec88c45f64/examples/knx-cc1310/coresdk_cc13xx_cc26xx/kernel/nortos/lib/nortos_cc26x2.arm4f -------------------------------------------------------------------------------- /examples/knx-cc1310/coresdk_cc13xx_cc26xx/kernel/nortos/posix/unistd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Texas Instruments Incorporated 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * * Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 12 | * * Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * 16 | * * Neither the name of Texas Instruments Incorporated nor the names of 17 | * its contributors may be used to endorse or promote products derived 18 | * from this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 22 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 27 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 28 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 29 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 30 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | /* 33 | * ======== unistd.h ======== 34 | */ 35 | 36 | #ifndef nortos_posix_unistd__include 37 | #define nortos_posix_unistd__include 38 | 39 | #ifdef __cplusplus 40 | extern "C" { 41 | #endif 42 | 43 | #include "sys/types.h" 44 | 45 | extern unsigned sleep(unsigned seconds); 46 | extern int usleep(useconds_t useconds); 47 | 48 | #ifdef __cplusplus 49 | } 50 | #endif 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/devices/cc13x0/driverlib/bin/gcc/driverlib.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/knx/764900e0c5251003eca22715991875ec88c45f64/examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/devices/cc13x0/driverlib/bin/gcc/driverlib.lib -------------------------------------------------------------------------------- /examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/devices/cc13x0/driverlib/bin/iar/driverlib.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/knx/764900e0c5251003eca22715991875ec88c45f64/examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/devices/cc13x0/driverlib/bin/iar/driverlib.lib -------------------------------------------------------------------------------- /examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/devices/cc13x0/driverlib/sw_ecrypt-machine.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Filename: sw_ecrypt-machine.h 3 | * Revised: 2016-10-05 12:42:03 +0200 (Wed, 05 Oct 2016) 4 | * Revision: 47308 5 | ******************************************************************************/ 6 | /* ecrypt-machine.h */ 7 | 8 | /* 9 | * This file is included by 'ecrypt-portable.h'. It allows to override 10 | * the default macros for specific platforms. Please carefully check 11 | * the machine code generated by your compiler (with optimisations 12 | * turned on) before deciding to edit this file. 13 | */ 14 | 15 | /* ------------------------------------------------------------------------- */ 16 | 17 | #if (defined(ECRYPT_DEFAULT_ROT) && !defined(ECRYPT_MACHINE_ROT)) 18 | 19 | #define ECRYPT_MACHINE_ROT 20 | 21 | #if (defined(WIN32) && defined(_MSC_VER)) 22 | 23 | #undef ROTL32 24 | #undef ROTR32 25 | #undef ROTL64 26 | #undef ROTR64 27 | 28 | #include 29 | 30 | #define ROTL32(v, n) _lrotl(v, n) 31 | #define ROTR32(v, n) _lrotr(v, n) 32 | #define ROTL64(v, n) _rotl64(v, n) 33 | #define ROTR64(v, n) _rotr64(v, n) 34 | 35 | #endif 36 | 37 | #endif 38 | 39 | /* ------------------------------------------------------------------------- */ 40 | 41 | #if (defined(ECRYPT_DEFAULT_SWAP) && !defined(ECRYPT_MACHINE_SWAP)) 42 | 43 | #define ECRYPT_MACHINE_SWAP 44 | 45 | /* 46 | * If you want to overwrite the default swap macros, put it here. And so on. 47 | */ 48 | 49 | #endif 50 | 51 | /* ------------------------------------------------------------------------- */ 52 | -------------------------------------------------------------------------------- /examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/devices/cc13x0/driverlib/sw_poly1305-donna.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Filename: sw_poly1305-donna.h 3 | * Revised: 2016-10-05 12:42:03 +0200 (Wed, 05 Oct 2016) 4 | * Revision: 47308 5 | ******************************************************************************/ 6 | 7 | #ifndef POLY1305_DONNA_H 8 | #define POLY1305_DONNA_H 9 | 10 | #include 11 | 12 | typedef struct { 13 | size_t aligner; 14 | unsigned char opaque[136]; 15 | } poly1305_context; 16 | 17 | void poly1305_init(poly1305_context *ctx, const unsigned char key[32]); 18 | void poly1305_update(poly1305_context *ctx, const unsigned char *m, size_t bytes); 19 | void poly1305_finish(poly1305_context *ctx, unsigned char mac[16]); 20 | void poly1305_auth(unsigned char mac[16], const unsigned char *m, size_t bytes, const unsigned char key[32]); 21 | 22 | int poly1305_verify(const unsigned char mac1[16], const unsigned char mac2[16]); 23 | int poly1305_power_on_self_test(void); 24 | 25 | #endif /* POLY1305_DONNA_H */ 26 | -------------------------------------------------------------------------------- /examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/devices/cc13x0/rom/driverlib.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/knx/764900e0c5251003eca22715991875ec88c45f64/examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/devices/cc13x0/rom/driverlib.elf -------------------------------------------------------------------------------- /examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/devices/cc13x0/rom/readme.txt: -------------------------------------------------------------------------------- 1 | Debugging sessions in IAR Embedded Workbench (IAR) and Code Composer Studio (CCS) 2 | can load symbol information covering the code in ROM. 3 | Symbols are loaded by selecting the ELF files found in the same folder as this 4 | readme.txt file. 5 | In addition the source code for the driverlib functions in ROM is found in the 6 | driverlib.c file in this folder. 7 | 8 | Loading ROM code symbols in CCS debug session: 9 | - Start a debug session in your project 10 | - Select Run > Load > Add Symbols to create additional symbols 11 | - Browse to and select each ELF file in this folder in the 'Program file' field 12 | - Set the value of 0 in the 'Code offset' field for each ELF file 13 | - If you enter a driverlib function in ROM during your debuging session and 14 | get this information: 15 | 'Can't find a source file at "..//driverlib.c"' 16 | you can navigate to the driverlib.c file in this folder by selecting 17 | the 'Locate File..' button. 18 | 19 | Loading ROM code symbols for use in IAR debug session: 20 | - In your project select the following before starting debug session: 21 | Project > Options.. > Debugger and then select the 'Images'-tab 22 | - In the 'Images'-tab do the following for each of the ELF files 23 | located in the same folder as this reame.txt file: 24 | -- Select the 'Download extra image' box 25 | -- Browse to the ELF file in the 'Path:' field 26 | -- Set the value of 0 in the 'Offset:' field 27 | -- Select the 'Debug info only' box 28 | - If you during a debug session enters a driverlib function in ROM you will 29 | be notified by this message: 30 | 'Could not find following file: ..//driverlib.c' 31 | Select the browse button and select the driverlib.c file located in this 32 | folder. 33 | -------------------------------------------------------------------------------- /examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/devices/cc13x2_cc26x2/driverlib/bin/gcc/driverlib.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/knx/764900e0c5251003eca22715991875ec88c45f64/examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/devices/cc13x2_cc26x2/driverlib/bin/gcc/driverlib.lib -------------------------------------------------------------------------------- /examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/devices/cc13x2_cc26x2/driverlib/bin/iar/driverlib.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/knx/764900e0c5251003eca22715991875ec88c45f64/examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/devices/cc13x2_cc26x2/driverlib/bin/iar/driverlib.lib -------------------------------------------------------------------------------- /examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/devices/cc13x2_cc26x2/driverlib/sw_ecrypt-machine.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Filename: sw_ecrypt-machine.h 3 | * Revised: 2016-10-05 12:42:03 +0200 (Wed, 05 Oct 2016) 4 | * Revision: 47308 5 | ******************************************************************************/ 6 | /* ecrypt-machine.h */ 7 | 8 | /* 9 | * This file is included by 'ecrypt-portable.h'. It allows to override 10 | * the default macros for specific platforms. Please carefully check 11 | * the machine code generated by your compiler (with optimisations 12 | * turned on) before deciding to edit this file. 13 | */ 14 | 15 | /* ------------------------------------------------------------------------- */ 16 | 17 | #if (defined(ECRYPT_DEFAULT_ROT) && !defined(ECRYPT_MACHINE_ROT)) 18 | 19 | #define ECRYPT_MACHINE_ROT 20 | 21 | #if (defined(WIN32) && defined(_MSC_VER)) 22 | 23 | #undef ROTL32 24 | #undef ROTR32 25 | #undef ROTL64 26 | #undef ROTR64 27 | 28 | #include 29 | 30 | #define ROTL32(v, n) _lrotl(v, n) 31 | #define ROTR32(v, n) _lrotr(v, n) 32 | #define ROTL64(v, n) _rotl64(v, n) 33 | #define ROTR64(v, n) _rotr64(v, n) 34 | 35 | #endif 36 | 37 | #endif 38 | 39 | /* ------------------------------------------------------------------------- */ 40 | 41 | #if (defined(ECRYPT_DEFAULT_SWAP) && !defined(ECRYPT_MACHINE_SWAP)) 42 | 43 | #define ECRYPT_MACHINE_SWAP 44 | 45 | /* 46 | * If you want to overwrite the default swap macros, put it here. And so on. 47 | */ 48 | 49 | #endif 50 | 51 | /* ------------------------------------------------------------------------- */ 52 | -------------------------------------------------------------------------------- /examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/devices/cc13x2_cc26x2/driverlib/sw_poly1305-donna.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Filename: sw_poly1305-donna.h 3 | * Revised: 2016-10-05 12:42:03 +0200 (Wed, 05 Oct 2016) 4 | * Revision: 47308 5 | ******************************************************************************/ 6 | 7 | #ifndef POLY1305_DONNA_H 8 | #define POLY1305_DONNA_H 9 | 10 | #include 11 | 12 | typedef struct { 13 | size_t aligner; 14 | unsigned char opaque[136]; 15 | } poly1305_context; 16 | 17 | void poly1305_init(poly1305_context *ctx, const unsigned char key[32]); 18 | void poly1305_update(poly1305_context *ctx, const unsigned char *m, size_t bytes); 19 | void poly1305_finish(poly1305_context *ctx, unsigned char mac[16]); 20 | void poly1305_auth(unsigned char mac[16], const unsigned char *m, size_t bytes, const unsigned char key[32]); 21 | 22 | int poly1305_verify(const unsigned char mac1[16], const unsigned char mac2[16]); 23 | int poly1305_power_on_self_test(void); 24 | 25 | #endif /* POLY1305_DONNA_H */ 26 | -------------------------------------------------------------------------------- /examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/devices/cc13x2_cc26x2/rom/driverlib.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/knx/764900e0c5251003eca22715991875ec88c45f64/examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/devices/cc13x2_cc26x2/rom/driverlib.elf -------------------------------------------------------------------------------- /examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/devices/cc13x2_cc26x2/rom/readme.txt: -------------------------------------------------------------------------------- 1 | Debugging sessions in IAR Embedded Workbench (IAR) and Code Composer Studio (CCS) 2 | can load symbol information covering the code in ROM. 3 | Symbols are loaded by selecting the ELF files found in the same folder as this 4 | readme.txt file. 5 | In addition the source code for the driverlib functions in ROM is found in the 6 | driverlib.c file in this folder. 7 | 8 | Loading ROM code symbols in CCS debug session: 9 | - Start a debug session in your project 10 | - Select Run > Load > Add Symbols to create additional symbols 11 | - Browse to and select each ELF file in this folder in the 'Program file' field 12 | - Set the value of 0 in the 'Code offset' field for each ELF file 13 | - If you enter a driverlib function in ROM during your debuging session and 14 | get this information: 15 | 'Can't find a source file at "..//driverlib.c"' 16 | you can navigate to the driverlib.c file in this folder by selecting 17 | the 'Locate File..' button. 18 | 19 | Loading ROM code symbols for use in IAR debug session: 20 | - In your project select the following before starting debug session: 21 | Project > Options.. > Debugger and then select the 'Images'-tab 22 | - In the 'Images'-tab do the following for each of the ELF files 23 | located in the same folder as this reame.txt file: 24 | -- Select the 'Download extra image' box 25 | -- Browse to the ELF file in the 'Path:' field 26 | -- Set the value of 0 in the 'Offset:' field 27 | -- Select the 'Debug info only' box 28 | - If you during a debug session enters a driverlib function in ROM you will 29 | be notified by this message: 30 | 'Could not find following file: ..//driverlib.c' 31 | Select the browse button and select the driverlib.c file located in this 32 | folder. 33 | -------------------------------------------------------------------------------- /examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/devices/cc26x0/driverlib/bin/gcc/driverlib.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/knx/764900e0c5251003eca22715991875ec88c45f64/examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/devices/cc26x0/driverlib/bin/gcc/driverlib.lib -------------------------------------------------------------------------------- /examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/devices/cc26x0/driverlib/bin/iar/driverlib.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/knx/764900e0c5251003eca22715991875ec88c45f64/examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/devices/cc26x0/driverlib/bin/iar/driverlib.lib -------------------------------------------------------------------------------- /examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/devices/cc26x0/driverlib/sw_ecrypt-machine.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Filename: sw_ecrypt-machine.h 3 | * Revised: 2016-10-05 12:42:03 +0200 (Wed, 05 Oct 2016) 4 | * Revision: 47308 5 | ******************************************************************************/ 6 | /* ecrypt-machine.h */ 7 | 8 | /* 9 | * This file is included by 'ecrypt-portable.h'. It allows to override 10 | * the default macros for specific platforms. Please carefully check 11 | * the machine code generated by your compiler (with optimisations 12 | * turned on) before deciding to edit this file. 13 | */ 14 | 15 | /* ------------------------------------------------------------------------- */ 16 | 17 | #if (defined(ECRYPT_DEFAULT_ROT) && !defined(ECRYPT_MACHINE_ROT)) 18 | 19 | #define ECRYPT_MACHINE_ROT 20 | 21 | #if (defined(WIN32) && defined(_MSC_VER)) 22 | 23 | #undef ROTL32 24 | #undef ROTR32 25 | #undef ROTL64 26 | #undef ROTR64 27 | 28 | #include 29 | 30 | #define ROTL32(v, n) _lrotl(v, n) 31 | #define ROTR32(v, n) _lrotr(v, n) 32 | #define ROTL64(v, n) _rotl64(v, n) 33 | #define ROTR64(v, n) _rotr64(v, n) 34 | 35 | #endif 36 | 37 | #endif 38 | 39 | /* ------------------------------------------------------------------------- */ 40 | 41 | #if (defined(ECRYPT_DEFAULT_SWAP) && !defined(ECRYPT_MACHINE_SWAP)) 42 | 43 | #define ECRYPT_MACHINE_SWAP 44 | 45 | /* 46 | * If you want to overwrite the default swap macros, put it here. And so on. 47 | */ 48 | 49 | #endif 50 | 51 | /* ------------------------------------------------------------------------- */ 52 | -------------------------------------------------------------------------------- /examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/devices/cc26x0/driverlib/sw_poly1305-donna.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Filename: sw_poly1305-donna.h 3 | * Revised: 2016-10-05 12:42:03 +0200 (Wed, 05 Oct 2016) 4 | * Revision: 47308 5 | ******************************************************************************/ 6 | 7 | #ifndef POLY1305_DONNA_H 8 | #define POLY1305_DONNA_H 9 | 10 | #include 11 | 12 | typedef struct { 13 | size_t aligner; 14 | unsigned char opaque[136]; 15 | } poly1305_context; 16 | 17 | void poly1305_init(poly1305_context *ctx, const unsigned char key[32]); 18 | void poly1305_update(poly1305_context *ctx, const unsigned char *m, size_t bytes); 19 | void poly1305_finish(poly1305_context *ctx, unsigned char mac[16]); 20 | void poly1305_auth(unsigned char mac[16], const unsigned char *m, size_t bytes, const unsigned char key[32]); 21 | 22 | int poly1305_verify(const unsigned char mac1[16], const unsigned char mac2[16]); 23 | int poly1305_power_on_self_test(void); 24 | 25 | #endif /* POLY1305_DONNA_H */ 26 | -------------------------------------------------------------------------------- /examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/devices/cc26x0/rom/driverlib.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/knx/764900e0c5251003eca22715991875ec88c45f64/examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/devices/cc26x0/rom/driverlib.elf -------------------------------------------------------------------------------- /examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/devices/cc26x0/rom/readme.txt: -------------------------------------------------------------------------------- 1 | Debugging sessions in IAR Embedded Workbench (IAR) and Code Composer Studio (CCS) 2 | can load symbol information covering the code in ROM. 3 | Symbols are loaded by selecting the ELF files found in the same folder as this 4 | readme.txt file. 5 | In addition the source code for the driverlib functions in ROM is found in the 6 | driverlib.c file in this folder. 7 | 8 | Loading ROM code symbols in CCS debug session: 9 | - Start a debug session in your project 10 | - Select Run > Load > Add Symbols to create additional symbols 11 | - Browse to and select each ELF file in this folder in the 'Program file' field 12 | - Set the value of 0 in the 'Code offset' field for each ELF file 13 | - If you enter a driverlib function in ROM during your debuging session and 14 | get this information: 15 | 'Can't find a source file at "..//driverlib.c"' 16 | you can navigate to the driverlib.c file in this folder by selecting 17 | the 'Locate File..' button. 18 | 19 | Loading ROM code symbols for use in IAR debug session: 20 | - In your project select the following before starting debug session: 21 | Project > Options.. > Debugger and then select the 'Images'-tab 22 | - In the 'Images'-tab do the following for each of the ELF files 23 | located in the same folder as this reame.txt file: 24 | -- Select the 'Download extra image' box 25 | -- Browse to the ELF file in the 'Path:' field 26 | -- Set the value of 0 in the 'Offset:' field 27 | -- Select the 'Debug info only' box 28 | - If you during a debug session enters a driverlib function in ROM you will 29 | be notified by this message: 30 | 'Could not find following file: ..//driverlib.c' 31 | Select the browse button and select the driverlib.c file located in this 32 | folder. 33 | -------------------------------------------------------------------------------- /examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/drivers/lib/drivers_cc13x0.am3g: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/knx/764900e0c5251003eca22715991875ec88c45f64/examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/drivers/lib/drivers_cc13x0.am3g -------------------------------------------------------------------------------- /examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/drivers/lib/drivers_cc13x0.arm3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/knx/764900e0c5251003eca22715991875ec88c45f64/examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/drivers/lib/drivers_cc13x0.arm3 -------------------------------------------------------------------------------- /examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/drivers/lib/drivers_cc13x2.am4fg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/knx/764900e0c5251003eca22715991875ec88c45f64/examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/drivers/lib/drivers_cc13x2.am4fg -------------------------------------------------------------------------------- /examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/drivers/lib/drivers_cc13x2.arm4f: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/knx/764900e0c5251003eca22715991875ec88c45f64/examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/drivers/lib/drivers_cc13x2.arm4f -------------------------------------------------------------------------------- /examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/drivers/lib/drivers_cc26x0.am3g: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/knx/764900e0c5251003eca22715991875ec88c45f64/examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/drivers/lib/drivers_cc26x0.am3g -------------------------------------------------------------------------------- /examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/drivers/lib/drivers_cc26x0.arm3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/knx/764900e0c5251003eca22715991875ec88c45f64/examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/drivers/lib/drivers_cc26x0.arm3 -------------------------------------------------------------------------------- /examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/drivers/lib/drivers_cc26x2.am4fg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/knx/764900e0c5251003eca22715991875ec88c45f64/examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/drivers/lib/drivers_cc26x2.am4fg -------------------------------------------------------------------------------- /examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/drivers/lib/drivers_cc26x2.arm4f: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/knx/764900e0c5251003eca22715991875ec88c45f64/examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/drivers/lib/drivers_cc26x2.arm4f -------------------------------------------------------------------------------- /examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/drivers/rf/lib/rf_multiMode_cc13x0.am3g: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/knx/764900e0c5251003eca22715991875ec88c45f64/examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/drivers/rf/lib/rf_multiMode_cc13x0.am3g -------------------------------------------------------------------------------- /examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/drivers/rf/lib/rf_multiMode_cc13x0.arm3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/knx/764900e0c5251003eca22715991875ec88c45f64/examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/drivers/rf/lib/rf_multiMode_cc13x0.arm3 -------------------------------------------------------------------------------- /examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/drivers/rf/lib/rf_multiMode_cc13x2.am4fg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/knx/764900e0c5251003eca22715991875ec88c45f64/examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/drivers/rf/lib/rf_multiMode_cc13x2.am4fg -------------------------------------------------------------------------------- /examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/drivers/rf/lib/rf_multiMode_cc13x2.arm4f: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/knx/764900e0c5251003eca22715991875ec88c45f64/examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/drivers/rf/lib/rf_multiMode_cc13x2.arm4f -------------------------------------------------------------------------------- /examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/drivers/rf/lib/rf_multiMode_cc26x0.am3g: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/knx/764900e0c5251003eca22715991875ec88c45f64/examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/drivers/rf/lib/rf_multiMode_cc26x0.am3g -------------------------------------------------------------------------------- /examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/drivers/rf/lib/rf_multiMode_cc26x0.arm3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/knx/764900e0c5251003eca22715991875ec88c45f64/examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/drivers/rf/lib/rf_multiMode_cc26x0.arm3 -------------------------------------------------------------------------------- /examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/drivers/rf/lib/rf_multiMode_cc26x2.am4fg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/knx/764900e0c5251003eca22715991875ec88c45f64/examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/drivers/rf/lib/rf_multiMode_cc26x2.am4fg -------------------------------------------------------------------------------- /examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/drivers/rf/lib/rf_multiMode_cc26x2.arm4f: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/knx/764900e0c5251003eca22715991875ec88c45f64/examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/drivers/rf/lib/rf_multiMode_cc26x2.arm4f -------------------------------------------------------------------------------- /examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/drivers/rf/lib/rf_singleMode_cc13x0.am3g: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/knx/764900e0c5251003eca22715991875ec88c45f64/examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/drivers/rf/lib/rf_singleMode_cc13x0.am3g -------------------------------------------------------------------------------- /examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/drivers/rf/lib/rf_singleMode_cc13x0.arm3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/knx/764900e0c5251003eca22715991875ec88c45f64/examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/drivers/rf/lib/rf_singleMode_cc13x0.arm3 -------------------------------------------------------------------------------- /examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/drivers/rf/lib/rf_singleMode_cc26x0.am3g: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/knx/764900e0c5251003eca22715991875ec88c45f64/examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/drivers/rf/lib/rf_singleMode_cc26x0.am3g -------------------------------------------------------------------------------- /examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/drivers/rf/lib/rf_singleMode_cc26x0.arm3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/knx/764900e0c5251003eca22715991875ec88c45f64/examples/knx-cc1310/coresdk_cc13xx_cc26xx/source/ti/drivers/rf/lib/rf_singleMode_cc26x0.arm3 -------------------------------------------------------------------------------- /examples/knx-cc1310/knx_wrapper.cpp: -------------------------------------------------------------------------------- 1 | #include "knx.h" 2 | #include 3 | 4 | #include "knx_wrapper.h" 5 | 6 | KnxFacade *pKnx = nullptr; 7 | 8 | void buttonUp() 9 | { 10 | static uint32_t lastpressed=0; 11 | if (millis() - lastpressed > 200) 12 | { 13 | KnxFacade &knx = *pKnx; 14 | knx.toggleProgMode(); 15 | lastpressed = millis(); 16 | } 17 | } 18 | 19 | void setup() 20 | { 21 | pKnx = new KnxFacade; 22 | KnxFacade &knx = *pKnx; 23 | 24 | // see GPIO_PinConfig gpioPinConfigs[] 25 | knx.buttonPin(0); 26 | knx.ledPinActiveOn(HIGH); 27 | 28 | knx.platform().init(); 29 | 30 | knx.readMemory(); 31 | 32 | if (knx.individualAddress() == 0) 33 | knx.progMode(true); 34 | 35 | if (knx.configured()) 36 | { 37 | println("configured"); 38 | } 39 | else 40 | println("not configured"); 41 | knx.start(); 42 | } 43 | 44 | void loop() 45 | { 46 | KnxFacade &knx = *pKnx; 47 | 48 | knx.loop(); 49 | } 50 | -------------------------------------------------------------------------------- /examples/knx-cc1310/knx_wrapper.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | extern void setup(); 8 | extern void loop(); 9 | 10 | #ifdef __cplusplus 11 | } 12 | #endif 13 | -------------------------------------------------------------------------------- /examples/knx-cc1310/smartrf_settings/smartrf_settings.h: -------------------------------------------------------------------------------- 1 | #ifndef _SMARTRF_SETTINGS_H_ 2 | #define _SMARTRF_SETTINGS_H_ 3 | 4 | //********************************************************************************* 5 | // Generated by SmartRF Studio version 2.9.0 (build #168) 6 | // Tested for SimpleLink SDK version: CC13x0 SDK 2.10.xx.xx 7 | // Device: CC1310 Rev. 2.1 8 | // 9 | //********************************************************************************* 10 | 11 | #include 12 | #include DeviceFamily_constructPath(driverlib/rf_mailbox.h) 13 | #include DeviceFamily_constructPath(driverlib/rf_common_cmd.h) 14 | #include DeviceFamily_constructPath(driverlib/rf_prop_cmd.h) 15 | #include 16 | 17 | // RF Core TX power 18 | extern const RF_TxPowerTable_Entry PROP_RF_txPowerTable[]; 19 | extern const uint8_t PROP_RF_txPowerTableSize; 20 | 21 | // TI-RTOS RF Mode Object 22 | extern RF_Mode RF_prop; 23 | 24 | // RF Core API commands 25 | extern rfc_CMD_PROP_RADIO_DIV_SETUP_t RF_cmdPropRadioDivSetup; 26 | extern rfc_CMD_FS_t RF_cmdFs; 27 | extern rfc_CMD_PROP_TX_t RF_cmdPropTx; 28 | extern rfc_CMD_PROP_RX_ADV_t RF_cmdPropRxAdv; 29 | 30 | #endif // _SMARTRF_SETTINGS_H_ 31 | -------------------------------------------------------------------------------- /examples/knx-cc1310/vscode/launch.json.example: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": "Cortex Debug", 9 | "cwd": "${workspaceRoot}", 10 | "executable": "./build/knx-cc1310", 11 | "request": "launch", 12 | "type": "cortex-debug", 13 | "servertype": "jlink", 14 | "serverpath": "/opt/SEGGER/JLink/JLinkGDBServerCLExe", 15 | "device": "CC1310F128", 16 | "interface": "jtag", 17 | "runToMain": false, 18 | } 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /examples/knx-demo-coupler/knx-demo-coupler.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void setup() 4 | { 5 | Serial.begin(115200); 6 | ArduinoPlatform::SerialDebug = &Serial; 7 | 8 | randomSeed(millis()); 9 | 10 | // read adress table, association table, groupobject table and parameters from eeprom 11 | knx.readMemory(); 12 | 13 | // print values of parameters if device is already configured 14 | if (knx.configured()) 15 | { 16 | Serial.println("Coupler configured."); 17 | } 18 | 19 | // pin or GPIO the programming led is connected to. Default is LED_BUILTIN 20 | // knx.ledPin(LED_BUILTIN); 21 | // is the led active on HIGH or low? Default is LOW 22 | // knx.ledPinActiveOn(HIGH); 23 | // pin or GPIO programming button is connected to. Default is 0 24 | // knx.buttonPin(0); 25 | 26 | // start the framework. 27 | knx.start(); 28 | } 29 | 30 | void loop() 31 | { 32 | // don't delay here to much. Otherwise you might lose packages or mess up the timing with ETS 33 | knx.loop(); 34 | 35 | // only run the application code if the device was configured with ETS 36 | if (!knx.configured()) 37 | return; 38 | } 39 | -------------------------------------------------------------------------------- /examples/knx-demo-coupler/platformio-ci.ini: -------------------------------------------------------------------------------- 1 | ;PlatformIO Project Configuration File 2 | ; 3 | ; Build options: build flags, source filter 4 | ; Upload options: custom upload port, speed and extra flags 5 | ; Library options: dependencies, extra library storages 6 | ; Advanced options: extra scripting 7 | ; 8 | ; Please visit documentation for the other options and examples 9 | ; https://docs.platformio.org/page/projectconf.html 10 | 11 | ;--- SAMD -------------------------------------------------- 12 | [env:adafruit_feather_m0_tp_rf] 13 | platform = atmelsam 14 | board = adafruit_feather_m0 15 | framework = arduino 16 | lib_deps = 17 | SPI 18 | knx 19 | 20 | build_flags = 21 | -DMASK_VERSION=0x2920 22 | -Wno-unknown-pragmas 23 | -DUSE_DATASECURE 24 | 25 | ;----------------------------------------------------------- 26 | 27 | 28 | ;--- ESP8266 ----------------------------------------------- 29 | #[env:nodemcuv2_ip_tp] 30 | #platform = espressif8266 31 | #board = nodemcuv2 32 | #framework = arduino 33 | #lib_deps = 34 | # WifiManager 35 | # knx 36 | 37 | #build_flags = 38 | # -DMASK_VERSION=0x091A 39 | # -Wno-unknown-pragmas 40 | # -DUSE_DATASECURE 41 | 42 | ;--------------------------------------------------------- 43 | 44 | 45 | ;--- ESP32 ----------------------------------------------- 46 | [env:esp32dev_ip_tp] 47 | platform = espressif32 48 | board = esp32dev 49 | framework = arduino 50 | lib_deps = 51 | knx 52 | 53 | build_flags = 54 | -DMASK_VERSION=0x091A 55 | -Wno-unknown-pragmas 56 | -DUSE_DATASECURE 57 | -------------------------------------------------------------------------------- /examples/knx-demo-coupler/platformio.ini: -------------------------------------------------------------------------------- 1 | ;PlatformIO Project Configuration File 2 | ; 3 | ; Build options: build flags, source filter 4 | ; Upload options: custom upload port, speed and extra flags 5 | ; Library options: dependencies, extra library storages 6 | ; Advanced options: extra scripting 7 | ; 8 | ; Please visit documentation for the other options and examples 9 | ; https://docs.platformio.org/page/projectconf.html 10 | [platformio] 11 | ; We have to keep libdeps dir out the project directory otherwise, 12 | ; library scanner seems to have issues so compilation fails 13 | libdeps_dir = /tmp/libdeps 14 | src_dir = . 15 | 16 | ;--- SAMD -------------------------------------------------- 17 | [env:adafruit_feather_m0_tp_rf] 18 | platform = atmelsam 19 | board = adafruit_feather_m0 20 | framework = arduino 21 | ; We consider that the this projects is opened within its project directory 22 | ; while working with VS Code. 23 | lib_extra_dirs = ../../../ 24 | 25 | lib_deps = 26 | SPI 27 | knx 28 | 29 | build_flags = 30 | -DMASK_VERSION=0x2920 31 | -Wno-unknown-pragmas 32 | 33 | ;----------------------------------------------------------- 34 | 35 | 36 | ;--- ESP8266 ----------------------------------------------- 37 | #[env:nodemcuv2_ip_tp] 38 | #platform = espressif8266 39 | #board = nodemcuv2 40 | #framework = arduino 41 | ; We consider that the this projects is opened within its project directory 42 | ; while working with VS Code. 43 | #lib_extra_dirs = ../../../ 44 | 45 | #lib_deps = 46 | # WifiManager 47 | # knx 48 | 49 | #build_flags = 50 | # -DMASK_VERSION=0x091A 51 | # -Wno-unknown-pragmas 52 | 53 | ;--------------------------------------------------------- 54 | 55 | 56 | ;--- ESP32 ----------------------------------------------- 57 | [env:esp32dev_ip_tp] 58 | platform = espressif32 59 | board = esp32dev 60 | framework = arduino 61 | ; We consider that the this projects is opened within its project directory 62 | ; while working with VS Code. 63 | lib_extra_dirs = ../../../ 64 | 65 | lib_deps = 66 | knx 67 | 68 | build_flags = 69 | -DMASK_VERSION=0x091A 70 | -Wno-unknown-pragmas 71 | -------------------------------------------------------------------------------- /examples/knx-demo-diy/.gitignore: -------------------------------------------------------------------------------- 1 | .pio 2 | .vscode/.browse.c_cpp.db* 3 | .vscode/c_cpp_properties.json 4 | .vscode/launch.json 5 | .vscode/ipch 6 | -------------------------------------------------------------------------------- /examples/knx-demo-diy/knx-demo-diy-tp.knxprod: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/knx/764900e0c5251003eca22715991875ec88c45f64/examples/knx-demo-diy/knx-demo-diy-tp.knxprod -------------------------------------------------------------------------------- /examples/knx-demo-diy/platformio-ci.ini: -------------------------------------------------------------------------------- 1 | ;PlatformIO Project Configuration File 2 | ; 3 | ; Build options: build flags, source filter 4 | ; Upload options: custom upload port, speed and extra flags 5 | ; Library options: dependencies, extra library storages 6 | ; Advanced options: extra scripting 7 | ; 8 | ; Please visit documentation for the other options and examples 9 | ; https://docs.platformio.org/page/projectconf.html 10 | 11 | ; 12 | ;--- ESP32 ----------------------------------------------- 13 | 14 | [env:esp32dev_tp] 15 | platform = espressif32 16 | board = esp32dev 17 | framework = arduino 18 | lib_deps = 19 | knx 20 | 21 | build_flags = 22 | -DMASK_VERSION=0x07B0 23 | -Wno-unknown-pragmas 24 | -DKNX_NO_AUTOMATIC_GLOBAL_INSTANCE 25 | -------------------------------------------------------------------------------- /examples/knx-demo-diy/platformio.ini: -------------------------------------------------------------------------------- 1 | ;PlatformIO Project Configuration File 2 | ; 3 | ; Build options: build flags, source filter 4 | ; Upload options: custom upload port, speed and extra flags 5 | ; Library options: dependencies, extra library storages 6 | ; Advanced options: extra scripting 7 | ; 8 | ; Please visit documentation for the other options and examples 9 | ; https://docs.platformio.org/page/projectconf.html 10 | [platformio] 11 | ; We have to keep libdeps dir out the project directory otherwise, 12 | ; library scanner seems to have issues so compilation fails 13 | libdeps_dir = /tmp/libdeps 14 | src_dir = . 15 | 16 | 17 | ;--- ESP32 ----------------------------------------------- 18 | 19 | [env:esp32dev_tp] 20 | platform = espressif32 21 | board = esp32dev 22 | framework = arduino 23 | ; We consider that the this projects is opened within its project directory 24 | ; while working with VS Code. 25 | lib_extra_dirs = ../../../ 26 | 27 | lib_deps = 28 | knx 29 | 30 | build_flags = 31 | -DMASK_VERSION=0x07B0 32 | -Wno-unknown-pragmas 33 | -DKNX_NO_AUTOMATIC_GLOBAL_INSTANCE 34 | -------------------------------------------------------------------------------- /examples/knx-demo/knx-demo-ip.knxprod: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/knx/764900e0c5251003eca22715991875ec88c45f64/examples/knx-demo/knx-demo-ip.knxprod -------------------------------------------------------------------------------- /examples/knx-demo/knx-demo-rf.knxprod: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/knx/764900e0c5251003eca22715991875ec88c45f64/examples/knx-demo/knx-demo-rf.knxprod -------------------------------------------------------------------------------- /examples/knx-demo/knx-demo-tp.knxprod: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/knx/764900e0c5251003eca22715991875ec88c45f64/examples/knx-demo/knx-demo-tp.knxprod -------------------------------------------------------------------------------- /examples/knx-h8i8o/knx-h8i8o.knxprod: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/knx/764900e0c5251003eca22715991875ec88c45f64/examples/knx-h8i8o/knx-h8i8o.knxprod -------------------------------------------------------------------------------- /examples/knx-h8i8o/platformio.ini: -------------------------------------------------------------------------------- 1 | ;PlatformIO Project Configuration File 2 | ; 3 | ; Build options: build flags, source filter 4 | ; Upload options: custom upload port, speed and extra flags 5 | ; Library options: dependencies, extra library storages 6 | ; Advanced options: extra scripting 7 | ; 8 | ; Please visit documentation for the other options and examples 9 | ; https://docs.platformio.org/page/projectconf.html 10 | [platformio] 11 | ; We have to keep libdeps dir out the project directory otherwise, 12 | ; library scanner seems to have issues so compilation fails 13 | libdeps_dir = /tmp/libdeps 14 | src_dir = . 15 | 16 | ;--- STM32/GD32 --- 17 | [env:h8i8o] 18 | platform = ststm32 19 | board = genericSTM32F103CB 20 | framework = arduino 21 | ; We consider that the this projects is opened within its project directory 22 | ; while working with VS Code. 23 | lib_extra_dirs = ../../../ 24 | 25 | lib_deps = 26 | knx 27 | 28 | build_flags = 29 | -DENABLE_HWSERIAL1 30 | -DPIN_SERIAL1_TX=PA9 31 | -DPIN_SERIAL1_RX=PA10 32 | -DKNX_SERIAL=Serial1 33 | -DKNX_BUTTON=PA11 34 | -DKNX_LED=PA12 35 | -DMASK_VERSION=0x07B0 36 | -DKNX_NO_PRINT 37 | -Wno-unknown-pragmas 38 | 39 | extra_scripts = ../scripts/stm32rdu.py 40 | -------------------------------------------------------------------------------- /examples/knx-linux-coupler/fdsk.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | class FdskCalculator 6 | { 7 | public: 8 | int snprintFdsk(char* str, int strSize, uint8_t* serialNumber, uint8_t* key); 9 | 10 | private: 11 | char* generateFdskString(uint8_t* serialNumber, uint8_t* key); 12 | 13 | int toBase32(uint8_t* in, long length, uint8_t*& out, bool usePadding); 14 | int fromBase32(uint8_t* in, long length, uint8_t*& out); 15 | 16 | uint8_t crc4Array(uint8_t* data, uint8_t len) { 17 | uint8_t start = 0; 18 | for (uint8_t i = 0; i > 4; 28 | c = crc4_tab[c ^ high4Bits]; 29 | c = crc4_tab[c ^ low4Bits]; 30 | 31 | return c; 32 | } 33 | 34 | int ceil(float num); 35 | 36 | static const uint8_t crc4_tab[16]; 37 | }; 38 | -------------------------------------------------------------------------------- /examples/knx-linux/.vscode/c_cpp_properties.json: -------------------------------------------------------------------------------- 1 | { 2 | "configurations": [ 3 | { 4 | "name": "Linux", 5 | "includePath": [ 6 | "${workspaceFolder}", 7 | "../../src" 8 | ], 9 | "defines": [], 10 | "compilerPath": "/usr/bin/gcc", 11 | "cStandard": "gnu11", 12 | "cppStandard": "gnu++14", 13 | "intelliSenseMode": "gcc-arm" 14 | } 15 | ], 16 | "version": 4 17 | } -------------------------------------------------------------------------------- /examples/knx-linux/fdsk.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | class FdskCalculator 6 | { 7 | public: 8 | int snprintFdsk(char* str, int strSize, uint8_t* serialNumber, uint8_t* key); 9 | 10 | private: 11 | char* generateFdskString(uint8_t* serialNumber, uint8_t* key); 12 | 13 | int toBase32(uint8_t* in, long length, uint8_t*& out, bool usePadding); 14 | int fromBase32(uint8_t* in, long length, uint8_t*& out); 15 | 16 | uint8_t crc4Array(uint8_t* data, uint8_t len) { 17 | uint8_t start = 0; 18 | for (uint8_t i = 0; i > 4; 28 | c = crc4_tab[c ^ high4Bits]; 29 | c = crc4_tab[c ^ low4Bits]; 30 | 31 | return c; 32 | } 33 | 34 | int ceil(float num); 35 | 36 | static const uint8_t crc4_tab[16]; 37 | }; 38 | -------------------------------------------------------------------------------- /examples/knx-pzem004/knx-pzem004t.knxprod: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/knx/764900e0c5251003eca22715991875ec88c45f64/examples/knx-pzem004/knx-pzem004t.knxprod -------------------------------------------------------------------------------- /examples/knx-sonoffS20/knx-sonoffS20.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef ARDUINO_ARCH_ESP8266 3 | #include 4 | #endif 5 | 6 | #define RELAYPIN 12 7 | 8 | // create named references for easy access to group objects 9 | #define goSwitch knx.getGroupObject(1) 10 | #define goBlock knx.getGroupObject(2) 11 | #define goStatus knx.getGroupObject(3) 12 | 13 | 14 | // callback from switch-GO 15 | void switchCallback(GroupObject& go) 16 | { 17 | if (goBlock.value()) 18 | return; 19 | 20 | bool value = goSwitch.value(); 21 | digitalWrite(RELAYPIN, value); 22 | goStatus.value(value); 23 | } 24 | 25 | void setup() 26 | { 27 | Serial.begin(115200); 28 | ArduinoPlatform::SerialDebug = &Serial; 29 | 30 | #ifdef ARDUINO_ARCH_ESP8266 31 | WiFiManager wifiManager; 32 | wifiManager.autoConnect("knx-sonoffS20"); 33 | #endif 34 | 35 | // read adress table, association table, groupobject table and parameters from eeprom 36 | knx.readMemory(); 37 | 38 | if (knx.configured()) 39 | { 40 | // register callback for reset GO 41 | goSwitch.callback(switchCallback); 42 | goSwitch.dataPointType(Dpt(1, 1)); 43 | goBlock.dataPointType(Dpt(1, 3)); 44 | goStatus.dataPointType(Dpt(1, 2)); 45 | } 46 | 47 | // start the framework. Will get wifi first. 48 | knx.start(); 49 | } 50 | 51 | void loop() 52 | { 53 | // don't delay here to much. Otherwise you might lose packages or mess up the timing with ETS 54 | knx.loop(); 55 | 56 | // only run the application code if the device was configured with ETS 57 | if(!knx.configured()) 58 | return; 59 | 60 | // nothing else to do. 61 | } 62 | -------------------------------------------------------------------------------- /examples/knx-sonoffS20/knx-sonoffS20.knxprod: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/knx/764900e0c5251003eca22715991875ec88c45f64/examples/knx-sonoffS20/knx-sonoffS20.knxprod -------------------------------------------------------------------------------- /examples/knx-usb/.gitignore: -------------------------------------------------------------------------------- 1 | .pio 2 | .vscode/.browse.c_cpp.db* 3 | .vscode/c_cpp_properties.json 4 | .vscode/launch.json 5 | .vscode/ipch 6 | -------------------------------------------------------------------------------- /examples/knx-usb/.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | // See http://go.microsoft.com/fwlink/?LinkId=827846 3 | // for the documentation about the extensions.json format 4 | "recommendations": [ 5 | "platformio.platformio-ide" 6 | ] 7 | } -------------------------------------------------------------------------------- /examples/knx-usb/custom_hwids.py: -------------------------------------------------------------------------------- 1 | Import("env") 2 | 3 | # access to global build environment 4 | print(env) 5 | 6 | board_config = env.BoardConfig() 7 | board_config.update("build.hwids", [ 8 | # ["0x135e", "0x0024"] # Merten GmbH & Co. KG 9 | # ["0x0E77", "0x2001"] # Weinzierl Engineering GmbH 10 | ["0x7660", "0x0002"] # KNX Assoc. 11 | ]) 12 | -------------------------------------------------------------------------------- /examples/knx-usb/platformio-ci.ini: -------------------------------------------------------------------------------- 1 | ;PlatformIO Project Configuration File 2 | ; 3 | ; Build options: build flags, source filter 4 | ; Upload options: custom upload port, speed and extra flags 5 | ; Library options: dependencies, extra library storages 6 | ; Advanced options: extra scripting 7 | ; 8 | ; Please visit documentation for the other options and examples 9 | ; https://docs.platformio.org/page/projectconf.html 10 | [env:adafruit_feather_m0] 11 | platform = atmelsam 12 | board = adafruit_feather_m0 13 | framework = arduino 14 | 15 | ; VID must be changed to some known KNX Manufacturer 16 | ; so that the KNX USB interface gets recognized by ETS 17 | ; not possible within ci 18 | ;extra_scripts = pre:custom_hwids.py 19 | ;board_build.usb_product="KNX RF - USB Interface" 20 | 21 | lib_deps = 22 | SPI 23 | Adafruit TinyUSB Library@0.7.1 24 | knx 25 | 26 | build_flags = 27 | -DMASK_VERSION=0x27B0 28 | -DUSE_USB 29 | -DUSE_TINYUSB 30 | -Wno-unknown-pragmas 31 | -DUSE_DATASECURE 32 | -------------------------------------------------------------------------------- /examples/knx-usb/platformio.ini: -------------------------------------------------------------------------------- 1 | ;PlatformIO Project Configuration File 2 | ; 3 | ; Build options: build flags, source filter 4 | ; Upload options: custom upload port, speed and extra flags 5 | ; Library options: dependencies, extra library storages 6 | ; Advanced options: extra scripting 7 | ; 8 | ; Please visit documentation for the other options and examples 9 | ; https://docs.platformio.org/page/projectconf.html 10 | [platformio] 11 | ; We have to keep libdeps dir out the project directory otherwise, 12 | ; library scanner seems to have issues so compilation fails 13 | libdeps_dir = /tmp/libdeps 14 | 15 | [env:adafruit_feather_m0] 16 | platform = atmelsam@6.0.1 17 | board = adafruit_feather_m0 18 | framework = arduino 19 | ; We consider that the this projects is opened within its project directory 20 | ; while working with VS Code. 21 | lib_extra_dirs = ../../../ 22 | 23 | ; VID must be changed to some known KNX Manufacturer 24 | ; so that the KNX USB interface gets recognized by ETS 25 | extra_scripts = pre:custom_hwids.py 26 | board_build.usb_product="KNX RF - USB Interface" 27 | 28 | lib_deps = 29 | SPI 30 | Adafruit TinyUSB Library@0.7.1 31 | ;https://github.com/thelsing/FlashStorage.git 32 | knx 33 | 34 | build_flags = 35 | -DMASK_VERSION=0x27B0 36 | -DUSE_USB 37 | -DUSE_TINYUSB 38 | -Wno-unknown-pragmas 39 | 40 | debug_tool = jlink 41 | #upload_protocol = jlink 42 | -------------------------------------------------------------------------------- /examples/knxPython/Manifest.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | recursive-include external * 4 | include ./*.py 5 | include ./VERSION 6 | include ./*.cmake 7 | include ./*.cpp 8 | include ./CMakeLists.txt 9 | include README.md 10 | 11 | global-exclude .git 12 | 13 | graft pybind11/include 14 | graft src 15 | -------------------------------------------------------------------------------- /examples/knxPython/VERSION: -------------------------------------------------------------------------------- 1 | 0.1.6 2 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/.appveyor.yml: -------------------------------------------------------------------------------- 1 | version: 1.0.{build} 2 | image: 3 | - Visual Studio 2015 4 | test: off 5 | skip_branch_with_pr: true 6 | build: 7 | parallel: true 8 | platform: 9 | - x86 10 | environment: 11 | matrix: 12 | - PYTHON: 36 13 | CONFIG: Debug 14 | - PYTHON: 27 15 | CONFIG: Debug 16 | install: 17 | - ps: | 18 | $env:CMAKE_GENERATOR = "Visual Studio 14 2015" 19 | if ($env:PLATFORM -eq "x64") { $env:PYTHON = "$env:PYTHON-x64" } 20 | $env:PATH = "C:\Python$env:PYTHON\;C:\Python$env:PYTHON\Scripts\;$env:PATH" 21 | python -W ignore -m pip install --upgrade pip wheel 22 | python -W ignore -m pip install pytest numpy --no-warn-script-location 23 | - ps: | 24 | Start-FileDownload 'https://gitlab.com/libeigen/eigen/-/archive/3.3.7/eigen-3.3.7.zip' 25 | 7z x eigen-3.3.7.zip -y > $null 26 | $env:CMAKE_INCLUDE_PATH = "eigen-3.3.7;$env:CMAKE_INCLUDE_PATH" 27 | build_script: 28 | - cmake -G "%CMAKE_GENERATOR%" -A "%CMAKE_ARCH%" 29 | -DCMAKE_CXX_STANDARD=14 30 | -DPYBIND11_WERROR=ON 31 | -DDOWNLOAD_CATCH=ON 32 | -DCMAKE_SUPPRESS_REGENERATION=1 33 | . 34 | - set MSBuildLogger="C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" 35 | - cmake --build . --config %CONFIG% --target pytest -- /m /v:m /logger:%MSBuildLogger% 36 | - cmake --build . --config %CONFIG% --target cpptest -- /m /v:m /logger:%MSBuildLogger% 37 | on_failure: if exist "tests\test_cmake_build" type tests\test_cmake_build\*.log* 38 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/.clang-tidy: -------------------------------------------------------------------------------- 1 | FormatStyle: file 2 | 3 | Checks: ' 4 | llvm-namespace-comment, 5 | modernize-use-override, 6 | readability-container-size-empty, 7 | modernize-use-using, 8 | modernize-use-equals-default, 9 | modernize-use-auto, 10 | modernize-use-emplace, 11 | ' 12 | 13 | HeaderFilterRegex: 'pybind11/.*h' 14 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/.github/ISSUE_TEMPLATE/bug-report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug Report 3 | about: File an issue about a bug 4 | title: "[BUG] " 5 | --- 6 | 7 | 8 | Make sure you've completed the following steps before submitting your issue -- thank you! 9 | 10 | 1. Make sure you've read the [documentation][]. Your issue may be addressed there. 11 | 2. Search the [issue tracker][] to verify that this hasn't already been reported. +1 or comment there if it has. 12 | 3. Consider asking first in the [Gitter chat room][]. 13 | 4. Include a self-contained and minimal piece of code that reproduces the problem. If that's not possible, try to make the description as clear as possible. 14 | a. If possible, make a PR with a new, failing test to give us a starting point to work on! 15 | 16 | [documentation]: https://pybind11.readthedocs.io 17 | [issue tracker]: https://github.com/pybind/pybind11/issues 18 | [Gitter chat room]: https://gitter.im/pybind/Lobby 19 | 20 | *After reading, remove this checklist and the template text in parentheses below.* 21 | 22 | ## Issue description 23 | 24 | (Provide a short description, state the expected behavior and what actually happens.) 25 | 26 | ## Reproducible example code 27 | 28 | (The code should be minimal, have no external dependencies, isolate the function(s) that cause breakage. Submit matched and complete C++ and Python snippets that can be easily compiled and run to diagnose the issue.) 29 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Gitter room 4 | url: https://gitter.im/pybind/Lobby 5 | about: A room for discussing pybind11 with an active community 6 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/.github/ISSUE_TEMPLATE/feature-request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature Request 3 | about: File an issue about adding a feature 4 | title: "[FEAT] " 5 | --- 6 | 7 | 8 | Make sure you've completed the following steps before submitting your issue -- thank you! 9 | 10 | 1. Check if your feature has already been mentioned / rejected / planned in other issues. 11 | 2. If those resources didn't help, consider asking in the [Gitter chat room][] to see if this is interesting / useful to a larger audience and possible to implement reasonably, 12 | 4. If you have a useful feature that passes the previous items (or not suitable for chat), please fill in the details below. 13 | 14 | [Gitter chat room]: https://gitter.im/pybind/Lobby 15 | 16 | *After reading, remove this checklist.* 17 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/.github/ISSUE_TEMPLATE/question.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Question 3 | about: File an issue about unexplained behavior 4 | title: "[QUESTION] " 5 | --- 6 | 7 | If you have a question, please check the following first: 8 | 9 | 1. Check if your question has already been answered in the [FAQ][] section. 10 | 2. Make sure you've read the [documentation][]. Your issue may be addressed there. 11 | 3. If those resources didn't help and you only have a short question (not a bug report), consider asking in the [Gitter chat room][] 12 | 4. Search the [issue tracker][], including the closed issues, to see if your question has already been asked/answered. +1 or comment if it has been asked but has no answer. 13 | 5. If you have a more complex question which is not answered in the previous items (or not suitable for chat), please fill in the details below. 14 | 6. Include a self-contained and minimal piece of code that illustrates your question. If that's not possible, try to make the description as clear as possible. 15 | 16 | [FAQ]: http://pybind11.readthedocs.io/en/latest/faq.html 17 | [documentation]: https://pybind11.readthedocs.io 18 | [issue tracker]: https://github.com/pybind/pybind11/issues 19 | [Gitter chat room]: https://gitter.im/pybind/Lobby 20 | 21 | *After reading, remove this checklist.* 22 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | # Maintain dependencies for GitHub Actions 4 | - package-ecosystem: "github-actions" 5 | directory: "/" 6 | schedule: 7 | interval: "daily" 8 | ignore: 9 | # Offical actions have moving tags like v1 10 | # that are used, so they don't need updates here 11 | - dependency-name: "actions/*" 12 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/.github/labeler.yml: -------------------------------------------------------------------------------- 1 | docs: 2 | - any: 3 | - 'docs/**/*.rst' 4 | - '!docs/changelog.rst' 5 | - '!docs/upgrade.rst' 6 | 7 | ci: 8 | - '.github/workflows/*.yml' 9 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/.github/labeler_merged.yml: -------------------------------------------------------------------------------- 1 | needs changelog: 2 | - all: 3 | - '!docs/changelog.rst' 4 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | ## Description 2 | 3 | 4 | 5 | 6 | ## Suggested changelog entry: 7 | 8 | 9 | 10 | ```rst 11 | 12 | ``` 13 | 14 | 15 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/.github/workflows/format.yml: -------------------------------------------------------------------------------- 1 | # This is a format job. Pre-commit has a first-party GitHub action, so we use 2 | # that: https://github.com/pre-commit/action 3 | 4 | name: Format 5 | 6 | on: 7 | workflow_dispatch: 8 | pull_request: 9 | push: 10 | branches: 11 | - master 12 | - stable 13 | - "v*" 14 | 15 | jobs: 16 | pre-commit: 17 | name: Format 18 | runs-on: ubuntu-latest 19 | steps: 20 | - uses: actions/checkout@v2 21 | - uses: actions/setup-python@v2 22 | - uses: pre-commit/action@v2.0.0 23 | with: 24 | # Slow hooks are marked with manual - slow is okay here, run them too 25 | extra_args: --hook-stage manual --all-files 26 | 27 | clang-tidy: 28 | name: Clang-Tidy 29 | runs-on: ubuntu-latest 30 | container: silkeh/clang:10 31 | steps: 32 | - uses: actions/checkout@v2 33 | 34 | - name: Install requirements 35 | run: apt-get update && apt-get install -y python3-dev python3-pytest 36 | 37 | - name: Configure 38 | run: cmake -S . -B build -DCMAKE_CXX_CLANG_TIDY="$(which clang-tidy);--warnings-as-errors=*" 39 | 40 | - name: Build 41 | run: cmake --build build -j 2 42 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/.github/workflows/labeler.yml: -------------------------------------------------------------------------------- 1 | name: Labeler 2 | on: 3 | pull_request_target: 4 | 5 | jobs: 6 | label: 7 | name: Labeler 8 | runs-on: ubuntu-latest 9 | steps: 10 | 11 | - uses: actions/labeler@main 12 | with: 13 | repo-token: ${{ secrets.GITHUB_TOKEN }} 14 | sync-labels: true 15 | 16 | - uses: actions/labeler@main 17 | if: "github.event.action == 'closed' && github.event.pull_request.merged == true" 18 | with: 19 | repo-token: ${{ secrets.GITHUB_TOKEN }} 20 | configuration-path: .github/labeler_merged.yml 21 | sync-labels: true 22 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/.gitignore: -------------------------------------------------------------------------------- 1 | CMakeCache.txt 2 | CMakeFiles 3 | Makefile 4 | cmake_install.cmake 5 | cmake_uninstall.cmake 6 | .DS_Store 7 | *.so 8 | *.pyd 9 | *.dll 10 | *.sln 11 | *.sdf 12 | *.opensdf 13 | *.vcxproj 14 | *.vcxproj.user 15 | *.filters 16 | example.dir 17 | Win32 18 | x64 19 | Release 20 | Debug 21 | .vs 22 | CTestTestfile.cmake 23 | Testing 24 | autogen 25 | MANIFEST 26 | /.ninja_* 27 | /*.ninja 28 | /docs/.build 29 | *.py[co] 30 | *.egg-info 31 | *~ 32 | .*.swp 33 | .DS_Store 34 | /dist 35 | /*build* 36 | .cache/ 37 | sosize-*.txt 38 | pybind11Config*.cmake 39 | pybind11Targets.cmake 40 | /*env* 41 | /.vscode 42 | /pybind11/include/* 43 | /pybind11/share/* 44 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 Wenzel Jakob , All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are met: 5 | 6 | 1. Redistributions of source code must retain the above copyright notice, this 7 | list of conditions and the following disclaimer. 8 | 9 | 2. Redistributions in binary form must reproduce the above copyright notice, 10 | this list of conditions and the following disclaimer in the documentation 11 | and/or other materials provided with the distribution. 12 | 13 | 3. Neither the name of the copyright holder nor the names of its contributors 14 | may be used to endorse or promote products derived from this software 15 | without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 21 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 23 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 24 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 25 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | 28 | Please also refer to the file .github/CONTRIBUTING.md, which clarifies licensing of 29 | external contributions to this project including patches, pull requests, etc. 30 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/MANIFEST.in: -------------------------------------------------------------------------------- 1 | recursive-include pybind11/include/pybind11 *.h 2 | recursive-include pybind11 *.py 3 | recursive-include pybind11 py.typed 4 | recursive-include pybind11 *.pyi 5 | include pybind11/share/cmake/pybind11/*.cmake 6 | include LICENSE README.rst pyproject.toml setup.py setup.cfg 7 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/docs/Doxyfile: -------------------------------------------------------------------------------- 1 | PROJECT_NAME = pybind11 2 | INPUT = ../include/pybind11/ 3 | RECURSIVE = YES 4 | 5 | GENERATE_HTML = NO 6 | GENERATE_LATEX = NO 7 | GENERATE_XML = YES 8 | XML_OUTPUT = .build/doxygenxml 9 | XML_PROGRAMLISTING = YES 10 | 11 | MACRO_EXPANSION = YES 12 | EXPAND_ONLY_PREDEF = YES 13 | EXPAND_AS_DEFINED = PYBIND11_RUNTIME_EXCEPTION 14 | 15 | ALIASES = "rst=\verbatim embed:rst" 16 | ALIASES += "endrst=\endverbatim" 17 | 18 | QUIET = YES 19 | WARNINGS = YES 20 | WARN_IF_UNDOCUMENTED = NO 21 | PREDEFINED = DOXYGEN_SHOULD_SKIP_THIS \ 22 | PY_MAJOR_VERSION=3 \ 23 | PYBIND11_NOINLINE 24 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/docs/advanced/cast/index.rst: -------------------------------------------------------------------------------- 1 | .. _type-conversions: 2 | 3 | Type conversions 4 | ################ 5 | 6 | Apart from enabling cross-language function calls, a fundamental problem 7 | that a binding tool like pybind11 must address is to provide access to 8 | native Python types in C++ and vice versa. There are three fundamentally 9 | different ways to do this—which approach is preferable for a particular type 10 | depends on the situation at hand. 11 | 12 | 1. Use a native C++ type everywhere. In this case, the type must be wrapped 13 | using pybind11-generated bindings so that Python can interact with it. 14 | 15 | 2. Use a native Python type everywhere. It will need to be wrapped so that 16 | C++ functions can interact with it. 17 | 18 | 3. Use a native C++ type on the C++ side and a native Python type on the 19 | Python side. pybind11 refers to this as a *type conversion*. 20 | 21 | Type conversions are the most "natural" option in the sense that native 22 | (non-wrapped) types are used everywhere. The main downside is that a copy 23 | of the data must be made on every Python ↔ C++ transition: this is 24 | needed since the C++ and Python versions of the same type generally won't 25 | have the same memory layout. 26 | 27 | pybind11 can perform many kinds of conversions automatically. An overview 28 | is provided in the table ":ref:`conversion_table`". 29 | 30 | The following subsections discuss the differences between these options in more 31 | detail. The main focus in this section is on type conversions, which represent 32 | the last case of the above list. 33 | 34 | .. toctree:: 35 | :maxdepth: 1 36 | 37 | overview 38 | strings 39 | stl 40 | functional 41 | chrono 42 | eigen 43 | custom 44 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/docs/cmake/index.rst: -------------------------------------------------------------------------------- 1 | CMake helpers 2 | ------------- 3 | 4 | Pybind11 can be used with ``add_subdirectory(extern/pybind11)``, or from an 5 | install with ``find_package(pybind11 CONFIG)``. The interface provided in 6 | either case is functionally identical. 7 | 8 | .. cmake-module:: ../../tools/pybind11Config.cmake.in 9 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/docs/index.rst: -------------------------------------------------------------------------------- 1 | .. only:: latex 2 | 3 | Intro 4 | ===== 5 | 6 | .. include:: readme.rst 7 | 8 | .. only:: not latex 9 | 10 | Contents: 11 | 12 | .. toctree:: 13 | :maxdepth: 1 14 | 15 | changelog 16 | upgrade 17 | 18 | .. toctree:: 19 | :caption: The Basics 20 | :maxdepth: 2 21 | 22 | installing 23 | basics 24 | classes 25 | compiling 26 | 27 | .. toctree:: 28 | :caption: Advanced Topics 29 | :maxdepth: 2 30 | 31 | advanced/functions 32 | advanced/classes 33 | advanced/exceptions 34 | advanced/smart_ptrs 35 | advanced/cast/index 36 | advanced/pycpp/index 37 | advanced/embedding 38 | advanced/misc 39 | 40 | .. toctree:: 41 | :caption: Extra Information 42 | :maxdepth: 1 43 | 44 | faq 45 | benchmark 46 | limitations 47 | reference 48 | cmake/index 49 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/docs/requirements.txt: -------------------------------------------------------------------------------- 1 | breathe==4.20.0 2 | commonmark==0.9.1 3 | recommonmark==0.6.0 4 | sphinx==3.2.1 5 | sphinx_rtd_theme==0.5.0 6 | sphinxcontrib-moderncmakedomain==3.13 7 | sphinxcontrib-svg2pdfconverter==1.1.0 8 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/include/pybind11/detail/typeid.h: -------------------------------------------------------------------------------- 1 | /* 2 | pybind11/detail/typeid.h: Compiler-independent access to type identifiers 3 | 4 | Copyright (c) 2016 Wenzel Jakob 5 | 6 | All rights reserved. Use of this source code is governed by a 7 | BSD-style license that can be found in the LICENSE file. 8 | */ 9 | 10 | #pragma once 11 | 12 | #include 13 | #include 14 | 15 | #if defined(__GNUG__) 16 | #include 17 | #endif 18 | 19 | #include "common.h" 20 | 21 | PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE) 22 | PYBIND11_NAMESPACE_BEGIN(detail) 23 | /// Erase all occurrences of a substring 24 | inline void erase_all(std::string &string, const std::string &search) { 25 | for (size_t pos = 0;;) { 26 | pos = string.find(search, pos); 27 | if (pos == std::string::npos) break; 28 | string.erase(pos, search.length()); 29 | } 30 | } 31 | 32 | PYBIND11_NOINLINE inline void clean_type_id(std::string &name) { 33 | #if defined(__GNUG__) 34 | int status = 0; 35 | std::unique_ptr res { 36 | abi::__cxa_demangle(name.c_str(), nullptr, nullptr, &status), std::free }; 37 | if (status == 0) 38 | name = res.get(); 39 | #else 40 | detail::erase_all(name, "class "); 41 | detail::erase_all(name, "struct "); 42 | detail::erase_all(name, "enum "); 43 | #endif 44 | detail::erase_all(name, "pybind11::"); 45 | } 46 | PYBIND11_NAMESPACE_END(detail) 47 | 48 | /// Return a string representation of a C++ type 49 | template static std::string type_id() { 50 | std::string name(typeid(T).name()); 51 | detail::clean_type_id(name); 52 | return name; 53 | } 54 | 55 | PYBIND11_NAMESPACE_END(PYBIND11_NAMESPACE) 56 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/pybind11/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | from ._version import version_info, __version__ 4 | from .commands import get_include, get_cmake_dir 5 | 6 | 7 | __all__ = ( 8 | "version_info", 9 | "__version__", 10 | "get_include", 11 | "get_cmake_dir", 12 | ) 13 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/pybind11/__main__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from __future__ import print_function 3 | 4 | import argparse 5 | import sys 6 | import sysconfig 7 | 8 | from .commands import get_include, get_cmake_dir 9 | 10 | 11 | def print_includes(): 12 | # type: () -> None 13 | dirs = [ 14 | sysconfig.get_path("include"), 15 | sysconfig.get_path("platinclude"), 16 | get_include(), 17 | ] 18 | 19 | # Make unique but preserve order 20 | unique_dirs = [] 21 | for d in dirs: 22 | if d and d not in unique_dirs: 23 | unique_dirs.append(d) 24 | 25 | print(" ".join("-I" + d for d in unique_dirs)) 26 | 27 | 28 | def main(): 29 | # type: () -> None 30 | 31 | parser = argparse.ArgumentParser() 32 | parser.add_argument( 33 | "--includes", 34 | action="store_true", 35 | help="Include flags for both pybind11 and Python headers.", 36 | ) 37 | parser.add_argument( 38 | "--cmakedir", 39 | action="store_true", 40 | help="Print the CMake module directory, ideal for setting -Dpybind11_ROOT in CMake.", 41 | ) 42 | args = parser.parse_args() 43 | if not sys.argv[1:]: 44 | parser.print_help() 45 | if args.includes: 46 | print_includes() 47 | if args.cmakedir: 48 | print(get_cmake_dir()) 49 | 50 | 51 | if __name__ == "__main__": 52 | main() 53 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/pybind11/_version.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | 4 | def _to_int(s): 5 | try: 6 | return int(s) 7 | except ValueError: 8 | return s 9 | 10 | 11 | __version__ = "2.6.0" 12 | version_info = tuple(_to_int(s) for s in __version__.split(".")) 13 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/pybind11/_version.pyi: -------------------------------------------------------------------------------- 1 | from typing import Union, Tuple 2 | 3 | def _to_int(s: str) -> Union[int, str]: ... 4 | 5 | __version__: str 6 | version_info: Tuple[Union[int, str], ...] 7 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/pybind11/commands.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import os 3 | 4 | 5 | DIR = os.path.abspath(os.path.dirname(__file__)) 6 | 7 | 8 | def get_include(user=False): 9 | # type: (bool) -> str 10 | installed_path = os.path.join(DIR, "include") 11 | source_path = os.path.join(os.path.dirname(DIR), "include") 12 | return installed_path if os.path.exists(installed_path) else source_path 13 | 14 | 15 | def get_cmake_dir(): 16 | # type: () -> str 17 | cmake_installed_path = os.path.join(DIR, "share", "cmake", "pybind11") 18 | if os.path.exists(cmake_installed_path): 19 | return cmake_installed_path 20 | else: 21 | msg = "pybind11 not installed, installation required to access the CMake files" 22 | raise ImportError(msg) 23 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/pybind11/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/knx/764900e0c5251003eca22715991875ec88c45f64/examples/knxPython/pybind11/pybind11/py.typed -------------------------------------------------------------------------------- /examples/knxPython/pybind11/pybind11/setup_helpers.pyi: -------------------------------------------------------------------------------- 1 | # IMPORTANT: Should stay in sync with setup_helpers.py (mostly checked by CI / 2 | # pre-commit). 3 | 4 | from typing import Any, Iterator, Optional, Type, TypeVar, Union 5 | from types import TracebackType 6 | 7 | from distutils.command.build_ext import build_ext as _build_ext # type: ignore 8 | from distutils.extension import Extension as _Extension 9 | import distutils.ccompiler 10 | import contextlib 11 | 12 | WIN: bool 13 | PY2: bool 14 | MACOS: bool 15 | STD_TMPL: str 16 | 17 | class Pybind11Extension(_Extension): 18 | def _add_cflags(self, *flags: str) -> None: ... 19 | def _add_lflags(self, *flags: str) -> None: ... 20 | def __init__( 21 | self, *args: Any, cxx_std: int = 0, language: str = "c++", **kwargs: Any 22 | ) -> None: ... 23 | @property 24 | def cxx_std(self) -> int: ... 25 | @cxx_std.setter 26 | def cxx_std(self, level: int) -> None: ... 27 | 28 | @contextlib.contextmanager 29 | def tmp_chdir() -> Iterator[str]: ... 30 | def has_flag(compiler: distutils.ccompiler.CCompiler, flag: str) -> bool: ... 31 | def auto_cpp_level(compiler: distutils.ccompiler.CCompiler) -> Union[int, str]: ... 32 | 33 | class build_ext(_build_ext): # type: ignore 34 | def build_extensions(self) -> None: ... 35 | 36 | T = TypeVar("T", bound="ParallelCompile") 37 | 38 | class ParallelCompile: 39 | def __init__( 40 | self, envvar: Optional[str] = None, default: int = 0, max: int = 0 41 | ): ... 42 | def function(self) -> Any: ... 43 | def install(self: T) -> T: ... 44 | def __enter__(self: T) -> T: ... 45 | def __exit__( 46 | self, 47 | exc_type: Optional[Type[BaseException]], 48 | exc_value: Optional[BaseException], 49 | traceback: Optional[TracebackType], 50 | ) -> None: ... 51 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = ["setuptools>=42", "wheel", "cmake>=3.18", "ninja"] 3 | build-backend = "setuptools.build_meta" 4 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/setup.cfg: -------------------------------------------------------------------------------- 1 | [metadata] 2 | long_description = file: README.rst 3 | long_description_content_type = text/x-rst 4 | description = Seamless operability between C++11 and Python 5 | author = Wenzel Jakob 6 | author_email = wenzel.jakob@epfl.ch 7 | url = https://github.com/pybind/pybind11 8 | license = BSD 9 | 10 | classifiers = 11 | Development Status :: 5 - Production/Stable 12 | Intended Audience :: Developers 13 | Topic :: Software Development :: Libraries :: Python Modules 14 | Topic :: Utilities 15 | Programming Language :: C++ 16 | Programming Language :: Python :: 2.7 17 | Programming Language :: Python :: 3 18 | Programming Language :: Python :: 3.5 19 | Programming Language :: Python :: 3.6 20 | Programming Language :: Python :: 3.7 21 | Programming Language :: Python :: 3.8 22 | License :: OSI Approved :: BSD License 23 | Programming Language :: Python :: Implementation :: PyPy 24 | Programming Language :: Python :: Implementation :: CPython 25 | Programming Language :: C++ 26 | Topic :: Software Development :: Libraries :: Python Modules 27 | 28 | keywords = 29 | C++11 30 | Python bindings 31 | 32 | [options] 33 | python_requires = >=2.7, !=3.0, !=3.1, !=3.2, !=3.3, !=3.4 34 | zip_safe = False 35 | 36 | [bdist_wheel] 37 | universal=1 38 | 39 | [check-manifest] 40 | ignore = 41 | tests/** 42 | docs/** 43 | tools/** 44 | include/** 45 | .appveyor.yml 46 | .cmake-format.yaml 47 | .gitmodules 48 | .pre-commit-config.yaml 49 | .readthedocs.yml 50 | .clang-tidy 51 | pybind11/include/** 52 | pybind11/share/** 53 | CMakeLists.txt 54 | 55 | 56 | [flake8] 57 | max-line-length = 99 58 | show_source = True 59 | exclude = .git, __pycache__, build, dist, docs, tools, venv 60 | ignore = 61 | # required for pretty matrix formatting: multiple spaces after `,` and `[` 62 | E201, E241, W504, 63 | # camelcase 'cPickle' imported as lowercase 'pickle' 64 | N813 65 | # Black conflict 66 | W503, E203 67 | 68 | [mypy] 69 | files = pybind11 70 | strict = True 71 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/tests/cross_module_gil_utils.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | tests/cross_module_gil_utils.cpp -- tools for acquiring GIL from a different module 3 | 4 | Copyright (c) 2019 Google LLC 5 | 6 | All rights reserved. Use of this source code is governed by a 7 | BSD-style license that can be found in the LICENSE file. 8 | */ 9 | #include 10 | #include 11 | 12 | // This file mimics a DSO that makes pybind11 calls but does not define a 13 | // PYBIND11_MODULE. The purpose is to test that such a DSO can create a 14 | // py::gil_scoped_acquire when the running thread is in a GIL-released state. 15 | // 16 | // Note that we define a Python module here for convenience, but in general 17 | // this need not be the case. The typical scenario would be a DSO that implements 18 | // shared logic used internally by multiple pybind11 modules. 19 | 20 | namespace { 21 | 22 | namespace py = pybind11; 23 | void gil_acquire() { py::gil_scoped_acquire gil; } 24 | 25 | constexpr char kModuleName[] = "cross_module_gil_utils"; 26 | 27 | #if PY_MAJOR_VERSION >= 3 28 | struct PyModuleDef moduledef = { 29 | PyModuleDef_HEAD_INIT, 30 | kModuleName, 31 | NULL, 32 | 0, 33 | NULL, 34 | NULL, 35 | NULL, 36 | NULL, 37 | NULL 38 | }; 39 | #else 40 | PyMethodDef module_methods[] = { 41 | {NULL, NULL, 0, NULL} 42 | }; 43 | #endif 44 | 45 | } // namespace 46 | 47 | extern "C" PYBIND11_EXPORT 48 | #if PY_MAJOR_VERSION >= 3 49 | PyObject* PyInit_cross_module_gil_utils() 50 | #else 51 | void initcross_module_gil_utils() 52 | #endif 53 | { 54 | 55 | PyObject* m = 56 | #if PY_MAJOR_VERSION >= 3 57 | PyModule_Create(&moduledef); 58 | #else 59 | Py_InitModule(kModuleName, module_methods); 60 | #endif 61 | 62 | if (m != NULL) { 63 | static_assert( 64 | sizeof(&gil_acquire) == sizeof(void*), 65 | "Function pointer must have the same size as void*"); 66 | PyModule_AddObject(m, "gil_acquire_funcaddr", 67 | PyLong_FromVoidPtr(reinterpret_cast(&gil_acquire))); 68 | } 69 | 70 | #if PY_MAJOR_VERSION >= 3 71 | return m; 72 | #endif 73 | } 74 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/tests/env.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import platform 3 | import sys 4 | 5 | LINUX = sys.platform.startswith("linux") 6 | MACOS = sys.platform.startswith("darwin") 7 | WIN = sys.platform.startswith("win32") or sys.platform.startswith("cygwin") 8 | 9 | CPYTHON = platform.python_implementation() == "CPython" 10 | PYPY = platform.python_implementation() == "PyPy" 11 | 12 | PY2 = sys.version_info.major == 2 13 | 14 | PY = sys.version_info 15 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/tests/extra_python_package/pytest.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/knx/764900e0c5251003eca22715991875ec88c45f64/examples/knxPython/pybind11/tests/extra_python_package/pytest.ini -------------------------------------------------------------------------------- /examples/knxPython/pybind11/tests/extra_setuptools/pytest.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenKNX/knx/764900e0c5251003eca22715991875ec88c45f64/examples/knxPython/pybind11/tests/extra_setuptools/pytest.ini -------------------------------------------------------------------------------- /examples/knxPython/pybind11/tests/pytest.ini: -------------------------------------------------------------------------------- 1 | [pytest] 2 | minversion = 3.1 3 | norecursedirs = test_* extra_* 4 | xfail_strict = True 5 | addopts = 6 | # show summary of skipped tests 7 | -rs 8 | # capture only Python print and C++ py::print, but not C output (low-level Python errors) 9 | --capture=sys 10 | # enable all warnings 11 | -Wa 12 | filterwarnings = 13 | # make warnings into errors but ignore certain third-party extension issues 14 | error 15 | # importing scipy submodules on some version of Python 16 | ignore::ImportWarning 17 | # bogus numpy ABI warning (see numpy/#432) 18 | ignore:.*numpy.dtype size changed.*:RuntimeWarning 19 | ignore:.*numpy.ufunc size changed.*:RuntimeWarning 20 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/tests/requirements.txt: -------------------------------------------------------------------------------- 1 | --extra-index-url https://antocuni.github.io/pypy-wheels/manylinux2010/ 2 | numpy==1.16.6; python_version<"3.6" and sys_platform!="win32" 3 | numpy==1.18.0; platform_python_implementation=="PyPy" and sys_platform=="darwin" and python_version>="3.6" 4 | numpy==1.19.1; (platform_python_implementation!="PyPy" or sys_platform=="linux") and python_version>="3.6" and python_version<"3.9" 5 | pytest==4.6.9; python_version<"3.5" 6 | pytest==5.4.3; python_version>="3.5" 7 | scipy==1.2.3; (platform_python_implementation!="PyPy" or sys_platform=="linux") and python_version<"3.6" 8 | scipy==1.5.2; (platform_python_implementation!="PyPy" or sys_platform=="linux") and python_version>="3.6" and python_version<"3.9" 9 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/tests/test_async.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | tests/test_async.cpp -- __await__ support 3 | 4 | Copyright (c) 2019 Google Inc. 5 | 6 | All rights reserved. Use of this source code is governed by a 7 | BSD-style license that can be found in the LICENSE file. 8 | */ 9 | 10 | #include "pybind11_tests.h" 11 | 12 | TEST_SUBMODULE(async_module, m) { 13 | struct DoesNotSupportAsync {}; 14 | py::class_(m, "DoesNotSupportAsync") 15 | .def(py::init<>()); 16 | struct SupportsAsync {}; 17 | py::class_(m, "SupportsAsync") 18 | .def(py::init<>()) 19 | .def("__await__", [](const SupportsAsync& self) -> py::object { 20 | static_cast(self); 21 | py::object loop = py::module_::import("asyncio.events").attr("get_event_loop")(); 22 | py::object f = loop.attr("create_future")(); 23 | f.attr("set_result")(5); 24 | return f.attr("__await__")(); 25 | }); 26 | } 27 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/tests/test_async.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import pytest 3 | 4 | asyncio = pytest.importorskip("asyncio") 5 | m = pytest.importorskip("pybind11_tests.async_module") 6 | 7 | 8 | @pytest.fixture 9 | def event_loop(): 10 | loop = asyncio.new_event_loop() 11 | yield loop 12 | loop.close() 13 | 14 | 15 | async def get_await_result(x): 16 | return await x 17 | 18 | 19 | def test_await(event_loop): 20 | assert 5 == event_loop.run_until_complete(get_await_result(m.SupportsAsync())) 21 | 22 | 23 | def test_await_missing(event_loop): 24 | with pytest.raises(TypeError): 25 | event_loop.run_until_complete(get_await_result(m.DoesNotSupportAsync())) 26 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/tests/test_cmake_build/embed.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | namespace py = pybind11; 3 | 4 | PYBIND11_EMBEDDED_MODULE(test_cmake_build, m) { 5 | m.def("add", [](int i, int j) { return i + j; }); 6 | } 7 | 8 | int main(int argc, char *argv[]) { 9 | if (argc != 2) 10 | throw std::runtime_error("Expected test.py file as the first argument"); 11 | auto test_py_file = argv[1]; 12 | 13 | py::scoped_interpreter guard{}; 14 | 15 | auto m = py::module_::import("test_cmake_build"); 16 | if (m.attr("add")(1, 2).cast() != 3) 17 | throw std::runtime_error("embed.cpp failed"); 18 | 19 | py::module_::import("sys").attr("argv") = py::make_tuple("test.py", "embed.cpp"); 20 | py::eval_file(test_py_file, py::globals()); 21 | } 22 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/tests/test_cmake_build/installed_embed/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.4) 2 | 3 | # The `cmake_minimum_required(VERSION 3.4...3.18)` syntax does not work with 4 | # some versions of VS that have a patched CMake 3.11. This forces us to emulate 5 | # the behavior using the following workaround: 6 | if(${CMAKE_VERSION} VERSION_LESS 3.18) 7 | cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}) 8 | else() 9 | cmake_policy(VERSION 3.18) 10 | endif() 11 | 12 | project(test_installed_embed CXX) 13 | 14 | find_package(pybind11 CONFIG REQUIRED) 15 | message(STATUS "Found pybind11 v${pybind11_VERSION}: ${pybind11_INCLUDE_DIRS}") 16 | 17 | add_executable(test_installed_embed ../embed.cpp) 18 | target_link_libraries(test_installed_embed PRIVATE pybind11::embed) 19 | set_target_properties(test_installed_embed PROPERTIES OUTPUT_NAME test_cmake_build) 20 | 21 | # Do not treat includes from IMPORTED target as SYSTEM (Python headers in pybind11::embed). 22 | # This may be needed to resolve header conflicts, e.g. between Python release and debug headers. 23 | set_target_properties(test_installed_embed PROPERTIES NO_SYSTEM_FROM_IMPORTED ON) 24 | 25 | add_custom_target(check_installed_embed $ 26 | ${PROJECT_SOURCE_DIR}/../test.py) 27 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/tests/test_cmake_build/installed_function/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.4) 2 | project(test_installed_module CXX) 3 | 4 | # The `cmake_minimum_required(VERSION 3.4...3.18)` syntax does not work with 5 | # some versions of VS that have a patched CMake 3.11. This forces us to emulate 6 | # the behavior using the following workaround: 7 | if(${CMAKE_VERSION} VERSION_LESS 3.18) 8 | cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}) 9 | else() 10 | cmake_policy(VERSION 3.18) 11 | endif() 12 | 13 | project(test_installed_function CXX) 14 | 15 | find_package(pybind11 CONFIG REQUIRED) 16 | message( 17 | STATUS "Found pybind11 v${pybind11_VERSION} ${pybind11_VERSION_TYPE}: ${pybind11_INCLUDE_DIRS}") 18 | 19 | pybind11_add_module(test_installed_function SHARED NO_EXTRAS ../main.cpp) 20 | set_target_properties(test_installed_function PROPERTIES OUTPUT_NAME test_cmake_build) 21 | 22 | if(DEFINED Python_EXECUTABLE) 23 | set(_Python_EXECUTABLE "${Python_EXECUTABLE}") 24 | elseif(DEFINED PYTHON_EXECUTABLE) 25 | set(_Python_EXECUTABLE "${PYTHON_EXECUTABLE}") 26 | else() 27 | message(FATAL_ERROR "No Python executable defined (should not be possible at this stage)") 28 | endif() 29 | 30 | add_custom_target( 31 | check_installed_function 32 | ${CMAKE_COMMAND} 33 | -E 34 | env 35 | PYTHONPATH=$ 36 | ${_Python_EXECUTABLE} 37 | ${PROJECT_SOURCE_DIR}/../test.py 38 | ${PROJECT_NAME}) 39 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/tests/test_cmake_build/installed_target/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.4) 2 | 3 | # The `cmake_minimum_required(VERSION 3.4...3.18)` syntax does not work with 4 | # some versions of VS that have a patched CMake 3.11. This forces us to emulate 5 | # the behavior using the following workaround: 6 | if(${CMAKE_VERSION} VERSION_LESS 3.18) 7 | cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}) 8 | else() 9 | cmake_policy(VERSION 3.18) 10 | endif() 11 | 12 | project(test_installed_target CXX) 13 | 14 | find_package(pybind11 CONFIG REQUIRED) 15 | message(STATUS "Found pybind11 v${pybind11_VERSION}: ${pybind11_INCLUDE_DIRS}") 16 | 17 | add_library(test_installed_target MODULE ../main.cpp) 18 | 19 | target_link_libraries(test_installed_target PRIVATE pybind11::module) 20 | set_target_properties(test_installed_target PROPERTIES OUTPUT_NAME test_cmake_build) 21 | 22 | # Make sure result is, for example, test_installed_target.so, not libtest_installed_target.dylib 23 | pybind11_extension(test_installed_target) 24 | 25 | # Do not treat includes from IMPORTED target as SYSTEM (Python headers in pybind11::module). 26 | # This may be needed to resolve header conflicts, e.g. between Python release and debug headers. 27 | set_target_properties(test_installed_target PROPERTIES NO_SYSTEM_FROM_IMPORTED ON) 28 | 29 | if(DEFINED Python_EXECUTABLE) 30 | set(_Python_EXECUTABLE "${Python_EXECUTABLE}") 31 | elseif(DEFINED PYTHON_EXECUTABLE) 32 | set(_Python_EXECUTABLE "${PYTHON_EXECUTABLE}") 33 | else() 34 | message(FATAL_ERROR "No Python executable defined (should not be possible at this stage)") 35 | endif() 36 | 37 | add_custom_target( 38 | check_installed_target 39 | ${CMAKE_COMMAND} 40 | -E 41 | env 42 | PYTHONPATH=$ 43 | ${_Python_EXECUTABLE} 44 | ${PROJECT_SOURCE_DIR}/../test.py 45 | ${PROJECT_NAME}) 46 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/tests/test_cmake_build/subdirectory_embed/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.4) 2 | 3 | # The `cmake_minimum_required(VERSION 3.4...3.18)` syntax does not work with 4 | # some versions of VS that have a patched CMake 3.11. This forces us to emulate 5 | # the behavior using the following workaround: 6 | if(${CMAKE_VERSION} VERSION_LESS 3.18) 7 | cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}) 8 | else() 9 | cmake_policy(VERSION 3.18) 10 | endif() 11 | 12 | project(test_subdirectory_embed CXX) 13 | 14 | set(PYBIND11_INSTALL 15 | ON 16 | CACHE BOOL "") 17 | set(PYBIND11_EXPORT_NAME test_export) 18 | 19 | add_subdirectory(${PYBIND11_PROJECT_DIR} pybind11) 20 | 21 | # Test basic target functionality 22 | add_executable(test_subdirectory_embed ../embed.cpp) 23 | target_link_libraries(test_subdirectory_embed PRIVATE pybind11::embed) 24 | set_target_properties(test_subdirectory_embed PROPERTIES OUTPUT_NAME test_cmake_build) 25 | 26 | add_custom_target(check_subdirectory_embed $ 27 | ${PROJECT_SOURCE_DIR}/../test.py) 28 | 29 | # Test custom export group -- PYBIND11_EXPORT_NAME 30 | add_library(test_embed_lib ../embed.cpp) 31 | target_link_libraries(test_embed_lib PRIVATE pybind11::embed) 32 | 33 | install( 34 | TARGETS test_embed_lib 35 | EXPORT test_export 36 | ARCHIVE DESTINATION bin 37 | LIBRARY DESTINATION lib 38 | RUNTIME DESTINATION lib) 39 | install(EXPORT test_export DESTINATION lib/cmake/test_export/test_export-Targets.cmake) 40 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/tests/test_cmake_build/subdirectory_function/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.4) 2 | 3 | # The `cmake_minimum_required(VERSION 3.4...3.18)` syntax does not work with 4 | # some versions of VS that have a patched CMake 3.11. This forces us to emulate 5 | # the behavior using the following workaround: 6 | if(${CMAKE_VERSION} VERSION_LESS 3.18) 7 | cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}) 8 | else() 9 | cmake_policy(VERSION 3.18) 10 | endif() 11 | 12 | project(test_subdirectory_function CXX) 13 | 14 | add_subdirectory("${PYBIND11_PROJECT_DIR}" pybind11) 15 | pybind11_add_module(test_subdirectory_function ../main.cpp) 16 | set_target_properties(test_subdirectory_function PROPERTIES OUTPUT_NAME test_cmake_build) 17 | 18 | if(DEFINED Python_EXECUTABLE) 19 | set(_Python_EXECUTABLE "${Python_EXECUTABLE}") 20 | elseif(DEFINED PYTHON_EXECUTABLE) 21 | set(_Python_EXECUTABLE "${PYTHON_EXECUTABLE}") 22 | else() 23 | message(FATAL_ERROR "No Python executable defined (should not be possible at this stage)") 24 | endif() 25 | 26 | add_custom_target( 27 | check_subdirectory_function 28 | ${CMAKE_COMMAND} 29 | -E 30 | env 31 | PYTHONPATH=$ 32 | ${_Python_EXECUTABLE} 33 | ${PROJECT_SOURCE_DIR}/../test.py 34 | ${PROJECT_NAME}) 35 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/tests/test_cmake_build/subdirectory_target/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.4) 2 | 3 | # The `cmake_minimum_required(VERSION 3.4...3.18)` syntax does not work with 4 | # some versions of VS that have a patched CMake 3.11. This forces us to emulate 5 | # the behavior using the following workaround: 6 | if(${CMAKE_VERSION} VERSION_LESS 3.18) 7 | cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}) 8 | else() 9 | cmake_policy(VERSION 3.18) 10 | endif() 11 | 12 | project(test_subdirectory_target CXX) 13 | 14 | add_subdirectory(${PYBIND11_PROJECT_DIR} pybind11) 15 | 16 | add_library(test_subdirectory_target MODULE ../main.cpp) 17 | set_target_properties(test_subdirectory_target PROPERTIES OUTPUT_NAME test_cmake_build) 18 | 19 | target_link_libraries(test_subdirectory_target PRIVATE pybind11::module) 20 | 21 | # Make sure result is, for example, test_installed_target.so, not libtest_installed_target.dylib 22 | pybind11_extension(test_subdirectory_target) 23 | 24 | if(DEFINED Python_EXECUTABLE) 25 | set(_Python_EXECUTABLE "${Python_EXECUTABLE}") 26 | elseif(DEFINED PYTHON_EXECUTABLE) 27 | set(_Python_EXECUTABLE "${PYTHON_EXECUTABLE}") 28 | else() 29 | message(FATAL_ERROR "No Python executable defined (should not be possible at this stage)") 30 | endif() 31 | 32 | add_custom_target( 33 | check_subdirectory_target 34 | ${CMAKE_COMMAND} 35 | -E 36 | env 37 | PYTHONPATH=$ 38 | ${_Python_EXECUTABLE} 39 | ${PROJECT_SOURCE_DIR}/../test.py 40 | ${PROJECT_NAME}) 41 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/tests/test_cmake_build/test.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import sys 3 | import test_cmake_build 4 | 5 | assert test_cmake_build.add(1, 2) == 3 6 | print("{} imports, runs, and adds: 1 + 2 = 3".format(sys.argv[1])) 7 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/tests/test_constants_and_functions.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import pytest 3 | 4 | m = pytest.importorskip("pybind11_tests.constants_and_functions") 5 | 6 | 7 | def test_constants(): 8 | assert m.some_constant == 14 9 | 10 | 11 | def test_function_overloading(): 12 | assert m.test_function() == "test_function()" 13 | assert m.test_function(7) == "test_function(7)" 14 | assert m.test_function(m.MyEnum.EFirstEntry) == "test_function(enum=1)" 15 | assert m.test_function(m.MyEnum.ESecondEntry) == "test_function(enum=2)" 16 | 17 | assert m.test_function() == "test_function()" 18 | assert m.test_function("abcd") == "test_function(char *)" 19 | assert m.test_function(1, 1.0) == "test_function(int, float)" 20 | assert m.test_function(1, 1.0) == "test_function(int, float)" 21 | assert m.test_function(2.0, 2) == "test_function(float, int)" 22 | 23 | 24 | def test_bytes(): 25 | assert m.print_bytes(m.return_bytes()) == "bytes[1 0 2 0]" 26 | 27 | 28 | def test_exception_specifiers(): 29 | c = m.C() 30 | assert c.m1(2) == 1 31 | assert c.m2(3) == 1 32 | assert c.m3(5) == 2 33 | assert c.m4(7) == 3 34 | assert c.m5(10) == 5 35 | assert c.m6(14) == 8 36 | assert c.m7(20) == 13 37 | assert c.m8(29) == 21 38 | 39 | assert m.f1(33) == 34 40 | assert m.f2(53) == 55 41 | assert m.f3(86) == 89 42 | assert m.f4(140) == 144 43 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/tests/test_docstring_options.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from pybind11_tests import docstring_options as m 3 | 4 | 5 | def test_docstring_options(): 6 | # options.disable_function_signatures() 7 | assert not m.test_function1.__doc__ 8 | 9 | assert m.test_function2.__doc__ == "A custom docstring" 10 | 11 | # docstring specified on just the first overload definition: 12 | assert m.test_overloaded1.__doc__ == "Overload docstring" 13 | 14 | # docstring on both overloads: 15 | assert m.test_overloaded2.__doc__ == "overload docstring 1\noverload docstring 2" 16 | 17 | # docstring on only second overload: 18 | assert m.test_overloaded3.__doc__ == "Overload docstr" 19 | 20 | # options.enable_function_signatures() 21 | assert m.test_function3.__doc__.startswith("test_function3(a: int, b: int) -> None") 22 | 23 | assert m.test_function4.__doc__.startswith("test_function4(a: int, b: int) -> None") 24 | assert m.test_function4.__doc__.endswith("A custom docstring\n") 25 | 26 | # options.disable_function_signatures() 27 | # options.disable_user_defined_docstrings() 28 | assert not m.test_function5.__doc__ 29 | 30 | # nested options.enable_user_defined_docstrings() 31 | assert m.test_function6.__doc__ == "A custom docstring" 32 | 33 | # RAII destructor 34 | assert m.test_function7.__doc__.startswith("test_function7(a: int, b: int) -> None") 35 | assert m.test_function7.__doc__.endswith("A custom docstring\n") 36 | 37 | # Suppression of user-defined docstrings for non-function objects 38 | assert not m.DocstringTestFoo.__doc__ 39 | assert not m.DocstringTestFoo.value_prop.__doc__ 40 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/tests/test_embed/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if("${PYTHON_MODULE_EXTENSION}" MATCHES "pypy" OR "${Python_INTERPRETER_ID}" STREQUAL "PyPy") 2 | add_custom_target(cpptest) # Dummy target on PyPy. Embedding is not supported. 3 | set(_suppress_unused_variable_warning "${DOWNLOAD_CATCH}") 4 | return() 5 | endif() 6 | 7 | find_package(Catch 2.13.0) 8 | 9 | if(CATCH_FOUND) 10 | message(STATUS "Building interpreter tests using Catch v${CATCH_VERSION}") 11 | else() 12 | message(STATUS "Catch not detected. Interpreter tests will be skipped. Install Catch headers" 13 | " manually or use `cmake -DDOWNLOAD_CATCH=ON` to fetch them automatically.") 14 | return() 15 | endif() 16 | 17 | find_package(Threads REQUIRED) 18 | 19 | add_executable(test_embed catch.cpp test_interpreter.cpp) 20 | pybind11_enable_warnings(test_embed) 21 | 22 | target_link_libraries(test_embed PRIVATE pybind11::embed Catch2::Catch2 Threads::Threads) 23 | 24 | if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR) 25 | file(COPY test_interpreter.py DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") 26 | endif() 27 | 28 | add_custom_target( 29 | cpptest 30 | COMMAND "$" 31 | WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") 32 | 33 | pybind11_add_module(external_module THIN_LTO external_module.cpp) 34 | set_target_properties(external_module PROPERTIES LIBRARY_OUTPUT_DIRECTORY 35 | "${CMAKE_CURRENT_BINARY_DIR}") 36 | foreach(config ${CMAKE_CONFIGURATION_TYPES}) 37 | string(TOUPPER ${config} config) 38 | set_target_properties(external_module PROPERTIES LIBRARY_OUTPUT_DIRECTORY_${config} 39 | "${CMAKE_CURRENT_BINARY_DIR}") 40 | endforeach() 41 | add_dependencies(cpptest external_module) 42 | 43 | add_dependencies(check cpptest) 44 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/tests/test_embed/test_interpreter.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from widget_module import Widget 3 | 4 | 5 | class DerivedWidget(Widget): 6 | def __init__(self, message): 7 | super(DerivedWidget, self).__init__(message) 8 | 9 | def the_answer(self): 10 | return 42 11 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/tests/test_eval.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import os 3 | 4 | import pytest 5 | 6 | import env # noqa: F401 7 | 8 | from pybind11_tests import eval_ as m 9 | 10 | 11 | def test_evals(capture): 12 | with capture: 13 | assert m.test_eval_statements() 14 | assert capture == "Hello World!" 15 | 16 | assert m.test_eval() 17 | assert m.test_eval_single_statement() 18 | 19 | assert m.test_eval_failure() 20 | 21 | 22 | @pytest.mark.xfail("env.PYPY and not env.PY2", raises=RuntimeError) 23 | def test_eval_file(): 24 | filename = os.path.join(os.path.dirname(__file__), "test_eval_call.py") 25 | assert m.test_eval_file(filename) 26 | 27 | assert m.test_eval_file_failure() 28 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/tests/test_eval_call.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # This file is called from 'test_eval.py' 3 | 4 | if "call_test2" in locals(): 5 | call_test2(y) # noqa: F821 undefined name 6 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/tests/test_gil_scoped.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | tests/test_gil_scoped.cpp -- acquire and release gil 3 | 4 | Copyright (c) 2017 Borja Zarco (Google LLC) 5 | 6 | All rights reserved. Use of this source code is governed by a 7 | BSD-style license that can be found in the LICENSE file. 8 | */ 9 | 10 | #include "pybind11_tests.h" 11 | #include 12 | 13 | 14 | class VirtClass { 15 | public: 16 | virtual ~VirtClass() = default; 17 | VirtClass() = default; 18 | VirtClass(const VirtClass&) = delete; 19 | virtual void virtual_func() {} 20 | virtual void pure_virtual_func() = 0; 21 | }; 22 | 23 | class PyVirtClass : public VirtClass { 24 | void virtual_func() override { 25 | PYBIND11_OVERRIDE(void, VirtClass, virtual_func,); 26 | } 27 | void pure_virtual_func() override { 28 | PYBIND11_OVERRIDE_PURE(void, VirtClass, pure_virtual_func,); 29 | } 30 | }; 31 | 32 | TEST_SUBMODULE(gil_scoped, m) { 33 | py::class_(m, "VirtClass") 34 | .def(py::init<>()) 35 | .def("virtual_func", &VirtClass::virtual_func) 36 | .def("pure_virtual_func", &VirtClass::pure_virtual_func); 37 | 38 | m.def("test_callback_py_obj", 39 | [](py::object func) { func(); }); 40 | m.def("test_callback_std_func", 41 | [](const std::function &func) { func(); }); 42 | m.def("test_callback_virtual_func", 43 | [](VirtClass &virt) { virt.virtual_func(); }); 44 | m.def("test_callback_pure_virtual_func", 45 | [](VirtClass &virt) { virt.pure_virtual_func(); }); 46 | m.def("test_cross_module_gil", 47 | []() { 48 | auto cm = py::module_::import("cross_module_gil_utils"); 49 | auto gil_acquire = reinterpret_cast( 50 | PyLong_AsVoidPtr(cm.attr("gil_acquire_funcaddr").ptr())); 51 | py::gil_scoped_release gil_release; 52 | gil_acquire(); 53 | }); 54 | } 55 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/tests/test_opaque_types.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import pytest 3 | from pybind11_tests import opaque_types as m 4 | from pybind11_tests import ConstructorStats, UserType 5 | 6 | 7 | def test_string_list(): 8 | lst = m.StringList() 9 | lst.push_back("Element 1") 10 | lst.push_back("Element 2") 11 | assert m.print_opaque_list(lst) == "Opaque list: [Element 1, Element 2]" 12 | assert lst.back() == "Element 2" 13 | 14 | for i, k in enumerate(lst, start=1): 15 | assert k == "Element {}".format(i) 16 | lst.pop_back() 17 | assert m.print_opaque_list(lst) == "Opaque list: [Element 1]" 18 | 19 | cvp = m.ClassWithSTLVecProperty() 20 | assert m.print_opaque_list(cvp.stringList) == "Opaque list: []" 21 | 22 | cvp.stringList = lst 23 | cvp.stringList.push_back("Element 3") 24 | assert m.print_opaque_list(cvp.stringList) == "Opaque list: [Element 1, Element 3]" 25 | 26 | 27 | def test_pointers(msg): 28 | living_before = ConstructorStats.get(UserType).alive() 29 | assert m.get_void_ptr_value(m.return_void_ptr()) == 0x1234 30 | assert m.get_void_ptr_value(UserType()) # Should also work for other C++ types 31 | assert ConstructorStats.get(UserType).alive() == living_before 32 | 33 | with pytest.raises(TypeError) as excinfo: 34 | m.get_void_ptr_value([1, 2, 3]) # This should not work 35 | assert ( 36 | msg(excinfo.value) 37 | == """ 38 | get_void_ptr_value(): incompatible function arguments. The following argument types are supported: 39 | 1. (arg0: capsule) -> int 40 | 41 | Invoked with: [1, 2, 3] 42 | """ # noqa: E501 line too long 43 | ) 44 | 45 | assert m.return_null_str() is None 46 | assert m.get_null_str_value(m.return_null_str()) is not None 47 | 48 | ptr = m.return_unique_ptr() 49 | assert "StringList" in repr(ptr) 50 | assert m.print_opaque_list(ptr) == "Opaque list: [some value]" 51 | 52 | 53 | def test_unions(): 54 | int_float_union = m.IntFloat() 55 | int_float_union.i = 42 56 | assert int_float_union.i == 42 57 | int_float_union.f = 3.0 58 | assert int_float_union.f == 3.0 59 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/tests/test_pickling.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import pytest 3 | 4 | import env # noqa: F401 5 | 6 | from pybind11_tests import pickling as m 7 | 8 | try: 9 | import cPickle as pickle # Use cPickle on Python 2.7 10 | except ImportError: 11 | import pickle 12 | 13 | 14 | @pytest.mark.parametrize("cls_name", ["Pickleable", "PickleableNew"]) 15 | def test_roundtrip(cls_name): 16 | cls = getattr(m, cls_name) 17 | p = cls("test_value") 18 | p.setExtra1(15) 19 | p.setExtra2(48) 20 | 21 | data = pickle.dumps(p, 2) # Must use pickle protocol >= 2 22 | p2 = pickle.loads(data) 23 | assert p2.value() == p.value() 24 | assert p2.extra1() == p.extra1() 25 | assert p2.extra2() == p.extra2() 26 | 27 | 28 | @pytest.mark.xfail("env.PYPY") 29 | @pytest.mark.parametrize("cls_name", ["PickleableWithDict", "PickleableWithDictNew"]) 30 | def test_roundtrip_with_dict(cls_name): 31 | cls = getattr(m, cls_name) 32 | p = cls("test_value") 33 | p.extra = 15 34 | p.dynamic = "Attribute" 35 | 36 | data = pickle.dumps(p, pickle.HIGHEST_PROTOCOL) 37 | p2 = pickle.loads(data) 38 | assert p2.value == p.value 39 | assert p2.extra == p.extra 40 | assert p2.dynamic == p.dynamic 41 | 42 | 43 | def test_enum_pickle(): 44 | from pybind11_tests import enums as e 45 | 46 | data = pickle.dumps(e.EOne, 2) 47 | assert e.EOne == pickle.loads(data) 48 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/tests/test_tagbased_polymorphic.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from pybind11_tests import tagbased_polymorphic as m 3 | 4 | 5 | def test_downcast(): 6 | zoo = m.create_zoo() 7 | assert [type(animal) for animal in zoo] == [ 8 | m.Labrador, 9 | m.Dog, 10 | m.Chihuahua, 11 | m.Cat, 12 | m.Panther, 13 | ] 14 | assert [animal.name for animal in zoo] == [ 15 | "Fido", 16 | "Ginger", 17 | "Hertzl", 18 | "Tiger", 19 | "Leo", 20 | ] 21 | zoo[1].sound = "woooooo" 22 | assert [dog.bark() for dog in zoo[:3]] == [ 23 | "Labrador Fido goes WOOF!", 24 | "Dog Ginger goes woooooo", 25 | "Chihuahua Hertzl goes iyiyiyiyiyi and runs in circles", 26 | ] 27 | assert [cat.purr() for cat in zoo[3:]] == ["mrowr", "mrrrRRRRRR"] 28 | zoo[0].excitement -= 1000 29 | assert zoo[0].excitement == 14000 30 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/tests/test_union.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | tests/test_class.cpp -- test py::class_ definitions and basic functionality 3 | 4 | Copyright (c) 2019 Roland Dreier 5 | 6 | All rights reserved. Use of this source code is governed by a 7 | BSD-style license that can be found in the LICENSE file. 8 | */ 9 | 10 | #include "pybind11_tests.h" 11 | 12 | TEST_SUBMODULE(union_, m) { 13 | union TestUnion { 14 | int value_int; 15 | unsigned value_uint; 16 | }; 17 | 18 | py::class_(m, "TestUnion") 19 | .def(py::init<>()) 20 | .def_readonly("as_int", &TestUnion::value_int) 21 | .def_readwrite("as_uint", &TestUnion::value_uint); 22 | } 23 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/tests/test_union.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from pybind11_tests import union_ as m 3 | 4 | 5 | def test_union(): 6 | instance = m.TestUnion() 7 | 8 | instance.as_uint = 10 9 | assert instance.as_int == 10 10 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/tools/check-style.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Script to check include/test code for common pybind11 code style errors. 4 | # 5 | # This script currently checks for 6 | # 7 | # 1. missing space between keyword and parenthesis, e.g.: for(, if(, while( 8 | # 2. Missing space between right parenthesis and brace, e.g. 'for (...){' 9 | # 3. opening brace on its own line. It should always be on the same line as the 10 | # if/while/for/do statement. 11 | # 12 | # Invoke as: tools/check-style.sh 13 | # 14 | 15 | check_style_errors=0 16 | IFS=$'\n' 17 | 18 | 19 | found="$(grep '\<\(if\|for\|while\|catch\)(\|){' $@ -rn --color=always)" 20 | if [ -n "$found" ]; then 21 | echo -e '\033[31;01mError: found the following coding style problems:\033[0m' 22 | check_style_errors=1 23 | echo "$found" | sed -e 's/^/ /' 24 | fi 25 | 26 | found="$(awk ' 27 | function prefix(filename, lineno) { 28 | return " \033[35m" filename "\033[36m:\033[32m" lineno "\033[36m:\033[0m" 29 | } 30 | function mark(pattern, string) { sub(pattern, "\033[01;31m&\033[0m", string); return string } 31 | last && /^\s*{/ { 32 | print prefix(FILENAME, FNR-1) mark("\\)\\s*$", last) 33 | print prefix(FILENAME, FNR) mark("^\\s*{", $0) 34 | last="" 35 | } 36 | { last = /(if|for|while|catch|switch)\s*\(.*\)\s*$/ ? $0 : "" } 37 | ' $(find include -type f) $@)" 38 | if [ -n "$found" ]; then 39 | check_style_errors=1 40 | echo -e '\033[31;01mError: braces should occur on the same line as the if/while/.. statement. Found issues in the following files:\033[0m' 41 | echo "$found" 42 | fi 43 | 44 | exit $check_style_errors 45 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/tools/cmake_uninstall.cmake.in: -------------------------------------------------------------------------------- 1 | # Source: https://gitlab.kitware.com/cmake/community/-/wikis/FAQ#can-i-do-make-uninstall-with-cmake 2 | 3 | if(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt") 4 | message(FATAL_ERROR "Cannot find install manifest: @CMAKE_BINARY_DIR@/install_manifest.txt") 5 | endif() 6 | 7 | file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files) 8 | string(REGEX REPLACE "\n" ";" files "${files}") 9 | foreach(file ${files}) 10 | message(STATUS "Uninstalling $ENV{DESTDIR}${file}") 11 | if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") 12 | exec_program( 13 | "@CMAKE_COMMAND@" ARGS 14 | "-E remove \"$ENV{DESTDIR}${file}\"" 15 | OUTPUT_VARIABLE rm_out 16 | RETURN_VALUE rm_retval) 17 | if(NOT "${rm_retval}" STREQUAL 0) 18 | message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}") 19 | endif() 20 | else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") 21 | message(STATUS "File $ENV{DESTDIR}${file} does not exist.") 22 | endif() 23 | endforeach() 24 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/tools/libsize.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from __future__ import print_function, division 3 | import os 4 | import sys 5 | 6 | # Internal build script for generating debugging test .so size. 7 | # Usage: 8 | # python libsize.py file.so save.txt -- displays the size of file.so and, if save.txt exists, compares it to the 9 | # size in it, then overwrites save.txt with the new size for future runs. 10 | 11 | if len(sys.argv) != 3: 12 | sys.exit("Invalid arguments: usage: python libsize.py file.so save.txt") 13 | 14 | lib = sys.argv[1] 15 | save = sys.argv[2] 16 | 17 | if not os.path.exists(lib): 18 | sys.exit("Error: requested file ({}) does not exist".format(lib)) 19 | 20 | libsize = os.path.getsize(lib) 21 | 22 | print("------", os.path.basename(lib), "file size:", libsize, end="") 23 | 24 | if os.path.exists(save): 25 | with open(save) as sf: 26 | oldsize = int(sf.readline()) 27 | 28 | if oldsize > 0: 29 | change = libsize - oldsize 30 | if change == 0: 31 | print(" (no change)") 32 | else: 33 | print(" (change of {:+} bytes = {:+.2%})".format(change, change / oldsize)) 34 | else: 35 | print() 36 | 37 | with open(save, "w") as sf: 38 | sf.write(str(libsize)) 39 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/tools/pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = ["setuptools>=42", "wheel"] 3 | build-backend = "setuptools.build_meta" 4 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/tools/setup_global.py.in: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | # Setup script for pybind11-global (in the sdist or in tools/setup_global.py in the repository) 5 | # This package is targeted for easy use from CMake. 6 | 7 | import contextlib 8 | import glob 9 | import os 10 | import re 11 | import shutil 12 | import subprocess 13 | import sys 14 | import tempfile 15 | 16 | # Setuptools has to be before distutils 17 | from setuptools import setup 18 | 19 | from distutils.command.install_headers import install_headers 20 | 21 | class InstallHeadersNested(install_headers): 22 | def run(self): 23 | headers = self.distribution.headers or [] 24 | for header in headers: 25 | # Remove pybind11/include/ 26 | short_header = header.split("/", 2)[-1] 27 | 28 | dst = os.path.join(self.install_dir, os.path.dirname(short_header)) 29 | self.mkpath(dst) 30 | (out, _) = self.copy_file(header, dst) 31 | self.outfiles.append(out) 32 | 33 | 34 | main_headers = glob.glob("pybind11/include/pybind11/*.h") 35 | detail_headers = glob.glob("pybind11/include/pybind11/detail/*.h") 36 | cmake_files = glob.glob("pybind11/share/cmake/pybind11/*.cmake") 37 | headers = main_headers + detail_headers 38 | 39 | cmdclass = {"install_headers": InstallHeadersNested} 40 | $extra_cmd 41 | 42 | # This will _not_ affect installing from wheels, 43 | # only building wheels or installing from SDist. 44 | # Primarily intended on Windows, where this is sometimes 45 | # customized (for example, conda-forge uses Library/) 46 | base = os.environ.get("PYBIND11_GLOBAL_PREFIX", "") 47 | 48 | # Must have a separator 49 | if base and not base.endswith("/"): 50 | base += "/" 51 | 52 | setup( 53 | name="pybind11_global", 54 | version="$version", 55 | packages=[], 56 | headers=headers, 57 | data_files=[ 58 | (base + "share/cmake/pybind11", cmake_files), 59 | (base + "include/pybind11", main_headers), 60 | (base + "include/pybind11/detail", detail_headers), 61 | ], 62 | cmdclass=cmdclass, 63 | ) 64 | -------------------------------------------------------------------------------- /examples/knxPython/pybind11/tools/setup_main.py.in: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | # Setup script (in the sdist or in tools/setup_main.py in the repository) 5 | 6 | from setuptools import setup 7 | 8 | cmdclass = {} 9 | $extra_cmd 10 | 11 | setup( 12 | name="pybind11", 13 | version="$version", 14 | download_url='https://github.com/pybind/pybind11/tarball/v$version', 15 | packages=[ 16 | "pybind11", 17 | "pybind11.include.pybind11", 18 | "pybind11.include.pybind11.detail", 19 | "pybind11.share.cmake.pybind11", 20 | ], 21 | package_data={ 22 | "pybind11": ["py.typed", "*.pyi"], 23 | "pybind11.include.pybind11": ["*.h"], 24 | "pybind11.include.pybind11.detail": ["*.h"], 25 | "pybind11.share.cmake.pybind11": ["*.cmake"], 26 | }, 27 | extras_require={ 28 | "global": ["pybind11_global==$version"] 29 | }, 30 | entry_points={ 31 | "console_scripts": [ 32 | "pybind11-config = pybind11.__main__:main", 33 | ] 34 | }, 35 | cmdclass=cmdclass 36 | ) 37 | -------------------------------------------------------------------------------- /examples/knxPython/write_version_info.py: -------------------------------------------------------------------------------- 1 | import subprocess 2 | import time 3 | import sys 4 | import socket 5 | 6 | def get_version_info(): 7 | 8 | try: 9 | git_revision = subprocess.check_output(["git", "rev-parse", "HEAD"]).decode("utf-8") .split("\n")[0] 10 | git_branch = subprocess.check_output(["git", "rev-parse","--abbrev-ref", "HEAD"]).decode("utf-8").split("\n")[0] 11 | except (subprocess.CalledProcessError, OSError): 12 | git_revision = "" 13 | git_branch = "non-git" 14 | 15 | def read_version(): 16 | with open("VERSION") as f: 17 | return f.readline().strip() 18 | 19 | build_datetime = time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime()) 20 | version_number = read_version() 21 | 22 | hostname = socket.gethostname() 23 | 24 | return git_revision, git_branch, build_datetime, version_number, hostname 25 | 26 | def print_version_number(): 27 | sys.stdout.write(get_version_info()[3]) 28 | 29 | if __name__ =="__main__": 30 | 31 | output_file = sys.argv[1] 32 | with open(output_file, "w") as fout: 33 | fout.write("""#pragma once 34 | 35 | namespace knx{{ 36 | namespace version{{ 37 | 38 | auto constexpr git_revision = u8"{0}"; 39 | auto constexpr git_branch = u8"{1}"; 40 | auto constexpr build_datetime = u8"{2}"; 41 | auto constexpr version_number = u8"{3}"; 42 | auto constexpr build_hostname = u8"{4}"; 43 | 44 | 45 | }} 46 | }} 47 | 48 | """.format(*get_version_info())) 49 | 50 | -------------------------------------------------------------------------------- /examples/scripts/stm32rdu.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | from subprocess import run 3 | from datetime import datetime, timedelta 4 | from os.path import expanduser 5 | 6 | ocddir = expanduser("~/.platformio/packages/tool-openocd/") 7 | chip = "stm32f1x" 8 | 9 | def unlock(*args, **kwargs): 10 | print("Please connect the board within the next two minutes.") 11 | endtime = datetime.now() + timedelta(minutes = 1) 12 | ret = 1 13 | while ret != 0 and datetime.now() < endtime: 14 | ret = run(["bin/openocd", "-f", "interface/stlink.cfg", "-f", "target/" + chip + ".cfg", "-c", "init", "-c", "reset halt", "-c", chip + " unlock 0", "-c", "reset halt", "-c", "exit"], cwd = ocddir).returncode 15 | if ret != 0: 16 | print("Timeout") 17 | return ret 18 | 19 | try: 20 | Import("env") 21 | except NameError: 22 | import sys 23 | if len(sys.argv) > 1: 24 | chip = sys.argv[1] 25 | if len(sys.argv) > 2: 26 | ocddir = sys.argv[2] 27 | unlock(None, None) 28 | else: 29 | ocddir = env.PioPlatform().get_package_dir("tool-openocd") 30 | options = env.GetProjectOptions() 31 | for option in options: 32 | if "unlock_chip" == option[0]: 33 | chip = option[1] 34 | env.AddCustomTarget("unlock", None, unlock) 35 | -------------------------------------------------------------------------------- /library.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "knx", 3 | "version": "2.1.2", 4 | "dependencies": { 5 | }, 6 | "description": "knx stack", 7 | "homepage": "https://openknx.de", 8 | "authors": [ 9 | { 10 | "name": "Thomas Kunze" 11 | }, 12 | { 13 | "name": "OpenKNX", 14 | "email": "info@openknx.de", 15 | "url": "https://openknx.de", 16 | "maintainer": true 17 | } 18 | ], 19 | "repository": { 20 | "type": "git", 21 | "url": "https://github.com/OpenKNX/knx" 22 | } 23 | } -------------------------------------------------------------------------------- /library.properties: -------------------------------------------------------------------------------- 1 | name=knx 2 | version=2.1.2 3 | author=Thomas Kunze, the OpenKNX Team, et. al. 4 | maintainer=OpenKNX Team 5 | sentence=knx stack 6 | paragraph= 7 | category=Communication 8 | url=https://github.com/OpenKNX/knx 9 | architectures=* 10 | includes=knx.h -------------------------------------------------------------------------------- /platformio.ini: -------------------------------------------------------------------------------- 1 | ; PlatformIO Project Configuration File 2 | ; 3 | ; Build options: build flags, source filter 4 | ; Upload options: custom upload port, speed and extra flags 5 | ; Library options: dependencies, extra library storages 6 | ; Advanced options: extra scripting 7 | ; 8 | ; Please visit documentation for the other options and examples 9 | ; https://docs.platformio.org/page/projectconf.html 10 | 11 | [platformio] 12 | src_dir = examples/knx-demo 13 | 14 | 15 | [env] 16 | platform = atmelsam 17 | board = zeroUSB 18 | framework = arduino 19 | build_type = debug 20 | monitor_speed = 115200 21 | lib_ldf_mode = deep+ 22 | lib_extra_dirs = 23 | ${sysenv.USERPROFILE}/Documents/PlatformIO/Projects 24 | build_flags = 25 | -Wno-unknown-pragmas 26 | 27 | [env:build] 28 | -------------------------------------------------------------------------------- /src/arduino_platform.h: -------------------------------------------------------------------------------- 1 | #include "knx/platform.h" 2 | 3 | #include "Arduino.h" 4 | 5 | #ifndef KNX_DEBUG_SERIAL 6 | #define KNX_DEBUG_SERIAL Serial 7 | #endif 8 | 9 | class ArduinoPlatform : public Platform 10 | { 11 | public: 12 | ArduinoPlatform(); 13 | ArduinoPlatform(HardwareSerial* knxSerial); 14 | 15 | // basic stuff 16 | void fatalError(); 17 | 18 | //uart 19 | virtual void knxUart( HardwareSerial* serial); 20 | virtual HardwareSerial* knxUart(); 21 | virtual void setupUart(); 22 | virtual void closeUart(); 23 | virtual int uartAvailable(); 24 | virtual size_t writeUart(const uint8_t data); 25 | virtual size_t writeUart(const uint8_t* buffer, size_t size); 26 | virtual int readUart(); 27 | virtual size_t readBytesUart(uint8_t* buffer, size_t length); 28 | virtual void flushUart(); 29 | 30 | //spi 31 | #ifndef KNX_NO_SPI 32 | void setupSpi() override; 33 | void closeSpi() override; 34 | int readWriteSpi (uint8_t *data, size_t len) override; 35 | #endif 36 | #ifndef KNX_NO_PRINT 37 | static Stream* SerialDebug; 38 | #endif 39 | 40 | protected: 41 | HardwareSerial* _knxSerial; 42 | }; 43 | -------------------------------------------------------------------------------- /src/cc1310_platform.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef DeviceFamily_CC13X0 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | #include "knx/platform.h" 10 | 11 | class CC1310Platform : public Platform 12 | { 13 | public: 14 | CC1310Platform(); 15 | virtual ~CC1310Platform(); 16 | 17 | void init(); 18 | 19 | // basic stuff 20 | void restart() final; 21 | void fatalError() final; 22 | 23 | uint8_t* getEepromBuffer(uint32_t size) final; 24 | void commitToEeprom() final; 25 | }; 26 | 27 | #endif //DeviceFamily_CC13X0 28 | -------------------------------------------------------------------------------- /src/esp32_platform.h: -------------------------------------------------------------------------------- 1 | #ifdef ARDUINO_ARCH_ESP32 2 | #include "arduino_platform.h" 3 | #include 4 | #include 5 | 6 | 7 | class Esp32Platform : public ArduinoPlatform 8 | { 9 | public: 10 | Esp32Platform(); 11 | Esp32Platform(HardwareSerial* s); 12 | 13 | // uart 14 | void knxUartPins(int8_t rxPin, int8_t txPin); 15 | void setupUart() override; 16 | 17 | // ip stuff 18 | uint32_t currentIpAddress() override; 19 | uint32_t currentSubnetMask() override; 20 | uint32_t currentDefaultGateway() override; 21 | void macAddress(uint8_t* addr) override; 22 | 23 | // unique serial number 24 | uint32_t uniqueSerialNumber() override; 25 | 26 | // basic stuff 27 | void restart(); 28 | 29 | //multicast 30 | void setupMultiCast(uint32_t addr, uint16_t port) override; 31 | void closeMultiCast() override; 32 | bool sendBytesMultiCast(uint8_t* buffer, uint16_t len) override; 33 | int readBytesMultiCast(uint8_t* buffer, uint16_t maxLen) override; 34 | 35 | //unicast 36 | bool sendBytesUniCast(uint32_t addr, uint16_t port, uint8_t* buffer, uint16_t len) override; 37 | 38 | //memory 39 | uint8_t* getEepromBuffer(uint32_t size); 40 | void commitToEeprom(); 41 | private: 42 | WiFiUDP _udp; 43 | int8_t _rxPin = -1; 44 | int8_t _txPin = -1; 45 | }; 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /src/esp_platform.h: -------------------------------------------------------------------------------- 1 | #ifdef ARDUINO_ARCH_ESP8266 2 | #include "arduino_platform.h" 3 | #include 4 | #include 5 | 6 | 7 | class EspPlatform : public ArduinoPlatform 8 | { 9 | public: 10 | EspPlatform(); 11 | EspPlatform(HardwareSerial* s); 12 | 13 | // ip stuff 14 | uint32_t currentIpAddress() override; 15 | uint32_t currentSubnetMask() override; 16 | uint32_t currentDefaultGateway() override; 17 | void macAddress(uint8_t* addr) override; 18 | 19 | // unique serial number 20 | uint32_t uniqueSerialNumber() override; 21 | 22 | // basic stuff 23 | void restart(); 24 | 25 | //multicast 26 | void setupMultiCast(uint32_t addr, uint16_t port) override; 27 | void closeMultiCast() override; 28 | bool sendBytesMultiCast(uint8_t* buffer, uint16_t len) override; 29 | int readBytesMultiCast(uint8_t* buffer, uint16_t maxLen) override; 30 | 31 | //unicast 32 | bool sendBytesUniCast(uint32_t addr, uint16_t port, uint8_t* buffer, uint16_t len) override; 33 | 34 | //memory 35 | uint8_t* getEepromBuffer(uint32_t size); 36 | void commitToEeprom(); 37 | private: 38 | WiFiUDP _udp; 39 | uint32_t _multicastAddr; 40 | uint16_t _multicastPort; 41 | }; 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /src/knx/address_table_object.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "table_object.h" 4 | /** 5 | * This class represents the group address table. It provides a mapping between transport layer 6 | * service access points (TSAP) and group addresses. The TSAP can be imagined as an index to the array 7 | * of group addresses. 8 | * 9 | * See section 4.10 of @cite knx:3/5/1 for further details. 10 | * It implements realisation type 7 (see section 4.10.7 of @cite knx:3/5/1). 11 | */ 12 | class AddressTableObject : public TableObject 13 | { 14 | public: 15 | /** 16 | * The constructor. 17 | * 18 | * @param memory This parameter is only passed to the constructor of TableObject and is not used by this class. 19 | */ 20 | AddressTableObject(Memory& memory); 21 | const uint8_t* restore(const uint8_t* buffer) override; 22 | 23 | /** 24 | * returns the number of group addresses of the object. 25 | */ 26 | uint16_t entryCount(); 27 | /** 28 | * Get the group address mapped to a TSAP. 29 | * 30 | * @param tsap The TSAP of which to get the group address for. 31 | * 32 | * @return the groupAddress if found or zero if no group address was found. 33 | */ 34 | uint16_t getGroupAddress(uint16_t tsap); 35 | /** 36 | * Get the TSAP mapped to a group address. 37 | * 38 | * @param groupAddress the group address of which to get the TSAP for. 39 | * 40 | * @return the TSAP if found or zero if no tsap was found. 41 | */ 42 | uint16_t getTsap(uint16_t groupAddress); 43 | /** 44 | * Check if the address table contains a group address. 45 | * 46 | * @param groupAddress the group address to check 47 | * 48 | * @return true if the address table contains the group address, false otherwise 49 | */ 50 | bool contains(uint16_t groupAddress); 51 | 52 | protected: 53 | void beforeStateChange(LoadState& newState) override; 54 | 55 | private: 56 | uint16_t* _groupAddresses = 0; 57 | }; 58 | -------------------------------------------------------------------------------- /src/knx/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 | -------------------------------------------------------------------------------- /src/knx/apdu.cpp: -------------------------------------------------------------------------------- 1 | #include "apdu.h" 2 | #include "cemi_frame.h" 3 | #include "bits.h" 4 | 5 | APDU::APDU(uint8_t* data, CemiFrame& frame): _data(data), _frame(frame) 6 | { 7 | } 8 | 9 | ApduType APDU::type() 10 | { 11 | uint16_t apci; 12 | apci = getWord(_data); 13 | popWord(apci, _data); 14 | apci &= 0x3ff; 15 | if ((apci >> 6) < 11 && (apci >> 6) != 7) //short apci 16 | apci &= 0x3c0; 17 | return (ApduType)apci; 18 | } 19 | 20 | void APDU::type(ApduType atype) 21 | { 22 | // ApduType is in big endian so convert to host first, pushWord converts back 23 | pushWord((uint16_t)atype, _data); 24 | } 25 | 26 | uint8_t* APDU::data() 27 | { 28 | return _data + 1; 29 | } 30 | 31 | CemiFrame& APDU::frame() 32 | { 33 | return _frame; 34 | } 35 | 36 | uint8_t APDU::length() const 37 | { 38 | return _frame.npdu().octetCount(); 39 | } 40 | 41 | void APDU::printPDU() 42 | { 43 | print("APDU: "); 44 | print(type(), HEX); 45 | print(" "); 46 | print(_data[0] & 0x3, HEX); 47 | for (uint8_t i = 1; i < length() + 1; ++i) 48 | { 49 | if (i) print(" "); 50 | print(_data[i], HEX); 51 | } 52 | println(); 53 | } 54 | -------------------------------------------------------------------------------- /src/knx/apdu.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "knx_types.h" 5 | 6 | class CemiFrame; 7 | 8 | /** 9 | * This class represents an Application Protocol Data Unit. It is part of a CemiFrame. 10 | */ 11 | class APDU 12 | { 13 | friend class CemiFrame; 14 | 15 | public: 16 | /** 17 | * Get the type of the APDU. 18 | */ 19 | ApduType type(); 20 | /** 21 | * Set the type of the APDU. 22 | */ 23 | void type(ApduType atype); 24 | /** 25 | * Get a pointer to the data. 26 | */ 27 | uint8_t* data(); 28 | /** 29 | * Get the CemiFrame this APDU is part of. 30 | */ 31 | CemiFrame& frame(); 32 | /** 33 | * Get the length of the APDU. (This is actually the octet count of the NPDU.) 34 | */ 35 | uint8_t length() const; 36 | /** 37 | * Print the contents of the APDU to console. 38 | */ 39 | void printPDU(); 40 | 41 | protected: 42 | /** 43 | * The constructor. 44 | * @param data The data of the APDU. Encoding depends on the ::ApduType. The class doesn't 45 | * take possession of this pointer. 46 | * @param frame The CemiFrame this APDU is part of. 47 | */ 48 | APDU(uint8_t* data, CemiFrame& frame); 49 | 50 | private: 51 | uint8_t* _data = 0; 52 | CemiFrame& _frame; 53 | }; -------------------------------------------------------------------------------- /src/knx/application_program_object.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "table_object.h" 4 | #include "bits.h" 5 | 6 | class ApplicationProgramObject : public TableObject 7 | { 8 | public: 9 | ApplicationProgramObject(Memory& memory); 10 | uint8_t* save(uint8_t* buffer) override; 11 | const uint8_t* restore(const uint8_t* buffer) override; 12 | uint16_t saveSize() override; 13 | uint8_t* data(uint32_t addr); 14 | uint8_t getByte(uint32_t addr); 15 | uint16_t getWord(uint32_t addr); 16 | uint32_t getInt(uint32_t addr); 17 | double getFloat(uint32_t addr, ParameterFloatEncodings encoding); 18 | }; 19 | -------------------------------------------------------------------------------- /src/knx/association_table_object.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "table_object.h" 4 | 5 | class AssociationTableObject : public TableObject 6 | { 7 | public: 8 | AssociationTableObject(Memory& memory); 9 | 10 | const uint8_t* restore(const uint8_t* buffer) override; 11 | 12 | int32_t translateAsap(uint16_t asap); 13 | int32_t nextAsap(uint16_t tsap, uint16_t& startIdx); 14 | 15 | protected: 16 | void beforeStateChange(LoadState& newState) override; 17 | 18 | private: 19 | uint16_t entryCount(); 20 | uint16_t getTSAP(uint16_t idx); 21 | uint16_t getASAP(uint16_t idx); 22 | void prepareBinarySearch(); 23 | uint16_t* _tableData = 0; 24 | uint16_t sortedEntryCount; 25 | }; 26 | -------------------------------------------------------------------------------- /src/knx/bau07B0.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "config.h" 4 | #if MASK_VERSION == 0x07B0 5 | 6 | #include "bau_systemB_device.h" 7 | #include "tpuart_data_link_layer.h" 8 | #include "cemi_server.h" 9 | #include "cemi_server_object.h" 10 | 11 | class Bau07B0 : public BauSystemBDevice, public ITpUartCallBacks, public DataLinkLayerCallbacks 12 | { 13 | public: 14 | Bau07B0(Platform& platform); 15 | void loop() override; 16 | bool enabled() override; 17 | void enabled(bool value) override; 18 | 19 | TpUartDataLinkLayer* getDataLinkLayer(); 20 | protected: 21 | InterfaceObject* getInterfaceObject(uint8_t idx); 22 | InterfaceObject* getInterfaceObject(ObjectType objectType, uint8_t objectInstance); 23 | 24 | // For TP1 only 25 | bool isAckRequired(uint16_t address, bool isGrpAddr) override; 26 | 27 | private: 28 | TpUartDataLinkLayer _dlLayer; 29 | #ifdef USE_CEMI_SERVER 30 | CemiServer _cemiServer; 31 | CemiServerObject _cemiServerObject; 32 | #endif 33 | }; 34 | #endif 35 | -------------------------------------------------------------------------------- /src/knx/bau091A.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "config.h" 4 | #if MASK_VERSION == 0x091A 5 | 6 | #include "bau_systemB_coupler.h" 7 | #include "router_object.h" 8 | #include "ip_parameter_object.h" 9 | #include "ip_data_link_layer.h" 10 | #include "tpuart_data_link_layer.h" 11 | #include "cemi_server_object.h" 12 | 13 | class Bau091A : public BauSystemBCoupler, public ITpUartCallBacks, public DataLinkLayerCallbacks 14 | { 15 | public: 16 | Bau091A(Platform& platform); 17 | void loop() override; 18 | bool enabled() override; 19 | void enabled(bool value) override; 20 | 21 | IpDataLinkLayer* getPrimaryDataLinkLayer(); 22 | TpUartDataLinkLayer* getSecondaryDataLinkLayer(); 23 | protected: 24 | InterfaceObject* getInterfaceObject(uint8_t idx); 25 | InterfaceObject* getInterfaceObject(ObjectType objectType, uint8_t objectInstance); 26 | 27 | // For TP1 only 28 | bool isAckRequired(uint16_t address, bool isGrpAddr) override; 29 | 30 | void doMasterReset(EraseCode eraseCode, uint8_t channel) override; 31 | private: 32 | RouterObject _routerObj; 33 | IpParameterObject _ipParameters; 34 | IpDataLinkLayer _dlLayerPrimary; 35 | TpUartDataLinkLayer _dlLayerSecondary; 36 | #ifdef USE_CEMI_SERVER 37 | CemiServer _cemiServer; 38 | CemiServerObject _cemiServerObject; 39 | #endif 40 | }; 41 | #endif 42 | -------------------------------------------------------------------------------- /src/knx/bau27B0.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "config.h" 4 | #if MASK_VERSION == 0x27B0 5 | 6 | #include "bau_systemB_device.h" 7 | #include "rf_medium_object.h" 8 | #if defined(DeviceFamily_CC13X0) 9 | #include "rf_physical_layer_cc1310.h" 10 | #else 11 | #include "rf_physical_layer_cc1101.h" 12 | #endif 13 | #include "rf_data_link_layer.h" 14 | #include "cemi_server.h" 15 | #include "cemi_server_object.h" 16 | 17 | class Bau27B0 : public BauSystemBDevice 18 | { 19 | public: 20 | Bau27B0(Platform& platform); 21 | void loop() override; 22 | bool enabled() override; 23 | void enabled(bool value) override; 24 | 25 | RfDataLinkLayer* getDataLinkLayer(); 26 | protected: 27 | InterfaceObject* getInterfaceObject(uint8_t idx); 28 | InterfaceObject* getInterfaceObject(ObjectType objectType, uint8_t objectInstance); 29 | 30 | void doMasterReset(EraseCode eraseCode, uint8_t channel) override; 31 | private: 32 | RfDataLinkLayer _dlLayer; 33 | RfMediumObject _rfMediumObj; 34 | #ifdef USE_CEMI_SERVER 35 | CemiServer _cemiServer; 36 | CemiServerObject _cemiServerObject; 37 | #endif 38 | 39 | void domainAddressSerialNumberWriteIndication(Priority priority, HopCountType hopType, const SecurityControl &secCtrl, const uint8_t* rfDoA, 40 | const uint8_t* knxSerialNumber) override; 41 | void domainAddressSerialNumberReadIndication(Priority priority, HopCountType hopType, const SecurityControl &secCtrl, const uint8_t* knxSerialNumber) override; 42 | void individualAddressSerialNumberReadIndication(Priority priority, HopCountType hopType, const SecurityControl &secCtrl, uint8_t* knxSerialNumber) override; 43 | void domainAddressSerialNumberWriteLocalConfirm(Priority priority, HopCountType hopType, const SecurityControl &secCtrl, const uint8_t* rfDoA, 44 | const uint8_t* knxSerialNumber, bool status) override; 45 | void domainAddressSerialNumberReadLocalConfirm(Priority priority, HopCountType hopType, const SecurityControl &secCtrl, const uint8_t* knxSerialNumber, bool status) override; 46 | }; 47 | #endif 48 | -------------------------------------------------------------------------------- /src/knx/bau2920.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "config.h" 4 | #if MASK_VERSION == 0x2920 5 | 6 | #include "bau_systemB_coupler.h" 7 | #include "tpuart_data_link_layer.h" 8 | #if defined(DeviceFamily_CC13X0) 9 | #include "rf_physical_layer_cc1310.h" 10 | #else 11 | #include "rf_physical_layer_cc1101.h" 12 | #endif 13 | #include "rf_data_link_layer.h" 14 | #include "rf_medium_object.h" 15 | #include "cemi_server_object.h" 16 | 17 | class Bau2920 : public BauSystemBCoupler 18 | { 19 | public: 20 | Bau2920(Platform& platform); 21 | void loop() override; 22 | bool enabled() override; 23 | void enabled(bool value) override; 24 | 25 | TpUartDataLinkLayer* getPrimaryDataLinkLayer(); 26 | RfDataLinkLayer* getSecondaryDataLinkLayer(); 27 | protected: 28 | InterfaceObject* getInterfaceObject(uint8_t idx); 29 | InterfaceObject* getInterfaceObject(ObjectType objectType, uint8_t objectInstance); 30 | 31 | void doMasterReset(EraseCode eraseCode, uint8_t channel) override; 32 | private: 33 | RouterObject _rtObjPrimary; 34 | RouterObject _rtObjSecondary; 35 | RfMediumObject _rfMediumObject; 36 | TpUartDataLinkLayer _dlLayerPrimary; 37 | RfDataLinkLayer _dlLayerSecondary; 38 | #ifdef USE_CEMI_SERVER 39 | CemiServer _cemiServer; 40 | CemiServerObject _cemiServerObject; 41 | #endif 42 | }; 43 | #endif 44 | -------------------------------------------------------------------------------- /src/knx/bau57B0.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "config.h" 4 | #if MASK_VERSION == 0x57B0 5 | 6 | #include "bau_systemB_device.h" 7 | #include "ip_parameter_object.h" 8 | #include "ip_data_link_layer.h" 9 | #include "cemi_server_object.h" 10 | 11 | class Bau57B0 : public BauSystemBDevice, public DataLinkLayerCallbacks 12 | { 13 | public: 14 | Bau57B0(Platform& platform); 15 | void loop() override; 16 | bool enabled() override; 17 | void enabled(bool value) override; 18 | 19 | IpDataLinkLayer* getDataLinkLayer(); 20 | protected: 21 | InterfaceObject* getInterfaceObject(uint8_t idx); 22 | InterfaceObject* getInterfaceObject(ObjectType objectType, uint8_t objectInstance); 23 | 24 | void doMasterReset(EraseCode eraseCode, uint8_t channel) override; 25 | private: 26 | IpParameterObject _ipParameters; 27 | IpDataLinkLayer _dlLayer; 28 | #ifdef USE_CEMI_SERVER 29 | CemiServer _cemiServer; 30 | CemiServerObject _cemiServerObject; 31 | #endif 32 | }; 33 | #endif 34 | -------------------------------------------------------------------------------- /src/knx/bau_systemB_coupler.cpp: -------------------------------------------------------------------------------- 1 | #include "bau_systemB_coupler.h" 2 | #include "bits.h" 3 | #include 4 | #include 5 | 6 | BauSystemBCoupler::BauSystemBCoupler(Platform& platform) : 7 | BauSystemB(platform), 8 | _platform(platform), 9 | #ifdef USE_DATASECURE 10 | _appLayer(_deviceObj, _secIfObj, *this), 11 | #else 12 | _appLayer(*this), 13 | #endif 14 | _transLayer(_appLayer), 15 | _netLayer(_deviceObj, _transLayer) 16 | { 17 | _appLayer.transportLayer(_transLayer); 18 | _transLayer.networkLayer(_netLayer); 19 | _memory.addSaveRestore(&_deviceObj); 20 | _memory.addSaveRestore(&_appProgram); 21 | #ifdef USE_DATASECURE 22 | _memory.addSaveRestore(&_secIfObj); 23 | #endif 24 | } 25 | 26 | ApplicationLayer& BauSystemBCoupler::applicationLayer() 27 | { 28 | return _appLayer; 29 | } 30 | 31 | void BauSystemBCoupler::loop() 32 | { 33 | _transLayer.loop(); 34 | #ifdef USE_DATASECURE 35 | _appLayer.loop(); 36 | #endif 37 | } 38 | 39 | bool BauSystemBCoupler::configured() 40 | { 41 | // _configured is set to true initially, if the device was configured with ETS it will be set to true after restart 42 | 43 | if (!_configured) 44 | return false; 45 | 46 | _configured = _appProgram.loadState() == LS_LOADED; 47 | #ifdef USE_DATASECURE 48 | _configured &= _secIfObj.loadState() == LS_LOADED; 49 | #endif 50 | 51 | return _configured; 52 | } 53 | 54 | void BauSystemBCoupler::doMasterReset(EraseCode eraseCode, uint8_t channel) 55 | { 56 | BauSystemB::doMasterReset(eraseCode, channel); 57 | 58 | #ifdef USE_DATASECURE 59 | _secIfObj.masterReset(eraseCode, channel); 60 | #endif 61 | } 62 | -------------------------------------------------------------------------------- /src/knx/bau_systemB_coupler.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "config.h" 4 | #include "bau_systemB.h" 5 | #include "device_object.h" 6 | #include "security_interface_object.h" 7 | #include "application_program_object.h" 8 | #include "router_object.h" 9 | #include "application_layer.h" 10 | #include "secure_application_layer.h" 11 | #include "transport_layer.h" 12 | #include "network_layer_coupler.h" 13 | #include "data_link_layer.h" 14 | #include "platform.h" 15 | #include "memory.h" 16 | 17 | class BauSystemBCoupler : public BauSystemB 18 | { 19 | public: 20 | BauSystemBCoupler(Platform& platform); 21 | void loop() override; 22 | bool configured() override; 23 | 24 | protected: 25 | ApplicationLayer& applicationLayer() override; 26 | 27 | void doMasterReset(EraseCode eraseCode, uint8_t channel) override; 28 | 29 | Platform& _platform; 30 | 31 | #ifdef USE_DATASECURE 32 | SecureApplicationLayer _appLayer; 33 | SecurityInterfaceObject _secIfObj; 34 | #else 35 | ApplicationLayer _appLayer; 36 | #endif 37 | TransportLayer _transLayer; 38 | NetworkLayerCoupler _netLayer; 39 | bool _configured = true; 40 | }; 41 | -------------------------------------------------------------------------------- /src/knx/callback_property.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "property.h" 4 | 5 | class InterfaceObject; 6 | 7 | template class CallbackProperty : public Property 8 | { 9 | public: 10 | CallbackProperty(T* io, PropertyID id, bool writeEnable, PropertyDataType type, uint16_t maxElements, 11 | uint8_t access, uint8_t (*readCallback)(T*, uint16_t, uint8_t, uint8_t*), 12 | uint8_t (*writeCallback)(T*, uint16_t, uint8_t, const uint8_t*)) 13 | : Property(id, writeEnable, type, maxElements, access), 14 | _interfaceObject(io), _readCallback(readCallback), _writeCallback(writeCallback) 15 | {} 16 | CallbackProperty(T* io, PropertyID id, bool writeEnable, PropertyDataType type, uint16_t maxElements, 17 | uint8_t access, uint8_t (*readCallback)(T*, uint16_t, uint8_t, uint8_t*)) 18 | : Property(id, writeEnable, type, maxElements, access), _interfaceObject(io), _readCallback(readCallback) 19 | {} 20 | 21 | uint8_t read(uint16_t start, uint8_t count, uint8_t* data) const override 22 | { 23 | if (count == 0 || _readCallback == nullptr || start > _maxElements || start + count > _maxElements + 1) 24 | return 0; 25 | 26 | return _readCallback(_interfaceObject, start, count, data); 27 | } 28 | uint8_t write(uint16_t start, uint8_t count, const uint8_t* data) override 29 | { 30 | if (count == 0 || start > _maxElements || start + count > _maxElements + 1 || _writeCallback == nullptr) 31 | return 0; 32 | return _writeCallback(_interfaceObject, start, count, data); 33 | } 34 | private: 35 | T* _interfaceObject = nullptr; 36 | uint8_t (*_readCallback)(T*, uint16_t, uint8_t, uint8_t*) = nullptr; 37 | uint8_t (*_writeCallback)(T*, uint16_t, uint8_t, const uint8_t*) = nullptr; 38 | }; 39 | -------------------------------------------------------------------------------- /src/knx/cemi_server.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "config.h" 4 | #ifdef USE_CEMI_SERVER 5 | 6 | #include 7 | #include "knx_types.h" 8 | #include "usb_tunnel_interface.h" 9 | 10 | class BauSystemB; 11 | class DataLinkLayer; 12 | class CemiFrame; 13 | 14 | /** 15 | * This is an implementation of the cEMI server as specified in @cite knx:3/6/3. 16 | * Overview on page 57. 17 | * It provides methods for the BusAccessUnit to do different things and translates this 18 | * call to an cEMI frame and calls the correct method of the data link layer. 19 | * It also takes calls from data link layer, decodes the submitted cEMI frames and calls the corresponding 20 | * methods of the BusAccessUnit class. 21 | */ 22 | class CemiServer 23 | { 24 | public: 25 | /** 26 | * The constructor. 27 | * @param bau methods are called here depending of the content of the APDU 28 | */ 29 | CemiServer(BauSystemB& bau); 30 | 31 | void dataLinkLayer(DataLinkLayer& layer); 32 | 33 | // from data link layer 34 | // Only L_Data service 35 | void dataIndicationToTunnel(CemiFrame& frame); 36 | void dataConfirmationToTunnel(CemiFrame& frame); 37 | 38 | // From tunnel interface 39 | void frameReceived(CemiFrame& frame); 40 | 41 | uint16_t clientAddress() const; 42 | void clientAddress(uint16_t value); 43 | 44 | void loop(); 45 | 46 | private: 47 | uint16_t _clientAddress = 0; 48 | uint8_t _frameNumber = 0; 49 | 50 | DataLinkLayer* _dataLinkLayer = nullptr; 51 | BauSystemB& _bau; 52 | UsbTunnelInterface _usbTunnelInterface; 53 | }; 54 | 55 | #endif -------------------------------------------------------------------------------- /src/knx/cemi_server_object.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "config.h" 4 | #ifdef USE_CEMI_SERVER 5 | 6 | #include "interface_object.h" 7 | 8 | class CemiServerObject: public InterfaceObject 9 | { 10 | public: 11 | CemiServerObject(); 12 | 13 | void setMediumTypeAsSupported(DptMedium dptMedium); 14 | void clearSupportedMediaTypes(); 15 | }; 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /src/knx/data_link_layer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "config.h" 4 | 5 | #include 6 | #include "device_object.h" 7 | #include "knx_types.h" 8 | #include "network_layer_entity.h" 9 | #include "cemi_server.h" 10 | 11 | class Platform; 12 | 13 | typedef void (*ActivityCallback)(uint8_t info); 14 | 15 | class DataLinkLayerCallbacks 16 | { 17 | protected: 18 | ActivityCallback _activityCallback = nullptr; 19 | public: 20 | virtual ~DataLinkLayerCallbacks() = default; 21 | virtual void activity(uint8_t info); 22 | virtual void setActivityCallback(ActivityCallback activityCallback); 23 | }; 24 | 25 | class DataLinkLayer 26 | { 27 | public: 28 | DataLinkLayer(DeviceObject& devObj, NetworkLayerEntity& netLayerEntity, 29 | Platform& platform); 30 | 31 | #ifdef USE_CEMI_SERVER 32 | // from tunnel 33 | void cemiServer(CemiServer& cemiServer); 34 | void dataRequestFromTunnel(CemiFrame& frame); 35 | #endif 36 | 37 | // from network layer 38 | void dataRequest(AckType ack, AddressType addrType, uint16_t destinationAddr, uint16_t sourceAddr, FrameFormat format, 39 | Priority priority, NPDU& npdu); 40 | void systemBroadcastRequest(AckType ack, FrameFormat format, Priority priority, NPDU& npdu, uint16_t sourceAddr); 41 | virtual void loop() = 0; 42 | virtual void enabled(bool value) = 0; 43 | virtual bool enabled() const = 0; 44 | virtual DptMedium mediumType() const = 0; 45 | 46 | protected: 47 | void frameReceived(CemiFrame& frame); 48 | void dataConReceived(CemiFrame& frame, bool success); 49 | bool sendTelegram(NPDU& npdu, AckType ack, uint16_t destinationAddr, AddressType addrType, uint16_t sourceAddr, FrameFormat format, Priority priority, SystemBroadcast systemBroadcast); 50 | virtual bool sendFrame(CemiFrame& frame) = 0; 51 | uint8_t* frameData(CemiFrame& frame); 52 | DeviceObject& _deviceObject; 53 | NetworkLayerEntity& _networkLayerEntity; 54 | Platform& _platform; 55 | #ifdef USE_CEMI_SERVER 56 | CemiServer* _cemiServer; 57 | #endif 58 | #ifdef KNX_ACTIVITYCALLBACK 59 | uint8_t _netIndex = 0; 60 | #endif 61 | }; 62 | -------------------------------------------------------------------------------- /src/knx/data_property.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "property.h" 4 | 5 | class DataProperty : public Property 6 | { 7 | public: 8 | DataProperty(PropertyID id, bool writeEnable, PropertyDataType type, uint16_t maxElements, uint8_t access); 9 | DataProperty(PropertyID id, bool writeEnable, PropertyDataType type, uint16_t maxElements, uint8_t access, uint8_t value); 10 | DataProperty(PropertyID id, bool writeEnable, PropertyDataType type, uint16_t maxElements, uint8_t access, uint16_t value); 11 | DataProperty(PropertyID id, bool writeEnable, PropertyDataType type, uint16_t maxElements, uint8_t access, uint32_t value); 12 | DataProperty(PropertyID id, bool writeEnable, PropertyDataType type, uint16_t maxElements, uint8_t access, const uint8_t* value); 13 | ~DataProperty() override; 14 | uint8_t read(uint16_t start, uint8_t count, uint8_t* data) const override; 15 | uint8_t write(uint16_t start, uint8_t count, const uint8_t* data) override; 16 | uint8_t* save(uint8_t* buffer) override; 17 | const uint8_t* restore(const uint8_t* buffer) override; 18 | uint16_t saveSize() override; 19 | const uint8_t* data(); 20 | const uint8_t* data(uint16_t elementIndex); 21 | 22 | private: 23 | uint16_t _currentElements = 0; 24 | uint8_t* _data = nullptr; 25 | }; 26 | -------------------------------------------------------------------------------- /src/knx/datapoint_types.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * datapoint_types.h - Conversion functions for datapoint types. 3 | * 4 | * Copyright (c) 2014 Stefan Taferner 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License version 3 as 8 | * published by the Free Software Foundation. 9 | */ 10 | 11 | #include "datapoint_types.h" 12 | #include 13 | 14 | // Sign for a negative DPT9 float value 15 | #define DPT_FLOAT_NEG_SIGN 0x8000 16 | 17 | 18 | uint16_t dptToFloat(int32_t value) 19 | { 20 | uint16_t exp = 0; 21 | 22 | if (value < -67108864 || value > 67076096) 23 | return 0x7fff; 24 | 25 | if (value < 0) 26 | { 27 | while (value < -2048) 28 | { 29 | value >>= 1; 30 | ++exp; 31 | } 32 | 33 | return DPT_FLOAT_NEG_SIGN | (((int32_t) value) & 2047) | (exp << 11); 34 | } 35 | else 36 | { 37 | while (value > 2047) 38 | { 39 | value >>= 1; 40 | ++exp; 41 | } 42 | 43 | return value | (exp << 11); 44 | } 45 | } 46 | 47 | int32_t dptFromFloat(uint16_t dptValue) 48 | { 49 | uint16_t exp = (dptValue >> 11) & 15; 50 | int32_t value; 51 | 52 | if (dptValue == 0x7fff) 53 | return INVALID_DPT_FLOAT; 54 | 55 | if (dptValue >= 0x8000) 56 | value = dptValue | (-1L & ~2047); 57 | else value = dptValue & 2047; 58 | 59 | for (; exp; --exp) 60 | value <<= 1; 61 | 62 | return value; 63 | } 64 | -------------------------------------------------------------------------------- /src/knx/datapoint_types.h: -------------------------------------------------------------------------------- 1 | /* 2 | * datapoint_types.h - Conversion functions for datapoint types. 3 | * 4 | * Copyright (c) 2014 Stefan Taferner 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License version 3 as 8 | * published by the Free Software Foundation. 9 | */ 10 | 11 | #pragma once 12 | #include 13 | 14 | /** 15 | * An invalid 2 uint8_t float (DPT9/EIS5). 16 | * To be used for dptToFloat() and dptFromFloat(). 17 | */ 18 | #define INVALID_DPT_FLOAT 2147483647U 19 | 20 | /** 21 | * Convert a value from uint32_t to 2 uint8_t float (DPT9/EIS5). The possible range 22 | * of the values is -67108864 to 67076096. 23 | * 24 | * @param value - the value to convert. 25 | * Use INVALID_DPT_FLOAT for the DPT9 "invalid data" value. 26 | * @return The 2 uint8_t float (DPT9/EIS5). 27 | */ 28 | uint16_t dptToFloat(int32_t value); 29 | 30 | /** 31 | * Convert a value from 2 uint8_t float (DPT9/EIS5) to integer. 32 | * 33 | * @param dptValue - the 2 uint8_t float (DPT9/EIS5) to convert 34 | * @return The value as integer, or INVALID_DPT_FLOAT for the 35 | * DPT9 "invalid data" value. 36 | */ 37 | int32_t dptFromFloat(uint16_t dptValue); -------------------------------------------------------------------------------- /src/knx/device_object.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "interface_object.h" 4 | 5 | #define LEN_HARDWARE_TYPE 6 6 | 7 | class DeviceObject: public InterfaceObject 8 | { 9 | public: 10 | // increase this version anytime DeviceObject-API changes 11 | // the following value represents the serialized representation of DeviceObject. 12 | const uint16_t apiVersion = 1; 13 | 14 | DeviceObject(); 15 | uint8_t* save(uint8_t* buffer) override; 16 | const uint8_t* restore(const uint8_t* buffer) override; 17 | uint16_t saveSize() override; 18 | 19 | uint16_t individualAddress(); 20 | void individualAddress(uint16_t value); 21 | 22 | void individualAddressDuplication(bool value); 23 | bool verifyMode(); 24 | void verifyMode(bool value); 25 | bool progMode(); 26 | void progMode(bool value); 27 | uint16_t manufacturerId(); 28 | void manufacturerId(uint16_t value); 29 | uint32_t bauNumber(); 30 | void bauNumber(uint32_t value); 31 | const uint8_t* orderNumber(); 32 | void orderNumber(const uint8_t* value); 33 | const uint8_t* hardwareType(); 34 | void hardwareType(const uint8_t* value); 35 | uint16_t version(); 36 | void version(uint16_t value); 37 | uint16_t maskVersion(); 38 | void maskVersion(uint16_t value); 39 | uint16_t maxApduLength(); 40 | void maxApduLength(uint16_t value); 41 | const uint8_t* rfDomainAddress(); 42 | void rfDomainAddress(uint8_t* value); 43 | uint8_t defaultHopCount(); 44 | private: 45 | uint8_t _prgMode = 0; 46 | uint16_t _ownAddress = 65535; // 15.15.255; 47 | }; 48 | -------------------------------------------------------------------------------- /src/knx/dpt.cpp: -------------------------------------------------------------------------------- 1 | #include "dpt.h" 2 | 3 | #include "bits.h" 4 | 5 | Dpt::Dpt() 6 | {} 7 | 8 | Dpt::Dpt(short mainGroup, short subGroup, short index /* = 0 */) 9 | : mainGroup(mainGroup), subGroup(subGroup), index(index) 10 | { 11 | if (subGroup == 0) 12 | println("WARNING: You used and invalid Dpt *.0"); 13 | } 14 | 15 | bool Dpt::operator==(const Dpt& other) const 16 | { 17 | return other.mainGroup == mainGroup && other.subGroup == subGroup && other.index == index; 18 | } 19 | 20 | bool Dpt::operator!=(const Dpt& other) const 21 | { 22 | return !(other == *this); 23 | } 24 | -------------------------------------------------------------------------------- /src/knx/function_property.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "property.h" 4 | 5 | class InterfaceObject; 6 | 7 | template class FunctionProperty : public Property 8 | { 9 | public: 10 | FunctionProperty(T* io, PropertyID id, 11 | void (*commandCallback)(T*, uint8_t*, uint8_t, uint8_t*, uint8_t&), 12 | void (*stateCallback)(T*, uint8_t*, uint8_t, uint8_t*, uint8_t&)) 13 | : Property(id, false, PDT_FUNCTION, 1, ReadLv0|WriteLv0), _interfaceObject(io), _commandCallback(commandCallback), _stateCallback(stateCallback) 14 | /* max_elements is set to 1, read and write level any value so we use Lv0, see 3.3.7 Application Layer p.68 */ 15 | {} 16 | 17 | uint8_t read(uint16_t start, uint8_t count, uint8_t* data) const override 18 | { 19 | return 0; 20 | } 21 | 22 | uint8_t write(uint16_t start, uint8_t count, const uint8_t* data) override 23 | { 24 | return 0; 25 | } 26 | 27 | void command(uint8_t* data, uint8_t length, uint8_t* resultData, uint8_t& resultLength) override 28 | { 29 | if (length == 0 || _commandCallback == nullptr ) 30 | { 31 | resultLength = 0; 32 | return; 33 | } 34 | _commandCallback(_interfaceObject, data, length, resultData, resultLength); 35 | } 36 | 37 | void state(uint8_t* data, uint8_t length, uint8_t* resultData, uint8_t& resultLength) override 38 | { 39 | if (length == 0 || _stateCallback == nullptr ) 40 | { 41 | resultLength = 0; 42 | return; 43 | } 44 | _stateCallback(_interfaceObject, data, length, resultData, resultLength); 45 | } 46 | 47 | private: 48 | T* _interfaceObject = nullptr; 49 | void (*_commandCallback)(T*, uint8_t*, uint8_t, uint8_t*, uint8_t&) = nullptr; 50 | void (*_stateCallback)(T*, uint8_t*, uint8_t, uint8_t*, uint8_t&) = nullptr; 51 | }; 52 | -------------------------------------------------------------------------------- /src/knx/group_object_table_object.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "table_object.h" 4 | #include "group_object.h" 5 | 6 | class GroupObjectTableObject : public TableObject 7 | { 8 | friend class GroupObject; 9 | 10 | public: 11 | GroupObjectTableObject(Memory& memory); 12 | virtual ~GroupObjectTableObject(); 13 | uint16_t entryCount(); 14 | GroupObject& get(uint16_t asap); 15 | GroupObject& nextUpdatedObject(bool& valid); 16 | void groupObjects(GroupObject* objs, uint16_t size); 17 | 18 | const uint8_t* restore(const uint8_t* buffer) override; 19 | 20 | protected: 21 | void beforeStateChange(LoadState& newState) override; 22 | 23 | private: 24 | void freeGroupObjects(); 25 | bool initGroupObjects(); 26 | uint16_t* _tableData = 0; 27 | GroupObject* _groupObjects = 0; 28 | uint16_t _groupObjectCount = 0; 29 | }; -------------------------------------------------------------------------------- /src/knx/ip_data_link_layer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "config.h" 4 | #ifdef USE_IP 5 | 6 | #include 7 | #include "data_link_layer.h" 8 | #include "ip_parameter_object.h" 9 | 10 | class IpDataLinkLayer : public DataLinkLayer 11 | { 12 | using DataLinkLayer::_deviceObject; 13 | 14 | public: 15 | IpDataLinkLayer(DeviceObject& devObj, IpParameterObject& ipParam, NetworkLayerEntity& netLayerEntity, 16 | Platform& platform, DataLinkLayerCallbacks* dllcb = nullptr); 17 | 18 | void loop(); 19 | void enabled(bool value); 20 | bool enabled() const; 21 | DptMedium mediumType() const override; 22 | 23 | private: 24 | bool _enabled = false; 25 | uint8_t _frameCount[10] = {0,0,0,0,0,0,0,0,0,0}; 26 | uint8_t _frameCountBase = 0; 27 | uint32_t _frameCountTimeBase = 0; 28 | bool sendFrame(CemiFrame& frame); 29 | bool sendBytes(uint8_t* buffer, uint16_t length); 30 | bool isSendLimitReached(); 31 | 32 | IpParameterObject& _ipParameters; 33 | DataLinkLayerCallbacks* _dllcb; 34 | }; 35 | #endif 36 | -------------------------------------------------------------------------------- /src/knx/ip_host_protocol_address_information.cpp: -------------------------------------------------------------------------------- 1 | #include "ip_host_protocol_address_information.h" 2 | #include "bits.h" 3 | #ifdef USE_IP 4 | IpHostProtocolAddressInformation::IpHostProtocolAddressInformation(uint8_t* data) 5 | : _data(data) 6 | {} 7 | 8 | 9 | uint8_t IpHostProtocolAddressInformation::length() const 10 | { 11 | return *_data; 12 | } 13 | 14 | void IpHostProtocolAddressInformation::length(uint8_t value) 15 | { 16 | *_data = value; 17 | } 18 | 19 | HostProtocolCode IpHostProtocolAddressInformation::code() const 20 | { 21 | return (HostProtocolCode)_data[1]; 22 | } 23 | 24 | void IpHostProtocolAddressInformation::code(HostProtocolCode value) 25 | { 26 | _data[1] = value; 27 | } 28 | 29 | uint32_t IpHostProtocolAddressInformation::ipAddress() const 30 | { 31 | return getInt(_data + 2); 32 | } 33 | 34 | void IpHostProtocolAddressInformation::ipAddress(uint32_t value) 35 | { 36 | pushInt(value, _data + 2); 37 | } 38 | 39 | uint16_t IpHostProtocolAddressInformation::ipPortNumber() const 40 | { 41 | return getWord(_data + 6); 42 | } 43 | 44 | void IpHostProtocolAddressInformation::ipPortNumber(uint16_t value) 45 | { 46 | pushWord(value, _data + 6); 47 | } 48 | #endif 49 | -------------------------------------------------------------------------------- /src/knx/ip_host_protocol_address_information.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "config.h" 5 | 6 | enum HostProtocolCode : uint8_t 7 | { 8 | IPV4_UDP = 1, 9 | IPV4_TCP = 2 10 | }; 11 | 12 | #ifdef USE_IP 13 | 14 | #define LEN_IPHPAI 8 15 | 16 | class IpHostProtocolAddressInformation 17 | { 18 | public: 19 | IpHostProtocolAddressInformation(uint8_t* data); 20 | uint8_t length() const; 21 | void length(uint8_t value); 22 | HostProtocolCode code() const; 23 | void code(HostProtocolCode value); 24 | uint32_t ipAddress() const; 25 | void ipAddress(uint32_t value); 26 | uint16_t ipPortNumber() const; 27 | void ipPortNumber(uint16_t value); 28 | 29 | private: 30 | uint8_t* _data; 31 | }; 32 | #endif -------------------------------------------------------------------------------- /src/knx/ip_parameter_object.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "config.h" 4 | #ifdef USE_IP 5 | #include "interface_object.h" 6 | #include "device_object.h" 7 | #include "platform.h" 8 | 9 | #define KNXIP_MULTICAST_PORT 3671 10 | 11 | class IpParameterObject : public InterfaceObject 12 | { 13 | public: 14 | IpParameterObject(DeviceObject& deviceObject, Platform& platform); 15 | 16 | private: 17 | DeviceObject& _deviceObject; 18 | Platform& _platform; 19 | }; 20 | #endif -------------------------------------------------------------------------------- /src/knx/knx_ip_device_information_dib.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "knx_ip_dib.h" 3 | 4 | #ifdef USE_IP 5 | #define LEN_DEVICE_INFORMATION_DIB 54 6 | #define LEN_SERIAL_NUMBER 6 7 | #define LEN_MAC_ADDRESS 6 8 | #define LEN_FRIENDLY_NAME 30 9 | 10 | class KnxIpDeviceInformationDIB : public KnxIpDIB 11 | { 12 | public: 13 | KnxIpDeviceInformationDIB(uint8_t* data); 14 | uint8_t medium() const; 15 | void medium(uint8_t value); 16 | uint8_t status() const; 17 | void status(uint8_t value); 18 | uint16_t individualAddress() const; 19 | void individualAddress(uint16_t value); 20 | uint16_t projectInstallationIdentifier() const; 21 | void projectInstallationIdentifier(uint16_t value); 22 | const uint8_t* serialNumber() const; 23 | void serialNumber(const uint8_t* value); 24 | uint32_t routingMulticastAddress() const; 25 | void routingMulticastAddress(uint32_t value); 26 | const uint8_t* macAddress() const; 27 | void macAddress(const uint8_t* value); 28 | const uint8_t* friendlyName() const; 29 | void friendlyName(const uint8_t* value); 30 | }; 31 | 32 | #endif -------------------------------------------------------------------------------- /src/knx/knx_ip_dib.cpp: -------------------------------------------------------------------------------- 1 | #include "knx_ip_dib.h" 2 | #ifdef USE_IP 3 | KnxIpDIB::KnxIpDIB(uint8_t* data) : _data(data) 4 | {} 5 | 6 | KnxIpDIB::~KnxIpDIB() 7 | {} 8 | 9 | uint8_t KnxIpDIB::length() const 10 | { 11 | return *_data; 12 | } 13 | 14 | void KnxIpDIB::length(uint8_t value) 15 | { 16 | *_data = value; 17 | } 18 | 19 | DescriptionTypeCode KnxIpDIB::code() const 20 | { 21 | return (DescriptionTypeCode)_data[1]; 22 | } 23 | 24 | void KnxIpDIB::code(DescriptionTypeCode value) 25 | { 26 | _data[1] = value; 27 | } 28 | #endif -------------------------------------------------------------------------------- /src/knx/knx_ip_dib.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "config.h" 5 | 6 | #ifdef USE_IP 7 | 8 | enum DescriptionTypeCode : uint8_t 9 | { 10 | DEVICE_INFO = 0x01, 11 | SUPP_SVC_FAMILIES = 0x02, 12 | IP_CONFIG = 0x03, 13 | IP_CUR_CONFIG = 0x04, 14 | KNX_ADDRESSES = 0x05, 15 | MFR_DATA = 0xFE 16 | }; 17 | 18 | class KnxIpDIB 19 | { 20 | public: 21 | KnxIpDIB(uint8_t* data); 22 | virtual ~KnxIpDIB(); 23 | DescriptionTypeCode code() const; 24 | void code(DescriptionTypeCode value); 25 | uint8_t length() const; 26 | void length(uint8_t value); 27 | 28 | protected: 29 | uint8_t* _data = 0; 30 | }; 31 | #endif 32 | -------------------------------------------------------------------------------- /src/knx/knx_ip_frame.cpp: -------------------------------------------------------------------------------- 1 | #include "knx_ip_frame.h" 2 | 3 | #ifdef USE_IP 4 | 5 | #include 6 | #include "bits.h" 7 | 8 | #define KNXIP_HEADER_LEN 0x6 9 | #define KNXIP_PROTOCOL_VERSION 0x10 10 | 11 | KnxIpFrame::KnxIpFrame(uint8_t* data, 12 | uint16_t length) 13 | { 14 | _data = data; 15 | _dataLength = length; 16 | } 17 | 18 | uint8_t KnxIpFrame::headerLength() const 19 | { 20 | return _data[0]; 21 | } 22 | 23 | void KnxIpFrame::headerLength(uint8_t length) 24 | { 25 | _data[0] = length; 26 | } 27 | 28 | KnxIpVersion KnxIpFrame::protocolVersion() const 29 | { 30 | return (KnxIpVersion)_data[1]; 31 | } 32 | 33 | void KnxIpFrame::protocolVersion(KnxIpVersion version) 34 | { 35 | _data[1] = (uint8_t)version; 36 | } 37 | 38 | uint16_t KnxIpFrame::serviceTypeIdentifier() const 39 | { 40 | return getWord(_data + 2); 41 | } 42 | 43 | void KnxIpFrame::serviceTypeIdentifier(uint16_t identifier) 44 | { 45 | pushWord(identifier, _data + 2); 46 | } 47 | 48 | uint16_t KnxIpFrame::totalLength() const 49 | { 50 | return getWord(_data + 4); 51 | } 52 | 53 | void KnxIpFrame::totalLength(uint16_t length) 54 | { 55 | pushWord(length, _data + 4); 56 | } 57 | 58 | uint8_t* KnxIpFrame::data() 59 | { 60 | return _data; 61 | } 62 | 63 | 64 | KnxIpFrame::~KnxIpFrame() 65 | { 66 | if (_freeData) 67 | delete[] _data; 68 | } 69 | 70 | 71 | KnxIpFrame::KnxIpFrame(uint16_t length) 72 | { 73 | _data = new uint8_t[length]; 74 | _dataLength = length; 75 | _freeData = true; 76 | memset(_data, 0, length); 77 | headerLength(LEN_KNXIP_HEADER); 78 | protocolVersion(KnxIp1_0); 79 | totalLength(length); 80 | } 81 | #endif -------------------------------------------------------------------------------- /src/knx/knx_ip_frame.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "cemi_frame.h" 4 | #include "config.h" 5 | #ifdef USE_IP 6 | 7 | #define LEN_KNXIP_HEADER 0x6 8 | 9 | enum KnxIpVersion 10 | { 11 | KnxIp1_0 = 0x10 12 | }; 13 | 14 | enum KnxIpServiceType 15 | { 16 | SearchRequest = 0x201, 17 | SearchResponse = 0x202, 18 | DescriptionRequest = 0x203, 19 | DescriptionResponse = 0x204, 20 | ConnectRequest = 0x205, 21 | ConnectResponse = 0x206, 22 | ConnectionStateRequest = 0x207, 23 | ConnectionStateResponse = 0x208, 24 | DisconnectRequest = 0x209, 25 | DisconnectResponse = 0x20A, 26 | SearchRequestExt = 0x20B, 27 | SearchResponseExt = 0x20C, 28 | DeviceConfigurationRequest = 0x310, 29 | DeviceConfigurationAck = 0x311, 30 | TunnelingRequest = 0x420, 31 | TunnelingAck = 0x421, 32 | RoutingIndication = 0x530, 33 | RoutingLostMessage = 0x531, 34 | }; 35 | 36 | class KnxIpFrame 37 | { 38 | public: 39 | KnxIpFrame(uint8_t* data, uint16_t length); 40 | KnxIpFrame(uint16_t totalLength); 41 | virtual ~KnxIpFrame(); 42 | uint8_t headerLength() const; 43 | void headerLength(uint8_t length); 44 | KnxIpVersion protocolVersion() const; 45 | void protocolVersion(KnxIpVersion version); 46 | uint16_t serviceTypeIdentifier() const; 47 | void serviceTypeIdentifier(uint16_t identifier); 48 | uint16_t totalLength() const; 49 | void totalLength(uint16_t length); 50 | uint8_t* data(); 51 | 52 | protected: 53 | bool _freeData = false; 54 | uint8_t* _data = 0; 55 | uint16_t _dataLength; 56 | }; 57 | #endif 58 | -------------------------------------------------------------------------------- /src/knx/knx_ip_routing_indication.cpp: -------------------------------------------------------------------------------- 1 | #include "knx_ip_routing_indication.h" 2 | #include 3 | 4 | #ifdef USE_IP 5 | CemiFrame& KnxIpRoutingIndication::frame() 6 | { 7 | return _frame; 8 | } 9 | 10 | 11 | KnxIpRoutingIndication::KnxIpRoutingIndication(uint8_t* data, 12 | uint16_t length) : KnxIpFrame(data, length), _frame(data + headerLength(), length - headerLength()) 13 | { 14 | } 15 | 16 | KnxIpRoutingIndication::KnxIpRoutingIndication(CemiFrame frame) 17 | : KnxIpFrame(frame.totalLenght() + LEN_KNXIP_HEADER), _frame(_data + headerLength(), frame.totalLenght()) 18 | { 19 | serviceTypeIdentifier(RoutingIndication); 20 | memcpy(_data + LEN_KNXIP_HEADER, frame.data(), frame.totalLenght()); 21 | } 22 | #endif -------------------------------------------------------------------------------- /src/knx/knx_ip_routing_indication.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "knx_ip_frame.h" 4 | #include "cemi_frame.h" 5 | #ifdef USE_IP 6 | 7 | class KnxIpRoutingIndication : public KnxIpFrame 8 | { 9 | public: 10 | KnxIpRoutingIndication(uint8_t* data, uint16_t length); 11 | KnxIpRoutingIndication(CemiFrame frame); 12 | CemiFrame& frame(); 13 | private: 14 | CemiFrame _frame; 15 | }; 16 | #endif -------------------------------------------------------------------------------- /src/knx/knx_ip_search_request.cpp: -------------------------------------------------------------------------------- 1 | #include "knx_ip_search_request.h" 2 | #ifdef USE_IP 3 | KnxIpSearchRequest::KnxIpSearchRequest(uint8_t* data, uint16_t length) 4 | : KnxIpFrame(data, length), _hpai(data + LEN_KNXIP_HEADER) 5 | { 6 | } 7 | 8 | 9 | IpHostProtocolAddressInformation& KnxIpSearchRequest::hpai() 10 | { 11 | return _hpai; 12 | } 13 | #endif -------------------------------------------------------------------------------- /src/knx/knx_ip_search_request.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "knx_ip_frame.h" 4 | #include "ip_host_protocol_address_information.h" 5 | #ifdef USE_IP 6 | class KnxIpSearchRequest : public KnxIpFrame 7 | { 8 | public: 9 | KnxIpSearchRequest(uint8_t* data, uint16_t length); 10 | IpHostProtocolAddressInformation& hpai(); 11 | private: 12 | IpHostProtocolAddressInformation _hpai; 13 | }; 14 | #endif -------------------------------------------------------------------------------- /src/knx/knx_ip_search_response.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "knx_ip_frame.h" 4 | #include "ip_host_protocol_address_information.h" 5 | #include "knx_ip_device_information_dib.h" 6 | #include "knx_ip_supported_service_dib.h" 7 | #include "ip_parameter_object.h" 8 | #ifdef USE_IP 9 | 10 | class KnxIpSearchResponse : public KnxIpFrame 11 | { 12 | public: 13 | KnxIpSearchResponse(IpParameterObject& parameters, DeviceObject& deviceObj); 14 | IpHostProtocolAddressInformation& controlEndpoint(); 15 | KnxIpDeviceInformationDIB& deviceInfo(); 16 | KnxIpSupportedServiceDIB& supportedServices(); 17 | private: 18 | IpHostProtocolAddressInformation _controlEndpoint; 19 | KnxIpDeviceInformationDIB _deviceInfo; 20 | KnxIpSupportedServiceDIB _supportedServices; 21 | }; 22 | 23 | #endif -------------------------------------------------------------------------------- /src/knx/knx_ip_supported_service_dib.cpp: -------------------------------------------------------------------------------- 1 | #include "knx_ip_supported_service_dib.h" 2 | 3 | #ifdef USE_IP 4 | KnxIpSupportedServiceDIB::KnxIpSupportedServiceDIB(uint8_t* data) : KnxIpDIB(data) 5 | {} 6 | 7 | 8 | uint8_t KnxIpSupportedServiceDIB::serviceVersion(ServiceFamily family) 9 | { 10 | uint8_t* start = _data + 2; 11 | uint8_t* end = _data + length(); 12 | 13 | for (uint8_t* it = start; it < end; it += 2) 14 | { 15 | if (*it == family) 16 | return it[1]; 17 | } 18 | return 0; 19 | } 20 | 21 | 22 | void KnxIpSupportedServiceDIB::serviceVersion(ServiceFamily family, uint8_t version) 23 | { 24 | uint8_t* start = _data + 2; 25 | uint8_t* end = _data + length(); 26 | 27 | for (uint8_t* it = start; it < end; it += 2) 28 | { 29 | if (*it == family) 30 | { 31 | it[1] = version; 32 | break; 33 | } 34 | 35 | if (*it == 0) 36 | { 37 | *it = family; 38 | it[1] = version; 39 | break; 40 | } 41 | } 42 | } 43 | #endif -------------------------------------------------------------------------------- /src/knx/knx_ip_supported_service_dib.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "knx_ip_dib.h" 3 | 4 | #ifdef USE_IP 5 | enum ServiceFamily : uint8_t 6 | { 7 | Core = 2, 8 | DeviceManagement = 3, 9 | Tunnelling = 4, 10 | Routing = 5, 11 | RemoteLogging = 6, 12 | RemoteConfigDiag = 7, 13 | ObjectServer = 8 14 | }; 15 | 16 | class KnxIpSupportedServiceDIB : public KnxIpDIB 17 | { 18 | public: 19 | KnxIpSupportedServiceDIB(uint8_t* data); 20 | uint8_t serviceVersion(ServiceFamily family); 21 | void serviceVersion(ServiceFamily family, uint8_t version); 22 | }; 23 | #endif -------------------------------------------------------------------------------- /src/knx/network_layer.cpp: -------------------------------------------------------------------------------- 1 | #include "network_layer.h" 2 | #include "device_object.h" 3 | #include "data_link_layer.h" 4 | #include "tpdu.h" 5 | #include "cemi_frame.h" 6 | #include "bits.h" 7 | #include "apdu.h" 8 | 9 | NetworkLayer::NetworkLayer(DeviceObject &deviceObj, TransportLayer& layer) : 10 | _deviceObj(deviceObj), 11 | _transportLayer(layer) 12 | { 13 | _hopCount = _deviceObj.defaultHopCount(); 14 | } 15 | 16 | uint8_t NetworkLayer::hopCount() const 17 | { 18 | return _hopCount; 19 | } 20 | 21 | bool NetworkLayer::isApciSystemBroadcast(APDU& apdu) 22 | { 23 | switch (apdu.type()) 24 | { 25 | // Application Layer Services on System Broadcast communication mode 26 | case SystemNetworkParameterRead: 27 | case SystemNetworkParameterResponse: 28 | case SystemNetworkParameterWrite: 29 | // Open media specific Application Layer Services on System Broadcast communication mode 30 | case DomainAddressSerialNumberRead: 31 | case DomainAddressSerialNumberResponse: 32 | case DomainAddressSerialNumberWrite: 33 | case DomainAddressRead: 34 | case DomainAddressSelectiveRead: 35 | case DomainAddressResponse: 36 | case DomainAddressWrite: 37 | return true; 38 | default: 39 | return false; 40 | } 41 | return false; 42 | } 43 | 44 | -------------------------------------------------------------------------------- /src/knx/network_layer_entity.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "knx_types.h" 5 | #include "npdu.h" 6 | 7 | class DataLinkLayer; 8 | class NetworkLayer; 9 | 10 | class NetworkLayerEntity 11 | { 12 | friend class NetworkLayerCoupler; 13 | friend class NetworkLayerDevice; 14 | 15 | public: 16 | NetworkLayerEntity(NetworkLayer &netLayer, uint8_t entityIndex); 17 | 18 | void dataLinkLayer(DataLinkLayer& layer); 19 | DataLinkLayer& dataLinkLayer(); 20 | 21 | DptMedium mediumType() const; 22 | uint8_t getEntityIndex(); 23 | 24 | // from data link layer 25 | void dataIndication(AckType ack, AddressType addType, uint16_t destination, FrameFormat format, NPDU& npdu, 26 | Priority priority, uint16_t source); 27 | void dataConfirm(AckType ack, AddressType addressType, uint16_t destination, FrameFormat format, Priority priority, 28 | uint16_t source, NPDU& npdu, bool status); 29 | void broadcastIndication(AckType ack, FrameFormat format, NPDU& npdu, 30 | Priority priority, uint16_t source); 31 | void broadcastConfirm(AckType ack, FrameFormat format, Priority priority, uint16_t source, NPDU& npdu, bool status); 32 | void systemBroadcastIndication(AckType ack, FrameFormat format, NPDU& npdu, 33 | Priority priority, uint16_t source); 34 | void systemBroadcastConfirm(AckType ack, FrameFormat format, Priority priority, uint16_t source, NPDU& npdu, bool status); 35 | 36 | private: 37 | // From network layer 38 | void sendDataRequest(NPDU& npdu, AckType ack, uint16_t destination, uint16_t source, Priority priority, AddressType addrType, SystemBroadcast systemBroadcast); 39 | 40 | DataLinkLayer* _dataLinkLayer = 0; 41 | NetworkLayer& _netLayer; 42 | uint8_t _entityIndex; 43 | }; 44 | -------------------------------------------------------------------------------- /src/knx/npdu.cpp: -------------------------------------------------------------------------------- 1 | #include "npdu.h" 2 | #include "cemi_frame.h" 3 | #include 4 | 5 | 6 | NPDU::NPDU(uint8_t* data, CemiFrame& frame): _data(data), _frame(frame) 7 | { 8 | } 9 | 10 | 11 | uint8_t NPDU::octetCount() const 12 | { 13 | return _data[0]; 14 | } 15 | 16 | void NPDU::octetCount(uint8_t value) 17 | { 18 | _data[0] = value; 19 | } 20 | 21 | uint8_t NPDU::length() const 22 | { 23 | return _data[0] + 2; // +1 for length field, +1 for TCPI 24 | } 25 | 26 | uint8_t NPDU::hopCount() const 27 | { 28 | return _frame.hopCount(); 29 | } 30 | 31 | void NPDU::hopCount(uint8_t value) 32 | { 33 | _frame.hopCount(value); 34 | } 35 | 36 | CemiFrame& NPDU::frame() 37 | { 38 | return _frame; 39 | } 40 | 41 | TPDU& NPDU::tpdu() 42 | { 43 | return _frame.tpdu(); 44 | } 45 | -------------------------------------------------------------------------------- /src/knx/npdu.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | class CemiFrame; 6 | class TPDU; 7 | 8 | class NPDU 9 | { 10 | friend class CemiFrame; 11 | 12 | public: 13 | uint8_t octetCount() const; 14 | void octetCount(uint8_t value); 15 | uint8_t length() const; 16 | uint8_t hopCount() const; 17 | void hopCount(uint8_t value); 18 | CemiFrame& frame(); 19 | TPDU& tpdu(); 20 | 21 | protected: 22 | NPDU(uint8_t* data, CemiFrame& frame); 23 | 24 | private: 25 | uint8_t* _data = 0; 26 | CemiFrame& _frame; 27 | }; -------------------------------------------------------------------------------- /src/knx/rf_data_link_layer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "config.h" 4 | #ifdef USE_RF 5 | 6 | #include 7 | #include "data_link_layer.h" 8 | 9 | #define MAX_KNX_TELEGRAM_SIZE 263 10 | 11 | class RfMediumObject; 12 | 13 | class RfDataLinkLayer : public DataLinkLayer 14 | { 15 | #if defined(DeviceFamily_CC13X0) 16 | friend class RfPhysicalLayerCC1310; 17 | #else 18 | friend class RfPhysicalLayerCC1101; 19 | #endif 20 | using DataLinkLayer::_deviceObject; 21 | using DataLinkLayer::_platform; 22 | 23 | public: 24 | RfDataLinkLayer(DeviceObject& devObj, RfMediumObject& rfMediumObj, NetworkLayerEntity& netLayerEntity, 25 | Platform& platform); 26 | 27 | void loop(); 28 | void enabled(bool value); 29 | bool enabled() const; 30 | DptMedium mediumType() const override; 31 | 32 | private: 33 | bool _enabled = false; 34 | uint8_t _loopState = 0; 35 | 36 | uint8_t _buffer[512]; 37 | 38 | uint8_t _frameNumber = 0; 39 | 40 | struct _tx_queue_frame_t 41 | { 42 | uint8_t* data; 43 | uint16_t length; 44 | _tx_queue_frame_t* next; 45 | }; 46 | 47 | struct _tx_queue_t 48 | { 49 | _tx_queue_frame_t* front = NULL; 50 | _tx_queue_frame_t* back = NULL; 51 | } _tx_queue; 52 | 53 | RfMediumObject& _rfMediumObj; 54 | #if defined(DeviceFamily_CC13X0) 55 | RfPhysicalLayerCC1310 _rfPhy; 56 | #else 57 | RfPhysicalLayerCC1101 _rfPhy; 58 | #endif 59 | void fillRfFrame(CemiFrame& frame, uint8_t* data); 60 | void addFrameTxQueue(CemiFrame& frame); 61 | bool isTxQueueEmpty(); 62 | void loadNextTxFrame(uint8_t** sendBuffer, uint16_t* sendBufferLength); 63 | bool sendFrame(CemiFrame& frame); 64 | void frameBytesReceived(uint8_t* buffer, uint16_t length); 65 | }; 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /src/knx/rf_medium_object.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "config.h" 4 | #ifdef USE_RF 5 | 6 | #include "interface_object.h" 7 | 8 | class RfMediumObject: public InterfaceObject 9 | { 10 | public: 11 | RfMediumObject(); 12 | const uint8_t* rfDomainAddress(); 13 | void rfDomainAddress(const uint8_t* value); 14 | 15 | private: 16 | uint8_t _rfDiagSourceAddressFilterTable[24] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}; 17 | uint8_t _rfDiagLinkBudgetTable[24] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}; 18 | }; 19 | #endif 20 | -------------------------------------------------------------------------------- /src/knx/rf_physical_layer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "config.h" 4 | #ifdef USE_RF 5 | 6 | #include 7 | 8 | #include "platform.h" 9 | 10 | // Calculate the real packet size out of the L-field of FT3 frame data. See KNX-RF spec. 3.2.5 Data Link Layer frame format 11 | #define PACKET_SIZE(lField) ((((lField - 10 /*size of first pkt*/))/16 + 2 /*CRC in first pkt */) * 2 /*to bytes*/ +lField + 1 /*size of len byte*/) 12 | 13 | class RfDataLinkLayer; 14 | 15 | class RfPhysicalLayer 16 | { 17 | public: 18 | RfPhysicalLayer(RfDataLinkLayer& rfDataLinkLayer, Platform& platform) 19 | : _rfDataLinkLayer(rfDataLinkLayer), _platform(platform) {} 20 | 21 | virtual bool InitChip() = 0; 22 | virtual void stopChip() = 0; 23 | virtual void loop() = 0; 24 | 25 | protected: 26 | RfDataLinkLayer& _rfDataLinkLayer; 27 | Platform& _platform; 28 | }; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /src/knx/rf_physical_layer_cc1310.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef DeviceFamily_CC13X0 4 | 5 | #include "config.h" 6 | #ifdef USE_RF 7 | 8 | #include 9 | 10 | #include "rf_physical_layer.h" 11 | 12 | #define RX_PACKET_TIMEOUT 20 // Wait 20ms for packet reception to complete 13 | 14 | // loop states 15 | #define RX_START 0 16 | #define RX_ACTIVE 1 17 | #define RX_END 2 18 | #define TX_START 3 19 | #define TX_ACTIVE 4 20 | #define TX_END 5 21 | 22 | class RfDataLinkLayer; 23 | 24 | class RfPhysicalLayerCC1310 : public RfPhysicalLayer 25 | { 26 | public: 27 | RfPhysicalLayerCC1310(RfDataLinkLayer& rfDataLinkLayer, Platform& platform); 28 | 29 | bool InitChip() override; 30 | void stopChip() override; 31 | void loop() override; 32 | 33 | void setOutputPowerLevel(int8_t dBm); 34 | 35 | private: 36 | uint8_t _loopState = RX_START; 37 | }; 38 | 39 | #endif // USE_RF 40 | 41 | #endif // DeviceFamily_CC13X0 -------------------------------------------------------------------------------- /src/knx/router_object.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "config.h" 4 | 5 | #include "table_object.h" 6 | #include "knx_types.h" 7 | 8 | class Memory; 9 | 10 | enum CouplerModel 11 | { 12 | Model_1x, 13 | Model_20 14 | }; 15 | 16 | enum RouterObjectType 17 | { 18 | Primary, 19 | Secondary, 20 | Single // Not used, just a placeholder for better readability for coupler model 1.x 21 | }; 22 | 23 | class RouterObject : public TableObject 24 | { 25 | public: 26 | RouterObject(Memory& memory); 27 | 28 | void initialize1x(DptMedium mediumType, uint16_t maxApduSize); 29 | void initialize20(uint8_t objIndex, DptMedium mediumType, RouterObjectType rtType, uint16_t maxApduSize); 30 | void initialize(CouplerModel model, uint8_t objIndex, DptMedium mediumType, RouterObjectType rtType, uint16_t maxApduSize); 31 | 32 | bool isGroupAddressInFilterTable(uint16_t groupAddress); 33 | 34 | bool isRfSbcRoutingEnabled(); 35 | bool isIpSbcRoutingEnabled(); 36 | 37 | void masterReset(EraseCode eraseCode, uint8_t channel) override; 38 | 39 | const uint8_t* restore(const uint8_t* buffer) override; 40 | 41 | protected: 42 | void beforeStateChange(LoadState& newState) override; 43 | 44 | private: 45 | // Function properties 46 | void functionRouteTableControl(bool isCommand, uint8_t* data, uint8_t length, uint8_t* resultData, uint8_t& resultLength); 47 | void functionRfEnableSbc(bool isCommand, uint8_t* data, uint8_t length, uint8_t* resultData, uint8_t& resultLength); 48 | void functionIpEnableSbc(bool isCommand, uint8_t* data, uint8_t length, uint8_t* resultData, uint8_t& resultLength); 49 | 50 | void commandClearSetRoutingTable(bool bitIsSet); 51 | bool statusClearSetRoutingTable(bool bitIsSet); 52 | void commandClearSetGroupAddress(uint16_t startAddress, uint16_t endAddress, bool bitIsSet); 53 | bool statusClearSetGroupAddress(uint16_t startAddress, uint16_t endAddress, bool bitIsSet); 54 | 55 | bool _rfSbcRoutingEnabled = false; 56 | bool _ipSbcRoutingEnabled = false; 57 | uint16_t* _filterTableGroupAddresses = 0; 58 | }; 59 | -------------------------------------------------------------------------------- /src/knx/save_restore.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | /** 5 | * Interface for classes that can save and restore data from a buffer. 6 | */ 7 | class SaveRestore 8 | { 9 | public: 10 | /** 11 | * This method is called when the object should save its state to the buffer. 12 | * 13 | * @param buffer The buffer the object should save its state to. 14 | * 15 | * @return The buffer plus the size of the object state. The next object will use this value as 16 | * the start of its buffer. 17 | */ 18 | virtual uint8_t* save(uint8_t* buffer) 19 | { 20 | return buffer; 21 | } 22 | 23 | /** 24 | * This method is called when the object should restore its state from the buffer. 25 | * 26 | * @param buffer The buffer the object should restore its state from. 27 | * 28 | * @return The buffer plus the size of the object state. The next object will use this value as 29 | * the start of its buffer. 30 | */ 31 | virtual const uint8_t* restore(const uint8_t* buffer) 32 | { 33 | return buffer; 34 | } 35 | 36 | /** 37 | * @return The maximum number of bytes the object needs to save its state. 38 | */ 39 | virtual uint16_t saveSize() 40 | { 41 | return 0; 42 | } 43 | }; -------------------------------------------------------------------------------- /src/knx/security_interface_object.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "config.h" 4 | #ifdef USE_DATASECURE 5 | 6 | #include "interface_object.h" 7 | #include "knx_types.h" 8 | 9 | class SecurityInterfaceObject: public InterfaceObject 10 | { 11 | public: 12 | SecurityInterfaceObject(); 13 | 14 | void masterReset(EraseCode eraseCode, uint8_t channel) override; 15 | 16 | bool isSecurityModeEnabled(); 17 | 18 | bool isLoaded(); 19 | 20 | const uint8_t* toolKey(); // returns single tool key (ETS) 21 | const uint8_t* p2pKey(uint16_t addressIndex); // returns p2p key for IA index 22 | const uint8_t* groupKey(uint16_t addressIndex); // returns group key for group address index 23 | 24 | uint16_t indAddressIndex(uint16_t indAddr); // returns 1-based index of address in security IA table 25 | 26 | void setSequenceNumber(bool toolAccess, uint64_t seqNum); 27 | uint64_t getLastValidSequenceNumber(uint16_t deviceAddr); 28 | void setLastValidSequenceNumber(uint16_t deviceAddr, uint64_t seqNum); 29 | 30 | DataSecurity getGroupObjectSecurity(uint16_t index); 31 | 32 | LoadState loadState(); 33 | uint8_t* save(uint8_t* buffer) override; 34 | const uint8_t* restore(const uint8_t* buffer) override; 35 | uint16_t saveSize() override; 36 | 37 | private: 38 | void setSecurityMode(bool enabled); 39 | 40 | void clearFailureLog(); 41 | void getFailureCounters(uint8_t* data); 42 | uint8_t getFromFailureLogByIndex(uint8_t index, uint8_t* data, uint8_t maxDataLen); 43 | 44 | void errorCode(ErrorCode errorCode); 45 | 46 | void loadEvent(const uint8_t* data); 47 | void loadEventUnloaded(const uint8_t* data); 48 | void loadEventLoading(const uint8_t* data); 49 | void loadEventLoaded(const uint8_t* data); 50 | void loadEventError(const uint8_t* data); 51 | 52 | void loadState(LoadState newState); 53 | LoadState _state = LS_UNLOADED; 54 | 55 | bool _securityModeEnabled {false}; 56 | 57 | uint16_t getNumberOfElements(PropertyID propId); 58 | 59 | // Our FDSK 60 | static const uint8_t _fdsk[]; 61 | static uint8_t _secReport[]; 62 | static uint8_t _secReportCtrl[]; 63 | }; 64 | #endif 65 | -------------------------------------------------------------------------------- /src/knx/tpdu.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "stdint.h" 4 | #include "knx_types.h" 5 | class CemiFrame; 6 | class APDU; 7 | 8 | class TPDU 9 | { 10 | friend class CemiFrame; 11 | 12 | public: 13 | TpduType type() const; 14 | void type(TpduType type); 15 | 16 | bool numbered() const; 17 | void numbered(bool value); 18 | 19 | bool control() const; 20 | void control(bool value); 21 | 22 | uint8_t sequenceNumber() const; 23 | void sequenceNumber(uint8_t value); 24 | 25 | APDU& apdu(); 26 | 27 | CemiFrame& frame(); 28 | void printPDU(); 29 | 30 | protected: 31 | TPDU(uint8_t* data, CemiFrame& frame); 32 | 33 | private: 34 | uint8_t* _data = 0; 35 | CemiFrame& _frame; 36 | }; 37 | -------------------------------------------------------------------------------- /src/samd_platform.h: -------------------------------------------------------------------------------- 1 | #include "arduino_platform.h" 2 | 3 | #include "Arduino.h" 4 | 5 | #ifdef ARDUINO_ARCH_SAMD 6 | 7 | #define PAGES_PER_ROW 4 8 | 9 | class SamdPlatform : public ArduinoPlatform 10 | { 11 | public: 12 | SamdPlatform(); 13 | SamdPlatform( HardwareSerial* s); 14 | 15 | // unique serial number 16 | uint32_t uniqueSerialNumber() override; 17 | 18 | void restart(); 19 | #ifdef USE_SAMD_EEPROM_EMULATION 20 | uint8_t* getEepromBuffer(uint32_t size); 21 | void commitToEeprom(); 22 | #else 23 | // size of one EraseBlock in pages 24 | virtual size_t flashEraseBlockSize(); 25 | // size of one flash page in bytes 26 | virtual size_t flashPageSize(); 27 | // start of user flash aligned to start of an erase block 28 | virtual uint8_t* userFlashStart(); 29 | // size of the user flash in EraseBlocks 30 | virtual size_t userFlashSizeEraseBlocks(); 31 | // relativ to userFlashStart 32 | virtual void flashErase(uint16_t eraseBlockNum); 33 | // write a single page to flash (pageNumber relative to userFashStart 34 | virtual void flashWritePage(uint16_t pageNumber, uint8_t* data); 35 | 36 | // writes _eraseblockBuffer to flash - overrides Plattform::writeBufferedEraseBlock() for performance optimization only 37 | void writeBufferedEraseBlock(); 38 | 39 | private: 40 | void init(); 41 | uint32_t _MemoryEnd = 0; 42 | uint32_t _MemoryStart = 0; 43 | uint32_t _pageSize; 44 | uint32_t _rowSize; 45 | uint32_t _pageCnt; 46 | 47 | uint32_t getRowAddr(uint32_t flasAddr); 48 | void write(const volatile void* flash_ptr, const void* data, uint32_t size); 49 | void erase(const volatile void* flash_ptr, uint32_t size); 50 | void eraseRow(const volatile void* flash_ptr); 51 | 52 | #endif 53 | }; 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /src/stm32_platform.cpp: -------------------------------------------------------------------------------- 1 | #include "stm32_platform.h" 2 | 3 | #ifdef ARDUINO_ARCH_STM32 4 | #include 5 | #include "knx/bits.h" 6 | 7 | #ifndef KNX_SERIAL 8 | #define KNX_SERIAL Serial2 9 | #endif 10 | 11 | Stm32Platform::Stm32Platform() 12 | #ifndef KNX_NO_DEFAULT_UART 13 | : ArduinoPlatform(&KNX_SERIAL) 14 | #endif 15 | { 16 | } 17 | 18 | Stm32Platform::Stm32Platform( HardwareSerial* s) : ArduinoPlatform(s) 19 | { 20 | } 21 | 22 | Stm32Platform::~Stm32Platform() 23 | { 24 | delete [] _eepromPtr; 25 | } 26 | 27 | uint32_t Stm32Platform::uniqueSerialNumber() 28 | { 29 | return HAL_GetUIDw0() ^ HAL_GetUIDw1() ^ HAL_GetUIDw2(); 30 | } 31 | 32 | void Stm32Platform::restart() 33 | { 34 | NVIC_SystemReset(); 35 | } 36 | 37 | uint8_t * Stm32Platform::getEepromBuffer(uint32_t size) 38 | { 39 | // check if the buffer already exists 40 | if (_eepromPtr == nullptr) // we need to initialize the buffer first 41 | { 42 | if (size > E2END + 1) 43 | { 44 | fatalError(); 45 | } 46 | 47 | _eepromSize = size; 48 | _eepromPtr = new uint8_t[size]; 49 | eeprom_buffer_fill(); 50 | for (uint16_t i = 0; i < size; ++i) 51 | _eepromPtr[i] = eeprom_buffered_read_byte(i); 52 | } 53 | 54 | return _eepromPtr; 55 | } 56 | 57 | void Stm32Platform::commitToEeprom() 58 | { 59 | if(_eepromPtr == nullptr || _eepromSize == 0) 60 | return; 61 | for (uint16_t i = 0; i < _eepromSize; ++i) 62 | eeprom_buffered_write_byte(i, _eepromPtr[i]); 63 | // For some GD32 chips, the flash needs to be unlocked twice 64 | // and the first call will fail. If the first call is 65 | // successful, the second one (inside eeprom_buffer_flush) 66 | // does nothing. 67 | HAL_FLASH_Unlock(); 68 | eeprom_buffer_flush(); 69 | } 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /src/stm32_platform.h: -------------------------------------------------------------------------------- 1 | #ifdef ARDUINO_ARCH_STM32 2 | #include "arduino_platform.h" 3 | 4 | class Stm32Platform : public ArduinoPlatform 5 | { 6 | public: 7 | Stm32Platform(); 8 | Stm32Platform( HardwareSerial* s); 9 | ~Stm32Platform(); 10 | 11 | // unique serial number 12 | uint32_t uniqueSerialNumber() override; 13 | 14 | // basic stuff 15 | void restart(); 16 | 17 | //memory 18 | uint8_t* getEepromBuffer(uint32_t size); 19 | void commitToEeprom(); 20 | private: 21 | uint8_t *_eepromPtr = nullptr; 22 | uint16_t _eepromSize = 0; 23 | }; 24 | 25 | #endif 26 | --------------------------------------------------------------------------------