├── .gitattributes ├── .github └── workflows │ ├── commit_formatting.yml │ ├── compile-examples.yml │ ├── docs.yml │ ├── hil-unity-checks.yml │ ├── pre-commit.yaml │ ├── release.yml │ └── stale_issues.yml ├── .gitignore ├── .gitmodules ├── .pre-commit-config.yaml ├── .readthedocs.yaml ├── CODE_CONVENTIONS.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE.md ├── README.md ├── boards.txt ├── ci-matrix-config.yml ├── config ├── clang-format │ └── .clang-format ├── clang-tidy │ └── .clang-tidy └── cppcheck │ ├── misra.json │ └── misra.txt ├── cores ├── Arduino.h ├── Client.h ├── HardwareSerial.cpp ├── HardwareSerial.h ├── IPAddress.cpp ├── IPAddress.h ├── Main.cpp ├── Print.cpp ├── Print.h ├── Printable.h ├── RingBuffer.cpp ├── RingBuffer.h ├── Server.h ├── Stream.cpp ├── Stream.h ├── Tone.cpp ├── Tone.h ├── Udp.h ├── WCharacter.h ├── WInterrupts.c ├── WInterrupts.h ├── WMath.cpp ├── WMath.h ├── WString.cpp ├── WString.h ├── Wprogram.h ├── abi.cpp ├── avr │ ├── dtostrf.c │ ├── dtostrf.h │ ├── interrupt.h │ ├── io.h │ └── pgmspace.h ├── binary.h ├── hooks.c ├── itoa.c ├── itoa.h ├── new.cpp ├── reset.c ├── reset.h ├── usblib │ ├── Class │ │ ├── CDCClass.h │ │ ├── Common │ │ │ ├── CDCClassCommon.h │ │ │ ├── HIDClassCommon.h │ │ │ ├── HIDParser.h │ │ │ ├── HIDReportData.h │ │ │ └── MassStorageClassCommon.h │ │ ├── Device │ │ │ ├── CDCClassDevice.c │ │ │ ├── CDCClassDevice.h │ │ │ ├── HIDClassDevice.c │ │ │ ├── HIDClassDevice.h │ │ │ ├── MassStorageClassDevice.c │ │ │ └── MassStorageClassDevice.h │ │ ├── HIDClass.h │ │ └── MassStorageClass.h │ ├── Common │ │ ├── ArchitectureSpecific.h │ │ ├── Architectures.h │ │ ├── Attributes.h │ │ ├── BoardTypes.h │ │ ├── Common.h │ │ ├── CompilerSpecific.h │ │ ├── Endianness.h │ │ └── memcpy.c │ ├── Core │ │ ├── ConfigDescriptors.c │ │ ├── ConfigDescriptors.h │ │ ├── Device.h │ │ ├── DeviceStandardReq.h │ │ ├── EndPoint.h │ │ ├── EndpointStream.h │ │ ├── Events.c │ │ ├── Events.h │ │ ├── Host.h │ │ ├── HostStandardReq.c │ │ ├── HostStandardReq.h │ │ ├── OTG.h │ │ ├── Pipe.h │ │ ├── PipeStream.h │ │ ├── StdDescriptors.h │ │ ├── StdRequestType.h │ │ ├── USBController.h │ │ ├── USBInterrupt.h │ │ ├── USBMode.h │ │ ├── USBTask.c │ │ ├── USBTask.h │ │ └── XMC4000 │ │ │ ├── Device_XMC4000.h │ │ │ ├── EndpointStream_XMC4000.c │ │ │ ├── EndpointStream_XMC4000.h │ │ │ ├── Endpoint_XMC4000.c │ │ │ ├── Endpoint_XMC4000.h │ │ │ ├── USBController_XMC4000.c │ │ │ └── USBController_XMC4000.h │ └── usblib.h ├── wiring_analog.c ├── wiring_analog.h ├── wiring_constants.h ├── wiring_digital.c ├── wiring_digital.h ├── wiring_pulse.c ├── wiring_pulse.h ├── wiring_shift.c ├── wiring_shift.h ├── wiring_time.c ├── wiring_time.h ├── xmc_lib │ ├── CMSIS │ │ ├── DSP │ │ │ ├── Include │ │ │ │ ├── arm_common_tables.h │ │ │ │ ├── arm_const_structs.h │ │ │ │ └── arm_math.h │ │ │ └── Source │ │ │ │ ├── arm_abs_f32.c │ │ │ │ ├── arm_bitreversal.c │ │ │ │ ├── arm_bitreversal2.S │ │ │ │ ├── arm_cfft_f32.c │ │ │ │ ├── arm_cfft_radix8_f32.c │ │ │ │ ├── arm_common_tables.c │ │ │ │ ├── arm_const_structs.c │ │ │ │ ├── arm_copy_q7.c │ │ │ │ ├── arm_mean_f32.c │ │ │ │ ├── arm_mean_q15.c │ │ │ │ ├── arm_mean_q31.c │ │ │ │ ├── arm_rfft_fast_f32.c │ │ │ │ ├── arm_rfft_fast_init_f32.c │ │ │ │ └── arm_var_f32.c │ │ ├── Include │ │ │ ├── cmsis_compiler.h │ │ │ ├── cmsis_gcc.h │ │ │ ├── cmsis_version.h │ │ │ ├── core_cm0.h │ │ │ ├── core_cm4.h │ │ │ └── mpu_armv7.h │ │ └── NN │ │ │ ├── Include │ │ │ ├── arm_nn_tables.h │ │ │ ├── arm_nnfunctions.h │ │ │ └── arm_nnsupportfunctions.h │ │ │ └── Source │ │ │ ├── ActivationFunctions │ │ │ ├── arm_nn_activations_q15.c │ │ │ ├── arm_nn_activations_q7.c │ │ │ ├── arm_relu_q15.c │ │ │ └── arm_relu_q7.c │ │ │ ├── ConvolutionFunctions │ │ │ ├── arm_convolve_1x1_HWC_q7_fast_nonsquare.c │ │ │ ├── arm_convolve_HWC_q15_basic.c │ │ │ ├── arm_convolve_HWC_q15_fast.c │ │ │ ├── arm_convolve_HWC_q7_RGB.c │ │ │ ├── arm_convolve_HWC_q7_basic.c │ │ │ ├── arm_convolve_HWC_q7_fast.c │ │ │ ├── arm_convolve_HWC_q7_fast_nonsquare.c │ │ │ ├── arm_depthwise_separable_conv_HWC_q7.c │ │ │ ├── arm_depthwise_separable_conv_HWC_q7_nonsquare.c │ │ │ ├── arm_nn_mat_mult_kernel_q7_q15.c │ │ │ └── arm_nn_mat_mult_kernel_q7_q15_reordered.c │ │ │ ├── FullyConnectedFunctions │ │ │ ├── arm_fully_connected_mat_q7_vec_q15.c │ │ │ ├── arm_fully_connected_mat_q7_vec_q15_opt.c │ │ │ ├── arm_fully_connected_q15.c │ │ │ ├── arm_fully_connected_q15_opt.c │ │ │ ├── arm_fully_connected_q7.c │ │ │ └── arm_fully_connected_q7_opt.c │ │ │ ├── NNSupportFunctions │ │ │ ├── arm_nntables.c │ │ │ ├── arm_q7_to_q15_no_shift.c │ │ │ └── arm_q7_to_q15_reordered_no_shift.c │ │ │ ├── PoolingFunctions │ │ │ └── arm_pool_q7_HWC.c │ │ │ └── SoftmaxFunctions │ │ │ ├── arm_softmax_q15.c │ │ │ └── arm_softmax_q7.c │ ├── LIBS │ │ ├── syscalls.c │ │ └── types.h │ ├── README.md │ └── XMCLib │ │ ├── License.txt │ │ ├── inc │ │ ├── xmc1_ccu4_map.h │ │ ├── xmc1_ccu8_map.h │ │ ├── xmc1_eru_map.h │ │ ├── xmc1_flash.h │ │ ├── xmc1_gpio.h │ │ ├── xmc1_gpio_map.h │ │ ├── xmc1_rtc.h │ │ ├── xmc1_scu.h │ │ ├── xmc1_usic_map.h │ │ ├── xmc4_ccu4_map.h │ │ ├── xmc4_ccu8_map.h │ │ ├── xmc4_eru_map.h │ │ ├── xmc4_flash.h │ │ ├── xmc4_gpio.h │ │ ├── xmc4_gpio_map.h │ │ ├── xmc4_rtc.h │ │ ├── xmc4_scu.h │ │ ├── xmc4_usic_map.h │ │ ├── xmc_acmp.h │ │ ├── xmc_bccu.h │ │ ├── xmc_can.h │ │ ├── xmc_can_map.h │ │ ├── xmc_ccu4.h │ │ ├── xmc_ccu8.h │ │ ├── xmc_common.h │ │ ├── xmc_dac.h │ │ ├── xmc_device.h │ │ ├── xmc_dma.h │ │ ├── xmc_dma_map.h │ │ ├── xmc_dsd.h │ │ ├── xmc_ebu.h │ │ ├── xmc_ecat.h │ │ ├── xmc_ecat_map.h │ │ ├── xmc_eru.h │ │ ├── xmc_eth_mac.h │ │ ├── xmc_eth_mac_map.h │ │ ├── xmc_eth_phy.h │ │ ├── xmc_fce.h │ │ ├── xmc_flash.h │ │ ├── xmc_gpio.h │ │ ├── xmc_hrpwm.h │ │ ├── xmc_hrpwm_map.h │ │ ├── xmc_i2c.h │ │ ├── xmc_i2s.h │ │ ├── xmc_ledts.h │ │ ├── xmc_math.h │ │ ├── xmc_pau.h │ │ ├── xmc_posif.h │ │ ├── xmc_posif_map.h │ │ ├── xmc_prng.h │ │ ├── xmc_rtc.h │ │ ├── xmc_scu.h │ │ ├── xmc_sdmmc.h │ │ ├── xmc_spi.h │ │ ├── xmc_uart.h │ │ ├── xmc_usbd.h │ │ ├── xmc_usbd_regs.h │ │ ├── xmc_usbh.h │ │ ├── xmc_usic.h │ │ ├── xmc_vadc.h │ │ ├── xmc_vadc_map.h │ │ └── xmc_wdt.h │ │ └── src │ │ ├── COMPONENT_CM0 │ │ ├── TOOLCHAIN_ARM │ │ │ └── xmc_common_mdk.s │ │ ├── TOOLCHAIN_GCC_ARM │ │ │ └── xmc_common_gcc.S │ │ └── TOOLCHAIN_IAR │ │ │ └── xmc_common_iar.s │ │ ├── COMPONENT_CM4 │ │ ├── TOOLCHAIN_ARM │ │ │ └── xmc_common_mdk.s │ │ ├── TOOLCHAIN_GCC_ARM │ │ │ └── xmc_common_gcc.S │ │ └── TOOLCHAIN_IAR │ │ │ └── xmc_common_iar.s │ │ ├── xmc1_eru.c │ │ ├── xmc1_flash.c │ │ ├── xmc1_gpio.c │ │ ├── xmc1_rtc.c │ │ ├── xmc1_scu.c │ │ ├── xmc4_eru.c │ │ ├── xmc4_flash.c │ │ ├── xmc4_gpio.c │ │ ├── xmc4_rtc.c │ │ ├── xmc4_scu.c │ │ ├── xmc_acmp.c │ │ ├── xmc_bccu.c │ │ ├── xmc_can.c │ │ ├── xmc_ccu4.c │ │ ├── xmc_ccu8.c │ │ ├── xmc_common.c │ │ ├── xmc_dac.c │ │ ├── xmc_dma.c │ │ ├── xmc_dsd.c │ │ ├── xmc_ebu.c │ │ ├── xmc_ecat.c │ │ ├── xmc_eru.c │ │ ├── xmc_eth_mac.c │ │ ├── xmc_eth_phy_dp83848.c │ │ ├── xmc_eth_phy_ksz8031rnl.c │ │ ├── xmc_eth_phy_ksz8081rnb.c │ │ ├── xmc_fce.c │ │ ├── xmc_gpio.c │ │ ├── xmc_hrpwm.c │ │ ├── xmc_i2c.c │ │ ├── xmc_i2s.c │ │ ├── xmc_ledts.c │ │ ├── xmc_math.c │ │ ├── xmc_pau.c │ │ ├── xmc_posif.c │ │ ├── xmc_prng.c │ │ ├── xmc_rtc.c │ │ ├── xmc_sdmmc.c │ │ ├── xmc_spi.c │ │ ├── xmc_uart.c │ │ ├── xmc_usbd.c │ │ ├── xmc_usbh.c │ │ ├── xmc_usic.c │ │ ├── xmc_vadc.c │ │ └── xmc_wdt.c └── yield.c ├── docs ├── Makefile ├── _templates │ └── layout.html ├── arduino-deviations.rst ├── builtin-libraries.rst ├── conf.py ├── development-instructions.rst ├── hw-platforms.rst ├── img │ ├── H-BRIDGE_KIT_2GO_pinout.jpg │ ├── KIT_XMC11_BOOT_001.jpg │ ├── KIT_XMC11_BOOT_001_pinout.png │ ├── KIT_XMC13_BOOT_001.jpg │ ├── KIT_XMC1400_ARDUINO.jpg │ ├── KIT_XMC1400_ARDUINO_pinout.png │ ├── KIT_XMC14_2GO.png │ ├── KIT_XMC14_2GO_pinout.svg │ ├── KIT_XMC47_RELAX_5V_AD_V1.jpg │ ├── KIT_XMC47_RELAX_5V_AD_V1_pinout.png │ ├── KIT_XMC_2GO_XMC1100_V1_pinout.png │ ├── KIT_XMC_PLT2GO_XMC4200.jpg │ ├── KIT_XMC_PLT2GO_XMC4200_pinout.png │ ├── KIT_XMC_PLT2GO_XMC4400.jpg │ ├── KIT_XMC_PLT2GO_XMC4400_pinout.png │ ├── XMC4700_Radar_Baseboard_pinout.png │ ├── arduino_ide_board_list.png │ ├── arduino_ide_board_manager_entry.png │ ├── arduino_ide_preferences_link.png │ ├── arduino_ide_preferences_menu.png │ ├── arduino_ide_release_index.png │ ├── arduino_ide_serial_selection.png │ ├── ifx_logo_white_green_s.png │ ├── jlink_downloads.png │ ├── jlink_installer_options.png │ ├── kit_xmc47_relax_cut_routes.jpg │ ├── kit_xmc_plt2go_xmc4200_remove_resistors.png │ └── kit_xmc_plt2go_xmc4400_cut_routes.png ├── index.rst ├── installation-instructions.rst ├── make.bat └── requirements.txt ├── keywords.txt ├── libraries ├── CAN │ ├── LICENSE │ ├── Makefile.codecheck │ ├── Makefile.codechecks.mk │ ├── README.md │ ├── examples │ │ ├── CANLoopBack │ │ │ └── CANLoopBack.ino │ │ ├── CANReceiver │ │ │ └── CANReceiver.ino │ │ ├── CANReceiverCallback │ │ │ └── CANReceiverCallback.ino │ │ └── CANSender │ │ │ └── CANSender.ino │ ├── keywords.txt │ ├── library.properties │ └── src │ │ ├── CAN.h │ │ ├── CANController.cpp │ │ ├── CANController.h │ │ ├── CANXMC.cpp │ │ └── CANXMC.h ├── DMA │ ├── Readme.MD │ ├── examples │ │ ├── DMA_Memory │ │ │ └── DMA_Memory.ino │ │ └── DMA_UART │ │ │ └── DMA_UART.ino │ ├── keywords.txt │ ├── library.properties │ └── src │ │ ├── DMA.cpp │ │ └── DMA.h ├── DeviceControlXMC │ ├── Readme.MD │ ├── examples │ │ ├── DieTemperatureMeasurement │ │ │ └── DieTemperatureMeasurement.ino │ │ ├── HeapMemoryMeasurement │ │ │ └── HeapMemoryMeasurement.ino │ │ ├── SleepModeXMC1100 │ │ │ └── SleepModeXMC1100.ino │ │ ├── SleepModeXMC4700 │ │ │ └── SleepModeXMC4700.ino │ │ └── StackMemoryMeasurement │ │ │ └── StackMemoryMeasurement.ino │ ├── keywords.txt │ ├── library.properties │ └── src │ │ ├── DeviceControlXMC.cpp │ │ ├── DeviceControlXMC.h │ │ └── utility │ │ ├── timer.c │ │ └── timer.h ├── I2S │ ├── README.md │ ├── examples │ │ ├── sampleValues │ │ │ └── sampleValues.ino │ │ ├── sampleValuesWithCallback │ │ │ └── sampleValuesWithCallback.ino │ │ └── soundPressureLevel │ │ │ └── soundPressureLevel.ino │ ├── keywords.txt │ ├── library.properties │ └── src │ │ ├── I2S.cpp │ │ └── I2S.h ├── LED │ ├── Readme.md │ ├── examples │ │ └── SimpleLED │ │ │ └── SimpleLED.ino │ ├── keywords.txt │ ├── library.properties │ └── src │ │ ├── LED.cpp │ │ └── LED.h ├── OneWire │ ├── Readme.MD │ ├── examples │ │ ├── DS18x20_Temperature │ │ │ └── DS18x20_Temperature.ino │ │ ├── DS2408_Switch │ │ │ └── DS2408_Switch.ino │ │ └── DS250x_PROM │ │ │ └── DS250x_PROM.ino │ ├── keywords.txt │ ├── library.json │ ├── library.properties │ └── src │ │ ├── OneWire.cpp │ │ ├── OneWire.h │ │ └── util │ │ ├── OneWireConf.h │ │ ├── OneWireHW.cpp │ │ ├── OneWireHW.h │ │ ├── OneWireImpl.cpp │ │ ├── OneWireImpl.h │ │ ├── OneWireSW.cpp │ │ ├── OneWireSW.h │ │ ├── OneWireSettings.h │ │ ├── OneWireTiming.cpp │ │ └── OneWireTiming.h ├── RTC │ ├── Readme.MD │ ├── examples │ │ ├── AlarmRTC │ │ │ └── AlarmRTC.ino │ │ └── SimpleRTC │ │ │ └── SimpleRTC.ino │ ├── keywords.txt │ ├── library.properties │ └── src │ │ ├── RTC.cpp │ │ ├── RTC.h │ │ └── utility │ │ ├── xmc_rtc_conf.c │ │ └── xmc_rtc_conf.h ├── SPI │ ├── Readme.MD │ ├── examples │ │ └── SPI_MOSI_to_MISO_SameDevice │ │ │ └── SPI_MOSI_to_MISO_SameDevice.ino │ ├── keywords.txt │ ├── library.properties │ └── src │ │ ├── HW_SPI.cpp │ │ ├── SPI.h │ │ ├── SW_SPI.cpp │ │ └── SW_SPI.h └── Wire │ ├── Readme.MD │ ├── examples │ ├── master_reader │ │ └── master_reader.ino │ ├── master_writer │ │ └── master_writer.ino │ ├── slave_receiver │ │ └── slave_receiver.ino │ └── slave_sender │ │ └── slave_sender.ino │ ├── keywords.txt │ ├── library.properties │ └── src │ ├── Wire.cpp │ └── Wire.h ├── package.json ├── package ├── config.yml └── package_infineon_index.template.json ├── platform.txt ├── programmers.txt ├── tests ├── Makefile.test ├── hil-unity-checklist.yaml ├── manual │ ├── PCLKTest │ │ └── PCLKTest.ino │ ├── PWMtest │ │ └── PWMtest.ino │ ├── PulseIntest │ │ └── PulseIntest.ino │ ├── Servotest │ │ └── Servotest.ino │ ├── analogwritetest │ │ └── analogwritetest.ino │ ├── delaytest │ │ └── delaytest.ino │ ├── testdefines │ │ └── testdefines.ino │ ├── tonetest │ │ └── tonetest.ino │ └── ulong_test │ │ └── ulong_test.ino └── test_config.h ├── tools ├── ci.sh ├── verifygitlog.py ├── xmc-flasher.py └── xmc_data.py └── variants ├── XMC1100 ├── XMC1000_RomFunctionTable.h ├── XMC1100.h ├── config │ ├── XMC1100_Boot_Kit │ │ └── pins_arduino.h │ └── XMC1100_XMC2GO │ │ └── pins_arduino.h ├── linker_script.ld ├── startup_XMC1100.S ├── system_XMC1100.c └── system_XMC1100.h ├── XMC1300 ├── XMC1000_RomFunctionTable.h ├── XMC1300.h ├── config │ └── XMC1300_Boot_Kit │ │ └── pins_arduino.h ├── linker_script_200k.ld ├── startup_XMC1300.S ├── system_XMC1300.c └── system_XMC1300.h ├── XMC1400 ├── XMC1000_RomFunctionTable.h ├── XMC1400.h ├── config │ ├── XMC1400_Arduino_Kit │ │ └── pins_arduino.h │ └── XMC1400_XMC2GO │ │ └── pins_arduino.h ├── linker_script_200k.ld ├── startup_XMC1400.S ├── system_XMC1400.c └── system_XMC1400.h ├── XMC4200 ├── XMC4200.h ├── config │ └── XMC4200_Platform2GO │ │ └── pins_arduino.h ├── linker_script.ld ├── startup_XMC4200.S ├── system_XMC4200.c └── system_XMC4200.h ├── XMC4400 ├── XMC4400.h ├── config │ └── XMC4400_Platform2GO │ │ └── pins_arduino.h ├── linker_script.ld ├── startup_XMC4400.S ├── system_XMC4400.c └── system_XMC4400.h └── XMC4700 ├── XMC4700.h ├── config └── XMC4700_Relax_Kit │ └── pins_arduino.h ├── linker_script.ld ├── startup_XMC4700.S ├── system_XMC4700.c └── system_XMC4700.h /.gitattributes: -------------------------------------------------------------------------------- 1 | # Configuration to handle line endings for working with Windows and Unix 2 | # Reference: 3 | # https://help.github.com/articles/dealing-with-line-endings/ 4 | # https://git-scm.com/docs/gitattributes#_checking_out_and_checking_in 5 | 6 | * text=auto 7 | 8 | *.c text 9 | *.cpp text 10 | *.h text 11 | *.hpp text 12 | *.ino text 13 | *.py text 14 | 15 | 16 | *.sh text eol=lf 17 | *.bat text eol=crlf -------------------------------------------------------------------------------- /.github/workflows/commit_formatting.yml: -------------------------------------------------------------------------------- 1 | name: Commit message check 2 | 3 | on: [push, pull_request] 4 | 5 | concurrency: 6 | group: ${{ github.workflow }}-${{ github.ref }} 7 | cancel-in-progress: true 8 | 9 | jobs: 10 | build: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v4 14 | with: 15 | fetch-depth: '100' 16 | - uses: actions/setup-python@v5 17 | - name: Check commit message formatting 18 | run: source tools/ci.sh && ci_commit_formatting_run 19 | -------------------------------------------------------------------------------- /.github/workflows/compile-examples.yml: -------------------------------------------------------------------------------- 1 | name: Compile examples 2 | 3 | on: 4 | push: 5 | 6 | jobs: 7 | compile-examples: 8 | uses: Infineon/arduino-devops/.github/workflows/compile-examples.yml@latest 9 | secrets: inherit -------------------------------------------------------------------------------- /.github/workflows/docs.yml: -------------------------------------------------------------------------------- 1 | name: Build docs 2 | 3 | on: 4 | push: 5 | paths: 6 | - docs/** 7 | pull_request: 8 | paths: 9 | - docs/** 10 | 11 | concurrency: 12 | group: ${{ github.workflow }}-${{ github.ref }} 13 | cancel-in-progress: true 14 | 15 | jobs: 16 | build: 17 | runs-on: ubuntu-latest 18 | 19 | steps: 20 | - uses: actions/checkout@v4 21 | - uses: actions/setup-python@v5 22 | - name: Install Python packages 23 | run: pip install -r docs/requirements.txt 24 | - name: Build docs 25 | run: make -C docs/ html 26 | -------------------------------------------------------------------------------- /.github/workflows/pre-commit.yaml: -------------------------------------------------------------------------------- 1 | name: Pre-commit checks 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | pull_request: 8 | branches: 9 | - master 10 | 11 | jobs: 12 | pre-commit: 13 | runs-on: ubuntu-latest 14 | 15 | steps: 16 | - name: Check out code 17 | uses: actions/checkout@v4 18 | 19 | - name: Set up Python 20 | uses: actions/setup-python@v5 21 | with: 22 | python-version: '3.x' 23 | 24 | - name: Install pre-commit 25 | run: pip install pre-commit 26 | 27 | - name: Run pre-commit 28 | run: pre-commit run --all-files -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Release 2 | 3 | on: 4 | push: 5 | tags: 6 | - '[0-9]+.[0-9]+.[0-9]+**' 7 | workflow_dispatch: 8 | inputs: 9 | version: 10 | description: 'Release version' 11 | required: true 12 | default: '' 13 | type: choice 14 | options: 15 | - patch 16 | - minor 17 | - major 18 | 19 | jobs: 20 | arduino-devops: 21 | uses: Infineon/arduino-devops/.github/workflows/release.yml@latest 22 | with: 23 | version: ${{ inputs.version }} 24 | secrets: inherit -------------------------------------------------------------------------------- /.github/workflows/stale_issues.yml: -------------------------------------------------------------------------------- 1 | name: 'Close stale issues/PRs' 2 | on: 3 | schedule: 4 | - cron: "50 14 */2 * *" 5 | 6 | jobs: 7 | call-workflow: 8 | uses: Infineon/workflows/.github/workflows/epe_stale_issues.yml@master -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # vscode 2 | .history 3 | .vscode 4 | .editorconfig 5 | 6 | # build folder 7 | pkg_build 8 | build 9 | 10 | # python 11 | **/__pycache__/ 12 | venv/ 13 | myenv/ 14 | 15 | # code-check standards and reports 16 | misra.txt 17 | clang-tidy-report.txt 18 | 19 | scan-build-reports/ 20 | 21 | cppcheck_reports/ 22 | cppcheck.checkers 23 | err.xml 24 | 25 | # Ignore docs build (Sphinx) 26 | docs/build 27 | docs/source/_build 28 | __pycache__/ 29 | _build/ 30 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "arduino-core-tests"] 2 | path = tests/arduino-core-tests 3 | url = https://github.com/Infineon/arduino-core-tests.git 4 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | repos: 2 | - repo: https://github.com/pre-commit/mirrors-clang-format 3 | rev: "v18.1.3" 4 | hooks: 5 | - id: clang-format 6 | args: ["-style=file:config/clang-format/.clang-format"] 7 | exclude: ^cores/(avr|usblib|xmc_lib)/ 8 | files: \.(c|cpp|h|hpp)$ 9 | - repo: local 10 | hooks: 11 | - id: verifygitlog 12 | name: git commit message format checker 13 | entry: python3 tools/verifygitlog.py --check-file --ignore-rebase 14 | language: python 15 | verbose: true 16 | stages: [commit-msg] -------------------------------------------------------------------------------- /.readthedocs.yaml: -------------------------------------------------------------------------------- 1 | # .readthedocs.yaml 2 | # Read the Docs configuration file 3 | # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details 4 | 5 | # Required 6 | version: 2 7 | 8 | # Set the version of Python and other tools you might need 9 | build: 10 | os: ubuntu-22.04 11 | tools: 12 | python: "3.11" 13 | 14 | # Build documentation in the docs/ directory with Sphinx 15 | sphinx: 16 | configuration: docs/conf.py 17 | 18 | # We recommend specifying your dependencies to enable reproducible builds: 19 | # https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html 20 | python: 21 | install: 22 | - requirements: docs/requirements.txt 23 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to XMC for Arduino 2 | First important point: **All Contributions** are welcomed :open_hands:. 3 | 4 | Please contribute and raise issues via the [github repository](https://github.com/Infineon/XMC-for-Arduino/tree/master). 5 | 6 | ## Overview for Contributors 7 | 8 | - Start your contribution by creating a [fork](https://github.com/Infineon/XMC-for-Arduino/fork) of this repository. 9 | - It's recommended to create a separate branch for your contribution in your fork. 10 | - Once your contribution is ready & tested, please create a [Pull Request](https://github.com/Infineon/XMC-for-Arduino/compare) to the master branch. We have some automated tests, so make sure you've browsed our [CODE CONVENTION](CODE_CONVENTION.md) and [development instructions](https://xmc-arduino.readthedocs.io/en/latest/development-instructions.html) 11 | - Once we merged your changes to the master branch, they are automatically included in the next release. 12 | 13 | ## Development 14 | Please check [development instructions](https://xmc-arduino.readthedocs.io/en/latest/development-instructions.html) section in our documentation for more information on how to set up your development enviroment and start developing XMC4Arduino! -------------------------------------------------------------------------------- /ci-matrix-config.yml: -------------------------------------------------------------------------------- 1 | sketch: 2 | - libraries/LED 3 | - libraries/RTC/examples/SimpleRTC 4 | - libraries/SPI 5 | - libraries/Wire 6 | - libraries/DeviceControlXMC/examples/DieTemperatureMeasurement/DieTemperatureMeasurement.ino 7 | - libraries/DeviceControlXMC/examples/HeapMemoryMeasurement/HeapMemoryMeasurement.ino 8 | - libraries/DeviceControlXMC/examples/StackMemoryMeasurement/StackMemoryMeasurement.ino 9 | 10 | include: 11 | - fqbn: Infineon:xmc:XMC1100_Boot_Kit 12 | sketch: 13 | - libraries/I2S 14 | - libraries/DeviceControlXMC/examples/SleepModeXMC1100/SleepModeXMC1100.ino 15 | - fqbn: Infineon:xmc:XMC1100_XMC2GO 16 | sketch: 17 | - libraries/I2S 18 | - libraries/DeviceControlXMC/examples/SleepModeXMC1100/SleepModeXMC1100.ino 19 | - fqbn: Infineon:xmc:XMC1300_Boot_Kit 20 | sketch: 21 | - libraries/DeviceControlXMC/examples/SleepModeXMC1100/SleepModeXMC1100.ino 22 | - fqbn: Infineon:xmc:XMC1400_XMC2GO 23 | sketch: 24 | - libraries/I2S 25 | - libraries/DeviceControlXMC/examples/SleepModeXMC1100/SleepModeXMC1100.ino 26 | - libraries/CAN 27 | - fqbn: Infineon:xmc:XMC1400_Arduino_Kit 28 | sketch: 29 | - libraries/DeviceControlXMC/examples/SleepModeXMC1100/SleepModeXMC1100.ino 30 | - fqbn: Infineon:xmc:XMC4200_Platform2GO 31 | sketch: 32 | - libraries/RTC/examples/AlarmRTC/AlarmRTC.ino 33 | - libraries/CAN 34 | - fqbn: Infineon:xmc:XMC4400_Platform2GO 35 | sketch: 36 | - libraries/CAN 37 | - fqbn: Infineon:xmc:XMC4700_Relax_Kit 38 | sketch: 39 | - libraries/I2S 40 | - libraries/DeviceControlXMC/examples/SleepModeXMC4700/SleepModeXMC4700.ino 41 | - libraries/DMA 42 | - libraries/RTC/examples/AlarmRTC/AlarmRTC.ino 43 | - libraries/CAN 44 | 45 | exclude: 46 | - fqbn: Infineon:xmc:XMC1400_XMC2GO 47 | sketch: 48 | - libraries/DeviceControlXMC/examples/StackMemoryMeasurement/StackMemoryMeasurement.ino 49 | - fqbn: Infineon:xmc:XMC1400_Arduino_Kit 50 | sketch: 51 | - libraries/DeviceControlXMC/examples/StackMemoryMeasurement/StackMemoryMeasurement.ino 52 | - fqbn: Infineon:xmc:XMC4200_Platform2GO 53 | sketch: 54 | - libraries/DeviceControlXMC/examples/DieTemperatureMeasurement/DieTemperatureMeasurement.ino 55 | - libraries/DeviceControlXMC/examples/HeapMemoryMeasurement/HeapMemoryMeasurement.ino 56 | - fqbn: Infineon:xmc:XMC4400_Platform2GO 57 | sketch: 58 | - libraries/DeviceControlXMC/examples/DieTemperatureMeasurement/DieTemperatureMeasurement.ino 59 | - libraries/DeviceControlXMC/examples/HeapMemoryMeasurement/HeapMemoryMeasurement.ino 60 | -------------------------------------------------------------------------------- /config/clang-format/.clang-format: -------------------------------------------------------------------------------- 1 | --- 2 | # We'll use defaults from the LLVM style, but with 4 columns indentation. 3 | #BasedOnStyle: GNU 4 | BasedOnStyle: LLVM 5 | #BasedOnStyle: Google 6 | #BasedOnStyle: Mozilla 7 | #BasedOnStyle: Chromium 8 | IndentWidth: 4 9 | --- 10 | Language: Cpp 11 | # BasedOnStyle: Google 12 | AccessModifierOffset: -4 13 | Standard: c++17 14 | TabWidth: 2 15 | UseTab: Never 16 | ColumnLimit: 100 17 | AlignAfterOpenBracket: Align 18 | BinPackParameters: false 19 | AlignEscapedNewlines: Left 20 | AlwaysBreakTemplateDeclarations: Yes 21 | PackConstructorInitializers: Never 22 | BreakConstructorInitializersBeforeComma: false 23 | IndentPPDirectives: BeforeHash 24 | SortIncludes: Never 25 | SeparateDefinitionBlocks: Always 26 | ... 27 | -------------------------------------------------------------------------------- /config/clang-tidy/.clang-tidy: -------------------------------------------------------------------------------- 1 | Checks: 'cppcoreguidelines-*, 2 | performance-*, 3 | modernize-*, 4 | google-*, 5 | misc-* 6 | cert-*, 7 | readability-*, 8 | clang-analyzer-*, 9 | -performance-unnecessary-value-param, 10 | -modernize-use-trailing-return-type, 11 | -google-runtime-references, 12 | -misc-non-private-member-variables-in-classes, 13 | -readability-braces-around-statements, 14 | -google-readability-braces-around-statements, 15 | -cppcoreguidelines-avoid-magic-numbers, 16 | -readability-magic-numbers, 17 | -readability-magic-numbers, 18 | -cppcoreguidelines-pro-type-vararg, 19 | -cppcoreguidelines-pro-bounds-pointer-arithmetic, 20 | -cppcoreguidelines-avoid-c-arrays, 21 | -modernize-avoid-c-arrays, 22 | -cppcoreguidelines-pro-bounds-array-to-pointer-decay, 23 | -readability-named-parameter, 24 | -cert-env33-c 25 | ' 26 | 27 | 28 | WarningsAsErrors: '' 29 | HeaderFilterRegex: '.*' 30 | #HeaderFilterRegex: '*spdlog/[^f].*' 31 | #AnalyzeTemporaryDtors: false 32 | FormatStyle: none 33 | 34 | CheckOptions: 35 | - key: google-readability-braces-around-statements.ShortStatementLines 36 | value: '1' 37 | - key: google-readability-function-size.StatementThreshold 38 | value: '800' 39 | - key: google-readability-namespace-comments.ShortNamespaceLines 40 | value: '10' 41 | - key: google-readability-namespace-comments.SpacesBeforeComments 42 | value: '2' 43 | - key: modernize-loop-convert.MaxCopySize 44 | value: '16' 45 | - key: modernize-loop-convert.MinConfidence 46 | value: reasonable 47 | - key: modernize-loop-convert.NamingStyle 48 | value: CamelCase 49 | - key: modernize-pass-by-value.IncludeStyle 50 | value: llvm 51 | - key: modernize-replace-auto-ptr.IncludeStyle 52 | value: llvm 53 | - key: modernize-use-nullptr.NullMacros 54 | value: 'NULL' 55 | -------------------------------------------------------------------------------- /config/cppcheck/misra.json: -------------------------------------------------------------------------------- 1 | { 2 | "script": "misra.py", 3 | "args": [ "--rule-texts=config/cppcheck/misra.txt" ] 4 | } -------------------------------------------------------------------------------- /config/cppcheck/misra.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Infineon/XMC-for-Arduino/73fcadf1f0bd7379eaaa3b081ed7d5a06b3b0293/config/cppcheck/misra.txt -------------------------------------------------------------------------------- /cores/Client.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011 Arduino. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef client_h 20 | #define client_h 21 | 22 | //**************************************************************************** 23 | // @Project Includes 24 | //**************************************************************************** 25 | #include "Print.h" 26 | #include "Stream.h" 27 | #include "IPAddress.h" 28 | 29 | //**************************************************************************** 30 | // @Class Definitions 31 | //**************************************************************************** 32 | class Client : public Stream { 33 | 34 | public: 35 | virtual int connect(IPAddress ip, uint16_t port) = 0; 36 | virtual int connect(const char *host, uint16_t port) = 0; 37 | virtual size_t write(uint8_t) = 0; 38 | virtual size_t write(const uint8_t *buf, size_t size) = 0; 39 | virtual int available() = 0; 40 | virtual int read() = 0; 41 | virtual int read(uint8_t *buf, size_t size) = 0; 42 | virtual int peek() = 0; 43 | virtual void flush() = 0; 44 | virtual void stop() = 0; 45 | virtual uint8_t connected() = 0; 46 | virtual operator bool() = 0; 47 | 48 | protected: 49 | uint8_t *rawIPAddress(IPAddress &addr) { return addr.raw_address(); }; 50 | }; 51 | 52 | #endif /* client_h */ 53 | -------------------------------------------------------------------------------- /cores/Main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011 Arduino. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | //**************************************************************************** 20 | // @Defines 21 | //**************************************************************************** 22 | #define ARDUINO_MAIN 23 | 24 | //**************************************************************************** 25 | // @Project Includes 26 | //**************************************************************************** 27 | #include "Arduino.h" 28 | 29 | // work around to use new operator 30 | extern "C" void *_sbrk(int incr); 31 | void dummy_sbrk_caller() __attribute__((__used__)); 32 | 33 | void dummy_sbrk_caller() { _sbrk(0); } 34 | 35 | int main(void) { 36 | /* 37 | * Initialization Time first to get closer to startup time accuracy 38 | */ 39 | wiring_time_init(); 40 | wiring_analog_init(); 41 | // Initialize the reset pin for the XMC1100 Boot Kit series and XMC1400 Kit for Arduino as they are 42 | // based on Arduino form-factor Hence, a dedicated reset pin is required. 43 | #ifdef HAS_GPIO_RESET 44 | reset_init(); 45 | #endif 46 | 47 | // Arduino's main() function just calls setup() and loop().... 48 | setup(); 49 | while (1) { 50 | loop(); 51 | serialEventRun(); 52 | } 53 | } 54 | 55 | //**************************************************************************** 56 | // END OF FILE 57 | //**************************************************************************** 58 | -------------------------------------------------------------------------------- /cores/Printable.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011 Arduino. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef Printable_h 20 | #define Printable_h 21 | 22 | #ifdef __cplusplus 23 | 24 | //**************************************************************************** 25 | // @Project Includes 26 | //**************************************************************************** 27 | #include 28 | 29 | //**************************************************************************** 30 | // @Class Definitions 31 | //**************************************************************************** 32 | class Print; 33 | 34 | /** The Printable class provides a way for new classes to allow themselves to be printed. 35 | By deriving from Printable and implementing the printTo method, it will then be possible 36 | for users to print out instances of this class by passing them into the usual 37 | Print::print and Print::println methods. 38 | */ 39 | class Printable { 40 | public: 41 | virtual size_t printTo(Print &p) const = 0; 42 | }; 43 | 44 | #endif // __cplusplus 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /cores/RingBuffer.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011 Arduino. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | //**************************************************************************** 20 | // @Project Includes 21 | //**************************************************************************** 22 | #include "RingBuffer.h" 23 | #include 24 | 25 | //**************************************************************************** 26 | // @Local Functions 27 | //**************************************************************************** 28 | 29 | // Constructors //////////////////////////////////////////////////////////////// 30 | 31 | RingBuffer::RingBuffer(void) { 32 | memset((void *)_aucBuffer, 0, SERIAL_BUFFER_SIZE); 33 | _iHead = 0; 34 | _iTail = 0; 35 | } 36 | 37 | void RingBuffer::store_char(uint8_t c) { 38 | int i = (uint32_t)(_iHead + 1) % SERIAL_BUFFER_SIZE; 39 | 40 | // if we should be storing the received character into the location 41 | // just before the tail (meaning that the head would advance to the 42 | // current location of the tail), we're about to overflow the buffer 43 | // and so we don't write the character or advance the head. 44 | if (i != _iTail) { 45 | _aucBuffer[_iHead] = c; 46 | _iHead = i; 47 | } 48 | } 49 | 50 | //**************************************************************************** 51 | // END OF FILE 52 | //**************************************************************************** 53 | -------------------------------------------------------------------------------- /cores/RingBuffer.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011 Arduino. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef _RING_BUFFER_ 20 | #define _RING_BUFFER_ 21 | 22 | #include 23 | 24 | // Define constants and variables for buffering incoming serial data. We're 25 | // using a ring buffer, in which head is the index of the location 26 | // to which to write the next incoming character and tail is the index of the 27 | // location from which to read. 28 | #define SERIAL_BUFFER_SIZE 128 29 | 30 | class RingBuffer { 31 | public: 32 | volatile uint8_t _aucBuffer[SERIAL_BUFFER_SIZE]; 33 | volatile int _iHead; 34 | volatile int _iTail; 35 | 36 | public: 37 | RingBuffer(void); 38 | void store_char(uint8_t c); 39 | }; 40 | 41 | #endif /* _RING_BUFFER_ */ 42 | -------------------------------------------------------------------------------- /cores/Server.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011 Arduino. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef server_h 20 | #define server_h 21 | 22 | //**************************************************************************** 23 | // @Project Includes 24 | //**************************************************************************** 25 | #include "Print.h" 26 | 27 | //**************************************************************************** 28 | // @Class Definitions 29 | //**************************************************************************** 30 | class Server : public Print { 31 | public: 32 | virtual void begin() = 0; 33 | }; 34 | 35 | #endif /* server_h */ 36 | -------------------------------------------------------------------------------- /cores/Tone.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011 Arduino. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | 18 | Copyright (c) 2018 Infineon Technologies AG 19 | This file has been modified for the XMC microcontroller series. 20 | */ 21 | #ifndef _WIRING_TONE_ 22 | #define _WIRING_TONE_ 23 | 24 | //**************************************************************************** 25 | // @External Prototypes 26 | //**************************************************************************** 27 | extern void tone(uint8_t, unsigned int, unsigned long = 0); 28 | #ifdef __cplusplus 29 | extern "C" { 30 | #endif 31 | extern void noTone(uint8_t); 32 | extern int tone_irq_action(int, int16_t); 33 | #ifdef __cplusplus 34 | } 35 | #endif 36 | 37 | #endif /* _WIRING_TONE_ */ 38 | -------------------------------------------------------------------------------- /cores/WInterrupts.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011 Arduino. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | 18 | Copyright (c) 2018 Infineon Technologies AG 19 | This file has been modified for the XMC microcontroller series. 20 | */ 21 | 22 | #ifndef W_INTERRUPTS_H 23 | #define W_INTERRUPTS_H 24 | 25 | //**************************************************************************** 26 | // @Project Includes 27 | //**************************************************************************** 28 | #include 29 | 30 | //**************************************************************************** 31 | // @Defines 32 | //**************************************************************************** 33 | #define INT0 0 34 | #define INT1 1 35 | 36 | #define PIN_INTERRUPT_NO_MODE 5 37 | #define FALLING 0 // same define as for LOW 38 | #define RISING 1 // same define as for HIGH 39 | #define CHANGE 2 40 | 41 | //**************************************************************************** 42 | // @Typedefs 43 | //**************************************************************************** 44 | typedef void (*interrupt_cb_t)(void); 45 | 46 | //**************************************************************************** 47 | // @External Prototypes 48 | //**************************************************************************** 49 | void attachInterrupt(uint32_t, interrupt_cb_t, uint32_t); 50 | void detachInterrupt(uint32_t); 51 | 52 | #endif /* W_INTERRUPTS_H */ 53 | -------------------------------------------------------------------------------- /cores/WMath.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011 Arduino. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | //**************************************************************************** 20 | // @Project Includes 21 | //**************************************************************************** 22 | extern "C" { 23 | #include "stdlib.h" 24 | #include "stdint.h" 25 | } 26 | 27 | #include "WMath.h" 28 | 29 | //**************************************************************************** 30 | // @Local Functions 31 | //**************************************************************************** 32 | 33 | void randomSeed(uint32_t dwSeed) { 34 | if (dwSeed != 0) { 35 | srand(dwSeed); 36 | } 37 | } 38 | 39 | long random(long howbig) { 40 | if (howbig == 0) { 41 | return 0; 42 | } 43 | 44 | return rand() % howbig; 45 | } 46 | 47 | long random(long howsmall, long howbig) { 48 | if (howsmall >= howbig) { 49 | return howsmall; 50 | } 51 | 52 | long diff = howbig - howsmall; 53 | 54 | return random(diff) + howsmall; 55 | } 56 | 57 | extern uint16_t makeWord(uint16_t w) { return w; } 58 | 59 | uint16_t makeWord(uint8_t h, uint8_t l) { return (h << 8) | l; } 60 | 61 | //**************************************************************************** 62 | // END OF FILE 63 | //**************************************************************************** 64 | -------------------------------------------------------------------------------- /cores/WMath.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011 Arduino. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef _WIRING_MATH_ 20 | #define _WIRING_MATH_ 21 | 22 | //**************************************************************************** 23 | // @External Prototypes 24 | //**************************************************************************** 25 | extern long random(long); 26 | extern long random(long, long); 27 | extern void randomSeed(uint32_t dwSeed); 28 | 29 | extern uint16_t makeWord(uint16_t w); 30 | extern uint16_t makeWord(uint8_t h, uint8_t l); 31 | 32 | //**************************************************************************** 33 | // @Defines 34 | //**************************************************************************** 35 | #define word(...) makeWord(__VA_ARGS__) 36 | 37 | #endif /* _WIRING_MATH_ */ 38 | -------------------------------------------------------------------------------- /cores/Wprogram.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011 Arduino. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef WPROGRAM_H_ 20 | #define WPROGRAM_H_ 21 | 22 | //**************************************************************************** 23 | // @Defines 24 | //**************************************************************************** 25 | #define _STDBOOL_H 26 | 27 | //**************************************************************************** 28 | // @Project Includes 29 | //**************************************************************************** 30 | 31 | #endif /* WPROGRAM_H_ */ 32 | -------------------------------------------------------------------------------- /cores/abi.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011 Arduino. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | //**************************************************************************** 20 | // @Project Includes 21 | //**************************************************************************** 22 | #include 23 | 24 | //**************************************************************************** 25 | // @External Prototypes 26 | //**************************************************************************** 27 | extern "C" void __cxa_pure_virtual(void) __attribute__((__noreturn__)); 28 | extern "C" void __cxa_deleted_virtual(void) __attribute__((__noreturn__)); 29 | 30 | //**************************************************************************** 31 | // @Local Functions 32 | //**************************************************************************** 33 | void __cxa_pure_virtual(void) { 34 | // We might want to write some diagnostics to uart in this case 35 | // std::terminate(); 36 | while (1) 37 | ; 38 | } 39 | 40 | void __cxa_deleted_virtual(void) { 41 | // We might want to write some diagnostics to uart in this case 42 | // std::terminate(); 43 | while (1) 44 | ; 45 | } 46 | 47 | //**************************************************************************** 48 | // END OF FILE 49 | //**************************************************************************** 50 | -------------------------------------------------------------------------------- /cores/avr/dtostrf.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011 Arduino. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | 20 | #ifndef DTOSTRF_H_ 21 | #define DTOSTRF_H_ 22 | 23 | //**************************************************************************** 24 | // @External Prototypes 25 | //**************************************************************************** 26 | 27 | /* 28 | * \brief Converts a double into string.. 29 | * 30 | * \param val The double value to convert 31 | * \param width Number of digits before the "." 32 | * \param prec Number of digits after the "." 33 | * \param s Resultant output string 34 | */ 35 | 36 | char* dtostrf (double val, signed int width, unsigned int prec, char *s); 37 | 38 | 39 | #endif /* DTOSTRF_H_ */ 40 | -------------------------------------------------------------------------------- /cores/avr/interrupt.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015 Arduino LCC. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | /* 20 | Empty file. 21 | This file is here to allow compatibility with sketches (made for AVR) 22 | that includes 23 | */ 24 | -------------------------------------------------------------------------------- /cores/avr/io.h: -------------------------------------------------------------------------------- 1 | /* 2 | io.h - Definitions for compatibility with AVR io macros 3 | 4 | Copyright (c) 2016 Arduino LLC 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE 23 | */ 24 | 25 | //#ifndef _IO_H_ 26 | //#define _IO_H_ 27 | // 28 | //#define RAMSTART (HMCRAMC0_ADDR) 29 | //#define RAMSIZE (HMCRAMC0_SIZE) 30 | //#define RAMEND (RAMSTART + RAMSIZE - 1) 31 | // 32 | //#endif 33 | 34 | /* 35 | Empty file. 36 | This file is here to allow compatibility with sketches (made for AVR) 37 | that includes 38 | */ -------------------------------------------------------------------------------- /cores/hooks.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012 Arduino. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | /** 20 | * Empty yield() hook. 21 | * 22 | * This function is intended to be used by library writers to build 23 | * libraries or sketches that supports cooperative threads. 24 | * 25 | * Its defined as a weak symbol and it can be redefined to implement a 26 | * real cooperative scheduler. 27 | */ 28 | static void __empty() { 29 | // Empty 30 | } 31 | 32 | void yield(void) __attribute__((weak, alias("__empty"))); 33 | -------------------------------------------------------------------------------- /cores/itoa.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011 Arduino. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef _ITOA_ 20 | #define _ITOA_ 21 | 22 | //**************************************************************************** 23 | // @External Prototypes 24 | //**************************************************************************** 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif // __cplusplus 29 | 30 | #if 0 31 | 32 | extern void itoa( int n, char s[] ) ; 33 | 34 | #else 35 | 36 | extern char *itoa(int value, char *string, int radix); 37 | extern char *ltoa(long value, char *string, int radix); 38 | extern char *utoa(unsigned int value, char *string, int radix); 39 | extern char *ultoa(unsigned long value, char *string, int radix); 40 | #endif /* 0 */ 41 | 42 | #ifdef __cplusplus 43 | } // extern "C" 44 | #endif // __cplusplus 45 | 46 | #endif // _ITOA_ 47 | -------------------------------------------------------------------------------- /cores/new.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011 Arduino. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | //**************************************************************************** 20 | // @Project Includes 21 | //**************************************************************************** 22 | #include 23 | 24 | //**************************************************************************** 25 | // @Local Functions 26 | //**************************************************************************** 27 | 28 | void *operator new(size_t size) { return malloc(size); } 29 | 30 | void *operator new[](size_t size) { return malloc(size); } 31 | 32 | void operator delete(void *ptr) { free(ptr); } 33 | 34 | void operator delete[](void *ptr) { free(ptr); } 35 | 36 | //**************************************************************************** 37 | // END OF FILE 38 | //**************************************************************************** 39 | -------------------------------------------------------------------------------- /cores/reset.h: -------------------------------------------------------------------------------- 1 | /** 2 | * reset.h - Handling the reset for the XMC1100 Boot Kit. 3 | * 4 | * Have a look at the application note/reference manual for more information. 5 | * 6 | * Copyright (c) 2018 Infineon Technologies AG 7 | * 8 | * Redistribution and use in source and binary forms, with or without modification, are permitted 9 | * provided that the following conditions are met: 10 | * 11 | * Redistributions of source code must retain the above copyright notice, this list of conditions 12 | * and the following disclaimer. 13 | * 14 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions 15 | * and the following disclaimer in the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * Neither the name of the copyright holders nor the names of its contributors may be used to 19 | * endorse or promote products derived from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 22 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 23 | * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR 28 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 29 | * OF SUCH DAMAGE. 30 | */ 31 | 32 | #ifndef Reset_h 33 | #define Reset_h 34 | 35 | //**************************************************************************** 36 | // @External Prototypes 37 | //**************************************************************************** 38 | 39 | /* 40 | * \brief Configures the reset pin for the selected board. 41 | */ 42 | extern void reset_init(void); 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /cores/usblib/Common/ArchitectureSpecific.h: -------------------------------------------------------------------------------- 1 | #ifdef XMC4_SERIES 2 | 3 | /* 4 | LUFA Library 5 | Copyright (C) Dean Camera, 2014. 6 | 7 | dean [at] fourwalledcubicle [dot] com 8 | www.lufa-lib.org 9 | */ 10 | 11 | /* 12 | Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) 13 | 14 | Permission to use, copy, modify, distribute, and sell this 15 | software and its documentation for any purpose is hereby granted 16 | without fee, provided that the above copyright notice appear in 17 | all copies and that both that the copyright notice and this 18 | permission notice and warranty disclaimer appear in supporting 19 | documentation, and that the name of the author not be used in 20 | advertising or publicity pertaining to distribution of the 21 | software without specific, written prior permission. 22 | 23 | The author disclaims all warranties with regard to this 24 | software, including all implied warranties of merchantability 25 | and fitness. In no event shall the author be liable for any 26 | special, indirect or consequential damages or any damages 27 | whatsoever resulting from loss of use, data or profits, whether 28 | in an action of contract, negligence or other tortious action, 29 | arising out of or in connection with the use or performance of 30 | this software. 31 | */ 32 | 33 | /** \file 34 | * \brief Architecture specific definitions relating to specific processor architectures. 35 | * 36 | * \copydetails Group_ArchitectureSpecific 37 | * 38 | * \note Do not include this file directly, rather include the Common.h header file instead to gain this file's 39 | * functionality. 40 | */ 41 | 42 | /** \ingroup Group_Common 43 | * \defgroup Group_ArchitectureSpecific Architecture Specific Definitions 44 | * \brief Architecture specific definitions relating to specific processor architectures. 45 | * 46 | * Architecture specific macros, functions and other definitions, which relate to specific architectures. This 47 | * definitions may or may not be available in some form on other architectures, and thus should be protected by 48 | * preprocessor checks in portable code to prevent compile errors. 49 | * 50 | * @{ 51 | */ 52 | 53 | #ifndef __LUFA_ARCHSPEC_H__ 54 | #define __LUFA_ARCHSPEC_H__ 55 | 56 | /* Preprocessor Checks: */ 57 | #if !defined(__INCLUDE_FROM_COMMON_H) 58 | #error Do not include this file directly. Include LUFA/Common/Common.h instead to gain this functionality. 59 | #endif 60 | 61 | /* Enable C linkage for C++ Compilers: */ 62 | #if defined(__cplusplus) 63 | extern "C" { 64 | #endif 65 | 66 | /* Public Interface - May be used in end-application: */ 67 | /* Macros: */ 68 | 69 | /* Disable C linkage for C++ Compilers: */ 70 | #if defined(__cplusplus) 71 | } 72 | #endif 73 | 74 | #endif 75 | 76 | /** @} */ 77 | 78 | 79 | #endif /* UC_FAMILY == XMC4 */ 80 | -------------------------------------------------------------------------------- /cores/usblib/Common/Architectures.h: -------------------------------------------------------------------------------- 1 | #ifdef XMC4_SERIES 2 | 3 | /* 4 | LUFA Library 5 | Copyright (C) Dean Camera, 2014. 6 | 7 | dean [at] fourwalledcubicle [dot] com 8 | www.lufa-lib.org 9 | */ 10 | 11 | /* 12 | Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) 13 | 14 | Permission to use, copy, modify, distribute, and sell this 15 | software and its documentation for any purpose is hereby granted 16 | without fee, provided that the above copyright notice appear in 17 | all copies and that both that the copyright notice and this 18 | permission notice and warranty disclaimer appear in supporting 19 | documentation, and that the name of the author not be used in 20 | advertising or publicity pertaining to distribution of the 21 | software without specific, written prior permission. 22 | 23 | The author disclaims all warranties with regard to this 24 | software, including all implied warranties of merchantability 25 | and fitness. In no event shall the author be liable for any 26 | special, indirect or consequential damages or any damages 27 | whatsoever resulting from loss of use, data or profits, whether 28 | in an action of contract, negligence or other tortious action, 29 | arising out of or in connection with the use or performance of 30 | this software. 31 | */ 32 | 33 | /** \file 34 | * \brief Supported library architecture defines. 35 | * 36 | * \copydetails Group_Architectures 37 | * 38 | * \note Do not include this file directly, rather include the Common.h header file instead to gain this file's 39 | * functionality. 40 | */ 41 | 42 | /** \ingroup Group_Common 43 | * \defgroup Group_Architectures Hardware Architectures 44 | * \brief Supported library architecture defines. 45 | * 46 | * Architecture macros for selecting the desired target microcontroller architecture. One of these values should be 47 | * defined as the value of \c ARCH in the user project makefile via the \c -D compiler switch to GCC, to select the 48 | * target architecture. 49 | * 50 | * The selected architecture should remain consistent with the makefile \c ARCH value, which is used to select the 51 | * underlying driver source files for each architecture. 52 | * 53 | * @{ 54 | */ 55 | 56 | #ifndef __LUFA_ARCHITECTURES_H__ 57 | #define __LUFA_ARCHITECTURES_H__ 58 | 59 | /* Preprocessor Checks: */ 60 | #if !defined(__INCLUDE_FROM_COMMON_H) 61 | #error Do not include this file directly. Include LUFA/Common/Common.h instead to gain this functionality. 62 | #endif 63 | 64 | /* Public Interface - May be used in end-application: */ 65 | /* Macros: */ 66 | 67 | #endif 68 | 69 | /** @} */ 70 | 71 | 72 | #endif /* UC_FAMILY == XMC4 */ 73 | -------------------------------------------------------------------------------- /cores/usblib/Common/memcpy.c: -------------------------------------------------------------------------------- 1 | #ifdef XMC4_SERIES 2 | 3 | /* Copyright (C) 2013 - Adam Green (https://github.com/adamgreen) 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | #if defined(USB0) 18 | #include 19 | 20 | #if defined(__GNUC__) 21 | /* This is a hand written Thumb-2 assembly language version of the 22 | standard C memcpy() function that can be used by the lwIP networking 23 | stack to improve its performance. It copies 4 bytes at a time and 24 | unrolls the loop to perform 4 of these copies per loop iteration. 25 | */ 26 | __attribute__((naked)) void thumb2_memcpy(void* pDest, const void* pSource, size_t length) 27 | { 28 | __asm ( 29 | ".syntax unified\n" 30 | ".thumb\n" 31 | 32 | // Copy 16 bytes at a time first. 33 | " lsrs r3, r2, #4\n" 34 | " beq.n 2$\n" 35 | "1$: ldr r12, [r1], #4\n" 36 | " str r12, [r0], #4\n" 37 | " ldr r12, [r1], #4\n" 38 | " str r12, [r0], #4\n" 39 | " ldr r12, [r1], #4\n" 40 | " str r12, [r0], #4\n" 41 | " ldr r12, [r1], #4\n" 42 | " str r12, [r0], #4\n" 43 | " subs r3, #1\n" 44 | " bne 1$\n" 45 | 46 | // Copy byte by byte for what is left. 47 | "2$:\n" 48 | " ands r3, r2, #0xf\n" 49 | " beq.n 4$\n" 50 | "3$: ldrb r12, [r1], #1\n" 51 | " strb r12, [r0], #1\n" 52 | " subs r3, #1\n" 53 | " bne 3$\n" 54 | 55 | // Return to caller. 56 | "4$: bx lr\n" 57 | ); 58 | } 59 | #endif 60 | 61 | #endif 62 | #endif /* UC_FAMILY == XMC4 */ 63 | -------------------------------------------------------------------------------- /cores/usblib/Core/Events.c: -------------------------------------------------------------------------------- 1 | #ifdef XMC4_SERIES 2 | 3 | /* 4 | LUFA Library 5 | Copyright (C) Dean Camera, 2014. 6 | 7 | dean [at] fourwalledcubicle [dot] com 8 | www.lufa-lib.org 9 | */ 10 | 11 | /* 12 | Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) 13 | 14 | Permission to use, copy, modify, distribute, and sell this 15 | software and its documentation for any purpose is hereby granted 16 | without fee, provided that the above copyright notice appear in 17 | all copies and that both that the copyright notice and this 18 | permission notice and warranty disclaimer appear in supporting 19 | documentation, and that the name of the author not be used in 20 | advertising or publicity pertaining to distribution of the 21 | software without specific, written prior permission. 22 | 23 | The author disclaims all warranties with regard to this 24 | software, including all implied warranties of merchantability 25 | and fitness. In no event shall the author be liable for any 26 | special, indirect or consequential damages or any damages 27 | whatsoever resulting from loss of use, data or profits, whether 28 | in an action of contract, negligence or other tortious action, 29 | arising out of or in connection with the use or performance of 30 | this software. 31 | */ 32 | 33 | #define __INCLUDE_FROM_EVENTS_C 34 | #define __INCLUDE_FROM_USB_DRIVER 35 | #include 36 | 37 | void USB_Event_Stub(void) 38 | { 39 | 40 | } 41 | 42 | 43 | #endif /* UC_FAMILY == XMC4 */ 44 | -------------------------------------------------------------------------------- /cores/usblib/Core/OTG.h: -------------------------------------------------------------------------------- 1 | #ifdef XMC4_SERIES 2 | 3 | /* 4 | LUFA Library 5 | Copyright (C) Dean Camera, 2014. 6 | 7 | dean [at] fourwalledcubicle [dot] com 8 | www.lufa-lib.org 9 | */ 10 | 11 | /* 12 | Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) 13 | 14 | Permission to use, copy, modify, distribute, and sell this 15 | software and its documentation for any purpose is hereby granted 16 | without fee, provided that the above copyright notice appear in 17 | all copies and that both that the copyright notice and this 18 | permission notice and warranty disclaimer appear in supporting 19 | documentation, and that the name of the author not be used in 20 | advertising or publicity pertaining to distribution of the 21 | software without specific, written prior permission. 22 | 23 | The author disclaims all warranties with regard to this 24 | software, including all implied warranties of merchantability 25 | and fitness. In no event shall the author be liable for any 26 | special, indirect or consequential damages or any damages 27 | whatsoever resulting from loss of use, data or profits, whether 28 | in an action of contract, negligence or other tortious action, 29 | arising out of or in connection with the use or performance of 30 | this software. 31 | */ 32 | 33 | /** \file 34 | * \brief Common USB OTG definitions for all architectures. 35 | * \copydetails Group_OTG 36 | * 37 | * \note This file should not be included directly. It is automatically included as needed by the USB driver 38 | * dispatch header located in LUFA/Drivers/USB/USB.h. 39 | */ 40 | 41 | /** \ingroup Group_USB 42 | * \defgroup Group_OTG USB On The Go (OTG) Management 43 | * \brief USB OTG management definitions. 44 | * 45 | * This module contains macros for embedded USB hosts with dual role On The Go capabilities, for managing role 46 | * exchange. OTG is a way for two USB dual role devices to talk to one another directly without fixed device/host 47 | * roles. 48 | * 49 | * @{ 50 | */ 51 | 52 | #ifndef __USBOTG_H__ 53 | #define __USBOTG_H__ 54 | 55 | /* Includes: */ 56 | #include <../Common/Common.h> 57 | #include 58 | 59 | /* Enable C linkage for C++ Compilers: */ 60 | #if defined(__cplusplus) 61 | extern "C" { 62 | #endif 63 | 64 | /* Preprocessor Checks: */ 65 | #if !defined(__INCLUDE_FROM_USB_DRIVER) 66 | #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. 67 | #endif 68 | 69 | /* Disable C linkage for C++ Compilers: */ 70 | #if defined(__cplusplus) 71 | } 72 | #endif 73 | 74 | #endif 75 | 76 | /** @} */ 77 | 78 | 79 | #endif /* UC_FAMILY == XMC4 */ 80 | -------------------------------------------------------------------------------- /cores/usblib/Core/USBInterrupt.h: -------------------------------------------------------------------------------- 1 | #ifdef XMC4_SERIES 2 | 3 | /* 4 | LUFA Library 5 | Copyright (C) Dean Camera, 2014. 6 | 7 | dean [at] fourwalledcubicle [dot] com 8 | www.lufa-lib.org 9 | */ 10 | 11 | /* 12 | Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) 13 | 14 | Permission to use, copy, modify, distribute, and sell this 15 | software and its documentation for any purpose is hereby granted 16 | without fee, provided that the above copyright notice appear in 17 | all copies and that both that the copyright notice and this 18 | permission notice and warranty disclaimer appear in supporting 19 | documentation, and that the name of the author not be used in 20 | advertising or publicity pertaining to distribution of the 21 | software without specific, written prior permission. 22 | 23 | The author disclaims all warranties with regard to this 24 | software, including all implied warranties of merchantability 25 | and fitness. In no event shall the author be liable for any 26 | special, indirect or consequential damages or any damages 27 | whatsoever resulting from loss of use, data or profits, whether 28 | in an action of contract, negligence or other tortious action, 29 | arising out of or in connection with the use or performance of 30 | this software. 31 | */ 32 | 33 | /** \file 34 | * \brief USB controller interrupt service routine management. 35 | * 36 | * This file contains definitions required for the correct handling of low level USB service routine interrupts 37 | * from the USB controller. 38 | * 39 | * \note This file should not be included directly. It is automatically included as needed by the USB driver 40 | * dispatch header located in LUFA/Drivers/USB/USB.h. 41 | */ 42 | 43 | #ifndef __USBINTERRUPT_H__ 44 | #define __USBINTERRUPT_H__ 45 | 46 | /* Includes: */ 47 | #include <../Common/Common.h> 48 | #include 49 | 50 | /* Enable C linkage for C++ Compilers: */ 51 | #if defined(__cplusplus) 52 | extern "C" { 53 | #endif 54 | 55 | /* Preprocessor Checks: */ 56 | #if !defined(__INCLUDE_FROM_USB_DRIVER) 57 | #error Do not include this file directly. Include USB/USB.h instead. 58 | #endif 59 | 60 | /* Architecture Includes: */ 61 | 62 | /* Disable C linkage for C++ Compilers: */ 63 | #if defined(__cplusplus) 64 | } 65 | #endif 66 | 67 | #endif 68 | 69 | 70 | #endif /* UC_FAMILY == XMC4 */ 71 | -------------------------------------------------------------------------------- /cores/usblib/Core/USBTask.c: -------------------------------------------------------------------------------- 1 | #ifdef XMC4_SERIES 2 | 3 | /* 4 | LUFA Library 5 | Copyright (C) Dean Camera, 2014. 6 | 7 | dean [at] fourwalledcubicle [dot] com 8 | www.lufa-lib.org 9 | */ 10 | 11 | /* 12 | Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) 13 | 14 | Permission to use, copy, modify, distribute, and sell this 15 | software and its documentation for any purpose is hereby granted 16 | without fee, provided that the above copyright notice appear in 17 | all copies and that both that the copyright notice and this 18 | permission notice and warranty disclaimer appear in supporting 19 | documentation, and that the name of the author not be used in 20 | advertising or publicity pertaining to distribution of the 21 | software without specific, written prior permission. 22 | 23 | The author disclaims all warranties with regard to this 24 | software, including all implied warranties of merchantability 25 | and fitness. In no event shall the author be liable for any 26 | special, indirect or consequential damages or any damages 27 | whatsoever resulting from loss of use, data or profits, whether 28 | in an action of contract, negligence or other tortious action, 29 | arising out of or in connection with the use or performance of 30 | this software. 31 | */ 32 | #if defined(USB0) 33 | #define __INCLUDE_FROM_USBTASK_C 34 | #define __INCLUDE_FROM_USB_DRIVER 35 | #include 36 | 37 | volatile bool USB_IsInitialized; 38 | USB_Request_Header_t USB_ControlRequest; 39 | 40 | #if defined(USB_CAN_BE_HOST) && !defined(HOST_STATE_AS_GPIOR) 41 | volatile uint8_t USB_HostState; 42 | #endif 43 | 44 | #if defined(USB_CAN_BE_DEVICE) && !defined(DEVICE_STATE_AS_GPIOR) 45 | volatile uint8_t USB_DeviceState; 46 | #endif 47 | 48 | void USB_USBTask(void) 49 | { 50 | #if defined(USB_CAN_BE_BOTH) 51 | if (USB_CurrentMode == USB_MODE_Device) 52 | USB_DeviceTask(); 53 | else if (USB_CurrentMode == USB_MODE_Host) 54 | USB_HostTask(); 55 | #elif defined(USB_CAN_BE_HOST) 56 | USB_HostTask(); 57 | #elif defined(USB_CAN_BE_DEVICE) 58 | USB_DeviceTask(); 59 | #endif 60 | } 61 | 62 | #if defined(USB_CAN_BE_DEVICE) 63 | static void USB_DeviceTask(void) 64 | { 65 | if (USB_DeviceState == DEVICE_STATE_Unattached) 66 | return; 67 | 68 | uint8_t PrevEndpoint = Endpoint_GetCurrentEndpoint(); 69 | 70 | Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP); 71 | 72 | if (Endpoint_IsSETUPReceived()) 73 | USB_Device_ProcessControlRequest(); 74 | 75 | Endpoint_SelectEndpoint(PrevEndpoint); 76 | } 77 | #endif 78 | 79 | #if defined(USB_CAN_BE_HOST) 80 | static void USB_HostTask(void) 81 | { 82 | uint8_t PrevPipe = Pipe_GetCurrentPipe(); 83 | 84 | Pipe_SelectPipe(PIPE_CONTROLPIPE); 85 | 86 | USB_Host_ProcessNextHostState(); 87 | 88 | Pipe_SelectPipe(PrevPipe); 89 | } 90 | #endif 91 | 92 | #endif 93 | #endif /* UC_FAMILY == XMC4 */ 94 | -------------------------------------------------------------------------------- /cores/wiring_digital.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011 Arduino. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | 18 | Copyright (c) 2018 Infineon Technologies AG 19 | This file has been modified for the XMC microcontroller series. 20 | */ 21 | 22 | //**************************************************************************** 23 | // @Project Includes 24 | //**************************************************************************** 25 | #include "Arduino.h" 26 | 27 | void pinMode(uint8_t pin, uint8_t mode) { 28 | XMC_GPIO_CONFIG_t gpio_conf; 29 | gpio_conf.mode = mode; 30 | gpio_conf.output_level = XMC_GPIO_OUTPUT_LEVEL_LOW; 31 | #if UC_FAMILY == XMC1 32 | gpio_conf.input_hysteresis = XMC_GPIO_INPUT_HYSTERESIS_LARGE; 33 | #endif 34 | XMC_GPIO_Init(mapping_port_pin[pin].port, mapping_port_pin[pin].pin, &gpio_conf); 35 | } 36 | 37 | uint8_t digitalRead(uint8_t pin) { 38 | return ((pin == GND) 39 | ? LOW 40 | : XMC_GPIO_GetInput(mapping_port_pin[pin].port, mapping_port_pin[pin].pin)); 41 | } 42 | 43 | void digitalWrite(uint8_t pin, uint8_t value) { 44 | XMC_GPIO_SetOutputLevel(mapping_port_pin[pin].port, mapping_port_pin[pin].pin, 45 | (value == LOW) ? XMC_GPIO_OUTPUT_LEVEL_LOW 46 | : XMC_GPIO_OUTPUT_LEVEL_HIGH); 47 | } 48 | 49 | void digitalToggle(uint8_t pin) { 50 | XMC_GPIO_ToggleOutput(mapping_port_pin[pin].port, mapping_port_pin[pin].pin); 51 | } 52 | 53 | //**************************************************************************** 54 | // END OF FILE 55 | //**************************************************************************** 56 | -------------------------------------------------------------------------------- /cores/wiring_pulse.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011 Arduino. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef _WIRING_PULSE_ 20 | #define _WIRING_PULSE_ 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | //**************************************************************************** 27 | // @External Prototypes 28 | //**************************************************************************** 29 | 30 | /* 31 | * \brief Measures the length (in microseconds) of a pulse on the pin; state is HIGH 32 | * or LOW, the type of pulse to measure. Works on pulses from 2-3 microseconds 33 | * to 3 minutes in length, but must be called at least a few dozen microseconds 34 | * before the start of the pulse. 35 | */ 36 | uint32_t pulseIn(uint32_t pin, uint32_t state, uint32_t timeout); 37 | 38 | #ifdef __cplusplus 39 | // Provides a version of pulseIn with a default argument (C++ only) 40 | uint32_t pulseIn(uint32_t pin, uint32_t state, uint32_t timeout = 1000000L); 41 | 42 | } // extern "C" 43 | #endif 44 | 45 | #endif /* _WIRING_PULSE_ */ 46 | -------------------------------------------------------------------------------- /cores/wiring_shift.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011 Arduino. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | //**************************************************************************** 20 | // @Project Includes 21 | //**************************************************************************** 22 | #include "Arduino.h" 23 | 24 | //**************************************************************************** 25 | // @Local Functions 26 | //**************************************************************************** 27 | 28 | void shiftOut(uint32_t ulDataPin, uint32_t ulClockPin, uint32_t ulBitOrder, uint32_t ulVal) { 29 | uint8_t i; 30 | 31 | for (i = 0; i < 8; i++) { 32 | if (ulBitOrder == LSBFIRST) { 33 | digitalWrite(ulDataPin, !!(ulVal & (1 << i))); 34 | } else { 35 | digitalWrite(ulDataPin, !!(ulVal & (1 << (7 - i)))); 36 | } 37 | 38 | digitalWrite(ulClockPin, HIGH); 39 | digitalWrite(ulClockPin, LOW); 40 | } 41 | } 42 | 43 | uint32_t shiftIn(uint32_t ulDataPin, uint32_t ulClockPin, uint32_t ulBitOrder) { 44 | uint8_t value = 0; 45 | uint8_t i; 46 | 47 | for (i = 0; i < 8; ++i) { 48 | digitalWrite(ulClockPin, HIGH); 49 | 50 | if (ulBitOrder == LSBFIRST) { 51 | value |= digitalRead(ulDataPin) << i; 52 | } else { 53 | value |= digitalRead(ulDataPin) << (7 - i); 54 | } 55 | 56 | digitalWrite(ulClockPin, LOW); 57 | } 58 | 59 | return value; 60 | } 61 | 62 | //**************************************************************************** 63 | // END OF FILE 64 | //**************************************************************************** 65 | -------------------------------------------------------------------------------- /cores/wiring_shift.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011 Arduino. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef WIRING_SHIFT_H_ 20 | #define WIRING_SHIFT_H_ 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | //**************************************************************************** 27 | // @External Prototypes 28 | //**************************************************************************** 29 | 30 | /* 31 | * \brief 32 | */ 33 | extern uint32_t shiftIn(uint32_t ulDataPin, uint32_t ulClockPin, uint32_t ulBitOrder); 34 | 35 | /* 36 | * \brief 37 | */ 38 | extern void shiftOut(uint32_t ulDataPin, uint32_t ulClockPin, uint32_t ulBitOrder, uint32_t ulVal); 39 | 40 | #ifdef __cplusplus 41 | } 42 | #endif 43 | 44 | #endif /* WIRING_SHIFT_H_ */ 45 | -------------------------------------------------------------------------------- /cores/xmc_lib/CMSIS/Include/cmsis_version.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file cmsis_version.h 3 | * @brief CMSIS Core(M) Version definitions 4 | * @version V5.0.2 5 | * @date 19. April 2017 6 | ******************************************************************************/ 7 | /* 8 | * Copyright (c) 2009-2017 ARM Limited. All rights reserved. 9 | * 10 | * SPDX-License-Identifier: Apache-2.0 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the License); you may 13 | * not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 20 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | */ 24 | 25 | #if defined ( __ICCARM__ ) 26 | #pragma system_include /* treat file as system include file for MISRA check */ 27 | #elif defined (__clang__) 28 | #pragma clang system_header /* treat file as system include file */ 29 | #endif 30 | 31 | #ifndef __CMSIS_VERSION_H 32 | #define __CMSIS_VERSION_H 33 | 34 | /* CMSIS Version definitions */ 35 | #define __CM_CMSIS_VERSION_MAIN ( 5U) /*!< [31:16] CMSIS Core(M) main version */ 36 | #define __CM_CMSIS_VERSION_SUB ( 1U) /*!< [15:0] CMSIS Core(M) sub version */ 37 | #define __CM_CMSIS_VERSION ((__CM_CMSIS_VERSION_MAIN << 16U) | \ 38 | __CM_CMSIS_VERSION_SUB ) /*!< CMSIS Core(M) version number */ 39 | #endif 40 | -------------------------------------------------------------------------------- /cores/xmc_lib/CMSIS/NN/Include/arm_nn_tables.h: -------------------------------------------------------------------------------- 1 | #ifdef ARM_LIB_CMSIS_NN 2 | 3 | /* ---------------------------------------------------------------------- 4 | * Project: CMSIS NN Library 5 | * Title: arm_nn_tables.h 6 | * Description: Extern declaration for NN tables 7 | * 8 | * $Date: 17. January 2018 9 | * $Revision: V.1.0.0 10 | * 11 | * Target Processor: Cortex-M cores 12 | * -------------------------------------------------------------------- */ 13 | /* 14 | * Copyright (C) 2010-2018 Arm Limited or its affiliates. All rights reserved. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * 18 | * Licensed under the Apache License, Version 2.0 (the License); you may 19 | * not use this file except in compliance with the License. 20 | * You may obtain a copy of the License at 21 | * 22 | * www.apache.org/licenses/LICENSE-2.0 23 | * 24 | * Unless required by applicable law or agreed to in writing, software 25 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 26 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 27 | * See the License for the specific language governing permissions and 28 | * limitations under the License. 29 | */ 30 | 31 | #ifndef _ARM_NN_TABLES_H 32 | #define _ARM_NN_TABLES_H 33 | 34 | #include "arm_math.h" 35 | 36 | /** 37 | * @brief tables for various activation functions 38 | * 39 | */ 40 | 41 | extern const q15_t sigmoidTable_q15[256]; 42 | extern const q7_t sigmoidTable_q7[256]; 43 | 44 | extern const q7_t tanhTable_q7[256]; 45 | extern const q15_t tanhTable_q15[256]; 46 | 47 | /** 48 | * @brief 2-way tables for various activation functions 49 | * 50 | * 2-way table, H table for value larger than 1/4 51 | * L table for value smaller than 1/4, H table for remaining 52 | * We have this only for the q15_t version. It does not make 53 | * sense to have it for q7_t type 54 | */ 55 | extern const q15_t sigmoidHTable_q15[192]; 56 | extern const q15_t sigmoidLTable_q15[128]; 57 | 58 | extern const q15_t sigmoidLTable_q15[128]; 59 | extern const q15_t sigmoidHTable_q15[192]; 60 | 61 | #endif /* ARM_NN_TABLES_H */ 62 | 63 | #endif /* ARM_LIB_CMSIS_NN */ 64 | -------------------------------------------------------------------------------- /cores/xmc_lib/CMSIS/NN/Source/ActivationFunctions/arm_nn_activations_q7.c: -------------------------------------------------------------------------------- 1 | #ifdef ARM_LIB_CMSIS_NN 2 | 3 | /* 4 | * Copyright (C) 2010-2018 Arm Limited or its affiliates. All rights reserved. 5 | * 6 | * SPDX-License-Identifier: Apache-2.0 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the License); you may 9 | * not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 16 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | /* ---------------------------------------------------------------------- 22 | * Project: CMSIS NN Library 23 | * Title: arm_nn_activations_q7.c 24 | * Description: Q7 neural network activation function using direct table look-up 25 | * 26 | * $Date: 17. January 2018 27 | * $Revision: V.1.0.0 28 | * 29 | * Target Processor: Cortex-M cores 30 | * 31 | * -------------------------------------------------------------------- */ 32 | 33 | #include "arm_math.h" 34 | #include "arm_common_tables.h" 35 | #include "arm_nnfunctions.h" 36 | 37 | /** 38 | * @ingroup groupNN 39 | */ 40 | 41 | /** 42 | * @addtogroup Acti 43 | * @{ 44 | */ 45 | 46 | /** 47 | * @brief Q7 neural network activation function using direct table look-up 48 | * @param[in,out] data pointer to input 49 | * @param[in] size number of elements 50 | * @param[in] int_width bit-width of the integer part, assume to be smaller than 3 51 | * @param[in] type type of activation functions 52 | * @return none. 53 | * 54 | * @details 55 | * 56 | * This is the direct table look-up approach. 57 | * 58 | * Assume here the integer part of the fixed-point is <= 3. 59 | * More than 3 just not making much sense, makes no difference with 60 | * saturation followed by any of these activation functions. 61 | */ 62 | 63 | void arm_nn_activations_direct_q7(q7_t * data, uint16_t size, uint16_t int_width, arm_nn_activation_type type) 64 | { 65 | uint16_t i = size; 66 | q7_t *pIn = data; 67 | q7_t *pOut = data; 68 | q7_t in; 69 | q7_t out; 70 | uint16_t shift_size = 3 - int_width; 71 | const q7_t *lookup_table; 72 | switch (type) 73 | { 74 | case ARM_SIGMOID: 75 | lookup_table = sigmoidTable_q7; 76 | break; 77 | case ARM_TANH: 78 | default: 79 | lookup_table = tanhTable_q7; 80 | break; 81 | } 82 | while (i) 83 | { 84 | in = *pIn++; 85 | out = lookup_table[(uint8_t) in >> shift_size]; 86 | *pOut++ = out; 87 | i--; 88 | } 89 | } 90 | 91 | /** 92 | * @} end of Acti group 93 | */ 94 | 95 | #endif /* ARM_LIB_CMSIS_NN */ 96 | -------------------------------------------------------------------------------- /cores/xmc_lib/CMSIS/NN/Source/ActivationFunctions/arm_relu_q15.c: -------------------------------------------------------------------------------- 1 | #ifdef ARM_LIB_CMSIS_NN 2 | 3 | /* 4 | * Copyright (C) 2010-2018 Arm Limited or its affiliates. All rights reserved. 5 | * 6 | * SPDX-License-Identifier: Apache-2.0 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the License); you may 9 | * not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 16 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | /* ---------------------------------------------------------------------- 22 | * Project: CMSIS NN Library 23 | * Title: arm_relu_q15.c 24 | * Description: Q15 version of ReLU 25 | * 26 | * $Date: 17. January 2018 27 | * $Revision: V.1.0.0 28 | * 29 | * Target Processor: Cortex-M cores 30 | * 31 | * -------------------------------------------------------------------- */ 32 | 33 | #include "arm_math.h" 34 | #include "arm_nnfunctions.h" 35 | 36 | /** 37 | * @ingroup groupNN 38 | */ 39 | 40 | /** 41 | * @addtogroup Acti 42 | * @{ 43 | */ 44 | 45 | /** 46 | * @brief Q15 RELU function 47 | * @param[in,out] data pointer to input 48 | * @param[in] size number of elements 49 | * @return none. 50 | * 51 | * @details 52 | * 53 | * Optimized relu with QSUB instructions. 54 | * 55 | */ 56 | 57 | void arm_relu_q15(q15_t * data, uint16_t size) 58 | { 59 | 60 | #if defined (ARM_MATH_DSP) 61 | /* Run the following code for Cortex-M4 and Cortex-M7 */ 62 | 63 | uint16_t i = size >> 1; 64 | q15_t *pIn = data; 65 | q15_t *pOut = data; 66 | q31_t in; 67 | q31_t buf; 68 | q31_t mask; 69 | 70 | while (i) 71 | { 72 | in = *__SIMD32(pIn)++; 73 | 74 | /* extract the first bit */ 75 | buf = __ROR(in & 0x80008000, 15); 76 | 77 | /* if MSB=1, mask will be 0xFF, 0x0 otherwise */ 78 | mask = __QSUB16(0x00000000, buf); 79 | 80 | *__SIMD32(pOut)++ = in & (~mask); 81 | i--; 82 | } 83 | 84 | if (size & 0x1) 85 | { 86 | if (*pIn < 0) 87 | { 88 | *pIn = 0; 89 | } 90 | pIn++; 91 | } 92 | #else 93 | /* Run the following code as reference implementation for Cortex-M0 and Cortex-M3 */ 94 | uint16_t i; 95 | 96 | for (i = 0; i < size; i++) 97 | { 98 | if (data[i] < 0) 99 | data[i] = 0; 100 | } 101 | 102 | #endif /* ARM_MATH_DSP */ 103 | 104 | } 105 | 106 | /** 107 | * @} end of Acti group 108 | */ 109 | 110 | #endif /* ARM_LIB_CMSIS_NN */ 111 | -------------------------------------------------------------------------------- /cores/xmc_lib/CMSIS/NN/Source/ActivationFunctions/arm_relu_q7.c: -------------------------------------------------------------------------------- 1 | #ifdef ARM_LIB_CMSIS_NN 2 | 3 | /* 4 | * Copyright (C) 2010-2018 Arm Limited or its affiliates. All rights reserved. 5 | * 6 | * SPDX-License-Identifier: Apache-2.0 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the License); you may 9 | * not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 16 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | /* ---------------------------------------------------------------------- 22 | * Project: CMSIS NN Library 23 | * Title: arm_relu_q7.c 24 | * Description: Q7 version of ReLU 25 | * 26 | * $Date: 17. January 2018 27 | * $Revision: V.1.0.0 28 | * 29 | * Target Processor: Cortex-M cores 30 | * 31 | * -------------------------------------------------------------------- */ 32 | 33 | #include "arm_math.h" 34 | #include "arm_nnfunctions.h" 35 | 36 | /** 37 | * @ingroup groupNN 38 | */ 39 | 40 | /** 41 | * @addtogroup Acti 42 | * @{ 43 | */ 44 | 45 | /** 46 | * @brief Q7 RELU function 47 | * @param[in,out] data pointer to input 48 | * @param[in] size number of elements 49 | * @return none. 50 | * 51 | * @details 52 | * 53 | * Optimized relu with QSUB instructions. 54 | * 55 | */ 56 | 57 | void arm_relu_q7(q7_t * data, uint16_t size) 58 | { 59 | 60 | #if defined (ARM_MATH_DSP) 61 | /* Run the following code for Cortex-M4 and Cortex-M7 */ 62 | 63 | uint16_t i = size >> 2; 64 | q7_t *pIn = data; 65 | q7_t *pOut = data; 66 | q31_t in; 67 | q31_t buf; 68 | q31_t mask; 69 | 70 | while (i) 71 | { 72 | in = *__SIMD32(pIn)++; 73 | 74 | /* extract the first bit */ 75 | buf = __ROR(in & 0x80808080, 7); 76 | 77 | /* if MSB=1, mask will be 0xFF, 0x0 otherwise */ 78 | mask = __QSUB8(0x00000000, buf); 79 | 80 | *__SIMD32(pOut)++ = in & (~mask); 81 | i--; 82 | } 83 | 84 | i = size & 0x3; 85 | while (i) 86 | { 87 | if (*pIn < 0) 88 | { 89 | *pIn = 0; 90 | } 91 | pIn++; 92 | i--; 93 | } 94 | 95 | #else 96 | /* Run the following code as reference implementation for Cortex-M0 and Cortex-M3 */ 97 | 98 | uint16_t i; 99 | 100 | for (i = 0; i < size; i++) 101 | { 102 | if (data[i] < 0) 103 | data[i] = 0; 104 | } 105 | 106 | #endif /* ARM_MATH_DSP */ 107 | 108 | } 109 | 110 | /** 111 | * @} end of Acti group 112 | */ 113 | 114 | #endif /* ARM_LIB_CMSIS_NN */ 115 | -------------------------------------------------------------------------------- /cores/xmc_lib/README.md: -------------------------------------------------------------------------------- 1 | # Develop notes 2 | ## XMCLib version 3 | The current one is V4.3.0. The macro of XMCLib version is also defined in ```cores\xmc_lib\XMCLib\inc\xmc_common.h``` 4 | 5 | ## CAN macro 6 | 7 | Because XMClibs use CAN macro, conflicts with Arduino default CAN class name, so we manually changed XMClib (CAN -> CAN_xmc). 8 | changed files: 9 | 10 | .h header files: 11 | - XMCLib\inc\xmc_can.h 12 | - XMCLib\inc\xmc_pau.h 13 | - XMCLib\inc\xmc1_scu.h 14 | - XMCLib\inc\xmc4_scu.h 15 | 16 | .c source files: 17 | - XMCLib\src\xmc_can.c 18 | - XMCLib\src\xmc1_scu.c -------------------------------------------------------------------------------- /cores/xmc_lib/XMCLib/License.txt: -------------------------------------------------------------------------------- 1 | License Terms and Copyright Information 2 | ======================================= 3 | 4 | Copyright (c) 2015-2023, Infineon Technologies AG All rights reserved. 5 | 6 | Boost Software License - Version 1.0 - August 17th, 2003 7 | 8 | Permission is hereby granted, free of charge, to any person or organization 9 | obtaining a copy of the software and accompanying documentation covered by 10 | this license (the "Software") to use, reproduce, display, distribute, 11 | execute, and transmit the Software, and to prepare derivative works of the 12 | Software, and to permit third-parties to whom the Software is furnished to 13 | do so, all subject to the following: 14 | 15 | The copyright notices in the Software and this entire statement, including 16 | the above license grant, this restriction and the following disclaimer, 17 | must be included in all copies of the Software, in whole or in part, and 18 | all derivative works of the Software, unless such copies or derivative 19 | works are solely in the form of machine-executable object code generated by 20 | a source language processor. 21 | 22 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 25 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 26 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 27 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 28 | DEALINGS IN THE SOFTWARE. 29 | 30 | To improve the quality of the software, users are encouraged to share modifications, 31 | enhancements or bug fixes with Infineon Technologies AG at XMCSupport@infineon.com. 32 | -------------------------------------------------------------------------------- /cores/xmc_lib/XMCLib/src/xmc1_eru.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file xmc1_eru.c 3 | * 4 | * @cond 5 | ***************************************************************************** 6 | * XMClib - XMC Peripheral Driver Library 7 | * 8 | * Copyright (c) 2015-2020, Infineon Technologies AG 9 | * All rights reserved. 10 | * 11 | * Boost Software License - Version 1.0 - August 17th, 2003 12 | * 13 | * Permission is hereby granted, free of charge, to any person or organization 14 | * obtaining a copy of the software and accompanying documentation covered by 15 | * this license (the "Software") to use, reproduce, display, distribute, 16 | * execute, and transmit the Software, and to prepare derivative works of the 17 | * Software, and to permit third-parties to whom the Software is furnished to 18 | * do so, all subject to the following: 19 | * 20 | * The copyright notices in the Software and this entire statement, including 21 | * the above license grant, this restriction and the following disclaimer, 22 | * must be included in all copies of the Software, in whole or in part, and 23 | * all derivative works of the Software, unless such copies or derivative 24 | * works are solely in the form of machine-executable object code generated by 25 | * a source language processor. 26 | * 27 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 28 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 29 | * FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 30 | * SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 31 | * FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 32 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 33 | * DEALINGS IN THE SOFTWARE. 34 | * 35 | * To improve the quality of the software, users are encouraged to share 36 | * modifications, enhancements or bug fixes with Infineon Technologies AG 37 | * at XMCSupport@infineon.com. 38 | ***************************************************************************** 39 | * 40 | * @endcond 41 | */ 42 | 43 | #include "xmc_eru.h" 44 | 45 | #if UC_FAMILY == XMC1 46 | 47 | /********************************************************************************************************************* 48 | * API IMPLEMENTATION 49 | ********************************************************************************************************************/ 50 | 51 | void XMC_ERU_Enable(XMC_ERU_t *const eru) 52 | { 53 | XMC_UNUSED_ARG(eru); 54 | } 55 | 56 | void XMC_ERU_Disable(XMC_ERU_t *const eru) 57 | { 58 | XMC_UNUSED_ARG(eru); 59 | } 60 | 61 | #endif /* if( UC_FAMILY == XMC1 ) */ 62 | -------------------------------------------------------------------------------- /cores/yield.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011 Arduino. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | //**************************************************************************** 20 | // @External Prototypes 21 | //**************************************************************************** 22 | void yield(void) __attribute__((weak)); 23 | void yield(void) {}; 24 | 25 | //**************************************************************************** 26 | // END OF FILE 27 | //**************************************************************************** 28 | -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line, and also 5 | # from the environment for the first two. 6 | SPHINXOPTS ?= 7 | SPHINXBUILD ?= sphinx-build 8 | SOURCEDIR = . 9 | BUILDDIR = build 10 | 11 | LINKCHECKDIR = build/linkcheck 12 | 13 | .PHONY: checklinks 14 | checklinks: 15 | $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(LINKCHECKDIR) 16 | @echo 17 | @echo "Check finished. Report is in $(LINKCHECKDIR)." 18 | 19 | # Put it first so that "make" without argument is like "make help". 20 | help: 21 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 22 | 23 | .PHONY: help Makefile 24 | 25 | # Catch-all target: route all unknown targets to Sphinx using the new 26 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 27 | %: Makefile 28 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 29 | -------------------------------------------------------------------------------- /docs/_templates/layout.html: -------------------------------------------------------------------------------- 1 | {% extends "!layout.html" %} 2 | {% block footer %} {{ super() }} 3 | 4 | 70 | {% endblock %} -------------------------------------------------------------------------------- /docs/img/H-BRIDGE_KIT_2GO_pinout.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Infineon/XMC-for-Arduino/73fcadf1f0bd7379eaaa3b081ed7d5a06b3b0293/docs/img/H-BRIDGE_KIT_2GO_pinout.jpg -------------------------------------------------------------------------------- /docs/img/KIT_XMC11_BOOT_001.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Infineon/XMC-for-Arduino/73fcadf1f0bd7379eaaa3b081ed7d5a06b3b0293/docs/img/KIT_XMC11_BOOT_001.jpg -------------------------------------------------------------------------------- /docs/img/KIT_XMC11_BOOT_001_pinout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Infineon/XMC-for-Arduino/73fcadf1f0bd7379eaaa3b081ed7d5a06b3b0293/docs/img/KIT_XMC11_BOOT_001_pinout.png -------------------------------------------------------------------------------- /docs/img/KIT_XMC13_BOOT_001.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Infineon/XMC-for-Arduino/73fcadf1f0bd7379eaaa3b081ed7d5a06b3b0293/docs/img/KIT_XMC13_BOOT_001.jpg -------------------------------------------------------------------------------- /docs/img/KIT_XMC1400_ARDUINO.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Infineon/XMC-for-Arduino/73fcadf1f0bd7379eaaa3b081ed7d5a06b3b0293/docs/img/KIT_XMC1400_ARDUINO.jpg -------------------------------------------------------------------------------- /docs/img/KIT_XMC1400_ARDUINO_pinout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Infineon/XMC-for-Arduino/73fcadf1f0bd7379eaaa3b081ed7d5a06b3b0293/docs/img/KIT_XMC1400_ARDUINO_pinout.png -------------------------------------------------------------------------------- /docs/img/KIT_XMC14_2GO.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Infineon/XMC-for-Arduino/73fcadf1f0bd7379eaaa3b081ed7d5a06b3b0293/docs/img/KIT_XMC14_2GO.png -------------------------------------------------------------------------------- /docs/img/KIT_XMC47_RELAX_5V_AD_V1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Infineon/XMC-for-Arduino/73fcadf1f0bd7379eaaa3b081ed7d5a06b3b0293/docs/img/KIT_XMC47_RELAX_5V_AD_V1.jpg -------------------------------------------------------------------------------- /docs/img/KIT_XMC47_RELAX_5V_AD_V1_pinout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Infineon/XMC-for-Arduino/73fcadf1f0bd7379eaaa3b081ed7d5a06b3b0293/docs/img/KIT_XMC47_RELAX_5V_AD_V1_pinout.png -------------------------------------------------------------------------------- /docs/img/KIT_XMC_2GO_XMC1100_V1_pinout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Infineon/XMC-for-Arduino/73fcadf1f0bd7379eaaa3b081ed7d5a06b3b0293/docs/img/KIT_XMC_2GO_XMC1100_V1_pinout.png -------------------------------------------------------------------------------- /docs/img/KIT_XMC_PLT2GO_XMC4200.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Infineon/XMC-for-Arduino/73fcadf1f0bd7379eaaa3b081ed7d5a06b3b0293/docs/img/KIT_XMC_PLT2GO_XMC4200.jpg -------------------------------------------------------------------------------- /docs/img/KIT_XMC_PLT2GO_XMC4200_pinout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Infineon/XMC-for-Arduino/73fcadf1f0bd7379eaaa3b081ed7d5a06b3b0293/docs/img/KIT_XMC_PLT2GO_XMC4200_pinout.png -------------------------------------------------------------------------------- /docs/img/KIT_XMC_PLT2GO_XMC4400.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Infineon/XMC-for-Arduino/73fcadf1f0bd7379eaaa3b081ed7d5a06b3b0293/docs/img/KIT_XMC_PLT2GO_XMC4400.jpg -------------------------------------------------------------------------------- /docs/img/KIT_XMC_PLT2GO_XMC4400_pinout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Infineon/XMC-for-Arduino/73fcadf1f0bd7379eaaa3b081ed7d5a06b3b0293/docs/img/KIT_XMC_PLT2GO_XMC4400_pinout.png -------------------------------------------------------------------------------- /docs/img/XMC4700_Radar_Baseboard_pinout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Infineon/XMC-for-Arduino/73fcadf1f0bd7379eaaa3b081ed7d5a06b3b0293/docs/img/XMC4700_Radar_Baseboard_pinout.png -------------------------------------------------------------------------------- /docs/img/arduino_ide_board_list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Infineon/XMC-for-Arduino/73fcadf1f0bd7379eaaa3b081ed7d5a06b3b0293/docs/img/arduino_ide_board_list.png -------------------------------------------------------------------------------- /docs/img/arduino_ide_board_manager_entry.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Infineon/XMC-for-Arduino/73fcadf1f0bd7379eaaa3b081ed7d5a06b3b0293/docs/img/arduino_ide_board_manager_entry.png -------------------------------------------------------------------------------- /docs/img/arduino_ide_preferences_link.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Infineon/XMC-for-Arduino/73fcadf1f0bd7379eaaa3b081ed7d5a06b3b0293/docs/img/arduino_ide_preferences_link.png -------------------------------------------------------------------------------- /docs/img/arduino_ide_preferences_menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Infineon/XMC-for-Arduino/73fcadf1f0bd7379eaaa3b081ed7d5a06b3b0293/docs/img/arduino_ide_preferences_menu.png -------------------------------------------------------------------------------- /docs/img/arduino_ide_release_index.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Infineon/XMC-for-Arduino/73fcadf1f0bd7379eaaa3b081ed7d5a06b3b0293/docs/img/arduino_ide_release_index.png -------------------------------------------------------------------------------- /docs/img/arduino_ide_serial_selection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Infineon/XMC-for-Arduino/73fcadf1f0bd7379eaaa3b081ed7d5a06b3b0293/docs/img/arduino_ide_serial_selection.png -------------------------------------------------------------------------------- /docs/img/ifx_logo_white_green_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Infineon/XMC-for-Arduino/73fcadf1f0bd7379eaaa3b081ed7d5a06b3b0293/docs/img/ifx_logo_white_green_s.png -------------------------------------------------------------------------------- /docs/img/jlink_downloads.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Infineon/XMC-for-Arduino/73fcadf1f0bd7379eaaa3b081ed7d5a06b3b0293/docs/img/jlink_downloads.png -------------------------------------------------------------------------------- /docs/img/jlink_installer_options.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Infineon/XMC-for-Arduino/73fcadf1f0bd7379eaaa3b081ed7d5a06b3b0293/docs/img/jlink_installer_options.png -------------------------------------------------------------------------------- /docs/img/kit_xmc47_relax_cut_routes.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Infineon/XMC-for-Arduino/73fcadf1f0bd7379eaaa3b081ed7d5a06b3b0293/docs/img/kit_xmc47_relax_cut_routes.jpg -------------------------------------------------------------------------------- /docs/img/kit_xmc_plt2go_xmc4200_remove_resistors.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Infineon/XMC-for-Arduino/73fcadf1f0bd7379eaaa3b081ed7d5a06b3b0293/docs/img/kit_xmc_plt2go_xmc4200_remove_resistors.png -------------------------------------------------------------------------------- /docs/img/kit_xmc_plt2go_xmc4400_cut_routes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Infineon/XMC-for-Arduino/73fcadf1f0bd7379eaaa3b081ed7d5a06b3b0293/docs/img/kit_xmc_plt2go_xmc4400_cut_routes.png -------------------------------------------------------------------------------- /docs/index.rst: -------------------------------------------------------------------------------- 1 | *************** 2 | XMC for Arduino 3 | *************** 4 | Welcome to Infineon's XMC Microcontroller Boards for Arduino! 5 | 6 | .. image:: img/KIT_XMC14_2GO.png 7 | :width: 200 8 | 9 | .. image:: img/KIT_XMC11_BOOT_001.jpg 10 | :width: 200 11 | 12 | .. image:: img/KIT_XMC47_RELAX_5V_AD_V1.jpg 13 | :width: 200 14 | 15 | The XMC microcontroller family from Infineon offers a powerful and versatile platform for embedded system development. 16 | Featuring a high-performance architecture, advanced peripherals, and low power consumption, XMC microcontrollers are 17 | well-suited for a broad range of applications. 18 | 19 | The XMC for Arduino core provides a flexible software framework enabling developers to fully utilize the capabilities 20 | of XMC microcontrollers within the popular Arduino ecosystem. This library includes an extensive set of APIs, examples, 21 | and tools, facilitating the rapid development and deployment of various applications, from simple prototypes to intricate systems. 22 | Key features include: 23 | 24 | * A rich set of APIs for accessing and controlling peripherals such as GPIO, UART, SPI, I2C, and more. 25 | * Support for numerous sensors and actuators, including both analog and digital sensors, displays, and communication modules. 26 | * Advanced features like interrupt handling, DMA, and power management. 27 | * Compatibility with a wide range of Arduino boards and shields. 28 | * Numerous examples and tutorials to help developers get started quickly and efficiently. 29 | 30 | By using the XMC for Arduino core, developers can enjoy the ease of use and flexibility of the Arduino platform while taking 31 | advantage of the advanced features and performance offered by XMC microcontrollers. 32 | 33 | 34 | .. toctree:: 35 | :maxdepth: 2 36 | :caption: CONTENT: 37 | 38 | Introduction 39 | installation-instructions 40 | development-instructions 41 | hw-platforms 42 | builtin-libraries 43 | arduino-deviations 44 | 45 | License 46 | ======= 47 | 48 | Please find the license file for this core `here `_. -------------------------------------------------------------------------------- /docs/make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | pushd %~dp0 4 | 5 | REM Command file for Sphinx documentation 6 | 7 | if "%SPHINXBUILD%" == "" ( 8 | set SPHINXBUILD=sphinx-build 9 | ) 10 | set SOURCEDIR=. 11 | set BUILDDIR=build 12 | 13 | if "%1" == "" goto help 14 | 15 | %SPHINXBUILD% >NUL 2>NUL 16 | if errorlevel 9009 ( 17 | echo. 18 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx 19 | echo.installed, then set the SPHINXBUILD environment variable to point 20 | echo.to the full path of the 'sphinx-build' executable. Alternatively you 21 | echo.may add the Sphinx directory to PATH. 22 | echo. 23 | echo.If you don't have Sphinx installed, grab it from 24 | echo.http://sphinx-doc.org/ 25 | exit /b 1 26 | ) 27 | 28 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% 29 | goto end 30 | 31 | :help 32 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% 33 | 34 | :end 35 | popd 36 | -------------------------------------------------------------------------------- /docs/requirements.txt: -------------------------------------------------------------------------------- 1 | # This is a list of python packages used to generate documentation. This file is used with pip: 2 | # pip install --user -r requirements.txt 3 | # 4 | sphinx>=7.2.6 5 | sphinx-tabs 6 | sphinxemoji 7 | sphinx-rtd-theme 8 | recommonmark>=0.6.0 -------------------------------------------------------------------------------- /keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Colouring Map For Core 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | ####################################### 10 | # Methods and Functions (KEYWORD2) 11 | ####################################### 12 | 13 | digitalToggle KEYWORD2 14 | setAnalogWriteFrequency KEYWORD2 15 | getAnalogReadBits KEYWORD2 16 | getAnalogWriteBits KEYWORD2 17 | getAnalogReadMaximum KEYWORD2 18 | getAnalogWriteMaximum KEYWORD2 19 | analogRead_variableGain KEYWORD2 20 | 21 | ####################################### 22 | # Instances (KEYWORD2) 23 | ####################################### 24 | 25 | ####################################### 26 | # Constants (LITERAL1) 27 | ####################################### 28 | 29 | INPUT_PULLDOWN LITERAL1 Constants RESERVED_WORD_2 30 | OUTPUT_OPENDRAIN LITERAL1 Constants RESERVED_WORD_2 31 | NUM_DIGITAL_PINS LITERAL1 32 | NUM_ANALOG_INPUTS LITERAL1 33 | NUM_PWM LITERAL1 34 | NUM_LEDS LITERAL1 35 | NUM_INTERRUPT LITERAL1 36 | NUM_SERIAL LITERAL1 37 | 38 | A0 LITERAL1 39 | A1 LITERAL1 40 | A2 LITERAL1 41 | A3 LITERAL1 42 | A4 LITERAL1 43 | A5 LITERAL1 44 | 45 | LED1 LITERAL1 46 | LED2 LITERAL1 47 | 48 | # XMC1xxx Boot Kits only 49 | LED3 LITERAL1 50 | LED4 LITERAL1 51 | LED5 LITERAL1 52 | LED6 LITERAL1 53 | 54 | # XMC4700 only 55 | BUTTON1 LITERAL1 56 | BUTTON2 LITERAL1 57 | 58 | # XMC4700 Radar Baseboard only 59 | LED_RED LITERAL1 60 | LED_BLUE LITERAL1 61 | LED_GREEN LITERAL1 -------------------------------------------------------------------------------- /libraries/CAN/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Infineon Technologies AG 4 | Copyright (c) 2017 Sandeep Mistry 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | -------------------------------------------------------------------------------- /libraries/CAN/Makefile.codecheck: -------------------------------------------------------------------------------- 1 | #Run Clang-format for c/c++ code. 2 | make -f Makefile.codechecks.mk clang-format 3 | 4 | #Run Clang-tidy 5 | make -f Makefile.codechecks.mk clang-tidy-src 6 | 7 | make -f Makefile.codechecks.mk clang-tidy-test 8 | 9 | #Run cppcheck 10 | make -f Makefile.codechecks.mk cppcheck 11 | 12 | 13 | -------------------------------------------------------------------------------- /libraries/CAN/Makefile.codechecks.mk: -------------------------------------------------------------------------------- 1 | 2 | WIN_USER ?= 3 | CONFIG_DIR := ../../config 4 | CORE_LIB_DIR := ../../cores 5 | 6 | 7 | CLANG_FORMAT_DIR := $(CONFIG_DIR)/clang-format 8 | CLANG_TIDY_DIR := $(CONFIG_DIR)/clang-tidy 9 | 10 | 11 | #################################### clang-format code formatter 12 | ### Need to install clang-tidy 13 | 14 | clang-format: 15 | 16 | clang-format -i -style=file:$(CLANG_FORMAT_DIR)/.clang-format $(shell find src -name \*.[hc]\*) 17 | 18 | 19 | 20 | ##TODO: add compilation database for builtin libraries! 21 | #################################### clang-tidy static code checker 22 | 23 | clang-tidy-test: C_CPP_SOURCES = $(shell find test -name \*.[hc]\*) 24 | clang-tidy-src: C_CPP_SOURCES = $(shell find src -name \*.[hc]\*) 25 | 26 | clang-tidy-test clang-tidy-src : clang-tidy 27 | 28 | clang-tidy: 29 | $(info $(C_CPP_SOURCES)) 30 | clang-tidy $(C_CPP_SOURCES) --config-file=$(CLANG_TIDY_DIR)/.clang-tidy -header-filter='' -- -Isrc/framework/arduino -Itest/unit/src/framework/arduino/corelibs -I$(CORE_LIB_DIR) > clang-tidy-report.txt 31 | 32 | 33 | 34 | #################################### scan-build static code checker #TODO: still using foo example 35 | ### After executing the scan-build target run the command scan-view as printed in the scan-build output last line. 36 | ### Or use firefox directly. 37 | scan-build: 38 | scan-build -o scan-build-reports make -f Makefile.codechecks.mk foo 39 | firefox scan-build-reports/ 40 | 41 | foo: 42 | $(CC) -c -Wextra -Wall -Wfloat-equal -Wconversion -Wredundant-decls -Wswitch-default -Wdouble-promotion -Wpedantic -Wunreachable-code -std=c++20 $(CONFIG_DIR)/sca/foo.cpp -o foo.o 43 | 44 | 45 | 46 | #################################### cppcheck static code checker 47 | ### Requirement : install cppcheck from https://github.com/danmar/cppcheck 48 | cppcheck: C_CPP_SOURCES = ./src 49 | 50 | CPPCHECK_PATH = ~/cppcheck/cppcheck 51 | 52 | cppcheck: 53 | $(CPPCHECK_PATH)/cppcheck -I $(C_CPP_SOURCES) \ 54 | -i build -i doc -i examples -i results -i reports_hml -i src -i test $(C_CPP_SOURCES) \ 55 | --check-level=exhaustive --enable=all --inconclusive \ 56 | --addon=config/cppcheck/misra.json --addon=misc --std=c++20 \ 57 | --checkers-report=cppcheck.checkers --xml --max-configs=50 2> ./err.xml 58 | $(CPPCHECK_PATH)/htmlreport/cppcheck-htmlreport --file=err.xml --title=TestCPPCheck --report-dir=cppcheck-reports --source-dir=. 59 | firefox cppcheck-reports/index.html 60 | 61 | -------------------------------------------------------------------------------- /libraries/CAN/examples/CANLoopBack/CANLoopBack.ino: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 Infineon Technologies AG. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | 6 | void setup() { 7 | // put your setup code here, to run once: 8 | Serial.begin(9600); 9 | while (!Serial) 10 | ; 11 | 12 | Serial.println("CAN Loopback"); 13 | 14 | // start the CAN bus at 500 kbps 15 | if (!CAN.begin(500E3)) { 16 | Serial.println("Starting CAN failed!"); 17 | while (1) 18 | ; 19 | } 20 | 21 | // set the can in loopback mode 22 | CAN.loopback(); 23 | } 24 | 25 | void loop() { 26 | 27 | // 28 | Serial.print("Sending packet"); 29 | CAN.beginPacket(0x12); 30 | CAN.write('L'); 31 | CAN.write('O'); 32 | CAN.write('O'); 33 | CAN.write('P'); 34 | CAN.endPacket(); 35 | 36 | 37 | int packetSize = CAN.parsePacket(); 38 | 39 | if (packetSize) { 40 | // received a packet 41 | Serial.print("Received "); 42 | 43 | if (CAN.packetExtended()) { 44 | Serial.print("extended "); 45 | } 46 | 47 | Serial.print("packet with id 0x"); 48 | Serial.print(CAN.packetId(), HEX); 49 | 50 | Serial.print(" and length "); 51 | Serial.println(packetSize); 52 | 53 | while (CAN.available()) { 54 | Serial.print((char)CAN.read()); 55 | } 56 | Serial.println(); 57 | } 58 | 59 | delay(1000); 60 | } 61 | -------------------------------------------------------------------------------- /libraries/CAN/examples/CANReceiver/CANReceiver.ino: -------------------------------------------------------------------------------- 1 | // Copyright (c) Sandeep Mistry. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | 6 | void setup() { 7 | Serial.begin(9600); 8 | while (!Serial); 9 | delay(1000); 10 | Serial.println("CAN Receiver"); 11 | 12 | // start the CAN bus at 500 kbps 13 | if (!CAN.begin(500000)) { 14 | Serial.println("Starting CAN failed!"); 15 | while (1); 16 | } 17 | } 18 | 19 | void loop() { 20 | // try to parse packet 21 | 22 | int packetSize = CAN.parsePacket(); 23 | 24 | if (packetSize) { 25 | // received a packet 26 | Serial.print("Received "); 27 | 28 | 29 | if (CAN.packetExtended()) { 30 | Serial.print("extended "); 31 | } 32 | 33 | if (CAN.packetRtr()) { 34 | // Remote transmission request, packet contains no data 35 | Serial.print("RTR "); 36 | } 37 | 38 | Serial.print("packet with id 0x"); 39 | Serial.print(CAN.packetId(), HEX); 40 | 41 | if (CAN.packetRtr()) { 42 | Serial.print(" and requested length "); 43 | Serial.println(CAN.packetDlc()); 44 | } else { 45 | Serial.print(" and length "); 46 | Serial.println(packetSize); 47 | 48 | // only print packet data for non-RTR packets 49 | while (CAN.available()) { 50 | Serial.print((char)CAN.read()); 51 | } 52 | Serial.println(); 53 | } 54 | 55 | Serial.println(); 56 | } 57 | } 58 | 59 | -------------------------------------------------------------------------------- /libraries/CAN/examples/CANReceiverCallback/CANReceiverCallback.ino: -------------------------------------------------------------------------------- 1 | // Copyright (c) Sandeep Mistry. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | 6 | void setup() { 7 | Serial.begin(9600); 8 | while (!Serial); 9 | delay(1000); 10 | Serial.println("CAN Receiver Callback"); 11 | 12 | // start the CAN bus at 500 kbps 13 | if (!CAN.begin(500E3)) { 14 | Serial.println("Starting CAN failed!"); 15 | while (1); 16 | } 17 | 18 | // register the receive callback 19 | CAN.onReceive(onReceive); 20 | } 21 | 22 | void loop() { 23 | // do nothing 24 | } 25 | 26 | void onReceive(int packetSize) { 27 | // received a packet 28 | Serial.print("Received "); 29 | 30 | if (CAN.packetExtended()) { 31 | Serial.print("extended "); 32 | } 33 | 34 | if (CAN.packetRtr()) { 35 | // Remote transmission request, packet contains no data 36 | Serial.print("RTR "); 37 | } 38 | 39 | Serial.print("packet with id 0x"); 40 | Serial.print(CAN.packetId(), HEX); 41 | 42 | if (CAN.packetRtr()) { 43 | Serial.print(" and requested length "); 44 | Serial.println(CAN.packetDlc()); 45 | } else { 46 | Serial.print(" and length "); 47 | Serial.println(packetSize); 48 | 49 | // only print packet data for non-RTR packets 50 | while (CAN.available()) { 51 | Serial.print((char)CAN.read()); 52 | } 53 | Serial.println(); 54 | } 55 | 56 | Serial.println(); 57 | } 58 | 59 | 60 | -------------------------------------------------------------------------------- /libraries/CAN/examples/CANSender/CANSender.ino: -------------------------------------------------------------------------------- 1 | // Copyright (c) Sandeep Mistry. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | #include 5 | 6 | void setup() { 7 | Serial.begin(9600); 8 | while (!Serial); 9 | 10 | Serial.println("CAN Sender"); 11 | 12 | // start the CAN bus at 500 kbps 13 | if (!CAN.begin(500E3)) { 14 | Serial.println("Starting CAN failed!"); 15 | while (1); 16 | } 17 | } 18 | 19 | void loop() { 20 | // send packet: id is 11 bits, packet can contain up to 8 bytes of data 21 | Serial.print("Sending packet ... "); 22 | 23 | CAN.beginPacket(0x12); 24 | CAN.write('h'); 25 | CAN.write('e'); 26 | CAN.write('l'); 27 | CAN.write('l'); 28 | CAN.write('o'); 29 | CAN.endPacket(); 30 | 31 | Serial.println("done"); 32 | 33 | delay(1000); 34 | 35 | CAN.beginExtendedPacket(0xFFF); 36 | CAN.write('w'); 37 | CAN.write('o'); 38 | CAN.write('r'); 39 | CAN.write('l'); 40 | CAN.write('d'); 41 | CAN.endPacket(); 42 | 43 | Serial.println("done"); 44 | 45 | delay(1000); 46 | } 47 | 48 | -------------------------------------------------------------------------------- /libraries/CAN/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For CAN 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | CAN KEYWORD1 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | 15 | begin KEYWORD2 16 | end KEYWORD2 17 | 18 | beginPacket KEYWORD2 19 | beginExtendedPacket KEYWORD2 20 | endPacket KEYWORD2 21 | 22 | parsePacket KEYWORD2 23 | packetId KEYWORD2 24 | packetExtended KEYWORD2 25 | packetRtr KEYWORD2 26 | packetDlc KEYWORD2 27 | 28 | write KEYWORD2 29 | 30 | available KEYWORD2 31 | read KEYWORD2 32 | peek KEYWORD2 33 | flush KEYWORD2 34 | 35 | onReceive KEYWORD2 36 | filter KEYWORD2 37 | filterExtended KEYWORD2 38 | loopback KEYWORD2 39 | sleep KEYWORD2 40 | wakeup KEYWORD2 41 | 42 | ####################################### 43 | # Constants (LITERAL1) 44 | ####################################### 45 | -------------------------------------------------------------------------------- /libraries/CAN/library.properties: -------------------------------------------------------------------------------- 1 | name=CAN 2 | version=1.0.0 3 | author=Infineon Technologies AG 4 | maintainer=Infineon Technologies AG 5 | sentence=This library allows the XMC µC to use the CAN for sending and receiving data. 6 | paragraph= CAN (Controller Area Network) is a serial communication protocol that was originally developed for the automotive industry. This library allows the XMC microcontroller to send and receive data using the CAN protocol. 7 | category=Communication 8 | url= https://github.com/Infineon/XMC-for-Arduino/tree/master/arm/libraries/CAN 9 | architectures=xmc 10 | 11 | -------------------------------------------------------------------------------- /libraries/CAN/src/CAN.h: -------------------------------------------------------------------------------- 1 | #ifndef CAN_H 2 | #define CAN_H 3 | 4 | #if defined(CAN_xmc) 5 | #include "CANXMC.h" 6 | #endif 7 | 8 | #endif -------------------------------------------------------------------------------- /libraries/CAN/src/CANController.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Sandeep Mistry. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license 3 | // information. 4 | #include 5 | #ifndef CAN_CONTROLLER_H 6 | #define CAN_CONTROLLER_H 7 | 8 | class CANControllerClass : public Stream { 9 | 10 | public: 11 | virtual int begin(long baudRate); 12 | virtual void end(); 13 | 14 | int beginPacket(int id, int dlc = -1, bool rtr = false); 15 | int beginExtendedPacket(long id, int dlc = -1, bool rtr = false); 16 | virtual int endPacket(); 17 | 18 | virtual int parsePacket(); 19 | long packetId(); 20 | bool packetExtended(); 21 | bool packetRtr(); 22 | int packetDlc(); 23 | 24 | // from Print 25 | virtual size_t write(uint8_t byte); 26 | virtual size_t write(const uint8_t *buffer, size_t size); 27 | 28 | // from Stream 29 | virtual int available(); 30 | virtual int read(); 31 | virtual int peek(); 32 | virtual void flush(); 33 | 34 | virtual void onReceive(void (*callback)(int)); 35 | 36 | virtual int filter(int id) { return filter(id, 0x7ff); } 37 | 38 | virtual int filter(int id, int mask); 39 | 40 | virtual int filterExtended(long id) { return filterExtended(id, 0x1fffffff); } 41 | 42 | virtual int filterExtended(long id, long mask); 43 | 44 | virtual int observe(); 45 | virtual int loopback(); 46 | virtual int sleep(); 47 | virtual int wakeup(); 48 | 49 | protected: 50 | CANControllerClass(); 51 | virtual ~CANControllerClass(); 52 | 53 | protected: 54 | void (*_onReceive)(int); 55 | 56 | bool _packetBegun; 57 | long _txId; 58 | bool _txExtended; 59 | bool _txRtr; // if it Remote Transmission Request 60 | int _txDlc; // DLC: Data Length Code specifies number of bytes in the data field 61 | int _txLength; // index of txData 62 | uint8_t _txData[8]; 63 | 64 | long _rxId; 65 | bool _rxExtended; 66 | bool _rxRtr; 67 | int _rxDlc; 68 | int _rxLength; 69 | int _rxIndex; 70 | uint8_t _rxData[8]; 71 | }; 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /libraries/CAN/src/CANXMC.h: -------------------------------------------------------------------------------- 1 | #include "CANController.h" 2 | #include "xmc_can.h" 3 | 4 | class CANXMC : public CANControllerClass { 5 | 6 | public: 7 | CANXMC(XMC_ARD_CAN_t *conf); 8 | ~CANXMC() final; 9 | 10 | int begin(long baudRate = 500E3) final; 11 | void end() final; 12 | 13 | int endPacket() final; 14 | 15 | int parsePacket() final; 16 | 17 | void onReceive(void (*callback)(int)) final; 18 | 19 | using CANControllerClass::filter; 20 | int filter(int id, int mask) final; 21 | using CANControllerClass::filterExtended; 22 | int filterExtended(long id, long mask) final; 23 | 24 | int observe() final; 25 | int loopback() final; 26 | int sleep() final; 27 | int wakeup() final; 28 | int setIdentifier(long); 29 | static void onInterrupt(); 30 | 31 | // Getter functions for CAN_msg_rx and CAN_msg_tx 32 | XMC_CAN_MO_t *getRxMessage(); 33 | XMC_CAN_MO_t *getTxMessage(); 34 | 35 | private: 36 | XMC_ARD_CAN_t *_XMC_CAN_config; 37 | XMC_CAN_MO_t CAN_msg_rx; 38 | XMC_CAN_MO_t CAN_msg_tx; 39 | }; 40 | 41 | extern CANXMC CAN; -------------------------------------------------------------------------------- /libraries/DMA/Readme.MD: -------------------------------------------------------------------------------- 1 | # DMA Library for XMC 2 | 3 | This library helps to manage DMA for XMC microcontrollers. 4 | 5 | ## Additional Information 6 | See also our [documentation](https://xmc-arduino.readthedocs.io/en/latest/builtin-libraries.html). -------------------------------------------------------------------------------- /libraries/DMA/examples/DMA_Memory/DMA_Memory.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * Simple DMA example for XMC4700 Relax Kit V1 3 | * Demonstrates how to setup an DMA, to transfer data between two places in memory. 4 | * Prints the message in Serial port. 5 | */ 6 | 7 | #include 8 | 9 | DMA dma_module; 10 | 11 | #define DATA_LENGTH 10 12 | 13 | uint32_t source_data[DATA_LENGTH] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; 14 | uint32_t destination_data[DATA_LENGTH]; 15 | 16 | void setup() 17 | { 18 | Serial.begin(9600); 19 | } 20 | 21 | // The loop function is called in an endless loop 22 | void loop() 23 | { 24 | Serial.print("We are going to copy from source this data: "); 25 | for(int i=0; i 8 | DMA dma_module; 9 | 10 | #define BUFFER_LENGTH 11 11 | 12 | volatile bool transfer_done = false; 13 | uint8_t message[] = "Hello World"; 14 | uint8_t received_message[BUFFER_LENGTH]; 15 | int led2 = 25; 16 | 17 | //The setup function is called once at startup of the sketch 18 | void setup() 19 | { 20 | Serial.begin(9600); 21 | pinMode(led2, OUTPUT); 22 | } 23 | 24 | void loop() 25 | { 26 | uint8_t i; 27 | dma_module.beginDMA(DMA0); 28 | 29 | dma_module.configDMA_M2P(DMA0, 0, UART0_CH0, (uint32_t)&message[0],BUFFER_LENGTH,TRANSFER_WIDTH_8, TRANSFER_WIDTH_8, BURST_LENGTH_4, BURST_LENGTH_1,true); 30 | dma_module.attachDMAInterrupt(DMA0, 0 ,dma_interrupt, BLOCK_TRANSFER_COMPLETE); 31 | 32 | // If P2M 33 | //dma_module.configDMA_P2M(DMA0, 0, UART0_CH0,(uint32_t)&received_message[0],BUFFER_LENGTH,TRANSFER_WIDTH_8, TRANSFER_WIDTH_8, BURST_LENGTH_1, BURST_LENGTH_1,true); 34 | //dma_module.attachDMAInterrupt(DMA0, 0,NULL, BLOCK_TRANSFER_COMPLETE); 35 | 36 | dma_module.beginDMATransaction(DMA0, 0); 37 | 38 | while (transfer_done == false){ 39 | } 40 | // If P2M is used, print the buffer 41 | /* for(i = 1; i < BUFFER_LENGTH; i++) 42 | Serial.print((char)(received_message[i]));*/ 43 | 44 | while(1); 45 | } 46 | 47 | void dma_interrupt() { 48 | transfer_done = true; 49 | digitalWrite(led2, HIGH); 50 | } 51 | 52 | -------------------------------------------------------------------------------- /libraries/DMA/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For DMA Library 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | DMA KEYWORD1 10 | 11 | 12 | 13 | ####################################### 14 | # Methods and Functions (KEYWORD2) 15 | ####################################### 16 | 17 | beginDMA KEYWORD2 18 | configDMA_M2M KEYWORD2 19 | configDMA_M2P KEYWORD2 20 | configDMA_P2M KEYWORD2 21 | configDMA_P2P KEYWORD2 22 | configDMA KEYWORD2 23 | attachDMAInterrupt KEYWORD2 24 | detachDMAInterrupt KEYWORD2 25 | beginDMATransaction KEYWORD2 26 | endDMA KEYWORD2 27 | 28 | 29 | ####################################### 30 | # Constants (LITERAL1) 31 | ####################################### 32 | 33 | DMA0 LITERAL1 34 | DMA1 LITERAL1 35 | 36 | BURST_LENGTH_1 LITERAL1 37 | BURST_LENGTH_4 LITERAL1 38 | BURST_LENGTH_8 LITERAL1 39 | 40 | TRANSFER_WIDTH_8 LITERAL1 41 | TRANSFER_WIDTH_16 LITERAL1 42 | TRANSFER_WIDTH_32 LITERAL1 43 | 44 | TRANSFER_COMPLETE LITERAL1 45 | SDMMC_ON LITERAL1 46 | BLOCK_TRANSFER_COMPLETE LITERAL1 47 | SRC_TRANSACTION_COMPLETE LITERAL1 48 | DST_TRANSACTION_COMPLETE LITERAL1 49 | ERROR LITERAL1 50 | 51 | UART0_CH0 LITERAL1 52 | UART0_CH1 LITERAL1 53 | UART1_CH0 LITERAL1 54 | UART1_CH1 LITERAL1 55 | UART2_CH0 LITERAL1 56 | UART2_CH1 LITERAL1 57 | SPI0_CH0 LITERAL1 58 | SPI0_CH1 LITERAL1 59 | SPI1_CH0 LITERAL1 60 | SPI1_CH1 LITERAL1 61 | SPI2_CH0 LITERAL1 62 | SPI2_CH1 LITERAL1 63 | -------------------------------------------------------------------------------- /libraries/DMA/library.properties: -------------------------------------------------------------------------------- 1 | name=DMA 2 | version=1.0.1 3 | author=Infineon Technologies AG 4 | maintainer=Infineon Technologies AG 5 | sentence=This library helps you to manage DMA for XMC microcontrollers [EXPERIMENTAL] 6 | paragraph= The General Purposes Direct Memory Access (GPDMA) is a module within the XMC4000 series to transfer data without any CPU interference. When a DMA transfer request is generated, the GPDMA transfers data stored at the source address to the destination address. 7 | category=Device Control 8 | url = https://www.infineon.com/dgdl/Infineon-GPDMA-XMC4000-AP32290-AN-v01_00-EN.pdf?fileId=5546d4624e765da5014ed9145c601e95 9 | architectures=xmc 10 | 11 | -------------------------------------------------------------------------------- /libraries/DeviceControlXMC/Readme.MD: -------------------------------------------------------------------------------- 1 | # DeviceControlXMC library for XMC 2 | 3 | This library includes the basic device control examples of the XMC which mesaures temperature, memory and sleep mode measurement. 4 | 5 | ## Additional Information 6 | See also our [documentation](https://xmc-arduino.readthedocs.io/en/latest/builtin-libraries.html). -------------------------------------------------------------------------------- /libraries/DeviceControlXMC/examples/DieTemperatureMeasurement/DieTemperatureMeasurement.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Simple die temperature measurement for XMC devices 3 | Demonstrates the measure temperature of die using sensor. 4 | 05 July 2017 5 | 6 | Amended July 2020 to allow negative die temperature 7 | 8 | Amended February 2020 in line with PR for XMC_BOARD tidy up 9 | 10 | Amended April 2018 Paul Carpenter, PC Services 11 | Needs first serial port to display results at 115,200 baud 12 | 13 | Add sign on message 14 | Take initial reading to avoid high reading as first reading 15 | Make board agnostic 16 | Simplify code 17 | */ 18 | #include 19 | 20 | // For library macro printing 21 | #define str(x) Serial.println( #x ) 22 | #define str1(x) str(x) 23 | 24 | XMCClass devCtrl; 25 | 26 | int32_t temperature = 0; 27 | 28 | 29 | void setup( ) 30 | { 31 | Serial.begin( 115200 ); 32 | delay( 100 ); 33 | Serial.println( "XMC Die Temperature in Degree C Demo (V2.0)" ); 34 | Serial.print( "Running on " ); 35 | str1( XMC_BOARD ); 36 | // dummy read to ensure first value which may be erroneous is ignored 37 | temperature = devCtrl.getTemperature(); 38 | } 39 | 40 | 41 | void loop( ) 42 | { 43 | delay( 1000 ); 44 | 45 | /* If UC_FAMILY = XMC4 you can also calibrate temperature for finer measurements */ 46 | temperature = devCtrl.getTemperature(); 47 | 48 | Serial.print( "Die Temperature\t" ); 49 | Serial.println( temperature ); 50 | } 51 | -------------------------------------------------------------------------------- /libraries/DeviceControlXMC/examples/HeapMemoryMeasurement/HeapMemoryMeasurement.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Simple example to check heap memory during run time for XMC devices 3 | Demonstrates the ability to check on free heap memory. 4 | 5 | Amended April 2018 Paul Carpenter, PC Services 6 | Needs first serial port to display results at 115,200 baud 7 | 8 | Add sign on header and total heap at compile time 9 | Add details for malloc and free after new() and delete[]() of array done 10 | Simplify code 11 | Make board agnostic 12 | 13 | At best gives largest free chunk available depending on any other 14 | malloc/free usage in your application. 15 | */ 16 | #include 17 | 18 | XMCClass devCtrl; 19 | 20 | char *pointer; // Points to allocated memory 21 | size_t freeMemory; // Used to store the value of unused memory; 22 | 23 | 24 | // Gets amount of free heap and sends to serial port as decimal number 25 | void dispFree( ) 26 | { 27 | freeMemory = devCtrl.freeHeapRAM( ); 28 | Serial.println( freeMemory ); 29 | } 30 | 31 | 32 | void setup( ) 33 | { 34 | Serial.begin( 115200 ); 35 | delay( 100 ); 36 | Serial.println( "Heap free memory example (V2.0)" ); 37 | Serial.print( "Total heap at Compile time\t" ); 38 | Serial.println( (uint32_t)( total_heap_s ) ); 39 | // Check the total free memory 40 | Serial.print( "Free memory before allocation:\t" ); 41 | dispFree( ); 42 | 43 | // Allocate some memory and check the changes 44 | pointer = (char*)malloc( 100 ); 45 | if( pointer != NULL ) // check if we had enough space to allocate that memory 46 | Serial.println( "Allocated 100 bytes" ); 47 | else 48 | Serial.println( "Failed to allocate memory" ); 49 | Serial.print( "Free memory after allocation:\t" ); 50 | dispFree( ); 51 | 52 | // Free the allocated memory and check the memory now 53 | free( pointer ); 54 | Serial.println( "Freed 100 bytes" ); 55 | Serial.print( "Free memory after freeing:\t" ); 56 | dispFree( ); 57 | 58 | // use new and delete on array of 100 x 32 bit ints 59 | pointer = (char *)new( int[ 100 ] ); 60 | if( pointer != NULL ) // check if we had enough space to allocate that memory 61 | Serial.println( "new() array of integers " ); 62 | else 63 | Serial.println( "Failed to allocate memory" ); 64 | Serial.print( "Free memory after new():\t" ); 65 | dispFree( ); 66 | 67 | // Free the allocated memory and check the memory now 68 | delete[]( pointer ); 69 | Serial.println( "Delete array" ); 70 | Serial.print( "Free memory after delete:\t" ); 71 | dispFree( ); 72 | } 73 | 74 | 75 | void loop( ) 76 | { 77 | // do absolutely nothing 78 | } 79 | 80 | -------------------------------------------------------------------------------- /libraries/DeviceControlXMC/examples/SleepModeXMC1100/SleepModeXMC1100.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Simple Sleep Mode for xmc1100 series 3 | Demonstrates the use of an alarm to wake up an xmc1100 from sleep mode. 4 | */ 5 | #include 6 | #include 7 | 8 | // Create an rtc object 9 | RTCClass rtc; 10 | 11 | // Create an DeviceControlXMC object 12 | XMCClass xmc1100; 13 | 14 | // Change these values to set the current initial time 15 | const byte seconds = 0; 16 | const byte minutes = 0; 17 | const byte hours = 16; 18 | 19 | // Change these values to set the current initial date 20 | const byte day = 25; 21 | const byte month = 9; 22 | const byte year = 15; 23 | 24 | int state = 0; // 0- in active mode; 1 - changing mode; 2 - in sleep mode 25 | 26 | void setup( ) 27 | { 28 | Serial.begin( 9600 ); 29 | rtc.begin( ); 30 | xmc1100.configureSleepMode( SLEEP_MODE, USIC_ON, LEDT_OFF, CCU_ON, WDT_ON, FLASH_ON ); 31 | 32 | rtc.setTime( hours, minutes, seconds ); 33 | rtc.setDate( day, month, year ); 34 | 35 | // Set alarm to go to sleep 36 | rtc.setAlarmTime( 16, 0, 5 ); 37 | rtc.enableAlarm( rtc.ALARM ); 38 | rtc.attachInterrupt( alarmMatch ); 39 | } 40 | 41 | 42 | void loop( ) 43 | { 44 | // Print time 45 | print2digits( rtc.getHours( ) ); 46 | Serial.print(":"); 47 | print2digits( rtc.getMinutes( ) ); 48 | Serial.print(":"); 49 | print2digits( rtc.getSeconds( ) ); 50 | Serial.println( ); 51 | delay( 1000 ); 52 | 53 | if( state == 1 ) { 54 | rtc.setAlarmTime( 16, 0, 20 ); 55 | state = 2; // Flag to wake up from sleep mode 56 | Serial.println( "Entering sleep mode" ); 57 | delay( 100 ); 58 | xmc1100.enterSleepMode( ); 59 | } 60 | } 61 | 62 | 63 | void print2digits( int number ) 64 | { 65 | if (number < 10) { 66 | Serial.write( '0' ); // Print a 0 before if the number is < than 10 67 | } 68 | Serial.print( number ); 69 | } 70 | 71 | 72 | void alarmMatch( ) 73 | { 74 | if( state == 2 ) { 75 | xmc1100.enterActiveMode( ); 76 | Serial.println( "Woke up" ); 77 | } 78 | else if( state == 0 ) // If device is in active state, set it to changing state 79 | state = 1; 80 | } 81 | -------------------------------------------------------------------------------- /libraries/DeviceControlXMC/examples/SleepModeXMC4700/SleepModeXMC4700.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Simple Sleep Mode for XMC4700 Relax Kit V1 3 | Demonstrates the ability to control peripherals on sleep mode. 4 | LED2 will blink fast on active mode. If CCU4 is ON in sleep mode, LED2 will blink slower (because of slower clock) while in sleep mode. 5 | If CCU is OFF in sleep mode, LED2 will stop blinking, until device wakes up. 6 | Demonstrates the use of an alarm to wake up an XMC4700 from sleep mode. 7 | */ 8 | #include 9 | #include 10 | #include "utility/timer.h" 11 | 12 | // Create an rtc object 13 | RTCClass rtc; 14 | 15 | // Create an DeviceControlXMC object 16 | XMCClass devCtrl; 17 | 18 | // Change these values to set the current initial time 19 | const byte seconds = 0; 20 | const byte minutes = 0; 21 | const byte hours = 16; 22 | 23 | // Change these values to set the current initial date 24 | const byte day = 25; 25 | const byte month = 9; 26 | const byte year = 15; 27 | 28 | int state = 0; // 0- in active mode; 1 - changing mode; 2 - in sleep mode 29 | bool led_state = false; 30 | 31 | 32 | void setup( ) 33 | { 34 | Serial.begin( 9600 ); 35 | rtc.begin(); 36 | devCtrl.configureSleepMode( SLEEP_MODE, SYSCLK_FOFI, USB_OFF, SDMMC_OFF, ETH_OFF, 37 | EBU_OFF, CCU_ON, WDT_ON, FLASH_ON, PLL_ON, VCO_ON ); 38 | pinMode( LED2, OUTPUT ); 39 | 40 | TIMER_Init( 0 ); // Timer init, used to toggle LED2 41 | 42 | rtc.setTime( hours, minutes, seconds ); 43 | rtc.setDate( day, month, year ); 44 | 45 | //Set alarm to go to sleep 46 | rtc.setAlarmTime( 16, 0, 5 ); 47 | rtc.enableAlarm( rtc.ALARM ); 48 | rtc.attachInterrupt( alarmMatch ); 49 | } 50 | 51 | void loop( ) 52 | { 53 | TIMER_Start( 8000000U ); // Start a timer 54 | 55 | if( state == 1 ){ 56 | rtc.setAlarmTime( 16, 0, 20 ); // Time to wake up 57 | state = 2; // Flag to wake up from sleep mode 58 | Serial.println( "Entering sleep mode" ); 59 | delay( 100 ); 60 | devCtrl.enterSleepMode(); 61 | } 62 | } 63 | void alarmMatch( ) 64 | { 65 | if( state == 2 ) { 66 | devCtrl.enterActiveMode( ); 67 | Serial.println( "Woke up" ); 68 | } 69 | else if( state == 0 ) 70 | state = 1; 71 | } 72 | 73 | void timer_cb( void ) 74 | { 75 | if( led_state == false ) { 76 | led_state = true; 77 | digitalWrite( LED2, HIGH ); 78 | } 79 | else { 80 | led_state = false; 81 | digitalWrite( LED2, LOW ); 82 | } 83 | 84 | TIMER_Stop( ); 85 | TIMER_Clear( ); 86 | TIMER_Start( 8000000U ); 87 | } 88 | -------------------------------------------------------------------------------- /libraries/DeviceControlXMC/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For DeviceControlXMC Library 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | XMCClass KEYWORD1 10 | 11 | 12 | 13 | ####################################### 14 | # Methods and Functions (KEYWORD2) 15 | ####################################### 16 | 17 | begin KEYWORD2 18 | enterActiveMode KEYWORD2 19 | reset KEYWORD2 20 | configureSleepMode KEYWORD2 21 | enterSleepMode KEYWORD2 22 | getTemperature KEYWORD2 23 | calibrateTemperatureSensor KEYWORD2 24 | freeHeapRAM KEYWORD2 25 | 26 | 27 | ####################################### 28 | # Constants (LITERAL1) 29 | ####################################### 30 | 31 | SLEEP_MODE LITERAL1 32 | DEEP_SLEEP_MODE LITERAL1 33 | 34 | WAKEUP_ON_RTC LITERAL1 35 | WAKEUP_ON_WATCHDOG LITERAL1 36 | WAKEUP_ON_IN_SIGNAL_POS_EDGE LITERAL1 37 | WAKEUP_ON_IN_SIGNAL_NEG_EDGE LITERAL1 38 | 39 | SYSCLK_FOFI LITERAL1 40 | SYSCLK_FPLL LITERAL1 41 | USB_ON LITERAL1 42 | USB_OFF LITERAL1 43 | SDMMC_ON LITERAL1 44 | SDMMC_OFF LITERAL1 45 | ETH_ON LITERAL1 46 | ETH_OFF LITERAL1 47 | EBU_ON LITERAL1 48 | EBU_OFF LITERAL1 49 | CCU_ON LITERAL1 50 | CCU_OFF LITERAL1 51 | WDT_ON LITERAL1 52 | WDT_OFF LITERAL1 53 | FLASH_ON LITERAL1 54 | FLASH_OFF LITERAL1 55 | PLL_ON LITERAL1 56 | PLL_OFF LITERAL1 57 | VCO_ON LITERAL1 58 | VCO_OFF LITERAL1 59 | 60 | USIC_ON LITERAL1 61 | USIC_OFF LITERAL1 62 | LEDT_ON LITERAL1 63 | LEDT_OFF LITERAL1 64 | -------------------------------------------------------------------------------- /libraries/DeviceControlXMC/library.properties: -------------------------------------------------------------------------------- 1 | name=Device Control XMC 2 | version=1.0 3 | author=Infineon Technologies AG 4 | maintainer=Infineon Technologies AG 5 | sentence=This library helps you to manage low power modes of XMC microcontrollers. 6 | paragraph= . 7 | category=Device Control 8 | url= 9 | architectures=xmc 10 | 11 | -------------------------------------------------------------------------------- /libraries/I2S/examples/sampleValues/sampleValues.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /* 4 | * This example reads audio data from Infineon's IM69D130 Microphone Shield2Go 5 | * and prints it on the serial monitor. 6 | * 7 | * Open the serial monitor with baudrate of 1000000 to see the results. 8 | * 9 | * Note: if 2 channels are used, the values returned from I2S.read() will be from both channels and thus look noisy 10 | * In this case, both values need to be separated. 11 | */ 12 | 13 | void setup() 14 | { 15 | Serial.begin(1000000); 16 | Serial.println("Begin of I2S microphone"); 17 | // Disable all microphones 18 | I2S.disableMicrophones(); 19 | // Enable the microphone when word select is low 20 | I2S.enableMicrophoneLow(); 21 | // Enable the microphone when word select is high 22 | // I2S.enableMicrophoneHigh(); 23 | // Get the activated microphones 24 | // You can compare against NO_MICROPHONE, MICROPHONE_LOW, MICROPHONE_HIGH, MICROPHONE_LOW_HIGH 25 | // e.g. I2S.getMicrophones() == NO_MICROPHONE 26 | // I2S.getMicrophones(); 27 | 28 | // Start I2S with I2S_PHILIPS_MODE, 11 kHz sampling rate and 20 bits per sample 29 | // Returns 0 if everything okay, otherwise value > 0 30 | I2S.begin(I2S_PHILIPS_MODE, 11000, 20); 31 | } 32 | 33 | void loop() 34 | { 35 | // I2S is very demanding in terms of data rate 36 | // Uncomment the line with I2S.getOverflow() to see whether the internal buffer has an overflow or not 37 | while (I2S.available() > 0) 38 | { 39 | // Read one value from the internal buffer and return it on the serial console 40 | Serial.println(I2S.read()); 41 | // if(I2S.getOverflow() == true) Serial.println("Overflow"); 42 | } 43 | // You can always use I2S.peek() to get the latest value 44 | // With I2S.flush(), you will read once the buffer size (if values are inserted faster, this will not empty the buffer) 45 | } 46 | -------------------------------------------------------------------------------- /libraries/I2S/examples/sampleValuesWithCallback/sampleValuesWithCallback.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /* 4 | * This example reads audio data from Infineon's IM69D130 Microphone Shield2Go 5 | * and prints it on the serial monitor - additionally, it uses a custom callback 6 | * to show how to distinguish between the peeked values for LOW and HIGH word select. 7 | * 8 | * Open the serial monitor with baudrate of 1000000 to see the results. 9 | * 10 | * Note: as 2 channels are used, the values returned from I2S.read() will be from both channels and thus look noisy 11 | * In this case, both values need to be separated. 12 | */ 13 | 14 | volatile int32_t lastValueLow = 0; 15 | volatile int32_t lastValueHigh = 0; 16 | 17 | void customCallback(){ 18 | if(I2S.getSampleInformation() == NO_MICROPHONE) return; 19 | 20 | if(I2S.getSampleInformation() == MICROPHONE_LOW){ 21 | lastValueLow = I2S.peek(); 22 | } 23 | if(I2S.getSampleInformation() == MICROPHONE_HIGH){ 24 | lastValueHigh = I2S.peek(); 25 | } 26 | } 27 | 28 | void setup() 29 | { 30 | Serial.begin(1000000); 31 | Serial.println("Begin of I2S microphone"); 32 | // Disable all microphones 33 | I2S.disableMicrophones(); 34 | // Enable the microphone in stereo mode 35 | I2S.enableMicrophoneLow(); 36 | I2S.enableMicrophoneHigh(); 37 | 38 | // Register the custom callback function 39 | I2S.onReceive(customCallback); 40 | 41 | // Start I2S with I2S_PHILIPS_MODE, 11 kHz sampling rate and 20 bits per sample 42 | // Returns 0 if everything okay, otherwise value > 0 43 | I2S.begin(I2S_PHILIPS_MODE, 11000, 20); 44 | } 45 | 46 | void loop() 47 | { 48 | // I2S is very demanding in terms of data rate 49 | // Uncomment the line with I2S.getOverflow() to see whether the internal buffer has an overflow or not 50 | while (I2S.available() > 0) 51 | { 52 | // Read one value from the internal buffer and return it on the serial console 53 | Serial.println(I2S.read()); 54 | // if(I2S.getOverflow() == true) Serial.println("Overflow"); 55 | } 56 | // Print the peeked values from the defined callback 57 | Serial.println("Last peeked value for LOW"); 58 | Serial.println(lastValueLow); 59 | Serial.println("Last peeked value for HIGH"); 60 | Serial.println(lastValueHigh); 61 | } -------------------------------------------------------------------------------- /libraries/I2S/examples/soundPressureLevel/soundPressureLevel.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /* 4 | * This example reads audio data from Infineon's IM69D130 Microphone Shield2Go 5 | * and processes it to provide feedback based on the sound pressure level. 6 | * 7 | * Open the serial plotter with baudrate of 1000000 and make noise to see the results. 8 | * 9 | * It is based on an example published by Sandeep Mistry (https://github.com/sandeepmistry) 10 | */ 11 | 12 | void setup() 13 | { 14 | // Open serial communication with a baudrate of 1000000 15 | Serial.begin(1000000); 16 | // Wait until the serial port is connected 17 | while (!Serial); 18 | 19 | I2S.disableMicrophones(); 20 | // Enable the microphone when word select is low 21 | I2S.enableMicrophoneLow(); 22 | 23 | // Start I2S at 11 kHz with 20 bits per sample 24 | if (I2S.begin(I2S_PHILIPS_MODE, 11000, 20) != 0) 25 | { 26 | Serial.println("Failed to initialize I2S!"); 27 | // Do nothing and wait 28 | while (true); 29 | } 30 | } 31 | 32 | void loop() 33 | { 34 | // Array to store the samples 35 | int samples[128]; 36 | if (I2S.available() > 128) 37 | { 38 | // Read 128 samples into the array 39 | I2S.read(samples, 128); 40 | 41 | float meanValue = 0; 42 | for (int i = 0; i < 128; i++) 43 | { 44 | meanValue += samples[i]; 45 | } 46 | meanValue /= 128; 47 | 48 | // Substract it from all samples to normalize output 49 | for (int i = 0; i < 128; i++) 50 | { 51 | samples[i] -= meanValue; 52 | } 53 | 54 | // Get the peak to peak maximum 55 | float maxSample, minSample; 56 | minSample = 100000; 57 | maxSample = -100000; 58 | for (int i = 0; i < 128; i++) 59 | { 60 | minSample = min(minSample, samples[i]); 61 | maxSample = max(maxSample, samples[i]); 62 | } 63 | Serial.println(maxSample - minSample); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /libraries/I2S/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For I2S 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | ####################################### 10 | # Methods and Functions (KEYWORD2) 11 | ####################################### 12 | begin KEYWORD2 13 | onReceive KEYWORD2 14 | enableMicrophoneLow KEYWORD2 15 | enableMicrophoneHigh KEYWORD2 16 | disableMicrophones KEYWORD2 17 | getMicrophones KEYWORD2 18 | peek KEYWORD2 19 | flush KEYWORD2 20 | end KEYWORD2 21 | read KEYWORD2 22 | available KEYWORD2 23 | enableMasterClock KEYWORD2 24 | getOverflow KEYWORD2 25 | ####################################### 26 | # Instances (KEYWORD2) 27 | ####################################### 28 | I2S KEYWORD2 29 | 30 | 31 | ####################################### 32 | # Constants (LITERAL1) 33 | ####################################### 34 | 35 | -------------------------------------------------------------------------------- /libraries/I2S/library.properties: -------------------------------------------------------------------------------- 1 | name=I2S 2 | version=1.0.2 3 | author=Infineon Technologies AG 4 | maintainer=Infineon Technologies AG 5 | sentence=This library allows the XMC µC to interface audio input devices with the I2S protocol 6 | paragraph=The I2S protocol is a synchronous serial communication protocol mainly for audio and infotainment applications. This library allows the microcontroller to work as the master device and read audio input from another device such as a microphone. USIC interrupts are used for sampling. 7 | category=Communication 8 | url=https://www.infineon.com/cms/en/product/promopages/microphones/ 9 | architectures=xmc 10 | 11 | -------------------------------------------------------------------------------- /libraries/LED/examples/SimpleLED/SimpleLED.ino: -------------------------------------------------------------------------------- 1 | /* Simple LED library flashes on board LED Every second 2 | 3 | Demonstrates the use of the on board LED library 4 | 5 | Works with any XMC board that has at least ONE LED on board 6 | Better with two 7 | */ 8 | #include 9 | 10 | /* Create an LED object */ 11 | LED Led; 12 | 13 | void setup( ) 14 | { 15 | Led.Add( LED1 ); // Configure the LEDs 16 | Led.Off( LED1 ); // Set default state of LEDs 17 | 18 | #if NUM_LEDS > 1 19 | Led.Add( LED2 ); 20 | Led.On( LED2 ); 21 | #endif 22 | } 23 | 24 | 25 | void loop( ) 26 | { 27 | delay( 1000 ); 28 | Led.Toggle( LED1 ); 29 | 30 | #if NUM_LEDS > 1 31 | Led.Off( LED2 ); 32 | #endif 33 | } 34 | -------------------------------------------------------------------------------- /libraries/LED/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Colouring Map For LED 3 | ####################################### 4 | 5 | ####################################### 6 | # Data types (KEYWORD1) 7 | ####################################### 8 | LED KEYWORD1 9 | 10 | ####################################### 11 | # Methods and Functions (KEYWORD2) 12 | ####################################### 13 | 14 | begin KEYWORD2 15 | end KEYWORD2 16 | 17 | On KEYWORD2 18 | Off KEYWORD2 19 | Toggle KEYWORD2 20 | Add KEYWORD2 21 | 22 | ####################################### 23 | # Constants (LITERAL1) 24 | ####################################### 25 | -------------------------------------------------------------------------------- /libraries/LED/library.properties: -------------------------------------------------------------------------------- 1 | name=LED 2 | version=1.0.4 3 | author=Paul Carpenter, PC services, www.pcserviceselectronics.co.uk 4 | maintainer=Infineon Technologies AG 5 | sentence=This library allows you to enable as well as control the on board LEDs of the XMC microcontrollers. 6 | paragraph= This library allows you to enable as well as control the on boards LEDs on Infineon XMC boards, in a way that works across ANY board. 7 | category=Other 8 | url=https://github.com/Infineon/XMC-for-Arduino/tree/master/arm/libraries/LED 9 | architectures=xmc 10 | 11 | -------------------------------------------------------------------------------- /libraries/LED/src/LED.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * LED.cpp - Library for Arduino to control the RTC (Real Time Clock) of the XMC microcontroller 3 | * series. 4 | * 5 | * On board LEDs on the XMC boards do not always operate the same way 6 | * This library encapsulates LED functions for on board LEDs to work the same 7 | * way on ALL boards 8 | * 9 | * Copyright (c) 2018 Infineon Technologies AG 10 | * 11 | * This library is free software; you can redistribute it and/or 12 | * modify it under the terms of the GNU Lesser General Public 13 | * License as published by the Free Software Foundation; either 14 | * version 2.1 of the License, or (at your option) any later version. 15 | * 16 | * This library is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * Lesser General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU Lesser General Public 22 | * License along with this library; if not, write to the Free Software 23 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 24 | */ 25 | 26 | /*! \file LED.cpp 27 | * \brief This file has to be included in projects that use Infineon's XMC on board LEDs 28 | */ 29 | #include 30 | #include "LED.h" 31 | 32 | //**************************************************************************** 33 | // @Prototypes Of Local Functions 34 | //**************************************************************************** 35 | 36 | //**************************************************************************** 37 | // @Local Functions 38 | //**************************************************************************** 39 | 40 | //**************************************************************************** 41 | // @Public Methods 42 | //**************************************************************************** 43 | 44 | // Nothing to initialise 45 | void LED::begin() {} 46 | 47 | // Nothing to release 48 | void LED::end() {} 49 | 50 | /* Configure pin for output for specified pin */ 51 | void LED::Add(int pin) { pinMode(pin, OUTPUT); } 52 | 53 | /* Set LED On for specified pin */ 54 | void LED::On(int pin) { 55 | if (pin == LED_BUILTIN) 56 | #ifdef XMC_LED_BUILTIN_REVERSED 57 | digitalWrite(pin, false); 58 | #else 59 | digitalWrite(pin, true); 60 | #endif 61 | else 62 | digitalWrite(pin, XMC_LED_ON); 63 | } 64 | 65 | /* Set LED Off for specified pin */ 66 | void LED::Off(int pin) { 67 | if (pin == LED_BUILTIN) 68 | #ifdef XMC_LED_BUILTIN_REVERSED 69 | digitalWrite(pin, true); 70 | #else 71 | digitalWrite(pin, false); 72 | #endif 73 | else 74 | digitalWrite(pin, !XMC_LED_ON); 75 | } 76 | 77 | /* Toggle LED state for specified pin */ 78 | void LED::Toggle(int pin) { digitalToggle(pin); } 79 | 80 | /****************************************** 81 | End of file LED.cpp 82 | *******************************************/ 83 | -------------------------------------------------------------------------------- /libraries/LED/src/LED.h: -------------------------------------------------------------------------------- 1 | /** 2 | * LED.h - Library for Arduino to control the on board LEDs of the XMC microcontroller series. 3 | * 4 | * On board LEDs on the XMC boards do not always operate the same way 5 | * This library encapsulates LED functions for on board LEDs to work the same 6 | * way on ALL boards 7 | * 8 | * Copyright (c) 2018 Infineon Technologies AG 9 | * 10 | * This library is based on the RTCZero implementation for Arduino: 11 | * 12 | * Copyright (c) 2015 Arduino LLC. All right reserved. 13 | * 14 | * This library is free software; you can redistribute it and/or 15 | * modify it under the terms of the GNU Lesser General Public 16 | * License as published by the Free Software Foundation; either 17 | * version 2.1 of the License, or (at your option) any later version. 18 | * 19 | * This library is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | * Lesser General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU Lesser General Public 25 | * License along with this library; if not, write to the Free Software 26 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 27 | */ 28 | 29 | /*! \file LED.h 30 | * \brief This file has to be included in projects that use Infineon's XMC on board LEDs 31 | */ 32 | 33 | #ifndef _LED_H_INCLUDED 34 | #define _LED_H_INCLUDED 35 | 36 | //**************************************************************************** 37 | // @Board Check 38 | //**************************************************************************** 39 | #if !defined(XMC1) || !defined(XMC4) 40 | #error Only XMC microcontrollers are supported by this library 41 | #endif 42 | 43 | #if !defined XMC_LED_ON 44 | #error This board NOT supported by this library (Check pins_arduino.h) 45 | #endif 46 | 47 | #if not defined(NUM_LEDS) || (NUM_LEDS < 1) 48 | #error Current selected board does NOT support on board LEDs 49 | #endif 50 | 51 | //**************************************************************************** 52 | // @Project Includes 53 | //**************************************************************************** 54 | 55 | //**************************************************************************** 56 | // @Defines 57 | //**************************************************************************** 58 | 59 | //**************************************************************************** 60 | // @Class Definitions 61 | //**************************************************************************** 62 | class LED { 63 | public: 64 | // Constructors and initialisers that do nothing 65 | LED() {} 66 | 67 | void begin(); 68 | void end(); 69 | 70 | // Useful methods 71 | void Add(int); // Configure digital output 72 | void On(int); // Set LED ON 73 | void Off(int); // Set LED OFF 74 | void Toggle(int); // Toggle state of LED 75 | }; 76 | #endif /* _LED_H_INCLUDED */ 77 | -------------------------------------------------------------------------------- /libraries/OneWire/Readme.MD: -------------------------------------------------------------------------------- 1 | # OneWire Library for XMC 2 | 3 | OneWire library lets you access 1-wire devices. 4 | 5 | ## Additional Information 6 | See also our [documentation](https://xmc-arduino.readthedocs.io/en/latest/builtin-libraries.html). -------------------------------------------------------------------------------- /libraries/OneWire/examples/DS2408_Switch/DS2408_Switch.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /* 4 | * DS2408 8-Channel Addressable Switch 5 | * 6 | * Writte by Glenn Trewitt, glenn at trewitt dot org 7 | * 8 | * Some notes about the DS2408: 9 | * - Unlike most input/output ports, the DS2408 doesn't have mode bits to 10 | * set whether the pins are input or output. If you issue a read command, 11 | * they're inputs. If you write to them, they're outputs. 12 | * - For reading from a switch, you should use 10K pull-up resisters. 13 | */ 14 | 15 | void PrintBytes(uint8_t* addr, uint8_t count, bool newline=0) { 16 | for (uint8_t i = 0; i < count; i++) { 17 | Serial.print(addr[i]>>4, HEX); 18 | Serial.print(addr[i]&0x0f, HEX); 19 | } 20 | if (newline) 21 | Serial.println(); 22 | } 23 | 24 | void ReadAndReport(OneWire* net, uint8_t* addr) { 25 | Serial.print(" Reading DS2408 "); 26 | PrintBytes(addr, 8); 27 | Serial.println(); 28 | 29 | uint8_t buf[13]; // Put everything in the buffer so we can compute CRC easily. 30 | buf[0] = 0xF0; // Read PIO Registers 31 | buf[1] = 0x88; // LSB address 32 | buf[2] = 0x00; // MSB address 33 | net->write_bytes(buf, 3); 34 | net->read_bytes(buf+3, 10); // 3 cmd bytes, 6 data bytes, 2 0xFF, 2 CRC16 35 | net->reset(); 36 | 37 | if (!OneWire::check_crc16(buf, 11, &buf[11])) { 38 | Serial.print("CRC failure in DS2408 at "); 39 | PrintBytes(addr, 8, true); 40 | return; 41 | } 42 | Serial.print(" DS2408 data = "); 43 | // First 3 bytes contain command, register address. 44 | Serial.println(buf[3], BIN); 45 | } 46 | 47 | OneWire net(10); // on pin 10 48 | 49 | void setup(void) { 50 | Serial.begin(9600); 51 | } 52 | 53 | void loop(void) { 54 | byte i; 55 | byte present = 0; 56 | byte addr[8]; 57 | 58 | if (!net.search(addr)) { 59 | Serial.print("No more addresses.\n"); 60 | net.reset_search(); 61 | delay(1000); 62 | return; 63 | } 64 | 65 | if (OneWire::crc8(addr, 7) != addr[7]) { 66 | Serial.print("CRC is not valid!\n"); 67 | return; 68 | } 69 | 70 | if (addr[0] != 0x29) { 71 | PrintBytes(addr, 8); 72 | Serial.print(" is not a DS2408.\n"); 73 | return; 74 | } 75 | 76 | ReadAndReport(&net, addr); 77 | } 78 | -------------------------------------------------------------------------------- /libraries/OneWire/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For OneWire 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | OneWire KEYWORD1 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | 15 | reset KEYWORD2 16 | write_bit KEYWORD2 17 | read_bit KEYWORD2 18 | write KEYWORD2 19 | write_bytes KEYWORD2 20 | read KEYWORD2 21 | read_bytes KEYWORD2 22 | select KEYWORD2 23 | skip KEYWORD2 24 | depower KEYWORD2 25 | reset_search KEYWORD2 26 | search KEYWORD2 27 | crc8 KEYWORD2 28 | crc16 KEYWORD2 29 | check_crc16 KEYWORD2 30 | 31 | ####################################### 32 | # Instances (KEYWORD2) 33 | ####################################### 34 | 35 | 36 | ####################################### 37 | # Constants (LITERAL1) 38 | ####################################### 39 | -------------------------------------------------------------------------------- /libraries/OneWire/library.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "OneWire", 3 | "description": "Control 1-Wire protocol (DS18S20, DS18B20, DS2408 and etc)", 4 | "keywords": "onewire, 1-wire, bus, sensor, temperature, ibutton", 5 | "authors": [ 6 | { 7 | "name": "Paul Stoffregen", 8 | "email": "paul@pjrc.com", 9 | "url": "http://www.pjrc.com", 10 | "maintainer": true 11 | }, 12 | { 13 | "name": "Jim Studt" 14 | }, 15 | { 16 | "name": "Tom Pollard", 17 | "email": "pollard@alum.mit.edu" 18 | }, 19 | { 20 | "name": "Derek Yerger" 21 | }, 22 | { 23 | "name": "Josh Larios" 24 | }, 25 | { 26 | "name": "Robin James" 27 | }, 28 | { 29 | "name": "Glenn Trewitt" 30 | }, 31 | { 32 | "name": "Jason Dangel", 33 | "email": "dangel.jason AT gmail.com" 34 | }, 35 | { 36 | "name": "Guillermo Lovato" 37 | }, 38 | { 39 | "name": "Ken Butcher" 40 | }, 41 | { 42 | "name": "Mark Tillotson" 43 | }, 44 | { 45 | "name": "Bertrik Sikken" 46 | }, 47 | { 48 | "name": "Scott Roberts" 49 | } 50 | ], 51 | "repository": { 52 | "type": "git", 53 | "url": "https://github.com/PaulStoffregen/OneWire" 54 | }, 55 | "version": "2.3.2", 56 | "homepage": "https://www.pjrc.com/teensy/td_libs_OneWire.html", 57 | "frameworks": "Arduino", 58 | "examples": [ 59 | "examples/*/*.pde" 60 | ] 61 | } 62 | -------------------------------------------------------------------------------- /libraries/OneWire/library.properties: -------------------------------------------------------------------------------- 1 | name=OneWire 2 | version=2.3.4 3 | author=Jim Studt, Tom Pollard, Robin James, Glenn Trewitt, Jason Dangel, Guillermo Lovato, Paul Stoffregen, Scott Roberts, Bertrik Sikken, Mark Tillotson, Ken Butcher, Roger Clark, Love Nystrom 4 | maintainer=Paul Stoffregen 5 | sentence=Access 1-wire temperature sensors, memory and other chips. 6 | paragraph=Add Dallas one wire interface for single wire peripherals like DS18B20 (temperature), memory and other devices 7 | category=Communication 8 | url=http://www.pjrc.com/teensy/td_libs_OneWire.html 9 | architectures=xmc 10 | 11 | -------------------------------------------------------------------------------- /libraries/OneWire/src/util/OneWireHW.h: -------------------------------------------------------------------------------- 1 | #ifndef ONEWIRE_HW_H 2 | #define ONEWIRE_HW_H 3 | 4 | #include "OneWireTiming.h" 5 | #include "OneWireImpl.h" 6 | #include "SPI.h" 7 | 8 | namespace onewire { 9 | class OneWireHW : public OneWireImpl { 10 | private: 11 | SPISettings mSpiConf; 12 | SPIClass mSpiHW; 13 | uint8_t mSpiCodes[2]; 14 | uint8_t mSpiResetTime; 15 | uint8_t mByteBuffer[8]; 16 | 17 | public: 18 | OneWireHW(XMC_SPI_t *spiConf, const Timing_t *timing); 19 | ~OneWireHW(); 20 | // begin and end do not appear in the original version 21 | // they are called automatically in our implementation 22 | virtual void begin(void) override; 23 | virtual void end(void) override; 24 | virtual uint8_t reset(void) override; 25 | virtual void write(uint8_t v, uint8_t power = 0) override; 26 | virtual void write_bytes(const uint8_t *buf, uint16_t count, bool power = 0) override; 27 | virtual uint8_t read(void) override; 28 | virtual void read_bytes(uint8_t *buf, uint16_t count) override; 29 | virtual void write_bit(uint8_t v) override; 30 | virtual uint8_t read_bit(void) override; 31 | virtual void depower(void) override; 32 | }; 33 | } // namespace onewire 34 | #endif -------------------------------------------------------------------------------- /libraries/OneWire/src/util/OneWireImpl.h: -------------------------------------------------------------------------------- 1 | #ifndef ONEWIRE_IMPL_H 2 | #define ONEWIRE_IMPL_H 3 | 4 | #include "SPI.h" 5 | #include "OneWireSettings.h" 6 | 7 | namespace onewire { 8 | class OneWireImpl { 9 | private: 10 | #if ONEWIRE_SEARCH 11 | // global search state 12 | unsigned char ROM_NO[8]; 13 | uint8_t LastDiscrepancy; 14 | uint8_t LastFamilyDiscrepancy; 15 | uint8_t LastDeviceFlag; 16 | #endif 17 | 18 | public: 19 | OneWireImpl(void); 20 | virtual ~OneWireImpl(); 21 | virtual void begin(void) = 0; 22 | virtual void end(void) = 0; 23 | virtual uint8_t reset(void) = 0; 24 | virtual void write(uint8_t v, uint8_t power = 0) = 0; 25 | virtual void write_bytes(const uint8_t *buf, uint16_t count, bool power = 0) = 0; 26 | virtual uint8_t read(void) = 0; 27 | virtual void read_bytes(uint8_t *buf, uint16_t count) = 0; 28 | virtual void write_bit(uint8_t v) = 0; 29 | virtual uint8_t read_bit(void) = 0; 30 | virtual void depower(void) = 0; 31 | 32 | // Issue a 1-Wire rom select command, you do the reset first. 33 | void select(const uint8_t rom[8]); 34 | // Issue a 1-Wire rom skip command, to address all on bus. 35 | void skip(void); 36 | 37 | #if ONEWIRE_SEARCH 38 | // Clear the search state so that if will start from the beginning again. 39 | void reset_search(); 40 | 41 | // Setup the search to find the device type 'family_code' on the next call 42 | // to search(*newAddr) if it is present. 43 | void target_search(uint8_t family_code); 44 | 45 | // Look for the next device. Returns 1 if a new address has been 46 | // returned. A zero might mean that the bus is shorted, there are 47 | // no devices, or you have already retrieved all of them. It 48 | // might be a good idea to check the CRC to make sure you didn't 49 | // get garbage. The order is deterministic. You will always get 50 | // the same devices in the same order. 51 | uint8_t search(uint8_t *newAddr, bool search_mode = true); 52 | #endif 53 | 54 | #if ONEWIRE_CRC 55 | // Compute a Dallas Semiconductor 8 bit CRC, these are used in the 56 | // ROM and scratchpad registers. 57 | static uint8_t crc8(const uint8_t *addr, uint8_t len); 58 | #if ONEWIRE_CRC16 59 | // Compute the 1-Wire CRC16 and compare it against the received CRC. 60 | static bool 61 | check_crc16(const uint8_t *input, uint16_t len, const uint8_t *inverted_crc, uint16_t crc = 0); 62 | // Compute a Dallas Semiconductor 16 bit CRC. 63 | static uint16_t crc16(const uint8_t *input, uint16_t len, uint16_t crc = 0); 64 | #endif 65 | #endif 66 | }; 67 | } // namespace onewire 68 | #endif -------------------------------------------------------------------------------- /libraries/OneWire/src/util/OneWireSW.h: -------------------------------------------------------------------------------- 1 | #ifndef ONEWIRE_SW_H 2 | #define ONEWIRE_SW_H 3 | 4 | #include "OneWireTiming.h" 5 | #include "OneWireImpl.h" 6 | 7 | namespace onewire { 8 | class OneWireSW : public OneWireImpl { 9 | private: 10 | // implementation-specific pin description 11 | uint8_t mActive; 12 | uint32_t mPinMask; 13 | volatile uint32_t *mPortInReg; 14 | volatile uint32_t *mPortOutReg; 15 | volatile uint32_t *mPortModeReg; 16 | uint32_t mPinModeMask; 17 | 18 | // implementation-specific timing description 19 | uint16_t mLowtimeShort; 20 | uint16_t mHightimeShort; 21 | uint16_t mLowtimeLong; 22 | uint16_t mHightimeLong; 23 | uint16_t mWaitBeforeCheck; 24 | uint16_t mWaitAfterCheck; 25 | uint16_t mResetDuration; 26 | 27 | public: 28 | OneWireSW(uint8_t pin, const Timing_t *timing); 29 | ~OneWireSW(); 30 | // begin and end do not appear in the original version 31 | // they are called automatically in our implementation 32 | virtual void begin(void) override; 33 | virtual void end(void) override; 34 | virtual uint8_t reset(void) override; 35 | virtual void write(uint8_t v, uint8_t power = 0) override; 36 | virtual void write_bytes(const uint8_t *buf, uint16_t count, bool power = 0) override; 37 | virtual uint8_t read(void) override; 38 | virtual void read_bytes(uint8_t *buf, uint16_t count) override; 39 | virtual void write_bit(uint8_t v) override; 40 | virtual uint8_t read_bit(void) override; 41 | virtual void depower(void) override; 42 | }; 43 | } // namespace onewire 44 | #endif -------------------------------------------------------------------------------- /libraries/OneWire/src/util/OneWireSettings.h: -------------------------------------------------------------------------------- 1 | #ifndef ONEWIRE_SETTINGS_H 2 | #define ONEWIRE_SETTINGS_H 3 | 4 | // You can exclude certain features from OneWire. In theory, this 5 | // might save some space. In practice, the compiler automatically 6 | // removes unused code (technically, the linker, using -fdata-sections 7 | // and -ffunction-sections when compiling, and Wl,--gc-sections 8 | // when linking), so most of these will not result in any code size 9 | // reduction. Well, unless you try to use the missing features 10 | // and redesign your program to not need them! ONEWIRE_CRC8_TABLE 11 | // is the exception, because it selects a fast but large algorithm 12 | // or a small but slow algorithm. 13 | 14 | // you can exclude onewire_search by defining that to 0 15 | #ifndef ONEWIRE_SEARCH 16 | #define ONEWIRE_SEARCH 1 17 | #endif 18 | 19 | // You can exclude CRC checks altogether by defining this to 0 20 | #ifndef ONEWIRE_CRC 21 | #define ONEWIRE_CRC 1 22 | #endif 23 | 24 | // Select the table-lookup method of computing the 8-bit CRC 25 | // by setting this to 1. The lookup table enlarges code size by 26 | // about 250 bytes. It does NOT consume RAM (but did in very 27 | // old versions of OneWire). If you disable this, a slower 28 | // but very compact algorithm is used. 29 | #ifndef ONEWIRE_CRC8_TABLE 30 | #define ONEWIRE_CRC8_TABLE 1 31 | #endif 32 | 33 | // You can allow 16-bit CRC checks by defining this to 1 34 | // (Note that ONEWIRE_CRC must also be 1.) 35 | #ifndef ONEWIRE_CRC16 36 | #define ONEWIRE_CRC16 1 37 | #endif 38 | 39 | #ifndef FALSE 40 | #define FALSE 0 41 | #endif 42 | #ifndef TRUE 43 | #define TRUE 1 44 | #endif 45 | 46 | #endif /*ONEWIRE_SETTINGS_H*/ -------------------------------------------------------------------------------- /libraries/OneWire/src/util/OneWireTiming.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "OneWireTiming.h" 3 | 4 | namespace onewire { 5 | 6 | uint8_t isValid(const Timing_t *timing) { 7 | if (timing->lowtimeShort < timing->checkAfter && timing->checkAfter < timing->lowtimeLong && 8 | timing->lowtimeLong < timing->bitDuration && timing->bitDuration < timing->resetDuration) { 9 | return TRUE; 10 | } else { 11 | return FALSE; 12 | } 13 | } 14 | 15 | Timing_t timingStd = {10, 65, 20, 70, 480}; 16 | Timing_t timingOverdrive = {1, 8, 5, 15, 52}; 17 | 18 | } // namespace onewire -------------------------------------------------------------------------------- /libraries/OneWire/src/util/OneWireTiming.h: -------------------------------------------------------------------------------- 1 | #ifndef ONEWIRE_TIMING_H 2 | #define ONEWIRE_TIMING_H 3 | 4 | namespace onewire { 5 | typedef struct { 6 | uint16_t lowtimeShort; 7 | uint16_t lowtimeLong; 8 | uint16_t checkAfter; 9 | uint16_t bitDuration; 10 | uint16_t resetDuration; 11 | } Timing_t; 12 | 13 | uint8_t isValid(const Timing_t *timing); 14 | 15 | extern Timing_t timingStd; 16 | extern Timing_t timingOverdrive; 17 | } // namespace onewire 18 | #endif -------------------------------------------------------------------------------- /libraries/RTC/Readme.MD: -------------------------------------------------------------------------------- 1 | # RTC Library for XMC 2 | 3 | This is the real time clock library that is supported by XMC4700. 4 | 5 | ## Additional Information 6 | See also our [documentation](https://xmc-arduino.readthedocs.io/en/latest/builtin-libraries.html). -------------------------------------------------------------------------------- /libraries/RTC/examples/AlarmRTC/AlarmRTC.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Simple RTC Alarm for XMC Boards 3 | Demonstrates how to set an RTC alarm for the XMC4700 Relax Kit V1 4 | */ 5 | 6 | /* 7 | Board Check 8 | This library can currently only be used with the XMC4700 Relax Kit 9 | If you modify the library to work with other XMC versions, remove the following lines 10 | */ 11 | #if (UC_FAMILY != XMC4) 12 | #error This XMC board is not supported, only XMC4700 Relax Kit is supported 13 | #endif 14 | // End of Board Check 15 | 16 | #include 17 | 18 | /* Create an rtc object */ 19 | RTCClass rtc; 20 | 21 | /* Change these values to set the current initial time */ 22 | const byte seconds = 0; 23 | const byte minutes = 0; 24 | const byte hours = 16; 25 | 26 | /* Change these values to set the current initial date */ 27 | const byte day = 25; 28 | const byte month = 9; 29 | const byte year = 15; 30 | 31 | void setup() 32 | { 33 | Serial.begin(9600); 34 | 35 | rtc.begin(); // initialize RTC 24H format 36 | 37 | rtc.setTime(hours, minutes, seconds); 38 | rtc.setDate(day, month, year); 39 | 40 | rtc.setAlarmTime(16, 0, 10); 41 | rtc.enableAlarm(rtc.ALARM); 42 | 43 | rtc.attachInterrupt(alarmMatch); 44 | } 45 | 46 | void loop() 47 | { 48 | 49 | // Print time 50 | print2digits(rtc.getHours()); 51 | Serial.print(":"); 52 | print2digits(rtc.getMinutes()); 53 | Serial.print(":"); 54 | print2digits(rtc.getSeconds()); 55 | 56 | Serial.println(); 57 | 58 | delay(1000); 59 | } 60 | 61 | void alarmMatch() 62 | { 63 | Serial.println("Alarm Match!"); 64 | } 65 | 66 | void print2digits(int number) { 67 | if (number < 10) { 68 | Serial.print("0"); // print a 0 before if the number is < than 10 69 | } 70 | Serial.print(number); 71 | } 72 | -------------------------------------------------------------------------------- /libraries/RTC/examples/SimpleRTC/SimpleRTC.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Simple RTC for XMC4700 Relax Kit V1 3 | Demonstrates the use of the RTC library for the XMC4700 4 | */ 5 | 6 | #include 7 | 8 | /* Create an rtc object */ 9 | RTCClass rtc; 10 | 11 | /* Change these values to set the current initial time */ 12 | const byte seconds = 0; 13 | const byte minutes = 0; 14 | const byte hours = 16; 15 | 16 | /* Change these values to set the current initial date */ 17 | const byte day = 15; 18 | const byte month = 6; 19 | const byte year = 15; 20 | 21 | void setup() 22 | { 23 | Serial.begin(9600); 24 | 25 | rtc.begin(); // initialize RTC 26 | 27 | // Set the time 28 | rtc.setHours(hours); 29 | rtc.setMinutes(minutes); 30 | rtc.setSeconds(seconds); 31 | 32 | // Set the date 33 | rtc.setDay(day); 34 | rtc.setMonth(month); 35 | rtc.setYear(year); 36 | 37 | // you can use also 38 | //rtc.setTime(hours, minutes, seconds); 39 | //rtc.setDate(day, month, year); 40 | } 41 | 42 | void loop() 43 | { 44 | // Print date... 45 | print2digits(rtc.getDay()); 46 | Serial.print("/"); 47 | print2digits(rtc.getMonth()); 48 | Serial.print("/"); 49 | print2digits(rtc.getYear()); 50 | Serial.print(" "); 51 | 52 | // ...and time 53 | print2digits(rtc.getHours()); 54 | Serial.print(":"); 55 | print2digits(rtc.getMinutes()); 56 | Serial.print(":"); 57 | print2digits(rtc.getSeconds()); 58 | 59 | Serial.println(); 60 | 61 | delay(1000); 62 | } 63 | 64 | 65 | 66 | void print2digits(int number) { 67 | if (number < 10) { 68 | Serial.print("0"); // print a 0 before if the number is < than 10 69 | } 70 | Serial.print(number); 71 | } 72 | 73 | 74 | -------------------------------------------------------------------------------- /libraries/RTC/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For RTC 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | RTCClass KEYWORD1 10 | 11 | 12 | ####################################### 13 | # Methods and Functions (KEYWORD2) 14 | ####################################### 15 | 16 | begin KEYWORD2 17 | end KEYWORD2 18 | 19 | setHours KEYWORD2 20 | setMinutes KEYWORD2 21 | setSeconds KEYWORD2 22 | setTime KEYWORD2 23 | setYear KEYWORD2 24 | setMonth KEYWORD2 25 | setDay KEYWORD2 26 | setDate KEYWORD2 27 | 28 | getHours KEYWORD2 29 | getMinutes KEYWORD2 30 | getSeconds KEYWORD2 31 | getYear KEYWORD2 32 | getMonth KEYWORD2 33 | getDay KEYWORD2 34 | 35 | setAlarmHours KEYWORD2 36 | setAlarmMinutes KEYWORD2 37 | setAlarmSeconds KEYWORD2 38 | setAlarmTime KEYWORD2 39 | setAlarmYear KEYWORD2 40 | setAlarmMonth KEYWORD2 41 | setAlarmDay KEYWORD2 42 | setAlarmDate KEYWORD2 43 | 44 | enableAlarm KEYWORD2 45 | disableAlarm KEYWORD2 46 | attachInterrupt KEYWORD2 47 | detachInterrupt KEYWORD2 48 | 49 | setPrescaler KEYWORD2 50 | getPrescaler KEYWORD2 51 | 52 | 53 | ####################################### 54 | # Constants (LITERAL1) 55 | ####################################### 56 | 57 | MATCH_OFF LITERAL1 58 | PERIODIC_SECONDS LITERAL1 59 | 60 | PERIODIC_MINUTES LITERAL1 61 | PERIODIC_HOURS LITERAL1 62 | PERIODIC_DAYS LITERAL1 63 | PERIODIC_MONTHS LITERAL1 64 | PERIODIC_YEARS LITERAL1 65 | ALARM LITERAL1 66 | -------------------------------------------------------------------------------- /libraries/RTC/library.properties: -------------------------------------------------------------------------------- 1 | name=RTC 2 | version=1.0 3 | author=Infineon Technologies AG 4 | maintainer=Infineon Technologies AG 5 | sentence=This library allows you to enable as well as controll the RTC (Real Time Clock) module of the XMC microcontrollers. 6 | paragraph= This library allows you to enable as well as controll the RTC (Real Time Clock) module of the XMC microcontrollers. Real-time clock (RTC) is a clock that keeps track of the current time. RTCs are present in almost any electronic device which needs to keep accurate time in a digital format for clock displays and computer systems. 7 | category=Timing 8 | url=http://www.arduino.cc/en/Reference/RTC 9 | architectures=xmc 10 | 11 | -------------------------------------------------------------------------------- /libraries/RTC/src/utility/xmc_rtc_conf.c: -------------------------------------------------------------------------------- 1 | /** 2 | * xmc_rtc_conf.c - Utility file for the RTC (Real Time Clock) library. 3 | * 4 | * Real-time clock (RTC) is a clock that keeps track of the current time. RTCs are present 5 | * in almost any electronic device which needs to keep accurate time in a digital format for 6 | * clock displays and computer systems. 7 | * 8 | * Have a look at the application note/datasheet for more information. 9 | * 10 | * Copyright (c) 2018 Infineon Technologies AG 11 | * 12 | * Redistribution and use in source and binary forms, with or without modification, are permitted 13 | * provided that the following conditions are met: 14 | * 15 | * Redistributions of source code must retain the above copyright notice, this list of conditions 16 | * and the following disclaimer. 17 | * 18 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions 19 | * and the following disclaimer in the documentation and/or other materials provided with the 20 | * distribution. 21 | * 22 | * Neither the name of the copyright holders nor the names of its contributors may be used to 23 | * endorse or promote products derived from this software without specific prior written permission. 24 | * 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 26 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 27 | * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 28 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 29 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 31 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR 32 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 33 | * OF SUCH DAMAGE. 34 | */ 35 | #include 36 | #include "xmc_rtc_conf.h" 37 | 38 | #if defined HAS_RTC 39 | XMC_RTC_CONFIG_t XMC_RTC_default_t = {.prescaler = 0x7fffU, 40 | .time = { 41 | 42 | .seconds = 0U, 43 | .minutes = 0U, 44 | .hours = 1U, 45 | .days = 1U, 46 | 47 | .year = 2017U, 48 | .month = XMC_RTC_MONTH_JANUARY, 49 | .daysofweek = XMC_RTC_WEEKDAY_SUNDAY, 50 | }}; 51 | #endif 52 | -------------------------------------------------------------------------------- /libraries/RTC/src/utility/xmc_rtc_conf.h: -------------------------------------------------------------------------------- 1 | /** 2 | * xmc_rtc_conf.h - Utility file for the RTC (Real Time Clock) library. 3 | * 4 | * Real-time clock (RTC) is a clock that keeps track of the current time. RTCs are present 5 | * in almost any electronic device which needs to keep accurate time in a digital format for 6 | * clock displays and computer systems. 7 | * 8 | * Have a look at the application note/datasheet for more information. 9 | * 10 | * Copyright (c) 2018 Infineon Technologies AG 11 | * 12 | * Redistribution and use in source and binary forms, with or without modification, are permitted 13 | * provided that the following conditions are met: 14 | * 15 | * Redistributions of source code must retain the above copyright notice, this list of conditions 16 | * and the following disclaimer. 17 | * 18 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions 19 | * and the following disclaimer in the documentation and/or other materials provided with the 20 | * distribution. 21 | * 22 | * Neither the name of the copyright holders nor the names of its contributors may be used to 23 | * endorse or promote products derived from this software without specific prior written permission. 24 | * 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 26 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 27 | * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 28 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 29 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 31 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR 32 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 33 | * OF SUCH DAMAGE. 34 | */ 35 | #ifndef XMC_RTC_CONF_H 36 | #define XMC_RTC_CONF_H 37 | 38 | #include 39 | 40 | #if defined HAS_RTC 41 | extern XMC_RTC_CONFIG_t XMC_RTC_default_t; 42 | #else 43 | #error XMC Board not supported 44 | #endif 45 | #endif /* XMC_RTC_CONF_H */ 46 | -------------------------------------------------------------------------------- /libraries/SPI/Readme.MD: -------------------------------------------------------------------------------- 1 | # SPI Library for XMC 2 | 3 | This library supports the Serial peripheral interaface communication protocol for the XMC. 4 | 5 | ## Additional Information 6 | See also our [documentation](https://xmc-arduino.readthedocs.io/en/latest/builtin-libraries.html). -------------------------------------------------------------------------------- /libraries/SPI/examples/SPI_MOSI_to_MISO_SameDevice/SPI_MOSI_to_MISO_SameDevice.ino: -------------------------------------------------------------------------------- 1 | #include "SPI.h" 2 | char outByte [20] = "Hello from XMC"; // string to be send and received via SPI port 3 | char inByte; // variable which stores the value of the byte received from SPI bus 4 | int i = 0; 5 | void setup() 6 | { 7 | pinMode(LED1, OUTPUT); // setting the LED pin as output 8 | 9 | Serial.begin(9600); // initializing the serial port at 9600 baud rate 10 | 11 | SPI.begin(); // initialize the SPI port as master 12 | 13 | delay(100); 14 | } 15 | void loop() 16 | { 17 | digitalWrite(LED1, HIGH); 18 | 19 | for(i=0;i<16;i++) 20 | { 21 | inByte = SPI.transfer(outByte[i]); 22 | Serial.write(inByte); 23 | } 24 | 25 | Serial.println(); 26 | delay(100); 27 | 28 | digitalWrite(LED1, LOW); 29 | 30 | delay(1000); 31 | } 32 | -------------------------------------------------------------------------------- /libraries/SPI/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map SPI 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | SPI KEYWORD1 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | begin KEYWORD2 15 | end KEYWORD2 16 | transfer KEYWORD2 17 | setBitOrder KEYWORD2 18 | setDataMode KEYWORD2 19 | setClockDivider KEYWORD2 20 | 21 | 22 | ####################################### 23 | # Constants (LITERAL1) 24 | ####################################### 25 | SPI_CLOCK_DIV4 LITERAL1 26 | SPI_CLOCK_DIV16 LITERAL1 27 | SPI_CLOCK_DIV64 LITERAL1 28 | SPI_CLOCK_DIV128 LITERAL1 29 | SPI_CLOCK_DIV2 LITERAL1 30 | SPI_CLOCK_DIV8 LITERAL1 31 | SPI_CLOCK_DIV32 LITERAL1 32 | SPI_CLOCK_DIV64 LITERAL1 33 | SPI_MODE0 LITERAL1 34 | SPI_MODE1 LITERAL1 35 | SPI_MODE2 LITERAL1 36 | SPI_MODE3 LITERAL1 -------------------------------------------------------------------------------- /libraries/SPI/library.properties: -------------------------------------------------------------------------------- 1 | name=SPI 2 | version=1.3 3 | author=Infineon Technologies AG 4 | maintainer=Infineon Technologies AG 5 | sentence=This library allows you to communicate with SPI for the XMC microcontroller series. 6 | paragraph= . 7 | category=Communication 8 | url=http://www.arduino.cc/en/Reference/SPI 9 | architectures=xmc 10 | 11 | -------------------------------------------------------------------------------- /libraries/Wire/Readme.MD: -------------------------------------------------------------------------------- 1 | # Wire Library for XMC 2 | This library allows you to communicate with I2C/TWI devices. 3 | 4 | ## Additional Information 5 | See also our [documentation](https://xmc-arduino.readthedocs.io/en/latest/builtin-libraries.html). -------------------------------------------------------------------------------- /libraries/Wire/examples/master_reader/master_reader.ino: -------------------------------------------------------------------------------- 1 | // Wire Master Reader 2 | // by Nicholas Zambetti 3 | 4 | // Demonstrates use of the Wire library 5 | // Reads data from an I2C/TWI slave device 6 | // Refer to the "Wire Slave Sender" example for use with this 7 | 8 | // Created 29 March 2006 9 | 10 | // This example code is in the public domain. 11 | 12 | 13 | #include 14 | 15 | void setup() { 16 | Wire.begin(); // join i2c bus (address optional for master) 17 | Serial.begin(9600); // start serial for output 18 | } 19 | 20 | void loop() { 21 | Wire.requestFrom(8, 6); // request 6 bytes from slave device #8 22 | 23 | while (Wire.available()) { // slave may send less than requested 24 | char c = Wire.read(); // receive a byte as character 25 | Serial.print(c); // print the character 26 | } 27 | 28 | delay(500); 29 | } 30 | -------------------------------------------------------------------------------- /libraries/Wire/examples/master_writer/master_writer.ino: -------------------------------------------------------------------------------- 1 | // Wire Master Writer 2 | // by Nicholas Zambetti 3 | 4 | // Demonstrates use of the Wire library 5 | // Writes data to an I2C/TWI slave device 6 | // Refer to the "Wire Slave Receiver" example for use with this 7 | 8 | // Created 29 March 2006 9 | 10 | // This example code is in the public domain. 11 | 12 | 13 | #include 14 | 15 | void setup() { 16 | pinMode(LED2, OUTPUT); 17 | digitalWrite(LED2, LOW); 18 | 19 | Wire.begin(); // join i2c bus (address optional for master) 20 | } 21 | 22 | byte x = 1; 23 | 24 | void loop() { 25 | delay(1000); 26 | Wire.beginTransmission(8); // transmit to device #8 27 | //Wire.write("x is "); // sends five bytes 28 | Wire.write(x); // sends one byte 29 | Wire.endTransmission(); // stop transmitting 30 | 31 | if(x % 2 == 0) 32 | { 33 | digitalWrite(LED2, LOW); 34 | } 35 | else 36 | { 37 | digitalWrite(LED2, HIGH); 38 | } 39 | 40 | x++; 41 | } 42 | -------------------------------------------------------------------------------- /libraries/Wire/examples/slave_receiver/slave_receiver.ino: -------------------------------------------------------------------------------- 1 | // Wire Slave Receiver 2 | // by Nicholas Zambetti 3 | 4 | // Demonstrates use of the Wire library 5 | // Receives data as an I2C/TWI slave device 6 | // Refer to the "Wire Master Writer" example for use with this 7 | 8 | // Created 29 March 2006 9 | 10 | // This example code is in the public domain. 11 | 12 | 13 | #include 14 | 15 | void setup() { 16 | Serial.begin(115200); 17 | pinMode(LED2, OUTPUT); 18 | digitalWrite(LED2, LOW); 19 | delay(500); 20 | Wire.begin(8); // join i2c bus with address #8 21 | Wire.onReceive(receiveEvent); // register event 22 | } 23 | 24 | void loop() { 25 | delay(100); 26 | } 27 | 28 | // function that executes whenever data is received from master 29 | // this function is registered as an event, see setup() 30 | void receiveEvent(int howMany) { 31 | uint8_t x = Wire.read(); // receive byte 32 | if(x % 2 == 0) 33 | { 34 | digitalWrite(LED2, LOW); 35 | } 36 | else 37 | { 38 | digitalWrite(LED2, HIGH); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /libraries/Wire/examples/slave_sender/slave_sender.ino: -------------------------------------------------------------------------------- 1 | // Wire Slave Sender 2 | // by Nicholas Zambetti 3 | 4 | // Demonstrates use of the Wire library 5 | // Sends data as an I2C/TWI slave device 6 | // Refer to the "Wire Master Reader" example for use with this 7 | 8 | // Created 29 March 2006 9 | 10 | // This example code is in the public domain. 11 | 12 | 13 | #include 14 | 15 | void setup() { 16 | Wire.begin(8); // join i2c bus with address #8 17 | Wire.onRequest(requestEvent); // register event 18 | } 19 | 20 | void loop() { 21 | delay(100); 22 | } 23 | 24 | // function that executes whenever data is requested by master 25 | // this function is registered as an event, see setup() 26 | void requestEvent() { 27 | Wire.write("hello "); // respond with message of 6 bytes 28 | // as expected by master 29 | } 30 | -------------------------------------------------------------------------------- /libraries/Wire/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For Wire 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | ####################################### 10 | # Methods and Functions (KEYWORD2) 11 | ####################################### 12 | 13 | begin KEYWORD2 14 | setClock KEYWORD2 15 | beginTransmission KEYWORD2 16 | endTransmission KEYWORD2 17 | requestFrom KEYWORD2 18 | onReceive KEYWORD2 19 | onRequest KEYWORD2 20 | 21 | ####################################### 22 | # Instances (KEYWORD2) 23 | ####################################### 24 | 25 | Wire KEYWORD2 26 | 27 | ####################################### 28 | # Constants (LITERAL1) 29 | ####################################### 30 | 31 | -------------------------------------------------------------------------------- /libraries/Wire/library.properties: -------------------------------------------------------------------------------- 1 | name=Wire 2 | version=1.2 3 | author=Infineon Technologies AG 4 | maintainer=Infineon Technologies AG 5 | sentence=This library allows you to communicate with I2C and Two Wire Interface devices with XMC microcontrollers. 6 | paragraph=It allows the communication with I2C devices like temperature sensors, realtime clocks and many others using SDA (Data Line) and SCL (Clock Line) in combination with the XMC microcontrollers. 7 | category=Communication 8 | url=http://www.arduino.cc/en/Reference/Wire 9 | architectures=xmc 10 | 11 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "framework-arduinoxmc", 3 | "version": "3.1.0", 4 | "description": "Integration of Infineon's XMC microcontrollers with the Arduino framework", 5 | "url": "https://www.infineon.com/cms/en/product/microcontroller/32-bit-industrial-microcontroller-based-on-arm-cortex-m/", 6 | "keywords": [ 7 | "framework", 8 | "arduino", 9 | "infineon" 10 | ], 11 | "repository": { 12 | "type": "git", 13 | "url": "https://github.com/Infineon/XMC-for-Arduino" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /package/config.yml: -------------------------------------------------------------------------------- 1 | package-name: xmc-for-arduino 2 | include: 3 | - cores 4 | - libraries 5 | - tools 6 | - variants 7 | - boards.txt 8 | - keywords.txt 9 | - LICENSE.md 10 | - package.json 11 | - platform.txt 12 | - programmers.txt 13 | - README.md 14 | index-name: package_infineon_index 15 | server: 16 | type: github 17 | owner: Infineon 18 | repo: XMC-for-Arduino -------------------------------------------------------------------------------- /programmers.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2014-2015 Arduino LLC. All right reserved. 2 | # 3 | # This library is free software; you can redistribute it and/or 4 | # modify it under the terms of the GNU Lesser General Public 5 | # License as published by the Free Software Foundation; either 6 | # version 2.1 of the License, or (at your option) any later version. 7 | # 8 | # This library is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 | # See the GNU Lesser General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU Lesser General Public 14 | # License along with this library; if not, write to the Free Software 15 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 16 | 17 | jlink.name=Segger J-Link 18 | jlink.communication=USB 19 | jlink.protocol=jlink.cfg 20 | jlink.program.tool=openocd 21 | jlink.program.tool.default=openocd 22 | jlink.extra_params=-c "transport select swd" 23 | -------------------------------------------------------------------------------- /tests/Makefile.test: -------------------------------------------------------------------------------- 1 | ### Build commands 2 | ### ! Please note that you need to change the port and path of Unity as appropriate ! 3 | 4 | ### Unit tests 5 | 6 | ##CAN 7 | 8 | # 1 board, no wire 9 | make FQBN=arduino-git:xmc:XMC1400_XMC2GO PORT=COM42 UNITY_PATH=\Unity test_can_single monitor 10 | 11 | # 2 boards 12 | make FQBN=arduino-git:xmc:XMC1400_XMC2GO PORT=COM42 UNITY_PATH=\Unity test_can_connected2_node2 monitor 13 | make FQBN=arduino-git:xmc:XMC1400_XMC2GO PORT=COM41 UNITY_PATH=\Unity test_can_connected2_node1 monitor 14 | 15 | 16 | ## IIC 17 | 18 | # 1 board "talking to itself", wire needed 19 | make FQBN=arduino-git:xmc:XMC4700_Relax_Kit PORT=COM28 UNITY_PATH=\Unity test_wire_connected1_pingpong monitor 20 | 21 | # 2 boards 22 | make FQBN=arduino-git:xmc:XMC4700_Relax_Kit PORT=/dev/ttyACM0 test_wire_connected2_masterpingpong monitor 23 | make FQBN=arduino-git:xmc:XMC4700_Relax_Kit PORT=/dev/ttyACM1 test_wire_connected2_slavepingpong monitor 24 | 25 | 26 | ## UART 27 | 28 | # 2 boards 29 | make FQBN=arduino-git:xmc:XMC4700_Relax_Kit PORT=/dev/ttyACM0 test_uart_connected2_tx monitor 30 | make FQBN=arduino-git:xmc:XMC4700_Relax_Kit PORT=/dev/ttyACM1 test_uart_connected2_rx monitor 31 | 32 | DigitalIO 33 | 34 | # 1 boards 35 | 36 | make FQBN=arduino-git:xmc:XMC4700_Relax_Kit PORT=/dev/ttyACM1 UNITY_PATH=\Unity test_digitalio_single monitor 37 | 38 | ## SPI 39 | 40 | # 2 boards 41 | make FQBN=arduino-git:xmc:XMC4700_Relax_Kit PORT=/dev/ttyACM0 test_spi_connected2_master monitor 42 | make FQBN=arduino-git:xmc:XMC4700_Relax_Kit PORT=/dev/ttyACM1 test_spi_connected2_slave monitor 43 | 44 | # 1 board, loopback 45 | make FQBN=arduino-git:xmc:XMC4700_Relax_Kit PORT=/dev/ttyACM0 test_spi_connected1_loopback monitor -------------------------------------------------------------------------------- /tests/hil-unity-checklist.yaml: -------------------------------------------------------------------------------- 1 | Infineon.xmc.XMC4700_Relax_Kit: 2 | CAN: 3 | 1: 4 | - "test_can_connected2_node2" 5 | - "test_can_connected2_node1" 6 | 2: 7 | - "test_can_single" 8 | 9 | Wire: 10 | 1: 11 | - "test_wire_connected2_slavepingpong" 12 | - "test_wire_connected2_masterpingpong" 13 | 2: 14 | - "test_wire_connected1_pingpong" 15 | 16 | Serial: 17 | 1: 18 | - "test_uart_connected2_tx" 19 | - "test_uart_connected2_rx" 20 | 21 | 22 | Infineon.xmc.XMC1400_XMC2GO: 23 | CAN: 24 | 1: 25 | - "test_can_connected2_node2" 26 | - "test_can_connected2_node1" 27 | 2: 28 | - "test_can_single" 29 | 30 | Wire: 31 | 1: 32 | - "test_wire_connected2_slavepingpong" 33 | - "test_wire_connected2_masterpingpong" 34 | 35 | 36 | Infineon.xmc.XMC1100_XMC2GO: 37 | Wire: 38 | 1: 39 | - "test_wire_connected2_slavepingpong" 40 | - "test_wire_connected2_masterpingpong" 41 | -------------------------------------------------------------------------------- /tests/manual/PCLKTest/PCLKTest.ino: -------------------------------------------------------------------------------- 1 | /* PCLK temp variation observations 2 | 3 | Sets PWM Output to 10 kHz 50% PWM to measure accuracy 4 | Reads out Die temp every 10 seconds 5 | 6 | If both LED1 and LED2 are permanently ON then an invalid pin for PWM has been 7 | attempted to be attached to a invalid pin 8 | 9 | Wiring 10 | Default PWM pin are 3 11 | 12 | Some Board variant PWM Pins 13 | XMC1100 Boot Kit 3, 4, 6, 9 14 | XMC1100 XMC2Go 8, 3, 2, 1 15 | XMC1300 Boot Kit 31, 26, 32, 33 16 | XMC4700 Relax 3, 10, 11, 95, 72, 96, 63, 36, 78, 90, 91, 17 | 5, 6, 9, 53, 39, 64, 38, 68, 79, 83, 82, 81 18 | */ 19 | #include 20 | #include 21 | 22 | // For library macro printing 23 | #define str(x) Serial.println( #x ) 24 | #define str1(x) str(x) 25 | 26 | // Adjust the following defines to match your setup 27 | // Pins for Servos and pot 28 | //#define PWM_A_PIN 3 29 | // XMC1300 Boot Kit pins 30 | #define PWM_A_PIN 31 31 | 32 | #define RESOLUTION 16 33 | #define REFRESH_FREQUENCY 10000 34 | #define DUTY_50 32767 35 | 36 | LED Led; /* Create an LED object */ 37 | XMCClass devCtrl; 38 | 39 | int32_t temperature; 40 | 41 | 42 | void setup( ) 43 | { 44 | Led.Add( LED1 ); // Configure the LEDs 45 | Led.Add( LED2 ); 46 | Led.Off( LED1 ); // Set default state of LEDs 47 | Led.Off( LED2 ); 48 | Serial.begin( 115200 ); 49 | delay( 100 ); 50 | Serial.println( "XMC PCLK Temp test" ); 51 | Serial.print( "Running on " ); 52 | str1( XMC_BOARD ); 53 | // dummy read to ensure first value which may be erroneous is ignored 54 | temperature = devCtrl.getTemperature(); 55 | 56 | // Setup the PWM pins 57 | analogWriteResolution( RESOLUTION ); 58 | if( setAnalogWriteFrequency( PWM_A_PIN, REFRESH_FREQUENCY ) < 0 ) 59 | { // Invalid pin trap for non-PWM pin 60 | Led.On( LED1 ); 61 | Led.On( LED2 ); 62 | while( 1 ); // Stick in error loop 63 | } 64 | analogWrite( PWM_A_PIN, DUTY_50 ); // Duty for mid (1500) = 4915 65 | } 66 | 67 | 68 | void loop( ) 69 | { 70 | /* If UC_FAMILY = XMC4 you can also calibrate temperature for finer measurements */ 71 | temperature = devCtrl.getTemperature(); 72 | 73 | Serial.print( "Die Temp:\t" ); 74 | Serial.println( temperature ); 75 | delay( 10000 ); 76 | } 77 | -------------------------------------------------------------------------------- /tests/manual/PWMtest/PWMtest.ino: -------------------------------------------------------------------------------- 1 | /* PWM test (Duty) 2 | Controlling TWO PWM positions using Fixed values 3 | Copyright (c) 2020 Paul Carpenter - PC Services. All right reserved. 4 | 5 | Drive two PWMs for measurement purposes at fixed values 6 | 7 | If both LED1 and LED2 are permanently ON then an invalid pin for PWM has been 8 | attempted to be attached to a invalid pin 9 | 10 | Wiring 11 | Default PWM pins are 3 and 4 12 | 13 | Some Board variant PWM Pins 14 | XMC1100 Boot Kit 3, 4, 6, 9 15 | XMC1100 XMC2Go 8, 3, 2, 1 16 | XMC1300 Boot Kit 31, 26, 32, 33 17 | XMC4700 Relax 3, 10, 11, 95, 72, 96, 63, 36, 78, 90, 91, 18 | 5, 6, 9, 53, 39, 64, 38, 68, 79, 83, 82, 81 19 | */ 20 | #include 21 | 22 | // Adjust the following defines to match your setup 23 | // Pins for Servos and pot 24 | //#define PWM_A_PIN 3 25 | //#define PWM_B_PIN 4 26 | // XMC1300 Boot Kit pins 27 | #define PWM_A_PIN 31 28 | #define PWM_B_PIN 26 29 | 30 | #define RESOLUTION 16 31 | #define REFRESH_FREQUENCY 50 32 | 33 | 34 | LED Led; /* Create an LED object */ 35 | 36 | int val; 37 | 38 | 39 | void setup( ) 40 | { 41 | Led.Add( LED1 ); // Configure the LEDs 42 | Led.Add( LED2 ); 43 | Led.Off( LED1 ); // Set default state of LEDs 44 | Led.Off( LED2 ); 45 | 46 | // Setup the PWM pins to the servo objects 47 | analogWriteResolution( RESOLUTION ); 48 | val = 0; 49 | if( setAnalogWriteFrequency( PWM_A_PIN, REFRESH_FREQUENCY ) < 0 ) 50 | val++; 51 | else 52 | if( setAnalogWriteFrequency( PWM_B_PIN, REFRESH_FREQUENCY ) < 0 ) 53 | val++; 54 | 55 | if( val ) // Invalid pin trap for non-PWM pin 56 | { 57 | Led.On( LED1 ); 58 | Led.On( LED2 ); 59 | while( 1 ); // Stick in error loop 60 | } 61 | 62 | analogWrite( PWM_A_PIN, 4915 ); // Duty for mid (1500) = 4915 63 | analogWrite( PWM_B_PIN, 1782 ); // Duty for Min (544) = 1782 64 | } 65 | 66 | 67 | void loop( ) 68 | { 69 | // Do nothing loop} 70 | -------------------------------------------------------------------------------- /tests/manual/PulseIntest/PulseIntest.ino: -------------------------------------------------------------------------------- 1 | /* PulseIn test 2 | * Requirements 3 | * - External Waveform generator set to produce at least 100 Hz square wave of 4 | * variable duty cycle down to On for a couple of microseconds, max 10ms. 5 | * - Oscilloscope to check timings being measured in software 6 | * - Serial port at 115,200 baud 7 | * - Default pin 4 for the TTL input 8 | * 9 | * Operation 10 | * Configures inputs 11 | * Loops 12 | * Get 10 PulseIn readings to array 13 | * Works out statistics on readings 14 | * Prints on serial port statistics table 15 | * waits 2 seconds 16 | * 17 | * Statistics show Minimum, Maximum, Average measurements (of valid readings) 18 | * Number of valid and timeout readings 19 | * 20 | * Due to asynchronous nature of waveform generator to software the important 21 | * factors to watch on statistics are how many timeouts occur and the average 22 | * reading. In tests using a 100 Hz to 10 kHz frequency average readings were 23 | * noted as being within +/- 1 microsecond from 10 to 50 micros second pulses. 24 | */ 25 | #include 26 | 27 | // Pin to use for input 28 | #define PIN 4 29 | 30 | uint32_t readings[ 10 ]; 31 | uint32_t min, max, avg; 32 | int count, timeouts; 33 | 34 | 35 | void setup() 36 | { 37 | Serial.begin( 115200 ); 38 | 39 | /* Configure pins and ensure trigger is OFF */ 40 | pinMode( PIN, INPUT ); 41 | delay( 50 ); 42 | /* Send signon message */ 43 | Serial.println( "PC Services - PulseIn accuracy test" ); 44 | } 45 | 46 | 47 | void loop() 48 | { 49 | // Reset statistics 50 | min = 100000; 51 | avg = 0; 52 | timeouts = 0; 53 | max = 0; 54 | 55 | // get readings and basic stats 56 | for( count = 0; count < 10; count++ ) 57 | { 58 | readings[ count ] = pulseIn( PIN, HIGH, 12000 ); 59 | if( readings[ count ] == 0 ) 60 | timeouts++; 61 | else 62 | { 63 | if( readings[ count ] < min ) 64 | min = readings[ count ]; 65 | if( readings[ count ] > max ) 66 | max = readings[ count ]; 67 | } 68 | } 69 | 70 | // Calculate statistics for non-timeout readings 71 | for( count = 0; count < 10; count++ ) 72 | if( readings[ count ] ) 73 | avg += readings[ count ]; 74 | avg /= 10 - timeouts; 75 | 76 | // display statistics 77 | Serial.print( "\nValid Readings\t" ); 78 | Serial.println( 10 - timeouts ); 79 | Serial.print( "Timeouts\t" ); 80 | Serial.println( timeouts ); 81 | Serial.print( "Minimum\t\t" ); 82 | Serial.println( min ); 83 | Serial.print( "Maximum\t\t" ); 84 | Serial.println( max ); 85 | Serial.print( "Valid Average\t" ); 86 | Serial.println( avg ); 87 | 88 | // Pause before next set 89 | delay( 2000 ); 90 | } 91 | -------------------------------------------------------------------------------- /tests/manual/Servotest/Servotest.ino: -------------------------------------------------------------------------------- 1 | /* Knob to 2 channels RC Servo (time) Demo - XMC_Servo 2 | Controlling TWO servo positions using a potentiometer (variable resistor) 3 | Copyright (c) 2020 Paul Carpenter - PC Services. All right reserved. 4 | 5 | Repeat at 10 Hz (10 times a second) 6 | One pot is read, and two Servos controlled anti-phase by time control 7 | ServoA is driven direct value mapped from pot 600-2400 8 | ServoB is driven as reversed angle 2400-600 9 | PWM output will continue between updates 10 | 11 | LED1 the Built-in LED is used when Pot is at centre position (1490-1510 microseconds) The LED 12 | is turned ON. 13 | 14 | If both LED1 and LED2 are permanently ON then an invalid pin for PWM has been 15 | attempted to be attached to a Servo class 16 | 17 | Wiring 18 | Pot is connected to analogue input A1 19 | (XMC1300 Boot Kit has on-board pot on this pin) 20 | Default PWM pins are 3 and 4 21 | 22 | Some Board variant PWM Pins 23 | XMC1100 Boot Kit 3, 4, 6, 9 24 | XMC1100 XMC2Go 8, 3, 2, 1 25 | XMC1300 Boot Kit 31, 26, 32, 33 26 | XMC4700 Relax 3, 10, 11, 95, 72, 96, 63, 36, 78, 90, 91, 27 | 5, 6, 9, 53, 39, 64, 38, 68, 79, 83, 82, 81 28 | */ 29 | #include 30 | #include 31 | 32 | // Adjust the following defines to match your setup 33 | // Pins for Servos and pot 34 | //#define SERVO_A_PIN 3 35 | //#define SERVO_B_PIN 4 36 | #define SERVO_A_PIN 31 37 | #define SERVO_B_PIN 26 38 | #define POT_PIN A1 39 | 40 | #define MIN_TIME 600 41 | #define MAX_TIME 2400 42 | 43 | Servo ServoA; 44 | Servo ServoB; 45 | 46 | /* Create an LED object */ 47 | LED Led; 48 | 49 | int val; // the analogue pin value 50 | 51 | 52 | void setup( ) 53 | { 54 | Led.Add( LED1 ); // Configure the LEDs 55 | Led.Off( LED1 ); // Set default state of LEDs 56 | Led.Add( LED2 ); 57 | Led.Off( LED2 ); 58 | 59 | // attaches the PWM pins to the servo objects 60 | val = 0; 61 | if( (ServoA.attach( SERVO_A_PIN ) ) == INVALID_SERVO ) 62 | val++; 63 | else 64 | if( (ServoB.attach( SERVO_B_PIN ) ) == INVALID_SERVO ) 65 | val++; 66 | 67 | if( val ) // Invalid pin trap 68 | { 69 | Led.On( LED1 ); 70 | Led.On( LED2 ); 71 | while( 1 ); // Stick in error loop 72 | } 73 | ServoA.writeMicroseconds( 1500 ); 74 | ServoB.writeMicroseconds( 1500 ); 75 | } 76 | 77 | 78 | void loop( ) 79 | { 80 | val = analogRead( POT_PIN ); // reads potentiometer (value 0 - 1023) 81 | val = map( val, 0, getAnalogReadMaximum(), MIN_TIME, MAX_TIME ); // scale to time us 82 | 83 | if( val >= 1490 && val <= 1510 ) // When 1490 to 1510 microseconds light LED 84 | { 85 | Led.On( LED1 ); 86 | val = 1500; 87 | } 88 | else 89 | Led.Off( LED1 ); 90 | 91 | //ServoA.writeMicroseconds( val ); // sets servo position to scaled value 92 | //ServoB.writeMicroseconds( MAX_TIME - val + MIN_TIME );// sets servo position to Reversed scaled value 93 | 94 | delay( 100 ); 95 | } 96 | -------------------------------------------------------------------------------- /tests/manual/analogwritetest/analogwritetest.ino: -------------------------------------------------------------------------------- 1 | /* Test analogwrite functions for any board 2 | 3 | If used prints signon message to serial port at 115200 baud 4 | Including board run on 5 | 6 | Uses available PWM Pin outputs and outputs 'tones' of 7 | 8 | 32 Hz 9 | 64 Hz 10 | 96 Hz 11 | 128 Hz 12 | 13 | First one only all boards, remainder on all supported boards with 4 PWM outputs 14 | */ 15 | // Print defines values as strings macros 16 | #define str(x) Serial.print( #x ) 17 | #define str1(x) str(x) 18 | 19 | 20 | void setup() { 21 | #if defined ( XMC1100_XMC2GO ) 22 | analogWrite( 8, 32 ); // all PWM4 23 | analogWrite( 1, 64 ); 24 | analogWrite( 2, 96 ); 25 | analogWrite( 3, 128 ); 26 | #endif 27 | #if defined ( XMC1100_H_BRIDGE2GO ) 28 | analogWrite( 8, 32 ); // PWM4 29 | #endif 30 | #if defined ( XMC1100_Boot_Kit ) || defined ( XMC1400_Boot_Kit ) || defined ( XMC1300_Sense2GoL ) 31 | // XMC1100 Boot Kit or XMC1400 Boot Kit or XMC1300 Sense2GoL 32 | analogWrite( 3, 32 ); // all PWM4 33 | analogWrite( 4, 64 ); 34 | analogWrite( 6, 96 ); 35 | analogWrite( 9, 128 ); 36 | #endif 37 | #if defined ( XMC1300_Boot_Kit ) 38 | // XMC1300 Boot Kit 39 | analogWrite( 31, 32 ); // PWM4 40 | analogWrite( 26, 64 ); 41 | analogWrite( 32, 96 ); // PWM8 42 | analogWrite( 33, 128 ); 43 | #endif 44 | #if defined ( XMC4700_Relax_Kit ) || defined( XMC4700_Radar_Baseboard ) 45 | analogWrite( 3, 32 ); // PWM4 46 | analogWrite( 5, 64 ); // PWM8 rest relax kit only 47 | analogWrite( 6, 96 ); 48 | analogWrite( 9, 128 ); 49 | #endif 50 | delay( 100 ); 51 | Serial.begin( 115200, SERIAL_8N1 ); 52 | Serial.println( "PC Services analogWrite Test" ); 53 | Serial.print( "Configured for XMC" ); 54 | str1( ARDUINO ); 55 | Serial.print( "\tBoard Name: " ); 56 | str1( XMC_BOARD ); 57 | } 58 | 59 | void loop() { 60 | } 61 | -------------------------------------------------------------------------------- /tests/manual/delaytest/delaytest.ino: -------------------------------------------------------------------------------- 1 | #include "Arduino.h" 2 | 3 | #define MIN_MICROS 10 4 | #define MAX_MICROS 150 5 | int i; 6 | uint32_t old_time, new_time, calltime; 7 | 8 | 9 | void setup( ) 10 | { 11 | delay( 100 ); 12 | Serial.begin( 115200, SERIAL_8N1 ); 13 | Serial.println( "Time tests for microsecond delays" ); 14 | Serial.println( "Delay\tOld\t\tNew\t\tDifference" ); 15 | i = MIN_MICROS; 16 | delay( 200 ); 17 | } 18 | 19 | void loop() 20 | { 21 | old_time = micros(); 22 | delayMicroseconds( i ); 23 | new_time = micros(); 24 | Serial.print( i ); 25 | Serial.write( '\t' ); 26 | Serial.print( old_time ); 27 | Serial.write( '\t' ); 28 | Serial.print( new_time ); 29 | Serial.write( '\t' ); 30 | Serial.println( new_time - old_time ); 31 | if( ++i >= MAX_MICROS ) 32 | { 33 | i = MIN_MICROS; 34 | delay( 5000 ); 35 | } 36 | else 37 | // pause between outputs 38 | delay( 5 ); 39 | } 40 | -------------------------------------------------------------------------------- /tests/manual/tonetest/tonetest.ino: -------------------------------------------------------------------------------- 1 | /* tonetest sketch tests wiring_time implementation 2 | 3 | Tests that the timing scheduler can handle multiple events at different 4 | timing intervals. 5 | 6 | The main ones it tests are as many pins to have tones on as possible 7 | by toggling on-board LEDs at different frequencies and using the delay (in ms) 8 | function that is also used by the same timed task scheduler. Uses as many LEDs 9 | as possible within the constraints of that board (unless used for RX and TX signals) 10 | 11 | Assumes board has at LEAST TWO LEDs compiler error for NO LEDs or TONE PINS 12 | available 13 | 14 | Main uses for timed task scheduling at 1 ms resolution are 15 | delay() function to wait for ms time interval 16 | tone() setup burst or continuous tone on a GPIO pin 17 | BGT24LTR11_CYCLE_TIMER_IRQ Handler scheduled task for radar sampling 18 | 19 | Author: Paul Carpenter, PC Services 20 | Version 2 Update for more XMC_BOARD types and more LEDs used 21 | Version 3 Updated to bring in line with correct XMC_BOARD usage as per PR 22 | */ 23 | 24 | #include 25 | 26 | #if NUM_TONE_PINS < 2 27 | #error Not enough Tone Pins available on this board 28 | #endif 29 | #if NUM_LEDS < 2 30 | #error Not enough LEDs available on this board to run this test 31 | #endif 32 | 33 | // External variables for stats printing 34 | extern uint8_t tone_pins[ NUM_TONE_PINS ]; 35 | extern volatile long timer_toggle_count[ NUM_TONE_PINS ]; 36 | extern int (* tasks[])( int, int ); 37 | extern struct TaskList taskTable[ ]; 38 | 39 | void printstats( ) 40 | { 41 | Serial.println( "pin\tid\tCount" ); 42 | for( int i = 0; i < NUM_TONE_PINS; i++ ) 43 | { 44 | Serial.print( tone_pins[ i ] ); 45 | Serial.print( "\t" ); 46 | Serial.print( i ); 47 | Serial.print( "\t" ); 48 | Serial.println( timer_toggle_count[ i ] ); 49 | } 50 | Serial.println( "ID\tnext\tInterval Status\tParam\tfunction" ); 51 | for( int i = 0; i < NUM_TONE_PINS+1; i++ ) 52 | { 53 | Serial.print( i ); 54 | Serial.print( "\t" ); 55 | Serial.print( taskTable[ i ].next ); 56 | Serial.print( "\t" ); 57 | Serial.print( taskTable[ i ].interval ); 58 | Serial.print( "\t" ); 59 | Serial.print( taskTable[ i ].status ); 60 | Serial.print( "\t" ); 61 | Serial.print( taskTable[ i ].param ); 62 | Serial.print( "\t" ); 63 | Serial.println( (uint32_t)tasks[ i ], HEX ); 64 | } 65 | } 66 | 67 | void setup() 68 | { 69 | Serial.begin( 115200 ); 70 | Serial.println( "PC Services Tone Test V2" ); 71 | tone( LED1, 1 ); 72 | tone( LED2, 2, 20000 ); 73 | 74 | #if defined( XMC1100_Boot_Kit ) || defined( XMC1300_Boot_Kit ) 75 | tone( LED5, 4, 1000 ); 76 | tone( LED6, 8, 6000 ); 77 | #elif defined( XMC1300_Sense2GoL ) 78 | tone( LED3, 4, 1000 ); 79 | #endif 80 | 81 | printstats(); 82 | } 83 | 84 | void loop() 85 | { 86 | delay( 2000 ); 87 | printstats(); 88 | } 89 | -------------------------------------------------------------------------------- /tests/manual/ulong_test/ulong_test.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | unsigned long old, newt, diff; 5 | int i; 6 | 7 | void setup() { 8 | newt = micros(); 9 | delay(60); 10 | Serial.begin( 115200); 11 | diff = ULONG_MAX; 12 | old = diff; 13 | 14 | Serial.println( "PC Services ulong test" ); 15 | Serial.print( "Microseconds to setup routine = " ); 16 | Serial.println( newt, DEC ); 17 | Serial.print( "Total milliseconds = " ); 18 | Serial.print( diff, DEC ); 19 | diff /= ( 60000 * 60 * 24 ); // days 20 | newt = old - ( diff * 60000 * 60 * 24 ); // days fraction 21 | old = newt / ( 60000 * 60 ); // hours 22 | Serial.print( "\nIn " ); 23 | Serial.print( diff, DEC ); 24 | Serial.print( " days " ); 25 | Serial.print( old, DEC ); 26 | Serial.print( " hours " ); 27 | newt -= ( old * 60000 * 60 ); // hours fraction 28 | old = newt / 60000; // minutes 29 | diff = newt - (old * 60000 ); //miutes fraction 30 | newt = diff / 1000; // seconds 31 | i = diff - (newt * 1000 ); 32 | Serial.print( old, DEC ); 33 | Serial.print( " minutes " ); 34 | Serial.print( newt, DEC ); 35 | Serial.print( " seconds " ); 36 | Serial.print( i, DEC ); 37 | Serial.println( " milliseconds " ); 38 | 39 | old = ULONG_MAX - 5; 40 | newt = old; 41 | for( i = 0; i < 20; i++, newt++ ) 42 | { 43 | Serial.print( " Old = " ); 44 | Serial.print( old, HEX ); 45 | Serial.print( "\tnew = " ); 46 | Serial.print( newt, HEX ); 47 | Serial.print( "\tdiff = " ); 48 | diff = newt - old; 49 | Serial.println( diff, DEC ); 50 | } 51 | } 52 | 53 | void loop() { 54 | // do nothing 55 | } 56 | -------------------------------------------------------------------------------- /tests/test_config.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file test_config.h 3 | * @brief Configuration file for board-specific test pin definitions. 4 | * 5 | * This header file contains the definitions of the pins used for testing 6 | * purposes on the specific board. These pins are configured as output and 7 | * input pins for various test scenarios. 8 | * 9 | * Used Board: XMC4700 10 | */ 11 | #ifndef TEST_CONFIG_H 12 | #define TEST_CONFIG_H 13 | 14 | #include 15 | 16 | // test defines 17 | const uint8_t TEST_DIGITALIO_OUTPUT = 7; // IO0 18 | const uint8_t TEST_DIGITALIO_INPUT = 8; // IO1 19 | 20 | #endif // TEST_CONFIG_H -------------------------------------------------------------------------------- /tools/ci.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if which nproc > /dev/null; then 4 | MAKEOPTS="-j$(nproc)" 5 | else 6 | MAKEOPTS="-j$(sysctl -n hw.ncpu)" 7 | fi 8 | 9 | # Ensure known OPEN_MAX (NO_FILES) limit. 10 | ulimit -n 1024 11 | 12 | ######################################################################################## 13 | # commit formatting 14 | 15 | function ci_commit_formatting_run { 16 | git remote add upstream https://github.com/Infineon/XMC-for-Arduino.git 17 | git fetch --depth=100 upstream master 18 | # If the common ancestor commit hasn't been found, fetch more. 19 | git merge-base upstream/master HEAD || git fetch upstream master 20 | # For a PR, upstream/master..HEAD ends with a merge commit into master, exclude that one. 21 | python tools/verifygitlog.py -v upstream/master..HEAD --no-merges 22 | } 23 | 24 | -------------------------------------------------------------------------------- /tools/xmc_data.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | xmc_master_data = { 4 | "XMC1100-0064":{ 5 | "IDCHIP":{ 6 | "addr":"40010004", 7 | "size":"4", 8 | "value":"00011000", 9 | "mask":"FFFFF000" 10 | }, 11 | "FLSIZE":{ 12 | "addr":"40000404", 13 | "size": "4", 14 | "bitposition_MSB":"17", 15 | "bitposition_LSB":"12" 16 | } 17 | }, 18 | "XMC1100-0032":{ 19 | "IDCHIP":{ 20 | "addr":"40010004", 21 | "size":"4", 22 | "value":"00011000", 23 | "mask":"FFFFF000" 24 | }, 25 | "FLSIZE":{ 26 | "addr":"40000404", 27 | "size": "4", 28 | "bitposition_MSB":"17", 29 | "bitposition_LSB":"12" 30 | } 31 | }, 32 | "XMC1302-0200":{ 33 | "IDCHIP":{ 34 | "addr":"40010004", 35 | "size":"4", 36 | "value":"00013000", 37 | "mask":"FFFFF000" 38 | }, 39 | "FLSIZE":{ 40 | "addr":"40000404", 41 | "size": "4", 42 | "bitposition_MSB":"17", 43 | "bitposition_LSB":"12" 44 | } 45 | }, 46 | "XMC1402-0200":{ 47 | "IDCHIP":{ 48 | "addr":"40010004", 49 | "size":"4", 50 | "value":"00014010", 51 | "mask":"000FFFF0" 52 | }, 53 | "FLSIZE":{ 54 | "addr":"40000404", 55 | "size": "4", 56 | "bitposition_MSB":"17", 57 | "bitposition_LSB":"12" 58 | } 59 | }, 60 | "XMC1404-0200":{ 61 | "IDCHIP":{ 62 | "addr":"40010004", 63 | "size":"4", 64 | "value":"00014040", 65 | "mask":"000FFFF0" 66 | }, 67 | "FLSIZE":{ 68 | "addr":"40000404", 69 | "size": "4", 70 | "bitposition_MSB":"17", 71 | "bitposition_LSB":"12" 72 | } 73 | }, 74 | "XMC4200-256":{ 75 | "IDCHIP":{ 76 | "addr":"50004004", 77 | "size":"4", 78 | "value":"00042000", 79 | "mask":"FFFFF000" 80 | }, 81 | "FLASH0_ID":{ 82 | "addr":"58002008", 83 | "size":"4", 84 | "value":"009C0000", 85 | "mask":"00FF0000" 86 | } 87 | }, 88 | "XMC4400-512":{ 89 | "IDCHIP":{ 90 | "addr":"50004004", 91 | "size":"4", 92 | "value":"00044000", 93 | "mask":"FFFFF000" 94 | }, 95 | "FLASH0_ID":{ 96 | "addr":"58002008", 97 | "size":"4", 98 | "value":"009F0000", 99 | "mask":"00FF0000" 100 | } 101 | }, 102 | "XMC4700-2048":{ 103 | "IDCHIP":{ 104 | "addr":"50004004", 105 | "size":"4", 106 | "value":"00047000", 107 | "mask":"FFFFF000" 108 | }, 109 | "FLASH0_ID":{ 110 | "addr":"58002008", 111 | "size":"4", 112 | "value":"00920000", 113 | "mask":"00FF0000" 114 | } 115 | } 116 | } -------------------------------------------------------------------------------- /variants/XMC1100/XMC1000_RomFunctionTable.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Infineon/XMC-for-Arduino/73fcadf1f0bd7379eaaa3b081ed7d5a06b3b0293/variants/XMC1100/XMC1000_RomFunctionTable.h -------------------------------------------------------------------------------- /variants/XMC1300/XMC1000_RomFunctionTable.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Infineon/XMC-for-Arduino/73fcadf1f0bd7379eaaa3b081ed7d5a06b3b0293/variants/XMC1300/XMC1000_RomFunctionTable.h --------------------------------------------------------------------------------