├── CHANGELOG.md
├── README.md
├── arduino
├── avrdude_conf
│ └── avrdude.conf
├── boards.txt
├── cores
│ └── RedBear_Duo
│ │ ├── firmware
│ │ ├── communication
│ │ │ └── src
│ │ │ │ ├── buffer_message_channel.h
│ │ │ │ ├── chunked_transfer.h
│ │ │ │ ├── coap.h
│ │ │ │ ├── coap_channel.h
│ │ │ │ ├── communication_diagnostic.h
│ │ │ │ ├── communication_dynalib.h
│ │ │ │ ├── device_keys.h
│ │ │ │ ├── dsakeygen.h
│ │ │ │ ├── dtls_message_channel.h
│ │ │ │ ├── dtls_protocol.h
│ │ │ │ ├── dtls_session_persist.h
│ │ │ │ ├── eckeygen.h
│ │ │ │ ├── events.h
│ │ │ │ ├── file_transfer.h
│ │ │ │ ├── functions.h
│ │ │ │ ├── handshake.h
│ │ │ │ ├── lightssl_message_channel.h
│ │ │ │ ├── lightssl_protocol.h
│ │ │ │ ├── message_channel.h
│ │ │ │ ├── messages.h
│ │ │ │ ├── ping.h
│ │ │ │ ├── protocol.h
│ │ │ │ ├── protocol_defs.h
│ │ │ │ ├── protocol_selector.h
│ │ │ │ ├── publisher.h
│ │ │ │ ├── spark_descriptor.h
│ │ │ │ ├── spark_protocol.h
│ │ │ │ ├── spark_protocol_functions.h
│ │ │ │ ├── subscriptions.h
│ │ │ │ ├── timesyncmanager.h
│ │ │ │ ├── tls_callbacks.h
│ │ │ │ └── variables.h
│ │ ├── dynalib
│ │ │ └── inc
│ │ │ │ ├── dynalib.h
│ │ │ │ └── module_info.h
│ │ ├── hal
│ │ │ ├── inc
│ │ │ │ ├── adc_hal.h
│ │ │ │ ├── bootloader_hal.h
│ │ │ │ ├── can_hal.h
│ │ │ │ ├── cellular_hal.h
│ │ │ │ ├── cellular_hal_constants.h
│ │ │ │ ├── concurrent_hal.h
│ │ │ │ ├── core_hal.h
│ │ │ │ ├── core_subsys_hal.h
│ │ │ │ ├── dac_hal.h
│ │ │ │ ├── delay_hal.h
│ │ │ │ ├── deviceid_hal.h
│ │ │ │ ├── dfu_hal.h
│ │ │ │ ├── eeprom_hal.h
│ │ │ │ ├── gpio_hal.h
│ │ │ │ ├── hal_dynalib.h
│ │ │ │ ├── hal_dynalib_bootloader.h
│ │ │ │ ├── hal_dynalib_btstack.h
│ │ │ │ ├── hal_dynalib_can.h
│ │ │ │ ├── hal_dynalib_cellular.h
│ │ │ │ ├── hal_dynalib_concurrent.h
│ │ │ │ ├── hal_dynalib_core.h
│ │ │ │ ├── hal_dynalib_dct.h
│ │ │ │ ├── hal_dynalib_gpio.h
│ │ │ │ ├── hal_dynalib_hci_usart.h
│ │ │ │ ├── hal_dynalib_i2c.h
│ │ │ │ ├── hal_dynalib_ota.h
│ │ │ │ ├── hal_dynalib_peripherals.h
│ │ │ │ ├── hal_dynalib_rgbled.h
│ │ │ │ ├── hal_dynalib_socket.h
│ │ │ │ ├── hal_dynalib_spi.h
│ │ │ │ ├── hal_dynalib_usart.h
│ │ │ │ ├── hal_dynalib_usb.h
│ │ │ │ ├── hal_dynalib_wlan.h
│ │ │ │ ├── hal_irq_flag.h
│ │ │ │ ├── hal_platform.h
│ │ │ │ ├── i2c_hal.h
│ │ │ │ ├── inet_hal.h
│ │ │ │ ├── interrupts_hal.h
│ │ │ │ ├── memory_hal.h
│ │ │ │ ├── net_hal.h
│ │ │ │ ├── ota_flash_hal.h
│ │ │ │ ├── pinmap_hal.h
│ │ │ │ ├── product_store_hal.h
│ │ │ │ ├── pwm_hal.h
│ │ │ │ ├── rgbled_hal.h
│ │ │ │ ├── rng_hal.h
│ │ │ │ ├── rtc_hal.h
│ │ │ │ ├── servo_hal.h
│ │ │ │ ├── socket_hal.h
│ │ │ │ ├── spi_hal.h
│ │ │ │ ├── syshealth_hal.h
│ │ │ │ ├── timer_hal.h
│ │ │ │ ├── tone_hal.h
│ │ │ │ ├── usart_hal.h
│ │ │ │ ├── usb_config_hal.h
│ │ │ │ ├── usb_hal.h
│ │ │ │ ├── watchdog_hal.h
│ │ │ │ └── wlan_hal.h
│ │ │ ├── shared
│ │ │ │ ├── flash_device_hal.h
│ │ │ │ ├── hal_event.h
│ │ │ │ ├── module_info_hal.h
│ │ │ │ ├── parse_server_address.h
│ │ │ │ └── system_tick_hal.h
│ │ │ └── src
│ │ │ │ ├── duo
│ │ │ │ ├── ble_provision.h
│ │ │ │ ├── btstack_hal.h
│ │ │ │ ├── btstack_hal_define.h
│ │ │ │ ├── dct_hal.h
│ │ │ │ ├── device_name.h
│ │ │ │ ├── hci_usart_hal.h
│ │ │ │ ├── include
│ │ │ │ │ ├── default_bt_config_dct.h
│ │ │ │ │ ├── default_network_config_dct.h
│ │ │ │ │ ├── default_p2p_config_dct.h
│ │ │ │ │ ├── default_wifi_config_dct.h
│ │ │ │ │ ├── wiced.h
│ │ │ │ │ ├── wiced_audio.h
│ │ │ │ │ ├── wiced_bluetooth_result.h
│ │ │ │ │ ├── wiced_codec_if.h
│ │ │ │ │ ├── wiced_constants.h
│ │ │ │ │ ├── wiced_crypto.h
│ │ │ │ │ ├── wiced_deep_sleep.h
│ │ │ │ │ ├── wiced_defaults.h
│ │ │ │ │ ├── wiced_dtls.h
│ │ │ │ │ ├── wiced_easy_setup.h
│ │ │ │ │ ├── wiced_filesystem.h
│ │ │ │ │ ├── wiced_framework.h
│ │ │ │ │ ├── wiced_management.h
│ │ │ │ │ ├── wiced_platform.h
│ │ │ │ │ ├── wiced_resource.h
│ │ │ │ │ ├── wiced_result.h
│ │ │ │ │ ├── wiced_rtos.h
│ │ │ │ │ ├── wiced_security.h
│ │ │ │ │ ├── wiced_tcpip.h
│ │ │ │ │ ├── wiced_time.h
│ │ │ │ │ ├── wiced_tls.h
│ │ │ │ │ ├── wiced_usb.h
│ │ │ │ │ ├── wiced_utilities.h
│ │ │ │ │ └── wiced_wifi.h
│ │ │ │ ├── libraries
│ │ │ │ │ └── btstack
│ │ │ │ │ │ ├── port
│ │ │ │ │ │ ├── btstack_chipset_bcm.h
│ │ │ │ │ │ ├── btstack_config.h
│ │ │ │ │ │ ├── btstack_debug.h
│ │ │ │ │ │ ├── btstack_run_loop_wiced.h
│ │ │ │ │ │ ├── btstack_version.h
│ │ │ │ │ │ └── hci_dump.h
│ │ │ │ │ │ └── src
│ │ │ │ │ │ ├── ble
│ │ │ │ │ │ ├── ad_parser.h
│ │ │ │ │ │ ├── ancs_client.h
│ │ │ │ │ │ ├── att_db.h
│ │ │ │ │ │ ├── att_db_util.h
│ │ │ │ │ │ ├── att_dispatch.h
│ │ │ │ │ │ ├── att_server.h
│ │ │ │ │ │ ├── core.h
│ │ │ │ │ │ ├── gatt_client.h
│ │ │ │ │ │ ├── le_device_db.h
│ │ │ │ │ │ └── sm.h
│ │ │ │ │ │ ├── bluetooth.h
│ │ │ │ │ │ ├── btstack.h
│ │ │ │ │ │ ├── btstack_chipset.h
│ │ │ │ │ │ ├── btstack_control.h
│ │ │ │ │ │ ├── btstack_defines.h
│ │ │ │ │ │ ├── btstack_event.h
│ │ │ │ │ │ ├── btstack_linked_list.h
│ │ │ │ │ │ ├── btstack_memory.h
│ │ │ │ │ │ ├── btstack_memory_pool.h
│ │ │ │ │ │ ├── btstack_run_loop.h
│ │ │ │ │ │ ├── btstack_slip.h
│ │ │ │ │ │ ├── btstack_util.h
│ │ │ │ │ │ ├── classic
│ │ │ │ │ │ ├── bnep.h
│ │ │ │ │ │ ├── btstack_link_key_db.h
│ │ │ │ │ │ ├── btstack_link_key_db_memory.h
│ │ │ │ │ │ ├── core.h
│ │ │ │ │ │ ├── hfp.h
│ │ │ │ │ │ ├── hfp_ag.h
│ │ │ │ │ │ ├── hfp_gsm_model.h
│ │ │ │ │ │ ├── hfp_hf.h
│ │ │ │ │ │ ├── hsp_ag.h
│ │ │ │ │ │ ├── hsp_hs.h
│ │ │ │ │ │ ├── pan.h
│ │ │ │ │ │ ├── rfcomm.h
│ │ │ │ │ │ ├── sdp_client.h
│ │ │ │ │ │ ├── sdp_client_rfcomm.h
│ │ │ │ │ │ ├── sdp_server.h
│ │ │ │ │ │ ├── sdp_util.h
│ │ │ │ │ │ └── spp_server.h
│ │ │ │ │ │ ├── gap.h
│ │ │ │ │ │ ├── hci.h
│ │ │ │ │ │ ├── hci_cmd.h
│ │ │ │ │ │ ├── hci_transport.h
│ │ │ │ │ │ ├── l2cap.h
│ │ │ │ │ │ └── l2cap_signaling.h
│ │ │ │ ├── miniz.h
│ │ │ │ ├── network_interface.h
│ │ │ │ ├── socket_internal.h
│ │ │ │ ├── softap.h
│ │ │ │ ├── softap_http.h
│ │ │ │ ├── usbd_desc_device.h
│ │ │ │ ├── wiced
│ │ │ │ │ ├── WWD
│ │ │ │ │ │ └── include
│ │ │ │ │ │ │ ├── wwd_assert.h
│ │ │ │ │ │ │ ├── wwd_constants.h
│ │ │ │ │ │ │ ├── wwd_debug.h
│ │ │ │ │ │ │ ├── wwd_eapol.h
│ │ │ │ │ │ │ ├── wwd_events.h
│ │ │ │ │ │ │ ├── wwd_management.h
│ │ │ │ │ │ │ ├── wwd_poll.h
│ │ │ │ │ │ │ ├── wwd_structures.h
│ │ │ │ │ │ │ ├── wwd_wifi.h
│ │ │ │ │ │ │ └── wwd_wlioctl.h
│ │ │ │ │ ├── platform
│ │ │ │ │ │ ├── GCC
│ │ │ │ │ │ │ ├── linker_symbols.h
│ │ │ │ │ │ │ └── platform_toolchain.h
│ │ │ │ │ │ └── include
│ │ │ │ │ │ │ ├── elf.h
│ │ │ │ │ │ │ ├── platform_audio.h
│ │ │ │ │ │ │ ├── platform_bluetooth.h
│ │ │ │ │ │ │ ├── platform_button.h
│ │ │ │ │ │ │ ├── platform_constants.h
│ │ │ │ │ │ │ ├── platform_dct.h
│ │ │ │ │ │ │ ├── platform_dct_old_sdk.h
│ │ │ │ │ │ │ ├── platform_ethernet.h
│ │ │ │ │ │ │ ├── platform_external_memory.h
│ │ │ │ │ │ │ ├── platform_init.h
│ │ │ │ │ │ │ ├── platform_mfi.h
│ │ │ │ │ │ │ ├── platform_nfc.h
│ │ │ │ │ │ │ ├── platform_peripheral.h
│ │ │ │ │ │ │ ├── platform_resource.h
│ │ │ │ │ │ │ ├── platform_sflash_dct.h
│ │ │ │ │ │ │ ├── platform_sleep.h
│ │ │ │ │ │ │ ├── platform_usb.h
│ │ │ │ │ │ │ └── wiced_block_device.h
│ │ │ │ │ └── security
│ │ │ │ │ │ └── BESL
│ │ │ │ │ │ ├── crypto
│ │ │ │ │ │ ├── crypto_constants.h
│ │ │ │ │ │ └── crypto_structures.h
│ │ │ │ │ │ ├── host
│ │ │ │ │ │ └── WICED
│ │ │ │ │ │ │ ├── besl_host.h
│ │ │ │ │ │ │ ├── besl_host_rtos_structures.h
│ │ │ │ │ │ │ ├── cipher_suites.h
│ │ │ │ │ │ │ ├── dtls_cipher_suites.h
│ │ │ │ │ │ │ ├── dtls_types.h
│ │ │ │ │ │ │ ├── tls_cipher_suites.h
│ │ │ │ │ │ │ ├── tls_types.h
│ │ │ │ │ │ │ ├── wiced_p2p.h
│ │ │ │ │ │ │ ├── wiced_supplicant.h
│ │ │ │ │ │ │ ├── wiced_tcpip_tls_api.h
│ │ │ │ │ │ │ ├── wiced_udpip_dtls_api.h
│ │ │ │ │ │ │ ├── wiced_wps.h
│ │ │ │ │ │ │ └── wps_host.h
│ │ │ │ │ │ ├── include
│ │ │ │ │ │ ├── besl_constants.h
│ │ │ │ │ │ ├── besl_host_interface.h
│ │ │ │ │ │ ├── besl_structures.h
│ │ │ │ │ │ ├── p2p_host_interface.h
│ │ │ │ │ │ ├── scan_host_interface.h
│ │ │ │ │ │ ├── wps_host_interface.h
│ │ │ │ │ │ └── wps_p2p_interface.h
│ │ │ │ │ │ └── supplicant
│ │ │ │ │ │ ├── supplicant_constants.h
│ │ │ │ │ │ └── supplicant_structures.h
│ │ │ │ ├── wlan_internal.h
│ │ │ │ └── wwd_resources.h
│ │ │ │ ├── stm32
│ │ │ │ ├── bits
│ │ │ │ │ └── gthr-default.h
│ │ │ │ ├── concurrent_hal_impl.h
│ │ │ │ ├── interrupts_irq.h
│ │ │ │ └── ota_module.h
│ │ │ │ └── stm32f2xx
│ │ │ │ ├── bootloader.h
│ │ │ │ ├── core_hal_stm32f2xx.h
│ │ │ │ ├── dct_hal_stm32f2xx.h
│ │ │ │ ├── deepsleep_hal_impl.h
│ │ │ │ ├── device_code.h
│ │ │ │ ├── interrupts_impl.h
│ │ │ │ ├── ota_flash_hal_stm32f2xx.h
│ │ │ │ ├── pinmap_impl.h
│ │ │ │ ├── platform_headers.h
│ │ │ │ ├── rgbled_hal_impl.h
│ │ │ │ ├── static_recursive_mutex.h
│ │ │ │ └── usb_settings.h
│ │ ├── platform
│ │ │ ├── MCU
│ │ │ │ ├── STM32F2xx
│ │ │ │ │ ├── CMSIS
│ │ │ │ │ │ ├── Device
│ │ │ │ │ │ │ └── ST
│ │ │ │ │ │ │ │ └── Include
│ │ │ │ │ │ │ │ ├── stm32f2xx.h
│ │ │ │ │ │ │ │ └── system_stm32f2xx.h
│ │ │ │ │ │ └── Include
│ │ │ │ │ │ │ ├── arm_common_tables.h
│ │ │ │ │ │ │ ├── arm_math.h
│ │ │ │ │ │ │ ├── core_cm0.h
│ │ │ │ │ │ │ ├── core_cm3.h
│ │ │ │ │ │ │ ├── core_cm4.h
│ │ │ │ │ │ │ ├── core_cm4_simd.h
│ │ │ │ │ │ │ ├── core_cmFunc.h
│ │ │ │ │ │ │ └── core_cmInstr.h
│ │ │ │ │ ├── SPARK_Firmware_Driver
│ │ │ │ │ │ └── inc
│ │ │ │ │ │ │ ├── dcd_flash_impl.h
│ │ │ │ │ │ │ ├── dct.h
│ │ │ │ │ │ │ ├── eeprom_emulation_impl.h
│ │ │ │ │ │ │ ├── flash_acquire.h
│ │ │ │ │ │ │ ├── flash_mal.h
│ │ │ │ │ │ │ ├── flash_storage_impl.h
│ │ │ │ │ │ │ ├── hw_config.h
│ │ │ │ │ │ │ ├── periph_lock.h
│ │ │ │ │ │ │ ├── platform_config.h
│ │ │ │ │ │ │ ├── platform_flash_modules.h
│ │ │ │ │ │ │ ├── platform_system_flags.h
│ │ │ │ │ │ │ ├── sflash_storage_impl.h
│ │ │ │ │ │ │ ├── spi_flash.h
│ │ │ │ │ │ │ ├── stm32f2xx_conf.h
│ │ │ │ │ │ │ ├── system_flags_impl.h
│ │ │ │ │ │ │ ├── usb_conf.h
│ │ │ │ │ │ │ ├── usbd_composite.h
│ │ │ │ │ │ │ ├── usbd_conf.h
│ │ │ │ │ │ │ ├── usbd_desc.h
│ │ │ │ │ │ │ ├── usbd_mcdc.h
│ │ │ │ │ │ │ ├── usbd_mhid.h
│ │ │ │ │ │ │ └── usbd_wcid.h
│ │ │ │ │ ├── STM32_StdPeriph_Driver
│ │ │ │ │ │ └── inc
│ │ │ │ │ │ │ ├── misc.h
│ │ │ │ │ │ │ ├── stm32f2xx_adc.h
│ │ │ │ │ │ │ ├── stm32f2xx_can.h
│ │ │ │ │ │ │ ├── stm32f2xx_crc.h
│ │ │ │ │ │ │ ├── stm32f2xx_cryp.h
│ │ │ │ │ │ │ ├── stm32f2xx_dac.h
│ │ │ │ │ │ │ ├── stm32f2xx_dbgmcu.h
│ │ │ │ │ │ │ ├── stm32f2xx_dcmi.h
│ │ │ │ │ │ │ ├── stm32f2xx_dma.h
│ │ │ │ │ │ │ ├── stm32f2xx_exti.h
│ │ │ │ │ │ │ ├── stm32f2xx_flash.h
│ │ │ │ │ │ │ ├── stm32f2xx_fsmc.h
│ │ │ │ │ │ │ ├── stm32f2xx_gpio.h
│ │ │ │ │ │ │ ├── stm32f2xx_hash.h
│ │ │ │ │ │ │ ├── stm32f2xx_i2c.h
│ │ │ │ │ │ │ ├── stm32f2xx_iwdg.h
│ │ │ │ │ │ │ ├── stm32f2xx_pwr.h
│ │ │ │ │ │ │ ├── stm32f2xx_rcc.h
│ │ │ │ │ │ │ ├── stm32f2xx_rng.h
│ │ │ │ │ │ │ ├── stm32f2xx_rtc.h
│ │ │ │ │ │ │ ├── stm32f2xx_sdio.h
│ │ │ │ │ │ │ ├── stm32f2xx_spi.h
│ │ │ │ │ │ │ ├── stm32f2xx_syscfg.h
│ │ │ │ │ │ │ ├── stm32f2xx_tim.h
│ │ │ │ │ │ │ ├── stm32f2xx_usart.h
│ │ │ │ │ │ │ └── stm32f2xx_wwdg.h
│ │ │ │ │ ├── STM32_USB_Device_Driver
│ │ │ │ │ │ └── inc
│ │ │ │ │ │ │ ├── usbd_audio_core.h
│ │ │ │ │ │ │ ├── usbd_audio_out_if.h
│ │ │ │ │ │ │ ├── usbd_cdc_core.h
│ │ │ │ │ │ │ ├── usbd_cdc_if_template.h
│ │ │ │ │ │ │ ├── usbd_conf_template.h
│ │ │ │ │ │ │ ├── usbd_core.h
│ │ │ │ │ │ │ ├── usbd_dct_if.h
│ │ │ │ │ │ │ ├── usbd_def.h
│ │ │ │ │ │ │ ├── usbd_dfu_core.h
│ │ │ │ │ │ │ ├── usbd_dfu_mal.h
│ │ │ │ │ │ │ ├── usbd_flash_if.h
│ │ │ │ │ │ │ ├── usbd_hid_core.h
│ │ │ │ │ │ │ ├── usbd_ioreq.h
│ │ │ │ │ │ │ ├── usbd_mem_if_template.h
│ │ │ │ │ │ │ ├── usbd_msc_bot.h
│ │ │ │ │ │ │ ├── usbd_msc_core.h
│ │ │ │ │ │ │ ├── usbd_msc_data.h
│ │ │ │ │ │ │ ├── usbd_msc_mem.h
│ │ │ │ │ │ │ ├── usbd_msc_scsi.h
│ │ │ │ │ │ │ ├── usbd_otp_if.h
│ │ │ │ │ │ │ ├── usbd_req.h
│ │ │ │ │ │ │ ├── usbd_sflash_if.h
│ │ │ │ │ │ │ └── usbd_usr.h
│ │ │ │ │ ├── STM32_USB_Host_Driver
│ │ │ │ │ │ └── inc
│ │ │ │ │ │ │ ├── usbh_conf_template.h
│ │ │ │ │ │ │ ├── usbh_core.h
│ │ │ │ │ │ │ ├── usbh_def.h
│ │ │ │ │ │ │ ├── usbh_hcs.h
│ │ │ │ │ │ │ ├── usbh_hid_core.h
│ │ │ │ │ │ │ ├── usbh_hid_keybd.h
│ │ │ │ │ │ │ ├── usbh_hid_mouse.h
│ │ │ │ │ │ │ ├── usbh_ioreq.h
│ │ │ │ │ │ │ ├── usbh_msc_bot.h
│ │ │ │ │ │ │ ├── usbh_msc_core.h
│ │ │ │ │ │ │ ├── usbh_msc_scsi.h
│ │ │ │ │ │ │ └── usbh_stdreq.h
│ │ │ │ │ └── STM32_USB_OTG_Driver
│ │ │ │ │ │ └── inc
│ │ │ │ │ │ ├── usb_bsp.h
│ │ │ │ │ │ ├── usb_conf_template.h
│ │ │ │ │ │ ├── usb_core.h
│ │ │ │ │ │ ├── usb_dcd.h
│ │ │ │ │ │ ├── usb_dcd_int.h
│ │ │ │ │ │ ├── usb_defines.h
│ │ │ │ │ │ ├── usb_hcd.h
│ │ │ │ │ │ ├── usb_hcd_int.h
│ │ │ │ │ │ ├── usb_otg.h
│ │ │ │ │ │ └── usb_regs.h
│ │ │ │ └── shared
│ │ │ │ │ └── STM32
│ │ │ │ │ └── inc
│ │ │ │ │ ├── flash_access.h
│ │ │ │ │ ├── hw_system_flags.h
│ │ │ │ │ └── hw_ticks.h
│ │ │ └── shared
│ │ │ │ └── inc
│ │ │ │ └── platforms.h
│ │ ├── services
│ │ │ └── inc
│ │ │ │ ├── appender.h
│ │ │ │ ├── atomic_flag_mutex.h
│ │ │ │ ├── bytes2hexbuf.h
│ │ │ │ ├── combine_hash.h
│ │ │ │ ├── completion_handler.h
│ │ │ │ ├── config.h
│ │ │ │ ├── dcd.h
│ │ │ │ ├── debug.h
│ │ │ │ ├── diagnostics.h
│ │ │ │ ├── eeprom_emulation.h
│ │ │ │ ├── fixed_queue.h
│ │ │ │ ├── flash_storage.h
│ │ │ │ ├── jsmn.h
│ │ │ │ ├── led_service.h
│ │ │ │ ├── logging.h
│ │ │ │ ├── panic.h
│ │ │ │ ├── panic_codes.h
│ │ │ │ ├── preprocessor.h
│ │ │ │ ├── printf_export.h
│ │ │ │ ├── rgbled.h
│ │ │ │ ├── ringbuf_helper.h
│ │ │ │ ├── service_debug.h
│ │ │ │ ├── services2_dynalib.h
│ │ │ │ ├── services_dynalib.h
│ │ │ │ ├── spark_macros.h
│ │ │ │ ├── static_assert.h
│ │ │ │ ├── system_error.h
│ │ │ │ ├── test_malloc.h
│ │ │ │ └── underlying_type.h
│ │ ├── system
│ │ │ └── inc
│ │ │ │ ├── active_object.h
│ │ │ │ ├── append_list.h
│ │ │ │ ├── channel.h
│ │ │ │ ├── simple_pool_allocator.h
│ │ │ │ ├── system_avrdude.h
│ │ │ │ ├── system_cloud.h
│ │ │ │ ├── system_control.h
│ │ │ │ ├── system_dynalib.h
│ │ │ │ ├── system_dynalib_cloud.h
│ │ │ │ ├── system_dynalib_net.h
│ │ │ │ ├── system_event.h
│ │ │ │ ├── system_led_signal.h
│ │ │ │ ├── system_mode.h
│ │ │ │ ├── system_network.h
│ │ │ │ ├── system_network_internal.h
│ │ │ │ ├── system_power.h
│ │ │ │ ├── system_setup.h
│ │ │ │ ├── system_sleep.h
│ │ │ │ ├── system_string_interpolate.h
│ │ │ │ ├── system_task.h
│ │ │ │ ├── system_threading.h
│ │ │ │ ├── system_update.h
│ │ │ │ ├── system_user.h
│ │ │ │ ├── system_version.h
│ │ │ │ ├── system_wireless_update.h
│ │ │ │ ├── system_ymodem.h
│ │ │ │ └── wifitester.h
│ │ ├── user
│ │ │ └── inc
│ │ │ │ ├── Arduino.h
│ │ │ │ ├── Particle.h
│ │ │ │ ├── Print.h
│ │ │ │ ├── SPI.h
│ │ │ │ ├── Stream.h
│ │ │ │ ├── WProgram.h
│ │ │ │ ├── WString.h
│ │ │ │ ├── Wire.h
│ │ │ │ └── application.h
│ │ └── wiring
│ │ │ └── inc
│ │ │ ├── avr
│ │ │ └── pgmspace.h
│ │ │ ├── debug_output_handler.h
│ │ │ ├── fast_pin.h
│ │ │ ├── spark_disable_cloud.h
│ │ │ ├── spark_disable_wlan.h
│ │ │ ├── spark_wiring.h
│ │ │ ├── spark_wiring_arduino.h
│ │ │ ├── spark_wiring_arduino_binary.h
│ │ │ ├── spark_wiring_arduino_constants.h
│ │ │ ├── spark_wiring_async.h
│ │ │ ├── spark_wiring_btstack.h
│ │ │ ├── spark_wiring_can.h
│ │ │ ├── spark_wiring_cellular.h
│ │ │ ├── spark_wiring_cellular_printable.h
│ │ │ ├── spark_wiring_character.h
│ │ │ ├── spark_wiring_client.h
│ │ │ ├── spark_wiring_cloud.h
│ │ │ ├── spark_wiring_constants.h
│ │ │ ├── spark_wiring_diagnostics.h
│ │ │ ├── spark_wiring_eeprom.h
│ │ │ ├── spark_wiring_error.h
│ │ │ ├── spark_wiring_fixed_point.h
│ │ │ ├── spark_wiring_flags.h
│ │ │ ├── spark_wiring_fuel.h
│ │ │ ├── spark_wiring_global.h
│ │ │ ├── spark_wiring_hciserial.h
│ │ │ ├── spark_wiring_i2c.h
│ │ │ ├── spark_wiring_interrupts.h
│ │ │ ├── spark_wiring_ipaddress.h
│ │ │ ├── spark_wiring_json.h
│ │ │ ├── spark_wiring_led.h
│ │ │ ├── spark_wiring_logging.h
│ │ │ ├── spark_wiring_network.h
│ │ │ ├── spark_wiring_platform.h
│ │ │ ├── spark_wiring_power.h
│ │ │ ├── spark_wiring_print.h
│ │ │ ├── spark_wiring_printable.h
│ │ │ ├── spark_wiring_random.h
│ │ │ ├── spark_wiring_rgb.h
│ │ │ ├── spark_wiring_servo.h
│ │ │ ├── spark_wiring_sflash.h
│ │ │ ├── spark_wiring_signal.h
│ │ │ ├── spark_wiring_spi.h
│ │ │ ├── spark_wiring_startup.h
│ │ │ ├── spark_wiring_stream.h
│ │ │ ├── spark_wiring_string.h
│ │ │ ├── spark_wiring_system.h
│ │ │ ├── spark_wiring_tcpclient.h
│ │ │ ├── spark_wiring_tcpserver.h
│ │ │ ├── spark_wiring_thread.h
│ │ │ ├── spark_wiring_ticks.h
│ │ │ ├── spark_wiring_time.h
│ │ │ ├── spark_wiring_timer.h
│ │ │ ├── spark_wiring_tone.h
│ │ │ ├── spark_wiring_udp.h
│ │ │ ├── spark_wiring_usartserial.h
│ │ │ ├── spark_wiring_usbkeyboard.h
│ │ │ ├── spark_wiring_usbkeyboard_scancode.h
│ │ │ ├── spark_wiring_usbmouse.h
│ │ │ ├── spark_wiring_usbserial.h
│ │ │ ├── spark_wiring_vector.h
│ │ │ ├── spark_wiring_version.h
│ │ │ ├── spark_wiring_watchdog.h
│ │ │ ├── spark_wiring_wifi.h
│ │ │ ├── spark_wiring_wifi_credentials.h
│ │ │ ├── spark_wiring_wifitester.h
│ │ │ └── string_convert.h
│ │ └── libs
│ │ ├── STM32F2xx_Peripheral_Libraries.a
│ │ ├── libcommunication-dynalib.a
│ │ ├── libhal-dynalib.a
│ │ ├── libplatform.a
│ │ ├── librt-dynalib.a
│ │ ├── libservices-dynalib.a
│ │ ├── libsystem-dynalib.a
│ │ ├── libwiring.a
│ │ ├── libwiring_globals.a
│ │ ├── module_info.o
│ │ ├── newlib_stubs.o
│ │ ├── user_export.o
│ │ └── user_module.o
├── firmwares
│ ├── README.md
│ ├── duo-bootloader-r6.bin
│ ├── duo-factory-reset.bin
│ ├── duo-system-part1-v0.3.3.bin
│ ├── duo-system-part2-v0.3.3.bin
│ ├── duo-user-part.bin
│ └── duo-wifi-r2.bin
├── libraries
│ └── RedBear_Duo
│ │ ├── examples
│ │ ├── 01.Basics
│ │ │ ├── Blink
│ │ │ │ └── Blink.ino
│ │ │ ├── ExternalSPIFlash
│ │ │ │ └── ExternalSPIFlash.ino
│ │ │ └── RGB
│ │ │ │ └── RGB.ino
│ │ ├── 02.WiFi
│ │ │ ├── ClientSendReceiveString
│ │ │ │ └── ClientSendReceiveString.ino
│ │ │ ├── ConnectNoEncryption
│ │ │ │ └── ConnectNoEncryption.ino
│ │ │ ├── ConnectWithWEP
│ │ │ │ └── ConnectWithWEP.ino
│ │ │ ├── ConnectWithWPA
│ │ │ │ └── ConnectWithWPA.ino
│ │ │ ├── ScanNetworks
│ │ │ │ └── ScanNetworks.ino
│ │ │ ├── SimpleWebServerWiFi
│ │ │ │ └── SimpleWebServerWiFi.ino
│ │ │ ├── WiFiChatServer
│ │ │ │ └── WiFiChatServer.ino
│ │ │ ├── WiFiTCPServerMultiClients
│ │ │ │ └── WiFiTCPServerMultiClients.ino
│ │ │ ├── WiFiUdpNtpClient
│ │ │ │ └── WiFiUdpNtpClient.ino
│ │ │ ├── WiFiUdpSendReceiveString
│ │ │ │ └── WiFiUdpSendReceiveString.ino
│ │ │ ├── WiFiWebClient
│ │ │ │ └── WiFiWebClient.ino
│ │ │ ├── WiFiWebClientRepeating
│ │ │ │ └── WiFiWebClientRepeating.ino
│ │ │ └── WiFiWebServer
│ │ │ │ └── WiFiWebServer.ino
│ │ ├── 03.BLE
│ │ │ ├── BLEController
│ │ │ │ ├── BLEController.ino
│ │ │ │ └── pin_inf.h
│ │ │ ├── BLEScanner
│ │ │ │ └── BLEScanner.ino
│ │ │ ├── EddyStone
│ │ │ │ └── EddyStone.ino
│ │ │ ├── IBeacon
│ │ │ │ └── IBeacon.ino
│ │ │ ├── SimpleBLECentral
│ │ │ │ └── SimpleBLECentral.ino
│ │ │ ├── SimpleBLEPeripheral
│ │ │ │ └── SimpleBLEPeripheral.ino
│ │ │ ├── SimpleChat
│ │ │ │ └── SimpleChat.ino
│ │ │ └── SimpleControls
│ │ │ │ └── SimpleControls.ino
│ │ ├── 04.Combo
│ │ │ ├── SimpleWebBLELedController
│ │ │ │ └── SimpleWebBLELedController.ino
│ │ │ ├── TCPServerControlMultiBLEPeripherals
│ │ │ │ ├── TCPServerControlMultiBLEPeripherals.ino
│ │ │ │ ├── ble_nano.cpp
│ │ │ │ ├── ble_nano.h
│ │ │ │ └── json_format.txt
│ │ │ └── WebServerBLEScanner
│ │ │ │ └── WebServerBLEScanner.ino
│ │ ├── 05.Grove
│ │ │ ├── Example01
│ │ │ │ └── Example01.ino
│ │ │ ├── Example02
│ │ │ │ └── Example02.ino
│ │ │ ├── Example03
│ │ │ │ └── Example03.ino
│ │ │ ├── Example04
│ │ │ │ └── Example04.ino
│ │ │ ├── Example05
│ │ │ │ └── Example05.ino
│ │ │ ├── Example06
│ │ │ │ └── Example06.ino
│ │ │ ├── Project01
│ │ │ │ └── Project01.ino
│ │ │ └── Project02
│ │ │ │ └── Project02.ino
│ │ └── 06.Cloud
│ │ │ ├── CloudFunction
│ │ │ └── CloudFunction.ino
│ │ │ ├── CloudVariable
│ │ │ └── CloudVariable.ino
│ │ │ ├── Echo
│ │ │ └── Echo.ino
│ │ │ ├── PublishPrivateEvent
│ │ │ └── PublishPrivateEvent.ino
│ │ │ ├── PublishPublicEvent
│ │ │ └── PublishPublicEvent.ino
│ │ │ ├── SubscribeEvent
│ │ │ └── SubscribeEvent.ino
│ │ │ ├── Tinker
│ │ │ └── Tinker.ino
│ │ │ └── UnsubscribeEvent
│ │ │ └── UnsubscribeEvent.ino
│ │ ├── keywords.txt
│ │ ├── library.properties
│ │ └── src
│ │ ├── AES.cpp
│ │ ├── AES.h
│ │ ├── ArduinoJson.h
│ │ ├── Buffer.cpp
│ │ ├── Buffer.h
│ │ ├── ChainableLED.cpp
│ │ ├── ChainableLED.h
│ │ ├── Label.cpp
│ │ ├── Label.h
│ │ ├── MDNS.cpp
│ │ ├── MDNS.h
│ │ ├── MMA7660.cpp
│ │ ├── MMA7660.h
│ │ ├── QuerySet.cpp
│ │ ├── QuerySet.h
│ │ ├── TM1637.cpp
│ │ ├── TM1637.h
│ │ ├── TxtData.cpp
│ │ ├── TxtData.h
│ │ ├── eddystone.h
│ │ ├── include
│ │ ├── ArduinoJson.h
│ │ └── ArduinoJson
│ │ │ ├── Arduino
│ │ │ ├── Print.hpp
│ │ │ └── String.hpp
│ │ │ ├── Configuration.hpp
│ │ │ ├── DynamicJsonBuffer.hpp
│ │ │ ├── Internals
│ │ │ ├── BlockJsonBuffer.hpp
│ │ │ ├── Comments.hpp
│ │ │ ├── DummyPrint.hpp
│ │ │ ├── DynamicStringBuilder.hpp
│ │ │ ├── Encoding.hpp
│ │ │ ├── ForceInline.hpp
│ │ │ ├── IndentedPrint.hpp
│ │ │ ├── JsonBufferAllocated.hpp
│ │ │ ├── JsonFloat.hpp
│ │ │ ├── JsonInteger.hpp
│ │ │ ├── JsonParser.hpp
│ │ │ ├── JsonPrintable.hpp
│ │ │ ├── JsonVariantContent.hpp
│ │ │ ├── JsonVariantType.hpp
│ │ │ ├── JsonWriter.hpp
│ │ │ ├── List.hpp
│ │ │ ├── ListConstIterator.hpp
│ │ │ ├── ListIterator.hpp
│ │ │ ├── ListNode.hpp
│ │ │ ├── Parse.hpp
│ │ │ ├── Prettyfier.hpp
│ │ │ ├── ReferenceType.hpp
│ │ │ ├── StaticStringBuilder.hpp
│ │ │ ├── StreamPrintAdapter.hpp
│ │ │ └── Unparsed.hpp
│ │ │ ├── JsonArray.hpp
│ │ │ ├── JsonArray.ipp
│ │ │ ├── JsonArraySubscript.hpp
│ │ │ ├── JsonBuffer.hpp
│ │ │ ├── JsonObject.hpp
│ │ │ ├── JsonObject.ipp
│ │ │ ├── JsonObjectKey.hpp
│ │ │ ├── JsonObjectSubscript.hpp
│ │ │ ├── JsonPair.hpp
│ │ │ ├── JsonVariant.hpp
│ │ │ ├── JsonVariant.ipp
│ │ │ ├── JsonVariantBase.hpp
│ │ │ ├── StaticJsonBuffer.hpp
│ │ │ └── TypeTraits
│ │ │ ├── EnableIf.hpp
│ │ │ ├── IsFloatingPoint.hpp
│ │ │ ├── IsIntegral.hpp
│ │ │ ├── IsReference.hpp
│ │ │ ├── IsSame.hpp
│ │ │ ├── RemoveConst.hpp
│ │ │ └── RemoveReference.hpp
│ │ ├── library.json
│ │ ├── library.properties
│ │ ├── src
│ │ ├── ArduinoJson.h
│ │ ├── CMakeLists.txt
│ │ ├── Internals
│ │ │ ├── Comments.cpp
│ │ │ ├── Encoding.cpp
│ │ │ ├── IndentedPrint.cpp
│ │ │ ├── JsonParser.cpp
│ │ │ ├── List.cpp
│ │ │ ├── Prettyfier.cpp
│ │ │ └── StaticStringBuilder.cpp
│ │ ├── JsonArray.cpp
│ │ ├── JsonBuffer.cpp
│ │ ├── JsonObject.cpp
│ │ └── JsonVariant.cpp
│ │ ├── stringbuffer.c
│ │ └── stringbuffer.h
├── platform.txt
├── programmers.txt
├── tools
│ ├── crc32
│ │ ├── linux
│ │ │ ├── crc32.sh
│ │ │ └── sh
│ │ ├── macosx
│ │ │ ├── crc32.sh
│ │ │ └── sh
│ │ └── windows
│ │ │ ├── bash.exe
│ │ │ ├── crc32.exe
│ │ │ ├── crc32.sh
│ │ │ ├── cut.exe
│ │ │ ├── dd.exe
│ │ │ ├── head.exe
│ │ │ ├── msys-1.0.dll
│ │ │ ├── msys-iconv-2.dll
│ │ │ ├── msys-intl-8.dll
│ │ │ ├── msys-regex-1.dll
│ │ │ ├── msys-termcap-0.dll
│ │ │ ├── sh.exe
│ │ │ ├── sha256sum.exe
│ │ │ ├── stat.exe
│ │ │ ├── tail.exe
│ │ │ ├── test.exe
│ │ │ └── xxd.exe
│ └── fw_loader
│ │ ├── linux
│ │ ├── dfu-util
│ │ └── fw-load
│ │ ├── macosx
│ │ ├── dfu-util
│ │ └── fw-load
│ │ └── windows
│ │ ├── dfu-util.exe
│ │ └── fw-load.bat
└── variants
│ └── RedBear_Duo
│ ├── linker_scripts
│ ├── gcc
│ │ ├── duo
│ │ │ ├── system-part1
│ │ │ │ └── module_system_part1_export.ld
│ │ │ ├── system-part2
│ │ │ │ └── module_system_part2_export.ld
│ │ │ └── user-part
│ │ │ │ ├── linker.ld
│ │ │ │ └── module_user_export.ld
│ │ └── shared
│ │ │ └── stm32f2xx
│ │ │ ├── part1_vtor_module.ld
│ │ │ └── user.ld
│ └── linker
│ │ ├── linker_newhalcpu.ld
│ │ ├── linker_stm32f10x_common.ld
│ │ ├── linker_stm32f10x_hd.ld
│ │ ├── linker_stm32f10x_hd_dfu.ld
│ │ ├── linker_stm32f10x_md.ld
│ │ ├── linker_stm32f10x_md_dfu.ld
│ │ ├── linker_stm32f2xx.ld
│ │ ├── linker_stm32f2xx_bootloader.ld
│ │ ├── linker_stm32f2xx_bootloader_ext.ld
│ │ ├── linker_stm32f2xx_common.ld
│ │ ├── linker_stm32f2xx_dfu.ld
│ │ ├── module_asserts.ld
│ │ ├── module_end.ld
│ │ ├── module_info.ld
│ │ ├── module_start.ld
│ │ └── stm32f2xx
│ │ ├── backup_ram_memory.ld
│ │ ├── backup_ram_system.ld
│ │ └── backup_ram_user.ld
│ └── openocd_scripts
│ └── redbear_duo.cfg
├── pack.sh
└── test.sh
/arduino/cores/RedBear_Duo/firmware/communication/src/communication_diagnostic.h:
--------------------------------------------------------------------------------
1 | #include "spark_wiring_diagnostics.h"
2 |
3 | extern particle::SimpleIntegerDiagnosticData g_rateLimitedEventsCounter;
4 | extern particle::SimpleIntegerDiagnosticData g_unacknowledgedMessageCounter;
5 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/communication/src/device_keys.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file device_keys.h
4 | * @authors Matthew McGowan
5 | * @date 02 March 2015
6 | ******************************************************************************
7 | Copyright (c) 2015 Particle Industries, Inc. All rights reserved.
8 |
9 | This library is free software; you can redistribute it and/or
10 | modify it under the terms of the GNU Lesser General Public
11 | License as published by the Free Software Foundation, either
12 | version 3 of the License, or (at your option) any later version.
13 |
14 | This library is distributed in the hope that it will be useful,
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 | Lesser General Public License for more details.
18 |
19 | You should have received a copy of the GNU Lesser General Public
20 | License along with this library; if not, see .
21 | ******************************************************************************
22 | */
23 |
24 | #ifndef DEVICE_KEYS_H
25 | #define DEVICE_KEYS_H
26 |
27 | /**
28 | * The maximum size of the 1024-bit device private key in DER format.
29 | */
30 | const int MAX_DEVICE_PRIVATE_KEY_LENGTH = 612;
31 |
32 | /**
33 | * The maximum size of the 1024-bit device public key in DER format.
34 | */
35 | const int MAX_DEVICE_PUBLIC_KEY_LENGTH = 162;
36 |
37 | /**
38 | * The maximum size of the 2048-bit server public key in DER format.
39 | */
40 | const int MAX_SERVER_PUBLIC_KEY_LENGTH = 296;
41 |
42 |
43 | #endif /* DEVICE_KEYS_H */
44 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/communication/src/dsakeygen.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file dsakeygen.h
4 | * @authors Matthew McGowan
5 | * @date 24 February 2015
6 | ******************************************************************************
7 | Copyright (c) 2015 Particle Industries, Inc. All rights reserved.
8 |
9 | This library is free software; you can redistribute it and/or
10 | modify it under the terms of the GNU Lesser General Public
11 | License as published by the Free Software Foundation, either
12 | version 3 of the License, or (at your option) any later version.
13 |
14 | This library is distributed in the hope that it will be useful,
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 | Lesser General Public License for more details.
18 |
19 | You should have received a copy of the GNU Lesser General Public
20 | License along with this library; if not, see .
21 | ******************************************************************************
22 | */
23 |
24 | #ifndef DSAKEYGEN_H
25 | #define DSAKEYGEN_H
26 |
27 | #ifdef __cplusplus
28 | extern "C" {
29 | #endif
30 |
31 | /**
32 | * Generates a DER formatted RSA PCKS#1 private key.
33 | * @param buffer The buffer to recieve the DER file.
34 | * @param max_length The length of the buffer
35 | * @param f_rng A random number generator
36 | * @param p_rng The argument to the random number generator
37 | * @return 0 on success. Non zero on failure.
38 | */
39 | int gen_rsa_key(uint8_t* buffer, size_t max_length, int32_t (*f_rng) (void *), void *p_rng);
40 |
41 |
42 |
43 | #ifdef __cplusplus
44 | }
45 | #endif
46 |
47 |
48 | #endif /* DSAKEYGEN_H */
49 |
50 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/communication/src/eckeygen.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | Copyright (c) 2015 Particle Industries, Inc. 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 3 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, see .
17 | ******************************************************************************
18 | */
19 |
20 | #pragma once
21 |
22 | #ifdef __cplusplus
23 | extern "C" {
24 | #endif
25 |
26 | #include
27 | #include
28 |
29 | /**
30 | * Generates a DER formatted EC private key.
31 | * @param buffer The buffer to receive the DER file.
32 | * @param max_length The length of the buffer
33 | * @param f_rng A random number generator
34 | * @param p_rng The argument to the random number generator
35 | * @return 0 on success. Non zero on failure.
36 | */
37 | int gen_ec_key(uint8_t* buffer, size_t max_length, int (*f_rng) (void *, uint8_t* buf, size_t len), void *p_rng);
38 |
39 | int extract_public_ec_key(uint8_t* buffer, size_t max_length, const uint8_t* private_key);
40 | int extract_public_ec_key_length(uint8_t* buffer, size_t max_length, const uint8_t* private_key, size_t private_key_len);
41 | size_t determine_der_length(const uint8_t* key, size_t max_len);
42 |
43 |
44 | #ifdef __cplusplus
45 | }
46 | #endif
47 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/communication/src/ping.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "protocol_defs.h"
4 |
5 | namespace particle { namespace protocol {
6 |
7 | class Pinger
8 | {
9 | bool expecting_ping_ack;
10 | system_tick_t ping_interval;
11 | system_tick_t ping_timeout;
12 |
13 | public:
14 | Pinger() : expecting_ping_ack(false), ping_interval(0), ping_timeout(10000) {}
15 |
16 | /**
17 | * Sets the ping interval that the client will send pings to the server, and the expected maximum response time.
18 | */
19 | void init(system_tick_t interval, system_tick_t timeout)
20 | {
21 | this->ping_interval = interval;
22 | this->ping_timeout = timeout;
23 | }
24 |
25 | void set_interval(system_tick_t interval)
26 | {
27 | this->ping_interval = interval;
28 | }
29 |
30 | void reset()
31 | {
32 | expecting_ping_ack = false;
33 | }
34 |
35 | /**
36 | * Handle ping messages
37 | */
38 | template ProtocolError process(system_tick_t millis_since_last_message, Callback ping)
39 | {
40 | if (expecting_ping_ack)
41 | {
42 | if (ping_timeout < millis_since_last_message)
43 | {
44 | // timed out, disconnect
45 | return PING_TIMEOUT;
46 | }
47 | else
48 | {
49 | expecting_ping_ack = false;
50 | }
51 | }
52 | else
53 | {
54 | if (ping_interval && ping_interval < millis_since_last_message)
55 | {
56 | expecting_ping_ack = true;
57 | return ping();
58 | }
59 | }
60 | return NO_ERROR;
61 | }
62 |
63 | bool is_expecting_ping_ack() const { return expecting_ping_ack; }
64 |
65 | void message_received() { expecting_ping_ack = false; }
66 | };
67 |
68 |
69 | }}
70 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/communication/src/protocol_selector.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | Copyright (c) 2013-2015 Particle Industries, Inc. 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 3 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, see .
17 | ******************************************************************************
18 | */
19 | #pragma once
20 |
21 | #include "hal_platform.h"
22 |
23 | #define USE_MBEDTLS // Use mbedTLS for all platforms
24 |
25 | #ifndef PARTICLE_PROTOCOL
26 | #if PLATFORM_ID>2
27 | #define PARTICLE_PROTOCOL 1
28 | #else
29 | #define PARTICLE_PROTOCOL 0
30 | #endif
31 | #endif
32 |
33 | #if PARTICLE_PROTOCOL
34 | #ifdef __cplusplus
35 | namespace particle { namespace protocol { class Protocol; }}
36 | typedef particle::protocol::Protocol ProtocolFacade;
37 | #else
38 | typedef void* ProtocolFacade;
39 | #endif
40 | #else // !PARTICLE_PROTOCOL
41 | #ifdef __cplusplus
42 | class SparkProtocol;
43 | typedef SparkProtocol ProtocolFacade;
44 | #else
45 | struct SparkProtocol;
46 | typedef struct SparkProtocol ProtocolFacade;
47 |
48 | #endif
49 | #endif
50 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/communication/src/timesyncmanager.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "protocol_defs.h"
4 | #include "service_debug.h"
5 |
6 | namespace particle { namespace protocol {
7 |
8 | class TimeSyncManager
9 | {
10 | public:
11 | TimeSyncManager()
12 | : lastSyncMillis_{0},
13 | requestSentMillis_{0},
14 | lastSyncTime_{0},
15 | expectingResponse_{false}
16 | {
17 | }
18 |
19 | void reset()
20 | {
21 | expectingResponse_ = false;
22 | requestSentMillis_ = 0;
23 | }
24 |
25 | template
26 | bool send_request(system_tick_t mil, Callback send_time_request) {
27 | if (expectingResponse_) {
28 | return true;
29 | }
30 |
31 | requestSentMillis_ = mil;
32 | expectingResponse_ = true;
33 | LOG(INFO, "Sending TIME request");
34 | return send_time_request();
35 | }
36 |
37 | template
38 | bool handle_time_response(time_t tm, system_tick_t mil, Callback set_time) {
39 | LOG(INFO, "Received TIME response: %lu", (unsigned long)tm);
40 | set_time(tm, 0, NULL);
41 | expectingResponse_ = false;
42 | lastSyncTime_ = tm;
43 | lastSyncMillis_ = mil;
44 | return true;
45 | }
46 |
47 | bool is_request_pending() const {
48 | return expectingResponse_;
49 | }
50 |
51 | system_tick_t last_sync(time_t& tm) const {
52 | tm = lastSyncTime_;
53 | return lastSyncMillis_;
54 | }
55 |
56 |
57 | private:
58 | system_tick_t lastSyncMillis_;
59 | system_tick_t requestSentMillis_;
60 | time_t lastSyncTime_;
61 | bool expectingResponse_;
62 | };
63 |
64 |
65 | }} // namespace particle::protocol
66 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/communication/src/tls_callbacks.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include "wiced_result.h"
5 |
6 | #ifdef __cplusplus
7 | extern "C" {
8 | #endif
9 |
10 | typedef struct {
11 | uint8_t version;
12 | uint64_t (*tls_host_get_time_ms)();
13 | void* (*tls_host_malloc)(const char*, uint32_t);
14 | void (*tls_host_free)(void*);
15 | wiced_result_t (*wiced_crypto_get_random)(void*, uint16_t);
16 | } TlsCallbacks;
17 |
18 | int tls_set_callbacks(TlsCallbacks callbacks);
19 |
20 | #ifdef __cplusplus
21 | }
22 | #endif
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/hal/inc/bootloader_hal.h:
--------------------------------------------------------------------------------
1 | /**
2 | Copyright (c) 2013-2016 Particle Industries, Inc. All rights 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 3 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. See the GNU
12 | 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, see .
16 | ******************************************************************************
17 | */
18 |
19 | #ifndef BOOTLOADER_HAL_H_
20 | #define BOOTLOADER_HAL_H_
21 |
22 | #ifdef __cplusplus
23 | extern "C" {
24 | #endif
25 |
26 | #include
27 |
28 | #if !defined(SYSTEM_MINIMAL)
29 | #if /*PLATFORM_ID==6 || PLATFORM_ID==8 ||*/ PLATFORM_ID==10 || PLATFORM_ID==88
30 | #define HAL_REPLACE_BOOTLOADER
31 | #endif
32 | #if PLATFORM_ID==6 || PLATFORM_ID==8 || PLATFORM_ID==10 || PLATFORM_ID==88
33 | #define HAL_REPLACE_BOOTLOADER_OTA
34 | #endif
35 | #endif
36 |
37 |
38 | const uint8_t* HAL_Bootloader_Image(uint32_t* size, void* reserved);
39 |
40 | #ifdef __cplusplus
41 | }
42 | #endif
43 |
44 | #endif /* BOOTLOADER_HAL_H_ */
45 |
46 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/hal/inc/core_subsys_hal.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file core_subsys_hal.h
4 | * @author Matthew McGowan
5 | * @version V1.0.0
6 | * @date 12-Sept-2014
7 | * @brief Defines the subsystem name and version.
8 | ******************************************************************************
9 | Copyright (c) 2013-2015 Particle Industries, Inc. All rights reserved.
10 |
11 | This library is free software; you can redistribute it and/or
12 | modify it under the terms of the GNU Lesser General Public
13 | License as published by the Free Software Foundation, either
14 | version 3 of the License, or (at your option) any later version.
15 |
16 | This library is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 | Lesser General Public License for more details.
20 |
21 | You should have received a copy of the GNU Lesser General Public
22 | License along with this library; if not, see .
23 | ******************************************************************************
24 | */
25 |
26 | #ifndef CORE_SUBSYS_H
27 | #define CORE_SUBSYS_H
28 |
29 | #ifdef __cplusplus
30 | extern "C" {
31 | #endif
32 |
33 |
34 | /**
35 | * Reads the subsystem version as a string into a given buffer.
36 | * @return 0 on success.
37 | */
38 | int HAL_core_subsystem_version(char* buf, int bufLen);
39 |
40 | #if PLATFORM_ID < 3
41 | /**
42 | * The event name to publish for this subsystem type.
43 | */
44 | #define SPARK_SUBSYSTEM_EVENT_NAME "cc3000-patch-version"
45 |
46 | #endif
47 |
48 | #ifdef __cplusplus
49 | }
50 | #endif
51 |
52 | #endif /* CORE_SUBSYS_H */
53 |
54 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/hal/inc/delay_hal.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file delay_hal.h
4 | * @author Matthew McGowan
5 | * @version V1.0.0
6 | * @date 25-Sept-2014
7 | * @brief
8 | ******************************************************************************
9 | Copyright (c) 2013-2015 Particle Industries, Inc. All rights reserved.
10 |
11 | This library is free software; you can redistribute it and/or
12 | modify it under the terms of the GNU Lesser General Public
13 | License as published by the Free Software Foundation, either
14 | version 3 of the License, or (at your option) any later version.
15 |
16 | This library is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 | Lesser General Public License for more details.
20 |
21 | You should have received a copy of the GNU Lesser General Public
22 | License along with this library; if not, see .
23 | ******************************************************************************
24 | */
25 |
26 | #ifndef DELAY_HAL_H
27 | #define DELAY_HAL_H
28 |
29 | #include
30 |
31 | #ifdef __cplusplus
32 | extern "C" {
33 | #endif
34 |
35 | void HAL_Delay_Milliseconds(uint32_t millis);
36 | void HAL_Delay_Microseconds(uint32_t micros);
37 |
38 |
39 | #ifdef __cplusplus
40 | }
41 | #endif
42 |
43 | #endif /* DELAY_HAL_H */
44 |
45 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/hal/inc/dfu_hal.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file dfu_hal.h
4 | * @author Satish Nair
5 | * @version V1.0.0
6 | * @date 20-Oct-2014
7 | * @brief Header for dfu_hal module
8 | ******************************************************************************
9 | Copyright (c) 2013-2015 Particle Industries, Inc. All rights reserved.
10 |
11 | This program is free software; you can redistribute it and/or
12 | modify it under the terms of the GNU Lesser General Public
13 | License as published by the Free Software Foundation, either
14 | version 3 of the License, or (at your option) any later version.
15 |
16 | This program is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 | Lesser General Public License for more details.
20 |
21 | You should have received a copy of the GNU Lesser General Public
22 | License along with this program; if not, see .
23 | ******************************************************************************
24 | */
25 |
26 | /* Define to prevent recursive inclusion -------------------------------------*/
27 | #ifndef __DFU_HAL_H
28 | #define __DFU_HAL_H
29 |
30 | /* Includes ------------------------------------------------------------------*/
31 | /* Exported types ------------------------------------------------------------*/
32 | /* Exported constants --------------------------------------------------------*/
33 | /* Exported macro ------------------------------------------------------------*/
34 | /* Exported functions ------------------------------------------------------- */
35 |
36 | uint8_t is_application_valid(uint32_t address);
37 | void HAL_DFU_USB_Init(void);
38 |
39 | #endif /* __DFU_HAL_H */
40 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/hal/inc/hal_dynalib_bootloader.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file hal_dynalib_bootloader.h
4 | * @authors Andrey Tolstoy
5 | * @date 15 December 2016
6 | ******************************************************************************
7 | Copyright (c) 2016 Particle Industries, Inc. All rights reserved.
8 | This library is free software; you can redistribute it and/or
9 | modify it under the terms of the GNU Lesser General Public
10 | License as published by the Free Software Foundation, either
11 | version 3 of the License, or (at your option) any later version.
12 | This library is distributed in the hope that it will be useful,
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | Lesser General Public License for more details.
16 | You should have received a copy of the GNU Lesser General Public
17 | License along with this library; if not, see .
18 | ******************************************************************************
19 | */
20 |
21 | #ifndef HAL_DYNALIB_BOOTLOADER_H
22 | #define HAL_DYNALIB_BOOTLOADER_H
23 |
24 | #include "dynalib.h"
25 |
26 | #ifdef DYNALIB_EXPORT
27 | #include "bootloader_hal.h"
28 | #endif
29 |
30 | DYNALIB_BEGIN(hal_bootloader)
31 |
32 | DYNALIB_FN(0, hal_bootloader, HAL_Bootloader_Image, const uint8_t*(uint32_t*, void*))
33 |
34 | DYNALIB_END(hal_bootloader)
35 |
36 | #endif /* HAL_DYNALIB_BOOTLOADER_H */
37 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/hal/inc/hal_dynalib_dct.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "dynalib.h"
4 |
5 | #ifdef DYNALIB_EXPORT
6 | #include "dct_hal.h"
7 | #include "device_code.h"
8 | #endif
9 |
10 | DYNALIB_BEGIN(hal_dct)
11 |
12 | DYNALIB_FN(0, hal_dct, dct_read_app_data, const void*(uint32_t))
13 | DYNALIB_FN(1, hal_dct, dct_read_app_data_copy, int(uint32_t, void*, size_t))
14 | DYNALIB_FN(2, hal_dct, dct_read_app_data_lock, const void*(uint32_t))
15 | DYNALIB_FN(3, hal_dct, dct_read_app_data_unlock, int(uint32_t))
16 | DYNALIB_FN(4, hal_dct, dct_write_app_data, int(const void*, uint32_t, uint32_t))
17 | DYNALIB_FN(5, hal_dct, fetch_or_generate_setup_ssid, bool(device_code_t*))
18 |
19 | DYNALIB_END(hal_dct)
20 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/hal/inc/hal_dynalib_rgbled.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | Copyright (c) 2016 Particle Industries, Inc. 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 3 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, see .
17 | ******************************************************************************
18 | */
19 |
20 | #ifndef HAL_DYNALIB_RGB_H
21 | #define HAL_DYNALIB_RGB_H
22 |
23 | #include "dynalib.h"
24 |
25 | #ifdef DYNALIB_EXPORT
26 | #include "rgbled_hal.h"
27 | #endif
28 |
29 | // WARNING
30 | // The order of functions must not be changed or older applications will break
31 | // when used with newer system firmware.
32 | // Function signatures shouldn't be changed other than changing pointer types.
33 | // New HAL functions must be added to the end of this list.
34 | // GNINRAW
35 |
36 | DYNALIB_BEGIN(hal_rgbled)
37 |
38 | DYNALIB_FN(0, hal_rgbled, HAL_Led_Rgb_Set_Values, void(uint16_t, uint16_t, uint16_t, void*))
39 | DYNALIB_FN(1, hal_rgbled, HAL_Led_Rgb_Get_Values, void(uint16_t*, void*))
40 | DYNALIB_FN(2, hal_rgbled, HAL_Led_Rgb_Get_Max_Value, uint32_t(void*))
41 | DYNALIB_FN(3, hal_rgbled, HAL_Led_User_Set, void(uint8_t, void*))
42 | DYNALIB_FN(4, hal_rgbled, HAL_Led_User_Toggle, void(void*))
43 |
44 | DYNALIB_END(hal_rgbled)
45 |
46 | #endif /* HAL_DYNALIB_GPIO_H */
47 |
48 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/hal/inc/hal_irq_flag.h:
--------------------------------------------------------------------------------
1 | #ifndef __HAL_IRQ_FLAG_H
2 | #define __HAL_IRQ_FLAG_H
3 |
4 | #ifdef __cplusplus
5 | extern "C" {
6 | #endif // __cplusplus
7 | int HAL_disable_irq();
8 | void HAL_enable_irq(int mask);
9 | #ifdef __cplusplus
10 | }
11 | #endif // __cplusplus
12 |
13 | #endif // __HAL_IRQ_FLAG_H
14 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/hal/inc/net_hal.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | #ifdef __cplusplus
7 | extern "C" {
8 | #endif
9 |
10 | typedef struct {
11 | size_t size;
12 | void (*notify_connected)(); // HAL_NET_notify_connected()
13 | void (*notify_disconnected)(); // HAL_NET_notify_disconnected()
14 | void (*notify_dhcp)(bool dhcp); // HAL_NET_notify_dhcp()
15 | void (*notify_can_shutdown)(); // HAL_NET_notify_can_shutdown()
16 | } HAL_NET_Callbacks;
17 |
18 | uint32_t HAL_NET_SetNetWatchDog(uint32_t timeOutInuS);
19 |
20 | /**
21 | * Sets notification callbacks. This function is used when HAL implementation cannot be linked
22 | * with HAL_NET_notify_*() functions directly.
23 | */
24 | void HAL_NET_SetCallbacks(const HAL_NET_Callbacks* callbacks, void* reserved);
25 |
26 | /**
27 | * Notification that the wifi network has been connected to.
28 | */
29 | void HAL_NET_notify_connected();
30 | void HAL_NET_notify_disconnected();
31 |
32 | /**
33 | * Notification that an IP address has been received via DHCP.
34 | * todo - what with the case of static IP config?
35 | */
36 | void HAL_NET_notify_dhcp(bool dhcp);
37 |
38 | void HAL_NET_notify_can_shutdown();
39 |
40 | typedef enum {
41 | NET_ACCESS_TECHNOLOGY_UNKNOWN = 0,
42 | NET_ACCESS_TECHNOLOGY_NONE = 0,
43 | NET_ACCESS_TECHNOLOGY_WIFI = 1,
44 | NET_ACCESS_TECHNOLOGY_GSM = 2,
45 | NET_ACCESS_TECHNOLOGY_EDGE = 3,
46 | NET_ACCESS_TECHNOLOGY_UMTS = 4,
47 | NET_ACCESS_TECHNOLOGY_UTRAN = 4,
48 | NET_ACCESS_TECHNOLOGY_WCDMA = 4,
49 | NET_ACCESS_TECHNOLOGY_CDMA = 5,
50 | NET_ACCESS_TECHNOLOGY_LTE = 6
51 | } hal_net_access_tech_t;
52 |
53 | #ifdef __cplusplus
54 | }
55 | #endif
56 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/hal/inc/product_store_hal.h:
--------------------------------------------------------------------------------
1 | /*
2 | * File: appstore_hal.h
3 | * Author: mat
4 | *
5 | * Created on 02 March 2015, 11:12
6 | */
7 |
8 | #ifndef APPSTORE_HAL_H
9 | #define APPSTORE_HAL_H
10 |
11 | #ifdef __cplusplus
12 | extern "C" {
13 | #endif
14 |
15 | #include
16 |
17 | typedef enum ProductStoreIndex
18 | {
19 | /**
20 | * The persisted Product ID, 0xFFFF if none set.
21 | */
22 | PRODUCT_STORE_ID = 0,
23 |
24 | /**
25 | * The persisted product version. 0xFFFF if none set.
26 | */
27 | PRODUCT_STORE_VERSION = 1
28 |
29 |
30 | } ProductStoreIndex;
31 |
32 | /**
33 | * Sets the value at a specific product store index.
34 | * @return The previous value.
35 | */
36 | uint16_t HAL_SetProductStore(ProductStoreIndex index, uint16_t value);
37 |
38 | /**
39 | * Fetches the value at a given index in the product store.
40 | * @param index
41 | * @return
42 | */
43 | uint16_t HAL_GetProductStore(ProductStoreIndex index);
44 |
45 | #ifdef __cplusplus
46 | }
47 | #endif
48 |
49 | #endif /* APPSTORE_HAL_H */
50 |
51 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/hal/inc/rng_hal.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file rng_hal.h
4 | * @author Satish Nair
5 | * @version V1.0.0
6 | * @date 13-Jan-2015
7 | * @brief
8 | ******************************************************************************
9 | Copyright (c) 2015 Particle Industries, Inc. All rights reserved.
10 |
11 | This library is free software; you can redistribute it and/or
12 | modify it under the terms of the GNU Lesser General Public
13 | License as published by the Free Software Foundation, either
14 | version 3 of the License, or (at your option) any later version.
15 |
16 | This library is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 | Lesser General Public License for more details.
20 |
21 | You should have received a copy of the GNU Lesser General Public
22 | License along with this library; if not, see .
23 | ******************************************************************************
24 | */
25 |
26 | /* Define to prevent recursive inclusion -------------------------------------*/
27 | #ifndef __RNG_HAL_H
28 | #define __RNG_HAL_H
29 |
30 | #include
31 | /* Exported types ------------------------------------------------------------*/
32 |
33 | /* Exported constants --------------------------------------------------------*/
34 |
35 | /* Exported macros -----------------------------------------------------------*/
36 |
37 | /* Exported functions --------------------------------------------------------*/
38 |
39 | #ifdef __cplusplus
40 | extern "C" {
41 | #endif
42 |
43 | void HAL_RNG_Configuration(void);
44 | uint32_t HAL_RNG_GetRandomNumber(void);
45 |
46 | #ifdef __cplusplus
47 | }
48 | #endif
49 |
50 | #endif /* __RNG_HAL_H */
51 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/hal/inc/watchdog_hal.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file watchdog_hal.h
4 | * @author Matthew McGowan
5 | * @version V1.0.0
6 | * @date 25-Sept-2014
7 | * @brief
8 | ******************************************************************************
9 | Copyright (c) 2013-2015 Particle Industries, Inc. All rights reserved.
10 |
11 | This library is free software; you can redistribute it and/or
12 | modify it under the terms of the GNU Lesser General Public
13 | License as published by the Free Software Foundation, either
14 | version 3 of the License, or (at your option) any later version.
15 |
16 | This library is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 | Lesser General Public License for more details.
20 |
21 | You should have received a copy of the GNU Lesser General Public
22 | License along with this library; if not, see .
23 | ******************************************************************************
24 | */
25 |
26 | #ifndef WATCHDOG_HAL_H
27 | #define WATCHDOG_HAL_H
28 |
29 | #include
30 |
31 | #ifdef __cplusplus
32 | extern "C" {
33 | #endif
34 |
35 | bool HAL_watchdog_reset_flagged();
36 |
37 | void HAL_Notify_WDT();
38 |
39 |
40 | #ifdef __cplusplus
41 | }
42 | #endif
43 |
44 | #endif /* WATCHDOG_HAL_H */
45 |
46 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/hal/shared/flash_device_hal.h:
--------------------------------------------------------------------------------
1 |
2 | #ifndef FLASH_DEVICE_HAL_H
3 | #define FLASH_DEVICE_HAL_H
4 |
5 | #ifdef __cplusplus
6 | extern "C" {
7 | #endif
8 |
9 | typedef enum flash_device_t {
10 | FLASH_INTERNAL,
11 | FLASH_SERIAL
12 | } flash_device_t;
13 |
14 |
15 | #ifdef __cplusplus
16 | }
17 | #endif
18 |
19 | #endif /* FLASH_DEVICE_HAL_H */
20 |
21 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/hal/shared/hal_event.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2016 Particle Industries, Inc. All rights 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 3 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. See the GNU
12 | * 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, see .
16 | */
17 |
18 | #ifndef HAL_EVENT_H
19 | #define HAL_EVENT_H
20 |
21 | #ifdef __cplusplus
22 | extern "C" {
23 | #endif
24 |
25 | #include "core_hal.h"
26 |
27 | // Generates HAL event. See HAL_Event enum for the list of defined events
28 | void hal_notify_event(int event, int flags, void* data);
29 |
30 | #ifdef __cplusplus
31 | } // extern "C"
32 | #endif
33 |
34 | #endif // HAL_EVENT_H
35 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/hal/shared/module_info_hal.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file module_info_hal.h
4 | * @authors mat
5 | * @date 24 February 2015
6 | ******************************************************************************
7 | Copyright (c) 2015 Particle Industries, Inc. All rights reserved.
8 |
9 | This library is free software; you can redistribute it and/or
10 | modify it under the terms of the GNU Lesser General Public
11 | License as published by the Free Software Foundation, either
12 | version 3 of the License, or (at your option) any later version.
13 |
14 | This library is distributed in the hope that it will be useful,
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 | Lesser General Public License for more details.
18 |
19 | You should have received a copy of the GNU Lesser General Public
20 | License along with this library; if not, see .
21 | ******************************************************************************
22 | */
23 |
24 | #ifndef MODULE_INFO_HAL_H
25 | #define MODULE_INFO_HAL_H
26 |
27 | #define MODULE_VERIFY_CRC 1<<1
28 | #define MODULE_VERIFY_DESTINATION_IS_START_ADDRESS 1<<2
29 | #define MODULE_VERIFY_FUNCTION 1<<3
30 | #define MODULE_VERIFY_LENGTH 1<<3
31 |
32 | #define MODULE_VERIFY_MASK \
33 | (MODULE_VERIFY_CRC | \
34 | MODULE_VERIFY_DESTINATION_IS_START_ADDRESS | \
35 | MODULE_VERIFY_FUNCTION | \
36 | MODULE_VERIFY_LENGTH)
37 |
38 |
39 | #endif /* MODULE_INFO_HAL_H */
40 |
41 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/hal/shared/system_tick_hal.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file system_tick_hal.h
4 | * @author Matthew McGowan
5 | * @version V1.0.0
6 | * @date 25-Sept-2014
7 | * @brief
8 | ******************************************************************************
9 | Copyright (c) 2013-2015 Particle Industries, Inc. All rights reserved.
10 |
11 | This library is free software; you can redistribute it and/or
12 | modify it under the terms of the GNU Lesser General Public
13 | License as published by the Free Software Foundation, either
14 | version 3 of the License, or (at your option) any later version.
15 |
16 | This library is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 | Lesser General Public License for more details.
20 |
21 | You should have received a copy of the GNU Lesser General Public
22 | License along with this library; if not, see .
23 | ******************************************************************************
24 | */
25 |
26 |
27 | #ifndef system_tick_h_
28 | #define system_tick_h_
29 |
30 | #include
31 |
32 | typedef uint32_t system_tick_t;
33 |
34 | #endif
35 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/hal/src/duo/ble_provision.h:
--------------------------------------------------------------------------------
1 |
2 | #ifdef __cplusplus
3 | extern "C" {
4 | #endif
5 |
6 | /*****************************************************************************
7 | * Function Prototypes
8 | *****************************************************************************/
9 | void ble_provision_init(void);
10 | void ble_provision_finalize(void);
11 | void ble_provision_on_failed(void);
12 |
13 | #ifdef __cplusplus
14 | }
15 | #endif
16 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/hal/src/duo/dct_hal.h:
--------------------------------------------------------------------------------
1 | /*
2 | * File: dct_hal.h
3 | * Author: mat
4 | *
5 | * Created on 11 November 2014, 09:32
6 | */
7 |
8 | #ifndef DCT_HAL_H
9 | #define DCT_HAL_H
10 |
11 | #include "dct_hal_stm32f2xx.h"
12 | #include "platform_dct.h"
13 | #include "platform_system_flags.h"
14 | #include "dct.h"
15 |
16 | #ifdef __cplusplus
17 | extern "C" {
18 | #endif
19 |
20 | typedef struct complete_dct {
21 | // 7548 bytes
22 | platform_dct_data_t system;
23 | application_dct_t application;
24 | // 52 bytes
25 | platform_dct_data2_t system2;
26 | } complete_dct_t;
27 |
28 | STATIC_ASSERT(offset_application_dct, (offsetof(complete_dct_t, application)==7548) );
29 | STATIC_ASSERT(size_complete_dct, (sizeof(complete_dct_t)<=16384));
30 |
31 | #ifdef __cplusplus
32 | } // extern "C"
33 | #endif
34 |
35 | #endif /* DCT_HAL_H */
36 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/hal/src/duo/device_name.h:
--------------------------------------------------------------------------------
1 | #ifndef DEVICE_NAME_H
2 | #define DEVICE_NAME_H
3 |
4 | #ifdef __cplusplus
5 | extern "C" {
6 | #endif
7 |
8 | #define MAX_LOCAL_NAME_SIZE 20
9 |
10 | typedef struct
11 | {
12 | uint8_t length;
13 | uint8_t value[ MAX_LOCAL_NAME_SIZE ];
14 | } local_name_t;
15 |
16 | void HAL_Local_Name(local_name_t *local_name);
17 |
18 | #ifdef __cplusplus
19 | }
20 | #endif
21 |
22 | #endif
23 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/hal/src/duo/hci_usart_hal.h:
--------------------------------------------------------------------------------
1 |
2 | #ifndef HCI_USART_HAL_H_
3 | #define HCI_USART_HAL_H_
4 |
5 | #ifdef __cplusplus
6 | extern "C" {
7 | #endif
8 |
9 | /* Includes ------------------------------------------------------------------*/
10 | #include
11 | #include "pinmap_hal.h"
12 |
13 | /* Exported defines ----------------------------------------------------------*/
14 |
15 | #define TOTAL_HCI_USARTS 1
16 | #define HCI_USART_BUFFER_SIZE 512
17 |
18 | /* Exported types ------------------------------------------------------------*/
19 | typedef struct HCI_USART_Ring_Buffer
20 | {
21 | unsigned char buffer[HCI_USART_BUFFER_SIZE];
22 | volatile uint16_t head;
23 | volatile uint16_t tail;
24 | } HCI_USART_Ring_Buffer;
25 |
26 | typedef enum HAL_HCI_USART_Serial {
27 | HAL_HCI_USART_SERIAL6 = 0 //maps to BT_UART
28 | } HAL_HCI_USART_Serial;
29 |
30 | typedef void (*ReceiveHandler_t)(void);
31 |
32 | /* Function Prototypes -------------------------------------------------------*/
33 | void HAL_HCI_USART_registerReceiveHandler(ReceiveHandler_t handler);
34 | void HAL_HCI_USART_receiveEvent(void);
35 | int32_t HAL_HCI_USART_downloadFirmeare(HAL_HCI_USART_Serial serial);
36 |
37 | void HAL_HCI_USART_Init(HAL_HCI_USART_Serial serial, HCI_USART_Ring_Buffer *rx_buffer, HCI_USART_Ring_Buffer *tx_buffer);
38 | void HAL_HCI_USART_Begin(HAL_HCI_USART_Serial serial, uint32_t baud);
39 | void HAL_HCI_USART_End(HAL_HCI_USART_Serial serial);
40 | void HAL_HCI_USART_RestartSend(HAL_HCI_USART_Serial serial);
41 |
42 | int32_t HAL_HCI_USART_Write_Data(HAL_HCI_USART_Serial serial, uint8_t data);
43 | int32_t HAL_HCI_USART_Write_Buffer(HAL_HCI_USART_Serial serial, const uint8_t *buf, uint16_t len);
44 | int32_t HAL_HCI_USART_Available_Data(HAL_HCI_USART_Serial serial);
45 | int32_t HAL_HCI_USART_Read_Data(HAL_HCI_USART_Serial serial);
46 |
47 | #ifdef __cplusplus
48 | }
49 | #endif
50 |
51 | #endif
52 |
53 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/hal/src/duo/include/default_network_config_dct.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Broadcom Proprietary and Confidential. Copyright 2016 Broadcom
3 | * All Rights Reserved.
4 | *
5 | * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Broadcom Corporation;
6 | * the contents of this file may not be disclosed to third parties, copied
7 | * or duplicated in any form, in whole or in part, without the prior
8 | * written permission of Broadcom Corporation.
9 | */
10 | #pragma once
11 |
12 | #ifdef __cplusplus
13 | extern "C" {
14 | #endif
15 |
16 |
17 | /******************************************************
18 | * Macros
19 | ******************************************************/
20 |
21 | /******************************************************
22 | * Constants
23 | ******************************************************/
24 | /* This is the Hostname used for device configuration */
25 | #define CONFIG_NETWORK_INTERFACE WICED_NETWORK_INTERFACE
26 | #define CONFIG_NETWORK_IP_HOSTNAME "WICED IP"
27 |
28 | /******************************************************
29 | * Enumerations
30 | ******************************************************/
31 |
32 | /******************************************************
33 | * Type Definitions
34 | ******************************************************/
35 |
36 | /******************************************************
37 | * Structures
38 | ******************************************************/
39 |
40 | /******************************************************
41 | * Global Variables
42 | ******************************************************/
43 |
44 | /******************************************************
45 | * Function Declarations
46 | ******************************************************/
47 |
48 |
49 | #ifdef __cplusplus
50 | } /* extern "C" */
51 | #endif
52 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/hal/src/duo/include/wiced.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Broadcom Proprietary and Confidential. Copyright 2016 Broadcom
3 | * All Rights Reserved.
4 | *
5 | * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Broadcom Corporation;
6 | * the contents of this file may not be disclosed to third parties, copied
7 | * or duplicated in any form, in whole or in part, without the prior
8 | * written permission of Broadcom Corporation.
9 | */
10 |
11 | /** @file
12 | * Header file that includes all API & helper functions
13 | */
14 |
15 | #pragma once
16 |
17 | #include "wiced_utilities.h"
18 | #include "wiced_framework.h"
19 | #include "wiced_platform.h"
20 | #include "wiced_rtos.h"
21 | #include "wiced_tcpip.h"
22 | #include "wiced_time.h"
23 | #include "wiced_wifi.h"
24 | #include "wiced_defaults.h"
25 | #include "wiced_network.h"
26 | #include "wiced_management.h"
27 | #include "wiced_easy_setup.h"
28 | #include "wiced_usb.h"
29 | #include "wwd_debug.h"
30 | #include "wwd_assert.h"
31 |
32 | #ifdef __cplusplus
33 | extern "C" {
34 | #endif
35 |
36 | /******************************************************
37 | * Macros
38 | ******************************************************/
39 |
40 | /******************************************************
41 | * Enumerations
42 | ******************************************************/
43 |
44 | /******************************************************
45 | * Structures
46 | ******************************************************/
47 |
48 | /******************************************************
49 | * Function Declarations
50 | ******************************************************/
51 |
52 | #ifdef __cplusplus
53 | } /*extern "C" */
54 | #endif
55 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/hal/src/duo/libraries/btstack/port/btstack_config.h:
--------------------------------------------------------------------------------
1 | //
2 | // btstack_config.h for WICED port
3 | //
4 |
5 | #ifndef __BTSTACK_CONFIG
6 | #define __BTSTACK_CONFIG
7 |
8 | // Port related features
9 | #define HAVE_TIME_MS
10 | #define WICED_BT_UART_MANUAL_CTS_RTS
11 |
12 | // BTstack features that can be enabled
13 | #define ENABLE_BLE
14 | #define ENABLE_CLASSIC
15 | //#define HAVE_INIT_SCRIPT
16 | #define HAVE_PARTICLE
17 |
18 | #define ENABLE_LOG_INTO_HCI_DUMP
19 | #define ENABLE_LOG_INFO
20 | #define ENABLE_LOG_DEBUG
21 | #define ENABLE_LOG_ERROR
22 |
23 | #define HCI_INIT_BAUDRATE 115200
24 | #define HCI_MAIN_BAUDRATE 115200
25 |
26 | // BTstack configuration. buffers, sizes, ...
27 | #define HCI_ACL_PAYLOAD_SIZE 52
28 | #define MAX_SPP_CONNECTIONS 8
29 | #define MAX_NR_GATT_CLIENTS 8
30 | #define MAX_NR_GATT_SUBCLIENTS 1
31 | #define MAX_NR_HCI_CONNECTIONS MAX_SPP_CONNECTIONS
32 | #define MAX_NR_L2CAP_SERVICES 2
33 | #define MAX_NR_L2CAP_CHANNELS (1+MAX_SPP_CONNECTIONS)
34 | #define MAX_NR_RFCOMM_MULTIPLEXERS MAX_SPP_CONNECTIONS
35 | #define MAX_NR_RFCOMM_SERVICES 1
36 | #define MAX_NR_RFCOMM_CHANNELS MAX_SPP_CONNECTIONS
37 | #define MAX_NR_BTSTACK_LINK_KEY_DB_MEMORY_ENTRIES 2
38 | #define MAX_NR_BNEP_SERVICES 0
39 | #define MAX_NR_BNEP_CHANNELS 0
40 | #define MAX_NR_HFP_CONNECTIONS 0
41 | #define MAX_NR_WHITELIST_ENTRIES 1
42 | #define MAX_NR_SM_LOOKUP_ENTRIES 3
43 | #define MAX_NR_SERVICE_RECORD_ITEMS 2
44 |
45 | #define MAX_ATT_DB_SIZE 600
46 | #define MAX_NR_NOTIFY_DATA_QUEUE 20
47 | #define MAX_NR_CLIENT_NOTIFY_QUEUE 10
48 | #define MAX_PREPARED_WRITE_SIZE 400
49 |
50 | #endif
51 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/hal/src/duo/libraries/btstack/port/btstack_version.h:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | #ifndef __BTSTACK_VERSION_H
5 | #define __BTSTACK_VERSION_H_
6 |
7 |
8 | #define BTSTACK_MAJOR 0
9 | #define BTSTACK_MINOR 0
10 |
11 |
12 | #endif
13 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/hal/src/duo/network_interface.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "inet_hal.h"
4 | #include "wiced.h"
5 |
6 | #ifdef __cplusplus
7 | inline wiced_interface_t wiced_wlan_interface(network_interface_t nif)
8 | {
9 | return nif ? WICED_AP_INTERFACE : WICED_STA_INTERFACE;
10 | }
11 | #else
12 | #define wiced_wlan_interface(nif) (nif ? WICED_AP_INTERFACE : WICED_STA_INTERFACE)
13 | #endif
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/hal/src/duo/socket_internal.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file socket_internal.h
4 | * @authors Matthew McGowan
5 | * @date 23 January 2015
6 | ******************************************************************************
7 | Copyright (c) 2015 Particle Industries, Inc. All rights reserved.
8 |
9 | This library is free software; you can redistribute it and/or
10 | modify it under the terms of the GNU Lesser General Public
11 | License as published by the Free Software Foundation, either
12 | version 3 of the License, or (at your option) any later version.
13 |
14 | This library is distributed in the hope that it will be useful,
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 | Lesser General Public License for more details.
18 |
19 | You should have received a copy of the GNU Lesser General Public
20 | License along with this library; if not, see .
21 | ******************************************************************************
22 | */
23 |
24 | #ifndef SOCKET_INTERNAL_H
25 | #define SOCKET_INTERNAL_H
26 |
27 | void socket_close_all();
28 |
29 | #endif /* SOCKET_INTERNAL_H */
30 |
31 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/hal/src/duo/softap.h:
--------------------------------------------------------------------------------
1 | /*
2 | * File: softap.h
3 | * Author: mat
4 | *
5 | * Created on 16 December 2014, 08:55
6 | */
7 |
8 | #ifndef SOFTAP_H
9 | #define SOFTAP_H
10 |
11 | #include "wiced.h" // for wiced_result_t
12 |
13 | #ifdef __cplusplus
14 | #include
15 | extern "C" {
16 | #endif
17 |
18 | typedef void* softap_handle;
19 |
20 | typedef struct softap_config {
21 | void (*softap_complete)();
22 | } softap_config;
23 |
24 | /**
25 | * Starts the soft ap setup process.
26 | * @param config The soft ap configuration details.
27 | * @return The softap handle, or NULL if soft ap could not be started.
28 | *
29 | * The softap config runs asynchronously.
30 | */
31 | softap_handle softap_start(softap_config* config);
32 |
33 | void softap_stop(void* pv);
34 |
35 | wiced_result_t add_wiced_wifi_credentials(const char *ssid, uint16_t ssidLen, const char *password,
36 | uint16_t passwordLen, wiced_security_t security, unsigned channel);
37 |
38 | size_t hex_decode(uint8_t* buf, size_t len, const char* hex);
39 | uint8_t hex_nibble(unsigned char c);
40 |
41 | #if PLATFORM_ID == 88
42 | void Wireless_Update_Begin(uint32_t file_length, uint16_t chunk_size, uint32_t chunk_address, uint8_t file_store);
43 | uint8_t Wireless_Update_Save_Chunk(uint8_t *data, uint16_t length);
44 | void Wireless_Update_Finish(void);
45 |
46 | int wlan_has_credentials();
47 | #endif
48 |
49 | #ifdef __cplusplus
50 | }
51 | #endif
52 |
53 | #endif /* SOFTAP_H */
54 |
55 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/hal/src/duo/usbd_desc_device.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file usbd_desc.c
4 | * @author Satish Nair
5 | * @version V1.0.0
6 | * @date 05-Nov-2014
7 | * @brief This file provides the USBD descriptors and string formating method.
8 | ******************************************************************************
9 | Copyright (c) 2013-2015 Particle Industries, Inc. All rights reserved.
10 |
11 | Copyright 2012 STMicroelectronics
12 | http://www.st.com/software_license_agreement_liberty_v2
13 |
14 | This library is free software; you can redistribute it and/or
15 | modify it under the terms of the GNU Lesser General Public
16 | License as published by the Free Software Foundation, either
17 | version 3 of the License, or (at your option) any later version.
18 |
19 | This library is distributed in the hope that it will be useful,
20 | but WITHOUT ANY WARRANTY; without even the implied warranty of
21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 | Lesser General Public License for more details.
23 |
24 | You should have received a copy of the GNU Lesser General Public
25 | License along with this library; if not, see .
26 | ******************************************************************************
27 | */
28 |
29 | #include "platforms.h"
30 |
31 | /* Includes ------------------------------------------------------------------*/
32 |
33 | /* USB Device String Definitions ---------------------------------------------*/
34 |
35 | #define USBD_LANGID_STRING 0x0409 //U.S. English
36 | #define USBD_MANUFACTURER_STRING "RedBear"
37 |
38 | #define USBD_PRODUCT_STRING "Duo"
39 |
40 | #define USBD_CONFIGURATION_STRING "Composite"
41 | // Unused
42 | #define USBD_INTERFACE_STRING ""
43 |
44 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/hal/src/duo/wiced/platform/GCC/linker_symbols.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Broadcom Proprietary and Confidential. Copyright 2016 Broadcom
3 | * All Rights Reserved.
4 | *
5 | * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Broadcom Corporation;
6 | * the contents of this file may not be disclosed to third parties, copied
7 | * or duplicated in any form, in whole or in part, without the prior
8 | * written permission of Broadcom Corporation.
9 | */
10 | #pragma once
11 |
12 | #ifdef __cplusplus
13 | extern "C"
14 | {
15 | #endif
16 |
17 | /******************************************************
18 | * Macros
19 | ******************************************************/
20 | #define ENTRY_ADDRESS (&reset_handler)
21 |
22 | /******************************************************
23 | * Constants
24 | ******************************************************/
25 |
26 | /******************************************************
27 | * Enumerations
28 | ******************************************************/
29 |
30 | /******************************************************
31 | * Type Definitions
32 | ******************************************************/
33 |
34 | /******************************************************
35 | * Structures
36 | ******************************************************/
37 |
38 | /******************************************************
39 | * Global Variables
40 | ******************************************************/
41 | extern void* reset_handler;
42 | extern void* link_stack_end;
43 |
44 | /******************************************************
45 | * Function Declarations
46 | ******************************************************/
47 |
48 | #ifdef __cplusplus
49 | } /*extern "C" */
50 | #endif
51 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/hal/src/duo/wiced/platform/include/platform_sflash_dct.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Broadcom Proprietary and Confidential. Copyright 2016 Broadcom
3 | * All Rights Reserved.
4 | *
5 | * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Broadcom Corporation;
6 | * the contents of this file may not be disclosed to third parties, copied
7 | * or duplicated in any form, in whole or in part, without the prior
8 | * written permission of Broadcom Corporation.
9 | */
10 |
11 | /** @file
12 | * Defines globally accessible serial flash DCT functions
13 | */
14 | #pragma once
15 | #include "platform_constants.h"
16 | #include "spi_flash.h"
17 |
18 | #ifdef __cplusplus
19 | extern "C" {
20 | #endif
21 |
22 | extern platform_result_t platform_get_sflash_dct_loc( sflash_handle_t* sflash_handle, uint32_t* loc );
23 |
24 | #ifdef __cplusplus
25 | } /* extern "C" */
26 | #endif
27 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/hal/src/duo/wiced/security/BESL/include/besl_host_interface.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Broadcom Proprietary and Confidential. Copyright 2016 Broadcom
3 | * All Rights Reserved.
4 | *
5 | * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Broadcom Corporation;
6 | * the contents of this file may not be disclosed to third parties, copied
7 | * or duplicated in any form, in whole or in part, without the prior
8 | * written permission of Broadcom Corporation.
9 | */
10 | #pragma once
11 |
12 | #include
13 | #include "besl_structures.h"
14 |
15 | #ifdef __cplusplus
16 | extern "C" {
17 | #endif
18 |
19 | /* Endian management functions */
20 | uint32_t besl_host_hton32(uint32_t intlong);
21 | uint16_t besl_host_hton16(uint16_t intshort);
22 | uint32_t besl_host_hton32_ptr(uint8_t* in, uint8_t* out);
23 | uint16_t besl_host_hton16_ptr(uint8_t* in, uint8_t* out);
24 |
25 |
26 | extern besl_result_t besl_host_get_mac_address(besl_mac_t* address, uint32_t interface );
27 | extern besl_result_t besl_host_set_mac_address(besl_mac_t* address, uint32_t interface );
28 | extern void besl_host_random_bytes(uint8_t* buffer, uint16_t buffer_length);
29 | extern void besl_host_get_time(besl_time_t* time);
30 |
31 | /* Memory allocation functions */
32 | extern void* besl_host_malloc( const char* name, uint32_t size );
33 | extern void* besl_host_calloc( const char* name, uint32_t num, uint32_t size );
34 | extern void besl_host_free( void* p );
35 |
36 | #ifdef __cplusplus
37 | } /*extern "C" */
38 | #endif
39 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/hal/src/duo/wiced/security/BESL/include/scan_host_interface.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Broadcom Proprietary and Confidential. Copyright 2016 Broadcom
3 | * All Rights Reserved.
4 | *
5 | * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Broadcom Corporation;
6 | * the contents of this file may not be disclosed to third parties, copied
7 | * or duplicated in any form, in whole or in part, without the prior
8 | * written permission of Broadcom Corporation.
9 | */
10 | #pragma once
11 |
12 | #ifdef __cplusplus
13 | extern "C" {
14 | #endif
15 |
16 | typedef void (*scan_result_handler_t)(wl_escan_result_t* result, void* user_data);
17 | typedef void (*scan_complete_hander_t)(void);
18 |
19 | extern void besl_host_scan(scan_result_handler_t result_handler, void* user_data);
20 |
21 | #ifdef __cplusplus
22 | } /*extern "C" */
23 | #endif
24 |
25 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/hal/src/duo/wiced/security/BESL/include/wps_p2p_interface.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Broadcom Proprietary and Confidential. Copyright 2016 Broadcom
3 | * All Rights Reserved.
4 | *
5 | * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Broadcom Corporation;
6 | * the contents of this file may not be disclosed to third parties, copied
7 | * or duplicated in any form, in whole or in part, without the prior
8 | * written permission of Broadcom Corporation.
9 | */
10 | #pragma once
11 |
12 | #ifdef __cplusplus
13 | extern "C" {
14 | #endif
15 |
16 | /******************************************************
17 | * Macros
18 | ******************************************************/
19 |
20 | /******************************************************
21 | * Constants
22 | ******************************************************/
23 |
24 | /******************************************************
25 | * Enumerations
26 | ******************************************************/
27 |
28 | /******************************************************
29 | * Type Definitions
30 | ******************************************************/
31 |
32 | /******************************************************
33 | * Structures
34 | ******************************************************/
35 |
36 | /******************************************************
37 | * Global Variables
38 | ******************************************************/
39 |
40 | /******************************************************
41 | * Function Declarations
42 | ******************************************************/
43 |
44 | extern void wiced_wps_thread_main( wwd_thread_arg_t arg );
45 | extern besl_result_t wps_internal_init( wps_agent_t* workspace, uint32_t interface, besl_wps_mode_t mode, const char* password, besl_wps_credential_t* credentials, uint16_t credential_length );
46 |
47 | #ifdef __cplusplus
48 | } /*extern "C" */
49 | #endif
50 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/hal/src/duo/wlan_internal.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file wlan_internal.h
4 | * @authors Matthew McGowan
5 | * @date 19 January 2015
6 | ******************************************************************************
7 | Copyright (c) 2015 Particle Industries, Inc. All rights reserved.
8 |
9 | This library is free software; you can redistribute it and/or
10 | modify it under the terms of the GNU Lesser General Public
11 | License as published by the Free Software Foundation, either
12 | version 3 of the License, or (at your option) any later version.
13 |
14 | This library is distributed in the hope that it will be useful,
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 | Lesser General Public License for more details.
18 |
19 | You should have received a copy of the GNU Lesser General Public
20 | License along with this library; if not, see .
21 | ******************************************************************************
22 | */
23 |
24 | #ifndef WLAN_INTERNAL_H
25 | #define WLAN_INTERNAL_H
26 |
27 | #include "wiced.h"
28 |
29 | #ifdef __cplusplus
30 | extern "C" {
31 | #endif
32 |
33 | wiced_result_t wlan_initialize_dct();
34 |
35 | #ifdef __cplusplus
36 | }
37 | #endif
38 |
39 |
40 |
41 | #endif /* WLAN_INTERNAL_H */
42 |
43 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/hal/src/duo/wwd_resources.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file wiced_stubs.h
4 | * @authors Matthew McGowan
5 | * @date 10 February 2015
6 | ******************************************************************************
7 | Copyright (c) 2015 Particle Industries, Inc. All rights reserved.
8 |
9 | This library is free software; you can redistribute it and/or
10 | modify it under the terms of the GNU Lesser General Public
11 | License as published by the Free Software Foundation, either
12 | version 3 of the License, or (at your option) any later version.
13 |
14 | This library is distributed in the hope that it will be useful,
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 | Lesser General Public License for more details.
18 |
19 | You should have received a copy of the GNU Lesser General Public
20 | License along with this library; if not, see .
21 | ******************************************************************************
22 | */
23 |
24 | #ifndef WICED_STUBS_H
25 | #define WICED_STUBS_H
26 |
27 | #include
28 |
29 | #ifdef __cplusplus
30 | extern "C" {
31 | #endif
32 |
33 | #ifndef INCLUDED_RESOURCE_H_
34 | // resource_hnd_t not defined so let's typedef it (it's only used as a pointer here.)
35 | typedef struct
36 | {
37 | } resource_hnd_t;
38 | #endif
39 |
40 | const resource_hnd_t* wwd_firmware_image_resource(void);
41 |
42 | const resource_hnd_t* wwd_nvram_image_resource(void);
43 |
44 | int wwd_select_nvram_image_resource(uint8_t res, void* reserved);
45 |
46 | #ifdef __cplusplus
47 | }
48 | #endif
49 |
50 | #endif /* WICED_STUBS_H */
51 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/hal/src/stm32/concurrent_hal_impl.h:
--------------------------------------------------------------------------------
1 |
2 | #ifndef CONCURRENT_HAL_IMPL_H
3 | #define CONCURRENT_HAL_IMPL_H
4 |
5 | #define OS_TIMER_INVALID_HANDLE NULL
6 |
7 | #ifdef __cplusplus
8 | extern "C" {
9 | #endif
10 |
11 | // This code is used by HAL-clients which don't have access to the FreeRTOS sources
12 | // so we cannot directly define __gthread_t as TaskHandle_t, however, we define it
13 | // here and statically assert that it is the same size.
14 |
15 | typedef void* __gthread_t;
16 |
17 | typedef void* os_thread_t;
18 | typedef int32_t os_result_t;
19 | typedef uint8_t os_thread_prio_t;
20 | /* Default priority is the same as the application thread */
21 | const os_thread_prio_t OS_THREAD_PRIORITY_DEFAULT = 2;
22 | const os_thread_prio_t OS_THREAD_PRIORITY_CRITICAL = 9;
23 | const size_t OS_THREAD_STACK_SIZE_DEFAULT = 3*1024;
24 |
25 | typedef void* os_mutex_t;
26 | typedef void* os_mutex_recursive_t;
27 | typedef void* condition_variable_t;
28 | typedef void* os_timer_t;
29 |
30 | typedef os_mutex_t __gthread_mutex_t;
31 | typedef os_mutex_recursive_t __gthread_recursive_mutex_t;
32 |
33 |
34 | /**
35 | * Alias for a queue handle in FreeRTOS - all handles are pointers.
36 | */
37 | typedef void* os_queue_t;
38 | typedef void* os_semaphore_t;
39 |
40 | typedef struct timespec __gthread_time_t;
41 |
42 | bool __gthread_equal(__gthread_t t1, __gthread_t t2);
43 | __gthread_t __gthread_self();
44 |
45 | typedef condition_variable_t __gthread_cond_t;
46 |
47 | int __gthread_cond_timedwait (__gthread_cond_t *cond,
48 | __gthread_mutex_t *mutex,
49 | const __gthread_time_t *abs_timeout);
50 |
51 |
52 | int __gthread_mutex_timedlock (__gthread_mutex_t* mutex, const __gthread_time_t* timeout);
53 |
54 | #ifdef __cplusplus
55 | }
56 | #endif
57 |
58 | #endif /* CONCURRENT_HAL_IMPL_H */
59 |
60 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/hal/src/stm32/ota_module.h:
--------------------------------------------------------------------------------
1 | /**
2 | Copyright (c) 2015 Particle Industries, Inc. All rights 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 3 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. See the GNU
12 | 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, see .
16 | ******************************************************************************
17 | */
18 |
19 |
20 | #pragma once
21 |
22 | #include "ota_flash_hal.h"
23 |
24 | #ifdef __cplusplus
25 | extern "C" {
26 | #endif
27 |
28 | /**
29 | * Checks if the minimum required dependencies for the given module are satisfied.
30 | * @param bounds The bounds of the module to check.
31 | * @return {@code true} if the dependencies are satisfied, {@code false} otherwise.
32 | */
33 | bool validate_module_dependencies(const module_bounds_t* bounds, bool userPartOptional, bool fullDeps);
34 | const module_bounds_t* find_module_bounds(uint8_t module_function, uint8_t module_index);
35 | bool fetch_module(hal_module_t* target, const module_bounds_t* bounds, bool userDepsOptional, uint16_t check_flags);
36 | const module_info_t* locate_module(const module_bounds_t* bounds);
37 |
38 | #ifdef __cplusplus
39 | }
40 | #endif
41 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/hal/src/stm32f2xx/bootloader.h:
--------------------------------------------------------------------------------
1 | /*
2 | * File: bootloader.h
3 | * Author: mat1
4 | *
5 | * Created on June 8, 2015, 4:45 PM
6 | */
7 |
8 | #ifndef BOOTLOADER_H
9 | #define BOOTLOADER_H
10 |
11 | #ifdef __cplusplus
12 | extern "C" {
13 | #endif
14 |
15 | #include
16 |
17 | bool bootloader_requires_update(const uint8_t* bootloader_image, uint32_t length);
18 | bool bootloader_update_if_needed();
19 |
20 | int bootloader_update(const void* bootloader_image, unsigned length);
21 |
22 |
23 | #ifdef __cplusplus
24 | }
25 | #endif
26 |
27 | #endif /* BOOTLOADER_H */
28 |
29 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/hal/src/stm32f2xx/dct_hal_stm32f2xx.h:
--------------------------------------------------------------------------------
1 | #ifndef DCT_HAL_STM32F2XX_H
2 | #define DCT_HAL_STM32F2XX_H
3 |
4 | #ifdef __cplusplus
5 | extern "C" {
6 | #endif
7 |
8 | int dct_lock(int write);
9 | int dct_unlock(int write);
10 |
11 | #ifdef __cplusplus
12 | } // extern "C"
13 | #endif
14 |
15 | #endif // DCT_HAL_STM32F2XX_H
16 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/hal/src/stm32f2xx/deepsleep_hal_impl.h:
--------------------------------------------------------------------------------
1 | /**
2 | Copyright (c) 2015 Particle Industries, Inc. All rights 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 3 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. See the GNU
12 | 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, see .
16 | ******************************************************************************
17 | */
18 |
19 | #pragma once
20 |
21 | #ifndef PARTICLE_NO_RETAINED
22 |
23 | #define retained __attribute__((section(".retained_user")))
24 |
25 | #define retained_system __attribute__((section(".retained_system")))
26 |
27 | #endif
28 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/hal/src/stm32f2xx/device_code.h:
--------------------------------------------------------------------------------
1 | /**
2 | Copyright (c) 2017 Particle Industries, Inc. All rights 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 3 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. See the GNU
12 | 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, see .
16 | ******************************************************************************
17 | */
18 | #pragma once
19 |
20 | #include
21 |
22 | #ifdef __cplusplus
23 | extern "C" {
24 | #endif
25 |
26 | /**
27 | * Variable String.
28 | */
29 | typedef struct
30 | {
31 | uint8_t length;
32 | uint8_t value[32];
33 | } device_code_t;
34 |
35 | /**
36 | * Appends the device code to the end of the existing value. The length field must be set to the length of
37 | * the current value.
38 | */
39 | bool fetch_or_generate_device_code(device_code_t* value);
40 | bool fetch_or_generate_setup_ssid(device_code_t* value);
41 |
42 | /**
43 | * This function is provided externally by the device HAL since the prefix is specific to the platform.
44 | */
45 | extern bool fetch_or_generate_ssid_prefix(device_code_t* value);
46 |
47 |
48 | #ifdef __cplusplus
49 | }
50 | #endif
51 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/hal/src/stm32f2xx/interrupts_impl.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file interrupts_impl.h
4 | * @author Satish Nair, Brett Walach, Matthew McGowan
5 | ******************************************************************************
6 | Copyright (c) 2013-2015 Particle Industries, Inc. All rights reserved.
7 |
8 | This library is free software; you can redistribute it and/or
9 | modify it under the terms of the GNU Lesser General Public
10 | License as published by the Free Software Foundation, either
11 | version 3 of the License, or (at your option) any later version.
12 |
13 | This library is distributed in the hope that it will be useful,
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 | Lesser General Public License for more details.
17 |
18 | You should have received a copy of the GNU Lesser General Public
19 | License along with this library; if not, see .
20 | ******************************************************************************
21 | */
22 |
23 | #ifndef INTERRUPTS_IMPL_H
24 | #define INTERRUPTS_IMPL_H
25 |
26 | #endif /* INTERRUPTS_IMPL_H */
27 |
28 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/hal/src/stm32f2xx/platform_headers.h:
--------------------------------------------------------------------------------
1 | /*
2 | * File: platform_headers.h
3 | * Author: mat
4 | *
5 | * Created on 31 October 2014, 21:25
6 | */
7 |
8 | #ifndef PLATFORM_HEADERS_H
9 | #define PLATFORM_HEADERS_H
10 |
11 | #ifdef __cplusplus
12 | extern "C" {
13 | #endif
14 |
15 | // These headers contain platform-specific defines.
16 | #include "gpio_hal.h"
17 | #include "hw_config.h"
18 | #include "pinmap_impl.h"
19 | #include "deepsleep_hal_impl.h"
20 | #if PLATFORM_ID == 10 // Electron
21 | #include "modem/enums_hal.h"
22 | #endif
23 | #include "usb_settings.h"
24 |
25 | #ifdef __cplusplus
26 | }
27 | #endif
28 |
29 | #endif /* PLATFORM_HEADERS_H */
30 |
31 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/hal/src/stm32f2xx/static_recursive_mutex.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "core_hal_stm32f2xx.h"
4 | #include "debug.h"
5 |
6 | #include "FreeRTOS.h"
7 | #include "semphr.h"
8 |
9 | // TODO: Use xSemaphoreCreateMutexStatic() after upgrading to FreeRTOS 9.x.x
10 | class StaticRecursiveMutex {
11 | public:
12 | StaticRecursiveMutex() :
13 | mutex_(nullptr) {
14 | }
15 |
16 | ~StaticRecursiveMutex() {
17 | if (mutex_) {
18 | vSemaphoreDelete(mutex_);
19 | }
20 | }
21 |
22 | bool lock(unsigned timeout = 0) {
23 | if (!mutex_ && !initMutex()) {
24 | return true; // FreeRTOS is not initialized
25 | }
26 | const TickType_t t = (timeout > 0) ? (timeout / portTICK_PERIOD_MS) : portMAX_DELAY;
27 | return (xSemaphoreTakeRecursive(mutex_, t) == pdTRUE);
28 | }
29 |
30 | bool unlock() {
31 | if (!mutex_) {
32 | return true;
33 | }
34 | return (xSemaphoreGiveRecursive(mutex_) == pdTRUE);
35 | }
36 |
37 | private:
38 | volatile SemaphoreHandle_t mutex_;
39 |
40 | bool initMutex() {
41 | const int32_t state = HAL_disable_irq();
42 | if (!mutex_ && rtos_started) {
43 | mutex_ = xSemaphoreCreateRecursiveMutex();
44 | SPARK_ASSERT(mutex_);
45 | }
46 | HAL_enable_irq(state);
47 | return (mutex_ != nullptr);
48 | }
49 | };
50 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/hal/src/stm32f2xx/usb_settings.h:
--------------------------------------------------------------------------------
1 | /**
2 | Copyright (c) 2016 Particle Industries, Inc. All rights 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 3 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. See the GNU
12 | 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, see .
16 | ******************************************************************************
17 | */
18 |
19 | #ifndef USB_SETTINGS_H_
20 | #define USB_SETTINGS_H_
21 |
22 | #define USB_TX_BUFFER_SIZE 129 /* Total size of IN buffer:
23 | APP_RX_DATA_SIZE*8/MAX_BAUDARATE*1000 should be > CDC_IN_FRAME_INTERVAL */
24 | #define USB_RX_BUFFER_SIZE 257
25 |
26 | #define USB_SERIAL_USERSPACE_BUFFERS 1
27 |
28 | #endif /* USB_SETTINGS_H_ */
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/platform/MCU/STM32F2xx/CMSIS/Device/ST/Include/stm32f2xx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/redbear/STM32-Arduino/b35fb3de95ba4faee41026cb38d0cc18e53ff84f/arduino/cores/RedBear_Duo/firmware/platform/MCU/STM32F2xx/CMSIS/Device/ST/Include/stm32f2xx.h
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/platform/MCU/STM32F2xx/CMSIS/Include/arm_common_tables.h:
--------------------------------------------------------------------------------
1 | /* ----------------------------------------------------------------------
2 | * Copyright (C) 2010 ARM Limited. All rights reserved.
3 | *
4 | * $Date: 11. November 2010
5 | * $Revision: V1.0.2
6 | *
7 | * Project: CMSIS DSP Library
8 | * Title: arm_common_tables.h
9 | *
10 | * Description: This file has extern declaration for common tables like Bitreverse, reciprocal etc which are used across different functions
11 | *
12 | * Target Processor: Cortex-M4/Cortex-M3
13 | *
14 | * Version 1.0.2 2010/11/11
15 | * Documentation updated.
16 | *
17 | * Version 1.0.1 2010/10/05
18 | * Production release and review comments incorporated.
19 | *
20 | * Version 1.0.0 2010/09/20
21 | * Production release and review comments incorporated.
22 | * -------------------------------------------------------------------- */
23 |
24 | #ifndef _ARM_COMMON_TABLES_H
25 | #define _ARM_COMMON_TABLES_H
26 |
27 | #include "arm_math.h"
28 |
29 | extern uint16_t armBitRevTable[256];
30 | extern q15_t armRecipTableQ15[64];
31 | extern q31_t armRecipTableQ31[64];
32 | extern const q31_t realCoefAQ31[1024];
33 | extern const q31_t realCoefBQ31[1024];
34 |
35 | #endif /* ARM_COMMON_TABLES_H */
36 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/platform/MCU/STM32F2xx/SPARK_Firmware_Driver/inc/eeprom_emulation_impl.h:
--------------------------------------------------------------------------------
1 | /*
2 | ******************************************************************************
3 | * Copyright (c) 2016 Particle Industries, Inc. 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 3 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, see .
17 | ******************************************************************************
18 | */
19 |
20 | #pragma once
21 |
22 | #include "eeprom_emulation.h"
23 | #if PLATFORM_ID == 88 // Duo
24 | #include "sflash_storage_impl.h"
25 |
26 | constexpr uintptr_t EEPROM_SectorBase1 = 0x000B8000;
27 | constexpr uintptr_t EEPROM_SectorBase2 = 0x000BC000;
28 |
29 | constexpr size_t EEPROM_SectorSize1 = 16*1024;
30 | constexpr size_t EEPROM_SectorSize2 = 16*1024;
31 |
32 | using FlashEEPROM = EEPROMEmulation;
33 | #else
34 | #include "flash_storage_impl.h"
35 |
36 | constexpr uintptr_t EEPROM_SectorBase1 = 0x0800C000;
37 | constexpr uintptr_t EEPROM_SectorBase2 = 0x08010000;
38 |
39 | constexpr size_t EEPROM_SectorSize1 = 16*1024;
40 | constexpr size_t EEPROM_SectorSize2 = 64*1024;
41 |
42 | using FlashEEPROM = EEPROMEmulation;
43 | #endif
44 |
45 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/platform/MCU/STM32F2xx/SPARK_Firmware_Driver/inc/flash_acquire.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #ifdef __cplusplus
4 | extern "C" {
5 | #endif
6 |
7 | /**
8 | * Acquire a thread-safe non-recurisve lock to the flash memory.
9 | */
10 | extern void __flash_acquire(void);
11 |
12 | /**
13 | * Release the previously acquired lock to flash memory. This MUST
14 | * be called after calling __flash_acquire() at the moment the current flash operation is complete.
15 | */
16 | extern void __flash_release(void);
17 |
18 | #ifdef __cplusplus
19 | }
20 | #endif
21 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/platform/MCU/STM32F2xx/SPARK_Firmware_Driver/inc/periph_lock.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #ifdef __cplusplus
4 | extern "C" {
5 | #endif
6 |
7 | /**
8 | * Acquire the global peripherals lock. The lock is recursive.
9 | */
10 | void periph_lock(void);
11 |
12 | /**
13 | * Release the global peripherals lock.
14 | */
15 | void periph_unlock(void);
16 |
17 | #ifdef __cplusplus
18 | }
19 | #endif
20 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/platform/MCU/STM32F2xx/SPARK_Firmware_Driver/inc/system_flags_impl.h:
--------------------------------------------------------------------------------
1 | #ifndef SYSTEM_FLAGS_IMPL_H
2 | #define SYSTEM_FLAGS_IMPL_H
3 |
4 | #include "platform_system_flags.h"
5 |
6 | #ifdef __cplusplus
7 | extern "C" {
8 | #endif
9 |
10 | int Load_SystemFlags_Impl(platform_system_flags_t* flags);
11 | int Save_SystemFlags_Impl(const platform_system_flags_t* flags);
12 |
13 | #ifdef __cplusplus
14 | } // extern "C"
15 | #endif
16 |
17 | #endif // SYSTEM_FLAGS_IMPL_H
18 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/platform/MCU/STM32F2xx/SPARK_Firmware_Driver/inc/usbd_mhid.h:
--------------------------------------------------------------------------------
1 | #ifndef USBD_MHID_H_
2 | #define USBD_MHID_H_
3 |
4 | #include "usbd_ioreq.h"
5 | #include "usbd_composite.h"
6 |
7 | #define USBD_MHID_CONFIG_DESC_SIZE 32
8 | #define USBD_MHID_DESC_SIZE 9
9 | #define USBD_MHID_REPORT_DESC_SIZE 178
10 |
11 | #define USBD_MHID_DIGITIZER_REPORT_DESC_SIZE 65
12 |
13 | #define HID_DESCRIPTOR_TYPE 0x21
14 | #define HID_REPORT_DESC 0x22
15 |
16 | #define HID_REQ_SET_PROTOCOL 0x0B
17 | #define HID_REQ_GET_PROTOCOL 0x03
18 |
19 | #define HID_REQ_SET_IDLE 0x0A
20 | #define HID_REQ_GET_IDLE 0x02
21 |
22 | #define HID_REQ_SET_REPORT 0x09
23 | #define HID_REQ_GET_REPORT 0x01
24 |
25 | extern USBD_Multi_Instance_cb_Typedef USBD_MHID_cb;
26 |
27 | typedef struct USBD_MHID_Instance_Data {
28 | __ALIGN_BEGIN volatile uint32_t alt_set __ALIGN_END;
29 | __ALIGN_BEGIN volatile uint32_t protocol __ALIGN_END;
30 | __ALIGN_BEGIN volatile uint32_t idle_state __ALIGN_END;
31 | uint8_t ep_in;
32 | uint8_t ep_out;
33 |
34 | uint8_t* report_descriptor;
35 | uint16_t report_descriptor_size;
36 |
37 | uint8_t configured;
38 |
39 | #ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED
40 | // Temporary aligned buffer
41 | __ALIGN_BEGIN uint8_t descriptor[USBD_MHID_DESC_SIZE] __ALIGN_END;
42 | #endif
43 |
44 | volatile uint8_t intransfer;
45 | } USBD_MHID_Instance_Data;
46 |
47 | uint8_t USBD_MHID_SendReport (USB_OTG_CORE_HANDLE* pdev, USBD_MHID_Instance_Data* priv, uint8_t* report, uint16_t len);
48 | int32_t USBD_MHID_Transfer_Status(void* pdev, USBD_Composite_Class_Data* cls);
49 | uint8_t USBD_MHID_SetDigitizerState(void* pdev, USBD_Composite_Class_Data* cls, uint8_t idx, uint8_t state);
50 |
51 | #endif /* USBD_MHID_H_ */
52 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/platform/MCU/STM32F2xx/STM32_USB_Device_Driver/inc/usbd_dct_if.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file usbd_dct_if.h
4 | * @author Spark Firmware Team
5 | * @version V1.1.0
6 | * @date 18-Nov-2014
7 | * @brief Header for usbd_dct_if.c file.
8 | ******************************************************************************
9 | *
10 | ******************************************************************************
11 | */
12 |
13 | /* Define to prevent recursive inclusion -------------------------------------*/
14 | #ifndef __DCT_IF_MAL_H
15 | #define __DCT_IF_MAL_H
16 |
17 | /* Includes ------------------------------------------------------------------*/
18 | #include "usbd_dfu_mal.h"
19 |
20 | /* Exported types ------------------------------------------------------------*/
21 | /* Exported constants --------------------------------------------------------*/
22 | #define DCT_START_ADD 0x00000000
23 |
24 | #define DCT_END_ADD 0x4000
25 | #define DCT_IF_STRING "@DCT Flash /0x00000000/01*016Kg"
26 |
27 |
28 | extern DFU_MAL_Prop_TypeDef DFU_DCT_cb;
29 |
30 | /* Exported macro ------------------------------------------------------------*/
31 | /* Exported functions ------------------------------------------------------- */
32 |
33 | #endif /* __DCT_IF_MAL_H */
34 |
35 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
36 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/platform/MCU/STM32F2xx/STM32_USB_Device_Driver/inc/usbd_sflash_if.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file usbd_sflash_if.h
4 | * @author Satish Nair
5 | * @version V1.0.0
6 | * @date 26-Nov-2014
7 | * @brief Header for usbd_sflash_if.c file.
8 | ******************************************************************************
9 | *
10 | ******************************************************************************
11 | */
12 |
13 | /* Define to prevent recursive inclusion -------------------------------------*/
14 | #ifndef __SFLASH_IF_MAL_H
15 | #define __SFLASH_IF_MAL_H
16 |
17 | /* Includes ------------------------------------------------------------------*/
18 | #include "usbd_dfu_mal.h"
19 |
20 | /* Exported types ------------------------------------------------------------*/
21 | /* Exported constants --------------------------------------------------------*/
22 | #define sFLASH_START_ADD 0x00000000
23 | #if PLATFORM_ID == PLATFORM_DUO_PRODUCTION
24 | #define sFLASH_END_ADD 0x00200000
25 | #else
26 | #define sFLASH_END_ADD 0x00100000
27 | #endif
28 |
29 | #if PLATFORM_ID == PLATFORM_DUO_PRODUCTION
30 | #define sFLASH_IF_STRING "@Serial Flash /0x00000000/192*004Kg,128*004Kg,64*004Kg,128*004Kg"
31 | #else
32 | #define sFLASH_IF_STRING "@Serial Flash /0x00000000/256*004Kg"
33 | #endif
34 |
35 | extern DFU_MAL_Prop_TypeDef DFU_sFlash_cb;
36 |
37 | /* Exported macro ------------------------------------------------------------*/
38 | /* Exported functions ------------------------------------------------------- */
39 |
40 | #endif /* __SFLASH_IF_MAL_H */
41 |
42 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/platform/MCU/shared/STM32/inc/hw_system_flags.h:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | Copyright (c) 2015 Particle Industries, Inc. All rights reserved.
4 |
5 | Copyright 2012 STMicroelectronics
6 | http://www.st.com/software_license_agreement_liberty_v2
7 |
8 | This library is free software; you can redistribute it and/or
9 | modify it under the terms of the GNU Lesser General Public
10 | License as published by the Free Software Foundation, either
11 | version 3 of the License, or (at your option) any later version.
12 |
13 | This library is distributed in the hope that it will be useful,
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 | Lesser General Public License for more details.
17 |
18 | You should have received a copy of the GNU Lesser General Public
19 | License along with this library; if not, see .
20 | ******************************************************************************
21 | */
22 |
23 | #pragma once
24 |
25 | #ifdef __cplusplus
26 | extern "C" {
27 | #endif
28 |
29 | #include "hw_config.h"
30 |
31 | void Save_Reset_Syndrome();
32 |
33 |
34 | #ifdef __cplusplus
35 | }
36 | #endif
37 |
38 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/platform/shared/inc/platforms.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file platforms.h
4 | * @authors Matthew McGowan, Brett Walach
5 | * @date 02 February 2015
6 | ******************************************************************************
7 | Copyright (c) 2015 Particle Industries, Inc. All rights reserved.
8 |
9 | This library is free software; you can redistribute it and/or
10 | modify it under the terms of the GNU Lesser General Public
11 | License as published by the Free Software Foundation, either
12 | version 3 of the License, or (at your option) any later version.
13 |
14 | This library is distributed in the hope that it will be useful,
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 | Lesser General Public License for more details.
18 |
19 | You should have received a copy of the GNU Lesser General Public
20 | License along with this library; if not, see .
21 | ******************************************************************************
22 | */
23 |
24 | #ifndef PLATFORMS_H
25 | #define PLATFORMS_H
26 |
27 | #define PLATFORM_SPARK_CORE 0
28 | #define PLATFORM_SPARK_CORE_HD 2
29 | #define PLATFORM_GCC 3
30 | #define PLATFORM_PHOTON_DEV 4
31 | #define PLATFORM_TEACUP_PIGTAIL_DEV 5
32 | #define PLATFORM_PHOTON_PRODUCTION 6
33 | #define PLATFORM_TEACUP_PIGTAIL_PRODUCTION 7
34 | #define PLATFORM_P1 8
35 | #define PLATFORM_ETHERNET_PROTO 9
36 | #define PLATFORM_ELECTRON_PRODUCTION 10
37 | #define PLATFORM_DUO_PRODUCTION 88
38 |
39 | #define PLATFORM_NEWHAL 60000
40 |
41 | #endif /* PLATFORMS_H */
42 |
43 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/services/inc/atomic_flag_mutex.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | template
7 | class AtomicFlagMutex {
8 | std::atomic_flag flag = ATOMIC_FLAG_INIT;
9 | public:
10 | void lock() {
11 | while (flag.test_and_set(std::memory_order_acquire)) {
12 | spin();
13 | }
14 | }
15 |
16 | void unlock() {
17 | flag.clear(std::memory_order_release);
18 | }
19 | };
20 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/services/inc/combine_hash.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2017 Particle Industries, Inc. All rights 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 3 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. See the GNU
12 | * 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, see .
16 | */
17 |
18 | #pragma once
19 |
20 | #include
21 |
22 | namespace particle {
23 |
24 | template
25 | inline void combineHash(size_t& seed, const T& value) {
26 | // The implementation is based on boost::hash_combine()
27 | std::hash hash;
28 | seed ^= hash(value) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
29 | }
30 |
31 | } // namespace particle
32 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/services/inc/debug.h:
--------------------------------------------------------------------------------
1 | #include "service_debug.h"
2 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/services/inc/panic.h:
--------------------------------------------------------------------------------
1 | /*
2 | * panic.h
3 | *
4 | * Created on: Jan 31, 2014
5 | * Author: david_s5
6 | */
7 | // The panic module will send SOS followed by 900 ms delay
8 | // followed by 300 blinks of the value of code
9 | /// ...---... code ...---...
10 |
11 |
12 | #ifndef PANIC_H_
13 | #define PANIC_H_
14 | #ifdef __cplusplus
15 | extern "C" {
16 | #endif
17 |
18 | #define def_panic_codes(_class,led,code) code,
19 | typedef enum {
20 | NotUsedPanicCode = 0, // Not used
21 | #include "panic_codes.h"
22 | } ePanicCode;
23 | #undef def_panic_codes
24 |
25 | void panic_(ePanicCode code, void* extraInfo, void (*HAL_Delay_Microseconds)(uint32_t));
26 |
27 | #ifdef __cplusplus
28 | }
29 | #endif
30 |
31 | #endif /* PANIC_H_ */
32 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/services/inc/panic_codes.h:
--------------------------------------------------------------------------------
1 | /*
2 | * panic.h
3 | *
4 | * Created on: Jan 31, 2014
5 | * Author: david_s5
6 | */
7 | // Add a panic code def_panic_codes(_class, led, code)
8 | // the panic module will send SOS followed by 900 ms delay
9 | // followed by 300 blinks of the value of code
10 | /// ...---... code ...---...
11 |
12 | def_panic_codes(Faults,RGB_COLOR_RED,HardFault)
13 | def_panic_codes(Faults,RGB_COLOR_RED,NMIFault)
14 | def_panic_codes(Faults,RGB_COLOR_RED,MemManage)
15 | def_panic_codes(Faults,RGB_COLOR_RED,BusFault)
16 | def_panic_codes(Faults,RGB_COLOR_RED,UsageFault)
17 |
18 | def_panic_codes(Cloud,RGB_COLOR_RED,InvalidLenth)
19 |
20 | def_panic_codes(System,RGB_COLOR_RED,Exit)
21 | def_panic_codes(System,RGB_COLOR_RED,OutOfHeap)
22 |
23 | def_panic_codes(System,RGB_COLOR_RED,SPIOverRun)
24 |
25 | def_panic_codes(Software,RGB_COLOR_RED,AssertionFailure)
26 | def_panic_codes(Software,RGB_COLOR_RED,InvalidCase)
27 | def_panic_codes(Software,RGB_COLOR_RED,PureVirtualCall)
28 |
29 | def_panic_codes(System,RGB_COLOR_RED,StackOverflow)
30 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/services/inc/ringbuf_helper.h:
--------------------------------------------------------------------------------
1 | #ifndef RINGBUF_HELPER_H_
2 | #define RINGBUF_HELPER_H_
3 |
4 | #include
5 |
6 | /* Wrap up buffer index */
7 | static inline uint32_t ring_wrap(uint32_t size, uint32_t idx)
8 | {
9 | return idx >= size ? idx - size : idx;
10 | }
11 |
12 | /* Returns the number of bytes available in buffer */
13 | static inline uint32_t ring_data_avail(uint32_t size, uint32_t head, uint32_t tail)
14 | {
15 | if (head >= tail)
16 | return head - tail;
17 | else
18 | return size + head - tail;
19 | }
20 |
21 | /* Returns the amount of free space available in buffer */
22 | static inline uint32_t ring_space_avail(uint32_t size, uint32_t head, uint32_t tail)
23 | {
24 | if (size == 0)
25 | return 0;
26 | return size - ring_data_avail(size, head, tail) - 1;
27 | }
28 |
29 | /* Returns the number of contiguous data bytes available in buffer */
30 | static inline uint32_t ring_data_contig(uint32_t size, uint32_t head, uint32_t tail)
31 | {
32 | if (head >= tail)
33 | return head - tail;
34 | else
35 | return size - tail;
36 | }
37 |
38 | /* Returns the amount of contiguous space available in buffer */
39 | static inline uint32_t ring_space_contig(uint32_t size, uint32_t head, uint32_t tail)
40 | {
41 | if (size == 0)
42 | return 0;
43 | if (head >= tail)
44 | return (tail ? size : size - 1) - head;
45 | else
46 | return tail - head - 1;
47 | }
48 |
49 | /* Returns the amount of free space available after wrapping up the head */
50 | static inline uint32_t ring_space_wrapped(uint32_t size, uint32_t head, uint32_t tail)
51 | {
52 | if (size == 0)
53 | return 0;
54 | if (head < tail || !tail)
55 | return 0;
56 | else
57 | return tail - 1;
58 | }
59 |
60 | #endif // RINGBUF_HELPER_H_
61 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/services/inc/static_assert.h:
--------------------------------------------------------------------------------
1 | /*
2 | * File: static_assert.h
3 | * Author: mat
4 | *
5 | * Created on 16 December 2014, 04:06
6 | */
7 |
8 | #ifndef STATIC_ASSERT_H
9 | #define STATIC_ASSERT_H
10 |
11 | #ifdef __cplusplus
12 | extern "C" {
13 | #endif
14 |
15 | #define STATIC_ASSERT_EXPR(name, condition) ((void)sizeof(char[1 - 2*!!(condition)]))
16 |
17 | #if defined(__cplusplus) && __cplusplus >= 201103L
18 | #define STATIC_ASSERT(name,condition) static_assert(condition,#name)
19 | #else
20 | #define STATIC_ASSERT(name,condition) typedef char assert_##name[(condition)?0:-1]
21 | #endif
22 |
23 |
24 | #ifdef __cplusplus
25 | }
26 | #endif
27 |
28 | #endif /* STATIC_ASSERT_H */
29 |
30 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/services/inc/test_malloc.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2016 Particle Industries, Inc. All rights 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 3 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. See the GNU
12 | * 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, see .
16 | */
17 |
18 | #pragma once
19 |
20 | #include
21 |
22 | #ifndef UNIT_TEST
23 |
24 | #define t_malloc malloc
25 | #define t_calloc calloc
26 | #define t_realloc realloc
27 | #define t_free free
28 |
29 | #else
30 |
31 | #ifdef __cplusplus
32 | extern "C" {
33 | #endif
34 |
35 | void* t_malloc(size_t size);
36 | void* t_calloc(size_t count, size_t size);
37 | void* t_realloc(void* ptr, size_t size);
38 | void t_free(void* ptr);
39 |
40 | #ifdef __cplusplus
41 | } // extern "C"
42 | #endif
43 |
44 | #endif // defined(UNIT_TEST)
45 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/services/inc/underlying_type.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2017 Particle Industries, Inc. All rights 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 3 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. See the GNU
12 | * 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, see .
16 | */
17 |
18 | #pragma once
19 |
20 | #include
21 |
22 | namespace particle {
23 |
24 | // Wrapper for std::underlying_type that falls back to the original type if it is not an enum
25 | template
26 | struct UnderlyingType {
27 | typedef T Type;
28 | };
29 |
30 | template
31 | struct UnderlyingType::value>::type> {
32 | typedef typename std::underlying_type::type Type;
33 | };
34 |
35 | } // namespace particle
36 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/system/inc/system_avrdude.h:
--------------------------------------------------------------------------------
1 | /**
2 | Copyright (c) 2015 Particle Industries, Inc. All rights 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 3 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. See the GNU
12 | 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, see .
16 | ******************************************************************************
17 | */
18 |
19 | #ifndef SYSTEM_AVRDUDE_H_
20 | #define SYSTEM_AVRDUDE_H_
21 |
22 | #include "file_transfer.h"
23 |
24 | #ifdef __cplusplus
25 | extern "C" {
26 | #endif
27 |
28 | typedef struct Stream Stream;
29 | #include
30 |
31 | #if (PLATFORM_ID==88)
32 | bool Avrdude_Serial_Flash_Update(Stream *serialObj, FileTransfer::Descriptor& desc, void*);
33 | #endif
34 |
35 | #ifdef __cplusplus
36 | }
37 | #endif
38 |
39 | #endif /* SYSTEM_AVRDUDE_H */
40 |
41 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/system/inc/system_mode.h:
--------------------------------------------------------------------------------
1 | /**
2 | Copyright (c) 2013-2015 Particle Industries, Inc. All rights 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 3 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. See the GNU
12 | 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, see .
16 | ******************************************************************************
17 | */
18 |
19 | #ifndef SYSTEM_MODE_H
20 | #define SYSTEM_MODE_H
21 |
22 | #include
23 |
24 | #ifdef __cplusplus
25 | extern "C" {
26 | #endif
27 |
28 | typedef enum
29 | {
30 | DEFAULT=0, AUTOMATIC = 1, SEMI_AUTOMATIC = 2, MANUAL = 3, SAFE_MODE=4
31 | } System_Mode_TypeDef;
32 |
33 | void set_system_mode(System_Mode_TypeDef mode);
34 | System_Mode_TypeDef system_mode();
35 |
36 | namespace spark {
37 | namespace feature {
38 | enum State {
39 | DISABLED =0,
40 | ENABLED =1,
41 | };
42 | }
43 |
44 | }
45 |
46 | void system_thread_set_state(spark::feature::State feature, void* reserved);
47 | spark::feature::State system_thread_get_state(void*);
48 | uint16_t system_button_pushed_duration(uint8_t button, void* reserved);
49 |
50 | #if PLATFORM_ID == 88
51 | void ble_setup_set_state(spark::feature::State state, void*);
52 | spark::feature::State ble_setup_get_state(void*);
53 | #endif
54 |
55 | #ifdef __cplusplus
56 | }
57 | #endif
58 |
59 | #endif /* SYSTEM_MODE_H */
60 |
61 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/system/inc/system_string_interpolate.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | Copyright (c) 2015 Particle Industries, Inc. 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 3 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, see .
17 | ******************************************************************************
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | /**
25 | * Callback to add interpolated variables to a buffer.
26 | */
27 | typedef size_t (*string_interpolate_source_t)(const char* ident, size_t ident_len, char* buf, size_t buf_len);
28 |
29 | /**
30 | * Interpolates variable placeholders in a buffer.
31 | * Each variable starts with $ and is a sequence of one or more alphanumeric characters, plus underscore.
32 | */
33 | size_t system_string_interpolate(const char* source, char* dest, size_t dest_len, string_interpolate_source_t vars);
34 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/system/inc/system_user.h:
--------------------------------------------------------------------------------
1 | /**
2 | Copyright (c) 2013-2015 Particle Industries, Inc. All rights 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 3 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. See the GNU
12 | 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, see .
16 | ******************************************************************************
17 | */
18 |
19 | #ifndef SYSTEM_USER_H
20 | #define SYSTEM_USER_H
21 |
22 | #ifdef __cplusplus
23 | extern "C" {
24 | #endif
25 |
26 | #include
27 |
28 | void setup();
29 | void loop();
30 |
31 | void _post_loop();
32 | void serialEventRun();
33 |
34 | /**
35 | * Code that is initialized before any user constructors are called.
36 | */
37 | void module_user_init_hook(void);
38 |
39 | /**
40 | * Determines if the backup ram was valid, or if it was initialized.
41 | * @return true if the backup ram was valid and didn't need initializing. False if the ram was invalid and was initialized.
42 | */
43 | bool __backup_ram_was_valid();
44 |
45 | void random_seed_from_cloud(unsigned int value) __attribute__((weak));
46 |
47 |
48 | #ifdef __cplusplus
49 | }
50 | #endif
51 |
52 | #endif /* SYSTEM_USER_H */
53 |
54 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/system/inc/system_wireless_update.h:
--------------------------------------------------------------------------------
1 |
2 | #ifndef SYSTEM_WIRELESS_UPDATE_H_
3 | #define SYSTEM_WIRELESS_UPDATE_H_
4 |
5 | #ifdef __cplusplus
6 | extern "C" {
7 | #endif
8 |
9 | #if (PLATFORM_ID==88)
10 |
11 | void Wireless_Update_Begin(uint32_t file_length, uint16_t chunk_size, uint32_t chunk_address, uint8_t file_store);
12 | uint8_t Wireless_Update_Save_Chunk(uint8_t *data, uint16_t length);
13 | void Wireless_Update_Finish(void);
14 |
15 | #endif
16 |
17 | #ifdef __cplusplus
18 | }
19 | #endif
20 |
21 | void HAL_WLAN_notify_OTA_update_completed(void);
22 |
23 | #endif /* SYSTEM_WIRELESS_UPDATE_H_ */
24 |
25 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/system/inc/wifitester.h:
--------------------------------------------------------------------------------
1 | #include "spark_wiring_wifitester.h"
2 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/user/inc/Particle.h:
--------------------------------------------------------------------------------
1 |
2 | #ifndef PARTICLE_H
3 | #define PARTICLE_H
4 |
5 | #include "application.h"
6 |
7 | #endif /* PARTICLE_H */
8 |
9 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/user/inc/Print.h:
--------------------------------------------------------------------------------
1 | #include "Arduino.h"
2 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/user/inc/SPI.h:
--------------------------------------------------------------------------------
1 | #include "Arduino.h"
2 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/user/inc/Stream.h:
--------------------------------------------------------------------------------
1 | #include "Arduino.h"
2 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/user/inc/WProgram.h:
--------------------------------------------------------------------------------
1 | #include "Arduino.h"
2 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/user/inc/WString.h:
--------------------------------------------------------------------------------
1 | #include "Arduino.h"
2 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/user/inc/Wire.h:
--------------------------------------------------------------------------------
1 | #include "Arduino.h"
2 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/wiring/inc/spark_disable_cloud.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file spark_disable_cloud.h
4 | * @author Satish Nair
5 | * @version V1.0.0
6 | * @date 6-March-2014
7 | * @brief Header to be included to prevent the core from connecting to cloud
8 | ******************************************************************************
9 | Copyright (c) 2013-2015 Particle Industries, Inc. All rights reserved.
10 |
11 | This library is free software; you can redistribute it and/or
12 | modify it under the terms of the GNU Lesser General Public
13 | License as published by the Free Software Foundation, either
14 | version 3 of the License, or (at your option) any later version.
15 |
16 | This library is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 | Lesser General Public License for more details.
20 |
21 | You should have received a copy of the GNU Lesser General Public
22 | License along with this library; if not, see .
23 | ******************************************************************************
24 | */
25 |
26 | /* Define to prevent recursive inclusion -------------------------------------*/
27 | #ifndef __SPARK_DISABLE_CLOUD_H
28 | #define __SPARK_DISABLE_CLOUD_H
29 |
30 | #error This header (spark_disable_cloud.h) has been deprecated. \
31 | Please use SYSTEM_MODE instead \
32 | "http://docs.spark.io/firmware/#advanced-system-modes".
33 |
34 | #endif /* __SPARK_DISABLE_CLOUD_H */
35 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/wiring/inc/spark_disable_wlan.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file spark_disable_wlan.h
4 | * @author Satish Nair
5 | * @version V1.0.0
6 | * @date 6-March-2014
7 | * @brief Header to be included to prevent the core from starting the wlan
8 | ******************************************************************************
9 | Copyright (c) 2013-2015 Particle Industries, Inc. All rights reserved.
10 |
11 | This library is free software; you can redistribute it and/or
12 | modify it under the terms of the GNU Lesser General Public
13 | License as published by the Free Software Foundation, either
14 | version 3 of the License, or (at your option) any later version.
15 |
16 | This library is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 | Lesser General Public License for more details.
20 |
21 | You should have received a copy of the GNU Lesser General Public
22 | License along with this library; if not, see .
23 | ******************************************************************************
24 | */
25 |
26 | /* Define to prevent recursive inclusion -------------------------------------*/
27 | #ifndef __SPARK_DISABLE_WLAN_H
28 | #define __SPARK_DISABLE_WLAN_H
29 |
30 | #error This header (spark_disable_wlan.h) has been deprecated. \
31 | Please use SYSTEM_MODE instead \
32 | "http://docs.spark.io/firmware/#advanced-system-modes".
33 |
34 | #endif /* __SPARK_DISABLE_WLAN_H */
35 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/wiring/inc/spark_wiring_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 |
23 | #include "system_network.h"
24 | #include "spark_wiring_print.h"
25 | #include "spark_wiring_stream.h"
26 | #include "spark_wiring_ipaddress.h"
27 |
28 | class Client : public Stream {
29 | protected:
30 | network_interface_t nif;
31 |
32 | public:
33 | virtual int connect(IPAddress ip, uint16_t port, network_interface_t=0) =0;
34 | virtual int connect(const char *host, uint16_t port, network_interface_t=0) =0;
35 | virtual size_t write(uint8_t) =0;
36 | virtual size_t write(const uint8_t *buf, size_t size) =0;
37 | virtual int available() = 0;
38 | virtual int read() = 0;
39 | virtual int read(uint8_t *buf, size_t size) = 0;
40 | virtual int peek() = 0;
41 | virtual void flush() = 0;
42 | virtual void stop() = 0;
43 | virtual uint8_t connected() = 0;
44 | virtual operator bool() = 0;
45 | };
46 |
47 | #endif
48 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/wiring/inc/spark_wiring_global.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2017 Particle Industries, Inc. All rights 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 3 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. See the GNU
12 | * 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, see .
16 | */
17 |
18 | #pragma once
19 |
20 | #if defined(PARTICLE_USER_MODULE)
21 | #define PARTICLE_RETAINED retained
22 | #else
23 | #define PARTICLE_RETAINED retained_system
24 | #endif
25 |
26 | #if defined(PARTICLE_USER_MODULE) && !defined(PARTICLE_USING_DEPRECATED_API)
27 | #define PARTICLE_DEPRECATED_API(_msg) \
28 | __attribute__((deprecated(_msg " Define PARTICLE_USING_DEPRECATED_API macro to avoid this warning.")))
29 | #else
30 | #define PARTICLE_DEPRECATED_API(_msg)
31 | #endif
32 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/wiring/inc/spark_wiring_hciserial.h:
--------------------------------------------------------------------------------
1 |
2 | #ifndef __SPARK_WIRING_HCISERIAL_H
3 | #define __SPARK_WIRING_HCISERIAL_H
4 |
5 | #if PLATFORM_ID == 88 // Duo
6 |
7 | #include "spark_wiring_stream.h"
8 | #include "hci_usart_hal.h"
9 | #include "spark_wiring_platform.h"
10 | #include "spark_wiring_usartserial.h"
11 |
12 |
13 | class HCIUsart
14 | {
15 | private:
16 | HAL_HCI_USART_Serial _serial;
17 | public:
18 | HCIUsart(HAL_HCI_USART_Serial serial, HCI_USART_Ring_Buffer *rx_buffer, HCI_USART_Ring_Buffer *tx_buffer);
19 |
20 | void registerReceiveHandler(ReceiveHandler_t handler);
21 | int downloadFirmware(void);
22 |
23 | void begin(unsigned long baudrate);
24 | void end(void);
25 |
26 | int available(void);
27 | int read(void);
28 | size_t write(uint8_t dat);
29 | size_t write(const uint8_t *buf, uint16_t len);
30 |
31 | void restartTransmit(void);
32 | void setRTS(uint8_t value);
33 | uint8_t checkCTS(void);
34 | };
35 |
36 | #if Wiring_Serial6
37 | extern HCIUsart BTUsart;
38 | #endif
39 |
40 | #endif
41 |
42 | #endif
43 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/wiring/inc/spark_wiring_printable.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file spark_wiring_printable.h
4 | * @author Satish Nair
5 | * @version V1.0.0
6 | * @date 10-Nov-2013
7 | * @brief Header for spark_wiring_printable.cpp module
8 | ******************************************************************************
9 | Copyright (c) 2013-2015 Particle Industries, Inc. All rights reserved.
10 | Copyright (c) 2011 Adrian McEwen. All right reserved.
11 |
12 | This library is free software; you can redistribute it and/or
13 | modify it under the terms of the GNU Lesser General Public
14 | License as published by the Free Software Foundation, either
15 | version 3 of the License, or (at your option) any later version.
16 |
17 | This library is distributed in the hope that it will be useful,
18 | but WITHOUT ANY WARRANTY; without even the implied warranty of
19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 | Lesser General Public License for more details.
21 |
22 | You should have received a copy of the GNU Lesser General Public
23 | License along with this library; if not, see .
24 | ******************************************************************************
25 | */
26 |
27 | #ifndef __SPARK_WIRING_PRINTABLE_H
28 | #define __SPARK_WIRING_PRINTABLE_H
29 |
30 | #include
31 |
32 | class Print;
33 |
34 | /** The Printable class provides a way for new classes to allow themselves to be printed.
35 | By deriving from Printable and implementing the printTo method, it will then be possible
36 | for users to print out instances of this class by passing them into the usual
37 | Print::print and Print::println methods.
38 | */
39 |
40 | class Printable
41 | {
42 | public:
43 | virtual size_t printTo(Print& p) const = 0;
44 | };
45 |
46 | #endif
47 |
48 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/wiring/inc/spark_wiring_random.h:
--------------------------------------------------------------------------------
1 | /*
2 | * File: spark_wiring_random.h
3 | * Author: mat
4 | *
5 | * Created on 04 September 2014, 21:50
6 | */
7 |
8 | #ifndef SPARK_WIRING_RANDOM_H
9 | #define SPARK_WIRING_RANDOM_H
10 |
11 | void randomSeed(unsigned int seed);
12 | int random(int max);
13 | int random(int min, int max);
14 |
15 | #endif /* SPARK_WIRING_RANDOM_H */
16 |
17 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/wiring/inc/spark_wiring_sflash.h:
--------------------------------------------------------------------------------
1 |
2 | #ifndef __SPARK_WIRING_SFLASH_H_
3 | #define __SPARK_WIRING_SFLASH_H_
4 |
5 | #if PLATFORM_ID == 88 // Duo
6 |
7 |
8 | #include "spi_flash.h"
9 |
10 |
11 | #define SFLASH_RESERVED_ADDRESS 0xB8000
12 |
13 | class SerialFlash
14 | {
15 | public:
16 | SerialFlash(void);
17 |
18 | void eraseSector(uint32_t SectorAddr);
19 | void writeBuffer(const uint8_t *pBuffer, uint32_t WriteAddr, uint32_t NumByteToWrite);
20 | void readBuffer(uint8_t *pBuffer, uint32_t ReadAddr, uint32_t NumByteToRead);
21 | int selfTest(void);
22 | };
23 |
24 |
25 | extern SerialFlash sFLASH;
26 |
27 | #endif
28 |
29 | #endif
30 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/wiring/inc/spark_wiring_signal.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2017 Particle Industries, Inc. All rights 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 3 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. See the GNU
12 | * 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, see .
16 | */
17 |
18 | #pragma once
19 |
20 | #include "net_hal.h"
21 |
22 | namespace particle {
23 |
24 | class Signal {
25 | public:
26 | virtual ~Signal() {};
27 |
28 | virtual hal_net_access_tech_t getAccessTechnology() const = 0;
29 | virtual float getStrength() const = 0;
30 | virtual float getStrengthValue() const = 0;
31 | virtual float getQuality() const = 0;
32 | virtual float getQualityValue() const = 0;
33 | };
34 |
35 | } // particle
36 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/wiring/inc/spark_wiring_startup.h:
--------------------------------------------------------------------------------
1 | /**
2 | Copyright (c) 2015 Particle Industries, Inc. All rights 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 3 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. See the GNU
12 | 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, see .
16 | ******************************************************************************
17 | */
18 |
19 | #pragma once
20 |
21 | #define STARTUP(code) STARTUP_(startup, __COUNTER__, code)
22 |
23 | #define STARTUP_(name, count, code) \
24 | STARTUP__(name, count, code)
25 |
26 | #define STARTUP__(name, id, code) \
27 | struct name##id { name##id() { code; } }; static name##id __instance_##name##id;
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/wiring/inc/spark_wiring_ticks.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file spark_wiring_ticks.h
4 | * @author Satish Nair, Zachary Crockett, Zach Supalla and Mohit Bhoite
5 | * @version V1.0.0
6 | * @date 13-March-2013
7 | * @brief Header for spark_wiring.c module
8 | ******************************************************************************
9 | Copyright (c) 2013-2015 Particle Industries, Inc. All rights reserved.
10 |
11 | This library is free software; you can redistribute it and/or
12 | modify it under the terms of the GNU Lesser General Public
13 | License as published by the Free Software Foundation, either
14 | version 3 of the License, or (at your option) any later version.
15 |
16 | This library is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 | Lesser General Public License for more details.
20 |
21 | You should have received a copy of the GNU Lesser General Public
22 | License along with this library; if not, see .
23 | ******************************************************************************
24 | */
25 |
26 | #ifndef SPARK_WIRING_TICKS_H
27 | #define SPARK_WIRING_TICKS_H
28 |
29 | #ifdef __cplusplus
30 | extern "C" {
31 | #endif
32 |
33 | #include "timer_hal.h"
34 | #include "delay_hal.h"
35 |
36 | inline system_tick_t millis(void) { return HAL_Timer_Get_Milli_Seconds(); }
37 | inline unsigned long micros(void) { return HAL_Timer_Get_Micro_Seconds(); }
38 | void delay(unsigned long ms);
39 | inline void delayMicroseconds(unsigned int us) { HAL_Delay_Microseconds(us); }
40 |
41 | #ifdef __cplusplus
42 | }
43 | #endif
44 |
45 |
46 | #endif /* SPARK_WIRING_TICKS_H */
47 |
48 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/wiring/inc/spark_wiring_tone.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file spark_wiring_tone.h
4 | * @author Satish Nair
5 | * @version V1.0.0
6 | * @date 21-April-2014
7 | * @brief Header for spark_wiring_tone.c module
8 | ******************************************************************************
9 | Copyright (c) 2013-2015 Particle Industries, Inc. All rights reserved.
10 |
11 | This library is free software; you can redistribute it and/or
12 | modify it under the terms of the GNU Lesser General Public
13 | License as published by the Free Software Foundation, either
14 | version 3 of the License, or (at your option) any later version.
15 |
16 | This library is distributed in the hope that it will be useful,
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 | Lesser General Public License for more details.
20 |
21 | You should have received a copy of the GNU Lesser General Public
22 | License along with this library; if not, see .
23 | ******************************************************************************
24 | */
25 |
26 | #ifndef __SPARK_WIRING_TONE_H
27 | #define __SPARK_WIRING_TONE_H
28 |
29 | #include "spark_wiring.h"
30 |
31 | #ifdef __cplusplus
32 | extern "C" {
33 | #endif
34 |
35 | void tone(uint8_t pin, unsigned int frequency, unsigned long duration = 0);
36 | void noTone(uint8_t pin);
37 |
38 | #ifdef __cplusplus
39 | }
40 | #endif
41 |
42 | #endif /* __SPARK_WIRING_TONE_H_ */
43 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/firmware/wiring/inc/string_convert.h:
--------------------------------------------------------------------------------
1 |
2 | #ifndef STRING_CONVERT_H
3 | #define STRING_CONVERT_H
4 |
5 | #ifdef __cplusplus
6 | extern "C" {
7 | #endif
8 |
9 | //convert long to string
10 | char *ltoa(long N, char *str, int base);
11 |
12 | //convert unsigned long to string
13 | char* ultoa(unsigned long a, char* buffer, int radix, char pad=1);
14 |
15 | //convert unsigned int to string
16 | char* utoa(unsigned a, char* buffer, int radix);
17 |
18 | char* itoa(int a, char* buffer, int radix);
19 |
20 |
21 |
22 |
23 | #ifdef __cplusplus
24 | }
25 | #endif
26 |
27 | #endif /* STRING_CONVERT_H */
28 |
29 |
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/libs/STM32F2xx_Peripheral_Libraries.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/redbear/STM32-Arduino/b35fb3de95ba4faee41026cb38d0cc18e53ff84f/arduino/cores/RedBear_Duo/libs/STM32F2xx_Peripheral_Libraries.a
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/libs/libcommunication-dynalib.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/redbear/STM32-Arduino/b35fb3de95ba4faee41026cb38d0cc18e53ff84f/arduino/cores/RedBear_Duo/libs/libcommunication-dynalib.a
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/libs/libhal-dynalib.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/redbear/STM32-Arduino/b35fb3de95ba4faee41026cb38d0cc18e53ff84f/arduino/cores/RedBear_Duo/libs/libhal-dynalib.a
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/libs/libplatform.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/redbear/STM32-Arduino/b35fb3de95ba4faee41026cb38d0cc18e53ff84f/arduino/cores/RedBear_Duo/libs/libplatform.a
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/libs/librt-dynalib.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/redbear/STM32-Arduino/b35fb3de95ba4faee41026cb38d0cc18e53ff84f/arduino/cores/RedBear_Duo/libs/librt-dynalib.a
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/libs/libservices-dynalib.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/redbear/STM32-Arduino/b35fb3de95ba4faee41026cb38d0cc18e53ff84f/arduino/cores/RedBear_Duo/libs/libservices-dynalib.a
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/libs/libsystem-dynalib.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/redbear/STM32-Arduino/b35fb3de95ba4faee41026cb38d0cc18e53ff84f/arduino/cores/RedBear_Duo/libs/libsystem-dynalib.a
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/libs/libwiring.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/redbear/STM32-Arduino/b35fb3de95ba4faee41026cb38d0cc18e53ff84f/arduino/cores/RedBear_Duo/libs/libwiring.a
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/libs/libwiring_globals.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/redbear/STM32-Arduino/b35fb3de95ba4faee41026cb38d0cc18e53ff84f/arduino/cores/RedBear_Duo/libs/libwiring_globals.a
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/libs/module_info.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/redbear/STM32-Arduino/b35fb3de95ba4faee41026cb38d0cc18e53ff84f/arduino/cores/RedBear_Duo/libs/module_info.o
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/libs/newlib_stubs.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/redbear/STM32-Arduino/b35fb3de95ba4faee41026cb38d0cc18e53ff84f/arduino/cores/RedBear_Duo/libs/newlib_stubs.o
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/libs/user_export.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/redbear/STM32-Arduino/b35fb3de95ba4faee41026cb38d0cc18e53ff84f/arduino/cores/RedBear_Duo/libs/user_export.o
--------------------------------------------------------------------------------
/arduino/cores/RedBear_Duo/libs/user_module.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/redbear/STM32-Arduino/b35fb3de95ba4faee41026cb38d0cc18e53ff84f/arduino/cores/RedBear_Duo/libs/user_module.o
--------------------------------------------------------------------------------
/arduino/firmwares/README.md:
--------------------------------------------------------------------------------
1 | Current Firmware Version: v0.3.1
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/arduino/firmwares/duo-bootloader-r6.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/redbear/STM32-Arduino/b35fb3de95ba4faee41026cb38d0cc18e53ff84f/arduino/firmwares/duo-bootloader-r6.bin
--------------------------------------------------------------------------------
/arduino/firmwares/duo-factory-reset.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/redbear/STM32-Arduino/b35fb3de95ba4faee41026cb38d0cc18e53ff84f/arduino/firmwares/duo-factory-reset.bin
--------------------------------------------------------------------------------
/arduino/firmwares/duo-system-part1-v0.3.3.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/redbear/STM32-Arduino/b35fb3de95ba4faee41026cb38d0cc18e53ff84f/arduino/firmwares/duo-system-part1-v0.3.3.bin
--------------------------------------------------------------------------------
/arduino/firmwares/duo-system-part2-v0.3.3.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/redbear/STM32-Arduino/b35fb3de95ba4faee41026cb38d0cc18e53ff84f/arduino/firmwares/duo-system-part2-v0.3.3.bin
--------------------------------------------------------------------------------
/arduino/firmwares/duo-user-part.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/redbear/STM32-Arduino/b35fb3de95ba4faee41026cb38d0cc18e53ff84f/arduino/firmwares/duo-user-part.bin
--------------------------------------------------------------------------------
/arduino/firmwares/duo-wifi-r2.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/redbear/STM32-Arduino/b35fb3de95ba4faee41026cb38d0cc18e53ff84f/arduino/firmwares/duo-wifi-r2.bin
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/examples/03.BLE/BLEController/pin_inf.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2016 RedBear
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
5 | * to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
6 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
7 | *
8 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 | *
10 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
11 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
12 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
13 | * IN THE SOFTWARE.
14 | */
15 |
16 | #ifndef PIN_INF_H_
17 | #define PIN_INF_H_
18 |
19 | #if defined(ARDUINO)
20 | #include "Arduino.h"
21 | #endif
22 |
23 | #define TOTAL_PINS_NUM 18
24 | #define VERSION_BLINK_PIN 7
25 |
26 | #define IS_PIN_DIGITAL(p) ( (p) >= 0 && (p) < 18 )
27 | #define IS_PIN_ANALOG(p) ( (p) >= 8 && (p) < 16 )
28 | #define IS_PIN_PWM(p) ( ( (p) >= 0 && (p) < 5 ) || (p) == 8 || (p) == 9 || ( (p) >= 14 && (p) < 18 ) )
29 | #define IS_PIN_SERVO(p) ( (p) == 12 || (p) == 13 )
30 |
31 | #define PIN_TO_DIGITAL(p) (p)
32 | #define PIN_TO_ANALOG(p) (p)
33 | #define PIN_TO_PWM(p) (p)
34 | #define PIN_TO_SERVO(p) (p)
35 |
36 | #endif
37 |
38 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/examples/04.Combo/TCPServerControlMultiBLEPeripherals/json_format.txt:
--------------------------------------------------------------------------------
1 |
2 | //write command
3 | {
4 | "OpCode":1,
5 | "ID":1,
6 | "NUM":255, //invalid
7 | "R":255,
8 | "G":100,
9 | "B":125
10 | }
11 |
12 | //read command
13 | {
14 | "OpCode":2,
15 | "ID":1,
16 | "NUM":0, //invalid
17 | "R":0, //invalid
18 | "G":0, //invalid
19 | "B":0 //invalid
20 | }
21 |
22 | //read number
23 | {
24 | "OpCode":3,
25 | "ID":255,
26 | "NUM":0, //invalid
27 | "R":0, //invalid
28 | "G":0, //invalid
29 | "B":0 //invalid
30 | }
31 |
32 | //status report
33 | {
34 | "OpCode":0,
35 | "ID":1,
36 | "NUM":255, //invalid
37 | "R":0,
38 | "G":0,
39 | "B":0
40 | }
41 |
42 | //back of read number
43 | {
44 | "OpCode":0,
45 | "ID":255,
46 | "NUM":8,
47 | "R":0, //invalid
48 | "G":0, //invalid
49 | "B":0 //invalid
50 | }
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/keywords.txt:
--------------------------------------------------------------------------------
1 | #######################################
2 | # Syntax Coloring Map Servo
3 | #######################################
4 |
5 | #######################################
6 | # Datatypes (KEYWORD1)
7 | #######################################
8 |
9 | RedBear_Duo KEYWORD1
10 |
11 | #######################################
12 | # Methods and Functions (KEYWORD2)
13 | #######################################
14 |
15 | invalid KEYWORD2
16 |
17 | #######################################
18 | # Constants (LITERAL1)
19 | #######################################
20 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/library.properties:
--------------------------------------------------------------------------------
1 | name=RedBear_Duo
2 | version=1.0.0
3 | author=RedBear_Duo
4 | maintainer=RedBear_Duo
5 | sentence=Allow
6 | paragraph=This library
7 | category=Display
8 | url=
9 | architectures=*
10 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/src/ArduinoJson.h:
--------------------------------------------------------------------------------
1 | // Copyright Benoit Blanchon 2014-2016
2 | // MIT License
3 | //
4 | // Arduino JSON library
5 | // https://github.com/bblanchon/ArduinoJson
6 | // If you like this project, please add a star!
7 |
8 | // About this file
9 | // ---------------
10 | // This file is here to please the Arduino IDE. It must be present in the src/
11 | // for the IDE to find it. Feel free to ignore this file if your working in
12 | // another environment
13 |
14 | #include "include/ArduinoJson.h"
15 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/src/Buffer.h:
--------------------------------------------------------------------------------
1 | #include"Arduino.h"
2 |
3 | #ifndef _INCL_BUFFER
4 | #define _INCL_BUFFER
5 |
6 | #define INVALID_MARK_OFFSET 0xffff
7 |
8 | class Buffer {
9 | public:
10 | Buffer(uint16_t size);
11 |
12 | uint16_t available();
13 |
14 | void mark();
15 | void reset();
16 | void setOffset(uint16_t offset);
17 | uint16_t getOffset();
18 |
19 | void read(UDP * udp);
20 |
21 | uint8_t readUInt8();
22 | uint16_t readUInt16();
23 |
24 | void write(UDP * udp);
25 |
26 | void writeUInt8(uint8_t value);
27 | void writeUInt16(uint16_t value);
28 | void writeUInt32(uint32_t value);
29 |
30 | void clear();
31 |
32 | private:
33 |
34 | uint8_t * data;
35 | uint16_t size;
36 |
37 | uint16_t limit = 0;
38 | uint16_t offset = 0;
39 | uint16_t markOffset = INVALID_MARK_OFFSET;
40 | };
41 |
42 | #endif
43 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/src/QuerySet.h:
--------------------------------------------------------------------------------
1 | #include "Arduino.h"
2 |
3 | #ifndef _INCL_QUERY_SET
4 | #define _INCL_QUERY_SET
5 |
6 | #include "Buffer.h"
7 |
8 | class QuerySet {
9 | public:
10 | struct Query {
11 | int8_t matchedName;
12 | String name;
13 | uint16_t type;
14 | uint16_t cls;
15 | };
16 |
17 | bool readHeader(Buffer * buffer);
18 |
19 | bool isQuery();
20 |
21 | uint16_t getId();
22 | uint16_t getFlags();
23 | uint16_t getQueryCount();
24 | uint16_t getAnswerCount();
25 | uint16_t getAuthorityCount();
26 | uint16_t getAdditionalCount();
27 |
28 | bool addEntry(Query query);
29 |
30 | uint8_t getEntryCount();
31 |
32 | Query getQuery(uint8_t index);
33 |
34 | void setResponses(uint16_t responses);
35 |
36 | uint16_t getResponses();
37 |
38 | void setStatus(String status);
39 |
40 | String getStatus();
41 |
42 | ~QuerySet();
43 |
44 | private:
45 |
46 | uint16_t id;
47 | uint16_t flags;
48 | uint16_t qdcount;
49 | uint16_t ancount;
50 | uint16_t nscount;
51 | uint16_t arcount;
52 |
53 | uint8_t entryCount;
54 | Query * queries;
55 |
56 | uint16_t responses;
57 | String status = "ok";
58 | };
59 |
60 | #endif
61 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/src/TxtData.cpp:
--------------------------------------------------------------------------------
1 | #include "TxtData.h"
2 |
3 | bool TxtData::addEntry(String key, String value) {
4 | uint8_t * oldData = data;
5 | uint16_t oldSize = size;
6 |
7 | uint8_t addedSize = key.length() + value.length() + 2;
8 |
9 | size += addedSize;
10 |
11 | data = (uint8_t *) malloc(size);
12 |
13 | if (data) {
14 | if (oldData) {
15 | for (int i = 0; i < oldSize; i++) {
16 | data[i] = oldData[i];
17 | }
18 | }
19 | int idx = oldSize;
20 |
21 | data[idx++] = addedSize - 1;
22 |
23 | for (uint8_t i = 0; i < key.length(); i++) {
24 | data[idx++] = key.charAt(i);
25 | }
26 |
27 | data[idx++] = '=';
28 |
29 | for (uint8_t i = 0; i < value.length(); i++) {
30 | data[idx++] = value.charAt(i);
31 | }
32 | }
33 |
34 | if (oldData) {
35 | free(oldData);
36 | }
37 |
38 | return data != NULL;
39 | }
40 |
41 | void TxtData::write(Buffer * buffer) {
42 | buffer->writeUInt16(size);
43 | for (uint16_t i = 0; i < size; i++) {
44 | buffer->writeUInt8(data[i]);
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/src/TxtData.h:
--------------------------------------------------------------------------------
1 | #include "Arduino.h"
2 |
3 | #ifndef _INCL_TXTDATA
4 | #define _INCL_TXTDATA
5 |
6 | #include "Buffer.h"
7 |
8 | class TxtData {
9 | public:
10 | bool addEntry(String key, String value);
11 |
12 | void write(Buffer * buffer);
13 |
14 | private:
15 |
16 | uint8_t * data;
17 | uint16_t size = 0;
18 | };
19 |
20 | #endif
21 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/src/eddystone.h:
--------------------------------------------------------------------------------
1 | #ifndef _EDDYSTONE_H_
2 | #define _EDDYSTONE_H_
3 |
4 | //// Definition of data for the different Eddystone frame types.
5 | // Note that multi-byte Eddystone data is in Big-Endian format.
6 | // Frame type ids
7 | #define EDDYSTONE_FRAME_TYPE_UID 0x00
8 | #define EDDYSTONE_FRAME_TYPE_URL 0x10
9 | #define EDDYSTONE_FRAME_TYPE_TLM 0x20
10 | #define EDDYSTONE_FRAME_TYPE_EID 0x30
11 |
12 | // TLM version
13 | #define EDDYSTONE_TLM_VERSION 0x00
14 |
15 | #define EDDYSTONE_TXPWR -17
16 |
17 |
18 | // Arduino IDE has problems with enums passed as function parameters.
19 | // Interestingly, you cannot declare the enum type in the file
20 | // with a function having a parameter of this enum type. The workaround
21 | // is to out-source the enum declaration to a separate file (as this
22 | // one here).
23 | enum url_schemes {http_www_dot, https_www_dot, http, https};
24 |
25 |
26 |
27 | #endif
28 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/src/include/ArduinoJson.h:
--------------------------------------------------------------------------------
1 | // Copyright Benoit Blanchon 2014-2016
2 | // MIT License
3 | //
4 | // Arduino JSON library
5 | // https://github.com/bblanchon/ArduinoJson
6 | // If you like this project, please add a star!
7 |
8 | #include "ArduinoJson/DynamicJsonBuffer.hpp"
9 | #include "ArduinoJson/JsonArray.hpp"
10 | #include "ArduinoJson/JsonObject.hpp"
11 | #include "ArduinoJson/StaticJsonBuffer.hpp"
12 |
13 | using namespace ArduinoJson;
14 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/src/include/ArduinoJson/Arduino/String.hpp:
--------------------------------------------------------------------------------
1 | // Copyright Benoit Blanchon 2014-2016
2 | // MIT License
3 | //
4 | // Arduino JSON library
5 | // https://github.com/bblanchon/ArduinoJson
6 | // If you like this project, please add a star!
7 |
8 | #pragma once
9 |
10 | //#ifndef ARDUINO
11 |
12 | #include "spark_wiring_string.h"
13 | //typedef std::string String;
14 |
15 | //#else
16 |
17 | //#include
18 |
19 | //#endif
20 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/src/include/ArduinoJson/DynamicJsonBuffer.hpp:
--------------------------------------------------------------------------------
1 | // Copyright Benoit Blanchon 2014-2016
2 | // MIT License
3 | //
4 | // Arduino JSON library
5 | // https://github.com/bblanchon/ArduinoJson
6 | // If you like this project, please add a star!
7 |
8 | #pragma once
9 |
10 | #include "Internals/BlockJsonBuffer.hpp"
11 |
12 | namespace ArduinoJson {
13 | // Implements a JsonBuffer with dynamic memory allocation.
14 | // You are strongly encouraged to consider using StaticJsonBuffer which is much
15 | // more suitable for embedded systems.
16 | typedef Internals::BlockJsonBuffer
17 | DynamicJsonBuffer;
18 | }
19 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/src/include/ArduinoJson/Internals/Comments.hpp:
--------------------------------------------------------------------------------
1 | // Copyright Benoit Blanchon 2014-2016
2 | // MIT License
3 | //
4 | // Arduino JSON library
5 | // https://github.com/bblanchon/ArduinoJson
6 | // If you like this project, please add a star!
7 |
8 | #pragma once
9 |
10 | namespace ArduinoJson {
11 | namespace Internals {
12 | const char *skipSpacesAndComments(const char *ptr);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/src/include/ArduinoJson/Internals/DummyPrint.hpp:
--------------------------------------------------------------------------------
1 | // Copyright Benoit Blanchon 2014-2016
2 | // MIT License
3 | //
4 | // Arduino JSON library
5 | // https://github.com/bblanchon/ArduinoJson
6 | // If you like this project, please add a star!
7 |
8 | #pragma once
9 |
10 | #include "../Arduino/Print.hpp"
11 |
12 | namespace ArduinoJson {
13 | namespace Internals {
14 |
15 | // A dummy Print implementation used in JsonPrintable::measureLength()
16 | class DummyPrint : public Print {
17 | public:
18 | virtual size_t write(uint8_t) { return 1; }
19 | };
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/src/include/ArduinoJson/Internals/DynamicStringBuilder.hpp:
--------------------------------------------------------------------------------
1 | // Copyright Benoit Blanchon 2014-2016
2 | // MIT License
3 | //
4 | // Arduino JSON library
5 | // https://github.com/bblanchon/ArduinoJson
6 | // If you like this project, please add a star!
7 |
8 | #pragma once
9 |
10 | #include "../Arduino/Print.hpp"
11 | #include "../Arduino/String.hpp"
12 |
13 | namespace ArduinoJson {
14 | namespace Internals {
15 |
16 | // A Print implementation that allows to write in a String
17 | class DynamicStringBuilder : public Print {
18 | public:
19 | DynamicStringBuilder(String &str) : _str(str) {}
20 |
21 | virtual size_t write(uint8_t c) {
22 | // Need to cast to char, otherwise String will print a number (issue #120)
23 | _str += static_cast(c);
24 | return 1;
25 | }
26 |
27 | private:
28 | DynamicStringBuilder &operator=(const DynamicStringBuilder &);
29 |
30 | String &_str;
31 | };
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/src/include/ArduinoJson/Internals/Encoding.hpp:
--------------------------------------------------------------------------------
1 | // Copyright Benoit Blanchon 2014-2016
2 | // MIT License
3 | //
4 | // Arduino JSON library
5 | // https://github.com/bblanchon/ArduinoJson
6 | // If you like this project, please add a star!
7 |
8 | #pragma once
9 |
10 | #include "../Arduino/Print.hpp"
11 |
12 | namespace ArduinoJson {
13 | namespace Internals {
14 |
15 | class Encoding {
16 | public:
17 | // Optimized for code size on a 8-bit AVR
18 | static char escapeChar(char c) {
19 | const char *p = _escapeTable;
20 | while (p[0] && p[1] != c) {
21 | p += 2;
22 | }
23 | return p[0];
24 | }
25 |
26 | // Optimized for code size on a 8-bit AVR
27 | static char unescapeChar(char c) {
28 | const char *p = _escapeTable + 4;
29 | for (;;) {
30 | if (p[0] == '\0') return c;
31 | if (p[0] == c) return p[1];
32 | p += 2;
33 | }
34 | }
35 |
36 | private:
37 | static const char _escapeTable[];
38 | };
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/src/include/ArduinoJson/Internals/ForceInline.hpp:
--------------------------------------------------------------------------------
1 | // Copyright Benoit Blanchon 2014-2016
2 | // MIT License
3 | //
4 | // Arduino JSON library
5 | // https://github.com/bblanchon/ArduinoJson
6 | // If you like this project, please add a star!
7 |
8 | #pragma once
9 |
10 | #ifdef _MSC_VER
11 | #define FORCE_INLINE __forceinline
12 | #else
13 | #define FORCE_INLINE __attribute__((always_inline))
14 | #endif
15 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/src/include/ArduinoJson/Internals/IndentedPrint.hpp:
--------------------------------------------------------------------------------
1 | // Copyright Benoit Blanchon 2014-2016
2 | // MIT License
3 | //
4 | // Arduino JSON library
5 | // https://github.com/bblanchon/ArduinoJson
6 | // If you like this project, please add a star!
7 |
8 | #pragma once
9 |
10 | #include "../Arduino/Print.hpp"
11 |
12 | namespace ArduinoJson {
13 | namespace Internals {
14 |
15 | // Decorator on top of Print to allow indented output.
16 | // This class is used by JsonPrintable::prettyPrintTo() but can also be used
17 | // for your own purpose, like logging.
18 | class IndentedPrint : public Print {
19 | public:
20 | explicit IndentedPrint(Print &p) : sink(&p) {
21 | level = 0;
22 | tabSize = 2;
23 | isNewLine = true;
24 | }
25 |
26 | virtual size_t write(uint8_t);
27 |
28 | // Adds one level of indentation
29 | void indent() {
30 | if (level < MAX_LEVEL) level++;
31 | }
32 |
33 | // Removes one level of indentation
34 | void unindent() {
35 | if (level > 0) level--;
36 | }
37 |
38 | // Set the number of space printed for each level of indentation
39 | void setTabSize(uint8_t n) {
40 | if (n < MAX_TAB_SIZE) tabSize = n & MAX_TAB_SIZE;
41 | }
42 |
43 | private:
44 | Print *sink;
45 | uint8_t level : 4;
46 | uint8_t tabSize : 3;
47 | bool isNewLine : 1;
48 |
49 | size_t writeTabs();
50 |
51 | static const int MAX_LEVEL = 15; // because it's only 4 bits
52 | static const int MAX_TAB_SIZE = 7; // because it's only 3 bits
53 | };
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/src/include/ArduinoJson/Internals/JsonBufferAllocated.hpp:
--------------------------------------------------------------------------------
1 | // Copyright Benoit Blanchon 2014-2016
2 | // MIT License
3 | //
4 | // Arduino JSON library
5 | // https://github.com/bblanchon/ArduinoJson
6 | // If you like this project, please add a star!
7 |
8 | #pragma once
9 |
10 | #include "../JsonBuffer.hpp"
11 |
12 | namespace ArduinoJson {
13 | namespace Internals {
14 |
15 | class JsonBufferAllocated {
16 | public:
17 | void *operator new(size_t n, JsonBuffer *jsonBuffer) throw() {
18 | if (!jsonBuffer) return NULL;
19 | return jsonBuffer->alloc(n);
20 | }
21 |
22 | void operator delete(void *, JsonBuffer *) throw() {}
23 | };
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/src/include/ArduinoJson/Internals/JsonFloat.hpp:
--------------------------------------------------------------------------------
1 | // Copyright Benoit Blanchon 2014-2016
2 | // MIT License
3 | //
4 | // Arduino JSON library
5 | // https://github.com/bblanchon/ArduinoJson
6 | // If you like this project, please add a star!
7 |
8 | #pragma once
9 |
10 | #include "../Configuration.hpp"
11 |
12 | namespace ArduinoJson {
13 | namespace Internals {
14 |
15 | #if ARDUINOJSON_USE_DOUBLE
16 | typedef double JsonFloat;
17 | #else
18 | typedef float JsonFloat;
19 | #endif
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/src/include/ArduinoJson/Internals/JsonInteger.hpp:
--------------------------------------------------------------------------------
1 | // Copyright Benoit Blanchon 2014-2016
2 | // MIT License
3 | //
4 | // Arduino JSON library
5 | // https://github.com/bblanchon/ArduinoJson
6 | // If you like this project, please add a star!
7 |
8 | #pragma once
9 |
10 | #include "../Configuration.hpp"
11 |
12 | namespace ArduinoJson {
13 | namespace Internals {
14 |
15 | #if ARDUINOJSON_USE_LONG_LONG
16 | typedef long long JsonInteger;
17 | #elif ARDUINOJSON_USE_INT64
18 | typedef __int64 JsonInteger;
19 | #else
20 | typedef long JsonInteger;
21 | #endif
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/src/include/ArduinoJson/Internals/JsonParser.hpp:
--------------------------------------------------------------------------------
1 | // Copyright Benoit Blanchon 2014-2016
2 | // MIT License
3 | //
4 | // Arduino JSON library
5 | // https://github.com/bblanchon/ArduinoJson
6 | // If you like this project, please add a star!
7 |
8 | #pragma once
9 |
10 | #include "../JsonBuffer.hpp"
11 | #include "../JsonVariant.hpp"
12 |
13 | namespace ArduinoJson {
14 | namespace Internals {
15 |
16 | // Parse JSON string to create JsonArrays and JsonObjects
17 | // This internal class is not indended to be used directly.
18 | // Instead, use JsonBuffer.parseArray() or .parseObject()
19 | class JsonParser {
20 | public:
21 | JsonParser(JsonBuffer *buffer, char *json, uint8_t nestingLimit)
22 | : _buffer(buffer),
23 | _readPtr(json ? json : ""),
24 | _writePtr(json),
25 | _nestingLimit(nestingLimit) {}
26 |
27 | JsonArray &parseArray();
28 | JsonObject &parseObject();
29 |
30 | private:
31 | bool skip(char charToSkip);
32 |
33 | const char *parseString();
34 | bool parseAnythingTo(JsonVariant *destination);
35 | FORCE_INLINE bool parseAnythingToUnsafe(JsonVariant *destination);
36 |
37 | inline bool parseArrayTo(JsonVariant *destination);
38 | inline bool parseObjectTo(JsonVariant *destination);
39 | inline bool parseStringTo(JsonVariant *destination);
40 |
41 | JsonBuffer *_buffer;
42 | const char *_readPtr;
43 | char *_writePtr;
44 | uint8_t _nestingLimit;
45 | };
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/src/include/ArduinoJson/Internals/JsonVariantContent.hpp:
--------------------------------------------------------------------------------
1 | // Copyright Benoit Blanchon 2014-2016
2 | // MIT License
3 | //
4 | // Arduino JSON library
5 | // https://github.com/bblanchon/ArduinoJson
6 | // If you like this project, please add a star!
7 |
8 | #pragma once
9 |
10 | #include "JsonFloat.hpp"
11 | #include "JsonInteger.hpp"
12 |
13 | namespace ArduinoJson {
14 |
15 | // Forward declarations
16 | class JsonArray;
17 | class JsonObject;
18 |
19 | namespace Internals {
20 | // A union that defines the actual content of a JsonVariant.
21 | // The enum JsonVariantType determines which member is in use.
22 | union JsonVariantContent {
23 | JsonFloat asFloat; // used for double and float
24 | JsonInteger asInteger; // used for bool, char, short, int and longs
25 | const char* asString; // asString can be null
26 | JsonArray* asArray; // asArray cannot be null
27 | JsonObject* asObject; // asObject cannot be null
28 | };
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/src/include/ArduinoJson/Internals/JsonVariantType.hpp:
--------------------------------------------------------------------------------
1 | // Copyright Benoit Blanchon 2014-2016
2 | // MIT License
3 | //
4 | // Arduino JSON library
5 | // https://github.com/bblanchon/ArduinoJson
6 | // If you like this project, please add a star!
7 |
8 | #pragma once
9 |
10 | namespace ArduinoJson {
11 | class JsonArray;
12 | class JsonObject;
13 |
14 | namespace Internals {
15 |
16 | // Enumerated type to know the current type of a JsonVariant.
17 | // The value determines which member of JsonVariantContent is used.
18 | enum JsonVariantType {
19 | JSON_UNDEFINED, // the JsonVariant has not been initialized
20 | JSON_UNPARSED, // the JsonVariant contains an unparsed string
21 | JSON_STRING, // the JsonVariant stores a const char*
22 | JSON_BOOLEAN, // the JsonVariant stores a bool
23 | JSON_INTEGER, // the JsonVariant stores an integer
24 | JSON_ARRAY, // the JsonVariant stores a pointer to a JsonArray
25 | JSON_OBJECT, // the JsonVariant stores a pointer to a JsonObject
26 |
27 | // The following values are reserved for float values
28 | // Multiple values are used for double, depending on the number of decimal
29 | // digits that must be printed in the JSON output.
30 | // This little trick allow to save one extra member in JsonVariant
31 | JSON_FLOAT_0_DECIMALS
32 | // JSON_FLOAT_1_DECIMAL
33 | // JSON_FLOAT_2_DECIMALS
34 | // ...
35 | };
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/src/include/ArduinoJson/Internals/ListConstIterator.hpp:
--------------------------------------------------------------------------------
1 | // Copyright Benoit Blanchon 2014-2016
2 | // MIT License
3 | //
4 | // Arduino JSON library
5 | // https://github.com/bblanchon/ArduinoJson
6 | // If you like this project, please add a star!
7 |
8 | #pragma once
9 |
10 | #include "ListNode.hpp"
11 |
12 | namespace ArduinoJson {
13 | namespace Internals {
14 |
15 | // A read-only forward itertor for List
16 | template
17 | class ListConstIterator {
18 | public:
19 | explicit ListConstIterator(const ListNode *node = NULL) : _node(node) {}
20 |
21 | const T &operator*() const { return _node->content; }
22 | const T *operator->() { return &_node->content; }
23 |
24 | bool operator==(const ListConstIterator &other) const {
25 | return _node == other._node;
26 | }
27 |
28 | bool operator!=(const ListConstIterator &other) const {
29 | return _node != other._node;
30 | }
31 |
32 | ListConstIterator &operator++() {
33 | if (_node) _node = _node->next;
34 | return *this;
35 | }
36 |
37 | private:
38 | const ListNode *_node;
39 | };
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/src/include/ArduinoJson/Internals/ListIterator.hpp:
--------------------------------------------------------------------------------
1 | // Copyright Benoit Blanchon 2014-2016
2 | // MIT License
3 | //
4 | // Arduino JSON library
5 | // https://github.com/bblanchon/ArduinoJson
6 | // If you like this project, please add a star!
7 |
8 | #pragma once
9 |
10 | #include "ListNode.hpp"
11 | #include "ListConstIterator.hpp"
12 |
13 | namespace ArduinoJson {
14 | namespace Internals {
15 |
16 | // A read-write forward iterator for List
17 | template
18 | class ListIterator {
19 | public:
20 | explicit ListIterator(ListNode *node = NULL) : _node(node) {}
21 |
22 | T &operator*() const { return _node->content; }
23 | T *operator->() { return &_node->content; }
24 |
25 | bool operator==(const ListIterator &other) const {
26 | return _node == other._node;
27 | }
28 |
29 | bool operator!=(const ListIterator &other) const {
30 | return _node != other._node;
31 | }
32 |
33 | ListIterator &operator++() {
34 | if (_node) _node = _node->next;
35 | return *this;
36 | }
37 |
38 | operator ListConstIterator() const { return ListConstIterator(_node); }
39 |
40 | private:
41 | ListNode *_node;
42 | };
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/src/include/ArduinoJson/Internals/ListNode.hpp:
--------------------------------------------------------------------------------
1 | // Copyright Benoit Blanchon 2014-2016
2 | // MIT License
3 | //
4 | // Arduino JSON library
5 | // https://github.com/bblanchon/ArduinoJson
6 | // If you like this project, please add a star!
7 |
8 | #pragma once
9 |
10 | #include // for NULL
11 |
12 | #include "JsonBufferAllocated.hpp"
13 |
14 | namespace ArduinoJson {
15 | namespace Internals {
16 |
17 | // A node for a singly-linked list.
18 | // Used by List and its iterators.
19 | template
20 | struct ListNode : public Internals::JsonBufferAllocated {
21 | ListNode() : next(NULL) {}
22 |
23 | ListNode *next;
24 | T content;
25 | };
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/src/include/ArduinoJson/Internals/Parse.hpp:
--------------------------------------------------------------------------------
1 | // Copyright Benoit Blanchon 2014-2016
2 | // MIT License
3 | //
4 | // Arduino JSON library
5 | // https://github.com/bblanchon/ArduinoJson
6 | // If you like this project, please add a star!
7 |
8 | #pragma once
9 |
10 | #include
11 |
12 | namespace ArduinoJson {
13 | namespace Internals {
14 | template
15 | TFloat parse(const char *);
16 |
17 | template <>
18 | inline float parse(const char *s) {
19 | return static_cast(strtod(s, NULL));
20 | }
21 |
22 | template <>
23 | inline double parse(const char *s) {
24 | return strtod(s, NULL);
25 | }
26 |
27 | template <>
28 | inline long parse(const char *s) {
29 | return strtol(s, NULL, 10);
30 | }
31 |
32 | template <>
33 | inline int parse(const char *s) {
34 | return atoi(s);
35 | }
36 |
37 | #if ARDUINOJSON_USE_LONG_LONG
38 | template <>
39 | inline long long parse(const char *s) {
40 | return strtoll(s, NULL, 10);
41 | }
42 | #endif
43 |
44 | #if ARDUINOJSON_USE_INT64
45 | template <>
46 | inline __int64 parse<__int64>(const char *s) {
47 | return _strtoi64(s, NULL, 10);
48 | }
49 | #endif
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/src/include/ArduinoJson/Internals/Prettyfier.hpp:
--------------------------------------------------------------------------------
1 | // Copyright Benoit Blanchon 2014-2016
2 | // MIT License
3 | //
4 | // Arduino JSON library
5 | // https://github.com/bblanchon/ArduinoJson
6 | // If you like this project, please add a star!
7 |
8 | #pragma once
9 |
10 | #include "IndentedPrint.hpp"
11 |
12 | namespace ArduinoJson {
13 | namespace Internals {
14 |
15 | // Converts a compact JSON string into an indented one.
16 | class Prettyfier : public Print {
17 | public:
18 | explicit Prettyfier(IndentedPrint& p) : _sink(p) {
19 | _previousChar = 0;
20 | _inString = false;
21 | }
22 |
23 | virtual size_t write(uint8_t);
24 |
25 | private:
26 | Prettyfier& operator=(const Prettyfier&); // cannot be assigned
27 |
28 | bool inEmptyBlock() { return _previousChar == '{' || _previousChar == '['; }
29 |
30 | size_t handleStringChar(uint8_t);
31 | size_t handleMarkupChar(uint8_t);
32 |
33 | size_t handleBlockClose(uint8_t);
34 | size_t handleBlockOpen(uint8_t);
35 | size_t handleColon();
36 | size_t handleComma();
37 | size_t handleQuoteOpen();
38 | size_t handleNormalChar(uint8_t);
39 | size_t indentIfNeeded();
40 | size_t unindentIfNeeded();
41 |
42 | uint8_t _previousChar;
43 | IndentedPrint& _sink;
44 | bool _inString;
45 | };
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/src/include/ArduinoJson/Internals/ReferenceType.hpp:
--------------------------------------------------------------------------------
1 | // Copyright Benoit Blanchon 2014-2016
2 | // MIT License
3 | //
4 | // Arduino JSON library
5 | // https://github.com/bblanchon/ArduinoJson
6 | // If you like this project, please add a star!
7 |
8 | #pragma once
9 |
10 | namespace ArduinoJson {
11 | namespace Internals {
12 |
13 | // A type that is meant to be used by reference only (JsonArray and JsonObject)
14 | class ReferenceType {
15 | public:
16 | bool operator==(const ReferenceType& other) const {
17 | // two JsonArray are equal if they are the same instance
18 | // (we don't compare the content)
19 | return this == &other;
20 | }
21 |
22 | bool operator!=(const ReferenceType& other) const { return this != &other; }
23 |
24 | protected:
25 | ReferenceType() {}
26 |
27 | private:
28 | // copy constructor is private
29 | ReferenceType(const ReferenceType&);
30 |
31 | // copy operator is private
32 | ReferenceType& operator=(const ReferenceType&);
33 | };
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/src/include/ArduinoJson/Internals/StaticStringBuilder.hpp:
--------------------------------------------------------------------------------
1 | // Copyright Benoit Blanchon 2014-2016
2 | // MIT License
3 | //
4 | // Arduino JSON library
5 | // https://github.com/bblanchon/ArduinoJson
6 | // If you like this project, please add a star!
7 |
8 | #pragma once
9 |
10 | #include "../Arduino/Print.hpp"
11 |
12 | namespace ArduinoJson {
13 | namespace Internals {
14 |
15 | // A Print implementation that allows to write in a char[]
16 | class StaticStringBuilder : public Print {
17 | public:
18 | StaticStringBuilder(char *buf, size_t size)
19 | : buffer(buf), capacity(size - 1), length(0) {
20 | buffer[0] = '\0';
21 | }
22 |
23 | virtual size_t write(uint8_t c);
24 |
25 | private:
26 | char *buffer;
27 | size_t capacity;
28 | size_t length;
29 | };
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/src/include/ArduinoJson/Internals/StreamPrintAdapter.hpp:
--------------------------------------------------------------------------------
1 | // Copyright Benoit Blanchon 2014-2016
2 | // MIT License
3 | //
4 | // Arduino JSON library
5 | // https://github.com/bblanchon/ArduinoJson
6 | // If you like this project, please add a star!
7 |
8 | #pragma once
9 |
10 | #include "../Configuration.hpp"
11 |
12 | #if ARDUINOJSON_ENABLE_STD_STREAM
13 |
14 | #include "../Arduino/Print.hpp"
15 |
16 | #include
17 |
18 | namespace ArduinoJson {
19 | namespace Internals {
20 |
21 | class StreamPrintAdapter : public Print {
22 | public:
23 | explicit StreamPrintAdapter(std::ostream& os) : _os(os) {}
24 |
25 | virtual size_t write(uint8_t c) {
26 | _os << static_cast(c);
27 | return 1;
28 | }
29 |
30 | private:
31 | // cannot be assigned
32 | StreamPrintAdapter& operator=(const StreamPrintAdapter&);
33 |
34 | std::ostream& _os;
35 | };
36 | }
37 | }
38 |
39 | #endif // ARDUINOJSON_ENABLE_STD_STREAM
40 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/src/include/ArduinoJson/Internals/Unparsed.hpp:
--------------------------------------------------------------------------------
1 | // Copyright Benoit Blanchon 2014-2016
2 | // MIT License
3 | //
4 | // Arduino JSON library
5 | // https://github.com/bblanchon/ArduinoJson
6 | // If you like this project, please add a star!
7 |
8 | #pragma once
9 |
10 | namespace ArduinoJson {
11 | namespace Internals {
12 | class Unparsed {
13 | public:
14 | explicit Unparsed(const char* str) : _str(str) {}
15 | operator const char*() const { return _str; }
16 |
17 | private:
18 | const char* _str;
19 | };
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/src/include/ArduinoJson/JsonObjectKey.hpp:
--------------------------------------------------------------------------------
1 | // Copyright Benoit Blanchon 2014-2016
2 | // MIT License
3 | //
4 | // Arduino JSON library
5 | // https://github.com/bblanchon/ArduinoJson
6 | // If you like this project, please add a star!
7 |
8 | #pragma once
9 |
10 | #include "Arduino/String.hpp"
11 |
12 | namespace ArduinoJson {
13 |
14 | // Represents a key in a JsonObject
15 | class JsonObjectKey {
16 | public:
17 | JsonObjectKey(const char* key) : _value(key), _needs_copy(false) {}
18 | JsonObjectKey(const String& key) : _value(key.c_str()), _needs_copy(true) {}
19 |
20 | const char* c_str() const { return _value; }
21 | bool needs_copy() const { return _needs_copy; }
22 |
23 | private:
24 | const char* _value;
25 | bool _needs_copy;
26 | };
27 | }
28 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/src/include/ArduinoJson/JsonPair.hpp:
--------------------------------------------------------------------------------
1 | // Copyright Benoit Blanchon 2014-2016
2 | // MIT License
3 | //
4 | // Arduino JSON library
5 | // https://github.com/bblanchon/ArduinoJson
6 | // If you like this project, please add a star!
7 |
8 | #pragma once
9 |
10 | #include "JsonObjectKey.hpp"
11 | #include "JsonVariant.hpp"
12 |
13 | namespace ArduinoJson {
14 |
15 | // A key value pair for JsonObject.
16 | struct JsonPair {
17 | const char* key;
18 | JsonVariant value;
19 | };
20 | }
21 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/src/include/ArduinoJson/StaticJsonBuffer.hpp:
--------------------------------------------------------------------------------
1 | // Copyright Benoit Blanchon 2014-2016
2 | // MIT License
3 | //
4 | // Arduino JSON library
5 | // https://github.com/bblanchon/ArduinoJson
6 | // If you like this project, please add a star!
7 |
8 | #pragma once
9 |
10 | #include "JsonBuffer.hpp"
11 |
12 | namespace ArduinoJson {
13 |
14 | // Implements a JsonBuffer with fixed memory allocation.
15 | // The template paramenter CAPACITY specifies the capacity of the buffer in
16 | // bytes.
17 | template
18 | class StaticJsonBuffer : public JsonBuffer {
19 | public:
20 | explicit StaticJsonBuffer() : _size(0) {}
21 |
22 | size_t capacity() const { return CAPACITY; }
23 | size_t size() const { return _size; }
24 |
25 | virtual void* alloc(size_t bytes) {
26 | if (_size + bytes > CAPACITY) return NULL;
27 | void* p = &_buffer[_size];
28 | _size += round_size_up(bytes);
29 | return p;
30 | }
31 |
32 | private:
33 | uint8_t _buffer[CAPACITY];
34 | size_t _size;
35 | };
36 | }
37 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/src/include/ArduinoJson/TypeTraits/EnableIf.hpp:
--------------------------------------------------------------------------------
1 | // Copyright Benoit Blanchon 2014-2016
2 | // MIT License
3 | //
4 | // Arduino JSON library
5 | // https://github.com/bblanchon/ArduinoJson
6 | // If you like this project, please add a star!
7 |
8 | #pragma once
9 |
10 | namespace ArduinoJson {
11 | namespace TypeTraits {
12 |
13 | // A meta-function that return the type T if Condition is true.
14 | template
15 | struct EnableIf {};
16 |
17 | template
18 | struct EnableIf {
19 | typedef T type;
20 | };
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/src/include/ArduinoJson/TypeTraits/IsFloatingPoint.hpp:
--------------------------------------------------------------------------------
1 | // Copyright Benoit Blanchon 2014-2016
2 | // MIT License
3 | //
4 | // Arduino JSON library
5 | // https://github.com/bblanchon/ArduinoJson
6 | // If you like this project, please add a star!
7 |
8 | #pragma once
9 |
10 | #include "IsSame.hpp"
11 |
12 | namespace ArduinoJson {
13 | namespace TypeTraits {
14 |
15 | // A meta-function that returns true if T is a floating point type
16 | template
17 | struct IsFloatingPoint {
18 | static const bool value = IsSame::value || IsSame::value;
19 | };
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/src/include/ArduinoJson/TypeTraits/IsIntegral.hpp:
--------------------------------------------------------------------------------
1 | // Copyright Benoit Blanchon 2014-2016
2 | // MIT License
3 | //
4 | // Arduino JSON library
5 | // https://github.com/bblanchon/ArduinoJson
6 | // If you like this project, please add a star!
7 |
8 | #pragma once
9 |
10 | #include "../Configuration.hpp"
11 | #include "IsSame.hpp"
12 |
13 | #include
14 |
15 | namespace ArduinoJson {
16 | namespace TypeTraits {
17 |
18 | // A meta-function that returns true if T is an integral type.
19 | template
20 | struct IsIntegral {
21 | static const bool value = TypeTraits::IsSame::value ||
22 | TypeTraits::IsSame::value ||
23 | TypeTraits::IsSame::value ||
24 | TypeTraits::IsSame::value ||
25 | TypeTraits::IsSame::value ||
26 | TypeTraits::IsSame::value ||
27 | TypeTraits::IsSame::value ||
28 | TypeTraits::IsSame::value ||
29 | #if ARDUINOJSON_USE_LONG_LONG
30 | TypeTraits::IsSame::value ||
31 | TypeTraits::IsSame::value ||
32 | #endif
33 |
34 | #if ARDUINOJSON_USE_INT64
35 | TypeTraits::IsSame::value ||
36 | TypeTraits::IsSame::value ||
37 | #endif
38 | TypeTraits::IsSame::value;
39 | };
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/src/include/ArduinoJson/TypeTraits/IsReference.hpp:
--------------------------------------------------------------------------------
1 | // Copyright Benoit Blanchon 2014-2016
2 | // MIT License
3 | //
4 | // Arduino JSON library
5 | // https://github.com/bblanchon/ArduinoJson
6 | // If you like this project, please add a star!
7 |
8 | #pragma once
9 |
10 | namespace ArduinoJson {
11 | namespace TypeTraits {
12 |
13 | // A meta-function that returns true if T is a reference
14 | template
15 | struct IsReference {
16 | static const bool value = false;
17 | };
18 |
19 | template
20 | struct IsReference {
21 | static const bool value = true;
22 | };
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/src/include/ArduinoJson/TypeTraits/IsSame.hpp:
--------------------------------------------------------------------------------
1 | // Copyright Benoit Blanchon 2014-2016
2 | // MIT License
3 | //
4 | // Arduino JSON library
5 | // https://github.com/bblanchon/ArduinoJson
6 | // If you like this project, please add a star!
7 |
8 | #pragma once
9 |
10 | namespace ArduinoJson {
11 | namespace TypeTraits {
12 |
13 | // A meta-function that returns true if types T and U are the same.
14 | template
15 | struct IsSame {
16 | static const bool value = false;
17 | };
18 |
19 | template
20 | struct IsSame {
21 | static const bool value = true;
22 | };
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/src/include/ArduinoJson/TypeTraits/RemoveConst.hpp:
--------------------------------------------------------------------------------
1 | // Copyright Benoit Blanchon 2014-2016
2 | // MIT License
3 | //
4 | // Arduino JSON library
5 | // https://github.com/bblanchon/ArduinoJson
6 | // If you like this project, please add a star!
7 |
8 | #pragma once
9 |
10 | namespace ArduinoJson {
11 | namespace TypeTraits {
12 |
13 | // A meta-function that return the type T without the const modifier
14 | template
15 | struct RemoveConst {
16 | typedef T type;
17 | };
18 | template
19 | struct RemoveConst {
20 | typedef T type;
21 | };
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/src/include/ArduinoJson/TypeTraits/RemoveReference.hpp:
--------------------------------------------------------------------------------
1 | // Copyright Benoit Blanchon 2014-2016
2 | // MIT License
3 | //
4 | // Arduino JSON library
5 | // https://github.com/bblanchon/ArduinoJson
6 | // If you like this project, please add a star!
7 |
8 | #pragma once
9 |
10 | namespace ArduinoJson {
11 | namespace TypeTraits {
12 |
13 | // A meta-function that return the type T without the reference modifier.
14 | template
15 | struct RemoveReference {
16 | typedef T type;
17 | };
18 | template
19 | struct RemoveReference {
20 | typedef T type;
21 | };
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/src/library.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Json",
3 | "keywords": "json, rest, http, web",
4 | "description": "An elegant and efficient JSON library for embedded systems",
5 | "repository": {
6 | "type": "git",
7 | "url": "https://github.com/bblanchon/ArduinoJson.git"
8 | },
9 | "version": "5.1.1",
10 | "authors": {
11 | "name": "Benoit Blanchon",
12 | "url": "http://blog.benoitblanchon.fr"
13 | },
14 | "exclude": [
15 | "scripts",
16 | "src/ArduinoJson.h",
17 | "test",
18 | "third-party"
19 | ],
20 | "frameworks": "arduino",
21 | "platforms": "*"
22 | }
23 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/src/library.properties:
--------------------------------------------------------------------------------
1 | name=ArduinoJson
2 | version=5.1.1
3 | author=Benoit Blanchon
4 | maintainer=Benoit Blanchon
5 | sentence=An efficient and elegant JSON library for Arduino.
6 | paragraph=Like this project? Please star it on GitHub!
7 | category=Data Processing
8 | url=https://github.com/bblanchon/ArduinoJson
9 | architectures=*
10 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/src/src/ArduinoJson.h:
--------------------------------------------------------------------------------
1 | // Copyright Benoit Blanchon 2014-2016
2 | // MIT License
3 | //
4 | // Arduino JSON library
5 | // https://github.com/bblanchon/ArduinoJson
6 | // If you like this project, please add a star!
7 |
8 | // About this file
9 | // ---------------
10 | // This file is here to please the Arduino IDE. It must be present in the src/
11 | // for the IDE to find it. Feel free to ignore this file if your working in
12 | // another environment
13 |
14 | #include "../include/ArduinoJson.h"
15 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/src/src/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright Benoit Blanchon 2014-2016
2 | # MIT License
3 | #
4 | # Arduino JSON library
5 | # https://github.com/bblanchon/ArduinoJson
6 | # If you like this project, please add a star!
7 |
8 | file(GLOB_RECURSE HPP_FILES ../include/*.hpp)
9 | file(GLOB_RECURSE IPP_FILES ../include/*.ipp)
10 | file(GLOB_RECURSE CPP_FILES *.cpp)
11 |
12 | if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)")
13 | add_compile_options(
14 | -fno-exceptions
15 | -fno-rtti
16 | -pedantic
17 | -Wall
18 | -Wcast-align
19 | -Wcast-qual
20 | -Wconversion
21 | -Wctor-dtor-privacy
22 | -Wdisabled-optimization
23 | -Werror
24 | -Wextra
25 | -Wformat=2
26 | -Winit-self
27 | -Wmissing-include-dirs
28 | -Wno-parentheses
29 | -Wno-sign-conversion
30 | -Wno-unused
31 | -Wno-variadic-macros
32 | -Wnon-virtual-dtor
33 | -Wold-style-cast
34 | -Woverloaded-virtual
35 | -Wredundant-decls
36 | -Wshadow
37 | -Wsign-promo
38 | -Wstrict-overflow=5
39 | -Wundef
40 | )
41 | endif()
42 |
43 | if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
44 | add_compile_options(
45 | -Wstrict-null-sentinel
46 | )
47 |
48 | if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.5)
49 | add_compile_options(-Wlogical-op) # the flag exists in 4.4 but is buggy
50 | endif()
51 |
52 | if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.6)
53 | add_compile_options(-Wnoexcept)
54 | endif()
55 | endif()
56 |
57 | if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
58 | add_compile_options(
59 | -Wc++11-compat
60 | -Wdeprecated-register
61 | )
62 | endif()
63 |
64 | if(MSVC)
65 | add_definitions(-D_CRT_SECURE_NO_WARNINGS)
66 | add_compile_options(-W4)
67 | endif()
68 |
69 | add_library(ArduinoJson ${CPP_FILES} ${HPP_FILES} ${IPP_FILES})
70 |
71 | target_include_directories(ArduinoJson INTERFACE ${CMAKE_CURRENT_LIST_DIR}/../include)
72 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/src/src/Internals/Comments.cpp:
--------------------------------------------------------------------------------
1 | // Copyright Benoit Blanchon 2014-2016
2 | // MIT License
3 | //
4 | // Arduino JSON library
5 | // https://github.com/bblanchon/ArduinoJson
6 | // If you like this project, please add a star!
7 |
8 | #include "../../include/ArduinoJson/Internals/Comments.hpp"
9 |
10 | inline static const char *skipCStyleComment(const char *ptr) {
11 | ptr += 2;
12 | for (;;) {
13 | if (ptr[0] == '\0') return ptr;
14 | if (ptr[0] == '*' && ptr[1] == '/') return ptr + 2;
15 | ptr++;
16 | }
17 | }
18 |
19 | inline static const char *skipCppStyleComment(const char *ptr) {
20 | ptr += 2;
21 | for (;;) {
22 | if (ptr[0] == '\0' || ptr[0] == '\n') return ptr;
23 | ptr++;
24 | }
25 | }
26 |
27 | const char *ArduinoJson::Internals::skipSpacesAndComments(const char *ptr) {
28 | for (;;) {
29 | switch (ptr[0]) {
30 | case ' ':
31 | case '\t':
32 | case '\r':
33 | case '\n':
34 | ptr++;
35 | continue;
36 | case '/':
37 | switch (ptr[1]) {
38 | case '*':
39 | ptr = skipCStyleComment(ptr);
40 | break;
41 | case '/':
42 | ptr = skipCppStyleComment(ptr);
43 | break;
44 | default:
45 | return ptr;
46 | }
47 | break;
48 | default:
49 | return ptr;
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/src/src/Internals/Encoding.cpp:
--------------------------------------------------------------------------------
1 | // Copyright Benoit Blanchon 2014-2016
2 | // MIT License
3 | //
4 | // Arduino JSON library
5 | // https://github.com/bblanchon/ArduinoJson
6 | // If you like this project, please add a star!
7 |
8 | #include "../../include/ArduinoJson/Internals/Encoding.hpp"
9 |
10 | // How to escape special chars:
11 | // _escapeTable[2*i+1] => the special char
12 | // _escapeTable[2*i] => the char to use instead
13 | const char ArduinoJson::Internals::Encoding::_escapeTable[] =
14 | "\"\"\\\\b\bf\fn\nr\rt\t";
15 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/src/src/Internals/IndentedPrint.cpp:
--------------------------------------------------------------------------------
1 | // Copyright Benoit Blanchon 2014-2016
2 | // MIT License
3 | //
4 | // Arduino JSON library
5 | // https://github.com/bblanchon/ArduinoJson
6 | // If you like this project, please add a star!
7 |
8 | #include "../../include/ArduinoJson/Internals/IndentedPrint.hpp"
9 |
10 | using namespace ArduinoJson::Internals;
11 |
12 | size_t IndentedPrint::write(uint8_t c) {
13 | size_t n = 0;
14 |
15 | if (isNewLine) n += writeTabs();
16 |
17 | n += sink->write(c);
18 |
19 | isNewLine = c == '\n';
20 |
21 | return n;
22 | }
23 |
24 | inline size_t IndentedPrint::writeTabs() {
25 | size_t n = 0;
26 |
27 | for (int i = 0; i < level * tabSize; i++) n += sink->write(' ');
28 |
29 | return n;
30 | }
31 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/src/src/Internals/List.cpp:
--------------------------------------------------------------------------------
1 | // Copyright Benoit Blanchon 2014-2016
2 | // MIT License
3 | //
4 | // Arduino JSON library
5 | // https://github.com/bblanchon/ArduinoJson
6 | // If you like this project, please add a star!
7 |
8 | #include "../../include/ArduinoJson/Internals/List.hpp"
9 |
10 | #include "../../include/ArduinoJson/JsonPair.hpp"
11 | #include "../../include/ArduinoJson/JsonVariant.hpp"
12 |
13 | using namespace ArduinoJson;
14 | using namespace ArduinoJson::Internals;
15 |
16 | template
17 | size_t List::size() const {
18 | size_t nodeCount = 0;
19 | for (node_type *node = _firstNode; node; node = node->next) nodeCount++;
20 | return nodeCount;
21 | }
22 |
23 | template
24 | typename List::node_type *List::addNewNode() {
25 | node_type *newNode = new (_buffer) node_type();
26 |
27 | if (_firstNode) {
28 | node_type *lastNode = _firstNode;
29 | while (lastNode->next) lastNode = lastNode->next;
30 | lastNode->next = newNode;
31 | } else {
32 | _firstNode = newNode;
33 | }
34 |
35 | return newNode;
36 | }
37 |
38 | template
39 | void List::removeNode(node_type *nodeToRemove) {
40 | if (!nodeToRemove) return;
41 | if (nodeToRemove == _firstNode) {
42 | _firstNode = nodeToRemove->next;
43 | } else {
44 | for (node_type *node = _firstNode; node; node = node->next)
45 | if (node->next == nodeToRemove) node->next = nodeToRemove->next;
46 | }
47 | }
48 |
49 | template class ArduinoJson::Internals::List;
50 | template class ArduinoJson::Internals::List;
51 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/src/src/Internals/StaticStringBuilder.cpp:
--------------------------------------------------------------------------------
1 | // Copyright Benoit Blanchon 2014-2016
2 | // MIT License
3 | //
4 | // Arduino JSON library
5 | // https://github.com/bblanchon/ArduinoJson
6 | // If you like this project, please add a star!
7 |
8 | #include "../../include/ArduinoJson/Internals/StaticStringBuilder.hpp"
9 |
10 | using namespace ArduinoJson::Internals;
11 |
12 | size_t StaticStringBuilder::write(uint8_t c) {
13 | if (length >= capacity) return 0;
14 |
15 | buffer[length++] = c;
16 | buffer[length] = '\0';
17 | return 1;
18 | }
19 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/src/src/JsonArray.cpp:
--------------------------------------------------------------------------------
1 | // Copyright Benoit Blanchon 2014-2016
2 | // MIT License
3 | //
4 | // Arduino JSON library
5 | // https://github.com/bblanchon/ArduinoJson
6 | // If you like this project, please add a star!
7 |
8 | #include "../include/ArduinoJson/JsonArray.hpp"
9 |
10 | #include "../include/ArduinoJson/JsonBuffer.hpp"
11 | #include "../include/ArduinoJson/JsonObject.hpp"
12 |
13 | using namespace ArduinoJson;
14 | using namespace ArduinoJson::Internals;
15 |
16 | JsonArray JsonArray::_invalid(NULL);
17 |
18 | JsonArray::node_type *JsonArray::getNodeAt(size_t index) const {
19 | node_type *node = _firstNode;
20 | while (node && index--) node = node->next;
21 | return node;
22 | }
23 |
24 | void JsonArray::removeAt(size_t index) { removeNode(getNodeAt(index)); }
25 |
26 | void JsonArray::writeTo(JsonWriter &writer) const {
27 | writer.beginArray();
28 |
29 | const node_type *child = _firstNode;
30 | while (child) {
31 | child->content.writeTo(writer);
32 |
33 | child = child->next;
34 | if (!child) break;
35 |
36 | writer.writeComma();
37 | }
38 |
39 | writer.endArray();
40 | }
41 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/src/src/JsonBuffer.cpp:
--------------------------------------------------------------------------------
1 | // Copyright Benoit Blanchon 2014-2016
2 | // MIT License
3 | //
4 | // Arduino JSON library
5 | // https://github.com/bblanchon/ArduinoJson
6 | // If you like this project, please add a star!
7 |
8 | #include "../include/ArduinoJson/JsonBuffer.hpp"
9 |
10 | #include "../include/ArduinoJson/Internals/JsonParser.hpp"
11 | #include "../include/ArduinoJson/JsonArray.hpp"
12 | #include "../include/ArduinoJson/JsonObject.hpp"
13 |
14 | using namespace ArduinoJson;
15 | using namespace ArduinoJson::Internals;
16 |
17 | JsonArray &JsonBuffer::createArray() {
18 | JsonArray *ptr = new (this) JsonArray(this);
19 | return ptr ? *ptr : JsonArray::invalid();
20 | }
21 |
22 | JsonObject &JsonBuffer::createObject() {
23 | JsonObject *ptr = new (this) JsonObject(this);
24 | return ptr ? *ptr : JsonObject::invalid();
25 | }
26 |
27 | JsonArray &JsonBuffer::parseArray(char *json, uint8_t nestingLimit) {
28 | JsonParser parser(this, json, nestingLimit);
29 | return parser.parseArray();
30 | }
31 |
32 | JsonObject &JsonBuffer::parseObject(char *json, uint8_t nestingLimit) {
33 | JsonParser parser(this, json, nestingLimit);
34 | return parser.parseObject();
35 | }
36 |
37 | char *JsonBuffer::strdup(const char *source, size_t length) {
38 | size_t size = length + 1;
39 | char *dest = static_cast(alloc(size));
40 | if (dest != NULL) memcpy(dest, source, size);
41 | return dest;
42 | }
43 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/src/src/JsonObject.cpp:
--------------------------------------------------------------------------------
1 | // Copyright Benoit Blanchon 2014-2016
2 | // MIT License
3 | //
4 | // Arduino JSON library
5 | // https://github.com/bblanchon/ArduinoJson
6 | // If you like this project, please add a star!
7 |
8 | #include "../include/ArduinoJson/JsonObject.hpp"
9 |
10 | #include // for strcmp
11 |
12 | #include "../include/ArduinoJson/Internals/StaticStringBuilder.hpp"
13 | #include "../include/ArduinoJson/JsonArray.hpp"
14 | #include "../include/ArduinoJson/JsonBuffer.hpp"
15 |
16 | using namespace ArduinoJson;
17 | using namespace ArduinoJson::Internals;
18 |
19 | JsonObject JsonObject::_invalid(NULL);
20 |
21 | JsonObject::node_type *JsonObject::getNodeAt(const char *key) const {
22 | for (node_type *node = _firstNode; node; node = node->next) {
23 | if (!strcmp(node->content.key, key)) return node;
24 | }
25 | return NULL;
26 | }
27 |
28 | void JsonObject::writeTo(JsonWriter &writer) const {
29 | writer.beginObject();
30 |
31 | const node_type *node = _firstNode;
32 | while (node) {
33 | writer.writeString(node->content.key);
34 | writer.writeColon();
35 | node->content.value.writeTo(writer);
36 |
37 | node = node->next;
38 | if (!node) break;
39 |
40 | writer.writeComma();
41 | }
42 |
43 | writer.endObject();
44 | }
45 |
--------------------------------------------------------------------------------
/arduino/libraries/RedBear_Duo/src/stringbuffer.h:
--------------------------------------------------------------------------------
1 | /*
2 | * aJson
3 | * stringbuffer.h
4 | *
5 | * http://interactive-matter.org/
6 | *
7 | * This file is part of aJson.
8 | *
9 | * aJson is free software: you can redistribute it and/or modify
10 | * it under the terms of the GNU General Public License as published by
11 | * the Free Software Foundation, either version 3 of the License, or
12 | * (at your option) any later version.
13 | *
14 | * aJson is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU General Public License for more details.
18 | * You should have received a copy of the GNU General Public License
19 | * along with aJson. If not, see .
20 | *
21 | * Created on: 14.10.2010
22 | * Author: marcus
23 | */
24 |
25 | #ifndef STRINGBUFFER_H_
26 | #define STRINGBUFFER_H_
27 |
28 | typedef struct
29 | {
30 | char* string;
31 | unsigned int memory;
32 | unsigned int string_length;
33 | } string_buffer;
34 |
35 | #ifdef __cplusplus
36 | extern "C"
37 | {
38 | #endif
39 |
40 | string_buffer*
41 | stringBufferCreate(void);
42 |
43 | char
44 | stringBufferAdd(char value, string_buffer* buffer);
45 |
46 | char*
47 | stringBufferToString(string_buffer* buffer);
48 |
49 | void
50 | stringBufferFree(string_buffer* buffer);
51 |
52 | #ifdef __cplusplus
53 | }
54 | #endif
55 | #endif /* STRINGBUFFER_H_ */
56 |
--------------------------------------------------------------------------------
/arduino/programmers.txt:
--------------------------------------------------------------------------------
1 | dfu_util.name=Duo FW Uploader
2 | dfu_util.name.communication=USB
3 | dfu_util.name.protocol=
4 | dfu_util.name.program.protocol=
5 | dfu_util.program.tool=fw_loader
6 | dfu_util.program.extra_params=
7 |
8 | rblink.name=RBLink
9 | rblink.name.communication=USB
10 | rblink.name.protocol=
11 | rblink.name.program.protocol=
12 | rblink.program.tool=openocd
13 | rblink.program.extra_params=
14 |
--------------------------------------------------------------------------------
/arduino/tools/crc32/linux/crc32.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # This tool is for creating user firmware with CRC
4 |
5 | # Path of arm-none-eabi
6 | arm_gcc_path=$3
7 | #echo ${arm_gcc_path}
8 |
9 | if [ -s $1 ]; then \
10 |
11 | head -c $((`stat -c %s $1` - 38)) $1 > $1.no_crc && \
12 |
13 | tail -c 38 $1 > $1.crc_block && \
14 |
15 | test "0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20280078563412" = `xxd -p -c 500 $1.crc_block` && \
16 |
17 | shasum -a 256 $1.no_crc | cut -c 1-65 | xxd -r -p | dd bs=1 of=$1 seek=$((`stat -c %s $1` - 38)) conv=notrunc && \
18 |
19 | head -c $((`stat -c %s $1` - 4)) $1 > $1.no_crc && \
20 |
21 | crc32 $1.no_crc | cut -c 1-10 | xxd -r -p | dd bs=1 of=$1 seek=$((`stat -c %s $1` - 4)) conv=notrunc ;\
22 |
23 | fi
24 |
25 | # Generate hex file.
26 | ${arm_gcc_path}/arm-none-eabi-objcopy -O ihex -I binary $1 $1.hex
27 |
28 |
--------------------------------------------------------------------------------
/arduino/tools/crc32/linux/sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | pwd
4 |
5 | $3/crc32.sh $2 $3 $4
6 |
7 |
--------------------------------------------------------------------------------
/arduino/tools/crc32/macosx/crc32.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # This tool is for creating user firmware with CRC
4 |
5 | # Path of arm-none-eabi
6 | arm_gcc_path=$3
7 | #echo ${arm_gcc_path}
8 |
9 |
10 |
11 | if [ -s $1 ]; then \
12 |
13 | head -c $((`stat -f%z $1` - 38)) $1 > $1.no_crc && \
14 |
15 | tail -c 38 $1 > $1.crc_block && \
16 |
17 | test "0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20280078563412" = `xxd -p -c 500 $1.crc_block` && \
18 |
19 | shasum -a 256 $1.no_crc | cut -c 1-65 | xxd -r -p | dd bs=1 of=$1 seek=$((`stat -f%z $1` - 38)) conv=notrunc && \
20 |
21 | head -c $((`stat -f%z $1` - 4)) $1 > $1.no_crc && \
22 |
23 | crc32 $1.no_crc | cut -c 1-10 | xxd -r -p | dd bs=1 of=$1 seek=$((`stat -f%z $1` - 4)) conv=notrunc ;\
24 |
25 | fi
26 |
27 | # Generate hex file.
28 | ${arm_gcc_path}/arm-none-eabi-objcopy -O ihex -I binary $1 $1.hex
29 |
--------------------------------------------------------------------------------
/arduino/tools/crc32/macosx/sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | pwd
4 |
5 | $3/crc32.sh $2 $3 $4
6 |
7 |
--------------------------------------------------------------------------------
/arduino/tools/crc32/windows/bash.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/redbear/STM32-Arduino/b35fb3de95ba4faee41026cb38d0cc18e53ff84f/arduino/tools/crc32/windows/bash.exe
--------------------------------------------------------------------------------
/arduino/tools/crc32/windows/crc32.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/redbear/STM32-Arduino/b35fb3de95ba4faee41026cb38d0cc18e53ff84f/arduino/tools/crc32/windows/crc32.exe
--------------------------------------------------------------------------------
/arduino/tools/crc32/windows/crc32.sh:
--------------------------------------------------------------------------------
1 | #!bash
2 |
3 | # This tool is for creating user firmware with CRC
4 |
5 | pwd
6 |
7 | # Path of crc related commands.
8 | comand_path=$2
9 | #echo ${comand_path}
10 |
11 | # Path of arm-none-eabi.
12 | gcc_path=$3
13 | echo ${gcc_path}
14 |
15 | # Jump to the path of crc commands.
16 | cd "${comand_path}"
17 |
18 | # Calculate CRC32.
19 | if [ -s $1 ]; then \
20 | ./head -c $((`./stat --print %s $1` - 38)) $1 > $1.no_crc && \
21 | ./tail -c 38 $1 > $1.crc_block && \
22 | ./test "0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20280078563412" = `./xxd -p -c 500 $1.crc_block` && \
23 | ./sha256sum $1.no_crc | ./cut -c 1-65 | ./xxd -r -p | ./dd bs=1 of=$1 seek=$((`./stat --print %s $1` - 38)) conv=notrunc && \
24 | ./head -c $((`./stat --print %s $1` - 4)) $1 > $1.no_crc && \
25 | ./crc32 $1.no_crc | ./cut -c 3-10 | ./xxd -r -p | ./dd bs=1 of=$1 seek=$((`./stat --print %s $1` - 4)) conv=notrunc ;\
26 | fi
27 |
28 | # Generate hex file.
29 | "${gcc_path}/arm-none-eabi-objcopy" -O ihex -I binary $1 $1.hex
--------------------------------------------------------------------------------
/arduino/tools/crc32/windows/cut.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/redbear/STM32-Arduino/b35fb3de95ba4faee41026cb38d0cc18e53ff84f/arduino/tools/crc32/windows/cut.exe
--------------------------------------------------------------------------------
/arduino/tools/crc32/windows/dd.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/redbear/STM32-Arduino/b35fb3de95ba4faee41026cb38d0cc18e53ff84f/arduino/tools/crc32/windows/dd.exe
--------------------------------------------------------------------------------
/arduino/tools/crc32/windows/head.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/redbear/STM32-Arduino/b35fb3de95ba4faee41026cb38d0cc18e53ff84f/arduino/tools/crc32/windows/head.exe
--------------------------------------------------------------------------------
/arduino/tools/crc32/windows/msys-1.0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/redbear/STM32-Arduino/b35fb3de95ba4faee41026cb38d0cc18e53ff84f/arduino/tools/crc32/windows/msys-1.0.dll
--------------------------------------------------------------------------------
/arduino/tools/crc32/windows/msys-iconv-2.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/redbear/STM32-Arduino/b35fb3de95ba4faee41026cb38d0cc18e53ff84f/arduino/tools/crc32/windows/msys-iconv-2.dll
--------------------------------------------------------------------------------
/arduino/tools/crc32/windows/msys-intl-8.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/redbear/STM32-Arduino/b35fb3de95ba4faee41026cb38d0cc18e53ff84f/arduino/tools/crc32/windows/msys-intl-8.dll
--------------------------------------------------------------------------------
/arduino/tools/crc32/windows/msys-regex-1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/redbear/STM32-Arduino/b35fb3de95ba4faee41026cb38d0cc18e53ff84f/arduino/tools/crc32/windows/msys-regex-1.dll
--------------------------------------------------------------------------------
/arduino/tools/crc32/windows/msys-termcap-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/redbear/STM32-Arduino/b35fb3de95ba4faee41026cb38d0cc18e53ff84f/arduino/tools/crc32/windows/msys-termcap-0.dll
--------------------------------------------------------------------------------
/arduino/tools/crc32/windows/sh.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/redbear/STM32-Arduino/b35fb3de95ba4faee41026cb38d0cc18e53ff84f/arduino/tools/crc32/windows/sh.exe
--------------------------------------------------------------------------------
/arduino/tools/crc32/windows/sha256sum.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/redbear/STM32-Arduino/b35fb3de95ba4faee41026cb38d0cc18e53ff84f/arduino/tools/crc32/windows/sha256sum.exe
--------------------------------------------------------------------------------
/arduino/tools/crc32/windows/stat.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/redbear/STM32-Arduino/b35fb3de95ba4faee41026cb38d0cc18e53ff84f/arduino/tools/crc32/windows/stat.exe
--------------------------------------------------------------------------------
/arduino/tools/crc32/windows/tail.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/redbear/STM32-Arduino/b35fb3de95ba4faee41026cb38d0cc18e53ff84f/arduino/tools/crc32/windows/tail.exe
--------------------------------------------------------------------------------
/arduino/tools/crc32/windows/test.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/redbear/STM32-Arduino/b35fb3de95ba4faee41026cb38d0cc18e53ff84f/arduino/tools/crc32/windows/test.exe
--------------------------------------------------------------------------------
/arduino/tools/crc32/windows/xxd.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/redbear/STM32-Arduino/b35fb3de95ba4faee41026cb38d0cc18e53ff84f/arduino/tools/crc32/windows/xxd.exe
--------------------------------------------------------------------------------
/arduino/tools/fw_loader/linux/dfu-util:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/redbear/STM32-Arduino/b35fb3de95ba4faee41026cb38d0cc18e53ff84f/arduino/tools/fw_loader/linux/dfu-util
--------------------------------------------------------------------------------
/arduino/tools/fw_loader/linux/fw-load:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | #
4 | # System firmware update script for the RedBear Duo
5 | #
6 |
7 | # Update System-Part1
8 |
9 | $1 -d 2b04:d058 -a 0 -s 0x08020000 -D $2/duo-system-part1-v0.3.3.bin
10 |
11 | # Update System-Part2
12 |
13 | $1 -d 2b04:d058 -a 0 -s 0x08040000 -D $2/duo-system-part2-v0.3.3.bin
14 |
15 | # Update User-Part
16 |
17 | $1 -d 2b04:d058 -a 0 -s 0x080C0000 -D $2/duo-user-part.bin
18 |
19 | # Update Factory Reset Part
20 |
21 | $1 -d 2b04:d058 -a 2 -s 0x140000 -D $2/duo-factory-reset.bin
22 |
23 | # Update Wi-Fi firmware and exit DFU mode
24 |
25 | $1 -d 2b04:d058 -a 2 -s 0x180000:leave -D $2/duo-wifi-r2.bin
26 |
--------------------------------------------------------------------------------
/arduino/tools/fw_loader/macosx/dfu-util:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/redbear/STM32-Arduino/b35fb3de95ba4faee41026cb38d0cc18e53ff84f/arduino/tools/fw_loader/macosx/dfu-util
--------------------------------------------------------------------------------
/arduino/tools/fw_loader/macosx/fw-load:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | #
4 | # System firmware update script for the RedBear Duo
5 | #
6 |
7 | # Update System-Part1
8 |
9 | $1 -d 2b04:d058 -a 0 -s 0x08020000 -D $2/duo-system-part1-v0.3.3.bin
10 |
11 | # Update System-Part2
12 |
13 | $1 -d 2b04:d058 -a 0 -s 0x08040000 -D $2/duo-system-part2-v0.3.3.bin
14 |
15 | # Update User-Part
16 |
17 | $1 -d 2b04:d058 -a 0 -s 0x080C0000 -D $2/duo-user-part.bin
18 |
19 | # Update Factory Reset Part
20 |
21 | $1 -d 2b04:d058 -a 2 -s 0x140000 -D $2/duo-factory-reset.bin
22 |
23 | # Update Wi-Fi firmware and exit DFU mode
24 |
25 | $1 -d 2b04:d058 -a 2 -s 0x180000:leave -D $2/duo-wifi-r2.bin
26 |
--------------------------------------------------------------------------------
/arduino/tools/fw_loader/windows/dfu-util.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/redbear/STM32-Arduino/b35fb3de95ba4faee41026cb38d0cc18e53ff84f/arduino/tools/fw_loader/windows/dfu-util.exe
--------------------------------------------------------------------------------
/arduino/tools/fw_loader/windows/fw-load.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 |
3 | rem System firmware update script for the RedBear Duo
4 |
5 | rem Update System-Part1
6 | %1 -d 2b04:d058 -a 0 -s 0x08020000 -D %2/duo-system-part1-v0.3.3.bin
7 |
8 | rem Update System-Part2
9 | %1 -d 2b04:d058 -a 0 -s 0x08040000 -D %2/duo-system-part2-v0.3.3.bin
10 |
11 | rem Update User-Part
12 | %1 -d 2b04:d058 -a 0 -s 0x080C0000 -D %2/duo-user-part.bin
13 |
14 | rem Update Factory Reset Part and exit DFU mode
15 | %1 -d 2b04:d058 -a 2 -s 0x140000 -D %2/duo-factory-reset.bin
16 |
17 | rem Update Wi-Fi firmware
18 | %1 -d 2b04:d058 -a 2 -s 0x180000:leave -D %2/duo-wifi-r2.bin
19 |
--------------------------------------------------------------------------------
/arduino/variants/RedBear_Duo/linker_scripts/gcc/duo/system-part1/module_system_part1_export.ld:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * The end of the statically allocated region.
4 | * This is much more than we need but ensures the RAM vtor table in part2 is
5 | * 512-byte aligned.
6 | */
7 | system_part1_module_ram_end = 0x20000300;
8 |
9 | INCLUDE "../../shared/stm32f2xx/part1_vtor_module.ld"
10 |
11 | /**
12 | * The dyanmic libraries exported by this module.
13 | */
14 | PROVIDE ( dynalib_location_communication = system_part1_module_table + 0 );
15 | PROVIDE ( dynalib_location_wifi_resource = system_part1_module_table + 4 );
16 | PROVIDE ( dynalib_location_system_module_part1 = system_part1_module_table + 8 );
17 | PROVIDE ( dynalib_location_services = system_part1_module_table + 12 );
18 | PROVIDE ( dynalib_location_crypto = system_part1_module_table + 16 );
19 |
20 |
--------------------------------------------------------------------------------
/arduino/variants/RedBear_Duo/linker_scripts/gcc/duo/user-part/linker.ld:
--------------------------------------------------------------------------------
1 |
2 | MEMORY
3 | {
4 | APP_FLASH (rx) : ORIGIN = 0x080C0000, LENGTH = 256K
5 | SRAM (rwx) : ORIGIN = 0x20000300, LENGTH = 0x20000 - 0x300 - 58K
6 | INCLUDE backup_ram_memory.ld
7 | }
8 |
9 | INCLUDE module_system_part1_export.ld
10 | INCLUDE module_system_part2_export.ld
11 |
12 | INCLUDE ../../shared/stm32f2xx/user.ld
13 |
--------------------------------------------------------------------------------
/arduino/variants/RedBear_Duo/linker_scripts/gcc/duo/user-part/module_user_export.ld:
--------------------------------------------------------------------------------
1 |
2 | /* location of the module_info block */
3 | user_module_info = 0x80C0000 ;
4 |
5 | /**
6 | * End of the module info block.
7 | */
8 | user_module_info_end = user_module_info + 24 ;
9 |
10 | user_module_table = user_module_info_end ;
11 |
12 | PROVIDE ( dynalib_location_user = user_module_table + 0 );
13 |
14 |
--------------------------------------------------------------------------------
/arduino/variants/RedBear_Duo/linker_scripts/gcc/shared/stm32f2xx/part1_vtor_module.ld:
--------------------------------------------------------------------------------
1 | /**
2 | * Symbols that define the location of the VTOR table and the module info
3 | */
4 |
5 | /**
6 | * The load address of the part1 module image
7 | */
8 | system_part1_start = 0x8020000;
9 |
10 | system_part1_boot_table_size = 0x184;
11 |
12 | system_part1_module_info_size = 24;
13 |
14 | system_part1_boot_table_start = system_part1_start;
15 |
16 | system_part1_module_info_start = system_part1_start + system_part1_boot_table_size;
17 |
18 | system_part1_module_info_end = system_part1_module_info_start + system_part1_module_info_size;
19 |
20 | /**
21 | * The location of the module export table.
22 | */
23 | system_part1_module_table = system_part1_module_info_end;
24 |
--------------------------------------------------------------------------------
/arduino/variants/RedBear_Duo/linker_scripts/linker/linker_newhalcpu.ld:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/redbear/STM32-Arduino/b35fb3de95ba4faee41026cb38d0cc18e53ff84f/arduino/variants/RedBear_Duo/linker_scripts/linker/linker_newhalcpu.ld
--------------------------------------------------------------------------------
/arduino/variants/RedBear_Duo/linker_scripts/linker/linker_stm32f10x_hd.ld:
--------------------------------------------------------------------------------
1 | /*
2 | *****************************************************************************
3 | **
4 | ** File : linker_stm32f10x_md.ld
5 | **
6 | ** Abstract : Linker script for STM32F103CB Device with
7 | ** 256KByte FLASH, 20KByte RAM
8 | **
9 | ** Set heap size, stack size and stack location according
10 | ** to application requirements.
11 | **
12 | ** Set memory bank area and size if external memory is used.
13 | **
14 | ** Target : STMicroelectronics STM32
15 | **
16 | ** Environment : Eclipse-CDT and GNU Tools ARM Embedded.
17 | **
18 | *****************************************************************************
19 | */
20 |
21 | MEMORY
22 | {
23 | RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 20K
24 | APP_FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 256K
25 | }
26 |
27 | INCLUDE linker_stm32f10x_common.ld
28 |
--------------------------------------------------------------------------------
/arduino/variants/RedBear_Duo/linker_scripts/linker/linker_stm32f10x_hd_dfu.ld:
--------------------------------------------------------------------------------
1 | /*
2 | *****************************************************************************
3 | **
4 | ** File : linker_stm32f10x_hd_dfu.ld
5 | **
6 | ** Abstract : Linker script for stm32F103RC Device with
7 | ** 256KByte FLASH, 48KByte RAM
8 | **
9 | ** Set heap size, stack size and stack location according
10 | ** to application requirements.
11 | **
12 | ** Set memory bank area and size if external memory is used.
13 | **
14 | ** Target : STMicroelectronics STM32
15 | **
16 | ** Environment : Eclipse-CDT and GNU Tools ARM Embedded.
17 | **
18 | *****************************************************************************
19 | */
20 |
21 |
22 | MEMORY
23 | {
24 | RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 20K
25 | APP_FLASH (rx) : ORIGIN = 0x08005000, LENGTH = 256K-0x5000
26 | }
27 |
28 | INCLUDE linker_stm32f10x_common.ld
29 |
--------------------------------------------------------------------------------
/arduino/variants/RedBear_Duo/linker_scripts/linker/linker_stm32f10x_md.ld:
--------------------------------------------------------------------------------
1 | /*
2 | *****************************************************************************
3 | **
4 | ** File : linker_stm32f10x_md.ld
5 | **
6 | ** Abstract : Linker script for STM32F103CB Device with
7 | ** 128KByte FLASH, 20KByte RAM
8 | **
9 | ** Set heap size, stack size and stack location according
10 | ** to application requirements.
11 | **
12 | ** Set memory bank area and size if external memory is used.
13 | **
14 | ** Target : STMicroelectronics STM32
15 | **
16 | ** Environment : Eclipse-CDT and GNU Tools ARM Embedded.
17 | **
18 | *****************************************************************************
19 | */
20 |
21 | MEMORY
22 | {
23 | RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 20K
24 | APP_FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 128K
25 | }
26 |
27 | INCLUDE linker_stm32f10x_common.ld
28 |
--------------------------------------------------------------------------------
/arduino/variants/RedBear_Duo/linker_scripts/linker/linker_stm32f10x_md_dfu.ld:
--------------------------------------------------------------------------------
1 | /*
2 | *****************************************************************************
3 | **
4 | ** File : linker_stm32f10x_md_dfu.ld
5 | **
6 | ** Abstract : Linker script for STM32F103CB Device with
7 | ** 128KByte FLASH, 20KByte RAM
8 | **
9 | ** Set heap size, stack size and stack location according
10 | ** to application requirements.
11 | **
12 | ** Set memory bank area and size if external memory is used.
13 | **
14 | ** Target : STMicroelectronics STM32
15 | **
16 | ** Environment : Eclipse-CDT and GNU Tools ARM Embedded.
17 | **
18 | *****************************************************************************
19 | */
20 |
21 | MEMORY
22 | {
23 | RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 20K
24 | APP_FLASH (rx) : ORIGIN = 0x08005000, LENGTH = 128K-0x5000
25 | }
26 |
27 | INCLUDE linker_stm32f10x_common.ld
28 |
--------------------------------------------------------------------------------
/arduino/variants/RedBear_Duo/linker_scripts/linker/linker_stm32f2xx.ld:
--------------------------------------------------------------------------------
1 | /*
2 | *****************************************************************************
3 | **
4 | ** File : linker_stm32f2xx_dfu.ld
5 | **
6 | ** Abstract : Linker script for STM32F205xx Device with
7 | ** 1MByte FLASH, 128KByte SRAM
8 | **
9 | ** Set heap size, stack size and stack location according
10 | ** to application requirements.
11 | **
12 | ** Set memory bank area and size if external memory is used.
13 | **
14 | ** Target : STMicroelectronics STM32
15 | **
16 | ** Environment : Eclipse-CDT and GNU Tools ARM Embedded.
17 | **
18 | *****************************************************************************
19 | */
20 |
21 | /* default stack sizes.
22 |
23 | These are used by the startup in order to allocate stacks for the different modes.
24 | */
25 |
26 | __Stack_Size = 2048 ;
27 |
28 | __Stack_Init = _estack - __Stack_Size ;
29 |
30 | /*
31 | There will be a link error if there is not this amount of RAM free at the end.
32 | */
33 | _Minimum_Stack_Size = 0x1400;
34 |
35 | /* include the memory spaces definitions sub-script */
36 | /*
37 | Linker subscript for STM32F205xx definitions with 1024K Flash and 128K RAM
38 | */
39 |
40 | /* Memory Spaces Definitions */
41 |
42 | MEMORY
43 | {
44 | RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
45 | APP_FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 16K
46 | DCT1_FLASH (rx) : ORIGIN = 0x08004000, LENGTH = 16K
47 | DCT2_FLASH (rx) : ORIGIN = 0x08008000, LENGTH = 16K
48 | INCLUDE backup_ram_memory.ld
49 | }
50 |
51 | INCLUDE linker_stm32f2xx_common.ld
--------------------------------------------------------------------------------
/arduino/variants/RedBear_Duo/linker_scripts/linker/linker_stm32f2xx_bootloader.ld:
--------------------------------------------------------------------------------
1 | /* Default stack sizes. These are used by the startup in order to allocate stacks for the
2 | different modes. */
3 | __Stack_Size = 2048;
4 | __Stack_Init = _estack - __Stack_Size;
5 |
6 | /* There will be a link error if there is not this amount of RAM free at the end. */
7 | _Minimum_Stack_Size = 0x1400;
8 |
9 | /* Memory Spaces Definitions */
10 |
11 | INCLUDE module_user_memory.ld
12 |
13 | /* Ensure RAM region doesn't overlap with the system modules, since the bootloader imports
14 | dynalib functions dynamically on certain platforms */
15 | bootloader_ram_length = 16K;
16 | bootloader_ram_offset = 8K;
17 | bootloader_ram_origin = user_module_sram_origin + bootloader_ram_offset;
18 | ASSERT(bootloader_ram_offset + bootloader_ram_length <= user_module_sram_length,
19 | "Insufficient space for RAM region");
20 |
21 | MEMORY
22 | {
23 | RAM (xrw) : ORIGIN = bootloader_ram_origin, LENGTH = bootloader_ram_length
24 | APP_FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 16K
25 | DCT1_FLASH (rx) : ORIGIN = 0x08004000, LENGTH = 16K
26 | DCT2_FLASH (rx) : ORIGIN = 0x08008000, LENGTH = 16K
27 | INCLUDE backup_ram_memory.ld
28 | }
29 |
30 | INCLUDE linker_stm32f2xx_common.ld
31 |
--------------------------------------------------------------------------------
/arduino/variants/RedBear_Duo/linker_scripts/linker/linker_stm32f2xx_bootloader_ext.ld:
--------------------------------------------------------------------------------
1 | /* Default stack sizes. These are used by the startup in order to allocate stacks for the
2 | different modes. */
3 | __Stack_Size = 2048;
4 | __Stack_Init = _estack - __Stack_Size;
5 |
6 | /* There will be a link error if there is not this amount of RAM free at the end. */
7 | _Minimum_Stack_Size = 0x1400;
8 |
9 | /* Memory Spaces Definitions */
10 |
11 | INCLUDE module_user_memory.ld
12 |
13 | /* Ensure RAM region doesn't overlap with the system modules, since the bootloader imports
14 | dynalib functions dynamically on certain platforms */
15 | bootloader_ram_length = 16K;
16 | bootloader_ram_offset = 8K;
17 | bootloader_ram_origin = user_module_sram_origin + bootloader_ram_offset;
18 | ASSERT(bootloader_ram_offset + bootloader_ram_length <= user_module_sram_length,
19 | "Insufficient space for RAM region");
20 |
21 | MEMORY
22 | {
23 | RAM (xrw) : ORIGIN = bootloader_ram_origin, LENGTH = bootloader_ram_length
24 | APP_FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 32K
25 | DCT1_FLASH (rx) : ORIGIN = 0x08008000, LENGTH = 16K
26 | DCT2_FLASH (rx) : ORIGIN = 0x0800C000, LENGTH = 16K
27 | INCLUDE backup_ram_memory.ld
28 | }
29 |
30 | INCLUDE linker_stm32f2xx_common.ld
31 |
--------------------------------------------------------------------------------
/arduino/variants/RedBear_Duo/linker_scripts/linker/linker_stm32f2xx_dfu.ld:
--------------------------------------------------------------------------------
1 | /*
2 | *****************************************************************************
3 | **
4 | ** File : linker_stm32f2xx_dfu.ld
5 | **
6 | ** Abstract : Linker script for STM32F205xx Device with
7 | ** 1MByte FLASH, 128KByte SRAM
8 | **
9 | ** Set heap size, stack size and stack location according
10 | ** to application requirements.
11 | **
12 | ** Set memory bank area and size if external memory is used.
13 | **
14 | ** Target : STMicroelectronics STM32
15 | **
16 | ** Environment : Eclipse-CDT and GNU Tools ARM Embedded.
17 | **
18 | *****************************************************************************
19 | */
20 |
21 | /* default stack sizes.
22 |
23 | These are used by the startup in order to allocate stacks for the different modes.
24 | */
25 |
26 | __Stack_Size = 2048 ;
27 |
28 | PROVIDE ( _Stack_Size = __Stack_Size ) ;
29 |
30 | __Stack_Init = _estack - __Stack_Size ;
31 |
32 | /*"PROVIDE" allows to easily override these values from an object file or the commmand line.*/
33 | PROVIDE ( _Stack_Init = __Stack_Init ) ;
34 |
35 | /*
36 | There will be a link error if there is not this amount of RAM free at the end.
37 | */
38 | _Minimum_Stack_Size = 0x1400;
39 |
40 | /* include the memory spaces definitions sub-script */
41 | /*
42 | Linker subscript for STM32F205xx definitions with 1024K Flash and 128K RAM
43 | */
44 |
45 | /* Memory Spaces Definitions */
46 |
47 | MEMORY
48 | {
49 | RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
50 | APP_FLASH (rx) : ORIGIN = 0x08020000, LENGTH = 1024K-0x20000
51 | DCT1_FLASH (rx) : ORIGIN = 0x08004000, LENGTH = 16K
52 | DCT2_FLASH (rx) : ORIGIN = 0x08008000, LENGTH = 16K
53 | INCLUDE backup_ram_memory.ld
54 | }
55 |
56 | INCLUDE linker_stm32f2xx_common.ld
57 |
--------------------------------------------------------------------------------
/arduino/variants/RedBear_Duo/linker_scripts/linker/module_asserts.ld:
--------------------------------------------------------------------------------
1 |
2 | ASSERT ( link_module_info_start < link_module_info_end, "module info not linked" );
3 | ASSERT ( link_module_info_suffix_start < link_module_info_suffix_end, "module info suffix not linked" );
4 | ASSERT ( link_module_info_crc_start < link_module_info_crc_end, "module info crc not linked" );
5 |
--------------------------------------------------------------------------------
/arduino/variants/RedBear_Duo/linker_scripts/linker/module_end.ld:
--------------------------------------------------------------------------------
1 | .module_info_suffix :
2 | {
3 | . = ALIGN(., 2);
4 | link_module_info_static_start = .;
5 | SHORT(0xffff)
6 | SHORT(0xffff)
7 | KEEP(*.o(.modinfo.product_id))
8 | KEEP(*.o(.modinfo.product_version))
9 |
10 | link_module_info_suffix_start = .;
11 | KEEP(*.o(.modinfo.module_info_suffix))
12 | link_module_info_suffix_end = .;
13 | }>APP_FLASH
14 |
15 | .module_end :
16 | {
17 | link_module_end = .;
18 | }>APP_FLASH
19 |
20 | .module_info_crc :
21 | {
22 | link_module_info_crc_start = .;
23 | KEEP(*.o(.modinfo.module_info_crc))
24 | link_module_info_crc_end = .;
25 | }>APP_FLASH
26 |
--------------------------------------------------------------------------------
/arduino/variants/RedBear_Duo/linker_scripts/linker/module_info.ld:
--------------------------------------------------------------------------------
1 | .module_info :
2 | {
3 | . = ALIGN(4);
4 | link_module_info_start = .;
5 | KEEP(*.o(.modinfo.module_info))
6 | link_module_info_end = .;
7 | }>APP_FLASH AT> APP_FLASH
8 |
--------------------------------------------------------------------------------
/arduino/variants/RedBear_Duo/linker_scripts/linker/module_start.ld:
--------------------------------------------------------------------------------
1 |
2 | .module_start :
3 | {
4 | link_module_start = .;
5 | } >APP_FLASH
6 |
--------------------------------------------------------------------------------
/arduino/variants/RedBear_Duo/linker_scripts/linker/stm32f2xx/backup_ram_memory.ld:
--------------------------------------------------------------------------------
1 | /* Declaration for the location of the application and system backup RAM region. */
2 | BACKUPSRAM (rwx) : ORIGIN = 0x40024000, LENGTH = 3K
3 | BACKUPSRAM_SYSTEM (rwx) : ORIGIN = 0x40025000-1K, LENGTH = 1K
4 |
--------------------------------------------------------------------------------
/arduino/variants/RedBear_Duo/linker_scripts/linker/stm32f2xx/backup_ram_system.ld:
--------------------------------------------------------------------------------
1 |
2 | .backup_system :
3 | {
4 | link_global_retained_system_initial_values = LOADADDR( .backup_system ); /* This is the location in flash of the initial values of retained global variables */
5 | link_global_retained_system_start = .;
6 | *(.retained_system*)
7 | link_global_retained_system_end = .;
8 | }>BACKUPSRAM_SYSTEM AT> APP_FLASH
9 | /* even though we don't initialize the system backup RAM presently, it has to be
10 | placed at APP_FLASH or the resulting file ends up being hundreds of megabytes in size */
11 |
--------------------------------------------------------------------------------
/arduino/variants/RedBear_Duo/linker_scripts/linker/stm32f2xx/backup_ram_user.ld:
--------------------------------------------------------------------------------
1 | .backup :
2 | {
3 | link_global_retained_initial_values = LOADADDR( .backup ); /* This is the location in flash of the initial values of retained global variables */
4 | link_global_retained_start = .;
5 | *(.retained_user*)
6 | link_global_retained_end = .;
7 | . = ALIGN(., 4);
8 | }>BACKUPSRAM AT> APP_FLASH
9 |
--------------------------------------------------------------------------------
/arduino/variants/RedBear_Duo/openocd_scripts/redbear_duo.cfg:
--------------------------------------------------------------------------------
1 | #
2 | # RedBear Duo OpenOCD script.
3 | #
4 | # Copyright (c) 2016 RedBear.cc All right reserved.
5 | #
6 | # This library is free software; you can redistribute it and/or
7 | # modify it under the terms of the GNU Lesser General Public
8 | # License as published by the Free Software Foundation; either
9 | # version 2.1 of the License, or (at your option) any later version.
10 | #
11 | # This library is distributed in the hope that it will be useful,
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 | # See the GNU Lesser General Public License for more details.
15 | #
16 | # You should have received a copy of the GNU Lesser General Public
17 | # License along with this library; if not, write to the Free Software
18 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 | #
20 |
21 | source [find interface/stlink-v2-1.cfg]
22 |
23 | set WORKAREASIZE 0x4000
24 |
25 | source [find target/stm32f2x.cfg]
26 |
27 | reset_config srst_only srst_nogate connect_assert_srst
28 |
29 | proc Unlock () {
30 | mww 0x40023C08 0x08192A3B; mww 0x40023C08 0x4C5D6E7F; mdw 0x40023c14
31 | mww 0x40023C14 0x0fffaaec; sleep 400; mdw 0x40023c14
32 | mww 0x40023C14 0x0fffaaef; sleep 400; mdw 0x40023c14
33 | }
34 |
--------------------------------------------------------------------------------
/pack.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | sudo chmod +x arduino/tools/crc32/linux/crc32.sh
4 | sudo chmod +x arduino/tools/crc32/linux/sh
5 | sudo chmod +x arduino/tools/crc32/macosx/crc32.sh
6 | sudo chmod +x arduino/tools/crc32/macosx/sh
7 |
8 | board_pack_name=duo_board_v$1
9 |
10 | mkdir $1
11 |
12 | cp -a arduino/ $1/
13 |
14 | tar -zcvf $board_pack_name.tar.gz $1
15 |
16 | rm -r $1
17 |
18 |
--------------------------------------------------------------------------------
/test.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | #
4 | # Script for copy to arduno15 folder
5 | #
6 | # For Linux root: $ sudo test.sh root
7 | #
8 |
9 | os=`uname`
10 |
11 | if [ $os == 'Darwin' ]; then
12 | board_path=~/Library/Arduino15/packages/RedBear/hardware/STM32F2
13 | elif [ $os == 'Windows' ]; then
14 | board_path=~/Library/Arduino15/packages/RedBear/hardware/STM32F2
15 | elif [ $os=='Linux' ]; then
16 | #if [ $# -eq 1 ]; then
17 | board_path=/root/.arduino15/packages/RedBear/hardware/STM32F2
18 | #else
19 | #board_path=~/.arduino15/packages/RedBear/hardware/STM32F2
20 | # fi
21 | else
22 | echo Unknown OS
23 | exit
24 | fi
25 |
26 | ver=$(ls $board_path | grep 0.2.)
27 |
28 | echo OS is $os
29 |
30 | if [ -s $board_path/$ver ]; then
31 | echo Will copy to $board_path/$ver
32 | rm -r $board_path/$ver
33 | mkdir $board_path/$ver
34 | cp -a arduino/* $board_path/$ver/
35 | else
36 | echo Error: please install board package for the Duo first.
37 | fi
38 |
--------------------------------------------------------------------------------