├── 98-daplink.rules ├── README.md ├── VERSION.md ├── arduino-1.6.x └── hardware │ └── RBL │ └── RBL_nRF51822 │ ├── avrdude_conf │ └── avrdude.conf │ ├── boards.txt │ ├── bootloaders │ └── bootloader.hex │ ├── cores │ └── RBL_nRF51822 │ │ ├── Arduino.h │ │ ├── BLE_API.h │ │ ├── HardwareSerial.h │ │ ├── Print.cpp │ │ ├── Print.h │ │ ├── Printable.h │ │ ├── WCharacter.h │ │ ├── WMath.cpp │ │ ├── WMath.h │ │ ├── WStream.cpp │ │ ├── WStream.h │ │ ├── WString.cpp │ │ ├── WString.h │ │ ├── avr │ │ └── pgmspace.h │ │ ├── binary.h │ │ ├── ble-master │ │ ├── .gitignore │ │ ├── CHANGELOG.md │ │ ├── CONTRIBUTING.md │ │ ├── DOXYGEN_FRONTPAGE.md │ │ ├── LICENSE │ │ ├── README.md │ │ ├── apache-2.0.txt │ │ ├── ble.doxyfile │ │ ├── ble │ │ │ ├── BLE.h │ │ │ ├── BLEInstanceBase.h │ │ │ ├── BLEProtocol.h │ │ │ ├── CallChainOfFunctionPointersWithContext.h │ │ │ ├── CharacteristicDescriptorDiscovery.h │ │ │ ├── DiscoveredCharacteristic.h │ │ │ ├── DiscoveredCharacteristicDescriptor.h │ │ │ ├── DiscoveredService.h │ │ │ ├── FunctionPointerWithContext.h │ │ │ ├── Gap.h │ │ │ ├── GapAdvertisingData.h │ │ │ ├── GapAdvertisingParams.h │ │ │ ├── GapEvents.h │ │ │ ├── GapScanningParams.h │ │ │ ├── GattAttribute.h │ │ │ ├── GattCallbackParamTypes.h │ │ │ ├── GattCharacteristic.h │ │ │ ├── GattClient.h │ │ │ ├── GattServer.h │ │ │ ├── GattServerEvents.h │ │ │ ├── GattService.h │ │ │ ├── SafeBool.h │ │ │ ├── SecurityManager.h │ │ │ ├── ServiceDiscovery.h │ │ │ ├── UUID.h │ │ │ ├── blecommon.h │ │ │ ├── deprecate.h │ │ │ └── services │ │ │ │ ├── BatteryService.h │ │ │ │ ├── DFUService.h │ │ │ │ ├── DeviceInformationService.h │ │ │ │ ├── EddystoneConfigService.h │ │ │ │ ├── EddystoneService.h │ │ │ │ ├── EnvironmentalService.h │ │ │ │ ├── HealthThermometerService.h │ │ │ │ ├── HeartRateService.h │ │ │ │ ├── LinkLossService.h │ │ │ │ ├── UARTService.h │ │ │ │ ├── URIBeaconConfigService.h │ │ │ │ └── iBeacon.h │ │ ├── module.json │ │ └── source │ │ │ ├── BLE.cpp │ │ │ ├── DiscoveredCharacteristic.cpp │ │ │ ├── GapScanningParams.cpp │ │ │ └── services │ │ │ ├── DFUService.cpp │ │ │ ├── UARTService.cpp │ │ │ └── URIBeaconConfigService.cpp │ │ ├── ble-nrf51822-master │ │ ├── CHANGELOG.md │ │ ├── LICENSE │ │ ├── apache-2.0.txt │ │ ├── module.json │ │ ├── softdevice_nrf51822_licence_agreement.txt │ │ └── source │ │ │ ├── btle │ │ │ ├── btle.cpp │ │ │ ├── btle.h │ │ │ ├── btle_advertising.cpp │ │ │ ├── btle_advertising.h │ │ │ ├── btle_discovery.cpp │ │ │ ├── btle_discovery.h │ │ │ ├── btle_gap.cpp │ │ │ ├── btle_gap.h │ │ │ ├── btle_security.cpp │ │ │ ├── btle_security.h │ │ │ └── custom │ │ │ │ ├── custom_helper.cpp │ │ │ │ └── custom_helper.h │ │ │ ├── common │ │ │ ├── ansi_escape.h │ │ │ ├── assertion.h │ │ │ ├── binary.h │ │ │ ├── ble_error.h │ │ │ ├── common.h │ │ │ └── compiler.h │ │ │ ├── nRF5xCharacteristicDescriptorDiscoverer.cpp │ │ │ ├── nRF5xCharacteristicDescriptorDiscoverer.h │ │ │ ├── nRF5xDiscoveredCharacteristic.cpp │ │ │ ├── nRF5xDiscoveredCharacteristic.h │ │ │ ├── nRF5xGap.cpp │ │ │ ├── nRF5xGap.h │ │ │ ├── nRF5xGattClient.cpp │ │ │ ├── nRF5xGattClient.h │ │ │ ├── nRF5xGattServer.cpp │ │ │ ├── nRF5xGattServer.h │ │ │ ├── nRF5xSecurityManager.h │ │ │ ├── nRF5xServiceDiscovery.cpp │ │ │ ├── nRF5xServiceDiscovery.h │ │ │ ├── nRF5xn.cpp │ │ │ ├── nRF5xn.h │ │ │ ├── nordic_sdk │ │ │ └── components │ │ │ │ ├── ble │ │ │ │ ├── ble_radio_notification │ │ │ │ │ ├── ble_radio_notification.c │ │ │ │ │ └── ble_radio_notification.h │ │ │ │ ├── ble_services │ │ │ │ │ └── ble_dfu │ │ │ │ │ │ ├── ble_dfu.c │ │ │ │ │ │ └── ble_dfu.h │ │ │ │ ├── common │ │ │ │ │ ├── ble_advdata.c │ │ │ │ │ ├── ble_advdata.h │ │ │ │ │ ├── ble_conn_params.cpp │ │ │ │ │ ├── ble_conn_params.h │ │ │ │ │ ├── ble_conn_state.c │ │ │ │ │ ├── ble_conn_state.h │ │ │ │ │ ├── ble_date_time.h │ │ │ │ │ ├── ble_gatt_db.h │ │ │ │ │ ├── ble_sensor_location.h │ │ │ │ │ ├── ble_srv_common.c │ │ │ │ │ └── ble_srv_common.h │ │ │ │ ├── device_manager │ │ │ │ │ ├── config │ │ │ │ │ │ └── device_manager_cnfg.h │ │ │ │ │ ├── device_manager.h │ │ │ │ │ └── device_manager_peripheral.c │ │ │ │ └── peer_manager │ │ │ │ │ ├── id_manager.c │ │ │ │ │ ├── id_manager.h │ │ │ │ │ ├── peer_data.c │ │ │ │ │ ├── peer_data.h │ │ │ │ │ ├── peer_data_storage.c │ │ │ │ │ ├── peer_data_storage.h │ │ │ │ │ ├── peer_database.c │ │ │ │ │ ├── peer_database.h │ │ │ │ │ ├── peer_id.c │ │ │ │ │ ├── peer_id.h │ │ │ │ │ ├── peer_manager_types.h │ │ │ │ │ ├── pm_buffer.c │ │ │ │ │ ├── pm_buffer.h │ │ │ │ │ ├── pm_mutex.c │ │ │ │ │ └── pm_mutex.h │ │ │ │ ├── device │ │ │ │ ├── compiler_abstraction.h │ │ │ │ ├── nrf.h │ │ │ │ ├── nrf51.h │ │ │ │ ├── nrf51_bitfields.h │ │ │ │ └── nrf51_deprecated.h │ │ │ │ ├── drivers_nrf │ │ │ │ ├── ble_flash │ │ │ │ │ ├── ble_flash.c │ │ │ │ │ └── ble_flash.h │ │ │ │ ├── delay │ │ │ │ │ ├── nrf_delay.c │ │ │ │ │ └── nrf_delay.h │ │ │ │ ├── hal │ │ │ │ │ ├── nrf_ecb.c │ │ │ │ │ ├── nrf_ecb.h │ │ │ │ │ ├── nrf_gpio.h │ │ │ │ │ ├── nrf_gpiote.h │ │ │ │ │ ├── nrf_nvmc.c │ │ │ │ │ ├── nrf_nvmc.h │ │ │ │ │ ├── nrf_temp.h │ │ │ │ │ └── nrf_wdt.h │ │ │ │ └── pstorage │ │ │ │ │ ├── config │ │ │ │ │ └── pstorage_platform.h │ │ │ │ │ ├── pstorage.c │ │ │ │ │ └── pstorage.h │ │ │ │ ├── libraries │ │ │ │ ├── bootloader_dfu │ │ │ │ │ ├── bootloader.h │ │ │ │ │ ├── bootloader_types.h │ │ │ │ │ ├── bootloader_util.c │ │ │ │ │ ├── bootloader_util.h │ │ │ │ │ ├── dfu.h │ │ │ │ │ ├── dfu_app_handler.c │ │ │ │ │ ├── dfu_app_handler.h │ │ │ │ │ ├── dfu_bank_internal.h │ │ │ │ │ ├── dfu_ble_svc.h │ │ │ │ │ ├── dfu_ble_svc_internal.h │ │ │ │ │ ├── dfu_init.h │ │ │ │ │ ├── dfu_init_template.c │ │ │ │ │ ├── dfu_transport.h │ │ │ │ │ ├── dfu_types.h │ │ │ │ │ └── hci_transport │ │ │ │ │ │ └── hci_mem_pool_internal.h │ │ │ │ ├── crc16 │ │ │ │ │ ├── crc16.c │ │ │ │ │ └── crc16.h │ │ │ │ ├── experimental_section_vars │ │ │ │ │ └── section_vars.h │ │ │ │ ├── fds │ │ │ │ │ ├── fds.c │ │ │ │ │ ├── fds.h │ │ │ │ │ ├── fds_config.h │ │ │ │ │ └── fds_types_internal.h │ │ │ │ ├── fstorage │ │ │ │ │ ├── fstorage.c │ │ │ │ │ ├── fstorage.h │ │ │ │ │ ├── fstorage_config.h │ │ │ │ │ └── fstorage_nosd.c │ │ │ │ ├── hci │ │ │ │ │ ├── hci_mem_pool.c │ │ │ │ │ └── hci_mem_pool.h │ │ │ │ ├── scheduler │ │ │ │ │ ├── app_scheduler.c │ │ │ │ │ └── app_scheduler.h │ │ │ │ ├── timer │ │ │ │ │ └── app_timer.h │ │ │ │ └── util │ │ │ │ │ ├── app_error.c │ │ │ │ │ ├── app_error.h │ │ │ │ │ ├── app_util.h │ │ │ │ │ ├── app_util_platform.c │ │ │ │ │ ├── app_util_platform.h │ │ │ │ │ ├── common.h │ │ │ │ │ ├── nordic_common.h │ │ │ │ │ ├── nrf_assert.c │ │ │ │ │ ├── nrf_assert.h │ │ │ │ │ ├── sdk_common.h │ │ │ │ │ ├── sdk_errors.h │ │ │ │ │ ├── sdk_mapped_flags.c │ │ │ │ │ ├── sdk_mapped_flags.h │ │ │ │ │ └── sdk_os.h │ │ │ │ └── softdevice │ │ │ │ ├── common │ │ │ │ └── softdevice_handler │ │ │ │ │ ├── ant_stack_handler_types.h │ │ │ │ │ ├── ble_stack_handler_types.h │ │ │ │ │ ├── softdevice_handler.c │ │ │ │ │ ├── softdevice_handler.h │ │ │ │ │ ├── softdevice_handler_appsh.c │ │ │ │ │ └── softdevice_handler_appsh.h │ │ │ │ └── s130 │ │ │ │ └── headers │ │ │ │ ├── ble.h │ │ │ │ ├── ble_err.h │ │ │ │ ├── ble_gap.h │ │ │ │ ├── ble_gatt.h │ │ │ │ ├── ble_gattc.h │ │ │ │ ├── ble_gatts.h │ │ │ │ ├── ble_hci.h │ │ │ │ ├── ble_l2cap.h │ │ │ │ ├── ble_ranges.h │ │ │ │ ├── ble_types.h │ │ │ │ ├── nrf_error.h │ │ │ │ ├── nrf_error_sdm.h │ │ │ │ ├── nrf_error_soc.h │ │ │ │ ├── nrf_mbr.h │ │ │ │ ├── nrf_sdm.h │ │ │ │ ├── nrf_soc.h │ │ │ │ ├── nrf_svc.h │ │ │ │ └── softdevice_assert.h │ │ │ ├── projectconfig.h │ │ │ └── supress-warnings.cmake │ │ ├── itoa.c │ │ ├── itoa.h │ │ ├── main.cpp │ │ ├── mbed │ │ ├── .yotta_ignore │ │ ├── CMakeLists.txt │ │ ├── api │ │ │ ├── AnalogIn.h │ │ │ ├── AnalogOut.h │ │ │ ├── BusIn.h │ │ │ ├── BusInOut.h │ │ │ ├── BusOut.h │ │ │ ├── CAN.h │ │ │ ├── CThunk.h │ │ │ ├── CallChain.h │ │ │ ├── CircularBuffer.h │ │ │ ├── DigitalIn.h │ │ │ ├── DigitalInOut.h │ │ │ ├── DigitalOut.h │ │ │ ├── DirHandle.h │ │ │ ├── Ethernet.h │ │ │ ├── FileBase.h │ │ │ ├── FileHandle.h │ │ │ ├── FileLike.h │ │ │ ├── FilePath.h │ │ │ ├── FileSystemLike.h │ │ │ ├── FunctionPointer.h │ │ │ ├── I2C.h │ │ │ ├── I2CSlave.h │ │ │ ├── InterruptIn.h │ │ │ ├── InterruptManager.h │ │ │ ├── LocalFileSystem.h │ │ │ ├── LowPowerTicker.h │ │ │ ├── LowPowerTimeout.h │ │ │ ├── LowPowerTimer.h │ │ │ ├── PortIn.h │ │ │ ├── PortInOut.h │ │ │ ├── PortOut.h │ │ │ ├── PwmOut.h │ │ │ ├── RawSerial.h │ │ │ ├── SPI.h │ │ │ ├── SPISlave.h │ │ │ ├── Serial.h │ │ │ ├── SerialBase.h │ │ │ ├── Stream.h │ │ │ ├── Ticker.h │ │ │ ├── Timeout.h │ │ │ ├── Timer.h │ │ │ ├── TimerEvent.h │ │ │ ├── Transaction.h │ │ │ ├── can_helper.h │ │ │ ├── mbed.h │ │ │ ├── mbed_assert.h │ │ │ ├── mbed_debug.h │ │ │ ├── mbed_error.h │ │ │ ├── mbed_interface.h │ │ │ ├── platform.h │ │ │ ├── rtc_time.h │ │ │ ├── semihost_api.h │ │ │ ├── toolchain.h │ │ │ └── wait_api.h │ │ ├── common │ │ │ ├── BusIn.cpp │ │ │ ├── BusInOut.cpp │ │ │ ├── BusOut.cpp │ │ │ ├── CAN.cpp │ │ │ ├── CallChain.cpp │ │ │ ├── Ethernet.cpp │ │ │ ├── FileBase.cpp │ │ │ ├── FileLike.cpp │ │ │ ├── FilePath.cpp │ │ │ ├── FileSystemLike.cpp │ │ │ ├── I2C.cpp │ │ │ ├── I2CSlave.cpp │ │ │ ├── InterruptIn.cpp │ │ │ ├── InterruptManager.cpp │ │ │ ├── LocalFileSystem.cpp │ │ │ ├── RawSerial.cpp │ │ │ ├── SPI.cpp │ │ │ ├── SPISlave.cpp │ │ │ ├── Serial.cpp │ │ │ ├── SerialBase.cpp │ │ │ ├── Stream.cpp │ │ │ ├── Ticker.cpp │ │ │ ├── Timeout.cpp │ │ │ ├── Timer.cpp │ │ │ ├── TimerEvent.cpp │ │ │ ├── assert.c │ │ │ ├── board.c │ │ │ ├── error.c │ │ │ ├── gpio.c │ │ │ ├── lp_ticker_api.c │ │ │ ├── mbed_interface.c │ │ │ ├── pinmap_common.c │ │ │ ├── retarget.cpp │ │ │ ├── rtc_time.c │ │ │ ├── semihost_api.c │ │ │ ├── ticker_api.c │ │ │ ├── us_ticker_api.c │ │ │ └── wait_api.c │ │ ├── hal │ │ │ ├── analogin_api.h │ │ │ ├── analogout_api.h │ │ │ ├── buffer.h │ │ │ ├── can_api.h │ │ │ ├── dma_api.h │ │ │ ├── ethernet_api.h │ │ │ ├── gpio_api.h │ │ │ ├── gpio_irq_api.h │ │ │ ├── i2c_api.h │ │ │ ├── lp_ticker_api.h │ │ │ ├── pinmap.h │ │ │ ├── port_api.h │ │ │ ├── pwmout_api.h │ │ │ ├── rtc_api.h │ │ │ ├── serial_api.h │ │ │ ├── sleep_api.h │ │ │ ├── spi_api.h │ │ │ ├── ticker_api.h │ │ │ └── us_ticker_api.h │ │ ├── module.json │ │ └── targets │ │ │ ├── cmsis │ │ │ ├── TARGET_NORDIC │ │ │ │ └── TARGET_MCU_NRF51822 │ │ │ │ │ ├── cmsis.h │ │ │ │ │ ├── cmsis_nvic.c │ │ │ │ │ ├── cmsis_nvic.h │ │ │ │ │ ├── compiler_abstraction.h │ │ │ │ │ ├── nrf.h │ │ │ │ │ ├── nrf51.h │ │ │ │ │ ├── nrf51.hxxxx │ │ │ │ │ ├── nrf51_bitfields.h │ │ │ │ │ ├── nrf51_bitfields.hxxxx │ │ │ │ │ ├── nrf_delay.h │ │ │ │ │ ├── system_nrf51.c │ │ │ │ │ └── system_nrf51.h │ │ │ ├── arm_common_tables.h │ │ │ ├── arm_const_structs.h │ │ │ ├── arm_math.h │ │ │ ├── core_ca9.h │ │ │ ├── core_caFunc.h │ │ │ ├── core_caInstr.h │ │ │ ├── core_ca_mmu.h │ │ │ ├── core_cm0.h │ │ │ ├── core_cm0plus.h │ │ │ ├── core_cm3.h │ │ │ ├── core_cm4.h │ │ │ ├── core_cm4_simd.h │ │ │ ├── core_cm7.h │ │ │ ├── core_cmFunc.h │ │ │ ├── core_cmInstr.h │ │ │ ├── core_cmSimd.h │ │ │ ├── core_sc000.h │ │ │ └── core_sc300.h │ │ │ └── hal │ │ │ └── TARGET_NORDIC │ │ │ └── TARGET_MCU_NRF51822 │ │ │ ├── PeripheralNames.h │ │ │ ├── PortNames.h │ │ │ ├── TARGET_RBLAB_BLENANO │ │ │ ├── PinNames.h │ │ │ └── device.h │ │ │ ├── TARGET_RBLAB_NRF51822 │ │ │ ├── PinNames.h │ │ │ └── device.h │ │ │ ├── analogin_api.c │ │ │ ├── gpio_api.c │ │ │ ├── gpio_irq_api.c │ │ │ ├── gpio_object.h │ │ │ ├── i2c_api.c │ │ │ ├── objects.h │ │ │ ├── pinmap.c │ │ │ ├── port_api.c │ │ │ ├── pwmout_api.c │ │ │ ├── serial_api.c │ │ │ ├── sleep.c │ │ │ ├── spi_api.c │ │ │ ├── twi_config.h │ │ │ ├── twi_master.c │ │ │ ├── twi_master.h │ │ │ └── us_ticker.c │ │ ├── nRF51822_API.h │ │ ├── pin_transform.cpp │ │ ├── pin_transform.h │ │ ├── startup_NRF51822.S │ │ ├── wiring_analog.cpp │ │ ├── wiring_analog.h │ │ ├── wiring_buffer.cpp │ │ ├── wiring_buffer.h │ │ ├── wiring_constants.h │ │ ├── wiring_delay.cpp │ │ ├── wiring_delay.h │ │ ├── wiring_digital.cpp │ │ ├── wiring_digital.h │ │ ├── wiring_interrupter.cpp │ │ ├── wiring_interrupter.h │ │ ├── wiring_serial.cpp │ │ ├── wiring_serial.h │ │ ├── wiring_shift_pulseIn.cpp │ │ └── wiring_shift_pulseIn.h │ ├── libraries │ ├── BLE_Examples │ │ ├── examples │ │ │ ├── BLEController │ │ │ │ ├── BLEController.ino │ │ │ │ └── pin_inf.h │ │ │ ├── BLE_CentralTest │ │ │ │ └── BLE_CentralTest.ino │ │ │ ├── BLE_HRM │ │ │ │ └── BLE_HRM.ino │ │ │ ├── BLE_RGB_Switch │ │ │ │ └── BLE_RGB_Switch.ino │ │ │ ├── BLE_ScanReport │ │ │ │ └── BLE_ScanReport.ino │ │ │ ├── BLE_Serial │ │ │ │ └── BLE_Serial.ino │ │ │ ├── BLE_SimplePeripheral │ │ │ │ └── BLE_SimplePeripheral.ino │ │ │ ├── BLE_beacon │ │ │ │ └── BLE_beacon.ino │ │ │ ├── BLE_multi_role │ │ │ │ └── BLE_multi_role.ino │ │ │ ├── SimpleChat │ │ │ │ └── SimpleChat.ino │ │ │ └── SimpleControls │ │ │ │ └── SimpleControls.ino │ │ ├── keywords.txt │ │ ├── library.properties │ │ └── src │ │ │ └── invalid.h │ ├── SPI_Master │ │ ├── SPI_Master.cpp │ │ ├── SPI_Master.h │ │ ├── examples │ │ │ ├── SPI_Flash_45DB021D │ │ │ │ └── SPI_Flash_45DB021D.ino │ │ │ └── SPI_Master_write │ │ │ │ └── SPI_Master_write.ino │ │ └── keywords.txt │ ├── Servo │ │ ├── Servo.cpp │ │ ├── Servo.h │ │ ├── examples │ │ │ └── Sweep │ │ │ │ └── Sweep.ino │ │ └── keywords.txt │ ├── Wire │ │ ├── Wire.cpp │ │ ├── Wire.h │ │ ├── examples │ │ │ ├── AT24C512_Demo │ │ │ │ └── AT24C512_Demo.ino │ │ │ ├── master_read │ │ │ │ └── master_read.ino │ │ │ └── master_write │ │ │ │ └── master_write.ino │ │ └── keywords.txt │ └── nRF_Examples │ │ ├── README.adoc │ │ ├── examples │ │ ├── External_Interrupter │ │ │ └── External_Interrupter.ino │ │ ├── Serial_IRQ_Handle │ │ │ └── Serial_IRQ_Handle.ino │ │ └── Ticker_Task │ │ │ └── Ticker_Task.ino │ │ ├── keywords.txt │ │ ├── library.properties │ │ └── src │ │ └── invalid.h │ ├── platform.txt │ ├── programmers.txt │ └── variants │ ├── BLE_Nano │ ├── linker_scripts │ │ └── gcc │ │ │ └── RBL_nRF51822.ld │ └── pins_arduino.h │ ├── BLE_Nano_32KB │ ├── linker_scripts │ │ └── gcc │ │ │ ├── RBL_nRF51822.ld │ │ │ └── RBL_nRF51822.ldxxx │ └── pins_arduino.h │ ├── RBL_nRF51822 │ ├── linker_scripts │ │ └── gcc │ │ │ └── RBL_nRF51822.ld │ └── pins_arduino.h │ └── RBL_nRF51822_32KB │ ├── linker_scripts │ └── gcc │ │ └── RBL_nRF51822.ld │ └── pins_arduino.h ├── bootloader ├── README.txt ├── SoftdeviceS130_1.0_Bootloader_20160824.hex ├── SoftdeviceS130_1.0_Bootloader_Blinky_20160824.hex └── bootloader.hex ├── docs └── DFU_User_Guider.md └── interface ├── README.md ├── f103 └── board_v1.0 │ └── daplink │ └── stm32f103xb_rblnano_if_crc_legacy_0x8000.bin └── mk20 ├── board_v1.0 └── daplink │ └── BLENano_MK20.bin └── board_v1.5 └── cmsis-dap ├── BLENano_MK20.bin └── RBL_nRF51822_MK20.bin /98-daplink.rules: -------------------------------------------------------------------------------- 1 | 2 | # mbed CMSIS-DAP 3 | ATTRS{idVendor}=="0d28", ATTRS{idProduct}=="0204", MODE="664", GROUP="plugdev" 4 | KERNEL=="hidraw*", ATTRS{idVendor}=="0d28", ATTRS{idProduct}=="0204", MODE="664", GROUP="plugdev" 5 | -------------------------------------------------------------------------------- /VERSION.md: -------------------------------------------------------------------------------- 1 | 2 | ## Version 3 | 4 | This is about the board support package version. 5 | 6 | #### Current Version 7 | 8 | #### Version: 1.0.8 9 | 10 | * Fix bug of Example "BLEController" : "reporting pin's status too fast for andriod". 11 | * Fix function "shiftOut()" : "Not generate clock correctly". 12 | * Fix the bug "Can't use DFUService". 13 | * Fix "Wire::endTransmission()". 14 | 15 | #### Verison: 1.0.7 16 | 17 | * Use SandeepMistry's openocd to instead of arduino openocd 18 | * Fixed bug "Can't upload on macosx" 19 | * Change file "nrf_ble.h" to "ble.h" 20 | 21 | ##### kown issue 22 | 23 | * Upload problem on Linux 64bit, fix it as follow: 24 | ``` 25 | sudo apt-get install lsb-core 26 | 27 | sudo apt-get install libudev1:i386 28 | 29 | sudo ln -sf /lib/x86_64-linux-gnu/libudev.so.1 /lib/x86_64-linux-gnu/libudev.so.0 30 | ``` 31 | * Can't use DFUService. 32 | * Function "shiftOut" : "Not generate clock correctly". 33 | * Example "BLEController" not compatible with andriod. 34 | 35 | #### Version: 1.0.6 36 | 37 | * Update libraries : ble-master, ble-nrf51822-master,mbed 38 | * Update examples, add more comments 39 | * Using openocd tools to instead of avrdude for uploading 40 | * Buring bootloader using DAPLink 41 | * Fixed bug "If don't call Serial.begin(),analogRead() would not work well" 42 | * Fixed bug "launchServiceDiscovery() doesn't discover all services and characteristics" 43 | 44 | ##### kown issue 45 | 46 | * Can't upload on macosx 47 | 48 | 49 | #### Version: 1.0.5 50 | 51 | * Fixed BLE Controller Sketch 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/Arduino.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #ifndef ARDUINO_H_ 4 | #define ARDUINO_H_ 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | #include "mbed.h" 14 | #include "binary.h" 15 | 16 | #include "wiring_constants.h" 17 | #include "wiring_digital.h" 18 | #include "wiring_delay.h" 19 | 20 | #include "wiring_buffer.h" 21 | #include "wiring_serial.h" 22 | 23 | #include "wiring_analog.h" 24 | #include "WMath.h" 25 | 26 | #include "wiring_shift_pulseIn.h" 27 | #include "wiring_interrupter.h" 28 | 29 | #include "pins_arduino.h" 30 | #include "pin_transform.h" 31 | 32 | /* sketch */ 33 | extern void setup( void ) ; 34 | extern void loop( void ) ; 35 | 36 | extern UARTClass Serial; 37 | 38 | #endif 39 | 40 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/BLE_API.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef BLE_API_H_ 3 | #define BLE_API_H_ 4 | 5 | #include "ble/BLE.h" 6 | #include "ble/blecommon.h" 7 | #include "ble/BLEInstanceBase.h" 8 | #include "ble/BLEProtocol.h" 9 | #include "ble/CallChainOfFunctionPointersWithContext.h" 10 | #include "ble/CharacteristicDescriptorDiscovery.h" 11 | #include "ble/deprecate.h" 12 | #include "ble/DiscoveredCharacteristic.h" 13 | #include "ble/DiscoveredCharacteristicDescriptor.h" 14 | #include "ble/DiscoveredService.h" 15 | #include "ble/FunctionPointerWithContext.h" 16 | #include "ble/Gap.h" 17 | #include "ble/GapAdvertisingData.h" 18 | #include "ble/GapAdvertisingParams.h" 19 | #include "ble/GapEvents.h" 20 | #include "ble/GapScanningParams.h" 21 | #include "ble/GattAttribute.h" 22 | #include "ble/GattCallbackParamTypes.h" 23 | #include "ble/GattCharacteristic.h" 24 | #include "ble/GattClient.h" 25 | #include "ble/GattServer.h" 26 | #include "ble/GattServerEvents.h" 27 | #include "ble/GattService.h" 28 | #include "ble/SafeBool.h" 29 | #include "ble/SecurityManager.h" 30 | #include "ble/ServiceDiscovery.h" 31 | #include "ble/UUID.h" 32 | 33 | #include "BatteryService.h" 34 | #include "DeviceInformationService.h" 35 | #include "DFUService.h" 36 | #include "EddystoneConfigService.h" 37 | #include "EddystoneService.h" 38 | #include "HealthThermometerService.h" 39 | #include "EnvironmentalService.h" 40 | #include "HealthThermometerService.h" 41 | #include "HeartRateService.h" 42 | #include "iBeacon.h" 43 | #include "LinkLossService.h" 44 | #include "UARTService.h" 45 | #include "URIBeaconConfigService.h" 46 | 47 | #include "nRF51822_API.h" 48 | 49 | #endif 50 | 51 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/HardwareSerial.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011 Arduino. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef HardwareSerial_h 20 | #define HardwareSerial_h 21 | 22 | #include 23 | 24 | #include "WStream.h" 25 | 26 | class HardwareSerial : public WStream 27 | { 28 | public: 29 | void begin( const uint32_t dwBaudRate ); 30 | void begin( const uint32_t dwBaudRate, PinName rx_pin, PinName tx_pin ); 31 | void end(); 32 | virtual int available(void) = 0; 33 | virtual int peek(void) = 0; 34 | virtual int read(void) = 0; 35 | virtual void flush(void) = 0; 36 | virtual size_t write(uint8_t) = 0; 37 | using Print::write; // pull in write(str) and write(buf, size) from Print 38 | virtual operator bool() = 0; 39 | }; 40 | 41 | extern void serialEvent(void) __attribute__((weak)); 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/Printable.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | Printable.h - Interface class that allows printing of complex types 4 | Copyright (c) 2011 Adrian McEwen. 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. See the GNU 14 | 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 | #ifndef Printable_h 22 | #define Printable_h 23 | 24 | #include 25 | 26 | class Print; 27 | 28 | /** The Printable class provides a way for new classes to allow themselves to be printed. 29 | By deriving from Printable and implementing the printTo method, it will then be possible 30 | for users to print out instances of this class by passing them into the usual 31 | Print::print and Print::println methods. 32 | */ 33 | 34 | class Printable 35 | { 36 | public: 37 | virtual size_t printTo(Print& p) const = 0; 38 | }; 39 | 40 | #endif 41 | 42 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/WMath.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | Copyright (c) 2011 Arduino. 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. 13 | See the GNU 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 | extern "C" { 21 | #include "stdlib.h" 22 | #include "stdint.h" 23 | } 24 | #include "WMath.h" 25 | 26 | extern void randomSeed( uint32_t dwSeed ) 27 | { 28 | if ( dwSeed != 0 ) 29 | { 30 | srand( dwSeed ) ; 31 | } 32 | } 33 | 34 | extern long random( long howbig ) 35 | { 36 | if ( howbig == 0 ) 37 | { 38 | return 0 ; 39 | } 40 | 41 | return rand() % howbig; 42 | } 43 | 44 | extern long random( long howsmall, long howbig ) 45 | { 46 | if (howsmall >= howbig) 47 | { 48 | return howsmall; 49 | } 50 | 51 | long diff = howbig - howsmall; 52 | 53 | return random(diff) + howsmall; 54 | } 55 | 56 | extern long map(long x, long in_min, long in_max, long out_min, long out_max) 57 | { 58 | return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; 59 | } 60 | 61 | extern uint16_t makeWord( uint16_t w ) 62 | { 63 | return w ; 64 | } 65 | 66 | extern uint16_t makeWord( uint8_t h, uint8_t l ) 67 | { 68 | return (h << 8) | l ; 69 | } 70 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/WMath.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | Copyright (c) 2011 Arduino. 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. 13 | See the GNU 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 _WIRING_MATH_ 21 | #define _WIRING_MATH_ 22 | 23 | extern long random( long ) ; 24 | extern long random( long, long ) ; 25 | extern void randomSeed( uint32_t dwSeed ) ; 26 | extern long map( long, long, long, long, long ) ; 27 | 28 | extern uint16_t makeWord( uint16_t w ) ; 29 | extern uint16_t makeWord( uint8_t h, uint8_t l ) ; 30 | 31 | #define word(...) makeWord(__VA_ARGS__) 32 | 33 | 34 | #endif /* _WIRING_MATH_ */ 35 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/avr/pgmspace.h: -------------------------------------------------------------------------------- 1 | #ifndef __PGMSPACE_H_ 2 | #define __PGMSPACE_H_ 1 3 | 4 | #include 5 | 6 | #define PROGMEM 7 | #define PGM_P const char * 8 | #define PSTR(str) (str) 9 | 10 | #define _SFR_BYTE(n) (n) 11 | 12 | typedef void prog_void; 13 | typedef char prog_char; 14 | typedef unsigned char prog_uchar; 15 | typedef int8_t prog_int8_t; 16 | typedef uint8_t prog_uint8_t; 17 | typedef int16_t prog_int16_t; 18 | typedef uint16_t prog_uint16_t; 19 | typedef int32_t prog_int32_t; 20 | typedef uint32_t prog_uint32_t; 21 | 22 | #define memcpy_P(dest, src, num) memcpy((dest), (src), (num)) 23 | #define strcpy_P(dest, src) strcpy((dest), (src)) 24 | #define strcat_P(dest, src) strcat((dest), (src)) 25 | #define strcmp_P(a, b) strcmp((a), (b)) 26 | #define strstr_P(a, b) strstr((a), (b)) 27 | #define strlen_P(a) strlen((a)) 28 | #define sprintf_P(s, f, ...) sprintf((s), (f), __VA_ARGS__) 29 | 30 | #define pgm_read_byte(addr) (*(const unsigned char *)(addr)) 31 | #define pgm_read_word(addr) (*(const unsigned short *)(addr)) 32 | #define pgm_read_dword(addr) (*(const unsigned long *)(addr)) 33 | #define pgm_read_float(addr) (*(const float *)(addr)) 34 | 35 | #define pgm_read_byte_near(addr) pgm_read_byte(addr) 36 | #define pgm_read_word_near(addr) pgm_read_word(addr) 37 | #define pgm_read_dword_near(addr) pgm_read_dword(addr) 38 | #define pgm_read_float_near(addr) pgm_read_float(addr) 39 | #define pgm_read_byte_far(addr) pgm_read_byte(addr) 40 | #define pgm_read_word_far(addr) pgm_read_word(addr) 41 | #define pgm_read_dword_far(addr) pgm_read_dword(addr) 42 | #define pgm_read_float_far(addr) pgm_read_float(addr) 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/ble-master/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore the generated Doxygen output 2 | apidoc/ 3 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/ble-master/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Hello! 2 | We are an open source project of [ARM mbed](https://www.mbed.com). Contributions via [pull request](https://github.com/ARMmbed/ble/pulls), and [bug reports](https://github.com/ARMmbed/ble/issues) are welcome! 3 | 4 | Please submit your pull request to the `develop` branch of [this module](https://github.com/ARMmbed/ble/tree/develop). Commits to develop will be merge into the master branch at the time of the next release. 5 | 6 | # Contributor agreement 7 | For your pull request to be accepted, we will need you to agree to our [contributor agreement](https://developer.mbed.org/contributor_agreement/) to give us the necessary rights to use and distribute your contributions. (To click through the agreement create an account on mbed.com and log in.) 8 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/ble-master/DOXYGEN_FRONTPAGE.md: -------------------------------------------------------------------------------- 1 | # BLE API {#mainpage} 2 | 3 | The BLE module within mbed OS offers a high abstraction level for using 4 | Bluetooth Low Energy on multiple platforms. 5 | 6 | This documentation describes the internal structure of the mbed 7 | [BLE API](https://github.com/armmbed/ble). 8 | 9 | For getting started with BLE on mbed, check our [introduction 10 | page](https://docs.mbed.com/docs/ble-intros/en/latest/). 11 | 12 | For mbed OS examples using BLE, check [this 13 | repository](https://github.com/armmbed/ble-examples). For mbed-classic 14 | examples, please refer to [code under mbed.org](https://developer.mbed.org/teams/Bluetooth-Low-Energy/code/). 15 | 16 | ## Supported Services 17 | 18 | Currently supported reference services include: 19 | 20 | * [Battery](@ref BatteryService) 21 | * [Device Firmware Update (DFU)](@ref DFUService) 22 | * [Device Information](@ref DeviceInformationService) 23 | * [Health Thermometer](@ref HealthThermometerService) 24 | * [Heart Rate](@ref HeartRateService) 25 | * [UART](@ref UARTService) 26 | * [UriBeacon](@ref URIBeaconConfigService) 27 | * [iBeacon](@ref iBeacon) 28 | 29 | The [documentation](https://docs.mbed.com/docs/ble-intros/en/latest/AdvSamples/Overview/) 30 | contains an overview on how to create new, application-specific services. 31 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/ble-master/LICENSE: -------------------------------------------------------------------------------- 1 | Unless specifically indicated otherwise in a file, files are licensed 2 | under the Apache 2.0 license, as can be found in: apache-2.0.txt 3 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/ble-master/README.md: -------------------------------------------------------------------------------- 1 | # mbed Bluetooth Low Energy Stack 2 | This is the Github repo for the `BLE_API` used by developer.mbed.org. Please see the [mbed BLE Homepage](https://developer.mbed.org/teams/Bluetooth-Low-Energy/) for all documentation, code examples and general help. 3 | 4 | # Supported Services 5 | Supported GATT services and constantly being added and can be found in the [ble/services/](https://github.com/ARMmbed/ble/tree/master/ble/services) folder. 6 | 7 | Currently supported services include: 8 | * Battery 9 | * Device Firmware Update (DFU) 10 | * Device Information 11 | * Eddystone Configuration Service 12 | * Health Thermometer 13 | * Heart Rate 14 | * Link Loss 15 | * UART 16 | * UriBeacon 17 | * iBeacon 18 | 19 | The [documentation](https://docs.mbed.com/docs/ble-intros/en/latest/AdvSamples/Overview/) 20 | contains an overview on how to create new, application-specific services. 21 | 22 | # Getting Started 23 | The mbed BLE API is meant to be used in projects on developer.mbed.org. Please see examples and sample project files there. 24 | A good starting point are these pages: 25 | * [mbed BLE Homepage](https://developer.mbed.org/teams/Bluetooth-Low-Energy/) for all things BLE 26 | * [mbed BLE Getting Started Guide](https://developer.mbed.org/forum/team-63-Bluetooth-Low-Energy-community/topic/5262/) a wonderful primer on using BLE with mbed 27 | * [mbed BLE doc](https://docs.mbed.com/docs/ble-intros/en/latest/) for an introduction to mbed BLE 28 | * [mbed BLE API page](https://docs.mbed.com/docs/ble-api/en/latest/api/index.html) for the Doxygen API documentation 29 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/ble-master/apache-2.0.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 ARM Limited 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/ble-master/ble/GapEvents.h: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __GAP_EVENTS_H__ 18 | #define __GAP_EVENTS_H__ 19 | 20 | #include "blecommon.h" 21 | 22 | /**************************************************************************/ 23 | /*! 24 | \brief 25 | The base class used to abstract away the callback events that can be 26 | triggered with the GAP. 27 | */ 28 | /**************************************************************************/ 29 | class GapEvents 30 | { 31 | public: 32 | /******************************************************************/ 33 | /*! 34 | \brief 35 | Identifies GAP events generated by the radio HW when an event 36 | callback occurs. 37 | */ 38 | /******************************************************************/ 39 | typedef enum gapEvent_e { 40 | GAP_EVENT_TIMEOUT = 1, /**< Advertising timed out before a connection could be established. */ 41 | GAP_EVENT_CONNECTED = 2, /**< A connection was established with a central device. */ 42 | GAP_EVENT_DISCONNECTED = 3 /**< A connection was closed or lost with a central device. */ 43 | } gapEvent_t; 44 | }; 45 | 46 | #endif // ifndef __GAP_EVENTS_H__ 47 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/ble-master/ble/GattServerEvents.h: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __GATT_SERVER_EVENTS_H__ 18 | #define __GATT_SERVER_EVENTS_H__ 19 | 20 | /** 21 | * @brief The base class used to abstract away the callback events that can be 22 | * triggered with the GATT Server. 23 | */ 24 | class GattServerEvents 25 | { 26 | public: 27 | /** 28 | * Enumeration for GattServer events. 29 | */ 30 | typedef enum gattEvent_e { 31 | GATT_EVENT_DATA_SENT = 1, /**< Fired when a message was successfully sent out (notify only?) */ 32 | GATT_EVENT_DATA_WRITTEN = 2, /**< Client wrote data to the server (separate into char and descriptor writes?) */ 33 | GATT_EVENT_UPDATES_ENABLED = 3, /**< Notify/Indicate enabled in CCCD. */ 34 | GATT_EVENT_UPDATES_DISABLED = 4, /**< Notify/Indicate disabled in CCCD. */ 35 | GATT_EVENT_CONFIRMATION_RECEIVED = 5, /**< Response received from Indicate message. */ 36 | GATT_EVENT_READ_AUTHORIZATION_REQ = 6, /**< Request application to authorize read. */ 37 | GATT_EVENT_WRITE_AUTHORIZATION_REQ = 7, /**< Request application to authorize write. */ 38 | } gattEvent_t; 39 | }; 40 | 41 | #endif /* ifndef __GATT_SERVER_EVENTS_H__ */ 42 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/ble-master/ble/deprecate.h: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __DEPRECATE_H__ 18 | #define __DEPRECATE_H__ 19 | 20 | #ifdef YOTTA_CFG_MBED_OS 21 | #include "compiler-polyfill/attributes.h" 22 | #else 23 | #define __deprecated_message(msg) 24 | #endif 25 | 26 | #endif -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/ble-master/module.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ble", 3 | "version": "2.6.0", 4 | "description": "The BLE module offers a high level abstraction for using Bluetooth Low Energy on multiple platforms.", 5 | "keywords": [ 6 | "Bluetooth", 7 | "BLE", 8 | "mbed", 9 | "mbed-official" 10 | ], 11 | "author": "Rohit Grover", 12 | "repository": { 13 | "url": "https://github.com/ARMmbed/ble.git", 14 | "type": "git" 15 | }, 16 | "homepage": "https://developer.mbed.org/teams/Bluetooth-Low-Energy/", 17 | "licenses": [ 18 | { 19 | "url": "https://spdx.org/licenses/Apache-2.0", 20 | "type": "Apache-2.0" 21 | } 22 | ], 23 | "dependencies": {}, 24 | "targetDependencies": { 25 | "st-ble-shield": { 26 | "x-nucleo-idb0xa1": "^2.0.0" 27 | }, 28 | "nrf51822": { 29 | "ble-nrf51822": "^2.2.8" 30 | }, 31 | "nrf52832": { 32 | "ble-nrf52832": "ARMmbed/ble-nrf52832" 33 | }, 34 | "cordio": { 35 | "ble-wicentric": "~0.0.4" 36 | }, 37 | "mbed-classic": { 38 | "mbed-classic": "~0.0.1" 39 | }, 40 | "mbed-os": { 41 | "mbed-drivers": "*", 42 | "compiler-polyfill": "^1.2.1" 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/ble-master/source/services/DFUService.cpp: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifdef TARGET_NRF51822 /* DFU only supported on nrf51 platforms */ 18 | 19 | #include "ble/services/DFUService.h" 20 | 21 | const uint8_t DFUServiceBaseUUID[] = { 22 | 0x00, 0x00, 0x00, 0x00, 0x12, 0x12, 0xEF, 0xDE, 23 | 0x15, 0x23, 0x78, 0x5F, 0xEA, 0xBC, 0xD1, 0x23, 24 | }; 25 | const uint16_t DFUServiceShortUUID = 0x1530; 26 | const uint16_t DFUServiceControlCharacteristicShortUUID = 0x1531; 27 | const uint16_t DFUServicePacketCharacteristicShortUUID = 0x1532; 28 | 29 | const uint8_t DFUServiceUUID[] = { 30 | 0x00, 0x00, (uint8_t)(DFUServiceShortUUID >> 8), (uint8_t)(DFUServiceShortUUID & 0xFF), 0x12, 0x12, 0xEF, 0xDE, 31 | 0x15, 0x23, 0x78, 0x5F, 0xEA, 0xBC, 0xD1, 0x23, 32 | }; 33 | const uint8_t DFUServiceControlCharacteristicUUID[] = { 34 | 0x00, 0x00, (uint8_t)(DFUServiceControlCharacteristicShortUUID >> 8), (uint8_t)(DFUServiceControlCharacteristicShortUUID & 0xFF), 0x12, 0x12, 0xEF, 0xDE, 35 | 0x15, 0x23, 0x78, 0x5F, 0xEA, 0xBC, 0xD1, 0x23, 36 | }; 37 | const uint8_t DFUServicePacketCharacteristicUUID[] = { 38 | 0x00, 0x00, (uint8_t)(DFUServicePacketCharacteristicShortUUID >> 8), (uint8_t)(DFUServicePacketCharacteristicShortUUID & 0xFF), 0x12, 0x12, 0xEF, 0xDE, 39 | 0x15, 0x23, 0x78, 0x5F, 0xEA, 0xBC, 0xD1, 0x23, 40 | }; 41 | 42 | DFUService::ResetPrepare_t DFUService::handoverCallback = NULL; 43 | 44 | #endif /* #ifdef TARGET_NRF51822 */ 45 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/ble-master/source/services/UARTService.cpp: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "ble/services/UARTService.h" 18 | 19 | const uint8_t UARTServiceBaseUUID[UUID::LENGTH_OF_LONG_UUID] = { 20 | 0x6E, 0x40, 0x00, 0x00, 0xB5, 0xA3, 0xF3, 0x93, 21 | 0xE0, 0xA9, 0xE5, 0x0E, 0x24, 0xDC, 0xCA, 0x9E, 22 | }; 23 | const uint16_t UARTServiceShortUUID = 0x0001; 24 | const uint16_t UARTServiceTXCharacteristicShortUUID = 0x0002; 25 | const uint16_t UARTServiceRXCharacteristicShortUUID = 0x0003; 26 | const uint8_t UARTServiceUUID[UUID::LENGTH_OF_LONG_UUID] = { 27 | 0x6E, 0x40, (uint8_t)(UARTServiceShortUUID >> 8), (uint8_t)(UARTServiceShortUUID & 0xFF), 0xB5, 0xA3, 0xF3, 0x93, 28 | 0xE0, 0xA9, 0xE5, 0x0E, 0x24, 0xDC, 0xCA, 0x9E, 29 | }; 30 | const uint8_t UARTServiceUUID_reversed[UUID::LENGTH_OF_LONG_UUID] = { 31 | 0x9E, 0xCA, 0xDC, 0x24, 0x0E, 0xE5, 0xA9, 0xE0, 32 | 0x93, 0xF3, 0xA3, 0xB5, (uint8_t)(UARTServiceShortUUID & 0xFF), (uint8_t)(UARTServiceShortUUID >> 8), 0x40, 0x6E 33 | }; 34 | const uint8_t UARTServiceTXCharacteristicUUID[UUID::LENGTH_OF_LONG_UUID] = { 35 | 0x6E, 0x40, (uint8_t)(UARTServiceTXCharacteristicShortUUID >> 8), (uint8_t)(UARTServiceTXCharacteristicShortUUID & 0xFF), 0xB5, 0xA3, 0xF3, 0x93, 36 | 0xE0, 0xA9, 0xE5, 0x0E, 0x24, 0xDC, 0xCA, 0x9E, 37 | }; 38 | const uint8_t UARTServiceRXCharacteristicUUID[UUID::LENGTH_OF_LONG_UUID] = { 39 | 0x6E, 0x40, (uint8_t)(UARTServiceRXCharacteristicShortUUID >> 8), (uint8_t)(UARTServiceRXCharacteristicShortUUID & 0xFF), 0xB5, 0xA3, 0xF3, 0x93, 40 | 0xE0, 0xA9, 0xE5, 0x0E, 0x24, 0xDC, 0xCA, 0x9E, 41 | }; 42 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/ble-master/source/services/URIBeaconConfigService.cpp: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "ble/services/URIBeaconConfigService.h" 18 | 19 | #define UUID_URI_BEACON(FIRST, SECOND) { \ 20 | 0xee, 0x0c, FIRST, SECOND, 0x87, 0x86, 0x40, 0xba, \ 21 | 0xab, 0x96, 0x99, 0xb9, 0x1a, 0xc9, 0x81, 0xd8, \ 22 | } 23 | 24 | const uint8_t UUID_URI_BEACON_SERVICE[UUID::LENGTH_OF_LONG_UUID] = UUID_URI_BEACON(0x20, 0x80); 25 | const uint8_t UUID_LOCK_STATE_CHAR[UUID::LENGTH_OF_LONG_UUID] = UUID_URI_BEACON(0x20, 0x81); 26 | const uint8_t UUID_LOCK_CHAR[UUID::LENGTH_OF_LONG_UUID] = UUID_URI_BEACON(0x20, 0x82); 27 | const uint8_t UUID_UNLOCK_CHAR[UUID::LENGTH_OF_LONG_UUID] = UUID_URI_BEACON(0x20, 0x83); 28 | const uint8_t UUID_URI_DATA_CHAR[UUID::LENGTH_OF_LONG_UUID] = UUID_URI_BEACON(0x20, 0x84); 29 | const uint8_t UUID_FLAGS_CHAR[UUID::LENGTH_OF_LONG_UUID] = UUID_URI_BEACON(0x20, 0x85); 30 | const uint8_t UUID_ADV_POWER_LEVELS_CHAR[UUID::LENGTH_OF_LONG_UUID] = UUID_URI_BEACON(0x20, 0x86); 31 | const uint8_t UUID_TX_POWER_MODE_CHAR[UUID::LENGTH_OF_LONG_UUID] = UUID_URI_BEACON(0x20, 0x87); 32 | const uint8_t UUID_BEACON_PERIOD_CHAR[UUID::LENGTH_OF_LONG_UUID] = UUID_URI_BEACON(0x20, 0x88); 33 | const uint8_t UUID_RESET_CHAR[UUID::LENGTH_OF_LONG_UUID] = UUID_URI_BEACON(0x20, 0x89); 34 | 35 | const uint8_t BEACON_UUID[sizeof(UUID::ShortUUIDBytes_t)] = {0xD8, 0xFE}; 36 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/ble-nrf51822-master/LICENSE: -------------------------------------------------------------------------------- 1 | This module contains softdevice which comes with The Nordic Softdevice License Agreement, 2 | a BSD-like licence for binary distributions, offered by Nordic for use in mbed. Some 3 | other files come from the mbed SDK, and are licensed under Apache-2.0. Unless 4 | specifically indicated otherwise in a file, files are licensed under the 5 | Apache 2.0 license, as can be found in: apache-2.0.txt. The Nordic Semiconductor Softdevice 6 | License Agreement can be found in softdevice_nrf51822_licence_agreement.txt. 7 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/ble-nrf51822-master/apache-2.0.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 ARM Limited 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/ble-nrf51822-master/module.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ble-nrf51822", 3 | "version": "2.7.1", 4 | "description": "Nordic stack and drivers for the mbed BLE API.", 5 | "keywords": [ 6 | "Bluetooth", 7 | "BLE", 8 | "mbed", 9 | "mbed-official" 10 | ], 11 | "author": "Rohit Grover", 12 | "repository": { 13 | "url": "git@github.com:ARMmbed/ble-nRF51822.git", 14 | "type": "git" 15 | }, 16 | "homepage": "https://developer.mbed.org/teams/Nordic-Semiconductor/", 17 | "licenses": [ 18 | { 19 | "url": "https://spdx.org/licenses/Apache-2.0", 20 | "type": "Apache-2.0" 21 | }, 22 | { 23 | "type": "LicenseRef-softdevice_nrf51822_licence_agreement.txt" 24 | } 25 | ], 26 | "dependencies": { 27 | "ble": "^2.6.0", 28 | "nrf51-sdk": "^2.4.0" 29 | }, 30 | "extraIncludes": [ 31 | "source/btle", 32 | "source/btle/custom", 33 | "source/common" 34 | ], 35 | "targetDependencies": {} 36 | } 37 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/ble-nrf51822-master/softdevice_nrf51822_licence_agreement.txt: -------------------------------------------------------------------------------- 1 | /* 2 | * S110/S120/S130 License Agreement 3 | * 4 | * Copyright (c) 2015, Nordic Semiconductor ASA, All rights reserved. 5 | * 6 | * Redistribution. Redistribution and use in binary form, without modification, 7 | * are permitted provided that the following conditions are met: 8 | * 9 | * • Redistributions must reproduce the above copyright notice and the following 10 | * disclaimer in the documentation and/or other materials provided with the 11 | * distribution. 12 | * • Neither the name of the copyright holder nor the names of its contributors 13 | * may be used to endorse or promote products derived from this software 14 | * without specific prior written permission. 15 | * • No reverse engineering, decompilation, or disassembly of this software is 16 | * permitted. 17 | * 18 | * DISCLAIMER. 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 23 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 26 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | * 30 | * / 31 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/ble-nrf51822-master/source/btle/btle.h: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _BTLE_H_ 18 | #define _BTLE_H_ 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | #include "common/common.h" 25 | 26 | #include "ble_srv_common.h" 27 | #include "ble.h" 28 | 29 | error_t btle_init(void); 30 | 31 | #ifdef __cplusplus 32 | } 33 | #endif 34 | 35 | #endif // ifndef _BTLE_H_ 36 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/ble-nrf51822-master/source/btle/btle_advertising.cpp: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #include "common/common.h" 17 | 18 | #include "ble_advdata.h" 19 | #include "btle.h" 20 | 21 | /**************************************************************************/ 22 | /*! 23 | @brief Starts the advertising process 24 | 25 | @returns 26 | */ 27 | /**************************************************************************/ 28 | error_t btle_advertising_start(void) 29 | { 30 | ble_gap_adv_params_t adv_para = {0}; 31 | 32 | /* Set the default advertising parameters */ 33 | adv_para.type = BLE_GAP_ADV_TYPE_ADV_IND; 34 | adv_para.p_peer_addr = NULL; /* Undirected advertising */ 35 | adv_para.fp = BLE_GAP_ADV_FP_ANY; 36 | adv_para.p_whitelist = NULL; 37 | adv_para.interval = (CFG_GAP_ADV_INTERVAL_MS * 8) / 5; /* Advertising 38 | * interval in 39 | * units of 0.625 40 | * ms */ 41 | adv_para.timeout = CFG_GAP_ADV_TIMEOUT_S; 42 | 43 | ASSERT_STATUS( sd_ble_gap_adv_start(&adv_para)); 44 | 45 | return ERROR_NONE; 46 | } 47 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/ble-nrf51822-master/source/btle/btle_advertising.h: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _BTLE_ADVERTISING_H_ 18 | #define _BTLE_ADVERTISING_H_ 19 | 20 | #include "common/common.h" 21 | 22 | error_t btle_advertising_start(void); 23 | 24 | #endif // ifndef _BTLE_ADVERTISING_H_ 25 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/ble-nrf51822-master/source/btle/btle_discovery.h: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _BTLE_DISCOVERY_H_ 18 | #define _BTLE_DISCOVERY_H_ 19 | 20 | void bleGattcEventHandler(const ble_evt_t *p_ble_evt); 21 | 22 | #endif /*_BTLE_DISCOVERY_H_*/ 23 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/ble-nrf51822-master/source/btle/btle_gap.h: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _BTLE_GAP_H_ 18 | #define _BTLE_GAP_H_ 19 | 20 | #include "common/common.h" 21 | 22 | error_t btle_gap_init(void); 23 | 24 | #endif // ifndef _BTLE_GAP_H_ 25 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/ble-nrf51822-master/source/nRF5xDiscoveredCharacteristic.h: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __NRF_DISCOVERED_CHARACTERISTIC_H__ 18 | #define __NRF_DISCOVERED_CHARACTERISTIC_H__ 19 | 20 | #include "ble/DiscoveredCharacteristic.h" 21 | #include "ble_gatt.h" 22 | 23 | class nRF5xGattClient; /* forward declaration */ 24 | 25 | class nRF5xDiscoveredCharacteristic : public DiscoveredCharacteristic { 26 | public: 27 | void setup(nRF5xGattClient *gattcIn, 28 | Gap::Handle_t connectionHandleIn, 29 | ble_gatt_char_props_t propsIn, 30 | GattAttribute::Handle_t declHandleIn, 31 | GattAttribute::Handle_t valueHandleIn); 32 | 33 | void setup(nRF5xGattClient *gattcIn, 34 | Gap::Handle_t connectionHandleIn, 35 | UUID::ShortUUIDBytes_t uuidIn, 36 | ble_gatt_char_props_t propsIn, 37 | GattAttribute::Handle_t declHandleIn, 38 | GattAttribute::Handle_t valueHandleIn); 39 | 40 | void setLastHandle(GattAttribute::Handle_t last) { 41 | lastHandle = last; 42 | } 43 | }; 44 | 45 | #endif /* __NRF_DISCOVERED_CHARACTERISTIC_H__ */ 46 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/ble-nrf51822-master/source/nordic_sdk/components/drivers_nrf/delay/nrf_delay.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Nordic Semiconductor ASA 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, this 12 | * list of conditions and the following disclaimer in the documentation and/or 13 | * other materials provided with the distribution. 14 | * 15 | * 3. Neither the name of Nordic Semiconductor ASA nor the names of other 16 | * contributors to this software may be used to endorse or promote products 17 | * derived from this software without specific prior written permission. 18 | * 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 24 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 27 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | 33 | #include 34 | #include "compiler_abstraction.h" 35 | #include "nrf.h" 36 | #include "nrf_delay.h" 37 | 38 | /*lint --e{438} "Variable not used" */ 39 | void nrf_delay_ms(uint32_t volatile number_of_ms) 40 | { 41 | while(number_of_ms != 0) 42 | { 43 | number_of_ms--; 44 | nrf_delay_us(999); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/ble-nrf51822-master/source/nordic_sdk/components/libraries/bootloader_dfu/hci_transport/hci_mem_pool_internal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Nordic Semiconductor ASA 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, this 12 | * list of conditions and the following disclaimer in the documentation and/or 13 | * other materials provided with the distribution. 14 | * 15 | * 3. Neither the name of Nordic Semiconductor ASA nor the names of other 16 | * contributors to this software may be used to endorse or promote products 17 | * derived from this software without specific prior written permission. 18 | * 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 24 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 27 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | 33 | /** @file 34 | * 35 | * @defgroup memory_pool_internal Memory Pool Internal 36 | * @{ 37 | * @ingroup memory_pool 38 | * 39 | * @brief Memory pool internal definitions 40 | */ 41 | 42 | #ifndef MEM_POOL_INTERNAL_H__ 43 | #define MEM_POOL_INTERNAL_H__ 44 | 45 | #define TX_BUF_SIZE 4u /**< TX buffer size in bytes. */ 46 | #define RX_BUF_SIZE 32u /**< RX buffer size in bytes. */ 47 | 48 | #define RX_BUF_QUEUE_SIZE 8u /**< RX buffer element size. */ 49 | 50 | #endif // MEM_POOL_INTERNAL_H__ 51 | 52 | /** @} */ 53 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/ble-nrf51822-master/source/nordic_sdk/components/libraries/crc16/crc16.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Nordic Semiconductor ASA 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, this 12 | * list of conditions and the following disclaimer in the documentation and/or 13 | * other materials provided with the distribution. 14 | * 15 | * 3. Neither the name of Nordic Semiconductor ASA nor the names of other 16 | * contributors to this software may be used to endorse or promote products 17 | * derived from this software without specific prior written permission. 18 | * 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 24 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 27 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | 33 | #include "crc16.h" 34 | #include 35 | 36 | uint16_t crc16_compute(const uint8_t * p_data, uint32_t size, const uint16_t * p_crc) 37 | { 38 | uint32_t i; 39 | uint16_t crc = (p_crc == NULL) ? 0xffff : *p_crc; 40 | 41 | for (i = 0; i < size; i++) 42 | { 43 | crc = (unsigned char)(crc >> 8) | (crc << 8); 44 | crc ^= p_data[i]; 45 | crc ^= (unsigned char)(crc & 0xff) >> 4; 46 | crc ^= (crc << 8) << 4; 47 | crc ^= ((crc & 0xff) << 4) << 1; 48 | } 49 | 50 | return crc; 51 | } 52 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/ble-nrf51822-master/source/nordic_sdk/components/libraries/fstorage/fstorage_nosd.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Nordic Semiconductor ASA 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, this 12 | * list of conditions and the following disclaimer in the documentation and/or 13 | * other materials provided with the distribution. 14 | * 15 | * 3. Neither the name of Nordic Semiconductor ASA nor the names of other 16 | * contributors to this software may be used to endorse or promote products 17 | * derived from this software without specific prior written permission. 18 | * 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 24 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 27 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | 33 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/ble-nrf51822-master/source/nordic_sdk/components/libraries/util/app_util_platform.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Nordic Semiconductor ASA 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, this 12 | * list of conditions and the following disclaimer in the documentation and/or 13 | * other materials provided with the distribution. 14 | * 15 | * 3. Neither the name of Nordic Semiconductor ASA nor the names of other 16 | * contributors to this software may be used to endorse or promote products 17 | * derived from this software without specific prior written permission. 18 | * 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 24 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 27 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | 33 | #include "app_util_platform.h" 34 | 35 | static uint32_t m_in_critical_region = 0; 36 | 37 | void critical_region_enter(void) 38 | { 39 | __disable_irq(); 40 | m_in_critical_region++; 41 | } 42 | 43 | void critical_region_exit(void) 44 | { 45 | m_in_critical_region--; 46 | if (m_in_critical_region == 0) 47 | { 48 | __enable_irq(); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/ble-nrf51822-master/source/nordic_sdk/components/libraries/util/nrf_assert.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Nordic Semiconductor ASA 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, this 12 | * list of conditions and the following disclaimer in the documentation and/or 13 | * other materials provided with the distribution. 14 | * 15 | * 3. Neither the name of Nordic Semiconductor ASA nor the names of other 16 | * contributors to this software may be used to endorse or promote products 17 | * derived from this software without specific prior written permission. 18 | * 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 24 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 27 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | #include "nrf_assert.h" 33 | 34 | #if defined(DEBUG_NRF) 35 | void assert_nrf_callback(uint16_t line_num, const uint8_t * file_name) 36 | { 37 | (void) file_name; /* Unused parameter */ 38 | (void) line_num; /* Unused parameter */ 39 | 40 | while (1) ; 41 | } 42 | #endif /* DEBUG_NRF */ 43 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/ble-nrf51822-master/source/nordic_sdk/components/softdevice/common/softdevice_handler/softdevice_handler_appsh.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Nordic Semiconductor ASA 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, this 12 | * list of conditions and the following disclaimer in the documentation and/or 13 | * other materials provided with the distribution. 14 | * 15 | * 3. Neither the name of Nordic Semiconductor ASA nor the names of other 16 | * contributors to this software may be used to endorse or promote products 17 | * derived from this software without specific prior written permission. 18 | * 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 24 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 27 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | 33 | #include "softdevice_handler_appsh.h" 34 | #include "app_scheduler.h" 35 | #include 36 | 37 | void softdevice_evt_get(void * p_event_data, uint16_t event_size) 38 | { 39 | APP_ERROR_CHECK_BOOL(event_size == 0); 40 | intern_softdevice_events_execute(); 41 | } 42 | 43 | uint32_t softdevice_evt_schedule(void) 44 | { 45 | return app_sched_event_put(NULL, 0, softdevice_evt_get); 46 | } 47 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/ble-nrf51822-master/source/nordic_sdk/components/softdevice/common/softdevice_handler/softdevice_handler_appsh.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Nordic Semiconductor ASA 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, this 12 | * list of conditions and the following disclaimer in the documentation and/or 13 | * other materials provided with the distribution. 14 | * 15 | * 3. Neither the name of Nordic Semiconductor ASA nor the names of other 16 | * contributors to this software may be used to endorse or promote products 17 | * derived from this software without specific prior written permission. 18 | * 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 24 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 27 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | */ 32 | 33 | #ifndef SOFTDEVICE_HANDLER_APPSH_H 34 | #define SOFTDEVICE_HANDLER_APPSH_H 35 | 36 | #include "softdevice_handler.h" 37 | #include 38 | 39 | #define SOFTDEVICE_HANDLER_APPSH_INIT(CLOCK_SOURCE,USE_SCHEDULER) \ 40 | SOFTDEVICE_HANDLER_INIT(CLOCK_SOURCE,(USE_SCHEDULER) ? softdevice_evt_schedule : NULL) 41 | 42 | uint32_t softdevice_evt_schedule(void); 43 | 44 | #endif //SOFTDEVICE_HANDLER_APPSH_H 45 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/ble-nrf51822-master/source/supress-warnings.cmake: -------------------------------------------------------------------------------- 1 | # Copyright 2015 ARM Limited 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | message("suppressing warnings from ble-nrf51822") 16 | 17 | if(CMAKE_C_COMPILER_ID STREQUAL "GNU") 18 | set_target_properties(ble-nrf51822 19 | PROPERTIES COMPILE_FLAGS "-Wno-sign-compare -Wno-unused-variable -Wno-unused-parameter -Wno-unused-function -Wno-missing-field-initializers" 20 | ) 21 | endif() 22 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/itoa.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | Copyright (c) 2011 Arduino. 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. 13 | See the GNU 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 _ITOA_ 21 | #define _ITOA_ 22 | 23 | #ifdef __cplusplus 24 | extern "C"{ 25 | #endif // __cplusplus 26 | 27 | #if 0 28 | 29 | extern void itoa( int n, char s[] ) ; 30 | 31 | #else 32 | 33 | extern char* itoa( int value, char *string, int radix ) ; 34 | extern char* ltoa( long value, char *string, int radix ) ; 35 | extern char* utoa( unsigned int value, char *string, int radix ) ; 36 | extern char* ultoa( unsigned long value, char *string, int radix ) ; 37 | #endif /* 0 */ 38 | 39 | #ifdef __cplusplus 40 | } // extern "C" 41 | #endif // __cplusplus 42 | 43 | #endif // _ITOA_ 44 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/main.cpp: -------------------------------------------------------------------------------- 1 | 2 | #define ARDUINO_MAIN 3 | 4 | #include "Arduino.h" 5 | 6 | int __attribute__ ((weak)) main( void ) 7 | { 8 | setup(); 9 | 10 | while(1) 11 | { 12 | loop(); 13 | } 14 | return 0; 15 | } -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/.yotta_ignore: -------------------------------------------------------------------------------- 1 | # ignore files for targets that aren't supported by the yotta build (to 2 | # minimise the size of the published module) 3 | 4 | TARGET_ARM_SSG 5 | TARGET_Freescale 6 | TARGET_RENESAS 7 | TARGET_Silicon_Labs 8 | TARGET_Atmel 9 | TARGET_Maxim 10 | TARGET_NXP 11 | TARGET_STM 12 | TARGET_WIZNET 13 | TOOLCHAIN_IAR 14 | 15 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/api/FileBase.h: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef MBED_FILEBASE_H 17 | #define MBED_FILEBASE_H 18 | 19 | typedef int FILEHANDLE; 20 | 21 | #include 22 | 23 | #if defined(__ARMCC_VERSION) || defined(__ICCARM__) 24 | # define O_RDONLY 0 25 | # define O_WRONLY 1 26 | # define O_RDWR 2 27 | # define O_CREAT 0x0200 28 | # define O_TRUNC 0x0400 29 | # define O_APPEND 0x0008 30 | 31 | # define NAME_MAX 255 32 | 33 | typedef int mode_t; 34 | typedef int ssize_t; 35 | typedef long off_t; 36 | 37 | #else 38 | # include 39 | # include 40 | # include 41 | #endif 42 | 43 | #include "platform.h" 44 | 45 | namespace mbed { 46 | 47 | typedef enum { 48 | FilePathType, 49 | FileSystemPathType 50 | } PathType; 51 | 52 | class FileBase { 53 | public: 54 | FileBase(const char *name, PathType t); 55 | 56 | virtual ~FileBase(); 57 | 58 | const char* getName(void); 59 | PathType getPathType(void); 60 | 61 | static FileBase *lookup(const char *name, unsigned int len); 62 | 63 | static FileBase *get(int n); 64 | 65 | protected: 66 | static FileBase *_head; 67 | 68 | FileBase *_next; 69 | const char *_name; 70 | PathType _path_type; 71 | 72 | /* disallow copy constructor and assignment operators */ 73 | private: 74 | FileBase(const FileBase&); 75 | FileBase & operator = (const FileBase&); 76 | }; 77 | 78 | } // namespace mbed 79 | 80 | #endif 81 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/api/FileLike.h: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef MBED_FILELIKE_H 17 | #define MBED_FILELIKE_H 18 | 19 | #include "FileBase.h" 20 | #include "FileHandle.h" 21 | 22 | namespace mbed { 23 | 24 | /* Class FileLike 25 | * A file-like object is one that can be opened with fopen by 26 | * fopen("/name", mode). It is intersection of the classes Base and 27 | * FileHandle. 28 | */ 29 | class FileLike : public FileHandle, public FileBase { 30 | 31 | public: 32 | /* Constructor FileLike 33 | * 34 | * Variables 35 | * name - The name to use to open the file. 36 | */ 37 | FileLike(const char *name); 38 | 39 | virtual ~FileLike(); 40 | }; 41 | 42 | } // namespace mbed 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/api/FilePath.h: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef MBED_FILEPATH_H 17 | #define MBED_FILEPATH_H 18 | 19 | #include "platform.h" 20 | 21 | #include "FileSystemLike.h" 22 | #include "FileLike.h" 23 | 24 | namespace mbed { 25 | 26 | class FilePath { 27 | public: 28 | FilePath(const char* file_path); 29 | 30 | const char* fileName(void); 31 | 32 | bool isFileSystem(void); 33 | FileSystemLike* fileSystem(void); 34 | 35 | bool isFile(void); 36 | FileLike* file(void); 37 | bool exists(void); 38 | 39 | private: 40 | const char* file_name; 41 | FileBase* fb; 42 | }; 43 | 44 | } // namespace mbed 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/api/LowPowerTicker.h: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2015 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef MBED_LOWPOWERTICKER_H 17 | #define MBED_LOWPOWERTICKER_H 18 | 19 | #include "platform.h" 20 | #include "Ticker.h" 21 | 22 | #if DEVICE_LOWPOWERTIMER 23 | 24 | #include "lp_ticker_api.h" 25 | 26 | namespace mbed { 27 | 28 | /** Low Power Ticker 29 | */ 30 | class LowPowerTicker : public Ticker { 31 | 32 | public: 33 | LowPowerTicker() : Ticker(get_lp_ticker_data()) { 34 | } 35 | 36 | virtual ~LowPowerTicker() { 37 | } 38 | }; 39 | 40 | } // namespace mbed 41 | 42 | #endif 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/api/LowPowerTimeout.h: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2015 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef MBED_LOWPOWERTIMEOUT_H 17 | #define MBED_LOWPOWERTIMEOUT_H 18 | 19 | #include "platform.h" 20 | 21 | #if DEVICE_LOWPOWERTIMER 22 | 23 | #include "lp_ticker_api.h" 24 | #include "LowPowerTicker.h" 25 | 26 | namespace mbed { 27 | 28 | /** Low Power Timout 29 | */ 30 | class LowPowerTimeout : public LowPowerTicker { 31 | 32 | private: 33 | virtual void handler(void) { 34 | _function.call(); 35 | } 36 | }; 37 | 38 | } 39 | 40 | #endif 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/api/LowPowerTimer.h: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2015 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef MBED_LOWPOWERTIMER_H 17 | #define MBED_LOWPOWERTIMER_H 18 | 19 | #include "platform.h" 20 | #include "Timer.h" 21 | 22 | #if DEVICE_LOWPOWERTIMER 23 | 24 | #include "lp_ticker_api.h" 25 | 26 | namespace mbed { 27 | 28 | /** Low power timer 29 | */ 30 | class LowPowerTimer : public Timer { 31 | 32 | public: 33 | LowPowerTimer() : Timer(get_lp_ticker_data()) { 34 | } 35 | 36 | }; 37 | 38 | } // namespace mbed 39 | 40 | #endif 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/api/Serial.h: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef MBED_SERIAL_H 17 | #define MBED_SERIAL_H 18 | 19 | #include "platform.h" 20 | 21 | #if DEVICE_SERIAL 22 | 23 | #include "Stream.h" 24 | #include "SerialBase.h" 25 | #include "serial_api.h" 26 | 27 | namespace mbed { 28 | 29 | /** A serial port (UART) for communication with other serial devices 30 | * 31 | * Can be used for Full Duplex communication, or Simplex by specifying 32 | * one pin as NC (Not Connected) 33 | * 34 | * Example: 35 | * @code 36 | * // Print "Hello World" to the PC 37 | * 38 | * #include "mbed.h" 39 | * 40 | * Serial pc(USBTX, USBRX); 41 | * 42 | * int main() { 43 | * pc.printf("Hello World\n"); 44 | * } 45 | * @endcode 46 | */ 47 | class Serial : public SerialBase, public Stream { 48 | 49 | public: 50 | #if DEVICE_SERIAL_ASYNCH 51 | using SerialBase::read; 52 | using SerialBase::write; 53 | #endif 54 | 55 | /** Create a Serial port, connected to the specified transmit and receive pins 56 | * 57 | * @param tx Transmit pin 58 | * @param rx Receive pin 59 | * 60 | * @note 61 | * Either tx or rx may be specified as NC if unused 62 | */ 63 | Serial(PinName tx, PinName rx, const char *name=NULL); 64 | 65 | protected: 66 | virtual int _getc(); 67 | virtual int _putc(int c); 68 | }; 69 | 70 | } // namespace mbed 71 | 72 | #endif 73 | 74 | #endif 75 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/api/Stream.h: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef MBED_STREAM_H 17 | #define MBED_STREAM_H 18 | 19 | #include "platform.h" 20 | #include "FileLike.h" 21 | #include 22 | 23 | namespace mbed { 24 | 25 | extern void mbed_set_unbuffered_stream(FILE *_file); 26 | extern int mbed_getc(FILE *_file); 27 | extern char* mbed_gets(char *s, int size, FILE *_file); 28 | 29 | class Stream : public FileLike { 30 | 31 | public: 32 | Stream(const char *name=NULL); 33 | virtual ~Stream(); 34 | 35 | int putc(int c); 36 | int puts(const char *s); 37 | int getc(); 38 | char *gets(char *s, int size); 39 | int printf(const char* format, ...); 40 | int scanf(const char* format, ...); 41 | int vprintf(const char* format, std::va_list args); 42 | int vscanf(const char* format, std::va_list args); 43 | 44 | operator std::FILE*() {return _file;} 45 | 46 | protected: 47 | virtual int close(); 48 | virtual ssize_t write(const void* buffer, size_t length); 49 | virtual ssize_t read(void* buffer, size_t length); 50 | virtual off_t lseek(off_t offset, int whence); 51 | virtual int isatty(); 52 | virtual int fsync(); 53 | virtual off_t flen(); 54 | 55 | virtual int _putc(int c) = 0; 56 | virtual int _getc() = 0; 57 | 58 | std::FILE *_file; 59 | 60 | /* disallow copy constructor and assignment operators */ 61 | private: 62 | Stream(const Stream&); 63 | Stream & operator = (const Stream&); 64 | }; 65 | 66 | } // namespace mbed 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/api/Timeout.h: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef MBED_TIMEOUT_H 17 | #define MBED_TIMEOUT_H 18 | 19 | #include "Ticker.h" 20 | 21 | namespace mbed { 22 | 23 | /** A Timeout is used to call a function at a point in the future 24 | * 25 | * You can use as many seperate Timeout objects as you require. 26 | * 27 | * Example: 28 | * @code 29 | * // Blink until timeout. 30 | * 31 | * #include "mbed.h" 32 | * 33 | * Timeout timeout; 34 | * DigitalOut led(LED1); 35 | * 36 | * int on = 1; 37 | * 38 | * void attimeout() { 39 | * on = 0; 40 | * } 41 | * 42 | * int main() { 43 | * timeout.attach(&attimeout, 5); 44 | * while(on) { 45 | * led = !led; 46 | * wait(0.2); 47 | * } 48 | * } 49 | * @endcode 50 | */ 51 | class Timeout : public Ticker { 52 | 53 | protected: 54 | virtual void handler(); 55 | }; 56 | 57 | } // namespace mbed 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/api/Timer.h: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef MBED_TIMER_H 17 | #define MBED_TIMER_H 18 | 19 | #include "platform.h" 20 | #include "ticker_api.h" 21 | 22 | namespace mbed { 23 | 24 | /** A general purpose timer 25 | * 26 | * Example: 27 | * @code 28 | * // Count the time to toggle a LED 29 | * 30 | * #include "mbed.h" 31 | * 32 | * Timer timer; 33 | * DigitalOut led(LED1); 34 | * int begin, end; 35 | * 36 | * int main() { 37 | * timer.start(); 38 | * begin = timer.read_us(); 39 | * led = !led; 40 | * end = timer.read_us(); 41 | * printf("Toggle the led takes %d us", end - begin); 42 | * } 43 | * @endcode 44 | */ 45 | class Timer { 46 | 47 | public: 48 | Timer(); 49 | Timer(const ticker_data_t *data); 50 | 51 | /** Start the timer 52 | */ 53 | void start(); 54 | 55 | /** Stop the timer 56 | */ 57 | void stop(); 58 | 59 | /** Reset the timer to 0. 60 | * 61 | * If it was already counting, it will continue 62 | */ 63 | void reset(); 64 | 65 | /** Get the time passed in seconds 66 | */ 67 | float read(); 68 | 69 | /** Get the time passed in mili-seconds 70 | */ 71 | int read_ms(); 72 | 73 | /** Get the time passed in micro-seconds 74 | */ 75 | int read_us(); 76 | 77 | #ifdef MBED_OPERATORS 78 | operator float(); 79 | #endif 80 | 81 | protected: 82 | int slicetime(); 83 | int _running; // whether the timer is running 84 | unsigned int _start; // the start time of the latest slice 85 | int _time; // any accumulated time from previous slices 86 | const ticker_data_t *_ticker_data; 87 | }; 88 | 89 | } // namespace mbed 90 | 91 | #endif 92 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/api/TimerEvent.h: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef MBED_TIMEREVENT_H 17 | #define MBED_TIMEREVENT_H 18 | 19 | #include "ticker_api.h" 20 | #include "us_ticker_api.h" 21 | 22 | namespace mbed { 23 | 24 | /** Base abstraction for timer interrupts 25 | */ 26 | class TimerEvent { 27 | public: 28 | TimerEvent(); 29 | TimerEvent(const ticker_data_t *data); 30 | 31 | /** The handler registered with the underlying timer interrupt 32 | */ 33 | static void irq(uint32_t id); 34 | 35 | /** Destruction removes it... 36 | */ 37 | virtual ~TimerEvent(); 38 | 39 | protected: 40 | // The handler called to service the timer event of the derived class 41 | virtual void handler() = 0; 42 | 43 | // insert in to linked list 44 | void insert(timestamp_t timestamp); 45 | 46 | // remove from linked list, if in it 47 | void remove(); 48 | 49 | ticker_event_t event; 50 | 51 | const ticker_data_t *_ticker_data; 52 | }; 53 | 54 | } // namespace mbed 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/api/Transaction.h: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2015 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef MBED_TRANSACTION_H 17 | #define MBED_TRANSACTION_H 18 | 19 | #include "platform.h" 20 | #include "FunctionPointer.h" 21 | 22 | namespace mbed { 23 | 24 | /** Transaction structure 25 | */ 26 | typedef struct { 27 | void *tx_buffer; /**< Tx buffer */ 28 | size_t tx_length; /**< Length of Tx buffer*/ 29 | void *rx_buffer; /**< Rx buffer */ 30 | size_t rx_length; /**< Length of Rx buffer */ 31 | uint32_t event; /**< Event for a transaction */ 32 | event_callback_t callback; /**< User's callback */ 33 | uint8_t width; /**< Buffer's word width (8, 16, 32, 64) */ 34 | } transaction_t; 35 | 36 | /** Transaction class defines a transaction. 37 | */ 38 | template 39 | class Transaction { 40 | public: 41 | Transaction(Class *tpointer, const transaction_t& transaction) : _obj(tpointer), _data(transaction) { 42 | } 43 | 44 | Transaction() : _obj(), _data() { 45 | } 46 | 47 | ~Transaction() { 48 | } 49 | 50 | /** Get object's instance for the transaction 51 | * 52 | * @return The object which was stored 53 | */ 54 | Class* get_object() { 55 | return _obj; 56 | } 57 | 58 | /** Get the transaction 59 | * 60 | * @return The transaction which was stored 61 | */ 62 | transaction_t* get_transaction() { 63 | return &_data; 64 | } 65 | 66 | private: 67 | Class* _obj; 68 | transaction_t _data; 69 | }; 70 | 71 | } 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/api/can_helper.h: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef MBED_CAN_HELPER_H 17 | #define MBED_CAN_HELPER_H 18 | 19 | #if DEVICE_CAN 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | enum CANFormat { 26 | CANStandard = 0, 27 | CANExtended = 1, 28 | CANAny = 2 29 | }; 30 | typedef enum CANFormat CANFormat; 31 | 32 | enum CANType { 33 | CANData = 0, 34 | CANRemote = 1 35 | }; 36 | typedef enum CANType CANType; 37 | 38 | struct CAN_Message { 39 | unsigned int id; // 29 bit identifier 40 | unsigned char data[8]; // Data field 41 | unsigned char len; // Length of data field in bytes 42 | CANFormat format; // 0 - STANDARD, 1- EXTENDED IDENTIFIER 43 | CANType type; // 0 - DATA FRAME, 1 - REMOTE FRAME 44 | }; 45 | typedef struct CAN_Message CAN_Message; 46 | 47 | #ifdef __cplusplus 48 | }; 49 | #endif 50 | 51 | #endif 52 | 53 | #endif // MBED_CAN_HELPER_H 54 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/api/mbed.h: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef MBED_H 17 | #define MBED_H 18 | 19 | #define MBED_LIBRARY_VERSION 120 20 | 21 | #include "platform.h" 22 | 23 | // Useful C libraries 24 | #include 25 | #include 26 | 27 | // mbed Debug libraries 28 | #include "mbed_error.h" 29 | #include "mbed_interface.h" 30 | 31 | // mbed Peripheral components 32 | #include "DigitalIn.h" 33 | #include "DigitalOut.h" 34 | #include "DigitalInOut.h" 35 | #include "BusIn.h" 36 | #include "BusOut.h" 37 | #include "BusInOut.h" 38 | #include "PortIn.h" 39 | #include "PortInOut.h" 40 | #include "PortOut.h" 41 | #include "AnalogIn.h" 42 | #include "AnalogOut.h" 43 | #include "PwmOut.h" 44 | //#include "Serial.h" 45 | #include "SPI.h" 46 | #include "SPISlave.h" 47 | #include "I2C.h" 48 | #include "I2CSlave.h" 49 | #include "Ethernet.h" 50 | #include "CAN.h" 51 | #include "RawSerial.h" 52 | 53 | // mbed Internal components 54 | #include "Timer.h" 55 | #include "Ticker.h" 56 | #include "Timeout.h" 57 | #include "LowPowerTimeout.h" 58 | #include "LowPowerTicker.h" 59 | #include "LowPowerTimer.h" 60 | #include "LocalFileSystem.h" 61 | #include "InterruptIn.h" 62 | #include "wait_api.h" 63 | #include "sleep_api.h" 64 | #include "rtc_time.h" 65 | 66 | using namespace mbed; 67 | using namespace std; 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/api/mbed_assert.h: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef MBED_ASSERT_H 17 | #define MBED_ASSERT_H 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | /** Internal mbed assert function which is invoked when MBED_ASSERT macro failes. 24 | * This function is active only if NDEBUG is not defined prior to including this 25 | * assert header file. 26 | * In case of MBED_ASSERT failing condition, error() is called with the assertation message. 27 | * @param expr Expresion to be checked. 28 | * @param file File where assertation failed. 29 | * @param line Failing assertation line number. 30 | */ 31 | void mbed_assert_internal(const char *expr, const char *file, int line); 32 | 33 | #ifdef __cplusplus 34 | } 35 | #endif 36 | 37 | #ifdef NDEBUG 38 | #define MBED_ASSERT(expr) ((void)0) 39 | 40 | #else 41 | #define MBED_ASSERT(expr) \ 42 | do { \ 43 | if (!(expr)) { \ 44 | mbed_assert_internal(#expr, __FILE__, __LINE__); \ 45 | } \ 46 | } while (0) 47 | #endif 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/api/mbed_debug.h: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef MBED_DEBUG_H 17 | #define MBED_DEBUG_H 18 | #include "device.h" 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | #if DEVICE_STDIO_MESSAGES 25 | #include 26 | #include 27 | 28 | /** Output a debug message 29 | * 30 | * @param format printf-style format string, followed by variables 31 | */ 32 | static inline void debug(const char *format, ...) { 33 | va_list args; 34 | va_start(args, format); 35 | vfprintf(stderr, format, args); 36 | va_end(args); 37 | } 38 | 39 | /** Conditionally output a debug message 40 | * 41 | * NOTE: If the condition is constant false (!= 1) and the compiler optimization 42 | * level is greater than 0, then the whole function will be compiled away. 43 | * 44 | * @param condition output only if condition is true (== 1) 45 | * @param format printf-style format string, followed by variables 46 | */ 47 | static inline void debug_if(int condition, const char *format, ...) { 48 | if (condition == 1) { 49 | va_list args; 50 | va_start(args, format); 51 | vfprintf(stderr, format, args); 52 | va_end(args); 53 | } 54 | } 55 | 56 | #else 57 | static inline void debug(const char *format, ...) {} 58 | static inline void debug_if(int condition, const char *format, ...) {} 59 | 60 | #endif 61 | 62 | #ifdef __cplusplus 63 | } 64 | #endif 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/api/mbed_error.h: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef MBED_ERROR_H 17 | #define MBED_ERROR_H 18 | 19 | /** To generate a fatal compile-time error, you can use the pre-processor #error directive. 20 | * 21 | * @code 22 | * #error "That shouldn't have happened!" 23 | * @endcode 24 | * 25 | * If the compiler evaluates this line, it will report the error and stop the compile. 26 | * 27 | * For example, you could use this to check some user-defined compile-time variables: 28 | * 29 | * @code 30 | * #define NUM_PORTS 7 31 | * #if (NUM_PORTS > 4) 32 | * #error "NUM_PORTS must be less than 4" 33 | * #endif 34 | * @endcode 35 | * 36 | * Reporting Run-Time Errors: 37 | * To generate a fatal run-time error, you can use the mbed error() function. 38 | * 39 | * @code 40 | * error("That shouldn't have happened!"); 41 | * @endcode 42 | * 43 | * If the mbed running the program executes this function, it will print the 44 | * message via the USB serial port, and then die with the blue lights of death! 45 | * 46 | * The message can use printf-style formatting, so you can report variables in the 47 | * message too. For example, you could use this to check a run-time condition: 48 | * 49 | * @code 50 | * if(x >= 5) { 51 | * error("expected x to be less than 5, but got %d", x); 52 | * } 53 | * #endcode 54 | */ 55 | 56 | #ifdef __cplusplus 57 | extern "C" { 58 | #endif 59 | 60 | void error(const char* format, ...); 61 | 62 | #ifdef __cplusplus 63 | } 64 | #endif 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/api/platform.h: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef MBED_PLATFORM_H 17 | #define MBED_PLATFORM_H 18 | 19 | #define MBED_OPERATORS 1 20 | 21 | #include "device.h" 22 | #include "PinNames.h" 23 | #include "PeripheralNames.h" 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/api/toolchain.h: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef MBED_TOOLCHAIN_H 17 | #define MBED_TOOLCHAIN_H 18 | 19 | #if defined(TOOLCHAIN_ARM) 20 | #include 21 | #endif 22 | 23 | #ifndef FILEHANDLE 24 | typedef int FILEHANDLE; 25 | #endif 26 | 27 | #if defined (__ICCARM__) 28 | # define WEAK __weak 29 | # define PACKED __packed 30 | #else 31 | # define WEAK __attribute__((weak)) 32 | # define PACKED __attribute__((packed)) 33 | #endif 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/api/wait_api.h: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef MBED_WAIT_API_H 17 | #define MBED_WAIT_API_H 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | /** Generic wait functions. 24 | * 25 | * These provide simple NOP type wait capabilities. 26 | * 27 | * Example: 28 | * @code 29 | * #include "mbed.h" 30 | * 31 | * DigitalOut heartbeat(LED1); 32 | * 33 | * int main() { 34 | * while (1) { 35 | * heartbeat = 1; 36 | * wait(0.5); 37 | * heartbeat = 0; 38 | * wait(0.5); 39 | * } 40 | * } 41 | */ 42 | 43 | /** Waits for a number of seconds, with microsecond resolution (within 44 | * the accuracy of single precision floating point). 45 | * 46 | * @param s number of seconds to wait 47 | */ 48 | void wait(float s); 49 | 50 | /** Waits a number of milliseconds. 51 | * 52 | * @param ms the whole number of milliseconds to wait 53 | */ 54 | void wait_ms(int ms); 55 | 56 | /** Waits a number of microseconds. 57 | * 58 | * @param us the whole number of microseconds to wait 59 | */ 60 | void wait_us(int us); 61 | 62 | #ifdef __cplusplus 63 | } 64 | #endif 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/common/Ethernet.cpp: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #include "Ethernet.h" 17 | 18 | #if DEVICE_ETHERNET 19 | 20 | #include "ethernet_api.h" 21 | 22 | namespace mbed { 23 | 24 | Ethernet::Ethernet() { 25 | ethernet_init(); 26 | } 27 | 28 | Ethernet::~Ethernet() { 29 | ethernet_free(); 30 | } 31 | 32 | int Ethernet::write(const char *data, int size) { 33 | return ethernet_write(data, size); 34 | } 35 | 36 | int Ethernet::send() { 37 | return ethernet_send(); 38 | } 39 | 40 | int Ethernet::receive() { 41 | return ethernet_receive(); 42 | } 43 | 44 | int Ethernet::read(char *data, int size) { 45 | return ethernet_read(data, size); 46 | } 47 | 48 | void Ethernet::address(char *mac) { 49 | return ethernet_address(mac); 50 | } 51 | 52 | int Ethernet::link() { 53 | return ethernet_link(); 54 | } 55 | 56 | void Ethernet::set_link(Mode mode) { 57 | int speed = -1; 58 | int duplex = 0; 59 | 60 | switch(mode) { 61 | case AutoNegotiate : speed = -1; duplex = 0; break; 62 | case HalfDuplex10 : speed = 0; duplex = 0; break; 63 | case FullDuplex10 : speed = 0; duplex = 1; break; 64 | case HalfDuplex100 : speed = 1; duplex = 0; break; 65 | case FullDuplex100 : speed = 1; duplex = 1; break; 66 | } 67 | 68 | ethernet_set_link(speed, duplex); 69 | } 70 | 71 | } // namespace mbed 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/common/FileLike.cpp: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #include "FileLike.h" 17 | 18 | namespace mbed { 19 | 20 | FileLike::FileLike(const char *name) : FileHandle(), FileBase(name, FilePathType) { 21 | 22 | } 23 | 24 | FileLike::~FileLike() { 25 | 26 | } 27 | 28 | } // namespace mbed 29 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/common/FilePath.cpp: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #include "FilePath.h" 17 | 18 | namespace mbed { 19 | 20 | FilePath::FilePath(const char* file_path) : file_name(NULL), fb(NULL) { 21 | if ((file_path[0] != '/') || (file_path[1] == 0)) return; 22 | 23 | const char* file_system = &file_path[1]; 24 | file_name = file_system; 25 | int len = 0; 26 | while (true) { 27 | char c = *file_name; 28 | if (c == '/') { // end of object name 29 | file_name++; // point to one char after the '/' 30 | break; 31 | } 32 | if (c == 0) { // end of object name, with no filename 33 | break; 34 | } 35 | len++; 36 | file_name++; 37 | } 38 | 39 | fb = FileBase::lookup(file_system, len); 40 | } 41 | 42 | const char* FilePath::fileName(void) { 43 | return file_name; 44 | } 45 | 46 | bool FilePath::isFileSystem(void) { 47 | if (NULL == fb) 48 | return false; 49 | return (fb->getPathType() == FileSystemPathType); 50 | } 51 | 52 | FileSystemLike* FilePath::fileSystem(void) { 53 | if (isFileSystem()) { 54 | return (FileSystemLike*)fb; 55 | } 56 | return NULL; 57 | } 58 | 59 | bool FilePath::isFile(void) { 60 | if (NULL == fb) 61 | return false; 62 | return (fb->getPathType() == FilePathType); 63 | } 64 | 65 | FileLike* FilePath::file(void) { 66 | if (isFile()) { 67 | return (FileLike*)fb; 68 | } 69 | return NULL; 70 | } 71 | 72 | bool FilePath::exists(void) { 73 | return fb != NULL; 74 | } 75 | 76 | } // namespace mbed 77 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/common/FileSystemLike.cpp: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #include "FileSystemLike.h" 17 | 18 | namespace mbed { 19 | 20 | class BaseDirHandle : public DirHandle { 21 | public: 22 | /* 23 | We keep track of our current location as the n'th object in the 24 | FileSystemLike list. Using a Base* instead would cause problems if that 25 | object were to be destroyed between readdirs. 26 | Using this method does mean though that destroying/creating objects can 27 | give unusual results from readdir. 28 | */ 29 | off_t n; 30 | struct dirent cur_entry; 31 | 32 | BaseDirHandle() : n(0), cur_entry() { 33 | } 34 | 35 | virtual int closedir() { 36 | delete this; 37 | return 0; 38 | } 39 | 40 | virtual struct dirent *readdir() { 41 | FileBase *ptr = FileBase::get(n); 42 | if (ptr == NULL) return NULL; 43 | 44 | /* Increment n, so next readdir gets the next item */ 45 | n++; 46 | 47 | /* Setup cur entry and return a pointer to it */ 48 | std::strncpy(cur_entry.d_name, ptr->getName(), NAME_MAX); 49 | return &cur_entry; 50 | } 51 | 52 | virtual off_t telldir() { 53 | return n; 54 | } 55 | 56 | virtual void seekdir(off_t offset) { 57 | n = offset; 58 | } 59 | 60 | virtual void rewinddir() { 61 | n = 0; 62 | } 63 | }; 64 | 65 | FileSystemLike::FileSystemLike(const char *name) : FileBase(name, FileSystemPathType) { 66 | 67 | } 68 | 69 | FileSystemLike::~FileSystemLike() { 70 | 71 | } 72 | 73 | DirHandle *FileSystemLike::opendir() { 74 | return new BaseDirHandle(); 75 | } 76 | 77 | } // namespace mbed 78 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/common/I2CSlave.cpp: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #include "I2CSlave.h" 17 | 18 | #if DEVICE_I2CSLAVE 19 | 20 | namespace mbed { 21 | 22 | I2CSlave::I2CSlave(PinName sda, PinName scl) : _i2c() { 23 | i2c_init(&_i2c, sda, scl); 24 | i2c_frequency(&_i2c, 100000); 25 | i2c_slave_mode(&_i2c, 1); 26 | } 27 | 28 | void I2CSlave::frequency(int hz) { 29 | i2c_frequency(&_i2c, hz); 30 | } 31 | 32 | void I2CSlave::address(int address) { 33 | int addr = (address & 0xFF) | 1; 34 | i2c_slave_address(&_i2c, 0, addr, 0); 35 | } 36 | 37 | int I2CSlave::receive(void) { 38 | return i2c_slave_receive(&_i2c); 39 | } 40 | 41 | int I2CSlave::read(char *data, int length) { 42 | return i2c_slave_read(&_i2c, data, length) != length; 43 | } 44 | 45 | int I2CSlave::read(void) { 46 | return i2c_byte_read(&_i2c, 0); 47 | } 48 | 49 | int I2CSlave::write(const char *data, int length) { 50 | return i2c_slave_write(&_i2c, data, length) != length; 51 | } 52 | 53 | int I2CSlave::write(int data) { 54 | return i2c_byte_write(&_i2c, data); 55 | } 56 | 57 | void I2CSlave::stop(void) { 58 | i2c_stop(&_i2c); 59 | } 60 | 61 | } 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/common/RawSerial.cpp: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #include "RawSerial.h" 17 | #include "wait_api.h" 18 | #include 19 | 20 | #if DEVICE_SERIAL 21 | 22 | #define STRING_STACK_LIMIT 120 23 | 24 | namespace mbed { 25 | 26 | RawSerial::RawSerial(PinName tx, PinName rx) : SerialBase(tx, rx) { 27 | } 28 | 29 | int RawSerial::getc() { 30 | return _base_getc(); 31 | } 32 | 33 | int RawSerial::putc(int c) { 34 | return _base_putc(c); 35 | } 36 | 37 | int RawSerial::puts(const char *str) { 38 | while (*str) 39 | putc(*str ++); 40 | return 0; 41 | } 42 | 43 | // Experimental support for printf in RawSerial. No Stream inheritance 44 | // means we can't call printf() directly, so we use sprintf() instead. 45 | // We only call malloc() for the sprintf() buffer if the buffer 46 | // length is above a certain threshold, otherwise we use just the stack. 47 | int RawSerial::printf(const char *format, ...) { 48 | std::va_list arg; 49 | va_start(arg, format); 50 | // ARMCC microlib does not properly handle a size of 0. 51 | // As a workaround supply a dummy buffer with a size of 1. 52 | char dummy_buf[1]; 53 | int len = vsnprintf(dummy_buf, sizeof(dummy_buf), format, arg); 54 | if (len < STRING_STACK_LIMIT) { 55 | char temp[STRING_STACK_LIMIT]; 56 | vsprintf(temp, format, arg); 57 | puts(temp); 58 | } else { 59 | char *temp = new char[len + 1]; 60 | vsprintf(temp, format, arg); 61 | puts(temp); 62 | delete[] temp; 63 | } 64 | va_end(arg); 65 | return len; 66 | } 67 | 68 | } // namespace mbed 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/common/SPISlave.cpp: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #include "SPISlave.h" 17 | 18 | #if DEVICE_SPISLAVE 19 | 20 | namespace mbed { 21 | 22 | SPISlave::SPISlave(PinName mosi, PinName miso, PinName sclk, PinName ssel) : 23 | _spi(), 24 | _bits(8), 25 | _mode(0), 26 | _hz(1000000) 27 | { 28 | spi_init(&_spi, mosi, miso, sclk, ssel); 29 | spi_format(&_spi, _bits, _mode, 1); 30 | spi_frequency(&_spi, _hz); 31 | } 32 | 33 | void SPISlave::format(int bits, int mode) { 34 | _bits = bits; 35 | _mode = mode; 36 | spi_format(&_spi, _bits, _mode, 1); 37 | } 38 | 39 | void SPISlave::frequency(int hz) { 40 | _hz = hz; 41 | spi_frequency(&_spi, _hz); 42 | } 43 | 44 | int SPISlave::receive(void) { 45 | return(spi_slave_receive(&_spi)); 46 | } 47 | 48 | int SPISlave::read(void) { 49 | return(spi_slave_read(&_spi)); 50 | } 51 | 52 | void SPISlave::reply(int value) { 53 | spi_slave_write(&_spi, value); 54 | } 55 | 56 | } // namespace mbed 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/common/Serial.cpp: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #include "Serial.h" 17 | #include "wait_api.h" 18 | 19 | #if DEVICE_SERIAL 20 | 21 | namespace mbed { 22 | 23 | Serial::Serial(PinName tx, PinName rx, const char *name) : SerialBase(tx, rx), Stream(name) { 24 | } 25 | 26 | int Serial::_getc() { 27 | return _base_getc(); 28 | } 29 | 30 | int Serial::_putc(int c) { 31 | return _base_putc(c); 32 | } 33 | 34 | } // namespace mbed 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/common/Ticker.cpp: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #include "Ticker.h" 17 | 18 | #include "TimerEvent.h" 19 | #include "FunctionPointer.h" 20 | #include "ticker_api.h" 21 | 22 | namespace mbed { 23 | 24 | void Ticker::detach() { 25 | remove(); 26 | _function.attach(0); 27 | } 28 | 29 | void Ticker::setup(timestamp_t t) { 30 | remove(); 31 | _delay = t; 32 | insert(_delay + ticker_read(_ticker_data)); 33 | } 34 | 35 | void Ticker::handler() { 36 | insert(event.timestamp + _delay); 37 | _function.call(); 38 | } 39 | 40 | } // namespace mbed 41 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/common/Timeout.cpp: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #include "Timeout.h" 17 | 18 | namespace mbed { 19 | 20 | void Timeout::handler() { 21 | _function.call(); 22 | } 23 | 24 | } // namespace mbed 25 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/common/Timer.cpp: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #include "Timer.h" 17 | #include "ticker_api.h" 18 | #include "us_ticker_api.h" 19 | 20 | namespace mbed { 21 | 22 | Timer::Timer() : _running(), _start(), _time(), _ticker_data(get_us_ticker_data()) { 23 | reset(); 24 | } 25 | 26 | Timer::Timer(const ticker_data_t *data) : _running(), _start(), _time(), _ticker_data(data) { 27 | reset(); 28 | } 29 | 30 | void Timer::start() { 31 | if (!_running) { 32 | _start = ticker_read(_ticker_data); 33 | _running = 1; 34 | } 35 | } 36 | 37 | void Timer::stop() { 38 | _time += slicetime(); 39 | _running = 0; 40 | } 41 | 42 | int Timer::read_us() { 43 | return _time + slicetime(); 44 | } 45 | 46 | float Timer::read() { 47 | return (float)read_us() / 1000000.0f; 48 | } 49 | 50 | int Timer::read_ms() { 51 | return read_us() / 1000; 52 | } 53 | 54 | int Timer::slicetime() { 55 | if (_running) { 56 | return ticker_read(_ticker_data) - _start; 57 | } else { 58 | return 0; 59 | } 60 | } 61 | 62 | void Timer::reset() { 63 | _start = ticker_read(_ticker_data); 64 | _time = 0; 65 | } 66 | 67 | #ifdef MBED_OPERATORS 68 | Timer::operator float() { 69 | return read(); 70 | } 71 | #endif 72 | 73 | } // namespace mbed 74 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/common/TimerEvent.cpp: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #include "TimerEvent.h" 17 | #include "cmsis.h" 18 | 19 | #include 20 | #include "ticker_api.h" 21 | #include "us_ticker_api.h" 22 | 23 | namespace mbed { 24 | 25 | TimerEvent::TimerEvent() : event(), _ticker_data(get_us_ticker_data()) { 26 | ticker_set_handler(_ticker_data, (&TimerEvent::irq)); 27 | } 28 | 29 | TimerEvent::TimerEvent(const ticker_data_t *data) : event(), _ticker_data(data) { 30 | ticker_set_handler(_ticker_data, (&TimerEvent::irq)); 31 | } 32 | 33 | void TimerEvent::irq(uint32_t id) { 34 | TimerEvent *timer_event = (TimerEvent*)id; 35 | timer_event->handler(); 36 | } 37 | 38 | TimerEvent::~TimerEvent() { 39 | remove(); 40 | } 41 | 42 | // insert in to linked list 43 | void TimerEvent::insert(timestamp_t timestamp) { 44 | ticker_insert_event(_ticker_data, &event, timestamp, (uint32_t)this); 45 | } 46 | 47 | void TimerEvent::remove() { 48 | ticker_remove_event(_ticker_data, &event); 49 | } 50 | 51 | } // namespace mbed 52 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/common/assert.c: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #include "mbed_assert.h" 17 | #include "mbed_error.h" 18 | 19 | void mbed_assert_internal(const char *expr, const char *file, int line) 20 | { 21 | error("mbed assertation failed: %s, file: %s, line %d \n", expr, file, line); 22 | } 23 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/common/board.c: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #include "gpio_api.h" 17 | #include "wait_api.h" 18 | #include "toolchain.h" 19 | #include "mbed_interface.h" 20 | 21 | WEAK void mbed_die(void) { 22 | #if !defined (NRF51_H) && !defined(TARGET_EFM32) 23 | __disable_irq(); // dont allow interrupts to disturb the flash pattern 24 | #endif 25 | #if (DEVICE_ERROR_RED == 1) 26 | gpio_t led_red; gpio_init_out(&led_red, LED_RED); 27 | #elif (DEVICE_ERROR_PATTERN == 1) 28 | gpio_t led_1; gpio_init_out(&led_1, LED1); 29 | gpio_t led_2; gpio_init_out(&led_2, LED2); 30 | gpio_t led_3; gpio_init_out(&led_3, LED3); 31 | gpio_t led_4; gpio_init_out(&led_4, LED4); 32 | #endif 33 | 34 | while (1) { 35 | #if (DEVICE_ERROR_RED == 1) 36 | gpio_write(&led_red, 1); 37 | 38 | #elif (DEVICE_ERROR_PATTERN == 1) 39 | gpio_write(&led_1, 1); 40 | gpio_write(&led_2, 0); 41 | gpio_write(&led_3, 0); 42 | gpio_write(&led_4, 1); 43 | #endif 44 | 45 | wait_ms(150); 46 | 47 | #if (DEVICE_ERROR_RED == 1) 48 | gpio_write(&led_red, 0); 49 | 50 | #elif (DEVICE_ERROR_PATTERN == 1) 51 | gpio_write(&led_1, 0); 52 | gpio_write(&led_2, 1); 53 | gpio_write(&led_3, 1); 54 | gpio_write(&led_4, 0); 55 | #endif 56 | 57 | wait_ms(150); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/common/error.c: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #include 17 | #include 18 | #include "device.h" 19 | #include "toolchain.h" 20 | #include "mbed_error.h" 21 | #if DEVICE_STDIO_MESSAGES 22 | #include 23 | #endif 24 | 25 | WEAK void error(const char* format, ...) { 26 | #if DEVICE_STDIO_MESSAGES 27 | va_list arg; 28 | va_start(arg, format); 29 | vfprintf(stderr, format, arg); 30 | va_end(arg); 31 | #endif 32 | exit(1); 33 | } 34 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/common/gpio.c: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #include "gpio_api.h" 17 | 18 | static inline void _gpio_init_in(gpio_t* gpio, PinName pin, PinMode mode) 19 | { 20 | gpio_init(gpio, pin); 21 | if (pin != NC) { 22 | gpio_dir(gpio, PIN_INPUT); 23 | gpio_mode(gpio, mode); 24 | } 25 | } 26 | 27 | static inline void _gpio_init_out(gpio_t* gpio, PinName pin, PinMode mode, int value) 28 | { 29 | gpio_init(gpio, pin); 30 | if (pin != NC) { 31 | gpio_write(gpio, value); 32 | gpio_dir(gpio, PIN_OUTPUT); 33 | gpio_mode(gpio, mode); 34 | } 35 | } 36 | 37 | void gpio_init_in(gpio_t* gpio, PinName pin) { 38 | gpio_init_in_ex(gpio, pin, PullDefault); 39 | } 40 | 41 | void gpio_init_in_ex(gpio_t* gpio, PinName pin, PinMode mode) { 42 | _gpio_init_in(gpio, pin, mode); 43 | } 44 | 45 | void gpio_init_out(gpio_t* gpio, PinName pin) { 46 | gpio_init_out_ex(gpio, pin, 0); 47 | } 48 | 49 | void gpio_init_out_ex(gpio_t* gpio, PinName pin, int value) { 50 | _gpio_init_out(gpio, pin, PullNone, value); 51 | } 52 | 53 | void gpio_init_inout(gpio_t* gpio, PinName pin, PinDirection direction, PinMode mode, int value) { 54 | if (direction == PIN_INPUT) { 55 | _gpio_init_in(gpio, pin, mode); 56 | if (pin != NC) 57 | gpio_write(gpio, value); // we prepare the value in case it is switched later 58 | } else { 59 | _gpio_init_out(gpio, pin, mode, value); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/common/lp_ticker_api.c: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2015 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #include "lp_ticker_api.h" 17 | 18 | #if DEVICE_LOWPOWERTIMER 19 | 20 | static ticker_event_queue_t events; 21 | 22 | static const ticker_interface_t lp_interface = { 23 | .init = lp_ticker_init, 24 | .read = lp_ticker_read, 25 | .disable_interrupt = lp_ticker_disable_interrupt, 26 | .clear_interrupt = lp_ticker_clear_interrupt, 27 | .set_interrupt = lp_ticker_set_interrupt, 28 | }; 29 | 30 | static const ticker_data_t lp_data = { 31 | .interface = &lp_interface, 32 | .queue = &events, 33 | }; 34 | 35 | const ticker_data_t* get_lp_ticker_data(void) 36 | { 37 | return &lp_data; 38 | } 39 | 40 | void lp_ticker_irq_handler(void) 41 | { 42 | ticker_irq_handler(&lp_data); 43 | } 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/common/us_ticker_api.c: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2015 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #include "us_ticker_api.h" 17 | 18 | static ticker_event_queue_t events; 19 | 20 | static const ticker_interface_t us_interface = { 21 | .init = us_ticker_init, 22 | .read = us_ticker_read, 23 | .disable_interrupt = us_ticker_disable_interrupt, 24 | .clear_interrupt = us_ticker_clear_interrupt, 25 | .set_interrupt = us_ticker_set_interrupt, 26 | }; 27 | 28 | static const ticker_data_t us_data = { 29 | .interface = &us_interface, 30 | .queue = &events, 31 | }; 32 | 33 | const ticker_data_t* get_us_ticker_data(void) 34 | { 35 | return &us_data; 36 | } 37 | 38 | void us_ticker_irq_handler(void) 39 | { 40 | ticker_irq_handler(&us_data); 41 | } 42 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/common/wait_api.c: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #include "wait_api.h" 17 | #include "us_ticker_api.h" 18 | 19 | void wait(float s) { 20 | wait_us(s * 1000000.0f); 21 | } 22 | 23 | void wait_ms(int ms) { 24 | wait_us(ms * 1000); 25 | } 26 | 27 | void wait_us(int us) { 28 | uint32_t start = us_ticker_read(); 29 | while ((us_ticker_read() - start) < (uint32_t)us); 30 | } 31 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/hal/analogin_api.h: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef MBED_ANALOGIN_API_H 17 | #define MBED_ANALOGIN_API_H 18 | 19 | #include "device.h" 20 | 21 | #if DEVICE_ANALOGIN 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | typedef struct analogin_s analogin_t; 28 | 29 | void analogin_init (analogin_t *obj, PinName pin); 30 | float analogin_read (analogin_t *obj); 31 | uint16_t analogin_read_u16(analogin_t *obj); 32 | 33 | #ifdef __cplusplus 34 | } 35 | #endif 36 | 37 | #endif 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/hal/analogout_api.h: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef MBED_ANALOGOUT_API_H 17 | #define MBED_ANALOGOUT_API_H 18 | 19 | #include "device.h" 20 | 21 | #if DEVICE_ANALOGOUT 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | typedef struct dac_s dac_t; 28 | 29 | void analogout_init (dac_t *obj, PinName pin); 30 | void analogout_free (dac_t *obj); 31 | void analogout_write (dac_t *obj, float value); 32 | void analogout_write_u16(dac_t *obj, uint16_t value); 33 | float analogout_read (dac_t *obj); 34 | uint16_t analogout_read_u16 (dac_t *obj); 35 | 36 | #ifdef __cplusplus 37 | } 38 | #endif 39 | 40 | #endif 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/hal/buffer.h: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2014-2015 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef MBED_BUFFER_H 17 | #define MBED_BUFFER_H 18 | 19 | #include 20 | 21 | /** Generic buffer structure 22 | */ 23 | typedef struct buffer_s { 24 | void *buffer; /**< the pointer to a buffer */ 25 | size_t length; /**< the buffer length */ 26 | size_t pos; /**< actual buffer position */ 27 | uint8_t width; /**< The buffer unit width (8, 16, 32, 64), used for proper *buffer casting */ 28 | } buffer_t; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/hal/dma_api.h: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2014-2015 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef MBED_DMA_API_H 17 | #define MBED_DMA_API_H 18 | 19 | #include 20 | 21 | #define DMA_ERROR_OUT_OF_CHANNELS (-1) 22 | 23 | typedef enum { 24 | DMA_USAGE_NEVER, 25 | DMA_USAGE_OPPORTUNISTIC, 26 | DMA_USAGE_ALWAYS, 27 | DMA_USAGE_TEMPORARY_ALLOCATED, 28 | DMA_USAGE_ALLOCATED 29 | } DMAUsage; 30 | 31 | #ifdef __cplusplus 32 | extern "C" { 33 | #endif 34 | 35 | void dma_init(void); 36 | 37 | int dma_channel_allocate(uint32_t capabilities); 38 | 39 | int dma_channel_free(int channelid); 40 | 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/hal/ethernet_api.h: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef MBED_ETHERNET_API_H 17 | #define MBED_ETHERNET_API_H 18 | 19 | #include "device.h" 20 | 21 | #if DEVICE_ETHERNET 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | // Connection constants 28 | 29 | int ethernet_init(void); 30 | void ethernet_free(void); 31 | 32 | // write size bytes from data to ethernet buffer 33 | // return num bytes written 34 | // or -1 if size is too big 35 | int ethernet_write(const char *data, int size); 36 | 37 | // send ethernet write buffer, returning the packet size sent 38 | int ethernet_send(void); 39 | 40 | // recieve from ethernet buffer, returning packet size, or 0 if no packet 41 | int ethernet_receive(void); 42 | 43 | // read size bytes in to data, return actual num bytes read (0..size) 44 | // if data == NULL, throw the bytes away 45 | int ethernet_read(char *data, int size); 46 | 47 | // get the ethernet address 48 | void ethernet_address(char *mac); 49 | 50 | // see if the link is up 51 | int ethernet_link(void); 52 | 53 | // force link settings 54 | void ethernet_set_link(int speed, int duplex); 55 | 56 | #ifdef __cplusplus 57 | } 58 | #endif 59 | 60 | #endif 61 | 62 | #endif 63 | 64 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/hal/gpio_api.h: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef MBED_GPIO_API_H 17 | #define MBED_GPIO_API_H 18 | 19 | #include "device.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | /* Set the given pin as GPIO 26 | * @param pin The pin to be set as GPIO 27 | * @return The GPIO port mask for this pin 28 | **/ 29 | uint32_t gpio_set(PinName pin); 30 | 31 | /* Checks if gpio object is connected (pin was not initialized with NC) 32 | * @param pin The pin to be set as GPIO 33 | * @return 0 if port is initialized with NC 34 | **/ 35 | int gpio_is_connected(const gpio_t *obj); 36 | 37 | /* GPIO object */ 38 | void gpio_init(gpio_t *obj, PinName pin); 39 | 40 | void gpio_mode (gpio_t *obj, PinMode mode); 41 | void gpio_dir (gpio_t *obj, PinDirection direction); 42 | 43 | void gpio_write(gpio_t *obj, int value); 44 | int gpio_read (gpio_t *obj); 45 | 46 | // the following set of functions are generic and are implemented in the common gpio.c file 47 | void gpio_init_in(gpio_t* gpio, PinName pin); 48 | void gpio_init_in_ex(gpio_t* gpio, PinName pin, PinMode mode); 49 | void gpio_init_out(gpio_t* gpio, PinName pin); 50 | void gpio_init_out_ex(gpio_t* gpio, PinName pin, int value); 51 | void gpio_init_inout(gpio_t* gpio, PinName pin, PinDirection direction, PinMode mode, int value); 52 | 53 | #ifdef __cplusplus 54 | } 55 | #endif 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/hal/gpio_irq_api.h: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef MBED_GPIO_IRQ_API_H 17 | #define MBED_GPIO_IRQ_API_H 18 | 19 | #include "device.h" 20 | 21 | #if DEVICE_INTERRUPTIN 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | typedef enum { 28 | IRQ_NONE, 29 | IRQ_RISE, 30 | IRQ_FALL 31 | } gpio_irq_event; 32 | 33 | typedef struct gpio_irq_s gpio_irq_t; 34 | 35 | typedef void (*gpio_irq_handler)(uint32_t id, gpio_irq_event event); 36 | 37 | int gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uint32_t id); 38 | void gpio_irq_free(gpio_irq_t *obj); 39 | void gpio_irq_set (gpio_irq_t *obj, gpio_irq_event event, uint32_t enable); 40 | void gpio_irq_enable(gpio_irq_t *obj); 41 | void gpio_irq_disable(gpio_irq_t *obj); 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | #endif 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/hal/lp_ticker_api.h: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2015 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef MBED_LPTICKER_API_H 17 | #define MBED_LPTICKER_API_H 18 | 19 | #include "device.h" 20 | 21 | #if DEVICE_LOWPOWERTIMER 22 | 23 | #include "ticker_api.h" 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | /** 30 | * \defgroup LpTicker Low Power Ticker Functions 31 | * @{ 32 | */ 33 | 34 | /** Get low power ticker's data 35 | * 36 | * @return The low power ticker data 37 | */ 38 | const ticker_data_t* get_lp_ticker_data(void); 39 | 40 | /** The wrapper for ticker_irq_handler, to pass lp ticker's data 41 | * 42 | */ 43 | void lp_ticker_irq_handler(void); 44 | 45 | /* HAL lp ticker */ 46 | 47 | /** Initialize the low power ticker 48 | * 49 | */ 50 | void lp_ticker_init(void); 51 | 52 | /** Read the current counter 53 | * 54 | * @return The current timer's counter value in microseconds 55 | */ 56 | uint32_t lp_ticker_read(void); 57 | 58 | /** Set interrupt for specified timestamp 59 | * 60 | * @param timestamp The time in microseconds to be set 61 | */ 62 | void lp_ticker_set_interrupt(timestamp_t timestamp); 63 | 64 | /** Disable low power ticker interrupt 65 | * 66 | */ 67 | void lp_ticker_disable_interrupt(void); 68 | 69 | /** Clear the low power ticker interrupt 70 | * 71 | */ 72 | void lp_ticker_clear_interrupt(void); 73 | 74 | /**@}*/ 75 | 76 | #ifdef __cplusplus 77 | } 78 | #endif 79 | 80 | #endif 81 | 82 | #endif 83 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/hal/pinmap.h: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef MBED_PINMAP_H 17 | #define MBED_PINMAP_H 18 | 19 | #include "PinNames.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct { 26 | PinName pin; 27 | int peripheral; 28 | int function; 29 | } PinMap; 30 | 31 | void pin_function(PinName pin, int function); 32 | void pin_mode (PinName pin, PinMode mode); 33 | 34 | uint32_t pinmap_peripheral(PinName pin, const PinMap* map); 35 | uint32_t pinmap_function(PinName pin, const PinMap* map); 36 | uint32_t pinmap_merge (uint32_t a, uint32_t b); 37 | void pinmap_pinout (PinName pin, const PinMap *map); 38 | uint32_t pinmap_find_peripheral(PinName pin, const PinMap* map); 39 | uint32_t pinmap_find_function(PinName pin, const PinMap* map); 40 | 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/hal/port_api.h: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef MBED_PORTMAP_H 17 | #define MBED_PORTMAP_H 18 | 19 | #include "device.h" 20 | 21 | #if DEVICE_PORTIN || DEVICE_PORTOUT 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | typedef struct port_s port_t; 28 | 29 | PinName port_pin(PortName port, int pin_n); 30 | 31 | void port_init (port_t *obj, PortName port, int mask, PinDirection dir); 32 | void port_mode (port_t *obj, PinMode mode); 33 | void port_dir (port_t *obj, PinDirection dir); 34 | void port_write(port_t *obj, int value); 35 | int port_read (port_t *obj); 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | #endif 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/hal/pwmout_api.h: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef MBED_PWMOUT_API_H 17 | #define MBED_PWMOUT_API_H 18 | 19 | #include "device.h" 20 | 21 | #if DEVICE_PWMOUT 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | typedef struct pwmout_s pwmout_t; 28 | 29 | void pwmout_init (pwmout_t* obj, PinName pin); 30 | void pwmout_free (pwmout_t* obj); 31 | 32 | void pwmout_write (pwmout_t* obj, float percent); 33 | float pwmout_read (pwmout_t* obj); 34 | 35 | void pwmout_period (pwmout_t* obj, float seconds); 36 | void pwmout_period_ms (pwmout_t* obj, int ms); 37 | void pwmout_period_us (pwmout_t* obj, int us); 38 | 39 | void pwmout_pulsewidth (pwmout_t* obj, float seconds); 40 | void pwmout_pulsewidth_ms(pwmout_t* obj, int ms); 41 | void pwmout_pulsewidth_us(pwmout_t* obj, int us); 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | #endif 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/hal/rtc_api.h: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef MBED_RTC_API_H 17 | #define MBED_RTC_API_H 18 | 19 | #include "device.h" 20 | 21 | #if DEVICE_RTC 22 | 23 | #include 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | void rtc_init(void); 30 | void rtc_free(void); 31 | int rtc_isenabled(void); 32 | 33 | time_t rtc_read(void); 34 | void rtc_write(time_t t); 35 | 36 | #ifdef __cplusplus 37 | } 38 | #endif 39 | 40 | #endif 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/hal/us_ticker_api.h: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2015 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef MBED_US_TICKER_API_H 17 | #define MBED_US_TICKER_API_H 18 | 19 | #include 20 | #include "ticker_api.h" 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | /** 27 | * \defgroup UsTicker Microseconds Ticker Functions 28 | * @{ 29 | */ 30 | 31 | /** Get ticker's data 32 | * 33 | * @return The low power ticker data 34 | */ 35 | const ticker_data_t* get_us_ticker_data(void); 36 | 37 | 38 | /** The wrapper for ticker_irq_handler, to pass us ticker's data 39 | * 40 | */ 41 | void us_ticker_irq_handler(void); 42 | 43 | /* HAL us ticker */ 44 | 45 | /** Initialize the ticker 46 | * 47 | */ 48 | void us_ticker_init(void); 49 | 50 | /** Read the current counter 51 | * 52 | * @return The current timer's counter value in microseconds 53 | */ 54 | uint32_t us_ticker_read(void); 55 | 56 | /** Set interrupt for specified timestamp 57 | * 58 | * @param timestamp The time in microseconds to be set 59 | */ 60 | void us_ticker_set_interrupt(timestamp_t timestamp); 61 | 62 | /** Disable us ticker interrupt 63 | * 64 | */ 65 | void us_ticker_disable_interrupt(void); 66 | 67 | /** Clear us ticker interrupt 68 | * 69 | */ 70 | void us_ticker_clear_interrupt(void); 71 | 72 | /**@}*/ 73 | 74 | #ifdef __cplusplus 75 | } 76 | #endif 77 | 78 | #endif 79 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/module.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mbed-classic", 3 | "version": "0.0.1", 4 | "description": "mbed core SDK (for mbed 2.0, *not* mbedOS)", 5 | "keywords": [ 6 | "mbed" 7 | ], 8 | "author": "Bogdan Marinescu ", 9 | "repository": { 10 | "url": "git@github.com:mbedmicro/mbed.git", 11 | "type": "git" 12 | }, 13 | "homepage": "https://github.com/mbedmicro/mbed", 14 | "licenses": [ 15 | { 16 | "url": "https://spdx.org/licenses/Apache-2.0", 17 | "type": "Apache-2.0" 18 | } 19 | ], 20 | "extraIncludes": [ 21 | "api", 22 | "hal", 23 | "targets/hal", 24 | "targets/cmsis" 25 | ], 26 | "dependencies": { 27 | }, 28 | "targetDependencies": { 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/targets/cmsis/TARGET_NORDIC/TARGET_MCU_NRF51822/cmsis.h: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library - CMSIS 2 | * Copyright (C) 2009-2011 ARM Limited. All rights reserved. 3 | * 4 | * A generic CMSIS include header, pulling in LPC407x_8x specifics 5 | */ 6 | 7 | #ifndef MBED_CMSIS_H 8 | #define MBED_CMSIS_H 9 | 10 | #include "nrf.h" 11 | #include "cmsis_nvic.h" 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/targets/cmsis/TARGET_NORDIC/TARGET_MCU_NRF51822/nrf.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2013, Nordic Semiconductor ASA 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * list of conditions and the following disclaimer. 9 | * 10 | * * Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * * Neither the name of Nordic Semiconductor ASA nor the names of its 15 | * contributors may be used to endorse or promote products derived from 16 | * this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | */ 30 | #ifndef NRF_H 31 | #define NRF_H 32 | 33 | #ifndef _WIN32 34 | 35 | /* Family selection for main includes. NRF51 must be selected. */ 36 | #ifdef NRF51 37 | #include "nrf51.h" 38 | #include "nrf51_bitfields.h" 39 | #else 40 | #error "Device family must be defined. See nrf.h." 41 | #endif /* NRF51 */ 42 | 43 | #include "compiler_abstraction.h" 44 | 45 | #endif /* _WIN32 */ 46 | 47 | #endif /* NRF_H */ 48 | 49 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/targets/cmsis/TARGET_NORDIC/TARGET_MCU_NRF51822/nrf_delay.h: -------------------------------------------------------------------------------- 1 | #ifndef _NRF_DELAY_H 2 | #define _NRF_DELAY_H 3 | 4 | // #include "nrf.h" 5 | 6 | /*lint --e{438, 522} "Variable not used" "Function lacks side-effects" */ 7 | #if defined ( __CC_ARM ) 8 | static __ASM void __INLINE nrf_delay_us(uint32_t volatile number_of_us) 9 | { 10 | loop 11 | SUBS R0, R0, #1 12 | NOP 13 | NOP 14 | NOP 15 | NOP 16 | NOP 17 | NOP 18 | NOP 19 | NOP 20 | NOP 21 | NOP 22 | NOP 23 | NOP 24 | BNE loop 25 | BX LR 26 | } 27 | #elif defined ( __ICCARM__ ) 28 | static void __INLINE nrf_delay_us(uint32_t volatile number_of_us) 29 | { 30 | __ASM ( 31 | "loop:\n\t" 32 | " SUBS R0, R0, #1\n\t" 33 | " NOP\n\t" 34 | " NOP\n\t" 35 | " NOP\n\t" 36 | " NOP\n\t" 37 | " NOP\n\t" 38 | " NOP\n\t" 39 | " NOP\n\t" 40 | " NOP\n\t" 41 | " NOP\n\t" 42 | " NOP\n\t" 43 | " NOP\n\t" 44 | " NOP\n\t" 45 | " BNE loop\n\t"); 46 | } 47 | #elif defined ( __GNUC__ ) 48 | __INLINE static void nrf_delay_us(uint32_t volatile number_of_us) 49 | { 50 | do 51 | { 52 | __ASM volatile ( 53 | "NOP\n\t" 54 | "NOP\n\t" 55 | "NOP\n\t" 56 | "NOP\n\t" 57 | "NOP\n\t" 58 | "NOP\n\t" 59 | "NOP\n\t" 60 | "NOP\n\t" 61 | "NOP\n\t" 62 | "NOP\n\t" 63 | "NOP\n\t" 64 | "NOP\n\t" 65 | "NOP\n\t" 66 | "NOP\n\t" 67 | ); 68 | } while (--number_of_us); 69 | } 70 | #endif 71 | 72 | void nrf_delay_ms(uint32_t volatile number_of_ms); 73 | 74 | #endif 75 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/targets/cmsis/core_caInstr.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file core_caInstr.h 3 | * @brief CMSIS Cortex-A9 Core Peripheral Access Layer Header File 4 | * @version 5 | * @date 04. December 2012 6 | * 7 | * @note 8 | * 9 | ******************************************************************************/ 10 | /* Copyright (c) 2009 - 2012 ARM LIMITED 11 | 12 | All rights reserved. 13 | Redistribution and use in source and binary forms, with or without 14 | modification, are permitted provided that the following conditions are met: 15 | - Redistributions of source code must retain the above copyright 16 | notice, this list of conditions and the following disclaimer. 17 | - Redistributions in binary form must reproduce the above copyright 18 | notice, this list of conditions and the following disclaimer in the 19 | documentation and/or other materials provided with the distribution. 20 | - Neither the name of ARM nor the names of its contributors may be used 21 | to endorse or promote products derived from this software without 22 | specific prior written permission. 23 | * 24 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 25 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27 | ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE 28 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 29 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 30 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 32 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 34 | POSSIBILITY OF SUCH DAMAGE. 35 | ---------------------------------------------------------------------------*/ 36 | 37 | #ifndef __CORE_CAINSTR_H__ 38 | #define __CORE_CAINSTR_H__ 39 | 40 | #define __CORTEX_M 0x3 41 | #include "core_cmInstr.h" 42 | #undef __CORTEX_M 43 | 44 | #endif 45 | 46 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/targets/hal/TARGET_NORDIC/TARGET_MCU_NRF51822/PeripheralNames.h: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2013 Nordic Semiconductor 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef MBED_PERIPHERALNAMES_H 17 | #define MBED_PERIPHERALNAMES_H 18 | 19 | #include "cmsis.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | #define STDIO_UART_TX TX_PIN_NUMBER 26 | #define STDIO_UART_RX RX_PIN_NUMBER 27 | #define STDIO_UART UART_0 28 | 29 | typedef enum { 30 | UART_0 = (int)NRF_UART0_BASE 31 | } UARTName; 32 | 33 | 34 | typedef enum { 35 | SPI_0 = (int)NRF_SPI0_BASE, 36 | SPI_1 = (int)NRF_SPI1_BASE, 37 | SPIS = (int)NRF_SPIS1_BASE 38 | } SPIName; 39 | 40 | typedef enum { 41 | PWM_1 = 0, 42 | PWM_2 43 | } PWMName; 44 | 45 | typedef enum { 46 | I2C_0 = (int)NRF_TWI0_BASE, 47 | I2C_1 = (int)NRF_TWI1_BASE 48 | } I2CName; 49 | 50 | typedef enum { 51 | ADC0_0 = (int)NRF_ADC_BASE 52 | } ADCName; 53 | 54 | #ifdef __cplusplus 55 | } 56 | #endif 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/targets/hal/TARGET_NORDIC/TARGET_MCU_NRF51822/PortNames.h: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2013 Nordic Semiconductor 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef MBED_PORTNAMES_H 17 | #define MBED_PORTNAMES_H 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | typedef enum { 24 | Port0 = 0 //GPIO pins 0-31 25 | } PortName; 26 | 27 | #ifdef __cplusplus 28 | } 29 | #endif 30 | #endif 31 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/targets/hal/TARGET_NORDIC/TARGET_MCU_NRF51822/TARGET_RBLAB_BLENANO/device.h: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef MBED_DEVICE_H 17 | #define MBED_DEVICE_H 18 | 19 | #define DEVICE_PORTIN 1 20 | #define DEVICE_PORTOUT 1 21 | #define DEVICE_PORTINOUT 1 22 | 23 | #define DEVICE_INTERRUPTIN 1 24 | 25 | #define DEVICE_ANALOGIN 1 26 | #define DEVICE_ANALOGOUT 0 27 | 28 | #define DEVICE_SERIAL 1 29 | 30 | #define DEVICE_I2C 1 31 | #define DEVICE_I2CSLAVE 0 32 | 33 | #define DEVICE_SPI 1 34 | #define DEVICE_SPISLAVE 1 35 | 36 | #define DEVICE_CAN 0 37 | 38 | #define DEVICE_RTC 0 39 | 40 | #define DEVICE_ETHERNET 0 41 | 42 | #define DEVICE_PWMOUT 1 43 | 44 | #define DEVICE_SEMIHOST 0 45 | #define DEVICE_LOCALFILESYSTEM 0 46 | 47 | #define DEVICE_SLEEP 1 48 | 49 | #define DEVICE_DEBUG_AWARENESS 0 50 | 51 | #define DEVICE_STDIO_MESSAGES 0 52 | 53 | #define DEVICE_ERROR_PATTERN 1 54 | 55 | #include "objects.h" 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/targets/hal/TARGET_NORDIC/TARGET_MCU_NRF51822/TARGET_RBLAB_NRF51822/device.h: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef MBED_DEVICE_H 17 | #define MBED_DEVICE_H 18 | 19 | #define DEVICE_PORTIN 1 20 | #define DEVICE_PORTOUT 1 21 | #define DEVICE_PORTINOUT 1 22 | 23 | #define DEVICE_INTERRUPTIN 1 24 | 25 | #define DEVICE_ANALOGIN 1 26 | #define DEVICE_ANALOGOUT 0 27 | 28 | #define DEVICE_SERIAL 1 29 | 30 | #define DEVICE_I2C 1 31 | #define DEVICE_I2CSLAVE 0 32 | 33 | #define DEVICE_SPI 1 34 | #define DEVICE_SPISLAVE 1 35 | 36 | #define DEVICE_CAN 0 37 | 38 | #define DEVICE_RTC 0 39 | 40 | #define DEVICE_ETHERNET 0 41 | 42 | #define DEVICE_PWMOUT 1 43 | 44 | #define DEVICE_SEMIHOST 0 45 | #define DEVICE_LOCALFILESYSTEM 0 46 | 47 | #define DEVICE_SLEEP 1 48 | 49 | #define DEVICE_DEBUG_AWARENESS 0 50 | 51 | #define DEVICE_STDIO_MESSAGES 0 52 | 53 | #define DEVICE_ERROR_PATTERN 1 54 | 55 | #include "objects.h" 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/targets/hal/TARGET_NORDIC/TARGET_MCU_NRF51822/gpio_object.h: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef MBED_GPIO_OBJECT_H 17 | #define MBED_GPIO_OBJECT_H 18 | 19 | #include "mbed_assert.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct { 26 | PinName pin; 27 | uint32_t mask; 28 | 29 | __IO uint32_t *reg_dir; 30 | __IO uint32_t *reg_set; 31 | __IO uint32_t *reg_clr; 32 | __I uint32_t *reg_in; 33 | } gpio_t; 34 | 35 | static inline void gpio_write(gpio_t *obj, int value) { 36 | MBED_ASSERT(obj->pin != (PinName)NC); 37 | if (value) 38 | *obj->reg_set = obj->mask; 39 | else 40 | *obj->reg_clr = obj->mask; 41 | } 42 | 43 | static inline int gpio_read(gpio_t *obj) { 44 | MBED_ASSERT(obj->pin != (PinName)NC); 45 | return ((*obj->reg_in & obj->mask) ? 1 : 0); 46 | } 47 | 48 | static inline int gpio_is_connected(const gpio_t *obj) { 49 | return obj->pin != (PinName)NC; 50 | } 51 | 52 | #ifdef __cplusplus 53 | } 54 | #endif 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/targets/hal/TARGET_NORDIC/TARGET_MCU_NRF51822/objects.h: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2013 Nordic Semiconductor 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef MBED_OBJECTS_H 17 | #define MBED_OBJECTS_H 18 | 19 | #include "cmsis.h" 20 | #include "PortNames.h" 21 | #include "PeripheralNames.h" 22 | #include "PinNames.h" 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | #define I2C_SPI_PERIPHERAL_FOR_I2C 1 29 | #define I2C_SPI_PERIPHERAL_FOR_SPI 2 30 | 31 | typedef struct { 32 | uint8_t usage; // I2C: 1, SPI: 2 33 | uint8_t sda_mosi; 34 | uint8_t scl_miso; 35 | uint8_t sclk; 36 | } i2c_spi_peripheral_t; 37 | 38 | struct serial_s { 39 | NRF_UART_Type *uart; 40 | int index; 41 | }; 42 | 43 | struct spi_s { 44 | NRF_SPI_Type *spi; 45 | NRF_SPIS_Type *spis; 46 | uint8_t peripheral; 47 | }; 48 | 49 | struct port_s { 50 | __IO uint32_t *reg_cnf; 51 | __IO uint32_t *reg_out; 52 | __I uint32_t *reg_in; 53 | PortName port; 54 | uint32_t mask; 55 | }; 56 | 57 | struct pwmout_s { 58 | PWMName pwm; 59 | PinName pin; 60 | }; 61 | 62 | struct i2c_s { 63 | NRF_TWI_Type *i2c; 64 | PinName sda; 65 | PinName scl; 66 | int freq; 67 | uint8_t address_set; 68 | uint8_t peripheral; 69 | }; 70 | 71 | struct analogin_s { 72 | ADCName adc; 73 | uint8_t adc_pin; 74 | }; 75 | 76 | struct gpio_irq_s { 77 | uint32_t ch; 78 | }; 79 | 80 | #include "gpio_object.h" 81 | 82 | #ifdef __cplusplus 83 | } 84 | #endif 85 | 86 | #endif 87 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/targets/hal/TARGET_NORDIC/TARGET_MCU_NRF51822/pinmap.c: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #include "mbed_assert.h" 17 | #include "pinmap.h" 18 | #include "mbed_error.h" 19 | 20 | void pin_function(PinName pin, int function) 21 | { 22 | } 23 | 24 | void pin_mode(PinName pin, PinMode mode) 25 | { 26 | MBED_ASSERT(pin != (PinName)NC); 27 | 28 | uint32_t pin_number = (uint32_t)pin; 29 | 30 | NRF_GPIO->PIN_CNF[pin_number] &= ~GPIO_PIN_CNF_PULL_Msk; 31 | NRF_GPIO->PIN_CNF[pin_number] |= (mode << GPIO_PIN_CNF_PULL_Pos); 32 | } 33 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/targets/hal/TARGET_NORDIC/TARGET_MCU_NRF51822/sleep.c: -------------------------------------------------------------------------------- 1 | /* mbed Microcontroller Library 2 | * Copyright (c) 2006-2013 ARM Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #include "sleep_api.h" 17 | #include "cmsis.h" 18 | #include "mbed_interface.h" 19 | 20 | void sleep(void) 21 | { 22 | // ensure debug is disconnected if semihost is enabled.... 23 | NRF_POWER->TASKS_LOWPWR = 1; 24 | // wait for interrupt 25 | __WFE(); 26 | } 27 | 28 | void deepsleep(void) 29 | { 30 | sleep(); 31 | // NRF_POWER->SYSTEMOFF=1; 32 | } 33 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/mbed/targets/hal/TARGET_NORDIC/TARGET_MCU_NRF51822/twi_config.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved. 2 | * 3 | * The information contained herein is property of Nordic Semiconductor ASA. 4 | * Terms and conditions of usage are described in detail in NORDIC 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 6 | * 7 | * Licensees are granted free, non-transferable use of the information. NO 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 9 | * the file. 10 | * 11 | */ 12 | #ifndef TWI_MASTER_CONFIG 13 | #define TWI_MASTER_CONFIG 14 | 15 | #include "PinNames.h" 16 | 17 | #define TWI_MASTER_CONFIG_CLOCK_PIN_NUMBER (I2C_SCL0) 18 | #define TWI_MASTER_CONFIG_DATA_PIN_NUMBER (I2C_SDA0) 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/pin_transform.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | Copyright (c) 2014 RedBearLab, All rights reserved. 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | See the GNU 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 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 21 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 22 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 23 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 24 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 25 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #ifndef PIN_TRANSFORM_H_ 29 | #define PIN_TRANSFORM_H_ 30 | 31 | #include "Arduino.h" 32 | 33 | PinName Pin_nRF51822_to_Arduino(uint32_t pin); 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/wiring_analog.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef WIRING_ANALOG_H_ 3 | #define WIRING_ANALOG_H_ 4 | 5 | 6 | #define WRITE_DEFAULT_RESOLUTION 8 7 | #define READ_DEFAULT_RESOLUTION 10 8 | 9 | // ADC reference selection 10 | #define REFSEL_VBG ADC_CONFIG_REFSEL_VBG // Use internal 1.2 V band gap reference 11 | #define REFSEL_EXT ADC_CONFIG_REFSEL_External // Use external reference specified by CONCFIG EXTREFSEL 12 | #define REFSEL_VDD_1_2_PS ADC_CONFIG_REFSEL_SupplyOneHalfPrescaling // Use VDD with 1/2 prescaling. (Only applicable when VDD is in the range 1.7V ?2.6V) 13 | #define REFSEL_VDD_1_3_PS ADC_CONFIG_REFSEL_SupplyOneThirdPrescaling // Use VDD with 1/3 prescaling. (Only applicable when VDD is in the range 2.5V ?3.6V) 14 | 15 | // External reference pin selection 16 | #define EXT_REFSEL_NONE ADC_CONFIG_EXTREFSEL_None // Analog reference inputs disabled 17 | #define EXT_REFSEL_AREF0 ADC_CONFIG_EXTREFSEL_AnalogReference0 // Use AREF0 as analog reference 18 | #define EXT_REFSEL_AREF1 ADC_CONFIG_EXTREFSEL_AnalogReference1 // Use AREF1 as analog reference 19 | 20 | // ADC input selection 21 | #define INPSEL_AIN_NO_PS ADC_CONFIG_INPSEL_AnalogInputNoPrescaling // Analog input pin specified by CONFIG.PSEL with no prescaling 22 | #define INPSEL_AIN_2_3_PS ADC_CONFIG_INPSEL_AnalogInputTwoThirdsPrescaling // Analog input pin specified by CONFIG. PSEL with 2/3 prescaling 23 | #define INPSEL_AIN_1_3_PS ADC_CONFIG_INPSEL_AnalogInputOneThirdPrescaling // Analog input pin specified by CONFIG. PSEL with 1/3 prescaling 24 | #define INPSEL_VDD_2_3_PS ADC_CONFIG_INPSEL_SupplyTwoThirdsPrescaling // Supply voltage with 2/3 prescaling used as input for the conversion 25 | #define INPSEL_VDD_1_3_PS ADC_CONFIG_INPSEL_SupplyOneThirdPrescaling // Supply voltage with 1/3 prescaling used as input for the conversion 26 | 27 | 28 | 29 | void analogReference(uint8_t ref_type, uint8_t input_type); 30 | void analogReadResolution(uint8_t resolution); 31 | void analogWriteResolution( uint8_t resolution ); 32 | uint32_t analogRead(uint32_t pin); 33 | void analogWrite(uint32_t pin, uint32_t value); 34 | 35 | #endif 36 | 37 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/wiring_buffer.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "Arduino.h" 3 | #include "wiring_buffer.h" 4 | 5 | 6 | /********************************************************************** 7 | name : 8 | function : 9 | **********************************************************************/ 10 | Buffer::Buffer( void ) 11 | { 12 | memset(RX_buff, 0, SERIAL_BUFFER_MAX_SIZE); 13 | rx_Head = 0; 14 | rx_Tail = 0; 15 | } 16 | 17 | /********************************************************************** 18 | name : 19 | function : 20 | **********************************************************************/ 21 | void Buffer::store_char( uint8_t c) 22 | { 23 | uint8_t i = ( uint8_t )( rx_Head +1 ) % SERIAL_BUFFER_MAX_SIZE; 24 | 25 | if( i != rx_Tail ) 26 | { 27 | RX_buff[rx_Head] = c; 28 | rx_Head = i; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/wiring_buffer.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef WIRING_BUFFER_H_ 3 | #define WIRING_BUFFER_H_ 4 | 5 | 6 | #define SERIAL_BUFFER_MAX_SIZE 64 7 | 8 | class Buffer 9 | { 10 | public: 11 | uint8_t RX_buff[SERIAL_BUFFER_MAX_SIZE]; 12 | uint8_t rx_Head; 13 | uint8_t rx_Tail; 14 | 15 | public: 16 | Buffer(void); 17 | 18 | void store_char(uint8_t c); 19 | }; 20 | 21 | 22 | #endif 23 | 24 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/wiring_constants.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef WIRING_CONSTANTS_H_ 3 | #define WIRING_CONSTANTS_H_ 4 | 5 | #include 6 | 7 | #define VARIANT_MCK 16000000UL 8 | 9 | #define clockCyclesPerMicrosecond() ( VARIANT_MCK / 1000000L ) 10 | #define clockCyclesToMicroseconds(a) ( (a) / clockCyclesPerMicrosecond() ) 11 | #define microsecondsToClockCycles(a) ( (a) * clockCyclesPerMicrosecond() ) 12 | 13 | 14 | #define INPUT 0x00 15 | #define OUTPUT 0x01 16 | #define INPUT_PULLUP 0x02 17 | 18 | #define LOW 0x00 19 | #define HIGH 0x01 20 | #define CHANGE 0x02 21 | #define FALLING 0x03 22 | #define RISING 0x04 23 | 24 | 25 | #define true 0x1 26 | #define false 0x0 27 | 28 | #define PI 3.1415926535897932384626433832795 29 | #define HALF_PI 1.5707963267948966192313216916398 30 | #define TWO_PI 6.283185307179586476925286766559 31 | #define DEG_TO_RAD 0.017453292519943295769236907684886 32 | #define RAD_TO_DEG 57.295779513082320876798154814105 33 | 34 | //Use the C++ STL, no need to define min and max 35 | //#ifndef min 36 | //#define min(a,b) ((a)<(b)?(a):(b)) 37 | //#endif // min 38 | 39 | //#ifndef max 40 | //#define max(a,b) ((a)>(b)?(a):(b)) 41 | //#endif // max 42 | 43 | #define abs(x) ((x)>0?(x):-(x)) 44 | #define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt))) 45 | #define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5)) 46 | #define radians(deg) ((deg)*DEG_TO_RAD) 47 | #define degrees(rad) ((rad)*RAD_TO_DEG) 48 | #define sq(x) ((x)*(x)) 49 | 50 | 51 | #define lowByte(w) ((uint8_t) ((w) & 0xff)) 52 | #define highByte(w) ((uint8_t) ((w) >> 8)) 53 | 54 | #define bitRead(value, bit) (((value) >> (bit)) & 0x01) 55 | #define bitSet(value, bit) ((value) |= (1UL << (bit))) 56 | #define bitClear(value, bit) ((value) &= ~(1UL << (bit))) 57 | #define bitWrite(value, bit, bitvalue) (bitvalue ? bitSet(value, bit) : bitClear(value, bit)) 58 | 59 | #define bit(b) (1UL << (b)) 60 | 61 | #define interrupts() __enable_irq() 62 | #define noInterrupts() __disable_irq() 63 | 64 | typedef unsigned int word; 65 | typedef uint8_t boolean ; 66 | typedef uint8_t byte ; 67 | 68 | enum BitOrder { 69 | LSBFIRST = 0, 70 | MSBFIRST = 1 71 | }; 72 | 73 | #endif 74 | 75 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/wiring_delay.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "Arduino.h" 3 | #include "wiring_delay.h" 4 | 5 | 6 | void delayMicroseconds(uint32_t us) 7 | { 8 | uint32_t start = us_ticker_read(); 9 | while((us_ticker_read() - start) < (uint32_t)us); 10 | } 11 | 12 | void delay(uint32_t ms) 13 | { 14 | delayMicroseconds(ms*1000); 15 | } 16 | 17 | uint32_t micros( void ) 18 | { 19 | return us_ticker_read(); 20 | } 21 | 22 | uint32_t millis( void ) 23 | { 24 | return ( us_ticker_read() / 1000); 25 | } 26 | 27 | 28 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/wiring_delay.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef WIRING_DELAY_H_ 3 | #define WIRING_DELAY_H_ 4 | 5 | void delayMicroseconds(uint32_t us); 6 | void delay(uint32_t ms); 7 | uint32_t micros( void ); 8 | uint32_t millis( void ); 9 | 10 | #endif 11 | 12 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/wiring_digital.cpp: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "Arduino.h" 4 | #include "wiring_digital.h" 5 | 6 | 7 | void pinMode(uint32_t pin, uint32_t mode) 8 | { 9 | PinName nrf_pin; 10 | gpio_t gpio; 11 | PinMode pin_mode; 12 | PinDirection direction; 13 | 14 | nrf_pin = Pin_nRF51822_to_Arduino(pin); 15 | MBED_ASSERT(nrf_pin != (PinName)NC); 16 | 17 | gpio.pin = nrf_pin; 18 | 19 | switch(mode) 20 | { 21 | case INPUT : direction = PIN_INPUT; pin_mode = PullNone; break; 22 | case OUTPUT : direction = PIN_OUTPUT; pin_mode = PullNone; break; 23 | case INPUT_PULLUP : direction = PIN_INPUT; pin_mode = PullUp; break; 24 | default : return; 25 | } 26 | gpio_dir(&gpio, direction); 27 | gpio_mode(&gpio, pin_mode); 28 | } 29 | 30 | void digitalWrite(uint32_t pin, uint32_t value) 31 | { 32 | PinName nrf_pin; 33 | 34 | nrf_pin = Pin_nRF51822_to_Arduino(pin); 35 | MBED_ASSERT(nrf_pin != (PinName)NC); 36 | if(value) 37 | NRF_GPIO->OUTSET = (1ul << nrf_pin); 38 | else 39 | NRF_GPIO->OUTCLR = (1ul << nrf_pin); 40 | } 41 | 42 | 43 | uint32_t digitalRead(uint32_t pin) 44 | { 45 | PinName nrf_pin; 46 | 47 | nrf_pin = Pin_nRF51822_to_Arduino(pin); 48 | MBED_ASSERT(nrf_pin != (PinName)NC); 49 | 50 | return ( (NRF_GPIO->IN >> nrf_pin) & 1UL ); 51 | } 52 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/wiring_digital.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #ifndef WIRING_DIGITAL_H_ 4 | #define WIRING_DIGITAL_H_ 5 | 6 | 7 | void pinMode(uint32_t pin, uint32_t mode); 8 | void digitalWrite(uint32_t pin, uint32_t value); 9 | uint32_t digitalRead(uint32_t pin); 10 | 11 | 12 | #endif 13 | 14 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/wiring_interrupter.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef WIRING_INTERRUPTER_H_ 3 | #define WIRING_INTERRUPTER_H_ 4 | 5 | 6 | typedef void (*irqHandle_t)(void); 7 | 8 | 9 | typedef struct{ 10 | 11 | gpio_irq_t gpio_irq; 12 | gpio_t gpio; 13 | irqHandle_t riseHandle; 14 | irqHandle_t fallHandle; 15 | 16 | }PinHandle_t; 17 | 18 | 19 | void attachInterrupt(uint32_t pin, irqHandle_t handle, uint8_t mode); 20 | void detachInterrupt(uint32_t pin ); 21 | 22 | 23 | #endif 24 | 25 | 26 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/wiring_serial.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef WIRING_SERIAL_H_ 3 | #define WIRING_SERIAL_H_ 4 | 5 | #include "HardwareSerial.h" 6 | 7 | class UARTClass : public HardwareSerial 8 | { 9 | public: 10 | UARTClass(); 11 | 12 | void attach(uart_irq_handler handle); 13 | void begin(const uint32_t BaudRate ); 14 | void begin(const uint32_t BaudRate, uint32_t rx_pin, uint32_t tx_pin); 15 | void end(void); 16 | 17 | int available( void ); 18 | int read( void ); 19 | int peek( void ); 20 | void flush( void ); 21 | size_t write( const uint8_t c); //just keep the format same with the virtual function 22 | 23 | #if defined __GNUC__ /* GCC CS3 */ 24 | using Print::write ; // pull in write(str) and write(buf, size) from Print 25 | #elif defined __ICCARM__ /* IAR Ewarm 5.41+ */ 26 | //virtual void write( const char *str ) ; 27 | //virtual void write( const uint8_t *buffer, size_t size ) ; 28 | #endif 29 | operator bool() { return true; }; // USART always active 30 | }; 31 | 32 | extern "C" void store(uint8_t c); 33 | 34 | #endif 35 | 36 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/cores/RBL_nRF51822/wiring_shift_pulseIn.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "Arduino.h" 3 | #include "wiring_shift_pulseIn.h" 4 | 5 | 6 | uint32_t shiftIn(uint32_t DataPin, uint32_t ClockPin, BitOrder Order) 7 | { 8 | uint8_t value; 9 | uint8_t index; 10 | 11 | value = 0; 12 | for(index=0; index<8; index++){ 13 | digitalWrite(ClockPin, HIGH); 14 | if(Order == LSBFIRST){ 15 | value |= (digitalRead(DataPin) << index); 16 | } 17 | else { 18 | value |= (digitalRead(DataPin) << (7-index)); 19 | } 20 | digitalWrite(ClockPin, LOW); 21 | } 22 | 23 | return value; 24 | } 25 | 26 | void shiftOut(uint32_t DataPin, uint32_t ClockPin, BitOrder Order, uint8_t value) 27 | { 28 | uint8_t index; 29 | 30 | for(index=0; index<8; index++){ 31 | if(Order == LSBFIRST){ 32 | digitalWrite(DataPin, !!(value&(1<= 2 && (p) < 24 ) 13 | #define IS_PIN_ANALOG(p) ( (p) >= 19 && (p) < 24) 14 | #define IS_PIN_PWM(p) ( (p) == 3 || (p) == 5 || (p) == 6 ) 15 | #define IS_PIN_SERVO(p) ( (p) > 2 && (p) < 12 ) 16 | 17 | #define PIN_TO_DIGITAL(p) (p) 18 | #define PIN_TO_ANALOG(p) ((p)-19) 19 | #define PIN_TO_PWM(p) PIN_TO_DIGITAL(p) 20 | #define PIN_TO_SERVO(p) (p) 21 | 22 | #endif 23 | 24 | #ifdef BLE_NANO 25 | 26 | #define TOTAL_ANALOG_PINS 3 27 | #define TOTAL_PINS (14+1) 28 | #define VERSION_BLINK_PIN 13 29 | #define IS_PIN_DIGITAL(p) ( (p) >= 2 && (p) <= 14 ) 30 | #define IS_PIN_ANALOG(p) ( (p) == 8 || (p) == 9 || (p) == 10 || (p) == 11 || (p) == 12 || (p) == 14) //A0~A5 31 | #define IS_PIN_PWM(p) ( (p) == 3 || (p) == 5 || (p) == 6 ) 32 | #define IS_PIN_SERVO(p) ( (p) > 2 && (p) <= 7 ) 33 | 34 | #define PIN_TO_DIGITAL(p) (p) 35 | #define PIN_TO_PWM(p) PIN_TO_DIGITAL(p) 36 | #define PIN_TO_SERVO(p) (p) 37 | 38 | #endif 39 | 40 | #endif 41 | 42 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/libraries/BLE_Examples/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map Servo 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | BLE_Exampls KEYWORD1 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | 15 | invalid KEYWORD2 16 | 17 | ####################################### 18 | # Constants (LITERAL1) 19 | ####################################### 20 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/libraries/BLE_Examples/library.properties: -------------------------------------------------------------------------------- 1 | name=BLE_Examples 2 | version=1.0.0 3 | author=RedBear 4 | maintainer=RedBear 5 | sentence=Allow 6 | paragraph=This library 7 | category=Communication 8 | url=https://github.com/redbear/nRF51822-Arduino 9 | architectures=* -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/libraries/BLE_Examples/src/invalid.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedBearLab/nRF51822-Arduino/5e3f230b324a7186423f88ae36d911c905e330ab/arduino-1.6.x/hardware/RBL/RBL_nRF51822/libraries/BLE_Examples/src/invalid.h -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/libraries/SPI_Master/examples/SPI_Master_write/SPI_Master_write.ino: -------------------------------------------------------------------------------- 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 | #include 16 | 17 | void setup() { 18 | // put your setup code here, to run once 19 | pinMode(D7, OUTPUT); 20 | digitalWrite(D7, HIGH); 21 | delay(500); 22 | SPI_Master.begin(); 23 | } 24 | 25 | void loop() { 26 | // put your main code here, to run repeatedly: 27 | digitalWrite(D7, LOW); 28 | SPI_Master.transfer(0x53); 29 | SPI_Master.transfer(0x00); 30 | SPI_Master.transfer(0x00); 31 | SPI_Master.transfer(0x00); 32 | digitalWrite(D7, HIGH); 33 | delay(1000); 34 | } 35 | 36 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/libraries/SPI_Master/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map SPI 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | SPI_Master KEYWORD1 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | begin KEYWORD2 15 | endTransfer KEYWORD2 16 | transfer KEYWORD2 17 | 18 | 19 | ####################################### 20 | # Constants (LITERAL1) 21 | ####################################### 22 | SPI_MODE0 LITERAL1 23 | SPI_MODE1 LITERAL1 24 | SPI_MODE2 LITERAL1 25 | SPI_MODE3 LITERAL1 26 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/libraries/Servo/examples/Sweep/Sweep.ino: -------------------------------------------------------------------------------- 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 | #include 16 | 17 | Servo myservo[4]; 18 | 19 | int pos = 0; 20 | 21 | void setup() { 22 | // put your setup code here, to run once 23 | myservo[0].attach(D2); 24 | myservo[1].attach(D3); 25 | myservo[2].attach(D4); 26 | myservo[3].attach(D5); 27 | } 28 | 29 | void loop() { 30 | // put your main code here, to run repeatedly: 31 | for(pos = 0; pos < 180; pos += 1) { 32 | myservo[0].write(pos); 33 | myservo[1].write(pos); 34 | myservo[2].write(pos); 35 | myservo[3].write(pos); 36 | delay(15); 37 | } 38 | for(pos = 180; pos >= 1; pos -= 1) { 39 | myservo[0].write(pos); 40 | myservo[1].write(pos); 41 | myservo[2].write(pos); 42 | myservo[3].write(pos); 43 | delay(15); 44 | } 45 | } 46 | 47 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/libraries/Servo/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map Servo 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | Servo KEYWORD1 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | attach KEYWORD2 15 | detach KEYWORD2 16 | write KEYWORD2 17 | read KEYWORD2 18 | attached KEYWORD2 19 | writeMicroseconds KEYWORD2 20 | readMicroseconds KEYWORD2 21 | 22 | ####################################### 23 | # Constants (LITERAL1) 24 | ####################################### 25 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/libraries/Wire/examples/master_read/master_read.ino: -------------------------------------------------------------------------------- 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 | /* RBL nRF51822 UNO 16 | *Example: 17 | * mast_write slave_sender 18 | *Pin: 19 | * SCL SCL 20 | * SDA SDA 21 | *address: 22 | * 0x02 0x02 23 | *read_len: 24 | 0x06 25 | */ 26 | 27 | #include 28 | 29 | void setup() { 30 | // put your setup code here, to run once: 31 | Serial.begin(9600); 32 | Wire.begin(); 33 | Serial.println("master read..."); 34 | } 35 | 36 | void loop() { 37 | // put your main code here, to run repeatedly: 38 | Wire.requestFrom(0x02,6); 39 | 40 | while( Wire.available() > 0 ) { 41 | uint8_t c = Wire.read(); 42 | Serial.write(c); 43 | } 44 | delay(1000); 45 | } 46 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/libraries/Wire/examples/master_write/master_write.ino: -------------------------------------------------------------------------------- 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 | /* nRF51822 UNO 16 | *Example: 17 | * master_write slave_receiver 18 | *Pin: 19 | * SCL SCL 20 | * SDA SDA 21 | *address: 22 | * 0x04 0x04 23 | */ 24 | 25 | #include 26 | 27 | void setup() { 28 | // put your setup code here, to run once: 29 | Serial.begin(9600); 30 | Wire.begin(); 31 | Serial.println("master write..."); 32 | } 33 | 34 | byte x = 0; 35 | 36 | void loop() { 37 | // put your main code here, to run repeatedly: 38 | Serial.println("master send begin: "); 39 | 40 | Wire.beginTransmission(0x04); 41 | Wire.write("x is"); 42 | Wire.write(x); 43 | Wire.endTransmission(); 44 | 45 | x++; 46 | delay(1000); 47 | } 48 | 49 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/libraries/Wire/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For Wire 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | ####################################### 10 | # Methods and Functions (KEYWORD2) 11 | ####################################### 12 | 13 | begin KEYWORD2 14 | beginTransmission KEYWORD2 15 | endTransmission KEYWORD2 16 | requestFrom KEYWORD2 17 | write KEYWORD2 18 | receive KEYWORD2 19 | 20 | ####################################### 21 | # Instances (KEYWORD2) 22 | ####################################### 23 | 24 | Wire KEYWORD2 25 | 26 | ####################################### 27 | # Constants (LITERAL1) 28 | ####################################### 29 | 30 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/libraries/nRF_Examples/README.adoc: -------------------------------------------------------------------------------- 1 | = nRF_Examples = 2 | 3 | == License == 4 | 5 | Copyright (c) 2016 RedBear 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), 8 | to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 | 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: 10 | 11 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 15 | 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 16 | IN THE SOFTWARE. 17 | 18 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/libraries/nRF_Examples/examples/External_Interrupter/External_Interrupter.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014 RedBearLab, 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 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 21 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | void handle_irq1(void) { 28 | Serial.println("Handle1 "); 29 | } 30 | 31 | void handle_irq2(void) { 32 | Serial.println("Handle2 "); 33 | } 34 | 35 | void handle_irq3(void) { 36 | if(HIGH == digitalRead(D8)) 37 | Serial.println("D8 Release "); 38 | else 39 | Serial.println("D8 Press "); 40 | } 41 | 42 | void setup() { 43 | // put your setup code here, to run once: 44 | pinMode(D13, OUTPUT); 45 | Serial.begin(9600); 46 | Serial.println("External Interrupter Demo "); 47 | // set interrupts, pin default is HIGH 48 | attachInterrupt(D6, handle_irq1, RISING); 49 | attachInterrupt(D7, handle_irq2, FALLING); 50 | attachInterrupt(D8, handle_irq3, CHANGE); 51 | } 52 | 53 | void loop() { 54 | // put your main code here, to run repeatedly: 55 | digitalWrite(D13,HIGH); 56 | delay(1000); 57 | digitalWrite(D13, LOW); 58 | delay(1000); 59 | } 60 | 61 | 62 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/libraries/nRF_Examples/examples/Serial_IRQ_Handle/Serial_IRQ_Handle.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014 RedBearLab, 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 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 21 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | // handle when rx event 28 | void uart_handle(uint32_t id, SerialIrq event) { 29 | // Serial receive byte event 30 | if(event == RxIrq){ 31 | // print the receive byte 32 | if(Serial.available()) 33 | Serial.write(Serial.read()); 34 | } 35 | } 36 | 37 | void setup() { 38 | // put your setup code here, to run once: 39 | Serial.begin(9600); 40 | Serial.attach(uart_handle); 41 | Serial.println("Serial IRQ Handle demo "); 42 | Serial.println("Please input string to Serial com :"); 43 | pinMode(D13, OUTPUT); 44 | } 45 | 46 | void loop() { 47 | // put your main code here, to run repeatedly: 48 | digitalWrite(D13,HIGH); 49 | delay(1000); 50 | digitalWrite(D13, LOW); 51 | delay(1000); 52 | } 53 | 54 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/libraries/nRF_Examples/examples/Ticker_Task/Ticker_Task.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014 RedBearLab, 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 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 21 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | /* 28 | This example show how to use timer task. 29 | */ 30 | 31 | Ticker ticker1, ticker2; 32 | 33 | void m_ticker1_handle(void) { 34 | Serial.println("Task1 callback handle "); 35 | } 36 | 37 | void m_ticker2_handle(void) { 38 | Serial.println("Task2 callback handle "); 39 | } 40 | 41 | void setup() { 42 | // put your setup code here, to run once: 43 | Serial.begin(9600); 44 | Serial.println("Ticker Task Test "); 45 | pinMode(D13, OUTPUT); 46 | // creat two task, one 1s and the other 2s 47 | ticker1.attach_us(m_ticker1_handle, 1000000); 48 | ticker2.attach(m_ticker2_handle, 2); 49 | } 50 | 51 | void loop() { 52 | // put your main code here, to run repeatedly: 53 | digitalWrite(D13,HIGH); 54 | delay(500); 55 | digitalWrite(D13, LOW); 56 | delay(500); 57 | } 58 | 59 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/libraries/nRF_Examples/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map Servo 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | nRF_Exampls KEYWORD1 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | 15 | invalid KEYWORD2 16 | 17 | ####################################### 18 | # Constants (LITERAL1) 19 | ####################################### 20 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/libraries/nRF_Examples/library.properties: -------------------------------------------------------------------------------- 1 | name=nRF_Examples 2 | version=1.0.0 3 | author=RedBear 4 | maintainer=RedBear 5 | sentence=Allow 6 | paragraph=This library 7 | category=Communication 8 | url=https://github.com/redbear/nRF51822-Arduino 9 | architectures=* -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/libraries/nRF_Examples/src/invalid.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedBearLab/nRF51822-Arduino/5e3f230b324a7186423f88ae36d911c905e330ab/arduino-1.6.x/hardware/RBL/RBL_nRF51822/libraries/nRF_Examples/src/invalid.h -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/programmers.txt: -------------------------------------------------------------------------------- 1 | 2 | dap_link.name=DAPLink 3 | dap_link.communication=USB 4 | dap_link.protocol= 5 | dap_link.program.protocol= 6 | dap_link.program.tool=openocd 7 | dap_link.program.interface=cmsis-dap 8 | dap_link.program.extra_params= 9 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/variants/BLE_Nano/pins_arduino.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef PINS_ARDUINO_H_ 3 | #define PINS_ARDUINO_H_ 4 | 5 | #define BLE_NANO 6 | 7 | #define D0 0 8 | #define D1 1 9 | #define D2 2 10 | #define D3 3 11 | 12 | #define D4 4 13 | #define D5 5 14 | #define D6 6 15 | #define D7 7 16 | 17 | #define D13 13 18 | 19 | #define D8 8 20 | #define D9 9 21 | #define D10 10 22 | #define D11 11 23 | #define D12 12 24 | #define D14 14 25 | 26 | #define A0 D8 27 | #define A1 D9 28 | #define A2 D10 29 | #define A3 D11 30 | #define A4 D12 31 | #define A5 D14 32 | 33 | #define CS D2 34 | #define SCK D3 35 | #define MISO D0 36 | #define MOSI D1 37 | 38 | #define SDA D2 39 | #define SCL D3 40 | 41 | #define DEFAULT_RX_PIN D0 42 | #define DERAULT_TX_PIN D1 43 | 44 | #define TWI_SDA SDA 45 | #define TWI_SCL SCL 46 | 47 | #define LED D13 48 | 49 | #endif 50 | 51 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/variants/BLE_Nano_32KB/pins_arduino.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef PINS_ARDUINO_H_ 3 | #define PINS_ARDUINO_H_ 4 | 5 | #define BLE_NANO 6 | 7 | #define D0 0 8 | #define D1 1 9 | #define D2 2 10 | #define D3 3 11 | 12 | #define D4 4 13 | #define D5 5 14 | #define D6 6 15 | #define D7 7 16 | 17 | #define D13 13 18 | 19 | #define D8 8 20 | #define D9 9 21 | #define D10 10 22 | #define D11 11 23 | #define D12 12 24 | #define D14 14 25 | 26 | #define A0 D8 27 | #define A1 D9 28 | #define A2 D10 29 | #define A3 D11 30 | #define A4 D12 31 | #define A5 D14 32 | 33 | #define CS D2 34 | #define SCK D3 35 | #define MISO D0 36 | #define MOSI D1 37 | 38 | #define SDA D2 39 | #define SCL D3 40 | 41 | #define DEFAULT_RX_PIN D0 42 | #define DERAULT_TX_PIN D1 43 | 44 | #define TWI_SDA SDA 45 | #define TWI_SCL SCL 46 | 47 | #define LED D13 48 | 49 | #endif 50 | 51 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/variants/RBL_nRF51822/pins_arduino.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef PINS_ARDUINO_H_ 3 | #define PINS_ARDUINO_H_ 4 | 5 | #define RBL_NRF51822 6 | 7 | //PIN Define 8 | #define D0 0 9 | #define D1 1 10 | #define D2 2 11 | #define D3 3 12 | #define D4 4 13 | #define D5 5 14 | #define D6 6 15 | #define D7 7 16 | #define D8 8 17 | #define D9 9 18 | #define D10 10 19 | #define D11 11 20 | #define D12 12 21 | #define D13 13 22 | #define D14 14 23 | #define D15 15 24 | #define D16 16 25 | #define D17 17 26 | #define D18 18 27 | #define D19 19 28 | #define D20 20 29 | #define D21 21 30 | #define D22 22 31 | #define D23 23 32 | #define D24 24 33 | 34 | #define CS D7 35 | #define SCK D16 36 | #define MISO D17 37 | #define MOSI D18 38 | 39 | #define SDA0 D2 40 | #define SCL0 D3 41 | 42 | #define SDA1 D14 43 | #define SCL1 D15 44 | 45 | #define A0 D19 46 | #define A1 D20 47 | #define A2 D21 48 | #define A3 D22 49 | #define A4 D23 50 | #define A5 D24 51 | 52 | #define DEFAULT_RX_PIN D0 53 | #define DERAULT_TX_PIN D1 54 | 55 | #define TWI_SDA SDA1 56 | #define TWI_SCL SCL1 57 | 58 | #define LED D13 59 | 60 | #endif 61 | 62 | -------------------------------------------------------------------------------- /arduino-1.6.x/hardware/RBL/RBL_nRF51822/variants/RBL_nRF51822_32KB/pins_arduino.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef PINS_ARDUINO_H_ 3 | #define PINS_ARDUINO_H_ 4 | 5 | #define RBL_NRF51822 6 | 7 | //PIN Define 8 | #define D0 0 9 | #define D1 1 10 | #define D2 2 11 | #define D3 3 12 | #define D4 4 13 | #define D5 5 14 | #define D6 6 15 | #define D7 7 16 | #define D8 8 17 | #define D9 9 18 | #define D10 10 19 | #define D11 11 20 | #define D12 12 21 | #define D13 13 22 | #define D14 14 23 | #define D15 15 24 | #define D16 16 25 | #define D17 17 26 | #define D18 18 27 | #define D19 19 28 | #define D20 20 29 | #define D21 21 30 | #define D22 22 31 | #define D23 23 32 | #define D24 24 33 | 34 | #define CS D7 35 | #define SCK D16 36 | #define MISO D17 37 | #define MOSI D18 38 | 39 | #define SDA0 D2 40 | #define SCL0 D3 41 | 42 | #define SDA1 D14 43 | #define SCL1 D15 44 | 45 | #define A0 D19 46 | #define A1 D20 47 | #define A2 D21 48 | #define A3 D22 49 | #define A4 D23 50 | #define A5 D24 51 | 52 | #define DEFAULT_RX_PIN D0 53 | #define DERAULT_TX_PIN D1 54 | 55 | #define TWI_SDA SDA1 56 | #define TWI_SCL SCL1 57 | 58 | #define LED D13 59 | 60 | #endif 61 | 62 | -------------------------------------------------------------------------------- /bootloader/README.txt: -------------------------------------------------------------------------------- 1 | 2 | nRF51822 Bootloader 3 | —-- 4 | 5 | This bootloader built with S130 SoftDevice and has OTA feature. 6 | 7 | *** Please download the whole zip file and use the bootloader.hex file inside. 8 | -------------------------------------------------------------------------------- /interface/README.md: -------------------------------------------------------------------------------- 1 | # MK20 USB Interface 2 | 3 | 4 | ## PCB Version 5 | 6 | ### V1.0 7 | 8 | For V1.0 version of the MK20 USB dongle, you can update it to the latest interface firmware called DAPLink which is supported and developed by ARM mbed. 9 | 10 | ### V1.5 11 | 12 | For V1.5, you can only use the CMSIS-DAP firmware. 13 | 14 | 15 | ## Update Interface Firmware 16 | 17 | In case you have changed the USB interface firmware inside the MK20 chip and want to restore to default one or upgrade to lastest version, follow the steps below: 18 | 19 | 1. Press and hold the reset button on your nRF51822 board 20 | 21 | 2. Connect it to an USB port of your PC 22 | 23 | 3. Release the button and the LED will keep flashing (slowly) 24 | 25 | 4.1 For Windows, just drag the firmware (.bin) to the MSD drive (e.g. E:), labelled 'BOOTLOADER' 26 | 27 | 4.2 For Linux or Mac OSX (10.9.x), use the follow command from the Terminal: 28 | 29 | Usage: 30 | dd if=src_firmware.bin of=/Volumes/BOOTLOADER/dst_firmware.bin conv=notrunc 31 | 32 | Example: 33 | dd if=BLENano_MK20.bin of=/Volumes/BOOTLOADER/BLENano_MK20.bin conv=notrunc 34 | 35 | 4.3 For Mac OSX (10.10.x / 10.11.x): 36 | 37 | sudo mount -u -w -o sync /Volumes/BOOTLOADER; cp -X ~/Desktop/BLENano_MK20.bin /Volumes/BOOTLOADER/ 38 | 39 | Note: Use RBL_nRF51822_MK20.bin for the RBL nRF51822 board and use BLENano_MK20.bin for the BLE Nano board 40 | 41 | 5. After that, the LED should keep flashing (very fast this time) 42 | 43 | 6. Remove the board from the USB port 44 | 45 | 7. Reconnect it to the USB port, your OS will show a drive labelled 'MBED' 46 | 47 | -------------------------------------------------------------------------------- /interface/f103/board_v1.0/daplink/stm32f103xb_rblnano_if_crc_legacy_0x8000.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedBearLab/nRF51822-Arduino/5e3f230b324a7186423f88ae36d911c905e330ab/interface/f103/board_v1.0/daplink/stm32f103xb_rblnano_if_crc_legacy_0x8000.bin -------------------------------------------------------------------------------- /interface/mk20/board_v1.0/daplink/BLENano_MK20.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedBearLab/nRF51822-Arduino/5e3f230b324a7186423f88ae36d911c905e330ab/interface/mk20/board_v1.0/daplink/BLENano_MK20.bin -------------------------------------------------------------------------------- /interface/mk20/board_v1.5/cmsis-dap/BLENano_MK20.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedBearLab/nRF51822-Arduino/5e3f230b324a7186423f88ae36d911c905e330ab/interface/mk20/board_v1.5/cmsis-dap/BLENano_MK20.bin -------------------------------------------------------------------------------- /interface/mk20/board_v1.5/cmsis-dap/RBL_nRF51822_MK20.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedBearLab/nRF51822-Arduino/5e3f230b324a7186423f88ae36d911c905e330ab/interface/mk20/board_v1.5/cmsis-dap/RBL_nRF51822_MK20.bin --------------------------------------------------------------------------------