├── .gitignore ├── README.md ├── boards.txt ├── cores └── arduino │ ├── Arduino.h │ ├── CDC.cpp │ ├── Callback.cpp │ ├── Callback.h │ ├── Client.h │ ├── FS.cpp │ ├── FS.h │ ├── HardwareSerial.cpp │ ├── HardwareSerial.h │ ├── HardwareSerial1.cpp │ ├── HardwareSerial2.cpp │ ├── HardwareSerial3.cpp │ ├── IPAddress.cpp │ ├── IPAddress.h │ ├── Makefile │ ├── Print.cpp │ ├── Print.h │ ├── Printable.h │ ├── RingBuffer.cpp │ ├── RingBuffer.h │ ├── Server.h │ ├── Stream.cpp │ ├── Stream.h │ ├── Tone.cpp │ ├── Tone.h │ ├── USBAPI.h │ ├── USBCore.cpp │ ├── Uart.cpp │ ├── Uart.h │ ├── Udp.h │ ├── WCharacter.h │ ├── WInterrupts.c │ ├── WInterrupts.h │ ├── WMath.cpp │ ├── WMath.h │ ├── WString.cpp │ ├── WString.h │ ├── WVariant.h │ ├── abi.cpp │ ├── avr │ ├── dtostrf.c │ ├── dtostrf.h │ ├── eeprom.c │ ├── eeprom.h │ ├── fdevopen.c │ ├── interrupt.h │ ├── io.h │ └── pgmspace.h │ ├── binary.h │ ├── delay.c │ ├── delay.h │ ├── hooks.c │ ├── itoa.c │ ├── itoa.h │ ├── main.cpp │ ├── new.cpp │ ├── syscalls_stm32l0.c │ ├── wiring.c │ ├── wiring.h │ ├── wiring_analog.c │ ├── wiring_analog.h │ ├── wiring_constants.h │ ├── wiring_digital.c │ ├── wiring_digital.h │ ├── wiring_private.h │ ├── wiring_pulse.c │ ├── wiring_pulse.h │ ├── wiring_shift.c │ └── wiring_shift.h ├── drivers ├── linux │ ├── 49-cicada.rules │ ├── 49-cricket.rules │ ├── 49-gnat.rules │ ├── 49-grasshopper.rules │ └── 49-nucleo.rules └── windows │ ├── cicada-cdc-acm.inf │ ├── cricket-cdc-acm.inf │ ├── dpinst.xml │ ├── dpinst_amd64.exe │ ├── dpinst_x86.exe │ ├── gnat-cdc-acm.inf │ └── grasshopper-cdc-acm.inf ├── libraries ├── CayenneLPP │ ├── examples │ │ └── CayenneLPP_GNSS │ │ │ └── CayenneLPP_GNSS.ino │ ├── keywords.txt │ ├── library.properties │ └── src │ │ ├── CayenneLPP.cpp │ │ └── CayenneLPP.h ├── DOSFS │ ├── examples │ │ ├── DOSFS_DataLogger │ │ │ └── DOSFS_DataLogger.ino │ │ ├── DOSFS_Directories │ │ │ └── DOSFS_Directories.ino │ │ ├── DOSFS_Files │ │ │ └── DOSFS_Files.ino │ │ └── DOSFS_ReadWrite │ │ │ └── DOSFS_ReadWrite.ino │ ├── keywords.txt │ ├── library.properties │ └── src │ │ ├── DOSFS.cpp │ │ └── DOSFS.h ├── EEPROM │ ├── examples │ │ ├── eeprom_clear │ │ │ └── eeprom_clear.ino │ │ ├── eeprom_crc │ │ │ └── eeprom_crc.ino │ │ ├── eeprom_get │ │ │ └── eeprom_get.ino │ │ ├── eeprom_iteration │ │ │ └── eeprom_iteration.ino │ │ ├── eeprom_put │ │ │ └── eeprom_put.ino │ │ ├── eeprom_read │ │ │ └── eeprom_read.ino │ │ ├── eeprom_update │ │ │ └── eeprom_update.ino │ │ └── eeprom_write │ │ │ └── eeprom_write.ino │ ├── keywords.txt │ ├── library.properties │ └── src │ │ └── EEPROM.h ├── FskRadio │ ├── examples │ │ ├── Fsk_AddressFiltering │ │ │ └── Fsk_AddressFiltering.ino │ │ ├── Fsk_Callbacks │ │ │ └── Fsk_Callback.ino │ │ ├── Fsk_FixedPayload │ │ │ └── Fsk_FixedPayload.ino │ │ ├── Fsk_PingPong │ │ │ └── Fsk_PingPong.ino │ │ └── Fsk_Sense │ │ │ └── Fsk_Sense.ino │ ├── keywords.txt │ ├── library.properties │ └── src │ │ ├── FskRadio.cpp │ │ └── FskRadio.h ├── GNSS │ ├── examples │ │ ├── GNSS_external │ │ │ └── GNSS_external.ino │ │ ├── GNSS_periodic │ │ │ └── GNSS_periodic.ino │ │ ├── GNSS_suspend │ │ │ └── GNSS_suspend.ino │ │ └── GPS │ │ │ └── GPS.ino │ ├── keywords.txt │ ├── library.properties │ └── src │ │ ├── GNSS.cpp │ │ ├── GNSS.h │ │ └── utility │ │ ├── gnss_api.h │ │ └── gnss_core.c ├── LoRaRadio │ ├── examples │ │ ├── LoRa_Callbacks │ │ │ └── LoRa_Callbacks.ino │ │ ├── LoRa_FixedPayload │ │ │ └── LoRa_FixedPayload.ino │ │ ├── LoRa_PingPong │ │ │ └── LoRa_PingPong.ino │ │ └── LoRa_Sense │ │ │ └── LoRa_Sense.ino │ ├── keywords.txt │ ├── library.properties │ └── src │ │ ├── LoRaRadio.cpp │ │ └── LoRaRadio.h ├── LoRaWAN │ ├── examples │ │ ├── LoRaWAN_ADR_Disable │ │ │ └── LoRaWAN_ADR_Disable.ino │ │ ├── LoRaWAN_BatteryLevel │ │ │ └── LoRaWAN_BatteryLevel.ino │ │ ├── LoRaWAN_Callbacks │ │ │ └── LoRaWAN_Callbacks.ino │ │ ├── LoRaWAN_Confirmed │ │ │ └── LoRaWAN_Confirmed.ino │ │ ├── LoRaWAN_DeepSleep │ │ │ └── LoRaWAN_DeepSleep.ino │ │ ├── LoRaWAN_Disconnect │ │ │ └── LoRaWAN_Disconnect.ino │ │ ├── LoRaWAN_Join_ABP │ │ │ └── LoRaWAN_Join_ABP.ino │ │ ├── LoRaWAN_Join_Commissioning │ │ │ └── LoRaWAN_Join_Commissioning.ino │ │ ├── LoRaWAN_Join_OTAA │ │ │ └── LoRaWAN_Join_OTAA.ino │ │ ├── LoRaWAN_Save_Commissioning │ │ │ └── LoRaWAN_Save_Commissioning.ino │ │ ├── LoRaWAN_Save_Session │ │ │ └── LoRaWAN_Save_Session.ino │ │ ├── LoRaWAN_TTN_ABP │ │ │ └── LoRaWAN_TTN_ABP.ino │ │ ├── LoRaWAN_TTN_OTAA │ │ │ └── LoRaWAN_TTN_OTAA.ino │ │ └── LoRaWAN_TimerMillis │ │ │ └── LoRaWAN_TimerMillis.ino │ ├── keywords.txt │ ├── library.properties │ └── src │ │ ├── LoRaWAN.cpp │ │ └── LoRaWAN.h ├── RTC │ ├── examples │ │ ├── Epoch │ │ │ └── Epoch.ino │ │ ├── SimpleRTC │ │ │ └── SimpleRTC.ino │ │ └── SimpleRTCAlarm │ │ │ └── SimpleRTCAlarm.ino │ ├── keywords.txt │ ├── library.properties │ └── src │ │ ├── RTC.cpp │ │ └── RTC.h ├── SPI │ ├── examples │ │ ├── BarometricPressureSensor │ │ │ └── BarometricPressureSensor.ino │ │ └── DigitalPotControl │ │ │ └── DigitalPotControl.ino │ ├── keywords.txt │ ├── library.properties │ └── src │ │ ├── SPI.cpp │ │ └── SPI.h ├── STM32L0 │ ├── keywords.txt │ ├── library.properties │ └── src │ │ ├── STM32L0.cpp │ │ └── STM32L0.h ├── TimerMillis │ ├── examples │ │ └── TimerMillis_Blink │ │ │ └── TimerMillis_Blink.ino │ ├── keywords.txt │ ├── library.properties │ └── src │ │ ├── TimerMillis.cpp │ │ └── TimerMillis.h └── Wire │ ├── examples │ ├── Wire_Extended │ │ └── Wire_Extended.ino │ ├── Wire_Interrupt │ │ └── Wire_Interrupt.ino │ ├── Wire_Master │ │ └── Wire_Master.ino │ ├── Wire_Poll │ │ └── Wire_Poll.ino │ ├── Wire_Simple │ │ └── Wire_Simple.ino │ ├── Wire_Slave │ │ └── Wire_Slave.ino │ ├── Wire_TimerMillis │ │ └── Wire_TimerMillis.ino │ └── Wire_Transfer │ │ └── Wire_Transfer.ino │ ├── keywords.txt │ ├── library.properties │ └── src │ ├── Wire.cpp │ └── Wire.h ├── platform.txt ├── programmers.txt ├── system ├── CMSIS │ ├── Device │ │ └── ST │ │ │ └── STM32L0xx │ │ │ └── Include │ │ │ ├── stm32l011xx.h │ │ │ ├── stm32l021xx.h │ │ │ ├── stm32l031xx.h │ │ │ ├── stm32l041xx.h │ │ │ ├── stm32l051xx.h │ │ │ ├── stm32l052xx.h │ │ │ ├── stm32l053xx.h │ │ │ ├── stm32l061xx.h │ │ │ ├── stm32l062xx.h │ │ │ ├── stm32l063xx.h │ │ │ ├── stm32l071xx.h │ │ │ ├── stm32l072xx.h │ │ │ ├── stm32l073xx.h │ │ │ ├── stm32l081xx.h │ │ │ ├── stm32l082xx.h │ │ │ ├── stm32l083xx.h │ │ │ ├── stm32l0xx.h │ │ │ └── system_stm32l0xx.h │ ├── Include │ │ ├── arm_common_tables.h │ │ ├── arm_const_structs.h │ │ ├── arm_math.h │ │ ├── cmsis_armcc.h │ │ ├── cmsis_armcc_V6.h │ │ ├── cmsis_gcc.h │ │ ├── core_cm0.h │ │ ├── core_cm0plus.h │ │ ├── core_cm3.h │ │ ├── core_cm4.h │ │ ├── core_cm7.h │ │ ├── core_cmFunc.h │ │ ├── core_cmInstr.h │ │ ├── core_cmSimd.h │ │ ├── core_sc000.h │ │ └── core_sc300.h │ └── Lib │ │ ├── libarm_cortexM0l_math.a │ │ └── license.txt └── STM32L0xx │ ├── Include │ ├── LoRaMac.h │ ├── LoRaMacTest.h │ ├── armv6m.h │ ├── armv6m_atomic.h │ ├── armv6m_core.h │ ├── armv6m_pendsv.h │ ├── armv6m_svcall.h │ ├── armv6m_systick.h │ ├── armv6m_work.h │ ├── dosfs_api.h │ ├── dosfs_config.h │ ├── dosfs_core.h │ ├── dosfs_device.h │ ├── dosfs_sflash.h │ ├── dosfs_storage.h │ ├── stm32l0_adc.h │ ├── stm32l0_aes.h │ ├── stm32l0_comp.h │ ├── stm32l0_dac.h │ ├── stm32l0_dma.h │ ├── stm32l0_eeprom.h │ ├── stm32l0_exti.h │ ├── stm32l0_flash.h │ ├── stm32l0_gpio.h │ ├── stm32l0_i2c.h │ ├── stm32l0_iwdg.h │ ├── stm32l0_lptim.h │ ├── stm32l0_random.h │ ├── stm32l0_rtc.h │ ├── stm32l0_sdspi.h │ ├── stm32l0_servo.h │ ├── stm32l0_sfspi.h │ ├── stm32l0_spi.h │ ├── stm32l0_system.h │ ├── stm32l0_timer.h │ ├── stm32l0_uart.h │ ├── stm32l0_usbd_cdc.h │ ├── stm32l0_usbd_class.h │ └── stm32l0_usbd_msc.h │ ├── Lib │ ├── libstm32l052xx.a │ ├── libstm32l072xx.a │ └── libstm32l082xx.a │ └── Source │ ├── LoRa │ ├── Boards │ │ ├── cmwx1zzabz-board.c │ │ ├── sx1272-board.h │ │ ├── sx1272mb2das-board.c │ │ ├── sx1276-board.h │ │ └── wmsgsm42-board.c │ ├── Crypto │ │ ├── aes.c │ │ ├── aes.h │ │ ├── cmac.c │ │ └── cmac.h │ ├── Mac │ │ ├── LoRaMac.c │ │ ├── LoRaMacCrypto.c │ │ ├── LoRaMacCrypto.h │ │ └── region │ │ │ ├── Region.h │ │ │ ├── RegionAS923.c │ │ │ ├── RegionAS923.h │ │ │ ├── RegionAU915.c │ │ │ ├── RegionAU915.h │ │ │ ├── RegionCN470.c │ │ │ ├── RegionCN470.h │ │ │ ├── RegionCN779.c │ │ │ ├── RegionCN779.h │ │ │ ├── RegionCommon.c │ │ │ ├── RegionCommon.h │ │ │ ├── RegionEU433.c │ │ │ ├── RegionEU433.h │ │ │ ├── RegionEU868.c │ │ │ ├── RegionEU868.h │ │ │ ├── RegionIN865.c │ │ │ ├── RegionIN865.h │ │ │ ├── RegionKR920.c │ │ │ ├── RegionKR920.h │ │ │ ├── RegionUS915.c │ │ │ └── RegionUS915.h │ ├── Radio │ │ ├── radio.c │ │ ├── radio.h │ │ ├── sx1272 │ │ │ ├── sx1272.c │ │ │ ├── sx1272.h │ │ │ ├── sx1272Regs-Fsk.h │ │ │ └── sx1272Regs-LoRa.h │ │ └── sx1276 │ │ │ ├── sx1276.c │ │ │ ├── sx1276.h │ │ │ ├── sx1276Regs-Fsk.h │ │ │ └── sx1276Regs-LoRa.h │ ├── System │ │ ├── timer.c │ │ └── timer.h │ └── Utilities │ │ ├── utilities.c │ │ └── utilities.h │ ├── Makefile │ ├── USB │ ├── Core │ │ ├── Inc │ │ │ ├── usbd_core.h │ │ │ ├── usbd_ctlreq.h │ │ │ ├── usbd_def.h │ │ │ └── usbd_ioreq.h │ │ └── Src │ │ │ ├── usbd_core.c │ │ │ ├── usbd_ctlreq.c │ │ │ └── usbd_ioreq.c │ ├── HAL │ │ ├── Inc │ │ │ ├── Legacy │ │ │ │ └── stm32_hal_legacy.h │ │ │ ├── stm32l0xx_hal.h │ │ │ ├── stm32l0xx_hal_conf.h │ │ │ ├── stm32l0xx_hal_def.h │ │ │ ├── stm32l0xx_hal_pcd.h │ │ │ ├── stm32l0xx_hal_pcd_ex.h │ │ │ ├── stm32l0xx_hal_pwr.h │ │ │ ├── stm32l0xx_hal_pwr_ex.h │ │ │ ├── stm32l0xx_hal_rcc.h │ │ │ ├── stm32l0xx_hal_rcc_ex.h │ │ │ ├── stm32l0xx_ll_pwr.h │ │ │ ├── stm32l0xx_ll_rcc.h │ │ │ └── stm32l0xx_ll_usb.h │ │ └── Src │ │ │ ├── stm32l0xx_hal_pcd.c │ │ │ ├── stm32l0xx_hal_pcd_ex.c │ │ │ └── stm32l0xx_ll_usb.c │ ├── usbd_conf.c │ ├── usbd_conf.h │ ├── usbd_desc.c │ └── usbd_desc.h │ ├── armv6m_atomic.c │ ├── armv6m_core.c │ ├── armv6m_pendsv.c │ ├── armv6m_svcall.c │ ├── armv6m_systick.c │ ├── armv6m_work.c │ ├── dosfs_core.c │ ├── dosfs_device.c │ ├── dosfs_sflash.c │ ├── dosfs_storage.c │ ├── startup_stm32l052xx.S │ ├── startup_stm32l072xx.S │ ├── startup_stm32l082xx.S │ ├── stm32l0_adc.c │ ├── stm32l0_aes.c │ ├── stm32l0_comp.c │ ├── stm32l0_dac.c │ ├── stm32l0_dma.c │ ├── stm32l0_eeprom.c │ ├── stm32l0_exti.c │ ├── stm32l0_flash.c │ ├── stm32l0_gpio.c │ ├── stm32l0_i2c.c │ ├── stm32l0_iwdg.c │ ├── stm32l0_lptim.c │ ├── stm32l0_random.c │ ├── stm32l0_rtc.c │ ├── stm32l0_sdspi.c │ ├── stm32l0_servo.c │ ├── stm32l0_sfspi.c │ ├── stm32l0_spi.c │ ├── stm32l0_system.c │ ├── stm32l0_timer.c │ ├── stm32l0_uart.c │ ├── stm32l0_usbd_cdc.c │ ├── stm32l0_usbd_class.c │ └── stm32l0_usbd_msc.c ├── tools ├── linux │ ├── dfu-prefix │ ├── dfu-suffix │ ├── dfu-util │ ├── openocd │ │ └── bin │ │ │ ├── libudev.so.0 │ │ │ └── openocd │ └── stm32l0-upload ├── macosx │ ├── dfu-prefix │ ├── dfu-suffix │ ├── dfu-util │ ├── openocd │ │ └── bin │ │ │ └── openocd │ └── stm32l0-upload ├── share │ └── openocd │ │ └── scripts │ │ ├── board │ │ ├── st_nucleo_f0.cfg │ │ ├── st_nucleo_f103rb.cfg │ │ ├── st_nucleo_f3.cfg │ │ ├── st_nucleo_f4.cfg │ │ ├── st_nucleo_f7.cfg │ │ ├── st_nucleo_h743zi.cfg │ │ ├── st_nucleo_l073rz.cfg │ │ ├── st_nucleo_l1.cfg │ │ ├── st_nucleo_l4.cfg │ │ ├── steval-idb007v1.cfg │ │ ├── steval-idb008v1.cfg │ │ ├── stm320518_eval.cfg │ │ ├── stm320518_eval_stlink.cfg │ │ ├── stm32100b_eval.cfg │ │ ├── stm3210b_eval.cfg │ │ ├── stm3210c_eval.cfg │ │ ├── stm3210e_eval.cfg │ │ ├── stm3220g_eval.cfg │ │ ├── stm3220g_eval_stlink.cfg │ │ ├── stm3241g_eval.cfg │ │ ├── stm3241g_eval_stlink.cfg │ │ ├── stm32429i_eval.cfg │ │ ├── stm32429i_eval_stlink.cfg │ │ ├── stm32439i_eval.cfg │ │ ├── stm32439i_eval_stlink.cfg │ │ ├── stm327x6g_eval.cfg │ │ ├── stm32f0discovery.cfg │ │ ├── stm32f334discovery.cfg │ │ ├── stm32f3discovery.cfg │ │ ├── stm32f429disc1.cfg │ │ ├── stm32f429discovery.cfg │ │ ├── stm32f469discovery.cfg │ │ ├── stm32f4discovery.cfg │ │ ├── stm32f7discovery.cfg │ │ ├── stm32h7x3i_eval.cfg │ │ ├── stm32l0discovery.cfg │ │ ├── stm32l4discovery.cfg │ │ ├── stm32ldiscovery.cfg │ │ └── stm32vldiscovery.cfg │ │ ├── chip │ │ └── st │ │ │ └── stm32 │ │ │ ├── stm32.tcl │ │ │ ├── stm32_rcc.tcl │ │ │ └── stm32_regs.tcl │ │ ├── cpu │ │ └── arm │ │ │ └── cortex_m3.tcl │ │ ├── interface │ │ ├── cmsis-dap.cfg │ │ ├── stlink-v1.cfg │ │ ├── stlink-v2-1.cfg │ │ ├── stlink-v2.cfg │ │ └── stlink.cfg │ │ ├── mem_helper.tcl │ │ └── target │ │ ├── bluenrg-x.cfg │ │ ├── stm32_stlink.cfg │ │ ├── stm32f0x.cfg │ │ ├── stm32f0x_stlink.cfg │ │ ├── stm32f1x.cfg │ │ ├── stm32f1x_stlink.cfg │ │ ├── stm32f2x.cfg │ │ ├── stm32f2x_stlink.cfg │ │ ├── stm32f3x.cfg │ │ ├── stm32f3x_stlink.cfg │ │ ├── stm32f4x.cfg │ │ ├── stm32f4x_stlink.cfg │ │ ├── stm32f7x.cfg │ │ ├── stm32h7x.cfg │ │ ├── stm32h7x_dual_bank.cfg │ │ ├── stm32l0.cfg │ │ ├── stm32l0_dual_bank.cfg │ │ ├── stm32l1.cfg │ │ ├── stm32l1x_dual_bank.cfg │ │ ├── stm32l4x.cfg │ │ ├── stm32lx_stlink.cfg │ │ ├── stm32w108_stlink.cfg │ │ ├── stm32w108xx.cfg │ │ ├── stm32xl.cfg │ │ └── swj-dp.tcl └── windows │ ├── dfu-prefix.exe │ ├── dfu-suffix.exe │ ├── dfu-util.exe │ ├── libwinpthread-1.dll │ ├── openocd │ └── bin │ │ ├── libusb0.dll │ │ └── openocd.exe │ └── stm32l0-upload.bat └── variants ├── B-L072Z-LRWAN1 ├── linker_scripts │ └── STM32L072CZ_FLASH.ld ├── openocd_scripts │ └── b-l072z-lrwan1.cfg ├── pins_arduino.h ├── variant.cpp └── variant.h ├── Cicada-L082CZ ├── linker_scripts │ └── STM32L082CZ_FLASH.ld ├── openocd_scripts │ └── cicada-l082cz.cfg ├── pins_arduino.h ├── variant.cpp └── variant.h ├── Cricket-L082CZ ├── linker_scripts │ └── STM32L082CZ_FLASH.ld ├── openocd_scripts │ └── cricket-l082cz.cfg ├── pins_arduino.h ├── variant.cpp └── variant.h ├── Gnat-L082CZ ├── linker_scripts │ └── STM32L082CZ_FLASH.ld ├── openocd_scripts │ └── gnat-l082cz.cfg ├── pins_arduino.h ├── variant.cpp └── variant.h ├── Grasshopper-L082CZ ├── linker_scripts │ └── STM32L082CZ_FLASH.ld ├── openocd_scripts │ └── grasshopper-l082cz.cfg ├── pins_arduino.h ├── variant.cpp └── variant.h ├── I-NUCLEO-LRWAN1 ├── linker_scripts │ └── STM32L052T8_FLASH.ld ├── openocd_scripts │ └── i-nucleo-lrwan1.cfg ├── pins_arduino.h ├── variant.cpp └── variant.h ├── NUCLEO-L053R8 ├── linker_scripts │ └── STM32L053R8_FLASH.ld ├── openocd_scripts │ └── nucleo-l053rb.cfg ├── pins_arduino.h ├── variant.cpp └── variant.h ├── NUCLEO-L073RZ ├── linker_scripts │ └── STM32L073RZ_FLASH.ld ├── openocd_scripts │ └── nucleo-l073rz.cfg ├── pins_arduino.h ├── variant.cpp └── variant.h └── P-NUCLEO-LRWAN1 ├── linker_scripts └── STM32L073RZ_FLASH.ld ├── openocd_scripts └── p-nucleo-lrwan1.cfg ├── pins_arduino.h ├── variant.cpp └── variant.h /.gitignore: -------------------------------------------------------------------------------- 1 | *.bz2 2 | 3 | bootloaders/*/build/ 4 | -------------------------------------------------------------------------------- /cores/arduino/Client.h: -------------------------------------------------------------------------------- 1 | /* 2 | Client.h - Base class that provides Client 3 | Copyright (c) 2011 Adrian McEwen. All right reserved. 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifndef client_h 21 | #define client_h 22 | #include "Print.h" 23 | #include "Stream.h" 24 | #include "IPAddress.h" 25 | 26 | class Client : public Stream { 27 | 28 | public: 29 | virtual int connect(IPAddress ip, uint16_t port) =0; 30 | virtual int connect(const char *host, uint16_t port) =0; 31 | virtual size_t write(uint8_t) =0; 32 | virtual size_t write(const uint8_t *buf, size_t size) =0; 33 | virtual int available() = 0; 34 | virtual int read() = 0; 35 | virtual int read(uint8_t *buf, size_t size) = 0; 36 | virtual int peek() = 0; 37 | virtual void flush() = 0; 38 | virtual void stop() = 0; 39 | virtual uint8_t connected() = 0; 40 | virtual operator bool() = 0; 41 | protected: 42 | uint8_t* rawIPAddress(IPAddress& addr) { return addr.raw_address(); }; 43 | }; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /cores/arduino/HardwareSerial1.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2018 Thomas Roell. All rights reserved. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to 6 | * deal with the Software without restriction, including without limitation the 7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | * sell copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * 1. Redistributions of source code must retain the above copyright notice, 12 | * this list of conditions and the following disclaimers. 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimers in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 3. Neither the name of Thomas Roell, nor the names of its contributors 17 | * may be used to endorse or promote products derived from this Software 18 | * without specific prior written permission. 19 | * 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | * CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 26 | * WITH THE SOFTWARE. 27 | */ 28 | 29 | #include "Arduino.h" 30 | #include "wiring_private.h" 31 | 32 | #if SERIAL_INTERFACES_COUNT > 1 33 | 34 | extern bool Serial1_available() __attribute__((weak)); 35 | extern void serialEvent1() __attribute__((weak)); 36 | 37 | bool Serial1_available() { return Serial1.available(); } 38 | 39 | #if defined(USBCON) 40 | extern stm32l0_uart_t g_Serial1; 41 | #else 42 | static stm32l0_uart_t g_Serial1; 43 | #endif 44 | extern const stm32l0_uart_params_t g_Serial1Params; 45 | 46 | Uart Serial1(&g_Serial1, &g_Serial1Params, (serialEvent1 ? serialEventRun : NULL)); 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /cores/arduino/HardwareSerial2.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2018 Thomas Roell. All rights reserved. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to 6 | * deal with the Software without restriction, including without limitation the 7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | * sell copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * 1. Redistributions of source code must retain the above copyright notice, 12 | * this list of conditions and the following disclaimers. 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimers in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 3. Neither the name of Thomas Roell, nor the names of its contributors 17 | * may be used to endorse or promote products derived from this Software 18 | * without specific prior written permission. 19 | * 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | * CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 26 | * WITH THE SOFTWARE. 27 | */ 28 | 29 | #include "Arduino.h" 30 | #include "wiring_private.h" 31 | 32 | #if SERIAL_INTERFACES_COUNT > 2 33 | 34 | extern bool Serial2_available() __attribute__((weak)); 35 | extern void serialEvent2() __attribute__((weak)); 36 | 37 | bool Serial2_available() { return Serial2.available(); } 38 | 39 | static stm32l0_uart_t g_Serial2; 40 | extern const stm32l0_uart_params_t g_Serial2Params; 41 | 42 | Uart Serial2(&g_Serial2, &g_Serial2Params, (serialEvent2 ? serialEventRun : NULL)); 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /cores/arduino/HardwareSerial3.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2018 Thomas Roell. All rights reserved. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to 6 | * deal with the Software without restriction, including without limitation the 7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | * sell copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * 1. Redistributions of source code must retain the above copyright notice, 12 | * this list of conditions and the following disclaimers. 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimers in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 3. Neither the name of Thomas Roell, nor the names of its contributors 17 | * may be used to endorse or promote products derived from this Software 18 | * without specific prior written permission. 19 | * 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | * CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 26 | * WITH THE SOFTWARE. 27 | */ 28 | 29 | #include "Arduino.h" 30 | #include "wiring_private.h" 31 | 32 | #if SERIAL_INTERFACES_COUNT > 3 33 | 34 | extern bool Serial3_available() __attribute__((weak)); 35 | extern void serialEvent3() __attribute__((weak)); 36 | 37 | bool Serial3_available() { return Serial3.available(); } 38 | 39 | static stm32l0_uart_t g_Serial3; 40 | extern const stm32l0_uart_params_t g_Serial3Params; 41 | 42 | Uart Serial3(&g_Serial3, &g_Serial3Params, (serialEvent3 ? serialEventRun : NULL)); 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /cores/arduino/Printable.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014 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 | #include 23 | 24 | class Print; 25 | 26 | /** The Printable class provides a way for new classes to allow themselves to be printed. 27 | By deriving from Printable and implementing the printTo method, it will then be possible 28 | for users to print out instances of this class by passing them into the usual 29 | Print::print and Print::println methods. 30 | */ 31 | 32 | class Printable 33 | { 34 | public: 35 | virtual size_t printTo(Print& p) const = 0; 36 | }; 37 | 38 | #endif 39 | 40 | -------------------------------------------------------------------------------- /cores/arduino/RingBuffer.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014 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 | #include "RingBuffer.h" 20 | #include 21 | 22 | RingBuffer::RingBuffer( void ) 23 | { 24 | memset( _aucBuffer, 0, SERIAL_BUFFER_SIZE ) ; 25 | clear(); 26 | } 27 | 28 | void RingBuffer::store_char( uint8_t c ) 29 | { 30 | int i = nextIndex(_iHead); 31 | 32 | // if we should be storing the received character into the location 33 | // just before the tail (meaning that the head would advance to the 34 | // current location of the tail), we're about to overflow the buffer 35 | // and so we don't write the character or advance the head. 36 | if ( i != _iTail ) 37 | { 38 | _aucBuffer[_iHead] = c ; 39 | _iHead = i ; 40 | } 41 | } 42 | 43 | void RingBuffer::clear() 44 | { 45 | _iHead = 0; 46 | _iTail = 0; 47 | } 48 | 49 | int RingBuffer::read_char() 50 | { 51 | if(_iTail == _iHead) 52 | return -1; 53 | 54 | uint8_t value = _aucBuffer[_iTail]; 55 | _iTail = nextIndex(_iTail); 56 | 57 | return value; 58 | } 59 | 60 | int RingBuffer::available() 61 | { 62 | int delta = _iHead - _iTail; 63 | 64 | if(delta < 0) 65 | return SERIAL_BUFFER_SIZE + delta; 66 | else 67 | return delta; 68 | } 69 | 70 | int RingBuffer::availableForStore() 71 | { 72 | if (_iHead >= _iTail) 73 | return SERIAL_BUFFER_SIZE - 1 - _iHead + _iTail; 74 | else 75 | return _iTail - _iHead - 1; 76 | } 77 | 78 | int RingBuffer::peek() 79 | { 80 | if(_iTail == _iHead) 81 | return -1; 82 | 83 | return _aucBuffer[_iTail]; 84 | } 85 | 86 | int RingBuffer::nextIndex(int index) 87 | { 88 | return (uint32_t)(index + 1) % SERIAL_BUFFER_SIZE; 89 | } 90 | 91 | bool RingBuffer::isFull() 92 | { 93 | return (nextIndex(_iHead) == _iTail); 94 | } 95 | -------------------------------------------------------------------------------- /cores/arduino/RingBuffer.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014 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 (I think), 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 64 29 | 30 | class RingBuffer 31 | { 32 | public: 33 | uint8_t _aucBuffer[SERIAL_BUFFER_SIZE] ; 34 | int _iHead ; 35 | int _iTail ; 36 | 37 | public: 38 | RingBuffer( void ) ; 39 | void store_char( uint8_t c ) ; 40 | void clear(); 41 | int read_char(); 42 | int available(); 43 | int availableForStore(); 44 | int peek(); 45 | bool isFull(); 46 | 47 | private: 48 | int nextIndex(int index); 49 | } ; 50 | 51 | #endif /* _RING_BUFFER_ */ 52 | -------------------------------------------------------------------------------- /cores/arduino/Server.h: -------------------------------------------------------------------------------- 1 | /* 2 | Server.h - Base class that provides Server 3 | Copyright (c) 2011 Adrian McEwen. All right reserved. 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifndef server_h 21 | #define server_h 22 | 23 | #include "Print.h" 24 | 25 | class Server : public Print { 26 | public: 27 | virtual void begin() =0; 28 | }; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /cores/arduino/Tone.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015 Arduino LLC. 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 | #pragma once 20 | 21 | #ifdef __cplusplus 22 | 23 | #include "Arduino.h" 24 | 25 | void tone(uint32_t _pin, uint32_t frequency, uint32_t duration = 0); 26 | void noTone(uint32_t _pin); 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /cores/arduino/WInterrupts.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015 Arduino LLC. 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_INTERRUPTS_ 20 | #define _WIRING_INTERRUPTS_ 21 | 22 | #include 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | // LOW 0 29 | // HIGH 1 30 | #define CHANGE 2 31 | #define FALLING 3 32 | #define RISING 4 33 | 34 | #define DEFAULT 1 35 | #define EXTERNAL 0 36 | 37 | typedef void (*voidFuncPtr)(void); 38 | 39 | /* 40 | * \brief Specifies a named Interrupt Service Routine (ISR) to call when an interrupt occurs. 41 | * Replaces any previous function that was attached to the interrupt. 42 | */ 43 | void attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode); 44 | void attachInterruptWakeup(uint32_t pin, voidFuncPtr callback, uint32_t mode); 45 | 46 | /* 47 | * \brief Turns off the given interrupt. 48 | */ 49 | void detachInterrupt(uint32_t pin); 50 | 51 | #ifdef __cplusplus 52 | } 53 | #endif 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /cores/arduino/WMath.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014 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 | extern "C" { 20 | #include "stdlib.h" 21 | #include "stdint.h" 22 | } 23 | #include "WMath.h" 24 | 25 | extern void randomSeed( uint32_t dwSeed ) 26 | { 27 | if ( dwSeed != 0 ) 28 | { 29 | srand( dwSeed ) ; 30 | } 31 | } 32 | 33 | extern long random( long howbig ) 34 | { 35 | if ( howbig == 0 ) 36 | { 37 | return 0 ; 38 | } 39 | 40 | return rand() % howbig; 41 | } 42 | 43 | extern long random( long howsmall, long howbig ) 44 | { 45 | if (howsmall >= howbig) 46 | { 47 | return howsmall; 48 | } 49 | 50 | long diff = howbig - howsmall; 51 | 52 | return random(diff) + howsmall; 53 | } 54 | 55 | extern long map(long x, long in_min, long in_max, long out_min, long out_max) 56 | { 57 | return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; 58 | } 59 | 60 | extern uint16_t makeWord( uint16_t w ) 61 | { 62 | return w ; 63 | } 64 | 65 | extern uint16_t makeWord( uint8_t h, uint8_t l ) 66 | { 67 | return (h << 8) | l ; 68 | } 69 | -------------------------------------------------------------------------------- /cores/arduino/WMath.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014 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 | extern long random( long ) ; 23 | extern long random( long, long ) ; 24 | extern void randomSeed( uint32_t dwSeed ) ; 25 | extern long map( long, long, long, long, long ) ; 26 | 27 | extern uint16_t makeWord( uint16_t w ) ; 28 | extern uint16_t makeWord( uint8_t h, uint8_t l ) ; 29 | 30 | #define word(...) makeWord(__VA_ARGS__) 31 | 32 | 33 | #endif /* _WIRING_MATH_ */ 34 | -------------------------------------------------------------------------------- /cores/arduino/abi.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014 Arduino LLC. 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 | #include 20 | 21 | extern "C" void __cxa_pure_virtual(void) __attribute__ ((__noreturn__)); 22 | extern "C" void __cxa_deleted_virtual(void) __attribute__ ((__noreturn__)); 23 | 24 | void __cxa_pure_virtual(void) { 25 | // We might want to write some diagnostics to uart in this case 26 | //std::terminate(); 27 | while (1) 28 | ; 29 | } 30 | 31 | void __cxa_deleted_virtual(void) { 32 | // We might want to write some diagnostics to uart in this case 33 | //std::terminate(); 34 | while (1) 35 | ; 36 | } 37 | 38 | -------------------------------------------------------------------------------- /cores/arduino/avr/dtostrf.c: -------------------------------------------------------------------------------- 1 | /* 2 | dtostrf - Emulation for dtostrf function from avr-libc 3 | Copyright (c) 2015 Arduino LLC. All rights reserved. 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #include 21 | 22 | char *dtostrf (double val, signed char width, unsigned char prec, char *sout) { 23 | asm(".global _printf_float"); 24 | 25 | char fmt[20]; 26 | sprintf(fmt, "%%%d.%df", width, prec); 27 | sprintf(sout, fmt, val); 28 | return sout; 29 | } 30 | 31 | -------------------------------------------------------------------------------- /cores/arduino/avr/dtostrf.h: -------------------------------------------------------------------------------- 1 | /* 2 | dtostrf - Emulation for dtostrf function from avr-libc 3 | Copyright (c) 2015 Arduino LLC. All rights reserved. 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #pragma once 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | char *dtostrf(double val, signed char width, unsigned char prec, char *sout); 27 | 28 | #ifdef __cplusplus 29 | } 30 | #endif 31 | -------------------------------------------------------------------------------- /cores/arduino/avr/fdevopen.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Thomas Roell. All rights reserved. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to 6 | * deal with the Software without restriction, including without limitation the 7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | * sell copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * 1. Redistributions of source code must retain the above copyright notice, 12 | * this list of conditions and the following disclaimers. 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimers in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 3. Neither the name of Thomas Roell, nor the names of its contributors 17 | * may be used to endorse or promote products derived from this Software 18 | * without specific prior written permission. 19 | * 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | * CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 26 | * WITH THE SOFTWARE. 27 | */ 28 | 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | 35 | extern int (*stm32l0_stdio_put)(char, FILE*); 36 | extern int (*stm32l0_stdio_get)(FILE*); 37 | 38 | FILE * fdevopen(int(*put)(char, FILE *), int(*get)(FILE *)) 39 | { 40 | if (put != NULL) 41 | { 42 | stm32l0_stdio_put = (void*)put; 43 | 44 | return stdout; 45 | } 46 | 47 | if (get != NULL) 48 | { 49 | stm32l0_stdio_get = get; 50 | 51 | return stdin; 52 | } 53 | 54 | return NULL; 55 | } 56 | -------------------------------------------------------------------------------- /cores/arduino/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/arduino/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 0x20000000 29 | #define RAMSIZE (20 * 1024) 30 | #define RAMEND (RAMSTART + RAMSIZE - 1) 31 | 32 | #define E2END 0xfff 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /cores/arduino/delay.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2020 Thomas Roell. All rights reserved. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to 6 | * deal with the Software without restriction, including without limitation the 7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | * sell copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * 1. Redistributions of source code must retain the above copyright notice, 12 | * this list of conditions and the following disclaimers. 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimers in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 3. Neither the name of Thomas Roell, nor the names of its contributors 17 | * may be used to endorse or promote products derived from this Software 18 | * without specific prior written permission. 19 | * 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | * CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 26 | * WITH THE SOFTWARE. 27 | */ 28 | 29 | #include "Arduino.h" 30 | #include "wiring_private.h" 31 | 32 | unsigned long millis(void) 33 | { 34 | uint64_t clock; 35 | 36 | clock = stm32l0_rtc_clock_read(); 37 | 38 | return stm32l0_rtc_clock_to_millis(clock); 39 | } 40 | 41 | unsigned long micros(void) 42 | { 43 | return armv6m_systick_micros(); 44 | } 45 | 46 | void delay(uint32_t timeout) 47 | { 48 | uint32_t now, start, end; 49 | 50 | if (timeout == 0) 51 | return; 52 | 53 | if (__get_IPSR() == 0) { 54 | 55 | stm32l0_system_sleep(g_defaultPolicy, 0, timeout); 56 | 57 | } else { 58 | 59 | now = millis(); 60 | start = now; 61 | end = start + timeout; 62 | 63 | do 64 | { 65 | now = millis(); 66 | } 67 | while ((now - start) < (end - start)); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /cores/arduino/hooks.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015 Arduino LLC. 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 | void yield(void) __attribute__ ((weak, alias("__empty"))); 32 | -------------------------------------------------------------------------------- /cores/arduino/itoa.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015 Arduino LLC. 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 | #pragma once 20 | 21 | #ifdef __cplusplus 22 | extern "C"{ 23 | #endif 24 | 25 | //extern void itoa( int n, char s[] ) ; 26 | 27 | extern char* itoa( int value, char *string, int radix ) ; 28 | extern char* ltoa( long value, char *string, int radix ) ; 29 | extern char* utoa( unsigned int value, char *string, int radix ) ; 30 | extern char* ultoa( unsigned long value, char *string, int radix ) ; 31 | 32 | #ifdef __cplusplus 33 | } // extern "C" 34 | #endif 35 | 36 | -------------------------------------------------------------------------------- /cores/arduino/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015 Arduino LLC. 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 | #define ARDUINO_MAIN 20 | #include "Arduino.h" 21 | #include "wiring_private.h" 22 | 23 | #if defined(ARDUINO_MAKEFILE) 24 | 25 | void setup(void) { 26 | } 27 | 28 | void loop(void) { 29 | } 30 | 31 | #endif 32 | 33 | // Weak empty variant initialization function. 34 | // May be redefined by variant files. 35 | void initVariant() __attribute__((weak)); 36 | void initVariant() { } 37 | 38 | // Initialize C library 39 | extern "C" void __libc_init_array(void); 40 | 41 | void (*g_serialEventRun)(void) = NULL; 42 | 43 | /* 44 | * \brief Main entry point of Arduino application 45 | */ 46 | int main( void ) 47 | { 48 | init(); 49 | initVariant(); 50 | 51 | __libc_init_array(); 52 | 53 | #if defined(USBCON) 54 | USBDevice.begin(); 55 | USBDevice.attach(); 56 | #endif 57 | 58 | setup(); 59 | 60 | for (;;) 61 | { 62 | loop(); 63 | if (g_serialEventRun) (*g_serialEventRun)(); 64 | } 65 | 66 | return 0; 67 | } 68 | -------------------------------------------------------------------------------- /cores/arduino/new.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014 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 | #include 20 | 21 | void *operator new(size_t size) { 22 | return malloc(size); 23 | } 24 | 25 | void *operator new[](size_t size) { 26 | return malloc(size); 27 | } 28 | 29 | void operator delete(void * ptr) { 30 | free(ptr); 31 | } 32 | 33 | void operator delete[](void * ptr) { 34 | free(ptr); 35 | } 36 | 37 | -------------------------------------------------------------------------------- /cores/arduino/wiring.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015 Arduino LLC. 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 | #pragma once 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | extern void init(void); 26 | 27 | extern uint32_t SystemCoreClock; 28 | 29 | #define F_CPU SystemCoreClock 30 | 31 | extern uint32_t __FlashBase; 32 | extern uint32_t __FlashLimit; 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | -------------------------------------------------------------------------------- /cores/arduino/wiring_constants.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014 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_CONSTANTS_ 20 | #define _WIRING_CONSTANTS_ 21 | 22 | #ifdef __cplusplus 23 | extern "C"{ 24 | #endif // __cplusplus 25 | 26 | #define LOW (0x0) 27 | #define HIGH (0x1) 28 | 29 | #define INPUT (0x0) 30 | #define OUTPUT (0x1) 31 | #define INPUT_PULLUP (0x2) 32 | #define INPUT_PULLDOWN (0x3) 33 | #define OUTPUT_OPENDRAIN (0x4) 34 | #define HIGHZ (0x5) 35 | 36 | #define PI 3.1415926535897932384626433832795 37 | #define HALF_PI 1.5707963267948966192313216916398 38 | #define TWO_PI 6.283185307179586476925286766559 39 | #define DEG_TO_RAD 0.017453292519943295769236907684886 40 | #define RAD_TO_DEG 57.295779513082320876798154814105 41 | #define EULER 2.718281828459045235360287471352 42 | 43 | #define SERIAL 0x0 44 | #define DISPLAY 0x1 45 | 46 | enum BitOrder { 47 | LSBFIRST = 0, 48 | MSBFIRST = 1 49 | }; 50 | 51 | // moved to WInterrupts.h 52 | //// LOW 0 53 | //// HIGH 1 54 | //#define CHANGE 2 55 | //#define FALLING 3 56 | //#define RISING 4 57 | // 58 | //#define DEFAULT 1 59 | //#define EXTERNAL 0 60 | 61 | #ifdef __cplusplus 62 | } // extern "C" 63 | #endif // __cplusplus 64 | 65 | #endif /* _WIRING_CONSTANTS_ */ 66 | -------------------------------------------------------------------------------- /cores/arduino/wiring_pulse.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015 Arduino LLC. 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 | #pragma once 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | /* 26 | * \brief Measures the length (in microseconds) of a pulse on the pin; state is HIGH 27 | * or LOW, the type of pulse to measure. Works on pulses from 2-3 microseconds 28 | * to 3 minutes in length, but must be called at least a few dozen microseconds 29 | * before the start of the pulse. 30 | */ 31 | uint32_t pulseIn(uint32_t pin, uint32_t state, uint32_t timeout); 32 | 33 | #ifdef __cplusplus 34 | // Provides a version of pulseIn with a default argument (C++ only) 35 | uint32_t pulseIn(uint32_t pin, uint32_t state, uint32_t timeout = 1000000L); 36 | 37 | } // extern "C" 38 | #endif 39 | 40 | -------------------------------------------------------------------------------- /cores/arduino/wiring_shift.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014 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_ 20 | #define _WIRING_SHIFT_ 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | /* 27 | * \brief 28 | */ 29 | extern uint32_t shiftIn( uint32_t ulDataPin, uint32_t ulClockPin, uint32_t ulBitOrder ) ; 30 | 31 | 32 | /* 33 | * \brief 34 | */ 35 | extern void shiftOut( uint32_t ulDataPin, uint32_t ulClockPin, uint32_t ulBitOrder, uint32_t ulVal ) ; 36 | 37 | 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | 42 | #endif /* _WIRING_SHIFT_ */ 43 | -------------------------------------------------------------------------------- /drivers/linux/49-cicada.rules: -------------------------------------------------------------------------------- 1 | ATTRS{idVendor}=="1209", ATTRS{idProduct}=="6663", ENV{ID_MM_DEVICE_IGNORE}="1" 2 | ATTRS{idVendor}=="1209", ATTRS{idProduct}=="6663", ENV{MTP_NO_PROBE}="1" 3 | ATTRS{idVendor}=="1209", ATTRS{idProduct}=="6663", ENV{UDISKS_AUTO}="0" 4 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="1209", ATTRS{idProduct}=="6663", MODE:="0666" 5 | KERNEL=="ttyACM*", ATTRS{idVendor}=="1209", ATTRS{idProduct}=="6663", MODE:="0666" 6 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", MODE:="0666" 7 | -------------------------------------------------------------------------------- /drivers/linux/49-cricket.rules: -------------------------------------------------------------------------------- 1 | ATTRS{idVendor}=="1209", ATTRS{idProduct}=="6664", ENV{ID_MM_DEVICE_IGNORE}="1" 2 | ATTRS{idVendor}=="1209", ATTRS{idProduct}=="6664", ENV{MTP_NO_PROBE}="1" 3 | ATTRS{idVendor}=="1209", ATTRS{idProduct}=="6664", ENV{UDISKS_AUTO}="0" 4 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="1209", ATTRS{idProduct}=="6664", MODE:="0666" 5 | KERNEL=="ttyACM*", ATTRS{idVendor}=="1209", ATTRS{idProduct}=="6664", MODE:="0666" 6 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", MODE:="0666" 7 | -------------------------------------------------------------------------------- /drivers/linux/49-gnat.rules: -------------------------------------------------------------------------------- 1 | ATTRS{idVendor}=="1209", ATTRS{idProduct}=="6662", ENV{ID_MM_DEVICE_IGNORE}="1" 2 | ATTRS{idVendor}=="1209", ATTRS{idProduct}=="6662", ENV{MTP_NO_PROBE}="1" 3 | ATTRS{idVendor}=="1209", ATTRS{idProduct}=="6662", ENV{UDISKS_AUTO}="0" 4 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="1209", ATTRS{idProduct}=="6662", MODE:="0666" 5 | KERNEL=="ttyACM*", ATTRS{idVendor}=="1209", ATTRS{idProduct}=="6662", MODE:="0666" 6 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", MODE:="0666" 7 | -------------------------------------------------------------------------------- /drivers/linux/49-grasshopper.rules: -------------------------------------------------------------------------------- 1 | ATTRS{idVendor}=="1209", ATTRS{idProduct}=="6665", ENV{ID_MM_DEVICE_IGNORE}="1" 2 | ATTRS{idVendor}=="1209", ATTRS{idProduct}=="6665", ENV{MTP_NO_PROBE}="1" 3 | ATTRS{idVendor}=="1209", ATTRS{idProduct}=="6665", ENV{UDISKS_AUTO}="0" 4 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="1209", ATTRS{idProduct}=="6665", MODE:="0666" 5 | KERNEL=="ttyACM*", ATTRS{idVendor}=="1209", ATTRS{idProduct}=="6665", MODE:="0666" 6 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", MODE:="0666" 7 | -------------------------------------------------------------------------------- /drivers/linux/49-nucleo.rules: -------------------------------------------------------------------------------- 1 | ATTRS{idVendor}=="0483", ATTRS{idProduct}=="374b", ENV{ID_MM_DEVICE_IGNORE}="1" 2 | ATTRS{idVendor}=="0483", ATTRS{idProduct}=="374b", ENV{MTP_NO_PROBE}="1" 3 | ATTRS{idVendor}=="0483", ATTRS{idProduct}=="374b", ENV{UDISKS_AUTO}="0" 4 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="374b", MODE:="0666" 5 | KERNEL=="ttyACM*", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="374b", MODE:="0666" 6 | -------------------------------------------------------------------------------- /drivers/windows/dpinst.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /drivers/windows/dpinst_amd64.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GrumpyOldPizza/ArduinoCore-stm32l0/b1cf1cd6eba2f06bbe4edbe76aa43ae5971e8d8c/drivers/windows/dpinst_amd64.exe -------------------------------------------------------------------------------- /drivers/windows/dpinst_x86.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GrumpyOldPizza/ArduinoCore-stm32l0/b1cf1cd6eba2f06bbe4edbe76aa43ae5971e8d8c/drivers/windows/dpinst_x86.exe -------------------------------------------------------------------------------- /libraries/CayenneLPP/examples/CayenneLPP_GNSS/CayenneLPP_GNSS.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * This example code is in the public domain. 3 | */ 4 | 5 | #include "LoRaWAN.h" 6 | #include "GNSS.h" 7 | #include "CayenneLPP.h" 8 | 9 | const char *appEui = "0101010101010101"; 10 | const char *appKey = "2B7E151628AED2A6ABF7158809CF4F3C"; 11 | const char *devEui = "0101010101010101"; 12 | 13 | GNSSLocation myLocation; 14 | 15 | CayenneLPP myLPP(64); 16 | 17 | void transmitCallback(void) 18 | { 19 | } 20 | 21 | 22 | void setup( void ) 23 | { 24 | GNSS.begin(Serial1, GNSS.MODE_UBLOX, GNSS.RATE_1HZ); 25 | 26 | while (GNSS.busy()) { } 27 | 28 | LoRaWAN.begin(US915); 29 | LoRaWAN.joinOTAA(appEui, appKey, devEui); 30 | } 31 | 32 | void loop( void ) 33 | { 34 | delay(10000); 35 | 36 | if (!LoRaWAN.busy() && LoRaWAN.joined()) 37 | { 38 | if (GNSS.location(myLocation) && (myLocation.fixType() == GNSSLocation::TYPE_3D)) 39 | { 40 | myLPP.reset(); 41 | myLPP.addGPS(0, myLocation.latitude(), myLocation.longitude(), myLocation.altitude()); 42 | 43 | LoRaWAN.sendPacket(myLPP.getBuffer(), myLPP.getSize()); 44 | } 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /libraries/CayenneLPP/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For CayenneLPP 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | CayenneLPP KEYWORD1 CayenneLPP 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | 15 | reset KEYWORD2 16 | getSize KEYWORD2 17 | getBuffer KEYWORD2 18 | copy KEYWORD2 19 | addDigitalInput KEYWORD2 20 | addDigitalOutput KEYWORD2 21 | addAnalogInput KEYWORD2 22 | addAnalogOutput KEYWORD2 23 | addLuminosity KEYWORD2 24 | addPresence KEYWORD2 25 | addTemperature KEYWORD2 26 | addRelativeHumidity KEYWORD2 27 | addAccelerometer KEYWORD2 28 | addBarometricPressure KEYWORD2 29 | addGyrometer KEYWORD2 30 | addGPS KEYWORD2 31 | 32 | ####################################### 33 | # Constants (LITERAL1) 34 | ####################################### 35 | 36 | LPP_DIGITAL_INPUT_SIZE LITERAL1 37 | LPP_DIGITAL_OUTPUT_SIZE LITERAL1 38 | LPP_ANALOG_INPUT_SIZE LITERAL1 39 | LPP_ANALOG_OUTPUT_SIZE LITERAL1 40 | LPP_LUMINOSITY_SIZE LITERAL1 41 | LPP_PRESENCE_SIZE LITERAL1 42 | LPP_TEMPERATURE_SIZE LITERAL1 43 | LPP_RELATIVE_HUMIDITY_SIZE LITERAL1 44 | LPP_ACCELEROMETER_SIZE LITERAL1 45 | LPP_BAROMETRIC_PRESSURE_SIZE LITERAL1 46 | LPP_GYROMETER_SIZE LITERAL1 47 | LPP_GPS_SIZE LITERAL1 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /libraries/CayenneLPP/library.properties: -------------------------------------------------------------------------------- 1 | name=CayenneLPP 2 | version=1.0.0 3 | author=myDevicesIOT 4 | maintainer= 5 | sentence=CayenneLPP Arduino Library 6 | paragraph=Cayenne Low Power Payload 7 | category=Communication 8 | url= 9 | architectures=stm32l0 10 | -------------------------------------------------------------------------------- /libraries/DOSFS/examples/DOSFS_DataLogger/DOSFS_DataLogger.ino: -------------------------------------------------------------------------------- 1 | /* DOSFS datalogger 2 | * 3 | * This example shows how to log data to a DOSFS file 4 | * 5 | * Please select in the "Tools->DOSFS" menu either 6 | * SDCARD or SFLASH. Make sure that "Tools->USB Type" 7 | * does not contain "Mass Storage". 8 | * 9 | * Kind of simple and a tad boring. The temperature sensor 10 | * is read and then the data appended to a logfile. There 11 | * are however a few interesting details internally. The 12 | * log file is closed after each dataset. That has 2 effects. 13 | * One is that the if the crashes or gets reset there is no 14 | * file system corruption. The other important detail is 15 | * that if no wok is pending, the SDCARD/SFLASH can go 16 | * to sleep, hence consuming less power. 17 | * 18 | * The loop is run every 5 seconds (STM32L0.deepsleep() to 19 | * put STM32L0 into STOP mode). Every 60 seconds the current 20 | * log file is printed out. 21 | * 22 | * This example code is in the public domain. 23 | */ 24 | 25 | #include "DOSFS.h" 26 | #include "STM32L0.h" 27 | 28 | int mySamples; 29 | float myTemperature; 30 | File myFile; 31 | 32 | void setup ( void ) 33 | { 34 | Serial.begin(9600); 35 | 36 | while (!Serial) { } 37 | 38 | DOSFS.begin(); 39 | 40 | DOSFS.remove("data.txt"); 41 | 42 | mySamples = 0; 43 | 44 | } 45 | 46 | void loop( void ) 47 | { 48 | myTemperature = STM32L0.getTemperature(); 49 | 50 | myFile = DOSFS.open("data.txt", "a+"); 51 | 52 | if (myFile) 53 | { 54 | myFile.println(myTemperature); 55 | myFile.close(); 56 | } 57 | 58 | mySamples++; 59 | 60 | if ((mySamples % 12) == 0) 61 | { 62 | myFile = DOSFS.open("data.txt", "r"); 63 | 64 | if (myFile) 65 | { 66 | Serial.println(); 67 | Serial.println(); 68 | Serial.println(mySamples); 69 | while (myFile.available()) 70 | { 71 | Serial.write(myFile.read()); 72 | } 73 | 74 | myFile.close(); 75 | } 76 | } 77 | 78 | STM32L0.deepsleep(5000); 79 | } 80 | 81 | 82 | -------------------------------------------------------------------------------- /libraries/DOSFS/examples/DOSFS_Directories/DOSFS_Directories.ino: -------------------------------------------------------------------------------- 1 | /* DOSFS basic directories example 2 | * 3 | * This example shows how to list files and subdirectories on a DOSFS filesystem 4 | * 5 | * This example code is in the public domain. 6 | */ 7 | 8 | #include 9 | 10 | File myFile; 11 | 12 | void setup ( void ) 13 | { 14 | Serial.begin(9600); 15 | 16 | while (!Serial) { } 17 | 18 | DOSFS.begin(); 19 | 20 | myFile = DOSFS.open("a.txt", "w"); 21 | myFile.close(); 22 | 23 | myFile = DOSFS.open("b.txt", "w"); 24 | myFile.close(); 25 | 26 | myFile = DOSFS.open("c.txt", "w"); 27 | myFile.close(); 28 | 29 | DOSFS.mkdir("d"); 30 | 31 | myFile = DOSFS.open("d/e0.txt", "w"); 32 | myFile.close(); 33 | 34 | myFile = DOSFS.open("d/e1.txt", "w"); 35 | myFile.close(); 36 | 37 | DOSFS.mkdir("d/e2"); 38 | 39 | myFile = DOSFS.open("d/e2/f00.txt", "w"); 40 | myFile.close(); 41 | 42 | myFile = DOSFS.open("g.txt", "w"); 43 | myFile.close(); 44 | 45 | String root = String("/"); 46 | 47 | printDir(root, 0); 48 | 49 | Serial.println("Done."); 50 | } 51 | 52 | void loop( void ) 53 | { 54 | } 55 | 56 | DirEntry entry; 57 | 58 | void printDir(const String &path, int ident) 59 | { 60 | String subdirectory; 61 | Dir dir; 62 | 63 | dir = DOSFS.openDir(path); 64 | 65 | if (dir) 66 | { 67 | while (dir.read(entry)) 68 | { 69 | for (int i = 0; i < ident; i++) 70 | { 71 | Serial.print(" "); 72 | } 73 | 74 | Serial.print(entry.fileName()); 75 | 76 | if (entry.isDirectory()) 77 | { 78 | Serial.println(); 79 | 80 | if ((entry.fileName() != ".") && (entry.fileName() != "..")) 81 | { 82 | subdirectory = path; 83 | 84 | if (path != "/") { 85 | subdirectory += "/"; 86 | } 87 | 88 | subdirectory += entry.fileName(); 89 | 90 | printDir(subdirectory, ident+2); 91 | } 92 | } 93 | else 94 | { 95 | Serial.print(", "); 96 | Serial.print(entry.fileSize()); 97 | Serial.println(); 98 | } 99 | } 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /libraries/DOSFS/examples/DOSFS_Files/DOSFS_Files.ino: -------------------------------------------------------------------------------- 1 | /* DOSFS basic file example 2 | * 3 | * This example shows how to create and destroy a DOSFS file 4 | * 5 | * Code adopted from the SD Library 6 | * 7 | * This example code is in the public domain. 8 | */ 9 | 10 | #include 11 | 12 | File myFile; 13 | 14 | void setup ( void ) 15 | { 16 | Serial.begin(9600); 17 | 18 | while (!Serial) { } 19 | 20 | 21 | DOSFS.begin(); 22 | 23 | if (DOSFS.exists("example.txt")) 24 | { 25 | Serial.println("Oops ... example.txt already exists."); 26 | } 27 | 28 | Serial.println("Creating example.txt..."); 29 | myFile = DOSFS.open("example.txt", "w"); 30 | myFile.close(); 31 | 32 | if (!DOSFS.exists("example.txt")) 33 | { 34 | Serial.println("example.txt doesn't exist."); 35 | } 36 | 37 | Serial.println("Removing example.txt..."); 38 | DOSFS.remove("example.txt"); 39 | 40 | if (DOSFS.exists("example.txt")) { 41 | Serial.println("Oops ... example.txt still exists."); 42 | } 43 | 44 | Serial.println("Done."); 45 | } 46 | 47 | void loop( void ) 48 | { 49 | } 50 | -------------------------------------------------------------------------------- /libraries/DOSFS/examples/DOSFS_ReadWrite/DOSFS_ReadWrite.ino: -------------------------------------------------------------------------------- 1 | /* DOSFS read/write 2 | * 3 | * This example shows how to read and write data to and from a DOSFS file 4 | * 5 | * Code adopted from the SD Library 6 | * 7 | * This example code is in the public domain. 8 | */ 9 | 10 | #include 11 | 12 | File myFile; 13 | 14 | void setup ( void ) 15 | { 16 | Serial.begin(9600); 17 | 18 | while (!Serial) { } 19 | 20 | 21 | DOSFS.begin(); 22 | 23 | myFile = DOSFS.open("test.txt", "w"); 24 | 25 | if (myFile) 26 | { 27 | Serial.println("Writing to test.txt..."); 28 | myFile.println("The Quick Brown Fox Jumps Over The Lazy Dog."); 29 | myFile.close(); 30 | } 31 | else 32 | { 33 | Serial.println("Error opening test.txt"); 34 | } 35 | 36 | myFile = DOSFS.open("test.txt", "r"); 37 | if (myFile) 38 | { 39 | Serial.println("Reading from test.txt... "); 40 | 41 | while (myFile.available()) 42 | { 43 | Serial.write(myFile.read()); 44 | } 45 | 46 | myFile.close(); 47 | } 48 | else 49 | { 50 | Serial.println("Error opening test.txt"); 51 | } 52 | 53 | Serial.println("Done"); 54 | } 55 | 56 | void loop( void ) 57 | { 58 | } 59 | 60 | 61 | -------------------------------------------------------------------------------- /libraries/DOSFS/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 | ####################################### 14 | # Instances (KEYWORD2) 15 | ####################################### 16 | 17 | ####################################### 18 | # Constants (LITERAL1) 19 | ####################################### 20 | 21 | -------------------------------------------------------------------------------- /libraries/DOSFS/library.properties: -------------------------------------------------------------------------------- 1 | name=DOSFS 2 | version=1.0 3 | author=Thomas Roell 4 | maintainer=Thomas Roell 5 | sentence=Implements a FAT12/FAT16/FAT32/VFAT file system for SDCARD & SFLASH devices 6 | paragraph= 7 | category=Data Storage 8 | url=http://www.arduino.cc/en/Reference/SD 9 | architectures=stm32l0 10 | -------------------------------------------------------------------------------- /libraries/DOSFS/src/DOSFS.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2018 Thomas Roell. All rights reserved. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to 6 | * deal with the Software without restriction, including without limitation the 7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | * sell copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * 1. Redistributions of source code must retain the above copyright notice, 12 | * this list of conditions and the following disclaimers. 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimers in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 3. Neither the name of Thomas Roell, nor the names of its contributors 17 | * may be used to endorse or promote products derived from this Software 18 | * without specific prior written permission. 19 | * 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | * CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 26 | * WITH THE SOFTWARE. 27 | */ 28 | 29 | #ifndef DOSFS_H 30 | #define DOSFS_H 31 | 32 | #include 33 | #include 34 | 35 | class DOSFSFileSystem final : public FileSystem 36 | { 37 | public: 38 | int begin(); 39 | void end(); 40 | bool check(); 41 | bool format(); 42 | 43 | File open(const char *path, const char *mode) override; 44 | Dir openDir(const char *path) override; 45 | bool exists(const char *path) override; 46 | bool remove(const char *path) override; 47 | bool mkdir(const char *path) override; 48 | bool rmdir(const char *path) override; 49 | 50 | using FileSystem::open; 51 | using FileSystem::openDir; 52 | using FileSystem::exists; 53 | using FileSystem::remove; 54 | using FileSystem::mkdir; 55 | using FileSystem::rmdir; 56 | }; 57 | 58 | extern DOSFSFileSystem DOSFS; 59 | 60 | #endif // DOSFS_H 61 | -------------------------------------------------------------------------------- /libraries/EEPROM/examples/eeprom_clear/eeprom_clear.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * EEPROM Clear 3 | * 4 | * Sets all of the bytes of the EEPROM to 0. 5 | * Please see eeprom_iteration for a more in depth 6 | * look at how to traverse the EEPROM. 7 | * 8 | * This example code is in the public domain. 9 | */ 10 | 11 | #include 12 | 13 | void setup() { 14 | // initialize the LED pin as an output. 15 | pinMode(13, OUTPUT); 16 | 17 | /*** 18 | Iterate through each byte of the EEPROM storage. 19 | 20 | Larger AVR processors have larger EEPROM sizes, E.g: 21 | - Arduno Duemilanove: 512b EEPROM storage. 22 | - Arduino Uno: 1kb EEPROM storage. 23 | - Arduino Mega: 4kb EEPROM storage. 24 | 25 | Rather than hard-coding the length, you should use the pre-provided length function. 26 | This will make your code portable to all AVR processors. 27 | ***/ 28 | 29 | for (int i = 0 ; i < EEPROM.length() ; i++) { 30 | EEPROM.write(i, 0); 31 | } 32 | 33 | // turn the LED on when we're done 34 | digitalWrite(13, HIGH); 35 | } 36 | 37 | void loop() { 38 | /** Empty loop. **/ 39 | } 40 | -------------------------------------------------------------------------------- /libraries/EEPROM/examples/eeprom_crc/eeprom_crc.ino: -------------------------------------------------------------------------------- 1 | /*** 2 | Written by Christopher Andrews. 3 | CRC algorithm generated by pycrc, MIT licence ( https://github.com/tpircher/pycrc ). 4 | 5 | A CRC is a simple way of checking whether data has changed or become corrupted. 6 | This example calculates a CRC value directly on the EEPROM values. 7 | The purpose of this example is to highlight how the EEPROM object can be used just like an array. 8 | ***/ 9 | 10 | #include 11 | #include 12 | 13 | void setup() { 14 | 15 | //Start serial 16 | Serial.begin(9600); 17 | while (!Serial) { 18 | ; // wait for serial port to connect. Needed for native USB port only 19 | } 20 | 21 | //Print length of data to run CRC on. 22 | Serial.print("EEPROM length: "); 23 | Serial.println(EEPROM.length()); 24 | 25 | //Print the result of calling eeprom_crc() 26 | Serial.print("CRC32 of EEPROM data: 0x"); 27 | Serial.println(eeprom_crc(), HEX); 28 | Serial.print("\n\nDone!"); 29 | } 30 | 31 | void loop() { 32 | /* Empty loop */ 33 | } 34 | 35 | unsigned long eeprom_crc(void) { 36 | 37 | const unsigned long crc_table[16] = { 38 | 0x00000000, 0x1db71064, 0x3b6e20c8, 0x26d930ac, 39 | 0x76dc4190, 0x6b6b51f4, 0x4db26158, 0x5005713c, 40 | 0xedb88320, 0xf00f9344, 0xd6d6a3e8, 0xcb61b38c, 41 | 0x9b64c2b0, 0x86d3d2d4, 0xa00ae278, 0xbdbdf21c 42 | }; 43 | 44 | unsigned long crc = ~0L; 45 | 46 | for (int index = 0 ; index < EEPROM.length() ; ++index) { 47 | crc = crc_table[(crc ^ EEPROM[index]) & 0x0f] ^ (crc >> 4); 48 | crc = crc_table[(crc ^ (EEPROM[index] >> 4)) & 0x0f] ^ (crc >> 4); 49 | crc = ~crc; 50 | } 51 | return crc; 52 | } 53 | -------------------------------------------------------------------------------- /libraries/EEPROM/examples/eeprom_get/eeprom_get.ino: -------------------------------------------------------------------------------- 1 | /*** 2 | eeprom_get example. 3 | 4 | This shows how to use the EEPROM.get() method. 5 | 6 | To pre-set the EEPROM data, run the example sketch eeprom_put. 7 | This sketch will run without it, however, the values shown 8 | will be shown from what ever is already on the EEPROM. 9 | 10 | This may cause the serial object to print out a large string 11 | of garbage if there is no null character inside one of the strings 12 | loaded. 13 | 14 | Written by Christopher Andrews 2015 15 | Released under MIT licence. 16 | ***/ 17 | 18 | #include 19 | 20 | void setup() { 21 | 22 | float f = 0.00f; //Variable to store data read from EEPROM. 23 | int eeAddress = 0; //EEPROM address to start reading from 24 | 25 | Serial.begin(9600); 26 | while (!Serial) { 27 | ; // wait for serial port to connect. Needed for native USB port only 28 | } 29 | Serial.print("Read float from EEPROM: "); 30 | 31 | //Get the float data from the EEPROM at position 'eeAddress' 32 | EEPROM.get(eeAddress, f); 33 | Serial.println(f, 3); //This may print 'ovf, nan' if the data inside the EEPROM is not a valid float. 34 | 35 | /*** 36 | As get also returns a reference to 'f', you can use it inline. 37 | E.g: Serial.print( EEPROM.get( eeAddress, f ) ); 38 | ***/ 39 | 40 | /*** 41 | Get can be used with custom structures too. 42 | I have separated this into an extra function. 43 | ***/ 44 | 45 | secondTest(); //Run the next test. 46 | } 47 | 48 | struct MyObject { 49 | float field1; 50 | byte field2; 51 | char name[10]; 52 | }; 53 | 54 | void secondTest() { 55 | int eeAddress = sizeof(float); //Move address to the next byte after float 'f'. 56 | 57 | MyObject customVar; //Variable to store custom object read from EEPROM. 58 | EEPROM.get(eeAddress, customVar); 59 | 60 | Serial.println("Read custom object from EEPROM: "); 61 | Serial.println(customVar.field1); 62 | Serial.println(customVar.field2); 63 | Serial.println(customVar.name); 64 | } 65 | 66 | void loop() { 67 | /* Empty loop */ 68 | } 69 | -------------------------------------------------------------------------------- /libraries/EEPROM/examples/eeprom_iteration/eeprom_iteration.ino: -------------------------------------------------------------------------------- 1 | /*** 2 | eeprom_iteration example. 3 | 4 | A set of example snippets highlighting the 5 | simplest methods for traversing the EEPROM. 6 | 7 | Running this sketch is not necessary, this is 8 | simply highlighting certain programming methods. 9 | 10 | Written by Christopher Andrews 2015 11 | Released under MIT licence. 12 | ***/ 13 | 14 | #include 15 | 16 | void setup() { 17 | 18 | /*** 19 | Iterate the EEPROM using a for loop. 20 | ***/ 21 | 22 | for (int index = 0 ; index < EEPROM.length() ; index++) { 23 | 24 | //Add one to each cell in the EEPROM 25 | EEPROM[ index ] += 1; 26 | } 27 | 28 | /*** 29 | Iterate the EEPROM using a while loop. 30 | ***/ 31 | 32 | int index = 0; 33 | 34 | while (index < EEPROM.length()) { 35 | 36 | //Add one to each cell in the EEPROM 37 | EEPROM[ index ] += 1; 38 | index++; 39 | } 40 | 41 | /*** 42 | Iterate the EEPROM using a do-while loop. 43 | ***/ 44 | 45 | int idx = 0; //Used 'idx' to avoid name conflict with 'index' above. 46 | 47 | do { 48 | 49 | //Add one to each cell in the EEPROM 50 | EEPROM[ idx ] += 1; 51 | idx++; 52 | } while (idx < EEPROM.length()); 53 | 54 | 55 | } //End of setup function. 56 | 57 | void loop() {} -------------------------------------------------------------------------------- /libraries/EEPROM/examples/eeprom_put/eeprom_put.ino: -------------------------------------------------------------------------------- 1 | /*** 2 | eeprom_put example. 3 | 4 | This shows how to use the EEPROM.put() method. 5 | Also, this sketch will pre-set the EEPROM data for the 6 | example sketch eeprom_get. 7 | 8 | Note, unlike the single byte version EEPROM.write(), 9 | the put method will use update semantics. As in a byte 10 | will only be written to the EEPROM if the data is actually 11 | different. 12 | 13 | Written by Christopher Andrews 2015 14 | Released under MIT licence. 15 | ***/ 16 | 17 | #include 18 | 19 | struct MyObject { 20 | float field1; 21 | byte field2; 22 | char name[10]; 23 | }; 24 | 25 | void setup() { 26 | 27 | Serial.begin(9600); 28 | while (!Serial) { 29 | ; // wait for serial port to connect. Needed for native USB port only 30 | } 31 | 32 | float f = 123.456f; //Variable to store in EEPROM. 33 | int eeAddress = 0; //Location we want the data to be put. 34 | 35 | 36 | //One simple call, with the address first and the object second. 37 | EEPROM.put(eeAddress, f); 38 | 39 | Serial.println("Written float data type!"); 40 | 41 | /** Put is designed for use with custom structures also. **/ 42 | 43 | //Data to store. 44 | MyObject customVar = { 45 | 3.14f, 46 | 65, 47 | "Working!" 48 | }; 49 | 50 | eeAddress += sizeof(float); //Move address to the next byte after float 'f'. 51 | 52 | EEPROM.put(eeAddress, customVar); 53 | Serial.print("Written custom data type! \n\nView the example sketch eeprom_get to see how you can retrieve the values!"); 54 | } 55 | 56 | void loop() { 57 | /* Empty loop */ 58 | } 59 | -------------------------------------------------------------------------------- /libraries/EEPROM/examples/eeprom_read/eeprom_read.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * EEPROM Read 3 | * 4 | * Reads the value of each byte of the EEPROM and prints it 5 | * to the computer. 6 | * This example code is in the public domain. 7 | */ 8 | 9 | #include 10 | 11 | // start reading from the first byte (address 0) of the EEPROM 12 | int address = 0; 13 | byte value; 14 | 15 | void setup() { 16 | // initialize serial and wait for port to open: 17 | Serial.begin(9600); 18 | while (!Serial) { 19 | ; // wait for serial port to connect. Needed for native USB port only 20 | } 21 | } 22 | 23 | void loop() { 24 | // read a byte from the current address of the EEPROM 25 | value = EEPROM.read(address); 26 | 27 | Serial.print(address); 28 | Serial.print("\t"); 29 | Serial.print(value, DEC); 30 | Serial.println(); 31 | 32 | /*** 33 | Advance to the next address, when at the end restart at the beginning. 34 | 35 | Larger AVR processors have larger EEPROM sizes, E.g: 36 | - Arduno Duemilanove: 512b EEPROM storage. 37 | - Arduino Uno: 1kb EEPROM storage. 38 | - Arduino Mega: 4kb EEPROM storage. 39 | 40 | Rather than hard-coding the length, you should use the pre-provided length function. 41 | This will make your code portable to all AVR processors. 42 | ***/ 43 | address = address + 1; 44 | if (address == EEPROM.length()) { 45 | address = 0; 46 | } 47 | 48 | /*** 49 | As the EEPROM sizes are powers of two, wrapping (preventing overflow) of an 50 | EEPROM address is also doable by a bitwise and of the length - 1. 51 | 52 | ++address &= EEPROM.length() - 1; 53 | ***/ 54 | 55 | delay(500); 56 | } 57 | -------------------------------------------------------------------------------- /libraries/EEPROM/examples/eeprom_update/eeprom_update.ino: -------------------------------------------------------------------------------- 1 | /*** 2 | EEPROM Update method 3 | 4 | Stores values read from analog input 0 into the EEPROM. 5 | These values will stay in the EEPROM when the board is 6 | turned off and may be retrieved later by another sketch. 7 | 8 | If a value has not changed in the EEPROM, it is not overwritten 9 | which would reduce the life span of the EEPROM unnecessarily. 10 | 11 | Released using MIT licence. 12 | ***/ 13 | 14 | #include 15 | 16 | /** the current address in the EEPROM (i.e. which byte we're going to write to next) **/ 17 | int address = 0; 18 | 19 | void setup() { 20 | /** EMpty setup **/ 21 | } 22 | 23 | void loop() { 24 | /*** 25 | need to divide by 4 because analog inputs range from 26 | 0 to 1023 and each byte of the EEPROM can only hold a 27 | value from 0 to 255. 28 | ***/ 29 | int val = analogRead(0) / 4; 30 | 31 | /*** 32 | Update the particular EEPROM cell. 33 | these values will remain there when the board is 34 | turned off. 35 | ***/ 36 | EEPROM.update(address, val); 37 | 38 | /*** 39 | The function EEPROM.update(address, val) is equivalent to the following: 40 | 41 | if( EEPROM.read(address) != val ){ 42 | EEPROM.write(address, val); 43 | } 44 | ***/ 45 | 46 | 47 | /*** 48 | Advance to the next address, when at the end restart at the beginning. 49 | 50 | Larger AVR processors have larger EEPROM sizes, E.g: 51 | - Arduno Duemilanove: 512b EEPROM storage. 52 | - Arduino Uno: 1kb EEPROM storage. 53 | - Arduino Mega: 4kb EEPROM storage. 54 | 55 | Rather than hard-coding the length, you should use the pre-provided length function. 56 | This will make your code portable to all AVR processors. 57 | ***/ 58 | address = address + 1; 59 | if (address == EEPROM.length()) { 60 | address = 0; 61 | } 62 | 63 | /*** 64 | As the EEPROM sizes are powers of two, wrapping (preventing overflow) of an 65 | EEPROM address is also doable by a bitwise and of the length - 1. 66 | 67 | ++address &= EEPROM.length() - 1; 68 | ***/ 69 | 70 | delay(100); 71 | } 72 | -------------------------------------------------------------------------------- /libraries/EEPROM/examples/eeprom_write/eeprom_write.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * EEPROM Write 3 | * 4 | * Stores values read from analog input 0 into the EEPROM. 5 | * These values will stay in the EEPROM when the board is 6 | * turned off and may be retrieved later by another sketch. 7 | */ 8 | 9 | #include 10 | 11 | /** the current address in the EEPROM (i.e. which byte we're going to write to next) **/ 12 | int addr = 0; 13 | 14 | void setup() { 15 | /** Empty setup. **/ 16 | } 17 | 18 | void loop() { 19 | /*** 20 | Need to divide by 4 because analog inputs range from 21 | 0 to 1023 and each byte of the EEPROM can only hold a 22 | value from 0 to 255. 23 | ***/ 24 | 25 | int val = analogRead(0) / 4; 26 | 27 | /*** 28 | Write the value to the appropriate byte of the EEPROM. 29 | these values will remain there when the board is 30 | turned off. 31 | ***/ 32 | 33 | EEPROM.write(addr, val); 34 | 35 | /*** 36 | Advance to the next address, when at the end restart at the beginning. 37 | 38 | Larger AVR processors have larger EEPROM sizes, E.g: 39 | - Arduno Duemilanove: 512b EEPROM storage. 40 | - Arduino Uno: 1kb EEPROM storage. 41 | - Arduino Mega: 4kb EEPROM storage. 42 | 43 | Rather than hard-coding the length, you should use the pre-provided length function. 44 | This will make your code portable to all AVR processors. 45 | ***/ 46 | addr = addr + 1; 47 | if (addr == EEPROM.length()) { 48 | addr = 0; 49 | } 50 | 51 | /*** 52 | As the EEPROM sizes are powers of two, wrapping (preventing overflow) of an 53 | EEPROM address is also doable by a bitwise and of the length - 1. 54 | 55 | ++addr &= EEPROM.length() - 1; 56 | ***/ 57 | 58 | 59 | delay(100); 60 | } 61 | -------------------------------------------------------------------------------- /libraries/EEPROM/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For EEPROM 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | EEPROM KEYWORD1 10 | EERef KEYWORD1 11 | EEPtr KEYWORD2 12 | 13 | ####################################### 14 | # Methods and Functions (KEYWORD2) 15 | ####################################### 16 | 17 | update KEYWORD2 18 | 19 | ####################################### 20 | # Constants (LITERAL1) 21 | ####################################### 22 | 23 | -------------------------------------------------------------------------------- /libraries/EEPROM/library.properties: -------------------------------------------------------------------------------- 1 | name=EEPROM 2 | version=2.0 3 | author=Arduino, Christopher Andrews 4 | maintainer=Thomas Roell 5 | sentence=Enables reading and writing to the permanent board storage. 6 | paragraph=This library allows to read and write data in a memory type, the EEPROM, that keeps its content also when the board is powered off. The amount of EEPROM available depends on the microcontroller type. 7 | category=Data Storage 8 | url=http://www.arduino.cc/en/Reference/EEPROM 9 | architectures=stm32l0 10 | 11 | -------------------------------------------------------------------------------- /libraries/FskRadio/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For FskRadio 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | FskRadio KEYWORD1 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | 15 | begin KEYWORD2 16 | end KEYWORD2 17 | busy KEYWORD2 18 | beginPacket KEYWORD2 19 | endPacket KEYWORD2 20 | sendPacket KEYWORD2 21 | receive KEYWORD2 22 | sense KEYWORD2 23 | standby KEYWORD2 24 | sleep KEYWORD2 25 | availableForWrite KEYWORD2 26 | flush KEYWORD2 27 | write KEYWORD2 28 | parsePacket KEYWORD2 29 | available KEYWORD2 30 | read KEYWORD2 31 | peek KEYWORD2 32 | purge KEYWORD2 33 | packetRssi KEYWORD2 34 | packetBroadcast KEYWORD2 35 | setFrequency KEYWORD2 36 | setTxPower KEYWORD2 37 | setDeviation KEYWORD2 38 | setBandwidth KEYWORD2 39 | setBandwidthAfc KEYWORD2 40 | setBitRate KEYWORD2 41 | setPreambleLength KEYWORD2 42 | setFixedPayloadLength KEYWORD2 43 | setMaxPayloadLength KEYWORD2 44 | setSyncTimeout KEYWORD2 45 | setSyncWord KEYWORD2 46 | setAddressFiltering KEYWORD2 47 | setNodeAddress KEYWORD2 48 | setBroadcastAddress KEYWORD2 49 | setModulation KEYWORD2 50 | setLnaBoost KEYWORD2 51 | enableAfc KEYWORD2 52 | disableAfc KEYWORD2 53 | enableWhitening KEYWORD2 54 | disableWhitening KEYWORD2 55 | enableCrc KEYWORD2 56 | disableCrc KEYWORD2 57 | setIdleMode KEYWORD2 58 | onReceive KEYWORD2 59 | onTransmit KEYWORD2 60 | enableWakeup KEYWORD2 61 | disableWakeup KEYWORD2 62 | 63 | ####################################### 64 | # Constants (LITERAL1) 65 | ####################################### 66 | 67 | FSK LITERAL1 68 | GFSK_BT_0_3 LITERAL1 69 | GFSK_BT_0_5 LITERAL1 70 | GFSK_BT_1_0 LITERAL1 71 | FILTERING_NONE LITERAL1 72 | FILTERING_NODE LITERAL1 73 | FILTERING_NODE_AND_BROADCAST LITERAL1 74 | 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /libraries/FskRadio/library.properties: -------------------------------------------------------------------------------- 1 | name=FskRadio 2 | version=1.0.0 3 | author=Thomas Roell 4 | maintainer=grumpyoldpizza@gmail.com 5 | sentence=FskRadio for STM32L0 6 | paragraph=Provides APIs to communicate via the FSK Radio (SX1272/SX1276) 7 | category=Communication 8 | url= 9 | architectures=stm32l0 10 | -------------------------------------------------------------------------------- /libraries/GNSS/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For GNSS 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | GNSSLocation KEYWORD1 10 | GNSSSatellites KEYWORD1 11 | 12 | ####################################### 13 | # Methods and Functions (KEYWORD2) 14 | ####################################### 15 | 16 | begin KEYWORD2 17 | end KEYWORD2 18 | setAntenna KEYWORD2 19 | setPPS KEYWORD2 20 | setConstellation KEYWORD2 21 | setSBAS KEYWORD2 22 | setQZSS KEYWORD2 23 | setAutonomous KEYWORD2 24 | setPlatform KEYWORD2 25 | setPeriodic KEYWORD2 26 | suspend KEYWORD2 27 | resume KEYWORD2 28 | busy KEYWORD2 29 | location KEYWORD2 30 | satellites KEYWORD2 31 | onLocation KEYWORD2 32 | onLocation KEYWORD2 33 | onSatellites KEYWORD2 34 | onSatellites KEYWORD2 35 | enableWakeup KEYWORD2 36 | disableWakeup KEYWORD2 37 | 38 | ####################################### 39 | # Instances (KEYWORD2) 40 | ####################################### 41 | 42 | GNSS KEYWORD2 43 | 44 | ####################################### 45 | # Constants (LITERAL1) 46 | ####################################### 47 | 48 | MODE_NMEA LITERAL1 49 | MODE_UBLOX LITERAL1 50 | RATE_1HZ LITERAL1 51 | RATE_5HZ LITERAL1 52 | RATE_10HZ LITERAL1 53 | ANTENNA_INTERNAL LITERAL1 54 | ANTENNA_EXTERNAL LITERAL1 55 | CONSTELLATION_GPS LITERAL1 56 | CONSTELLATION_GPS_AND_GLONASS LITERAL1 57 | 58 | 59 | -------------------------------------------------------------------------------- /libraries/GNSS/library.properties: -------------------------------------------------------------------------------- 1 | name=GNSS 2 | version=1.0 3 | author=Thomas Roell 4 | maintainer=grumpyoldpizza@gmail.com 5 | sentence=Handles an attached GNSS. Specific implementation for STM32L4. 6 | paragraph= 7 | category=Sensors 8 | url=http://www.arduino.cc/en/Reference/GNSS 9 | architectures=stm32l4 10 | -------------------------------------------------------------------------------- /libraries/LoRaRadio/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For LoRaRadio 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | LoRaRadio KEYWORD1 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | 15 | begin KEYWORD2 16 | end KEYWORD2 17 | busy KEYWORD2 18 | cadDetected KEYWORD2 19 | beginPacket KEYWORD2 20 | endPacket KEYWORD2 21 | sendPacket KEYWORD2 22 | receive KEYWORD2 23 | cad KEYWORD2 24 | sense KEYWORD2 25 | standby KEYWORD2 26 | stop KEYWORD2 27 | availableForWrite KEYWORD2 28 | flush KEYWORD2 29 | write KEYWORD2 30 | parsePacket KEYWORD2 31 | available KEYWORD2 32 | read KEYWORD2 33 | peek KEYWORD2 34 | purge KEYWORD2 35 | packetRssi KEYWORD2 36 | packetSnr KEYWORD2 37 | setFrequency KEYWORD2 38 | setTxPower KEYWORD2 39 | setBandwidth KEYWORD2 40 | setSpreadingFactor KEYWORD2 41 | setCodingRate KEYWORD2 42 | setPreambleLength KEYWORD2 43 | setFixedPayloadLength KEYWORD2 44 | setSymbolTimeout KEYWORD2 45 | setIQInverted KEYWORD2 46 | setPublicNetwork KEYWORD2 47 | setLnaBoost KEYWORD2 48 | enableCrc KEYWORD2 49 | disableCrc KEYWORD2 50 | setIdleMode KEYWORD2 51 | onReceive KEYWORD2 52 | onTransmit KEYWORD2 53 | onCad KEYWORD2 54 | enableWakeup KEYWORD2 55 | disableWakeup KEYWORD2 56 | 57 | ####################################### 58 | # Constants (LITERAL1) 59 | ####################################### 60 | 61 | BW_125 LITERAL1 62 | BW_250 LITERAL1 63 | BW_500 LITERAL1 64 | SF_7 LITERAL1 65 | SF_8 LITERAL1 66 | SF_9 LITERAL1 67 | SF_10 LITERAL1 68 | SF_11 LITERAL1 69 | SF_12 LITERAL1 70 | CR_4_5 LITERAL1 71 | CR_4_6 LITERAL1 72 | CR_4_7 LITERAL1 73 | CR_4_8 LITERAL1 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /libraries/LoRaRadio/library.properties: -------------------------------------------------------------------------------- 1 | name=LoRaRadio 2 | version=1.0.0 3 | author=Thomas Roell 4 | maintainer=grumpyoldpizza@gmail.com 5 | sentence=LoRaRadio for STM32L0 6 | paragraph=Provides APIs to communicate via the LoRa Radio (SX1272/SX1276) 7 | category=Communication 8 | url= 9 | architectures=stm32l0 10 | -------------------------------------------------------------------------------- /libraries/LoRaWAN/examples/LoRaWAN_Join_ABP/LoRaWAN_Join_ABP.ino: -------------------------------------------------------------------------------- 1 | /* Simple ABP join for a LoRaWAN network 2 | * 3 | * In setup() below please replace the argument to LoRaWAN.begin() 4 | * with your appropriate region specific band: 5 | * 6 | * AS923 7 | * AU915 8 | * EU868 9 | * IN865 10 | * KR920 11 | * US915 12 | * 13 | * AU915/US915 networks have 64+8 channels. Typical gateways support only 14 | * 8 (9) channels. Hence it's a good idea to pick the proper channel 15 | * subset via select via LoRaWAN.setSubBand(), 16 | * 17 | * EU868/IN865 have duty cycle restrictions. For debugging it makes sense 18 | * to disable those via setDutyCycle(false); 19 | * 20 | * For an external antenna one should set the proper antenna gain 21 | * (default is 2.0) via setAntennaGain(). 22 | * 23 | * Please edit the keys below as they are just debugging samples. 24 | * 25 | * 26 | * This example code is in the public domain. 27 | */ 28 | 29 | #include "LoRaWAN.h" 30 | 31 | const char *devAddr = "0100000A"; 32 | const char *nwkSKey = "2B7E151628AED2A6ABF7158809CF4F3C"; 33 | const char *appSKey = "2B7E151628AED2A6ABF7158809CF4F3C"; 34 | 35 | void setup( void ) 36 | { 37 | Serial.begin(9600); 38 | 39 | while (!Serial) { } 40 | 41 | LoRaWAN.begin(US915); 42 | // LoRaWAN.setSubBand(2); 43 | // LoRaWAN.setDutyCycle(false); 44 | // LoRaWAN.setAntennaGain(2.0); 45 | LoRaWAN.joinABP(devAddr, nwkSKey, appSKey); 46 | 47 | Serial.println("JOIN( )"); 48 | } 49 | 50 | void loop( void ) 51 | { 52 | if (LoRaWAN.joined() && !LoRaWAN.busy()) 53 | { 54 | Serial.print("TRANSMIT( "); 55 | Serial.print("TimeOnAir: "); 56 | Serial.print(LoRaWAN.getTimeOnAir()); 57 | Serial.print(", NextTxTime: "); 58 | Serial.print(LoRaWAN.getNextTxTime()); 59 | Serial.print(", MaxPayloadSize: "); 60 | Serial.print(LoRaWAN.getMaxPayloadSize()); 61 | Serial.print(", DR: "); 62 | Serial.print(LoRaWAN.getDataRate()); 63 | Serial.print(", TxPower: "); 64 | Serial.print(LoRaWAN.getTxPower(), 1); 65 | Serial.print("dbm, UpLinkCounter: "); 66 | Serial.print(LoRaWAN.getUpLinkCounter()); 67 | Serial.print(", DownLinkCounter: "); 68 | Serial.print(LoRaWAN.getDownLinkCounter()); 69 | Serial.println(" )"); 70 | 71 | LoRaWAN.beginPacket(); 72 | LoRaWAN.write(0xef); 73 | LoRaWAN.write(0xbe); 74 | LoRaWAN.write(0xad); 75 | LoRaWAN.write(0xde); 76 | LoRaWAN.endPacket(); 77 | } 78 | 79 | delay(10000); 80 | } 81 | -------------------------------------------------------------------------------- /libraries/LoRaWAN/examples/LoRaWAN_Join_Commissioning/LoRaWAN_Join_Commissioning.ino: -------------------------------------------------------------------------------- 1 | /* Simple OTAA join via commissioning in EEPROM 2 | * 3 | * The code below assumes that you first saved the commissioning data 4 | * in EEPROM via the LoRaWAN_Save_Commissioning.ino example. They key 5 | * idea that you can moves the euis/keys out of the main sketch. 6 | * 7 | * 8 | * In setup() below please replace the argument to LoRaWAN.begin() 9 | * with your appropriate region specific band: 10 | * 11 | * AS923 12 | * AU915 13 | * EU868 14 | * IN865 15 | * KR920 16 | * US915 17 | * 18 | * AU915/US915 networks have 64+8 channels. Typical gateways support only 19 | * 8 (9) channels. Hence it's a good idea to pick the proper channel 20 | * subset via select via LoRaWAN.setSubBand(), 21 | * 22 | * EU868/IN865 have duty cycle restrictions. For debugging it makes sense 23 | * to disable those via setDutyCycle(false); 24 | * 25 | * For an external antenna one should set the proper antenna gain 26 | * (default is 2.0) via setAntennaGain(). 27 | * 28 | * Please edit the keys below as they are just debugging samples. 29 | * 30 | * 31 | * This example code is in the public domain. 32 | */ 33 | 34 | #include "LoRaWAN.h" 35 | 36 | void setup( void ) 37 | { 38 | Serial.begin(9600); 39 | 40 | while (!Serial) { } 41 | 42 | LoRaWAN.begin(US915); 43 | // LoRaWAN.setSubBand(2); 44 | // LoRaWAN.setDutyCycle(false); 45 | // LoRaWAN.setAntennaGain(2.0); 46 | LoRaWAN.joinOTAA(); 47 | 48 | Serial.println("JOIN( )"); 49 | } 50 | 51 | void loop( void ) 52 | { 53 | if (LoRaWAN.joined() && !LoRaWAN.busy()) 54 | { 55 | Serial.print("TRANSMIT( "); 56 | Serial.print("TimeOnAir: "); 57 | Serial.print(LoRaWAN.getTimeOnAir()); 58 | Serial.print(", NextTxTime: "); 59 | Serial.print(LoRaWAN.getNextTxTime()); 60 | Serial.print(", MaxPayloadSize: "); 61 | Serial.print(LoRaWAN.getMaxPayloadSize()); 62 | Serial.print(", DR: "); 63 | Serial.print(LoRaWAN.getDataRate()); 64 | Serial.print(", TxPower: "); 65 | Serial.print(LoRaWAN.getTxPower(), 1); 66 | Serial.print("dbm, UpLinkCounter: "); 67 | Serial.print(LoRaWAN.getUpLinkCounter()); 68 | Serial.print(", DownLinkCounter: "); 69 | Serial.print(LoRaWAN.getDownLinkCounter()); 70 | Serial.println(" )"); 71 | 72 | LoRaWAN.beginPacket(); 73 | LoRaWAN.write(0xef); 74 | LoRaWAN.write(0xbe); 75 | LoRaWAN.write(0xad); 76 | LoRaWAN.write(0xde); 77 | LoRaWAN.endPacket(); 78 | } 79 | 80 | delay(10000); 81 | } 82 | -------------------------------------------------------------------------------- /libraries/LoRaWAN/examples/LoRaWAN_Join_OTAA/LoRaWAN_Join_OTAA.ino: -------------------------------------------------------------------------------- 1 | /* Simple OTAA join for a LoRaWAN network 2 | * 3 | * In setup() below please replace the argument to LoRaWAN.begin() 4 | * with your appropriate region specific band: 5 | * 6 | * AS923 7 | * AU915 8 | * EU868 9 | * IN865 10 | * KR920 11 | * US915 12 | * 13 | * AU915/US915 networks have 64+8 channels. Typical gateways support only 14 | * 8 (9) channels. Hence it's a good idea to pick the proper channel 15 | * subset via select via LoRaWAN.setSubBand(), 16 | * 17 | * EU868/IN865 have duty cycle restrictions. For debugging it makes sense 18 | * to disable those via setDutyCycle(false); 19 | * 20 | * For an external antenna one should set the proper antenna gain 21 | * (default is 2.0) via setAntennaGain(). 22 | * 23 | * Please edit the keys below as they are just debugging samples. 24 | * 25 | * 26 | * This example code is in the public domain. 27 | */ 28 | 29 | #include "LoRaWAN.h" 30 | 31 | const char *appEui = "0101010101010101"; 32 | const char *appKey = "2B7E151628AED2A6ABF7158809CF4F3C"; 33 | const char *devEui = "0101010101010101"; 34 | 35 | void setup( void ) 36 | { 37 | Serial.begin(9600); 38 | 39 | while (!Serial) { } 40 | 41 | LoRaWAN.begin(US915); 42 | // LoRaWAN.setSubBand(2); 43 | // LoRaWAN.setDutyCycle(false); 44 | // LoRaWAN.setAntennaGain(2.0); 45 | LoRaWAN.joinOTAA(appEui, appKey, devEui); 46 | 47 | Serial.println("JOIN( )"); 48 | } 49 | 50 | void loop( void ) 51 | { 52 | if (LoRaWAN.joined() && !LoRaWAN.busy()) 53 | { 54 | Serial.print("TRANSMIT( "); 55 | Serial.print("TimeOnAir: "); 56 | Serial.print(LoRaWAN.getTimeOnAir()); 57 | Serial.print(", NextTxTime: "); 58 | Serial.print(LoRaWAN.getNextTxTime()); 59 | Serial.print(", MaxPayloadSize: "); 60 | Serial.print(LoRaWAN.getMaxPayloadSize()); 61 | Serial.print(", DR: "); 62 | Serial.print(LoRaWAN.getDataRate()); 63 | Serial.print(", TxPower: "); 64 | Serial.print(LoRaWAN.getTxPower(), 1); 65 | Serial.print("dbm, UpLinkCounter: "); 66 | Serial.print(LoRaWAN.getUpLinkCounter()); 67 | Serial.print(", DownLinkCounter: "); 68 | Serial.print(LoRaWAN.getDownLinkCounter()); 69 | Serial.println(" )"); 70 | 71 | LoRaWAN.beginPacket(); 72 | LoRaWAN.write(0xef); 73 | LoRaWAN.write(0xbe); 74 | LoRaWAN.write(0xad); 75 | LoRaWAN.write(0xde); 76 | LoRaWAN.endPacket(); 77 | } 78 | 79 | delay(10000); 80 | } 81 | -------------------------------------------------------------------------------- /libraries/LoRaWAN/examples/LoRaWAN_Save_Commissioning/LoRaWAN_Save_Commissioning.ino: -------------------------------------------------------------------------------- 1 | /* Save commissioning data to EEPROM for later reuse. 2 | * 3 | * Please edit the keys below as they are just debugging samples. 4 | * 5 | * 6 | * This example code is in the public domain. 7 | */ 8 | 9 | #include "LoRaWAN.h" 10 | 11 | const char *appEui = "0101010101010101"; 12 | const char *appKey = "2B7E151628AED2A6ABF7158809CF4F3C"; 13 | const char *devEui = "0101010101010101"; 14 | const char *devAddr = "0100000A"; 15 | const char *nwkSKey = "2B7E151628AED2A6ABF7158809CF4F3C"; 16 | const char *appSKey = "2B7E151628AED2A6ABF7158809CF4F3C"; 17 | 18 | void setup( void ) 19 | { 20 | LoRaWAN.setAppEui(appEui); 21 | LoRaWAN.setAppKey(appKey); 22 | LoRaWAN.setDevEui(devEui); 23 | LoRaWAN.setDevAddr(devAddr); 24 | LoRaWAN.setNwkSKey(nwkSKey); 25 | LoRaWAN.setAppSKey(appSKey); 26 | } 27 | 28 | void loop( void ) 29 | { 30 | } 31 | -------------------------------------------------------------------------------- /libraries/LoRaWAN/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For LoRaWAN 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | LoRaWAN KEYWORD1 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | 15 | begin KEYWORD2 16 | joinOTAA KEYWORD2 17 | rejoinOTAA KEYWORD2 18 | joinABP KEYWORD2 19 | joined KEYWORD2 20 | confirmed KEYWORD2 21 | pending KEYWORD2 22 | busy KEYWORD2 23 | beginPacket KEYWORD2 24 | endPacket KEYWORD2 25 | sendPacket KEYWORD2 26 | linkCheck KEYWORD2 27 | ping KEYWORD2 28 | availableForWrite KEYWORD2 29 | write KEYWORD2 30 | parsePacket KEYWORD2 31 | available KEYWORD2 32 | read KEYWORD2 33 | peek KEYWORD2 34 | flush KEYWORD2 35 | remotePort KEYWORD2 36 | lastRSSI KEYWORD2 37 | lastSNR KEYWORD2 38 | linkMargin KEYWORD2 39 | linkGateways KEYWORD2 40 | onJoin KEYWORD2 41 | onLinkCheck KEYWORD2 42 | onReceive KEYWORD2 43 | onTransmit KEYWORD2 44 | enableWakeup KEYWORD2 45 | disableWakeup KEYWORD2 46 | setDevEui KEYWORD2 47 | setAppEui KEYWORD2 48 | setAppKey KEYWORD2 49 | setDevAddr KEYWORD2 50 | setNwkSKey KEYWORD2 51 | setAppSKey KEYWORD2 52 | setDevEui KEYWORD2 53 | getNextTxTime KEYWORD2 54 | getMaxPayloadSize KEYWORD2 55 | getDataRate KEYWORD2 56 | getTxPower KEYWORD2 57 | getRepeat KEYWORD2 58 | getTimeOnAir KEYWORD2 59 | getUpLinkCounter KEYWORD2 60 | getDownLinkCounter KEYWORD2 61 | setJoinDelay1 KEYWORD2 62 | setJoinDelay2 KEYWORD2 63 | setJoinRetries KEYWORD2 64 | setADR KEYWORD2 65 | setDataRate KEYWORD2 66 | setTxPower KEYWORD2 67 | setRepeat KEYWORD2 68 | setRetries KEYWORD2 69 | setPublicNetwork KEYWORD2 70 | setSubBand KEYWORD2 71 | setReceiveDelay KEYWORD2 72 | setRX1DrOffset KEYWORD2 73 | setRX2Channel KEYWORD2 74 | addChannel KEYWORD2 75 | removeChannel KEYWORD2 76 | enableChannel KEYWORD2 77 | disableChannel KEYWORD2 78 | setDownLinkChannel KEYWORD2 79 | setUpLinkDwellTime KEYWORD2 80 | setDownLinkDwellTime KEYWORD2 81 | setMaxEIRP KEYWORD2 82 | setAntennaGain KEYWORD2 83 | setDutyCycle KEYWORD2 84 | setRxWindows KEYWORD2 85 | setTxContinuousWave KEYWORD2 86 | setComplianceTest KEYWORD2 87 | setBatteryLevel KEYWORD2 88 | 89 | ####################################### 90 | # Constants (LITERAL1) 91 | ####################################### 92 | 93 | AS923 LITERAL1 94 | AU915 LITERAL1 95 | EU868 LITERAL1 96 | IN865 LITERAL1 97 | KR920 LITERAL1 98 | US915 LITERAL1 99 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /libraries/LoRaWAN/library.properties: -------------------------------------------------------------------------------- 1 | name=LoRaWAN 2 | version=1.1.0 3 | author=Thomas Roell 4 | maintainer=grumpyoldpizza@gmail.com 5 | sentence=LoRaWAN for STM32L0 6 | paragraph=Provides APIs to communicate with LoRa and LoraWAN networks 7 | category=Communication 8 | url= 9 | architectures=stm32l0 10 | -------------------------------------------------------------------------------- /libraries/RTC/examples/Epoch/Epoch.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Epoch time example for Arduino Zero and MKR1000 3 | 4 | Demonstrates how to set time using epoch for the Arduino Zero and MKR1000 5 | 6 | This example code is in the public domain 7 | 8 | created by Sandeep Mistry 9 | 31 Dec 2015 10 | modified 11 | 18 Feb 2016 12 | */ 13 | 14 | #include 15 | 16 | void setup() { 17 | Serial.begin(9600); 18 | 19 | RTC.setEpoch(1451606400); // Jan 1, 2016 20 | } 21 | 22 | void loop() { 23 | Serial.print("Unix time = "); 24 | Serial.println(RTC.getEpoch()); 25 | 26 | Serial.print("Seconds since Jan 1 2000 = "); 27 | Serial.println(RTC.getY2kEpoch()); 28 | 29 | // Print date... 30 | Serial.print(RTC.getDay()); 31 | Serial.print("/"); 32 | Serial.print(RTC.getMonth()); 33 | Serial.print("/"); 34 | Serial.print(RTC.getYear()); 35 | Serial.print("\t"); 36 | 37 | // ...and time 38 | print2digits(RTC.getHours()); 39 | Serial.print(":"); 40 | print2digits(RTC.getMinutes()); 41 | Serial.print(":"); 42 | print2digits(RTC.getSeconds()); 43 | 44 | Serial.println(); 45 | 46 | delay(1000); 47 | } 48 | 49 | void print2digits(int number) { 50 | if (number < 10) { 51 | Serial.print("0"); 52 | } 53 | Serial.print(number); 54 | } 55 | 56 | -------------------------------------------------------------------------------- /libraries/RTC/examples/SimpleRTC/SimpleRTC.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Simple RTC for Arduino Zero and MKR1000 3 | 4 | Demonstrates the use of the RTC library for the Arduino Zero and MKR1000 5 | 6 | This example code is in the public domain 7 | 8 | http://arduino.cc/en/Tutorial/SimpleRTC 9 | 10 | created by Arturo Guadalupi 11 | 15 Jun 2015 12 | modified 13 | 18 Feb 2016 14 | modified by Andrea Richetta 15 | 24 Aug 2016 16 | */ 17 | 18 | #include 19 | 20 | /* Change these values to set the current initial time */ 21 | const byte seconds = 0; 22 | const byte minutes = 0; 23 | const byte hours = 16; 24 | 25 | /* Change these values to set the current initial date */ 26 | const byte day = 15; 27 | const byte month = 6; 28 | const byte year = 15; 29 | 30 | void setup() 31 | { 32 | Serial.begin(9600); 33 | 34 | // Set the time 35 | RTC.setHours(hours); 36 | RTC.setMinutes(minutes); 37 | RTC.setSeconds(seconds); 38 | 39 | // Set the date 40 | RTC.setDay(day); 41 | RTC.setMonth(month); 42 | RTC.setYear(year); 43 | 44 | // you can use also 45 | //RTC.setTime(hours, minutes, seconds); 46 | //RTC.setDate(day, month, year); 47 | } 48 | 49 | void loop() 50 | { 51 | // Print date... 52 | print2digits(RTC.getDay()); 53 | Serial.print("/"); 54 | print2digits(RTC.getMonth()); 55 | Serial.print("/"); 56 | print2digits(RTC.getYear()); 57 | Serial.print(" "); 58 | 59 | // ...and time 60 | print2digits(RTC.getHours()); 61 | Serial.print(":"); 62 | print2digits(RTC.getMinutes()); 63 | Serial.print(":"); 64 | print2digits(RTC.getSeconds()); 65 | 66 | Serial.println(); 67 | 68 | delay(1000); 69 | } 70 | 71 | 72 | 73 | void print2digits(int number) { 74 | if (number < 10) { 75 | Serial.print("0"); // print a 0 before if the number is < than 10 76 | } 77 | Serial.print(number); 78 | } -------------------------------------------------------------------------------- /libraries/RTC/examples/SimpleRTCAlarm/SimpleRTCAlarm.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Simple RTC Alarm for Arduino Zero and MKR1000 3 | 4 | Demonstrates how to set an RTC alarm for the Arduino Zero and MKR1000 5 | 6 | This example code is in the public domain 7 | 8 | http://arduino.cc/en/Tutorial/SimpleRTCAlarm 9 | 10 | created by Arturo Guadalupi 11 | 25 Sept 2015 12 | 13 | modified 14 | 21 Oct 2015 15 | */ 16 | 17 | #include 18 | 19 | /* Change these values to set the current initial time */ 20 | const byte seconds = 0; 21 | const byte minutes = 0; 22 | const byte hours = 16; 23 | 24 | /* Change these values to set the current initial date */ 25 | const byte day = 25; 26 | const byte month = 9; 27 | const byte year = 15; 28 | 29 | void setup() 30 | { 31 | Serial.begin(9600); 32 | 33 | RTC.setTime(hours, minutes, seconds); 34 | RTC.setDate(day, month, year); 35 | 36 | RTC.setAlarmTime(16, 0, 10); 37 | RTC.enableAlarm(RTC.MATCH_HHMMSS); 38 | 39 | RTC.attachInterrupt(alarmMatch); 40 | } 41 | 42 | void loop() 43 | { 44 | 45 | } 46 | 47 | void alarmMatch() 48 | { 49 | Serial.println("Alarm Match!"); 50 | } 51 | -------------------------------------------------------------------------------- /libraries/RTC/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For RTC 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | RTC KEYWORD1 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | 15 | begin KEYWORD2 16 | 17 | getMilliSeconds KEYWORD2 18 | getSeconds KEYWORD2 19 | getMinutes KEYWORD2 20 | getHours KEYWORD2 21 | getDay KEYWORD2 22 | getMonth KEYWORD2 23 | getYear KEYWORD2 24 | getTime KEYWORD2 25 | getDate KEYWORD2 26 | getDateTime KEYWORD2 27 | 28 | setSeconds KEYWORD2 29 | setMinutes KEYWORD2 30 | setHours KEYWORD2 31 | setDay KEYWORD2 32 | setMonth KEYWORD2 33 | setYear KEYWORD2 34 | setTime KEYWORD2 35 | setDate KEYWORD2 36 | setDateTime KEYWORD2 37 | 38 | getEpoch KEYWORD2 39 | setEpoch KEYWORD2 40 | getY2kEpoch KEYWORD2 41 | setY2kEpoch KEYWORD2 42 | getGpsEpoch KEYWORD2 43 | setGpsEpoch KEYWORD2 44 | 45 | getAlarmSeconds KEYWORD2 46 | getAlarmMinutes KEYWORD2 47 | getAlarmHours KEYWORD2 48 | getAlarmDay KEYWORD2 49 | getAlarmMonth KEYWORD2 50 | getAlarmYear KEYWORD2 51 | getAlarmTime KEYWORD2 52 | getAlarmDate KEYWORD2 53 | getAlarmDateTime KEYWORD2 54 | 55 | setAlarmSeconds KEYWORD2 56 | setAlarmMinutes KEYWORD2 57 | setAlarmHours KEYWORD2 58 | setAlarmDay KEYWORD2 59 | setAlarmMonth KEYWORD2 60 | setAlarmYear KEYWORD2 61 | setAlarmTime KEYWORD2 62 | setAlarmDate KEYWORD2 63 | setAlarmDateTime KEYWORD2 64 | setAlarmEpoch KEYWORD2 65 | 66 | enableAlarm KEYWORD2 67 | disableAlarm KEYWORD2 68 | 69 | attachInterrupt KEYWORD2 70 | detachInterrupt KEYWORD2 71 | 72 | getTzOffset KEYWORD2 73 | setTzOffset KEYWORD2 74 | 75 | getUtcOffset KEYWORD2 76 | setUtcOffset KEYWORD2 77 | 78 | isConfigured KEYWORD2 79 | 80 | ####################################### 81 | # Constants (LITERAL1) 82 | ####################################### 83 | -------------------------------------------------------------------------------- /libraries/RTC/library.properties: -------------------------------------------------------------------------------- 1 | name=RTC 2 | version=1.0 3 | author=Thomas Roell 4 | maintainer=grumpyoldpizza@gmail.com 5 | sentence=Allows to use the RTC functionalities. 6 | paragraph=With this library you can use the RTC peripheral to program actions related to date and time. 7 | category=Timing 8 | url=http://www.arduino.cc/en/Reference/RTCZero 9 | architectures=stm32l0 10 | -------------------------------------------------------------------------------- /libraries/SPI/examples/DigitalPotControl/DigitalPotControl.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Digital Pot Control 3 | 4 | This example controls an Analog Devices AD5206 digital potentiometer. 5 | The AD5206 has 6 potentiometer channels. Each channel's pins are labeled 6 | A - connect this to voltage 7 | W - this is the pot's wiper, which changes when you set it 8 | B - connect this to ground. 9 | 10 | The AD5206 is SPI-compatible,and to command it, you send two bytes, 11 | one with the channel number (0 - 5) and one with the resistance value for the 12 | channel (0 - 255). 13 | 14 | The circuit: 15 | * All A pins of AD5206 connected to +5V 16 | * All B pins of AD5206 connected to ground 17 | * An LED and a 220-ohm resisor in series connected from each W pin to ground 18 | * CS - to digital pin 10 (SS pin) 19 | * SDI - to digital pin 11 (MOSI pin) 20 | * CLK - to digital pin 13 (SCK pin) 21 | 22 | created 10 Aug 2010 23 | by Tom Igoe 24 | 25 | Thanks to Heather Dewey-Hagborg for the original tutorial, 2005 26 | 27 | */ 28 | 29 | 30 | // inslude the SPI library: 31 | #include 32 | 33 | 34 | // set pin 10 as the slave select for the digital pot: 35 | const int slaveSelectPin = 10; 36 | 37 | void setup() { 38 | // set the slaveSelectPin as an output: 39 | pinMode (slaveSelectPin, OUTPUT); 40 | // initialize SPI: 41 | SPI.begin(); 42 | } 43 | 44 | void loop() { 45 | // go through the six channels of the digital pot: 46 | for (int channel = 0; channel < 6; channel++) { 47 | // change the resistance on this channel from min to max: 48 | for (int level = 0; level < 255; level++) { 49 | digitalPotWrite(channel, level); 50 | delay(10); 51 | } 52 | // wait a second at the top: 53 | delay(100); 54 | // change the resistance on this channel from max to min: 55 | for (int level = 0; level < 255; level++) { 56 | digitalPotWrite(channel, 255 - level); 57 | delay(10); 58 | } 59 | } 60 | 61 | } 62 | 63 | void digitalPotWrite(int address, int value) { 64 | // take the SS pin low to select the chip: 65 | digitalWrite(slaveSelectPin, LOW); 66 | // send in the address and value via SPI: 67 | SPI.transfer(address); 68 | SPI.transfer(value); 69 | // take the SS pin high to de-select the chip: 70 | digitalWrite(slaveSelectPin, HIGH); 71 | } 72 | -------------------------------------------------------------------------------- /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 | 15 | begin KEYWORD2 16 | end KEYWORD2 17 | usingInterrupt KEYWORD2 18 | notUsingInterrupt KEYWORD2 19 | beginTransaction KEYWORD2 20 | endTransaction KEYWORD2 21 | transfer KEYWORD2 22 | transfer16 KEYWORD2 23 | setBitOrder KEYWORD2 24 | setDataMode KEYWORD2 25 | setClockDivider KEYWORD2 26 | cancel KEYWORD2 27 | done KEYWORD2 28 | 29 | 30 | ####################################### 31 | # Constants (LITERAL1) 32 | ####################################### 33 | SPI_MODE0 LITERAL1 34 | SPI_MODE1 LITERAL1 35 | SPI_MODE2 LITERAL1 36 | SPI_MODE3 LITERAL1 37 | -------------------------------------------------------------------------------- /libraries/SPI/library.properties: -------------------------------------------------------------------------------- 1 | name=SPI 2 | version=1.0 3 | author=Jonathan BAUDIN, Thibaut VIARD, Arduino 4 | maintainer=Thomas Roell 5 | sentence=Enables the communication with devices that use the Serial Peripheral Interface (SPI) Bus. Specific implementation for STM32L0 6 | paragraph= 7 | category=Communication 8 | url=http://www.arduino.cc/en/Reference/SPI 9 | architectures=stm32l0 10 | -------------------------------------------------------------------------------- /libraries/STM32L0/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For STM32L0 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | STM32L0 KEYWORD1 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | 15 | getSerial KEYWORD2 16 | getUID KEYWORD2 17 | getDID KEYWORD2 18 | getVREF KEYWORD2 19 | getTemperature KEYWORD2 20 | resetCause KEYWORD2 21 | wakeupReason KEYWORD2 22 | enablePowerSave KEYWORD2 23 | disablePowerSave KEYWORD2 24 | wakeup KEYWORD2 25 | sleep KEYWORD2 26 | deepsleep KEYWORD2 27 | standby KEYWORD2 28 | reset KEYWORD2 29 | dfu KEYWORD2 30 | wdtEnable KEYWORD2 31 | wdtReset KEYWORD2 32 | flashErase KEYWORD2 33 | flashProgram KEYWORD2 34 | 35 | ####################################### 36 | # Constants (LITERAL1) 37 | ####################################### 38 | 39 | FLASHSTART LITERAL1 40 | FLASHEND LITERAL1 41 | -------------------------------------------------------------------------------- /libraries/STM32L0/library.properties: -------------------------------------------------------------------------------- 1 | name=STM32L0 2 | version=1.0 3 | author=Thomas Roell 4 | maintainer=grumpyoldpizza@gmail.com 5 | sentence=Allows to use the STM32L0 functionalities. 6 | paragraph=With this library you can use the system peripherals of STM32L0. 7 | category=Device Control 8 | url=http://www.arduino.cc/en/Reference/STM32L0 9 | architectures=stm32l0 10 | -------------------------------------------------------------------------------- /libraries/TimerMillis/examples/TimerMillis_Blink/TimerMillis_Blink.ino: -------------------------------------------------------------------------------- 1 | /* LED Blink via TimerMillis 2 | * 3 | * In setup, start the timerOn instance of the millisecond timer with no delay 4 | * and repeat every 2000 milliseconds. CallbackOn turns on the led then calls 5 | * the second instance of the millisecond timer with delay of 250 milliseconds 6 | * to execute once per call. 7 | * 8 | * Net effect is that the led is on for 250 millisconds every 2000 milliseconds 9 | * 10 | * This example code is in the public domain. 11 | */ 12 | 13 | #include "TimerMillis.h" 14 | 15 | TimerMillis timerOff; 16 | TimerMillis timerOn; 17 | 18 | void callbackOff(void) 19 | { 20 | digitalWrite(LED_BUILTIN, 0); 21 | } 22 | 23 | void callbackOn(void) 24 | { 25 | digitalWrite(LED_BUILTIN, 1); 26 | 27 | timerOff.start(callbackOff, 250); 28 | } 29 | 30 | void setup( void ) 31 | { 32 | pinMode(LED_BUILTIN, OUTPUT); 33 | digitalWrite(LED_BUILTIN, 0); 34 | 35 | timerOn.start(callbackOn, 0, 2000); 36 | } 37 | 38 | void loop( void ) 39 | { 40 | } 41 | -------------------------------------------------------------------------------- /libraries/TimerMillis/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For RTC 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | RTCZero KEYWORD1 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | 15 | getDay KEYWORD2 16 | getMonth KEYWORD2 17 | getYear KEYWORD2 18 | getHours KEYWORD2 19 | getMinutes KEYWORD2 20 | getSeconds KEYWORD2 21 | 22 | setDay KEYWORD2 23 | setMonth KEYWORD2 24 | setYear KEYWORD2 25 | setHours KEYWORD2 26 | setMinutes KEYWORD2 27 | setSeconds KEYWORD2 28 | setDate KEYWORD2 29 | setTime KEYWORD2 30 | 31 | getEpoch KEYWORD2 32 | getY2kEpoch KEYWORD2 33 | setEpoch KEYWORD2 34 | setY2kEpoch KEYWORD2 35 | 36 | getAlarmDay KEYWORD2 37 | getAlarmMonth KEYWORD2 38 | getAlarmYear KEYWORD2 39 | getAlarmHours KEYWORD2 40 | getAlarmMinutes KEYWORD2 41 | getAlarmSeconds KEYWORD2 42 | 43 | setAlarmDay KEYWORD2 44 | setAlarmMonth KEYWORD2 45 | setAlarmYear KEYWORD2 46 | setAlarmHours KEYWORD2 47 | setAlarmMinutes KEYWORD2 48 | setAlarmSeconds KEYWORD2 49 | setAlarmDate KEYWORD2 50 | setAlarmTime KEYWORD2 51 | 52 | enableAlarm KEYWORD2 53 | disableAlarm KEYWORD2 54 | 55 | ####################################### 56 | # Constants (LITERAL1) 57 | ####################################### 58 | -------------------------------------------------------------------------------- /libraries/TimerMillis/library.properties: -------------------------------------------------------------------------------- 1 | name=TimerMillis 2 | version=1.0 3 | author=Thomas Roell 4 | maintainer=grumpyoldpizza@gmail.com 5 | sentence=Allows to call functions with a given delay/period. 6 | paragraph=With this library you can have multiple timeout style callbacks. 7 | category=Timing 8 | url= 9 | architectures=stm32l0 10 | -------------------------------------------------------------------------------- /libraries/TimerMillis/src/TimerMillis.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2020 Thomas Roell. All rights reserved. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to 6 | * deal with the Software without restriction, including without limitation the 7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | * sell copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * 1. Redistributions of source code must retain the above copyright notice, 12 | * this list of conditions and the following disclaimers. 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimers in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 3. Neither the name of Thomas Roell, nor the names of its contributors 17 | * may be used to endorse or promote products derived from this Software 18 | * without specific prior written permission. 19 | * 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | * CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 26 | * WITH THE SOFTWARE. 27 | */ 28 | 29 | #ifndef _TIMERMILLIS_H 30 | #define _TIMERMILLIS_H 31 | 32 | #include "Arduino.h" 33 | #include "stm32l0_rtc.h" 34 | 35 | class TimerMillis { 36 | public: 37 | TimerMillis(); 38 | ~TimerMillis(); 39 | 40 | int start(void(*callback)(void), uint32_t delay, uint32_t period = 0); 41 | int start(Callback callback, uint32_t delay, uint32_t period = 0); 42 | int restart(uint32_t delay, uint32_t period = 0); 43 | int stop(); 44 | bool active(); 45 | 46 | private: 47 | stm32l0_rtc_timer_t _timer; 48 | uint64_t _clock; 49 | uint32_t _millis; 50 | uint32_t _period; 51 | Callback _callback; 52 | static void timeout(class TimerMillis *self); 53 | }; 54 | 55 | #endif // _TIMERMILLIS_H 56 | -------------------------------------------------------------------------------- /libraries/Wire/examples/Wire_Master/Wire_Master.ino: -------------------------------------------------------------------------------- 1 | /* Wire Master example (see Wire_Slave.ino for the master) 2 | * 3 | * The code in Wire_Slave.ino implements a simple slave 4 | * device that transmits a recurring data stream. Hence 5 | * first initialize the index into the stream, and then 6 | * read it in 8 byte chunks, and then print it. 7 | * 8 | * 9 | * This example code is in the public domain. 10 | */ 11 | 12 | #include "Wire.h" 13 | 14 | void setup() 15 | { 16 | Serial.begin(9600); 17 | 18 | while (!Serial) { } 19 | 20 | Wire.begin(); 21 | 22 | Wire.beginTransmission(0x7c); 23 | Wire.write(0x00); 24 | Wire.endTransmission(); 25 | } 26 | 27 | void loop() 28 | { 29 | int size; 30 | uint8_t data[8]; 31 | 32 | size = Wire.requestFrom(0x7c, 8); 33 | 34 | if (size) 35 | { 36 | Wire.read(data, size); 37 | Serial.write(data, size); 38 | } 39 | 40 | delay(500); 41 | } 42 | -------------------------------------------------------------------------------- /libraries/Wire/examples/Wire_Poll/Wire_Poll.ino: -------------------------------------------------------------------------------- 1 | /* Extended Wire Sensor example 2 | * 3 | * The code is using the proprietary Wire transfer interface 4 | * to communicate with a LPS22HB sensor and print temperature, 5 | * pressure samples every 10 seconds. 6 | * 7 | * Wire.transfer() to avoid intermediate buffer handling 8 | * within the Wire library. 9 | * 10 | * Since we official don't know the conversion time for 11 | * LPS22HB, the code simply polls the status register. 12 | * 13 | * This here is not meant to provide a useful library 14 | * or anything generic, it's just here to show how 15 | * to use the Wire library to communicate with LPS22HB. 16 | * 17 | * 18 | * This example code is in the public domain. 19 | */ 20 | 21 | #include "Wire.h" 22 | #include "TimerMillis.h" 23 | 24 | #define LPS22HB_I2C_ADDRESS 0x5C 25 | 26 | uint8_t lps22hb_data[5]; 27 | 28 | void setup() 29 | { 30 | Serial.begin(9600); 31 | 32 | while (!Serial) { } 33 | 34 | Wire.begin(); 35 | 36 | lps22hb_write_config(); 37 | } 38 | 39 | void loop() 40 | { 41 | float temperature, pressure; 42 | 43 | Wire.transfer(LPS22HB_I2C_ADDRESS, (const uint8_t[]){ 0x11, 0x11 }, 2, NULL, 0); 44 | 45 | do 46 | { 47 | Wire.transfer(LPS22HB_I2C_ADDRESS, (const uint8_t[]){ 0x27 }, 1, &lps22hb_data[0], 1); 48 | } 49 | while ((lps22hb_data[0] & 0x03) != 0x03); 50 | 51 | Wire.transfer(LPS22HB_I2C_ADDRESS, (const uint8_t[]){ 0x28 }, 1, &lps22hb_data[0], 5); 52 | 53 | temperature = (float)((int16_t)(((uint16_t)lps22hb_data[3] << 0) | ((uint16_t)lps22hb_data[4] << 8))) / 100.0; 54 | pressure = (float)((uint32_t)(((uint32_t)lps22hb_data[0] << 0) | ((uint32_t)lps22hb_data[1] << 8) | ((uint32_t)lps22hb_data[2] << 16))) / 4096.0; 55 | 56 | Serial.print("Temperature = "); 57 | Serial.print(temperature); 58 | Serial.println(" *C"); 59 | 60 | Serial.print("Pressure = "); 61 | Serial.print(pressure); 62 | Serial.println(" hPa"); 63 | 64 | Serial.println(); 65 | 66 | delay(10); 67 | } 68 | 69 | void lps22hb_write_config() 70 | { 71 | Wire.transfer(LPS22HB_I2C_ADDRESS, (const uint8_t[]){ 0x10, 0x02 }, 2, NULL, 0); 72 | Wire.transfer(LPS22HB_I2C_ADDRESS, (const uint8_t[]){ 0x11, 0x10 }, 2, NULL, 0); 73 | Wire.transfer(LPS22HB_I2C_ADDRESS, (const uint8_t[]){ 0x12, 0x04 }, 2, NULL, 0); 74 | } 75 | -------------------------------------------------------------------------------- /libraries/Wire/examples/Wire_Slave/Wire_Slave.ino: -------------------------------------------------------------------------------- 1 | /* Wire Slave example (see Wire_Master.ino for the master) 2 | * 3 | * The myReceiveCallback tracking the received data sets 4 | * tx_index into tx_data[], if only one byte had been 5 | * transferred. The myRequestCallback puts 32 bytes from 6 | * tx_data[] starting at tx_index into the transmit buffer. 7 | * Finally the myTransmitCallback adjusts tx_index with 8 | * the number of transferred bytes. 9 | * 10 | * The code roughly simluates a slave device with a FIFO. 11 | * Sunce the myRequestCallback cannot know how many bytes 12 | * need to be send, it fills up the buffer to the max. 13 | * Only at the myTransmitCallback the number of bytes 14 | * transmitted is known. 15 | * 16 | * 17 | * This example code is in the public domain. 18 | */ 19 | 20 | #include "Wire.h" 21 | 22 | int tx_index = 7; 23 | 24 | uint8_t tx_data[] = "The quick brown fox jumps over the lazy dog\r\n"; 25 | 26 | 27 | void myReceiveCallback(int count) 28 | { 29 | if (count == 1) 30 | { 31 | tx_index = Wire.read(); 32 | 33 | while (tx_index >= sizeof(tx_data)) 34 | { 35 | tx_index -= sizeof(tx_data); 36 | } 37 | } 38 | } 39 | 40 | void myRequestCallback(void) 41 | { 42 | for (int i = 0, n = tx_index; i < BUFFER_LENGTH; i++) 43 | { 44 | Wire.write(tx_data[n]); 45 | 46 | n++; 47 | 48 | if (n >= sizeof(tx_data)) { n = 0; } 49 | } 50 | } 51 | 52 | void myTransmitCallback(int count) 53 | { 54 | tx_index += count; 55 | 56 | while (tx_index >= sizeof(tx_data)) 57 | { 58 | tx_index -= sizeof(tx_data); 59 | } 60 | } 61 | 62 | void setup() 63 | { 64 | Wire.begin(0x7c); 65 | 66 | Wire.onReceive(myReceiveCallback); 67 | Wire.onRequest(myRequestCallback); 68 | Wire.onTransmit(myTransmitCallback); 69 | } 70 | 71 | void loop() 72 | { 73 | } 74 | -------------------------------------------------------------------------------- /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 | end KEYWORD2 15 | setClock KEYWORD2 16 | beginTransmission KEYWORD2 17 | endTransmission KEYWORD2 18 | requestFrom KEYWORD2 19 | onReceive KEYWORD2 20 | onRequest KEYWORD2 21 | onTransmit KEYWORD2 22 | setClockLowTimeout KEYWORD2 23 | isGeneralCall KEYWORD2 24 | transfer KEYWORD2 25 | reset KEYWORD2 26 | scan KEYWORD2 27 | suspend KEYWORD2 28 | resume KEYWORD2 29 | 30 | ####################################### 31 | # Instances (KEYWORD2) 32 | ####################################### 33 | 34 | Wire KEYWORD2 35 | Wire1 KEYWORD2 36 | 37 | ####################################### 38 | # Constants (LITERAL1) 39 | ####################################### 40 | 41 | -------------------------------------------------------------------------------- /libraries/Wire/library.properties: -------------------------------------------------------------------------------- 1 | name=Wire 2 | version=1.1 3 | author=Jonathan BAUDIN, Thibaut VIARD, Arduino 4 | maintainer=Thomas Roell 5 | sentence=Allows the communication between devices or sensors connected via Two Wire Interface Bus. Specific implementation for STM32L0 6 | paragraph= 7 | category=Communication 8 | url=http://www.arduino.cc/en/Reference/Wire 9 | architectures=stm32l0 10 | -------------------------------------------------------------------------------- /programmers.txt: -------------------------------------------------------------------------------- 1 | dfu.name=STM32 BOOTLOADER (STM32L0) 2 | dfu.communication=USB 3 | dfu.protocol=dfu 4 | dfu.program.protocol= 5 | dfu.program.tool=stm32l0_dfu 6 | dfu.program.extra_params= 7 | 8 | stlink.name=ST-Link V2/V3 (STM32L0) 9 | stlink.communication=USB 10 | stlink.protocol=stlink 11 | stlink.program.protocol= 12 | stlink.program.tool=stm32l0_openocd 13 | stlink.program.extra_params= 14 | -------------------------------------------------------------------------------- /system/CMSIS/Lib/libarm_cortexM0l_math.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GrumpyOldPizza/ArduinoCore-stm32l0/b1cf1cd6eba2f06bbe4edbe76aa43ae5971e8d8c/system/CMSIS/Lib/libarm_cortexM0l_math.a -------------------------------------------------------------------------------- /system/CMSIS/Lib/license.txt: -------------------------------------------------------------------------------- 1 | All pre-build libraries contained in the folders "ARM" and "GCC" 2 | are guided by the following license: 3 | 4 | Copyright (C) 2009-2014 ARM Limited. 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are met: 9 | - Redistributions of source code must retain the above copyright 10 | notice, this list of conditions and the following disclaimer. 11 | - Redistributions in binary form must reproduce the above copyright 12 | notice, this list of conditions and the following disclaimer in the 13 | documentation and/or other materials provided with the distribution. 14 | - Neither the name of ARM nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without 16 | specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE 22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /system/STM32L0xx/Include/armv6m.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2020 Thomas Roell. All rights reserved. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to 6 | * deal with the Software without restriction, including without limitation the 7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | * sell copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * 1. Redistributions of source code must retain the above copyright notice, 12 | * this list of conditions and the following disclaimers. 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimers in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 3. Neither the name of Thomas Roell, nor the names of its contributors 17 | * may be used to endorse or promote products derived from this Software 18 | * without specific prior written permission. 19 | * 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | * CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 26 | * WITH THE SOFTWARE. 27 | */ 28 | 29 | #if !defined(_ARMV6M_H) 30 | #define _ARMV6M_H 31 | 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | 38 | #include "stm32l0xx.h" 39 | 40 | #include "armv6m_atomic.h" 41 | #include "armv6m_core.h" 42 | #include "armv6m_pendsv.h" 43 | #include "armv6m_svcall.h" 44 | #include "armv6m_systick.h" 45 | #include "armv6m_work.h" 46 | 47 | #endif /* _ARMV6M_H */ 48 | -------------------------------------------------------------------------------- /system/STM32L0xx/Include/armv6m_systick.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2020 Thomas Roell. All rights reserved. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to 6 | * deal with the Software without restriction, including without limitation the 7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | * sell copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * 1. Redistributions of source code must retain the above copyright notice, 12 | * this list of conditions and the following disclaimers. 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimers in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 3. Neither the name of Thomas Roell, nor the names of its contributors 17 | * may be used to endorse or promote products derived from this Software 18 | * without specific prior written permission. 19 | * 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | * CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 26 | * WITH THE SOFTWARE. 27 | */ 28 | 29 | #if !defined(_ARMV6M_SYSTICK_H) 30 | #define _ARMV6M_SYSTICK_H 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | extern void __armv6m_systick_initialize(void); 37 | 38 | extern void armv6m_systick_enable(void); 39 | extern void armv6m_systick_disable(void); 40 | extern uint32_t armv6m_systick_micros(void); 41 | 42 | #ifdef __cplusplus 43 | } 44 | #endif 45 | 46 | #endif /* _ARMV6M_SYSTICK_H */ 47 | -------------------------------------------------------------------------------- /system/STM32L0xx/Include/armv6m_work.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019-2020 Thomas Roell. All rights reserved. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to 6 | * deal with the Software without restriction, including without limitation the 7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | * sell copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * 1. Redistributions of source code must retain the above copyright notice, 12 | * this list of conditions and the following disclaimers. 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimers in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 3. Neither the name of Thomas Roell, nor the names of its contributors 17 | * may be used to endorse or promote products derived from this Software 18 | * without specific prior written permission. 19 | * 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | * CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 26 | * WITH THE SOFTWARE. 27 | */ 28 | 29 | #if !defined(_ARMV6M_WORK_H) 30 | #define _ARMV6M_WORKD_H 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | typedef struct _armv6m_work_t { 37 | struct _armv6m_work_t * volatile next; 38 | armv6m_core_callback_t callback; 39 | } armv6m_work_t; 40 | 41 | #define ARMV6M_WORK_INIT(_routine, _context) { \ 42 | .callback.routine = (armv6m_core_routine_t)(_routine), \ 43 | .callback.context = (void*)(_context), \ 44 | } 45 | 46 | extern void __armv6m_work_initialize(void); 47 | 48 | extern void armv6m_work_create(armv6m_work_t *work, armv6m_core_routine_t routine, void *context); 49 | extern bool armv6m_work_destory(armv6m_work_t *work); 50 | extern bool armv6m_work_submit(armv6m_work_t *work); 51 | extern void armv6m_work_block(void); 52 | extern void armv6m_work_unblock(void); 53 | 54 | #ifdef __cplusplus 55 | } 56 | #endif 57 | 58 | #endif /* _ARMV6M_WORK_H */ 59 | -------------------------------------------------------------------------------- /system/STM32L0xx/Include/stm32l0_flash.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2018 Thomas Roell. All rights reserved. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to 6 | * deal with the Software without restriction, including without limitation the 7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | * sell copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * 1. Redistributions of source code must retain the above copyright notice, 12 | * this list of conditions and the following disclaimers. 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimers in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 3. Neither the name of Thomas Roell, nor the names of its contributors 17 | * may be used to endorse or promote products derived from this Software 18 | * without specific prior written permission. 19 | * 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | * CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 26 | * WITH THE SOFTWARE. 27 | */ 28 | 29 | #if !defined(_STM32L0_FLASH_H) 30 | #define _STM32L0_FLASH_H 31 | 32 | #include "armv6m.h" 33 | #include "stm32l0xx.h" 34 | 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | extern uint32_t stm32l0_flash_size(void); 40 | extern void stm32l0_flash_lock(void); 41 | extern bool stm32l0_flash_unlock(void); 42 | extern bool stm32l0_flash_erase(uint32_t address, uint32_t count); 43 | extern bool stm32l0_flash_program(uint32_t address, const uint8_t *data, uint32_t count); 44 | 45 | #ifdef __cplusplus 46 | } 47 | #endif 48 | 49 | #endif /* _STM32L0_FLASH_H */ 50 | -------------------------------------------------------------------------------- /system/STM32L0xx/Include/stm32l0_iwdg.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2018 Thomas Roell. All rights reserved. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to 6 | * deal with the Software without restriction, including without limitation the 7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | * sell copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * 1. Redistributions of source code must retain the above copyright notice, 12 | * this list of conditions and the following disclaimers. 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimers in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 3. Neither the name of Thomas Roell, nor the names of its contributors 17 | * may be used to endorse or promote products derived from this Software 18 | * without specific prior written permission. 19 | * 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | * CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 26 | * WITH THE SOFTWARE. 27 | */ 28 | 29 | #if !defined(_STM32L0_IWDG_H) 30 | #define _STM32L0_IWDG_H 31 | 32 | #include "armv6m.h" 33 | #include "stm32l0xx.h" 34 | 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | extern void stm32l0_iwdg_enable(uint32_t timeout); 40 | 41 | static inline void stm32l0_iwdg_reset(void) 42 | { 43 | IWDG->KR = 0xaaaa; 44 | } 45 | 46 | #ifdef __cplusplus 47 | } 48 | #endif 49 | 50 | #endif /* _STM32L0_IWDG_H */ 51 | -------------------------------------------------------------------------------- /system/STM32L0xx/Include/stm32l0_random.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2018 Thomas Roell. All rights reserved. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to 6 | * deal with the Software without restriction, including without limitation the 7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | * sell copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * 1. Redistributions of source code must retain the above copyright notice, 12 | * this list of conditions and the following disclaimers. 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimers in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 3. Neither the name of Thomas Roell, nor the names of its contributors 17 | * may be used to endorse or promote products derived from this Software 18 | * without specific prior written permission. 19 | * 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | * CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 26 | * WITH THE SOFTWARE. 27 | */ 28 | 29 | #if !defined(_STM32L0_RANDOM_H) 30 | #define _STM32L0_RANDOM_H 31 | 32 | #include "armv6m.h" 33 | #include "stm32l0xx.h" 34 | 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | extern bool stm32l0_random(uint8_t *data, uint32_t count); 40 | 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | #endif /* _STM32L0_RANDOM_H */ 46 | -------------------------------------------------------------------------------- /system/STM32L0xx/Include/stm32l0_usbd_msc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019-2020 Thomas Roell. All rights reserved. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to 6 | * deal with the Software without restriction, including without limitation the 7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | * sell copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * 1. Redistributions of source code must retain the above copyright notice, 12 | * this list of conditions and the following disclaimers. 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimers in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 3. Neither the name of Thomas Roell, nor the names of its contributors 17 | * may be used to endorse or promote products derived from this Software 18 | * without specific prior written permission. 19 | * 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | * CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 26 | * WITH THE SOFTWARE. 27 | */ 28 | 29 | #if !defined(_STM32L0_USBD_MSC_H) 30 | #define _STM32L0_USBD_MSC_H 31 | 32 | #include "stm32l0xx.h" 33 | 34 | #ifdef __cplusplus 35 | extern "C" { 36 | #endif 37 | 38 | #define STM32L0_USBD_MSC_DATA_IN_EP_ADDR 0x83 39 | #define STM32L0_USBD_MSC_DATA_OUT_EP_ADDR 0x03 40 | 41 | #define STM32L0_USBD_MSC_DATA_INTERFACE 2 42 | 43 | #define STM32L0_USBD_MSC_DATA_MAX_PACKET_SIZE 64 44 | 45 | #define STM32L0_USBD_MSC_DATA_BLOCK_SIZE 512 46 | 47 | extern void USBD_MSC_Notify(uint8_t lun, int acquire); 48 | 49 | #ifdef __cplusplus 50 | } 51 | #endif 52 | 53 | #endif /* _STM32L0_STM32L0_USBD_MSC_H */ 54 | -------------------------------------------------------------------------------- /system/STM32L0xx/Lib/libstm32l052xx.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GrumpyOldPizza/ArduinoCore-stm32l0/b1cf1cd6eba2f06bbe4edbe76aa43ae5971e8d8c/system/STM32L0xx/Lib/libstm32l052xx.a -------------------------------------------------------------------------------- /system/STM32L0xx/Lib/libstm32l072xx.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GrumpyOldPizza/ArduinoCore-stm32l0/b1cf1cd6eba2f06bbe4edbe76aa43ae5971e8d8c/system/STM32L0xx/Lib/libstm32l072xx.a -------------------------------------------------------------------------------- /system/STM32L0xx/Lib/libstm32l082xx.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GrumpyOldPizza/ArduinoCore-stm32l0/b1cf1cd6eba2f06bbe4edbe76aa43ae5971e8d8c/system/STM32L0xx/Lib/libstm32l082xx.a -------------------------------------------------------------------------------- /system/STM32L0xx/Source/LoRa/Radio/radio.c: -------------------------------------------------------------------------------- 1 | /*! 2 | * \file radio.c 3 | * 4 | * \brief Radio implementation 5 | * 6 | * \copyright Revised BSD License, see section \ref LICENSE. 7 | * 8 | * \code 9 | * ______ _ 10 | * / _____) _ | | 11 | * ( (____ _____ ____ _| |_ _____ ____| |__ 12 | * \____ \| ___ | (_ _) ___ |/ ___) _ \ 13 | * _____) ) ____| | | || |_| ____( (___| | | | 14 | * (______/|_____)_|_|_| \__)_____)\____)_| |_| 15 | * (C)2013-2017 Semtech 16 | * 17 | * \endcode 18 | * 19 | * \author Miguel Luis ( Semtech ) 20 | * 21 | * \author Gregory Cristian ( Semtech ) 22 | */ 23 | 24 | #include "radio.h" 25 | 26 | const struct Radio_s * __Radio; 27 | 28 | 29 | -------------------------------------------------------------------------------- /system/STM32L0xx/Source/LoRa/System/timer.c: -------------------------------------------------------------------------------- 1 | /* 2 | / _____) _ | | 3 | ( (____ _____ ____ _| |_ _____ ____| |__ 4 | \____ \| ___ | (_ _) ___ |/ ___) _ \ 5 | _____) ) ____| | | || |_| ____( (___| | | | 6 | (______/|_____)_|_|_| \__)_____)\____)_| |_| 7 | (C)2013 Semtech 8 | 9 | Description: Timer objects and scheduling management 10 | 11 | License: Revised BSD License, see LICENSE.TXT file include in the project 12 | 13 | Maintainer: Miguel Luis and Gregory Cristian 14 | */ 15 | 16 | #include "armv6m.h" 17 | #include "stm32l0xx.h" 18 | 19 | #include "stm32l0_rtc.h" 20 | 21 | #include "timer.h" 22 | 23 | static void TimerCallback( TimerEvent_t *obj ) 24 | { 25 | if (obj->IsRunning) 26 | { 27 | obj->IsRunning = false; 28 | 29 | if (obj->Callback) 30 | { 31 | (*obj->Callback)(); 32 | } 33 | } 34 | } 35 | 36 | void TimerInit( TimerEvent_t *obj, void ( *callback )( void ) ) 37 | { 38 | stm32l0_rtc_timer_create(&obj->Timer, (stm32l0_rtc_timer_callback_t)TimerCallback, (void*)obj); 39 | 40 | obj->Ticks = 0; 41 | obj->IsRunning = false; 42 | obj->Callback = callback; 43 | } 44 | 45 | void TimerStart( TimerEvent_t *obj ) 46 | { 47 | if (obj->Ticks) 48 | { 49 | obj->IsRunning = true; 50 | 51 | stm32l0_rtc_timer_start(&obj->Timer, obj->Ticks, STM32L0_RTC_TIMER_MODE_RELATIVE); 52 | } 53 | } 54 | 55 | void TimerStop( TimerEvent_t *obj ) 56 | { 57 | stm32l0_rtc_timer_stop(&obj->Timer); 58 | 59 | obj->IsRunning = false; 60 | } 61 | 62 | void TimerReset( TimerEvent_t *obj ) 63 | { 64 | TimerStop( obj ); 65 | TimerStart( obj ); 66 | } 67 | 68 | bool TimerIsRunning( TimerEvent_t *obj ) 69 | { 70 | return obj->IsRunning; 71 | } 72 | 73 | void TimerSetValue( TimerEvent_t *obj, uint32_t value ) 74 | { 75 | TimerStop( obj ); 76 | 77 | obj->Ticks = stm32l0_rtc_millis_to_ticks(value); 78 | } 79 | 80 | TimerTime_t TimerGetCurrentTime( void ) 81 | { 82 | TimerTime_t currentTime; 83 | 84 | currentTime = stm32l0_rtc_clock_to_millis(stm32l0_rtc_clock_read()); 85 | 86 | return currentTime; 87 | } 88 | 89 | TimerTime_t TimerGetElapsedTime( TimerTime_t savedTime ) 90 | { 91 | TimerTime_t currentTime; 92 | 93 | currentTime = stm32l0_rtc_clock_to_millis(stm32l0_rtc_clock_read()); 94 | 95 | return currentTime - savedTime; 96 | } 97 | -------------------------------------------------------------------------------- /system/STM32L0xx/Source/LoRa/Utilities/utilities.c: -------------------------------------------------------------------------------- 1 | /* 2 | / _____) _ | | 3 | ( (____ _____ ____ _| |_ _____ ____| |__ 4 | \____ \| ___ | (_ _) ___ |/ ___) _ \ 5 | _____) ) ____| | | || |_| ____( (___| | | | 6 | (______/|_____)_|_|_| \__)_____)\____)_| |_| 7 | (C)2013 Semtech 8 | 9 | Description: Helper functions implementation 10 | 11 | License: Revised BSD License, see LICENSE.TXT file include in the project 12 | 13 | Maintainer: Miguel Luis and Gregory Cristian 14 | */ 15 | #include 16 | #include 17 | #include 18 | #include "utilities.h" 19 | 20 | /*! 21 | * Redefinition of rand() and srand() standard C functions. 22 | * These functions are redefined in order to get the same behavior across 23 | * different compiler toolchains implementations. 24 | */ 25 | // Standard random functions redefinition start 26 | #define RAND_LOCAL_MAX 2147483647L 27 | 28 | static uint32_t next = 1; 29 | 30 | int32_t rand1( void ) 31 | { 32 | return ( ( next = next * 1103515245L + 12345L ) % RAND_LOCAL_MAX ); 33 | } 34 | 35 | void srand1( uint32_t seed ) 36 | { 37 | next = seed; 38 | } 39 | // Standard random functions redefinition end 40 | 41 | int32_t randr( int32_t min, int32_t max ) 42 | { 43 | return ( int32_t )rand1( ) % ( max - min + 1 ) + min; 44 | } 45 | 46 | void memcpyr( uint8_t *dst, const uint8_t *src, uint16_t size ) 47 | { 48 | dst = dst + ( size - 1 ); 49 | while( size-- ) 50 | { 51 | *dst-- = *src++; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /system/STM32L0xx/Source/LoRa/Utilities/utilities.h: -------------------------------------------------------------------------------- 1 | /* 2 | / _____) _ | | 3 | ( (____ _____ ____ _| |_ _____ ____| |__ 4 | \____ \| ___ | (_ _) ___ |/ ___) _ \ 5 | _____) ) ____| | | || |_| ____( (___| | | | 6 | (______/|_____)_|_|_| \__)_____)\____)_| |_| 7 | (C)2013 Semtech 8 | 9 | Description: Helper functions implementation 10 | 11 | License: Revised BSD License, see LICENSE.TXT file include in the project 12 | 13 | Maintainer: Miguel Luis and Gregory Cristian 14 | */ 15 | #ifndef __UTILITIES_H__ 16 | #define __UTILITIES_H__ 17 | 18 | #include 19 | 20 | /*! 21 | * \brief Returns the minimum value between a and b 22 | * 23 | * \param [IN] a 1st value 24 | * \param [IN] b 2nd value 25 | * \retval minValue Minimum value 26 | */ 27 | #define MIN( a, b ) ( ( ( a ) < ( b ) ) ? ( a ) : ( b ) ) 28 | 29 | /*! 30 | * \brief Returns the maximum value between a and b 31 | * 32 | * \param [IN] a 1st value 33 | * \param [IN] b 2nd value 34 | * \retval maxValue Maximum value 35 | */ 36 | #define MAX( a, b ) ( ( ( a ) > ( b ) ) ? ( a ) : ( b ) ) 37 | 38 | /*! 39 | * \brief Returns 2 raised to the power of n 40 | * 41 | * \param [IN] n power value 42 | * \retval result of raising 2 to the power n 43 | */ 44 | #define POW2( n ) ( 1 << n ) 45 | 46 | /*! 47 | * \brief Initializes the pseudo random generator initial value 48 | * 49 | * \param [IN] seed Pseudo random generator initial value 50 | */ 51 | void srand1( uint32_t seed ); 52 | 53 | /*! 54 | * \brief Computes a random number between min and max 55 | * 56 | * \param [IN] min range minimum value 57 | * \param [IN] max range maximum value 58 | * \retval random random value in range min..max 59 | */ 60 | int32_t randr( int32_t min, int32_t max ); 61 | 62 | /*! 63 | * \brief Copies size elements of src array to dst array reversing the byte order 64 | * 65 | * \param [OUT] dst Destination array 66 | * \param [IN] src Source array 67 | * \param [IN] size Number of bytes to be copied 68 | */ 69 | void memcpyr( uint8_t *dst, const uint8_t *src, uint16_t size ); 70 | 71 | #endif // __UTILITIES_H__ 72 | -------------------------------------------------------------------------------- /system/STM32L0xx/Source/armv6m_svcall.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2020 Thomas Roell. All rights reserved. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to 6 | * deal with the Software without restriction, including without limitation the 7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | * sell copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * 1. Redistributions of source code must retain the above copyright notice, 12 | * this list of conditions and the following disclaimers. 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimers in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 3. Neither the name of Thomas Roell, nor the names of its contributors 17 | * may be used to endorse or promote products derived from this Software 18 | * without specific prior written permission. 19 | * 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | * CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 26 | * WITH THE SOFTWARE. 27 | */ 28 | 29 | #include "armv6m.h" 30 | 31 | void __armv6m_svcall_initialize(void) 32 | { 33 | NVIC_SetPriority(SVC_IRQn, ARMV6M_IRQ_PRIORITY_SVCALL); 34 | } 35 | 36 | void __attribute__((naked)) SVC_Handler(void) 37 | { 38 | __asm__( 39 | " mov r2, sp \n" 40 | " push { r2, lr } \n" 41 | " .cfi_def_cfa_offset 8 \n" 42 | " .cfi_offset 2, -8 \n" 43 | " .cfi_offset 14, -4 \n" 44 | " ldmia r2, { r0, r1, r2, r3 } \n" 45 | " blx r7 \n" 46 | " str r0, [sp, #8] \n" 47 | " pop { r2, pc } \n" 48 | : 49 | : 50 | ); 51 | } 52 | -------------------------------------------------------------------------------- /system/STM32L0xx/Source/stm32l0_iwdg.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2018 Thomas Roell. All rights reserved. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to 6 | * deal with the Software without restriction, including without limitation the 7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | * sell copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * 1. Redistributions of source code must retain the above copyright notice, 12 | * this list of conditions and the following disclaimers. 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimers in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 3. Neither the name of Thomas Roell, nor the names of its contributors 17 | * may be used to endorse or promote products derived from this Software 18 | * without specific prior written permission. 19 | * 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | * CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 26 | * WITH THE SOFTWARE. 27 | */ 28 | 29 | #include "armv6m.h" 30 | #include "stm32l0xx.h" 31 | 32 | #include "stm32l0_iwdg.h" 33 | #include "stm32l0_system.h" 34 | 35 | 36 | void stm32l0_iwdg_enable(uint32_t timeout) 37 | { 38 | uint32_t iwdg_pr, iwdg_rl; 39 | 40 | /* LSI is nominal @ 37kHz, but can vary between 26kHz and 56kHz. 41 | * Hence be conservative on a maximum timeout. 42 | */ 43 | if (timeout > 18000) 44 | { 45 | timeout = 18000; 46 | } 47 | 48 | iwdg_pr = 0; 49 | iwdg_rl = timeout * (stm32l0_system_lsiclk() / (4 * 1000)); 50 | 51 | while (iwdg_rl > 4096) 52 | { 53 | iwdg_pr++; 54 | iwdg_rl >>= 1; 55 | } 56 | 57 | IWDG->KR = 0xcccc; 58 | IWDG->KR = 0x5555; 59 | 60 | while (IWDG->SR & (IWDG_SR_WVU | IWDG_SR_RVU | IWDG_SR_PVU)) 61 | { 62 | } 63 | 64 | IWDG->PR = iwdg_pr; 65 | IWDG->RLR = iwdg_rl -1; 66 | IWDG->KR = 0xaaaa; 67 | } 68 | -------------------------------------------------------------------------------- /tools/linux/dfu-prefix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GrumpyOldPizza/ArduinoCore-stm32l0/b1cf1cd6eba2f06bbe4edbe76aa43ae5971e8d8c/tools/linux/dfu-prefix -------------------------------------------------------------------------------- /tools/linux/dfu-suffix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GrumpyOldPizza/ArduinoCore-stm32l0/b1cf1cd6eba2f06bbe4edbe76aa43ae5971e8d8c/tools/linux/dfu-suffix -------------------------------------------------------------------------------- /tools/linux/dfu-util: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GrumpyOldPizza/ArduinoCore-stm32l0/b1cf1cd6eba2f06bbe4edbe76aa43ae5971e8d8c/tools/linux/dfu-util -------------------------------------------------------------------------------- /tools/linux/openocd/bin/libudev.so.0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GrumpyOldPizza/ArduinoCore-stm32l0/b1cf1cd6eba2f06bbe4edbe76aa43ae5971e8d8c/tools/linux/openocd/bin/libudev.so.0 -------------------------------------------------------------------------------- /tools/linux/openocd/bin/openocd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GrumpyOldPizza/ArduinoCore-stm32l0/b1cf1cd6eba2f06bbe4edbe76aa43ae5971e8d8c/tools/linux/openocd/bin/openocd -------------------------------------------------------------------------------- /tools/linux/stm32l0-upload: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | TOOLDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd) 4 | 5 | RETRIES=10 6 | 7 | while [ $RETRIES -gt 0 ] 8 | do 9 | if [ "$($TOOLDIR/dfu-util -l 2>/dev/null | grep 0483:df11)" != "" ] 10 | then 11 | $TOOLDIR/dfu-util -d $1:$2,0x0483:0xdf11 -a 0 -s 0x08000000:leave -D $3 12 | echo "OK" 13 | exit 0 14 | fi 15 | echo $RETRIES 16 | RETRIES=$[$RETRIES -1]; 17 | sleep 1; 18 | done 19 | 20 | echo "FAIL" 21 | exit 0 22 | -------------------------------------------------------------------------------- /tools/macosx/dfu-prefix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GrumpyOldPizza/ArduinoCore-stm32l0/b1cf1cd6eba2f06bbe4edbe76aa43ae5971e8d8c/tools/macosx/dfu-prefix -------------------------------------------------------------------------------- /tools/macosx/dfu-suffix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GrumpyOldPizza/ArduinoCore-stm32l0/b1cf1cd6eba2f06bbe4edbe76aa43ae5971e8d8c/tools/macosx/dfu-suffix -------------------------------------------------------------------------------- /tools/macosx/dfu-util: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GrumpyOldPizza/ArduinoCore-stm32l0/b1cf1cd6eba2f06bbe4edbe76aa43ae5971e8d8c/tools/macosx/dfu-util -------------------------------------------------------------------------------- /tools/macosx/openocd/bin/openocd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GrumpyOldPizza/ArduinoCore-stm32l0/b1cf1cd6eba2f06bbe4edbe76aa43ae5971e8d8c/tools/macosx/openocd/bin/openocd -------------------------------------------------------------------------------- /tools/macosx/stm32l0-upload: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | TOOLDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd) 4 | 5 | RETRIES=10 6 | 7 | while [ $RETRIES -gt 0 ] 8 | do 9 | if [ "$($TOOLDIR/dfu-util -l 2>/dev/null | grep 0483:df11)" != "" ] 10 | then 11 | $TOOLDIR/dfu-util -d $1:$2,0x0483:0xdf11 -a 0 -s 0x08000000:leave -D $3 12 | echo "OK" 13 | exit 0 14 | fi 15 | echo $RETRIES 16 | RETRIES=$[$RETRIES -1]; 17 | sleep 1; 18 | done 19 | 20 | echo "FAIL" 21 | exit 0 22 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/board/st_nucleo_f0.cfg: -------------------------------------------------------------------------------- 1 | # This is for all ST NUCLEO with any STM32F0. Known boards at the moment: 2 | # STM32F030R8 3 | # http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/LN1847/PF259997 4 | # NUCLEO-F072RB 5 | # http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/LN1847/PF259997 6 | # STM32F091RC 7 | # http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/LN1847/PF260944 8 | 9 | source [find interface/stlink.cfg] 10 | 11 | transport select hla_swd 12 | 13 | source [find target/stm32f0x.cfg] 14 | 15 | reset_config srst_only 16 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/board/st_nucleo_f103rb.cfg: -------------------------------------------------------------------------------- 1 | # This is an ST NUCLEO F103RB board with a single STM32F103RBT6 chip. 2 | # http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/LN1847/PF259875 3 | 4 | source [find interface/stlink.cfg] 5 | 6 | transport select hla_swd 7 | 8 | source [find target/stm32f1x.cfg] 9 | 10 | reset_config srst_only 11 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/board/st_nucleo_f3.cfg: -------------------------------------------------------------------------------- 1 | # This is an ST NUCLEO F334R8 board with a single STM32F334R8T6 chip. 2 | # http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/LN1847/PF260004 3 | 4 | source [find interface/stlink.cfg] 5 | 6 | transport select hla_swd 7 | 8 | source [find target/stm32f3x.cfg] 9 | 10 | reset_config srst_only 11 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/board/st_nucleo_f4.cfg: -------------------------------------------------------------------------------- 1 | # This is for all ST NUCLEO with any STM32F4. Known boards at the moment: 2 | # STM32F401RET6 3 | # http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/LN1847/PF260000 4 | # STM32F411RET6 5 | # http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/LN1847/PF260320 6 | 7 | source [find interface/stlink.cfg] 8 | 9 | transport select hla_swd 10 | 11 | source [find target/stm32f4x.cfg] 12 | 13 | reset_config srst_only 14 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/board/st_nucleo_f7.cfg: -------------------------------------------------------------------------------- 1 | # STMicroelectronics STM32F7 Nucleo development board 2 | # Known boards: NUCLEO-F746ZG and NUCLEO-F767ZI 3 | 4 | source [find interface/stlink-v2-1.cfg] 5 | 6 | transport select hla_swd 7 | 8 | source [find target/stm32f7x.cfg] 9 | 10 | reset_config srst_only 11 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/board/st_nucleo_h743zi.cfg: -------------------------------------------------------------------------------- 1 | # This is an ST NUCLEO-H743ZI board with single STM32H743ZI chip. 2 | # http://www.st.com/en/evaluation-tools/nucleo-h743zi.html 3 | 4 | source [find interface/stlink-v2-1.cfg] 5 | 6 | transport select hla_swd 7 | 8 | source [find target/stm32h7x_dual_bank.cfg] 9 | 10 | reset_config srst_only 11 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/board/st_nucleo_l073rz.cfg: -------------------------------------------------------------------------------- 1 | # This is an ST NUCLEO-L073RZ board with single STM32L073RZ chip. 2 | # http://www.st.com/en/evaluation-tools/nucleo-l073rz.html 3 | source [find interface/stlink-v2-1.cfg] 4 | 5 | transport select hla_swd 6 | 7 | set WORKAREASIZE 0x2000 8 | 9 | source [find target/stm32l0_dual_bank.cfg] 10 | 11 | # There is only system reset line and JTAG/SWD command can be issued when SRST 12 | reset_config srst_only 13 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/board/st_nucleo_l1.cfg: -------------------------------------------------------------------------------- 1 | # This is an ST NUCLEO L152RE board with a single STM32L152RET6 chip. 2 | # http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/LN1847/PF260002 3 | 4 | source [find interface/stlink.cfg] 5 | 6 | transport select hla_swd 7 | 8 | source [find target/stm32l1.cfg] 9 | 10 | reset_config srst_only 11 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/board/st_nucleo_l4.cfg: -------------------------------------------------------------------------------- 1 | # Should work with all STM32L4 Nucleo Dev Boards. 2 | # http://www.st.com/en/evaluation-tools/stm32-mcu-nucleo.html 3 | 4 | source [find interface/stlink.cfg] 5 | 6 | transport select hla_swd 7 | 8 | source [find target/stm32l4x.cfg] 9 | 10 | # use hardware reset 11 | reset_config srst_only srst_nogate 12 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/board/steval-idb007v1.cfg: -------------------------------------------------------------------------------- 1 | # This is an evaluation board with a single BlueNRG-1 chip. 2 | # http://www.st.com/content/st_com/en/products/evaluation-tools/solution-evaluation-tools/communication-and-connectivity-solution-eval-boards/steval-idb008v1.html 3 | set CHIPNAME bluenrg-1 4 | source [find target/bluenrg-x.cfg] 5 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/board/steval-idb008v1.cfg: -------------------------------------------------------------------------------- 1 | # This is an evaluation board with a single BlueNRG-2 chip. 2 | # http://www.st.com/content/st_com/en/products/evaluation-tools/solution-evaluation-tools/communication-and-connectivity-solution-eval-boards/steval-idb007v1.html 3 | set CHIPNAME bluenrg-2 4 | source [find target/bluenrg-x.cfg] 5 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/board/stm320518_eval.cfg: -------------------------------------------------------------------------------- 1 | # STM320518-EVAL: This is an STM32F0 eval board with a single STM32F051R8T6 2 | # (64KB) chip. 3 | # http://www.st.com/internet/evalboard/product/252994.jsp 4 | # 5 | 6 | # increase working area to 8KB 7 | set WORKAREASIZE 0x2000 8 | 9 | # chip name 10 | set CHIPNAME STM32F051R8T6 11 | 12 | source [find target/stm32f0x.cfg] 13 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/board/stm320518_eval_stlink.cfg: -------------------------------------------------------------------------------- 1 | # STM320518-EVAL: This is an STM32F0 eval board with a single STM32F051R8T6 2 | # (64KB) chip. 3 | # http://www.st.com/internet/evalboard/product/252994.jsp 4 | # 5 | # This is for using the onboard STLINK/V2 6 | 7 | source [find interface/stlink.cfg] 8 | 9 | transport select hla_swd 10 | 11 | # increase working area to 8KB 12 | set WORKAREASIZE 0x2000 13 | 14 | # chip name 15 | set CHIPNAME STM32F051R8T6 16 | 17 | source [find target/stm32f0x.cfg] 18 | 19 | reset_config srst_only 20 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/board/stm32100b_eval.cfg: -------------------------------------------------------------------------------- 1 | # This is an STM32 eval board with a single STM32F100VBT6 chip. 2 | # http://www.st.com/internet/evalboard/product/247099.jsp 3 | 4 | # The chip has only 8KB sram 5 | set WORKAREASIZE 0x2000 6 | 7 | source [find target/stm32f1x.cfg] 8 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/board/stm3210b_eval.cfg: -------------------------------------------------------------------------------- 1 | # This is an STM32 eval board with a single STM32F10x (128KB) chip. 2 | # http://www.st.com/internet/evalboard/product/176090.jsp 3 | 4 | # increase working area to 32KB for faster flash programming 5 | set WORKAREASIZE 0x8000 6 | 7 | source [find target/stm32f1x.cfg] 8 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/board/stm3210c_eval.cfg: -------------------------------------------------------------------------------- 1 | # This is an STM32 eval board with a single STM32F107VCT chip. 2 | # http://www.st.com/internet/evalboard/product/217965.jsp 3 | 4 | # increase working area to 32KB for faster flash programming 5 | set WORKAREASIZE 0x8000 6 | 7 | source [find target/stm32f1x.cfg] 8 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/board/stm3210e_eval.cfg: -------------------------------------------------------------------------------- 1 | # This is an STM32 eval board with a single STM32F103ZET6 chip. 2 | # http://www.st.com/internet/evalboard/product/204176.jsp 3 | 4 | # increase working area to 32KB for faster flash programming 5 | set WORKAREASIZE 0x8000 6 | 7 | source [find target/stm32f1x.cfg] 8 | 9 | # 10 | # configure FSMC Bank 1 (NOR/PSRAM Bank 2) NOR flash 11 | # M29W128GL70ZA6E 12 | # 13 | 14 | set _FLASHNAME $_CHIPNAME.norflash 15 | flash bank $_FLASHNAME cfi 0x64000000 0x01000000 2 2 $_TARGETNAME 16 | 17 | proc stm32_enable_fsmc {} { 18 | 19 | echo "Enabling FSMC Bank 1 (NOR/PSRAM Bank 2)" 20 | 21 | # enable gpio (defg) clocks for fsmc 22 | # RCC_APB2ENR 23 | mww 0x40021018 0x000001E0 24 | 25 | # enable fsmc clock 26 | # RCC_AHBENR 27 | mww 0x40021014 0x00000114 28 | 29 | # configure gpio to alternate function 30 | # GPIOD_CRL 31 | mww 0x40011400 0x44BB44BB 32 | # GPIOD_CRH 33 | mww 0x40011404 0xBBBBBBBB 34 | 35 | # GPIOE_CRL 36 | mww 0x40011800 0xBBBBB444 37 | # GPIOE_CRH 38 | mww 0x40011804 0xBBBBBBBB 39 | 40 | # GPIOF_CRL 41 | mww 0x40011C00 0x44BBBBBB 42 | # GPIOF_CRH 43 | mww 0x40011C04 0xBBBB4444 44 | 45 | # GPIOG_CRL 46 | mww 0x40012000 0x44BBBBBB 47 | # GPIOG_CRH 48 | mww 0x40012004 0x444444B4 49 | 50 | # setup fsmc timings 51 | # FSMC_BCR1 52 | mww 0xA0000008 0x00001058 53 | 54 | # FSMC_BTR1 55 | mww 0xA000000C 0x10000502 56 | 57 | # FSMC_BCR1 - enable fsmc 58 | mww 0xA0000008 0x00001059 59 | } 60 | 61 | $_TARGETNAME configure -event reset-init { 62 | stm32_enable_fsmc 63 | } 64 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/board/stm3220g_eval.cfg: -------------------------------------------------------------------------------- 1 | # STM3220G-EVAL: This is an STM32F2 eval board with a single STM32F207IGH6 2 | # (128KB) chip. 3 | # http://www.st.com/internet/evalboard/product/250374.jsp 4 | 5 | # increase working area to 128KB 6 | set WORKAREASIZE 0x20000 7 | 8 | # chip name 9 | set CHIPNAME STM32F207IGH6 10 | 11 | source [find target/stm32f2x.cfg] 12 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/board/stm3220g_eval_stlink.cfg: -------------------------------------------------------------------------------- 1 | # STM3220G-EVAL: This is an STM32F2 eval board with a single STM32F207IGH6 2 | # (128KB) chip. 3 | # http://www.st.com/internet/evalboard/product/250374.jsp 4 | # 5 | # This is for using the onboard STLINK/V2 6 | 7 | source [find interface/stlink.cfg] 8 | 9 | transport select hla_swd 10 | 11 | # increase working area to 128KB 12 | set WORKAREASIZE 0x20000 13 | 14 | # chip name 15 | set CHIPNAME STM32F207IGH6 16 | 17 | source [find target/stm32f2x.cfg] 18 | 19 | reset_config srst_only 20 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/board/stm3241g_eval.cfg: -------------------------------------------------------------------------------- 1 | # STM3241G-EVAL: This is an STM32F4 eval board with a single STM32F417IGH6 2 | # (1024KB) chip. 3 | # http://www.st.com/internet/evalboard/product/252216.jsp 4 | 5 | # increase working area to 128KB 6 | set WORKAREASIZE 0x20000 7 | 8 | # chip name 9 | set CHIPNAME STM32F417IGH6 10 | 11 | source [find target/stm32f4x.cfg] 12 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/board/stm3241g_eval_stlink.cfg: -------------------------------------------------------------------------------- 1 | # STM3241G-EVAL: This is an STM32F4 eval board with a single STM32F417IGH6 2 | # (1024KB) chip. 3 | # http://www.st.com/internet/evalboard/product/252216.jsp 4 | # 5 | # This is for using the onboard STLINK/V2 6 | 7 | source [find interface/stlink.cfg] 8 | 9 | transport select hla_swd 10 | 11 | # increase working area to 128KB 12 | set WORKAREASIZE 0x20000 13 | 14 | # chip name 15 | set CHIPNAME STM32F417IGH6 16 | 17 | source [find target/stm32f4x.cfg] 18 | 19 | reset_config srst_only 20 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/board/stm32429i_eval.cfg: -------------------------------------------------------------------------------- 1 | # STM32429I-EVAL: This is an STM32F4 eval board with a single STM32F429NIH6 2 | # (2048KB) chip. 3 | # http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/LN1199/PF259093 4 | 5 | # increase working area to 128KB 6 | set WORKAREASIZE 0x20000 7 | 8 | # chip name 9 | set CHIPNAME STM32F429NIH6 10 | 11 | source [find target/stm32f4x.cfg] 12 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/board/stm32429i_eval_stlink.cfg: -------------------------------------------------------------------------------- 1 | # STM32429I-EVAL: This is an STM32F4 eval board with a single STM32F429NIH6 2 | # (2048KB) chip. 3 | # http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/LN1199/PF259093 4 | # 5 | # This is for using the onboard STLINK/V2 6 | 7 | source [find interface/stlink.cfg] 8 | 9 | transport select hla_swd 10 | 11 | # increase working area to 128KB 12 | set WORKAREASIZE 0x20000 13 | 14 | # chip name 15 | set CHIPNAME STM32F429NIH6 16 | 17 | source [find target/stm32f4x.cfg] 18 | 19 | reset_config srst_only 20 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/board/stm32439i_eval.cfg: -------------------------------------------------------------------------------- 1 | # STM32439I-EVAL: This is an STM32F4 eval board with a single STM32F439NIH6 2 | # (2048KB) chip. 3 | # http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/LN1199/PF259094 4 | 5 | # increase working area to 128KB 6 | set WORKAREASIZE 0x20000 7 | 8 | # chip name 9 | set CHIPNAME STM32F439NIH6 10 | 11 | source [find target/stm32f4x.cfg] 12 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/board/stm32439i_eval_stlink.cfg: -------------------------------------------------------------------------------- 1 | # STM32439I-EVAL: This is an STM32F4 eval board with a single STM32F439NIH6 2 | # (2048KB) chip. 3 | # http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/LN1199/PF259094 4 | # 5 | # This is for using the onboard STLINK/V2 6 | 7 | source [find interface/stlink.cfg] 8 | 9 | transport select hla_swd 10 | 11 | # increase working area to 128KB 12 | set WORKAREASIZE 0x20000 13 | 14 | # chip name 15 | set CHIPNAME STM32F439NIH6 16 | 17 | source [find target/stm32f4x.cfg] 18 | 19 | reset_config srst_only 20 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/board/stm327x6g_eval.cfg: -------------------------------------------------------------------------------- 1 | # STM327[4|5]6G-EVAL: This is for the STM32F7 eval boards. 2 | # STM32746G-EVAL 3 | # http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/LN1199/PF261639 4 | # STM32756G-EVAL 5 | # http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/LN1199/PF261640 6 | 7 | # increase working area to 256KB 8 | set WORKAREASIZE 0x40000 9 | 10 | source [find target/stm32f7x.cfg] 11 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/board/stm32f0discovery.cfg: -------------------------------------------------------------------------------- 1 | # This is an STM32F0 discovery board with a single STM32F051R8T6 chip. 2 | # http://www.st.com/internet/evalboard/product/253215.jsp 3 | 4 | source [find interface/stlink.cfg] 5 | 6 | transport select hla_swd 7 | 8 | set WORKAREASIZE 0x2000 9 | source [find target/stm32f0x.cfg] 10 | 11 | reset_config srst_only 12 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/board/stm32f334discovery.cfg: -------------------------------------------------------------------------------- 1 | # This is an STM32F334 discovery board with a single STM32F334C8T6 chip. 2 | # As it is one of the few boards with stlink V.2-1, we source the corresponding 3 | # nucleo file. 4 | # http://www.st.com/web/en/catalog/tools/FM116/SC959/SS1532/LN1848/PF260318 5 | 6 | source [find board/st_nucleo_f3.cfg] 7 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/board/stm32f3discovery.cfg: -------------------------------------------------------------------------------- 1 | # This is an STM32F3 discovery board with a single STM32F303VCT6 chip. 2 | # http://www.st.com/internet/evalboard/product/254044.jsp 3 | 4 | source [find interface/stlink.cfg] 5 | 6 | transport select hla_swd 7 | 8 | source [find target/stm32f3x.cfg] 9 | 10 | reset_config srst_only 11 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/board/stm32f429disc1.cfg: -------------------------------------------------------------------------------- 1 | # 2 | # This is an STM32F429 discovery board with a single STM32F429ZI chip. 3 | # http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/PF259090 4 | # 5 | 6 | source [find interface/stlink.cfg] 7 | 8 | transport select hla_swd 9 | 10 | source [find target/stm32f4x.cfg] 11 | 12 | reset_config srst_only 13 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/board/stm32f429discovery.cfg: -------------------------------------------------------------------------------- 1 | # 2 | # This is an STM32F429 discovery board with a single STM32F429ZI chip. 3 | # http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/PF259090 4 | # 5 | 6 | source [find interface/stlink.cfg] 7 | 8 | transport select hla_swd 9 | 10 | # increase working area to 128KB 11 | set WORKAREASIZE 0x20000 12 | 13 | source [find target/stm32f4x.cfg] 14 | 15 | reset_config srst_only 16 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/board/stm32f469discovery.cfg: -------------------------------------------------------------------------------- 1 | # 2 | # This is an STM32F469 discovery board with a single STM32F469NI chip. 3 | # http://www.st.com/web/catalog/tools/FM116/CL1620/SC959/SS1532/LN1848/PF262395 4 | # 5 | 6 | source [find interface/stlink.cfg] 7 | 8 | transport select hla_swd 9 | 10 | # increase working area to 128KB 11 | set WORKAREASIZE 0x20000 12 | 13 | source [find target/stm32f4x.cfg] 14 | 15 | reset_config srst_only 16 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/board/stm32f4discovery.cfg: -------------------------------------------------------------------------------- 1 | # This is an STM32F4 discovery board with a single STM32F407VGT6 chip. 2 | # http://www.st.com/internet/evalboard/product/252419.jsp 3 | 4 | source [find interface/stlink.cfg] 5 | 6 | transport select hla_swd 7 | 8 | # increase working area to 64KB 9 | set WORKAREASIZE 0x10000 10 | 11 | source [find target/stm32f4x.cfg] 12 | 13 | reset_config srst_only 14 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/board/stm32f7discovery.cfg: -------------------------------------------------------------------------------- 1 | # This is an STM32F7 discovery board with a single STM32F756NGH6 chip. 2 | # http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/LN1848/PF261641 3 | 4 | # This is for using the onboard STLINK/V2-1 5 | source [find interface/stlink.cfg] 6 | 7 | transport select hla_swd 8 | 9 | # increase working area to 256KB 10 | set WORKAREASIZE 0x40000 11 | 12 | source [find target/stm32f7x.cfg] 13 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/board/stm32h7x3i_eval.cfg: -------------------------------------------------------------------------------- 1 | # STM32H7[4|5]3I-EVAL: this is for the H7 eval boards. 2 | # This is an ST EVAL-H743XI board with single STM32H743XI chip. 3 | # http://www.st.com/en/evaluation-tools/stm32h743i-eval.html 4 | # This is an ST EVAL-H753XI board with single STM32H753XI chip. 5 | # http://www.st.com/en/evaluation-tools/stm32h753i-eval.html 6 | 7 | source [find interface/stlink-v2-1.cfg] 8 | 9 | transport select hla_swd 10 | 11 | source [find target/stm32h7x_dual_bank.cfg] 12 | 13 | reset_config srst_only 14 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/board/stm32l0discovery.cfg: -------------------------------------------------------------------------------- 1 | # This is an STM32L053 discovery board with a single STM32L053 chip. 2 | # http://www.st.com/web/en/catalog/tools/PF260319 3 | 4 | source [find interface/stlink.cfg] 5 | 6 | transport select hla_swd 7 | 8 | set WORKAREASIZE 0x2000 9 | source [find target/stm32l0.cfg] 10 | 11 | reset_config srst_only 12 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/board/stm32l4discovery.cfg: -------------------------------------------------------------------------------- 1 | # Explicitly for the STM32L476 discovery board: 2 | # http://www.st.com/web/en/catalog/tools/PF261635 3 | # but perfectly functional for any other STM32L4 board connected via 4 | # an stlink-v2-1 interface. 5 | # This is for STM32L4 boards that are connected via stlink-v2-1. 6 | 7 | source [find interface/stlink.cfg] 8 | 9 | transport select hla_swd 10 | 11 | source [find target/stm32l4x.cfg] 12 | 13 | reset_config srst_only 14 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/board/stm32ldiscovery.cfg: -------------------------------------------------------------------------------- 1 | # This is an STM32L discovery board with a single STM32L152RBT6 chip. 2 | # http://www.st.com/internet/evalboard/product/250990.jsp 3 | 4 | source [find interface/stlink.cfg] 5 | 6 | transport select hla_swd 7 | 8 | set WORKAREASIZE 0x4000 9 | source [find target/stm32l1.cfg] 10 | 11 | reset_config srst_only 12 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/board/stm32vldiscovery.cfg: -------------------------------------------------------------------------------- 1 | # This is an STM32VL discovery board with a single STM32F100RB chip. 2 | # http://www.st.com/internet/evalboard/product/250863.jsp 3 | 4 | source [find interface/stlink.cfg] 5 | 6 | transport select hla_swd 7 | 8 | set WORKAREASIZE 0x2000 9 | source [find target/stm32f1x.cfg] 10 | 11 | reset_config srst_only 12 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/chip/st/stm32/stm32.tcl: -------------------------------------------------------------------------------- 1 | source [find bitsbytes.tcl] 2 | source [find cpu/arm/cortex_m3.tcl] 3 | source [find memory.tcl] 4 | source [find mmr_helpers.tcl] 5 | 6 | source [find chip/st/stm32/stm32_regs.tcl] 7 | source [find chip/st/stm32/stm32_rcc.tcl] 8 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/cpu/arm/cortex_m3.tcl: -------------------------------------------------------------------------------- 1 | set CPU_TYPE arm 2 | set CPU_NAME cortex_m3 3 | set CPU_ARCH armv7 4 | set CPU_MAX_ADDRESS 0xFFFFFFFF 5 | set CPU_NBITS 32 6 | 7 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/interface/cmsis-dap.cfg: -------------------------------------------------------------------------------- 1 | # 2 | # ARM CMSIS-DAP compliant adapter 3 | # 4 | # http://www.keil.com/support/man/docs/dapdebug/ 5 | # 6 | 7 | interface cmsis-dap 8 | 9 | # Optionally specify the serial number of CMSIS-DAP usb device. 10 | #cmsis_dap_serial 02200201E6661E601B98E3B9 11 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/interface/stlink-v1.cfg: -------------------------------------------------------------------------------- 1 | echo "WARNING: interface/stlink-v1.cfg is deprecated, please switch to interface/stlink.cfg" 2 | source [find interface/stlink.cfg] 3 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/interface/stlink-v2-1.cfg: -------------------------------------------------------------------------------- 1 | echo "WARNING: interface/stlink-v2-1.cfg is deprecated, please switch to interface/stlink.cfg" 2 | source [find interface/stlink.cfg] 3 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/interface/stlink-v2.cfg: -------------------------------------------------------------------------------- 1 | echo "WARNING: interface/stlink-v2.cfg is deprecated, please switch to interface/stlink.cfg" 2 | source [find interface/stlink.cfg] 3 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/interface/stlink.cfg: -------------------------------------------------------------------------------- 1 | # 2 | # STMicroelectronics ST-LINK/V1, ST-LINK/V2, ST-LINK/V2-1 in-circuit 3 | # debugger/programmer 4 | # 5 | 6 | interface hla 7 | hla_layout stlink 8 | hla_device_desc "ST-LINK" 9 | hla_vid_pid 0x0483 0x3744 0x0483 0x3748 0x0483 0x374b 10 | 11 | # Optionally specify the serial number of ST-LINK/V2 usb device. ST-LINK/V2 12 | # devices seem to have serial numbers with unreadable characters. ST-LINK/V2 13 | # firmware version >= V2.J21.S4 recommended to avoid issues with adapter serial 14 | # number reset issues. 15 | # eg. 16 | #hla_serial "\xaa\xbc\x6e\x06\x50\x75\xff\x55\x17\x42\x19\x3f" 17 | 18 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/mem_helper.tcl: -------------------------------------------------------------------------------- 1 | # Helper for common memory read/modify/write procedures 2 | 3 | # mrw: "memory read word", returns value of $reg 4 | proc mrw {reg} { 5 | set value "" 6 | mem2array value 32 $reg 1 7 | return $value(0) 8 | } 9 | 10 | add_usage_text mrw "address" 11 | add_help_text mrw "Returns value of word in memory." 12 | 13 | proc mrb {reg} { 14 | set value "" 15 | mem2array value 8 $reg 1 16 | return $value(0) 17 | } 18 | 19 | add_usage_text mrb "address" 20 | add_help_text mrb "Returns value of byte in memory." 21 | 22 | # mmw: "memory modify word", updates value of $reg 23 | # $reg <== ((value & ~$clearbits) | $setbits) 24 | proc mmw {reg setbits clearbits} { 25 | set old [mrw $reg] 26 | set new [expr ($old & ~$clearbits) | $setbits] 27 | mww $reg $new 28 | } 29 | 30 | add_usage_text mmw "address setbits clearbits" 31 | add_help_text mmw "Modify word in memory. new_val = (old_val & ~clearbits) | setbits;" 32 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/target/bluenrg-x.cfg: -------------------------------------------------------------------------------- 1 | # 2 | # bluenrg-1/2 devices support only SWD transports. 3 | # 4 | 5 | source [find target/swj-dp.tcl] 6 | 7 | if { [info exists CHIPNAME] } { 8 | set _CHIPNAME $CHIPNAME 9 | } else { 10 | set _CHIPNAME bluenrg-1 11 | } 12 | 13 | set _ENDIAN little 14 | 15 | # Work-area is a space in RAM used for flash programming 16 | # By default use 24kB-256bytes 17 | if { [info exists WORKAREASIZE] } { 18 | set _WORKAREASIZE $WORKAREASIZE 19 | } else { 20 | set _WORKAREASIZE 0x5F00 21 | } 22 | 23 | adapter_khz 4000 24 | 25 | if { [info exists CPUTAPID] } { 26 | set _CPUTAPID $CPUTAPID 27 | } else { 28 | set _CPUTAPID 0x0bb11477 29 | } 30 | 31 | swj_newdap $_CHIPNAME cpu -expected-id $_CPUTAPID 32 | dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.cpu 33 | 34 | set _TARGETNAME $_CHIPNAME.cpu 35 | set WDOG_VALUE 0 36 | set WDOG_VALUE_SET 0 37 | 38 | target create $_TARGETNAME cortex_m -endian $_ENDIAN -dap $_CHIPNAME.dap 39 | 40 | $_TARGETNAME configure -work-area-phys 0x20000100 -work-area-size $_WORKAREASIZE -work-area-backup 0 41 | 42 | # flash size will be probed 43 | set _FLASHNAME $_CHIPNAME.flash 44 | flash bank $_FLASHNAME bluenrg-x 0 0 0 0 $_TARGETNAME 45 | 46 | # In BlueNRG-X reset pin is actually a shutdown (power-off), so define reset as none 47 | reset_config none 48 | 49 | if {![using_hla]} { 50 | # if srst is not fitted use SYSRESETREQ to 51 | # perform a soft reset 52 | cortex_m reset_config sysresetreq 53 | } 54 | 55 | $_TARGETNAME configure -event halted { 56 | global WDOG_VALUE 57 | global WDOG_VALUE_SET 58 | # Stop watchdog during halt, if enabled 59 | mem2array value 32 0x40700008 1 60 | set WDOG_VALUE [expr ($value(0))] 61 | if [expr ($value(0) & (1 << 1))] { 62 | set WDOG_VALUE_SET 1 63 | mww 0x40700008 [expr ($value(0) & 0xFFFFFFFD)] 64 | } 65 | } 66 | $_TARGETNAME configure -event resumed { 67 | global WDOG_VALUE 68 | global WDOG_VALUE_SET 69 | if [expr $WDOG_VALUE_SET] { 70 | # Restore watchdog enable value after resume 71 | mww 0x40700008 $WDOG_VALUE 72 | set WDOG_VALUE_SET 0 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/target/stm32_stlink.cfg: -------------------------------------------------------------------------------- 1 | echo "WARNING: stm32_stlink.cfg is deprecated (and does nothing, you can safely remove it.)" 2 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/target/stm32f0x_stlink.cfg: -------------------------------------------------------------------------------- 1 | echo "WARNING: target/stm32f0x_stlink.cfg is deprecated, please switch to target/stm32f0x.cfg" 2 | source [find target/stm32f0x.cfg] 3 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/target/stm32f1x.cfg: -------------------------------------------------------------------------------- 1 | # script for stm32f1x family 2 | 3 | # 4 | # stm32 devices support both JTAG and SWD transports. 5 | # 6 | source [find target/swj-dp.tcl] 7 | source [find mem_helper.tcl] 8 | 9 | if { [info exists CHIPNAME] } { 10 | set _CHIPNAME $CHIPNAME 11 | } else { 12 | set _CHIPNAME stm32f1x 13 | } 14 | 15 | set _ENDIAN little 16 | 17 | # Work-area is a space in RAM used for flash programming 18 | # By default use 4kB (as found on some STM32F100s) 19 | if { [info exists WORKAREASIZE] } { 20 | set _WORKAREASIZE $WORKAREASIZE 21 | } else { 22 | set _WORKAREASIZE 0x1000 23 | } 24 | 25 | # Allow overriding the Flash bank size 26 | if { [info exists FLASH_SIZE] } { 27 | set _FLASH_SIZE $FLASH_SIZE 28 | } else { 29 | # autodetect size 30 | set _FLASH_SIZE 0 31 | } 32 | 33 | #jtag scan chain 34 | if { [info exists CPUTAPID] } { 35 | set _CPUTAPID $CPUTAPID 36 | } else { 37 | if { [using_jtag] } { 38 | # See STM Document RM0008 Section 26.6.3 39 | set _CPUTAPID 0x3ba00477 40 | } { 41 | # this is the SW-DP tap id not the jtag tap id 42 | set _CPUTAPID 0x1ba01477 43 | } 44 | } 45 | 46 | swj_newdap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID 47 | dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.cpu 48 | 49 | if {[using_jtag]} { 50 | jtag newtap $_CHIPNAME bs -irlen 5 51 | } 52 | 53 | set _TARGETNAME $_CHIPNAME.cpu 54 | target create $_TARGETNAME cortex_m -endian $_ENDIAN -dap $_CHIPNAME.dap 55 | 56 | $_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE -work-area-backup 0 57 | 58 | # flash size will be probed 59 | set _FLASHNAME $_CHIPNAME.flash 60 | flash bank $_FLASHNAME stm32f1x 0x08000000 $_FLASH_SIZE 0 0 $_TARGETNAME 61 | 62 | # JTAG speed should be <= F_CPU/6. F_CPU after reset is 8MHz, so use F_JTAG = 1MHz 63 | adapter_khz 1000 64 | 65 | adapter_nsrst_delay 100 66 | if {[using_jtag]} { 67 | jtag_ntrst_delay 100 68 | } 69 | 70 | reset_config srst_nogate 71 | 72 | if {![using_hla]} { 73 | # if srst is not fitted use SYSRESETREQ to 74 | # perform a soft reset 75 | cortex_m reset_config sysresetreq 76 | } 77 | 78 | $_TARGETNAME configure -event examine-end { 79 | # DBGMCU_CR |= DBG_WWDG_STOP | DBG_IWDG_STOP | 80 | # DBG_STANDBY | DBG_STOP | DBG_SLEEP 81 | mmw 0xE0042004 0x00000307 0 82 | } 83 | 84 | $_TARGETNAME configure -event trace-config { 85 | # Set TRACE_IOEN; TRACE_MODE is set to async; when using sync 86 | # change this value accordingly to configure trace pins 87 | # assignment 88 | mmw 0xE0042004 0x00000020 0 89 | } 90 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/target/stm32f1x_stlink.cfg: -------------------------------------------------------------------------------- 1 | echo "WARNING: target/stm32f1x_stlink.cfg is deprecated, please switch to target/stm32f1x.cfg" 2 | source [find target/stm32f1x.cfg] 3 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/target/stm32f2x.cfg: -------------------------------------------------------------------------------- 1 | # script for stm32f2x family 2 | 3 | # 4 | # stm32 devices support both JTAG and SWD transports. 5 | # 6 | source [find target/swj-dp.tcl] 7 | source [find mem_helper.tcl] 8 | 9 | if { [info exists CHIPNAME] } { 10 | set _CHIPNAME $CHIPNAME 11 | } else { 12 | set _CHIPNAME stm32f2x 13 | } 14 | 15 | set _ENDIAN little 16 | 17 | # Work-area is a space in RAM used for flash programming 18 | # By default use 64kB 19 | if { [info exists WORKAREASIZE] } { 20 | set _WORKAREASIZE $WORKAREASIZE 21 | } else { 22 | set _WORKAREASIZE 0x10000 23 | } 24 | 25 | # JTAG speed should be <= F_CPU/6. F_CPU after reset is 8MHz, so use F_JTAG = 1MHz 26 | # 27 | # Since we may be running of an RC oscilator, we crank down the speed a 28 | # bit more to be on the safe side. Perhaps superstition, but if are 29 | # running off a crystal, we can run closer to the limit. Note 30 | # that there can be a pretty wide band where things are more or less stable. 31 | adapter_khz 1000 32 | 33 | adapter_nsrst_delay 100 34 | if {[using_jtag]} { 35 | jtag_ntrst_delay 100 36 | } 37 | 38 | #jtag scan chain 39 | if { [info exists CPUTAPID] } { 40 | set _CPUTAPID $CPUTAPID 41 | } else { 42 | if { [using_jtag] } { 43 | # See STM Document RM0033 44 | # Section 32.6.3 - corresponds to Cortex-M3 r2p0 45 | set _CPUTAPID 0x4ba00477 46 | } { 47 | set _CPUTAPID 0x2ba01477 48 | } 49 | } 50 | 51 | swj_newdap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID 52 | dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.cpu 53 | 54 | if {[using_jtag]} { 55 | jtag newtap $_CHIPNAME bs -irlen 5 56 | } 57 | 58 | set _TARGETNAME $_CHIPNAME.cpu 59 | target create $_TARGETNAME cortex_m -endian $_ENDIAN -dap $_CHIPNAME.dap 60 | 61 | $_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE -work-area-backup 0 62 | 63 | set _FLASHNAME $_CHIPNAME.flash 64 | flash bank $_FLASHNAME stm32f2x 0 0 0 0 $_TARGETNAME 65 | 66 | reset_config srst_nogate 67 | 68 | if {![using_hla]} { 69 | # if srst is not fitted use SYSRESETREQ to 70 | # perform a soft reset 71 | cortex_m reset_config sysresetreq 72 | } 73 | 74 | $_TARGETNAME configure -event examine-end { 75 | # DBGMCU_CR |= DBG_STANDBY | DBG_STOP | DBG_SLEEP 76 | mmw 0xE0042004 0x00000007 0 77 | 78 | # Stop watchdog counters during halt 79 | # DBGMCU_APB1_FZ |= DBG_IWDG_STOP | DBG_WWDG_STOP 80 | mmw 0xE0042008 0x00001800 0 81 | } 82 | 83 | $_TARGETNAME configure -event trace-config { 84 | # Set TRACE_IOEN; TRACE_MODE is set to async; when using sync 85 | # change this value accordingly to configure trace pins 86 | # assignment 87 | mmw 0xE0042004 0x00000020 0 88 | } 89 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/target/stm32f2x_stlink.cfg: -------------------------------------------------------------------------------- 1 | echo "WARNING: target/stm32f2x_stlink.cfg is deprecated, please switch to target/stm32f2x.cfg" 2 | source [find target/stm32f2x.cfg] 3 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/target/stm32f3x_stlink.cfg: -------------------------------------------------------------------------------- 1 | echo "WARNING: target/stm32f3x_stlink.cfg is deprecated, please switch to target/stm32f3x.cfg" 2 | source [find target/stm32f3x.cfg] 3 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/target/stm32f4x_stlink.cfg: -------------------------------------------------------------------------------- 1 | echo "WARNING: target/stm32f4x_stlink.cfg is deprecated, please switch to target/stm32f4x.cfg" 2 | source [find target/stm32f4x.cfg] 3 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/target/stm32f7x.cfg: -------------------------------------------------------------------------------- 1 | # script for stm32f7x family 2 | 3 | # 4 | # stm32f7 devices support both JTAG and SWD transports. 5 | # 6 | source [find target/swj-dp.tcl] 7 | source [find mem_helper.tcl] 8 | 9 | if { [info exists CHIPNAME] } { 10 | set _CHIPNAME $CHIPNAME 11 | } else { 12 | set _CHIPNAME stm32f7x 13 | } 14 | 15 | set _ENDIAN little 16 | 17 | # Work-area is a space in RAM used for flash programming 18 | # By default use 128kB 19 | if { [info exists WORKAREASIZE] } { 20 | set _WORKAREASIZE $WORKAREASIZE 21 | } else { 22 | set _WORKAREASIZE 0x20000 23 | } 24 | 25 | #jtag scan chain 26 | if { [info exists CPUTAPID] } { 27 | set _CPUTAPID $CPUTAPID 28 | } else { 29 | if { [using_jtag] } { 30 | # See STM Document RM0385 31 | # Section 40.6.3 - corresponds to Cortex-M7 with FPU r0p0 32 | set _CPUTAPID 0x5ba00477 33 | } { 34 | set _CPUTAPID 0x5ba02477 35 | } 36 | } 37 | 38 | swj_newdap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID 39 | dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.cpu 40 | 41 | if {[using_jtag]} { 42 | jtag newtap $_CHIPNAME bs -irlen 5 43 | } 44 | 45 | set _TARGETNAME $_CHIPNAME.cpu 46 | target create $_TARGETNAME cortex_m -endian $_ENDIAN -dap $_CHIPNAME.dap 47 | 48 | $_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE -work-area-backup 0 49 | 50 | set _FLASHNAME $_CHIPNAME.flash 51 | flash bank $_FLASHNAME stm32f2x 0 0 0 0 $_TARGETNAME 52 | 53 | # adapter speed should be <= F_CPU/6. F_CPU after reset is 16MHz, so use F_JTAG = 2MHz 54 | adapter_khz 2000 55 | 56 | adapter_nsrst_delay 100 57 | if {[using_jtag]} { 58 | jtag_ntrst_delay 100 59 | } 60 | 61 | # use hardware reset, connect under reset 62 | reset_config srst_only srst_nogate 63 | 64 | if {![using_hla]} { 65 | # if srst is not fitted use SYSRESETREQ to 66 | # perform a soft reset 67 | cortex_m reset_config sysresetreq 68 | } 69 | 70 | $_TARGETNAME configure -event examine-end { 71 | # DBGMCU_CR |= DBG_STANDBY | DBG_STOP | DBG_SLEEP 72 | mmw 0xE0042004 0x00000007 0 73 | 74 | # Stop watchdog counters during halt 75 | # DBGMCU_APB1_FZ |= DBG_IWDG_STOP | DBG_WWDG_STOP 76 | mmw 0xE0042008 0x00001800 0 77 | } 78 | 79 | $_TARGETNAME configure -event trace-config { 80 | # Set TRACE_IOEN; TRACE_MODE is set to async; when using sync 81 | # change this value accordingly to configure trace pins 82 | # assignment 83 | mmw 0xE0042004 0x00000020 0 84 | } 85 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/target/stm32h7x.cfg: -------------------------------------------------------------------------------- 1 | # script for stm32h7x family 2 | 3 | # 4 | # stm32h7 devices support both JTAG and SWD transports. 5 | # 6 | source [find target/swj-dp.tcl] 7 | source [find mem_helper.tcl] 8 | 9 | if { [info exists CHIPNAME] } { 10 | set _CHIPNAME $CHIPNAME 11 | } else { 12 | set _CHIPNAME stm32h7x 13 | } 14 | 15 | set _ENDIAN little 16 | 17 | # Work-area is a space in RAM used for flash programming 18 | # By default use 64kB 19 | if { [info exists WORKAREASIZE] } { 20 | set _WORKAREASIZE $WORKAREASIZE 21 | } else { 22 | set _WORKAREASIZE 0x10000 23 | } 24 | 25 | #jtag scan chain 26 | if { [info exists CPUTAPID] } { 27 | set _CPUTAPID $CPUTAPID 28 | } else { 29 | if { [using_jtag] } { 30 | set _CPUTAPID 0x6ba00477 31 | } { 32 | set _CPUTAPID 0x6ba02477 33 | } 34 | } 35 | 36 | swj_newdap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID 37 | dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.cpu 38 | 39 | if {[using_jtag]} { 40 | swj_newdap $_CHIPNAME bs -irlen 5 41 | } 42 | 43 | set _TARGETNAME $_CHIPNAME.cpu 44 | target create $_TARGETNAME cortex_m -endian $_ENDIAN -dap $_CHIPNAME.dap 45 | 46 | $_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE -work-area-backup 0 47 | 48 | set _FLASHNAME $_CHIPNAME.flash 49 | flash bank $_FLASHNAME stm32h7x 0x08000000 0 0 0 $_TARGETNAME 50 | 51 | # Clock after reset is HSI at 64 MHz, no need of PLL 52 | adapter_khz 1800 53 | 54 | adapter_nsrst_delay 100 55 | if {[using_jtag]} { 56 | jtag_ntrst_delay 100 57 | } 58 | 59 | # use hardware reset, connect under reset 60 | reset_config srst_only srst_nogate 61 | 62 | if {![using_hla]} { 63 | # if srst is not fitted use SYSRESETREQ to 64 | # perform a soft reset 65 | cortex_m reset_config sysresetreq 66 | } 67 | 68 | $_TARGETNAME configure -event examine-end { 69 | # Enable D3 and D1 DBG clocks 70 | # DBGMCU_CR |= D3DBGCKEN | D1DBGCKEN 71 | mmw 0x5C001004 0x00600000 0 72 | 73 | # Enable debug during low power modes (uses more power) 74 | # DBGMCU_CR |= DBG_STANDBY | DBG_STOP | DBG_SLEEP in D3 & D1 Domains 75 | mmw 0x5C001004 0x00000187 0 76 | 77 | # Stop watchdog counters during halt 78 | # DBGMCU_APB3FZ1 |= WWDG1 79 | mmw 0x5C001034 0x00000040 0 80 | # DBGMCU_APB4FZ1 |= WDGLSD1 81 | mmw 0x5C001054 0x00040000 0 82 | } 83 | 84 | $_TARGETNAME configure -event trace-config { 85 | # Set TRACECLKEN; TRACE_MODE is set to async; when using sync 86 | # change this value accordingly to configure trace pins 87 | # assignment 88 | mmw 0x5C001004 0x00100000 0 89 | } 90 | 91 | $_TARGETNAME configure -event reset-init { 92 | # Clock after reset is HSI at 64 MHz, no need of PLL 93 | adapter_khz 4000 94 | } 95 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/target/stm32h7x_dual_bank.cfg: -------------------------------------------------------------------------------- 1 | # script for stm32h7x family (dual flash bank) 2 | source [find target/stm32h7x.cfg] 3 | 4 | # STM32H7xxxI 2Mo have a dual bank flash. 5 | # Add the second flash bank. 6 | set _FLASHNAME $_CHIPNAME.flash1 7 | flash bank $_FLASHNAME stm32h7x 0x08100000 0 0 0 $_TARGETNAME 8 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/target/stm32l0.cfg: -------------------------------------------------------------------------------- 1 | # 2 | # M0+ devices only have SW-DP, but swj-dp code works, just don't 3 | # set any jtag related features 4 | # 5 | 6 | source [find target/swj-dp.tcl] 7 | source [find mem_helper.tcl] 8 | 9 | if { [info exists CHIPNAME] } { 10 | set _CHIPNAME $CHIPNAME 11 | } else { 12 | set _CHIPNAME stm32l0 13 | } 14 | 15 | set _ENDIAN little 16 | 17 | # Work-area is a space in RAM used for flash programming 18 | # By default use 2kB (max ram on smallest part) 19 | if { [info exists WORKAREASIZE] } { 20 | set _WORKAREASIZE $WORKAREASIZE 21 | } else { 22 | set _WORKAREASIZE 0x800 23 | } 24 | 25 | # JTAG speed should be <= F_CPU/6. 26 | # F_CPU after reset is ~2MHz, so use F_JTAG max = 333kHz 27 | adapter_khz 300 28 | 29 | adapter_nsrst_delay 100 30 | 31 | if { [info exists CPUTAPID] } { 32 | set _CPUTAPID $CPUTAPID 33 | } else { 34 | # Arm, m0+, non-multidrop. 35 | # http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.faqs/ka16088.html 36 | set _CPUTAPID 0x0bc11477 37 | } 38 | 39 | swj_newdap $_CHIPNAME cpu -expected-id $_CPUTAPID 40 | dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.cpu 41 | 42 | set _TARGETNAME $_CHIPNAME.cpu 43 | target create $_TARGETNAME cortex_m -endian $_ENDIAN -dap $_CHIPNAME.dap 44 | 45 | $_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE -work-area-backup 0 46 | 47 | # flash size will be probed 48 | set _FLASHNAME $_CHIPNAME.flash 49 | flash bank $_FLASHNAME stm32lx 0x08000000 0 0 0 $_TARGETNAME 50 | 51 | reset_config srst_nogate 52 | 53 | if {![using_hla]} { 54 | # if srst is not fitted use SYSRESETREQ to 55 | # perform a soft reset 56 | cortex_m reset_config sysresetreq 57 | } 58 | 59 | proc stm32l0_enable_HSI16 {} { 60 | # Enable HSI16 as clock source 61 | echo "STM32L0: Enabling HSI16" 62 | 63 | # Set HSI16ON in RCC_CR (leave MSI enabled) 64 | mww 0x40021000 0x00000101 65 | 66 | # Set HSI16 as SYSCLK (RCC_CFGR) 67 | mww 0x4002100c 0x00000001 68 | 69 | # Increase speed 70 | adapter_khz 2500 71 | } 72 | 73 | $_TARGETNAME configure -event reset-init { 74 | stm32l0_enable_HSI16 75 | } 76 | 77 | $_TARGETNAME configure -event reset-start { 78 | adapter_khz 300 79 | } 80 | 81 | $_TARGETNAME configure -event examine-end { 82 | # DBGMCU_CR |= DBG_STANDBY | DBG_STOP | DBG_SLEEP 83 | mmw 0x40015804 0x00000007 0 84 | 85 | # Stop watchdog counters during halt 86 | # DBGMCU_APB1_FZ |= DBG_IWDG_STOP | DBG_WWDG_STOP 87 | mmw 0x40015808 0x00001800 0 88 | } 89 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/target/stm32l0_dual_bank.cfg: -------------------------------------------------------------------------------- 1 | source [find target/stm32l0.cfg] 2 | 3 | # Add the second flash bank. 4 | set _FLASHNAME $_CHIPNAME.flash1 5 | flash bank $_FLASHNAME stm32lx 0 0 0 0 $_TARGETNAME 6 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/target/stm32l1x_dual_bank.cfg: -------------------------------------------------------------------------------- 1 | source [find target/stm32l1.cfg] 2 | 3 | # The stm32l1x 384kb have a dual bank flash. 4 | # Let's add a definition for the second bank here. 5 | 6 | # Add the second flash bank. 7 | set _FLASHNAME $_CHIPNAME.flash1 8 | flash bank $_FLASHNAME stm32lx 0 0 0 0 $_TARGETNAME 9 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/target/stm32lx_stlink.cfg: -------------------------------------------------------------------------------- 1 | echo "WARNING: target/stm32lx_stlink.cfg is deprecated, please switch to target/stm32l1.cfg" 2 | source [find target/stm32l1.cfg] 3 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/target/stm32w108_stlink.cfg: -------------------------------------------------------------------------------- 1 | echo "WARNING: target/stm32w108xx_stlink.cfg is deprecated, please switch to target/stm32w108xx.cfg" 2 | source [find target/stm32w108xx.cfg] 3 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/target/stm32w108xx.cfg: -------------------------------------------------------------------------------- 1 | # 2 | # Target configuration for the ST STM32W108xx chips 3 | # 4 | # Processor: ARM Cortex-M3 5 | # Date: 2013-06-09 6 | # Author: Giuseppe Barba 7 | 8 | # 9 | # stm32 devices support both JTAG and SWD transports. 10 | # 11 | source [find target/swj-dp.tcl] 12 | 13 | if { [info exists CHIPNAME] == 0 } { 14 | set _CHIPNAME stm32w108 15 | } else { 16 | set _CHIPNAME $CHIPNAME 17 | } 18 | 19 | # Work-area is a space in RAM used for flash programming 20 | # By default use 8kB 21 | if { [info exists WORKAREASIZE] } { 22 | set _WORKAREASIZE $WORKAREASIZE 23 | } else { 24 | set _WORKAREASIZE 0x2000 25 | } 26 | 27 | if { [info exists CPUTAPID] } { 28 | set _CPUTAPID $CPUTAPID 29 | } else { 30 | if { [using_jtag] } { 31 | set _CPUTAPID 0x3ba00477 32 | } { 33 | set _CPUTAPID 0x1ba01477 34 | } 35 | } 36 | 37 | set _ENDIAN little 38 | 39 | swj_newdap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID 40 | dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.cpu 41 | 42 | if {[using_jtag]} { 43 | if { [info exists BSTAPID] } { 44 | set _BSTAPID $BSTAPID 45 | swj_newdap $_CHIPNAME bs -irlen 4 -ircapture 0xe -irmask 0xf -expected-id _BSTAPID 46 | } else { 47 | set _BSTAPID_1 0x169a862b 48 | set _BSTAPID_2 0x269a862b 49 | swj_newdap $_CHIPNAME bs -irlen 4 -ircapture 0xe -irmask 0xf \ 50 | -expected-id $_BSTAPID_1 -expected-id $_BSTAPID_2 51 | } 52 | } 53 | # 54 | # Set Target 55 | # 56 | set _TARGETNAME $_CHIPNAME.cpu 57 | target create $_TARGETNAME cortex_m -endian $_ENDIAN -dap $_CHIPNAME.dap 58 | $_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE -work-area-backup 0 59 | 60 | 61 | # Use the flash driver from the EM357 62 | set _FLASHNAME $_CHIPNAME.flash 63 | 64 | # 64k (0x10000) of flash 65 | flash bank $_FLASHNAME em357 0x08000000 0x10000 0 0 $_TARGETNAME 66 | 67 | reset_config srst_nogate 68 | 69 | if {![using_hla]} { 70 | cortex_m reset_config sysresetreq 71 | } 72 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/target/stm32xl.cfg: -------------------------------------------------------------------------------- 1 | # script for stm32xl family (dual flash bank) 2 | source [find target/stm32f1x.cfg] 3 | 4 | # flash size will be probed 5 | set _FLASHNAME $_CHIPNAME.flash1 6 | flash bank $_FLASHNAME stm32f1x 0x08080000 0 0 0 $_TARGETNAME 7 | -------------------------------------------------------------------------------- /tools/share/openocd/scripts/target/swj-dp.tcl: -------------------------------------------------------------------------------- 1 | # ARM Debug Interface V5 (ADI_V5) utility 2 | # ... Mostly for SWJ-DP (not SW-DP or JTAG-DP, since 3 | # SW-DP and JTAG-DP targets don't need to switch based 4 | # on which transport is active. 5 | # 6 | # declare a JTAG or SWD Debug Access Point (DAP) 7 | # based on the transport in use with this session. 8 | # You can't access JTAG ops when SWD is active, etc. 9 | 10 | # params are currently what "jtag newtap" uses 11 | # because OpenOCD internals are still strongly biased 12 | # to JTAG .... but for SWD, "irlen" etc are ignored, 13 | # and the internals work differently 14 | 15 | # for now, ignore non-JTAG and non-SWD transports 16 | # (e.g. initial flash programming via SPI or UART) 17 | 18 | # split out "chip" and "tag" so we can someday handle 19 | # them more uniformly irlen too...) 20 | 21 | if [catch {transport select}] { 22 | echo "Error: unable to select a session transport. Can't continue." 23 | shutdown 24 | } 25 | 26 | proc swj_newdap {chip tag args} { 27 | if [using_hla] { 28 | eval hla newtap $chip $tag $args 29 | } elseif [using_jtag] { 30 | eval jtag newtap $chip $tag $args 31 | } elseif [using_swd] { 32 | eval swd newdap $chip $tag $args 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /tools/windows/dfu-prefix.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GrumpyOldPizza/ArduinoCore-stm32l0/b1cf1cd6eba2f06bbe4edbe76aa43ae5971e8d8c/tools/windows/dfu-prefix.exe -------------------------------------------------------------------------------- /tools/windows/dfu-suffix.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GrumpyOldPizza/ArduinoCore-stm32l0/b1cf1cd6eba2f06bbe4edbe76aa43ae5971e8d8c/tools/windows/dfu-suffix.exe -------------------------------------------------------------------------------- /tools/windows/dfu-util.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GrumpyOldPizza/ArduinoCore-stm32l0/b1cf1cd6eba2f06bbe4edbe76aa43ae5971e8d8c/tools/windows/dfu-util.exe -------------------------------------------------------------------------------- /tools/windows/libwinpthread-1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GrumpyOldPizza/ArduinoCore-stm32l0/b1cf1cd6eba2f06bbe4edbe76aa43ae5971e8d8c/tools/windows/libwinpthread-1.dll -------------------------------------------------------------------------------- /tools/windows/openocd/bin/libusb0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GrumpyOldPizza/ArduinoCore-stm32l0/b1cf1cd6eba2f06bbe4edbe76aa43ae5971e8d8c/tools/windows/openocd/bin/libusb0.dll -------------------------------------------------------------------------------- /tools/windows/openocd/bin/openocd.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GrumpyOldPizza/ArduinoCore-stm32l0/b1cf1cd6eba2f06bbe4edbe76aa43ae5971e8d8c/tools/windows/openocd/bin/openocd.exe -------------------------------------------------------------------------------- /tools/windows/stm32l0-upload.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | set count=1 3 | :wait 4 | "%~dp0\dfu-util.exe" -l -d 0483:df11 | findstr "Found" >NUL 2>&1 5 | if %errorlevel% == 0 ( 6 | "%~dp0\dfu-util.exe" -d %1:%2,0x0483:0xdf11 -a 0 -s 0x08000000:leave -D %3 7 | ) else ( 8 | if %count% gtr 10 goto break 9 | echo %count% 10 | set /A count+=1 11 | ping -n 1 127.0.0.1 >NUL 12 | goto :wait 13 | ) 14 | ) 15 | 16 | :break 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /variants/B-L072Z-LRWAN1/openocd_scripts/b-l072z-lrwan1.cfg: -------------------------------------------------------------------------------- 1 | # This is a B-L072Z-LRWAN1 board with a single STM32L072CZ chip. 2 | # 3 | 4 | source [find interface/stlink.cfg] 5 | 6 | transport select hla_swd 7 | 8 | # chip name 9 | set CHIPNAME STM32L072 10 | 11 | source [find target/stm32l0_dual_bank.cfg] 12 | 13 | reset_config srst_only connect_assert_srst 14 | -------------------------------------------------------------------------------- /variants/B-L072Z-LRWAN1/pins_arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014-2015 Arduino LLC. 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 | // API compatibility 20 | #include "variant.h" 21 | 22 | -------------------------------------------------------------------------------- /variants/Cicada-L082CZ/openocd_scripts/cicada-l082cz.cfg: -------------------------------------------------------------------------------- 1 | # This is a Cicada L082CZ board with a single STM32L082CZ chip. 2 | # 3 | 4 | source [find interface/stlink.cfg] 5 | 6 | transport select hla_swd 7 | 8 | # chip name 9 | set CHIPNAME STM32L082 10 | 11 | source [find target/stm32l0_dual_bank.cfg] 12 | 13 | reset_config none separate 14 | -------------------------------------------------------------------------------- /variants/Cicada-L082CZ/pins_arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014-2015 Arduino LLC. 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 | // API compatibility 20 | #include "variant.h" 21 | 22 | -------------------------------------------------------------------------------- /variants/Cricket-L082CZ/openocd_scripts/cricket-l082cz.cfg: -------------------------------------------------------------------------------- 1 | # This is a Grasshopper L082CZ board with a single STM32L082CZ chip. 2 | # 3 | 4 | source [find interface/stlink.cfg] 5 | 6 | transport select hla_swd 7 | 8 | # chip name 9 | set CHIPNAME STM32L082 10 | 11 | source [find target/stm32l0_dual_bank.cfg] 12 | 13 | reset_config none separate 14 | -------------------------------------------------------------------------------- /variants/Cricket-L082CZ/pins_arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014-2015 Arduino LLC. 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 | // API compatibility 20 | #include "variant.h" 21 | 22 | -------------------------------------------------------------------------------- /variants/Gnat-L082CZ/openocd_scripts/gnat-l082cz.cfg: -------------------------------------------------------------------------------- 1 | # This is a Gnat L082CZ board with a single STM32L082CZ chip. 2 | # 3 | 4 | source [find interface/stlink.cfg] 5 | 6 | transport select hla_swd 7 | 8 | # chip name 9 | set CHIPNAME STM32L082 10 | 11 | source [find target/stm32l0_dual_bank.cfg] 12 | 13 | reset_config none separate 14 | -------------------------------------------------------------------------------- /variants/Gnat-L082CZ/pins_arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014-2015 Arduino LLC. 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 | // API compatibility 20 | #include "variant.h" 21 | 22 | -------------------------------------------------------------------------------- /variants/Grasshopper-L082CZ/openocd_scripts/grasshopper-l082cz.cfg: -------------------------------------------------------------------------------- 1 | # This is a Grasshopper L082CZ board with a single STM32L082CZ chip. 2 | # 3 | 4 | source [find interface/stlink.cfg] 5 | 6 | transport select hla_swd 7 | 8 | # chip name 9 | set CHIPNAME STM32L082 10 | 11 | source [find target/stm32l0_dual_bank.cfg] 12 | 13 | reset_config none separate 14 | -------------------------------------------------------------------------------- /variants/Grasshopper-L082CZ/pins_arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014-2015 Arduino LLC. 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 | // API compatibility 20 | #include "variant.h" 21 | 22 | -------------------------------------------------------------------------------- /variants/I-NUCLEO-LRWAN1/openocd_scripts/i-nucleo-lrwan1.cfg: -------------------------------------------------------------------------------- 1 | # This is a NUCLEO-64 board with a single STM32L052K8 chip. 2 | # 3 | 4 | source [find interface/stlink.cfg] 5 | 6 | transport select hla_swd 7 | 8 | # chip name 9 | set CHIPNAME STM32L052 10 | 11 | source [find target/stm32l0.cfg] 12 | 13 | #reset_config srst_only connect_assert_srst 14 | 15 | reset_config none separate 16 | 17 | 18 | -------------------------------------------------------------------------------- /variants/I-NUCLEO-LRWAN1/pins_arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014-2015 Arduino LLC. 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 | // API compatibility 20 | #include "variant.h" 21 | 22 | -------------------------------------------------------------------------------- /variants/NUCLEO-L053R8/openocd_scripts/nucleo-l053rb.cfg: -------------------------------------------------------------------------------- 1 | # This is a NUCLEO-64 board with a single STM32L053RB chip. 2 | # 3 | 4 | source [find interface/stlink.cfg] 5 | 6 | transport select hla_swd 7 | 8 | # chip name 9 | set CHIPNAME STM32L053 10 | 11 | source [find target/stm32l0.cfg] 12 | 13 | reset_config srst_only connect_assert_srst 14 | -------------------------------------------------------------------------------- /variants/NUCLEO-L053R8/pins_arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014-2015 Arduino LLC. 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 | // API compatibility 20 | #include "variant.h" 21 | 22 | -------------------------------------------------------------------------------- /variants/NUCLEO-L073RZ/openocd_scripts/nucleo-l073rz.cfg: -------------------------------------------------------------------------------- 1 | # This is a NUCLEO-64 board with a single STM32L073RZ chip. 2 | # 3 | 4 | source [find interface/stlink.cfg] 5 | 6 | transport select hla_swd 7 | 8 | # chip name 9 | set CHIPNAME STM32L073 10 | 11 | source [find target/stm32l0_dual_bank.cfg] 12 | 13 | reset_config srst_only connect_assert_srst 14 | -------------------------------------------------------------------------------- /variants/NUCLEO-L073RZ/pins_arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014-2015 Arduino LLC. 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 | // API compatibility 20 | #include "variant.h" 21 | 22 | -------------------------------------------------------------------------------- /variants/P-NUCLEO-LRWAN1/openocd_scripts/p-nucleo-lrwan1.cfg: -------------------------------------------------------------------------------- 1 | # This is a NUCLEO-64 board with a single STM32L072RZ chip. 2 | # 3 | 4 | source [find interface/stlink.cfg] 5 | 6 | transport select hla_swd 7 | 8 | # chip name 9 | set CHIPNAME STM32L073 10 | 11 | source [find target/stm32l0_dual_bank.cfg] 12 | 13 | reset_config srst_only connect_assert_srst 14 | -------------------------------------------------------------------------------- /variants/P-NUCLEO-LRWAN1/pins_arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014-2015 Arduino LLC. 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 | // API compatibility 20 | #include "variant.h" 21 | 22 | --------------------------------------------------------------------------------