├── .gitattributes ├── .gitignore ├── CHANGELOG.md ├── boards.txt ├── bootloaders ├── primo │ └── bootloader_primo_v1.0.0.hex └── primo_core │ └── bootloader_primo_core_v1.0.0.hex ├── cores └── arduino │ ├── Arduino.h │ ├── Client.h │ ├── DFUService.cpp │ ├── DFUService.h │ ├── HardwareSerial.h │ ├── IPAddress.cpp │ ├── IPAddress.h │ ├── Print.cpp │ ├── Print.h │ ├── Printable.h │ ├── RingBuffer.cpp │ ├── RingBuffer.h │ ├── RingBufferT.cpp │ ├── RingBufferT.h │ ├── Server.h │ ├── SoftDeviceManager.cpp │ ├── SoftDeviceManager.h │ ├── Stream.cpp │ ├── Stream.h │ ├── Tone.cpp │ ├── Tone.h │ ├── Uart.cpp │ ├── Uart.h │ ├── Udp.h │ ├── WCharacter.h │ ├── WInterrupts.c │ ├── WInterrupts.h │ ├── WMath.cpp │ ├── WMath.h │ ├── WString.cpp │ ├── WString.h │ ├── WVariant.h │ ├── avr │ ├── dtostrf.c │ ├── dtostrf.h │ ├── interrupt.h │ └── pgmspace.h │ ├── binary.h │ ├── components │ ├── ble │ │ ├── ble_advertising │ │ │ ├── ble_advertising.c │ │ │ └── ble_advertising.h │ │ ├── ble_services │ │ │ └── ble_dfu │ │ │ │ ├── ble_dfu.c │ │ │ │ └── ble_dfu.h │ │ ├── common │ │ │ ├── ble_advdata.c │ │ │ ├── ble_advdata.h │ │ │ ├── ble_conn_params.c │ │ │ ├── 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 │ ├── device │ │ ├── compiler_abstraction.h │ │ ├── nrf.h │ │ ├── nrf51.h │ │ ├── nrf51_bitfields.h │ │ ├── nrf51_deprecated.h │ │ ├── nrf51_to_nrf52.h │ │ ├── nrf52.h │ │ ├── nrf52_bitfields.h │ │ └── nrf52_name_change.h │ ├── drivers_nrf │ │ ├── clock │ │ │ ├── nrf_drv_clock.c │ │ │ └── nrf_drv_clock.h │ │ ├── common │ │ │ ├── nrf_drv_common.c │ │ │ └── nrf_drv_common.h │ │ ├── config │ │ │ ├── nrf_drv_config.h │ │ │ └── nrf_drv_config_validation.h │ │ ├── delay │ │ │ ├── nrf_delay.c │ │ │ └── nrf_delay.h │ │ ├── hal │ │ │ ├── nrf_adc.c │ │ │ ├── nrf_adc.h │ │ │ ├── nrf_clock.h │ │ │ ├── nrf_comp.h │ │ │ ├── nrf_ecb.c │ │ │ ├── nrf_ecb.h │ │ │ ├── nrf_egu.h │ │ │ ├── nrf_gpio.h │ │ │ ├── nrf_gpiote.h │ │ │ ├── nrf_i2s.h │ │ │ ├── nrf_lpcomp.h │ │ │ ├── nrf_nvmc.c │ │ │ ├── nrf_nvmc.h │ │ │ ├── nrf_pdm.h │ │ │ ├── nrf_ppi.h │ │ │ ├── nrf_pwm.h │ │ │ ├── nrf_qdec.h │ │ │ ├── nrf_rng.h │ │ │ ├── nrf_rtc.h │ │ │ ├── nrf_saadc.c │ │ │ ├── nrf_saadc.h │ │ │ ├── nrf_spi.h │ │ │ ├── nrf_spim.h │ │ │ ├── nrf_spis.h │ │ │ ├── nrf_temp.h │ │ │ ├── nrf_timer.h │ │ │ ├── nrf_twi.h │ │ │ ├── nrf_twim.h │ │ │ ├── nrf_twis.h │ │ │ ├── nrf_uart.h │ │ │ ├── nrf_uarte.h │ │ │ └── nrf_wdt.h │ │ ├── nrf_soc_nosd │ │ │ ├── nrf_error.h │ │ │ ├── nrf_nvic.c │ │ │ ├── nrf_nvic.h │ │ │ ├── nrf_soc.c │ │ │ └── nrf_soc.h │ │ ├── pstorage │ │ │ ├── config │ │ │ │ └── pstorage_platform.h │ │ │ ├── pstorage.c │ │ │ └── pstorage.h │ │ ├── rng │ │ │ ├── nrf_drv_rng.c │ │ │ └── nrf_drv_rng.h │ │ └── uart │ │ │ ├── nrf_drv_uart.c │ │ │ └── nrf_drv_uart.h │ ├── libraries │ │ ├── bootloader_dfu │ │ │ ├── bootloader_types.h │ │ │ ├── bootloader_util.c │ │ │ ├── bootloader_util.h │ │ │ ├── dfu_app_handler.c │ │ │ ├── dfu_app_handler.h │ │ │ └── dfu_ble_svc.h │ │ ├── experimental_section_vars │ │ │ └── section_vars.h │ │ ├── fifo │ │ │ ├── app_fifo.c │ │ │ └── app_fifo.h │ │ ├── fstorage │ │ │ ├── config │ │ │ │ └── fstorage_config.h │ │ │ ├── fstorage.c │ │ │ ├── fstorage.h │ │ │ ├── fstorage_internal_defs.h │ │ │ └── fstorage_nosd.c │ │ ├── scheduler │ │ │ ├── app_scheduler.c │ │ │ ├── app_scheduler.h │ │ │ └── app_scheduler_serconn.c │ │ ├── softuart │ │ │ ├── retarget_bitbang.c │ │ │ ├── uart_bitbang.c │ │ │ └── uart_bitbang.h │ │ ├── timer │ │ │ ├── app_timer.c │ │ │ ├── app_timer.h │ │ │ ├── app_timer_appsh.c │ │ │ ├── app_timer_appsh.h │ │ │ └── app_timer_ble_gzll.c │ │ ├── trace │ │ │ ├── app_trace.c │ │ │ └── app_trace.h │ │ ├── uart │ │ │ ├── app_uart.c │ │ │ ├── app_uart.h │ │ │ ├── app_uart_fifo.c │ │ │ └── retarget.c │ │ └── util │ │ │ ├── app_error.c │ │ │ ├── app_error.h │ │ │ ├── app_error_weak.c │ │ │ ├── app_error_weak.h │ │ │ ├── app_util.h │ │ │ ├── app_util_bds.h │ │ │ ├── app_util_platform.c │ │ │ ├── app_util_platform.h │ │ │ ├── common.h │ │ │ ├── nordic_common.h │ │ │ ├── nrf_assert.c │ │ │ ├── nrf_assert.h │ │ │ ├── nrf_log.c │ │ │ ├── nrf_log.h │ │ │ ├── sdk_common.h │ │ │ ├── sdk_errors.h │ │ │ ├── sdk_macros.h │ │ │ ├── sdk_mapped_flags.c │ │ │ ├── sdk_mapped_flags.h │ │ │ ├── sdk_os.h │ │ │ └── sdk_resources.h │ ├── nfc │ │ ├── ndef │ │ │ ├── connection_handover │ │ │ │ ├── ac_rec │ │ │ │ │ ├── nfc_ac_rec.c │ │ │ │ │ └── nfc_ac_rec.h │ │ │ │ ├── ep_oob_rec │ │ │ │ │ ├── nfc_ep_oob_rec.c │ │ │ │ │ └── nfc_ep_oob_rec.h │ │ │ │ ├── hs_rec │ │ │ │ │ ├── nfc_hs_rec.c │ │ │ │ │ └── nfc_hs_rec.h │ │ │ │ ├── le_oob_rec │ │ │ │ │ ├── nfc_le_oob_rec.c │ │ │ │ │ └── nfc_le_oob_rec.h │ │ │ │ ├── nfc_ble_pair_msg.c │ │ │ │ └── nfc_ble_pair_msg.h │ │ │ ├── generic │ │ │ │ ├── message │ │ │ │ │ ├── nfc_ndef_msg.c │ │ │ │ │ └── nfc_ndef_msg.h │ │ │ │ └── record │ │ │ │ │ ├── nfc_ndef_record.c │ │ │ │ │ └── nfc_ndef_record.h │ │ │ ├── launchapp │ │ │ │ ├── nfc_launchapp_msg.c │ │ │ │ ├── nfc_launchapp_msg.h │ │ │ │ ├── nfc_launchapp_rec.c │ │ │ │ └── nfc_launchapp_rec.h │ │ │ ├── parser │ │ │ │ ├── message │ │ │ │ │ ├── nfc_ndef_msg_parser.c │ │ │ │ │ ├── nfc_ndef_msg_parser.h │ │ │ │ │ ├── nfc_ndef_msg_parser_local.c │ │ │ │ │ └── nfc_ndef_msg_parser_local.h │ │ │ │ └── record │ │ │ │ │ ├── nfc_ndef_parser_logger.h │ │ │ │ │ ├── nfc_ndef_record_parser.c │ │ │ │ │ └── nfc_ndef_record_parser.h │ │ │ ├── text │ │ │ │ ├── nfc_text_rec.c │ │ │ │ └── nfc_text_rec.h │ │ │ └── uri │ │ │ │ ├── nfc_uri_msg.c │ │ │ │ ├── nfc_uri_msg.h │ │ │ │ ├── nfc_uri_rec.c │ │ │ │ └── nfc_uri_rec.h │ │ ├── t2t_lib │ │ │ ├── hal_t2t │ │ │ │ ├── hal_nfc_t2t.c │ │ │ │ ├── hal_nfc_t2t.h │ │ │ │ └── hal_nfc_t2t_logger.h │ │ │ ├── licence_agreement.txt │ │ │ ├── nfc_fixes.h │ │ │ ├── nfc_t2t_lib.h │ │ │ └── nfc_t2t_lib_gcc.a │ │ └── t2t_parser │ │ │ ├── nfc_t2t_parser.c │ │ │ ├── nfc_t2t_parser.h │ │ │ └── nfc_tlv_block.h │ ├── softdevice │ │ ├── common │ │ │ └── softdevice_handler │ │ │ │ ├── app_ram_base.h │ │ │ │ ├── ble_stack_handler_types.h │ │ │ │ ├── softdevice_handler.c │ │ │ │ ├── softdevice_handler.h │ │ │ │ ├── softdevice_handler_appsh.c │ │ │ │ └── softdevice_handler_appsh.h │ │ └── s132 │ │ │ ├── doc │ │ │ ├── s132_nrf52_2.0.0_licence_agreement.pdf │ │ │ ├── s132_nrf52_2.0.0_licence_agreement.txt │ │ │ ├── s132_nrf52_2.0.0_readme.txt │ │ │ ├── s132_nrf52_2.0.0_releasenotes.pdf │ │ │ └── s13x_nrf5x_2.0.0_migration_document.pdf │ │ │ ├── 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 │ │ │ ├── nrf52 │ │ │ │ └── nrf_mbr.h │ │ │ ├── nrf_error.h │ │ │ ├── nrf_error_sdm.h │ │ │ ├── nrf_error_soc.h │ │ │ ├── nrf_nvic.h │ │ │ ├── nrf_sd_def.h │ │ │ ├── nrf_sdm.h │ │ │ ├── nrf_soc.h │ │ │ └── nrf_svc.h │ │ │ ├── hex │ │ │ ├── s132_nrf52_2.0.0_licence_agreement.txt │ │ │ └── s132_nrf52_2.0.0_softdevice.hex │ │ │ └── toolchain │ │ │ └── armgcc │ │ │ └── armgcc_s132_nrf52832_xxaa.ld │ └── toolchain │ │ ├── CMSIS │ │ └── Include │ │ │ ├── arm_common_tables.h │ │ │ ├── arm_const_structs.h │ │ │ ├── arm_math.h │ │ │ ├── cmsis_armcc.h │ │ │ ├── cmsis_armcc_V6.h │ │ │ ├── cmsis_gcc.h │ │ │ ├── core_cm0.h │ │ │ ├── core_cm0plus.h │ │ │ ├── core_cm3.h │ │ │ ├── core_cm4.h │ │ │ ├── core_cm7.h │ │ │ ├── core_cmFunc.h │ │ │ ├── core_cmInstr.h │ │ │ ├── core_cmSimd.h │ │ │ ├── core_sc000.h │ │ │ └── core_sc300.h │ │ ├── arm │ │ ├── arm_startup_nrf51.s │ │ ├── arm_startup_nrf52.s │ │ └── uicr_config.h │ │ ├── gcc │ │ ├── Makefile.common │ │ ├── Makefile.posix │ │ ├── Makefile.windows │ │ ├── gcc_nrf51_common.ld │ │ ├── gcc_startup_nrf51.s │ │ ├── gcc_startup_nrf52.s │ │ ├── nrf51_common.ld │ │ ├── nrf51_xxaa.ld │ │ ├── nrf51_xxab.ld │ │ ├── nrf51_xxac.ld │ │ ├── nrf52_common.ld │ │ ├── nrf52_xxaa.ld │ │ └── nrf5x_common.ld │ │ ├── system_nrf52.c │ │ └── system_nrf52.h │ ├── delay.c │ ├── delay.h │ ├── hooks.c │ ├── itoa.c │ ├── itoa.h │ ├── main.cpp │ ├── startup_nrf52.S │ ├── syscalls.c │ ├── syscalls.h │ ├── system_nrf52.c │ ├── system_nrf52.h │ ├── wiring.c │ ├── wiring.h │ ├── wiring_analog.c │ ├── wiring_analog.h │ ├── wiring_constants.h │ ├── wiring_digital.c │ ├── wiring_digital.h │ ├── wiring_private.h │ ├── wiring_shift.c │ └── wiring_shift.h ├── drivers ├── dpinst-amd64.exe ├── dpinst-x86.exe ├── license │ ├── .DS_Store │ └── libusb0 │ │ └── installer_license.txt ├── x64 │ ├── desktop.ini │ ├── mbedClassCoInst_x64.dll │ ├── mbedComposite_x64.inf │ ├── mbedComposite_x64.sys │ ├── mbedDevInst_x64.dll │ ├── mbedSerial_x64.inf │ ├── mbedSerial_x64.sys │ ├── mbedcomposite_x64.cat │ └── mbedserial_x64.cat └── x86 │ ├── mbedClassCoInst.dll │ ├── mbedComposite.inf │ ├── mbedComposite.sys │ ├── mbedDevInst.dll │ ├── mbedSerial.inf │ ├── mbedSerial.sys │ ├── mbedcomposite.cat │ └── mbedserial.cat ├── firmwares └── primo │ ├── softdevice │ ├── s132_nrf52_2.0.0_licence_agreement.txt │ └── s132_nrf52_2.0.0_softdevice.hex │ └── stm32 │ ├── stm32f103xb_primo_bl_2.4.1_1.0.0.bin │ └── stm32f103xb_primo_if_2.4.1_1.0.1.bin ├── libraries ├── BLE │ ├── API.md │ ├── BLEAttribute.cpp │ ├── BLEAttribute.h │ ├── BLEBondStore.cpp │ ├── BLEBondStore.h │ ├── BLECentral.cpp │ ├── BLECentral.h │ ├── BLECentralRole.cpp │ ├── BLECentralRole.h │ ├── BLECharacteristic.cpp │ ├── BLECharacteristic.h │ ├── BLEConstantCharacteristic.cpp │ ├── BLEConstantCharacteristic.h │ ├── BLEDescriptor.cpp │ ├── BLEDescriptor.h │ ├── BLEDevice.cpp │ ├── BLEDevice.h │ ├── BLEDeviceLimits.h │ ├── BLEFixedLengthCharacteristic.cpp │ ├── BLEFixedLengthCharacteristic.h │ ├── BLEHID.cpp │ ├── BLEHID.h │ ├── BLEHIDPeripheral.cpp │ ├── BLEHIDPeripheral.h │ ├── BLEHIDReportMapCharacteristic.cpp │ ├── BLEHIDReportMapCharacteristic.h │ ├── BLEHIDReportReferenceDescriptor.cpp │ ├── BLEHIDReportReferenceDescriptor.h │ ├── BLEKeyboard.cpp │ ├── BLEKeyboard.h │ ├── BLELocalAttribute.cpp │ ├── BLELocalAttribute.h │ ├── BLEManager.cpp │ ├── BLEManager.h │ ├── BLEMouse.cpp │ ├── BLEMouse.h │ ├── BLEMultimedia.cpp │ ├── BLEMultimedia.h │ ├── BLENode.cpp │ ├── BLENode.h │ ├── BLEPeripheral.cpp │ ├── BLEPeripheral.h │ ├── BLEProgmemConstantCharacteristic.cpp │ ├── BLEProgmemConstantCharacteristic.h │ ├── BLERemoteAttribute.cpp │ ├── BLERemoteAttribute.h │ ├── BLERemoteCharacteristic.cpp │ ├── BLERemoteCharacteristic.h │ ├── BLERemoteService.cpp │ ├── BLERemoteService.h │ ├── BLESerial.cpp │ ├── BLESerial.h │ ├── BLEService.cpp │ ├── BLEService.h │ ├── BLESystemControl.cpp │ ├── BLESystemControl.h │ ├── BLETypedCharacteristic.h │ ├── BLETypedCharacteristics.cpp │ ├── BLETypedCharacteristics.h │ ├── BLEUtil.cpp │ ├── BLEUtil.h │ ├── BLEUuid.cpp │ ├── BLEUuid.h │ ├── EddystoneBeacon.cpp │ ├── EddystoneBeacon.h │ ├── LICENSE │ ├── README.md │ ├── examples │ │ ├── Central │ │ │ ├── Bonding │ │ │ │ ├── enterPasskeyCentral │ │ │ │ │ └── enterPasskeyCentral.ino │ │ │ │ └── showPasskeyCentral │ │ │ │ │ └── showPasskeyCentral.ino │ │ │ ├── CTSServer │ │ │ │ └── CTSServer.ino │ │ │ ├── led_switch_client │ │ │ │ └── led_switch_client.ino │ │ │ ├── multilink │ │ │ │ └── multilink.ino │ │ │ ├── scanner │ │ │ │ └── scanner.ino │ │ │ └── serialClient │ │ │ │ └── serialClient.ino │ │ ├── Peripheral │ │ │ ├── Bonding │ │ │ │ ├── enterPasskey │ │ │ │ │ └── enterPasskey.ino │ │ │ │ └── showPasskey │ │ │ │ │ └── showPasskey.ino │ │ │ ├── CTSClient │ │ │ │ └── CTSClient.ino │ │ │ ├── Eddystone │ │ │ │ ├── EddystoneUID │ │ │ │ │ └── EddystoneUID.ino │ │ │ │ └── EddystoneURL │ │ │ │ │ └── EddystoneURL.ino │ │ │ ├── HID │ │ │ │ ├── HID_joystick_mouse │ │ │ │ │ └── HID_joystick_mouse.ino │ │ │ │ ├── HID_keyboard │ │ │ │ │ └── HID_keyboard.ino │ │ │ │ ├── HID_keypad │ │ │ │ │ └── HID_keypad.ino │ │ │ │ └── HID_test │ │ │ │ │ └── HID_test.ino │ │ │ ├── README.md │ │ │ ├── ancs │ │ │ │ └── ancs.ino │ │ │ ├── iBeacon │ │ │ │ └── iBeacon.ino │ │ │ ├── led │ │ │ │ └── led.ino │ │ │ ├── led_callback │ │ │ │ └── led_callback.ino │ │ │ ├── led_switch │ │ │ │ └── led_switch.ino │ │ │ ├── remote_service │ │ │ │ └── remote_service.ino │ │ │ ├── remote_test │ │ │ │ └── remote_test.ino │ │ │ ├── serial │ │ │ │ └── serial.ino │ │ │ └── starter │ │ │ │ └── starter.ino │ │ └── multirole │ │ │ └── multirole.ino │ ├── iBeacon.cpp │ ├── iBeacon.h │ ├── keywords.txt │ ├── library.json │ ├── library.properties │ ├── nRF51822.cpp │ ├── nRF51822.h │ ├── nRF8001.cpp │ ├── nRF8001.h │ ├── set-version.sh │ └── utility │ │ ├── README.md │ │ ├── RFduino │ │ ├── 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_sdm.h │ │ ├── nrf_soc.h │ │ ├── nrf_svc.h │ │ └── softdevice_assert.h │ │ ├── aci.h │ │ ├── aci_cmds.h │ │ ├── aci_evts.h │ │ ├── aci_protocol_defines.h │ │ ├── aci_queue.cpp │ │ ├── aci_queue.h │ │ ├── acilib.cpp │ │ ├── acilib.h │ │ ├── acilib_defs.h │ │ ├── acilib_if.h │ │ ├── acilib_types.h │ │ ├── ble_assert.h │ │ ├── boards.h │ │ ├── dtm.h │ │ ├── hal_aci_tl.cpp │ │ ├── hal_aci_tl.h │ │ ├── hal_platform.h │ │ ├── lib_aci.cpp │ │ └── lib_aci.h ├── CIR │ ├── cir.cpp │ ├── cir.h │ ├── examples │ │ ├── Receiver │ │ │ └── Receiver.ino │ │ └── Transmitter │ │ │ └── Transmitter.ino │ ├── keywords.txt │ └── library.properties ├── Comparator │ ├── Comparator.cpp │ ├── Comparator.h │ ├── examples │ │ └── CompareVoltages │ │ │ └── CompareVoltages.ino │ ├── keywords.txt │ └── library.properties ├── CoreSensors │ ├── examples │ │ ├── DoubleTap │ │ │ └── DoubleTap.ino │ │ ├── FreeFall │ │ │ └── FreeFall.ino │ │ ├── Orientation6D │ │ │ └── Orientation6D.ino │ │ ├── Pedometer │ │ │ └── Pedometer.ino │ │ ├── SensorsDataLogTerminal │ │ │ └── SensorsDataLogTerminal.ino │ │ ├── Tap │ │ │ └── Tap.ino │ │ ├── Tilt │ │ │ └── Tilt.ino │ │ └── WakeUp │ │ │ └── WakeUp.ino │ ├── keywords.txt │ ├── library.properties │ └── src │ │ ├── CoreSensors.cpp │ │ ├── CoreSensors.h │ │ ├── DevI2C_Arduino │ │ ├── DevI2C.cpp │ │ └── DevI2C.h │ │ ├── HTS221Sensor │ │ ├── HTS221Sensor.cpp │ │ ├── HTS221Sensor.h │ │ ├── HTS221_Driver.c │ │ └── HTS221_Driver.h │ │ ├── LIS3MDLSensor │ │ ├── LIS3MDLSensor.cpp │ │ ├── LIS3MDLSensor.h │ │ ├── LIS3MDL_MAG_driver.c │ │ └── LIS3MDL_MAG_driver.h │ │ └── LSM6DS3Sensor │ │ ├── LSM6DS3Sensor.cpp │ │ ├── LSM6DS3Sensor.h │ │ ├── LSM6DS3_ACC_GYRO_driver.c │ │ └── LSM6DS3_ACC_GYRO_driver.h ├── NFC │ ├── NFC.cpp │ ├── NFC.h │ ├── examples │ │ ├── SendText │ │ │ └── SendText.ino │ │ ├── SendURL │ │ │ └── SendURL.ino │ │ └── StartApp │ │ │ └── StartApp.ino │ ├── keywords.txt │ └── library.properties ├── PPI │ ├── PPI.cpp │ ├── PPI.h │ ├── examples │ │ ├── LowPowerBlink │ │ │ └── LowPowerBlink.ino │ │ └── SenseNFC │ │ │ └── SenseNFC.ino │ ├── keywords.txt │ └── library.properties ├── RTC │ ├── RTCInt.cpp │ ├── RTCInt.h │ └── examples │ │ ├── ALARM_interrupt │ │ └── ALARM_interrupt.ino │ │ ├── ALARM_polled │ │ └── ALARM_polled.ino │ │ ├── RTC_simple │ │ └── RTC_simple.ino │ │ └── RTC_simple_24H_mode │ │ └── RTC_simple_24H_mode.ino ├── SPI │ ├── SPI.cpp │ ├── SPI.h │ ├── examples │ │ ├── BarometricPressureSensor │ │ │ └── BarometricPressureSensor.ino │ │ ├── DigitalPotControl │ │ │ └── DigitalPotControl.ino │ │ ├── MasterSend │ │ │ └── MasterSend.ino │ │ └── SlaveReceive │ │ │ └── SlaveReceive.ino │ ├── keywords.txt │ └── library.properties ├── SoftwareSerial │ ├── SoftwareSerial.cpp │ ├── SoftwareSerial.h │ ├── examples │ │ ├── SoftwareSerialExample │ │ │ └── SoftwareSerialExample.ino │ │ └── TwoPortReceive │ │ │ └── TwoPortReceive.ino │ ├── keywords.txt │ └── library.properties └── Wire │ ├── Wire.cpp │ ├── Wire.h │ ├── examples │ ├── SFRRanger_reader │ │ └── SFRRanger_reader.pde │ ├── digital_potentiometer │ │ └── digital_potentiometer.pde │ ├── master_reader │ │ └── master_reader.ino │ ├── master_writer │ │ └── master_writer.pde │ ├── slave_receiver │ │ └── slave_receiver.pde │ └── slave_sender │ │ └── slave_sender.pde │ ├── keywords.txt │ └── library.properties ├── platform.txt ├── post_install.bat ├── programmers.txt ├── readme.md └── variants ├── arduino_primo ├── linker_scripts │ └── gcc │ │ ├── flash.ld │ │ └── flash_without_softdevice.ld ├── openocd_scripts │ └── arduino_primo.cfg ├── pins_arduino.h ├── variant.cpp └── variant.h └── arduino_primo_core ├── linker_scripts └── gcc │ ├── flash.ld │ └── flash_without_softdevice.ld ├── openocd_scripts └── arduino_primo.cfg ├── pins_arduino.h ├── variant.cpp └── variant.h /.gitattributes: -------------------------------------------------------------------------------- 1 | *.inf eol=crlf 2 | *.bat eol=crlf 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | dist/* 2 | .DS_Store 3 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 1.0.2 2 | ###### Core: 3 | - Added Primo Core platform 4 | - Added DFU service in all Primo and Primo Core sketches 5 | 6 | ###### Libraries: 7 | - Added CoreSensor library 8 | 9 | ###### Misc: 10 | - Added bootloader files 11 | 12 | ## 1.0.1 13 | ###### Core: 14 | - Fixed Tone issue if no duration was indicate 15 | 16 | ###### Libraries: 17 | - Added BAT library 18 | - Modified CIR library 19 | - Fixed pins initialization in Wire library 20 | 21 | ###### Misc: 22 | - Added CHANGELOG.md 23 | - Updated drivers for Windows 24 | - Updated STM32 firmware 25 | 26 | ## 1.0.0 - 2017-04-21 27 | First release -------------------------------------------------------------------------------- /boards.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016-2017 Arduino Srl. All right reserved. 2 | # 3 | 4 | #menu.upload=Upload 5 | 6 | ##################################### 7 | ########### ARDUINO PRIMO ########### 8 | 9 | primo.name=Arduino Primo 10 | primo.vid.0=0x2a03 11 | primo.pid.0=0x805a 12 | 13 | #primo.menu.upload.serial=via Serial 14 | #primo.menu.upload.bluetooth=via Bluetooth 15 | #primo.menu.upload.bluetooth.upload.tool=otable 16 | 17 | primo.upload.tool=openocd 18 | primo.upload.protocol=sam-ba 19 | primo.upload.maximum_size=385024 20 | primo.upload.use_1200bps_touch=false 21 | primo.upload.speed=115200 22 | primo.upload.wait_for_upload_port=false 23 | 24 | primo.build.mcu=cortex-m4 25 | primo.build.f_cpu=64000000L 26 | primo.build.usb_product="Arduino Primo" 27 | primo.build.board=NRF52_PRIMO 28 | primo.build.core=arduino 29 | primo.build.extra_flags=-mthumb -DESP_CH_SPI 30 | primo.build.ldscript=linker_scripts/gcc/flash.ld 31 | primo.build.openocdscript=openocd_scripts/arduino_primo.cfg 32 | primo.build.variant=arduino_primo 33 | primo.build.components=components 34 | primo.build.vid=0x2a03 35 | primo.build.pid=0x805a 36 | 37 | primo.bootloader.file=primo/bootloader_primo_v1.0.0.hex 38 | primo.firmware.softdevice.file=primo/softdevice/s132_nrf52_2.0.0_softdevice.hex 39 | 40 | 41 | ##################################### 42 | ######## ARDUINO PRIMO CORE ######### 43 | 44 | primo_core.name=Arduino Primo Core 45 | 46 | #primo_core.menu.upload.serial=via Serial 47 | #primo_core.menu.upload.bluetooth=via Bluetooth 48 | #primo_core.menu.upload.bluetooth.upload.tool=otable 49 | 50 | primo_core.upload.tool=openocd 51 | primo_core.upload.protocol=sam-ba 52 | primo_core.upload.maximum_size=385024 53 | primo_core.upload.use_1200bps_touch=false 54 | primo_core.upload.speed=115200 55 | primo_core.upload.wait_for_upload_port=false 56 | 57 | primo_core.build.mcu=cortex-m4 58 | primo_core.build.f_cpu=64000000L 59 | primo_core.build.usb_product="Arduino Primo Core" 60 | primo_core.build.board=NRF52_PRIMO_CORE 61 | primo_core.build.core=arduino 62 | primo_core.build.extra_flags=-mthumb 63 | primo_core.build.ldscript=linker_scripts/gcc/flash.ld 64 | primo_core.build.openocdscript=openocd_scripts/arduino_primo.cfg 65 | primo_core.build.variant=arduino_primo_core 66 | primo_core.build.components=components 67 | 68 | primo_core.bootloader.file=primo_core/bootloader_primo_core_v1.0.0.hex 69 | primo_core.firmware.softdevice.file=primo/softdevice/s132_nrf52_2.0.0_softdevice.hex 70 | -------------------------------------------------------------------------------- /cores/arduino/Client.h: -------------------------------------------------------------------------------- 1 | /* 2 | Client.h - Base class that provides Client 3 | Copyright (c) 2011 Adrian McEwen. All right reserved. 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifndef client_h 21 | #define client_h 22 | #include "Print.h" 23 | #include "Stream.h" 24 | #include "IPAddress.h" 25 | 26 | class Client : public Stream { 27 | 28 | public: 29 | virtual int connect(IPAddress ip, uint16_t port) =0; 30 | virtual int connect(const char *host, uint16_t port) =0; 31 | virtual size_t write(uint8_t) =0; 32 | virtual size_t write(const uint8_t *buf, size_t size) =0; 33 | virtual int available() = 0; 34 | virtual int read() = 0; 35 | virtual int read(uint8_t *buf, size_t size) = 0; 36 | virtual int peek() = 0; 37 | virtual void flush() = 0; 38 | virtual void stop() = 0; 39 | virtual uint8_t connected() = 0; 40 | virtual operator bool() = 0; 41 | protected: 42 | uint8_t* rawIPAddress(IPAddress& addr) { return addr.raw_address(); }; 43 | }; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /cores/arduino/DFUService.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Arduino. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | 18 | */ 19 | 20 | #ifndef _DFU_SERVICE_H 21 | #define _DFU_SERVICE_H 22 | 23 | 24 | /* 25 | * \brief Choose if remove or not the DFU service from the sketches (enabled by default). 26 | * 27 | * \param remove 28 | */ 29 | extern void removeDfuService(bool remove); 30 | 31 | 32 | /* 33 | * \brief Indicate whether DFU service is enabled or not. 34 | * 35 | */ 36 | extern bool dfuIsEnabled(); 37 | 38 | 39 | /* 40 | * \brief Add DFU service to the sketch. 41 | * 42 | */ 43 | extern void add_dfu_service(); 44 | 45 | /* 46 | * \brief Set parameters used in bonding procedure from external libraries. 47 | * 48 | * \param Bond, Mimt, Lest, IO_caps 49 | */ 50 | extern void setSecParams(uint8_t Bond, uint8_t Mitm, uint8_t Lesc, uint8_t IO_caps); 51 | 52 | extern void eraseBond(); 53 | extern void initDM(); 54 | /* 55 | * \brief Receive and forward all BLE events. 56 | * 57 | * \param p_ble_evt 58 | */ 59 | extern void ble_evt_dispatch(ble_evt_t * p_ble_evt); 60 | 61 | #ifdef __cplusplus 62 | extern "C"{ 63 | #endif 64 | extern void forwardEvent(uint32_t type, uint32_t code); 65 | #ifdef __cplusplus 66 | } 67 | #endif 68 | 69 | #endif /*_DFU_SERVICE_H*/ -------------------------------------------------------------------------------- /cores/arduino/HardwareSerial.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 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 "Stream.h" 25 | 26 | //NRF52 provide even parity only 27 | #define HARDSER_PARITY_EVEN (0x1ul) 28 | #define HARDSER_PARITY_NONE (0x3ul) 29 | #define HARDSER_PARITY_MASK (0xFul) 30 | 31 | #define HARDSER_STOP_BIT_1 (0x10ul) 32 | 33 | #define HARDSER_DATA_8 (0x400ul) 34 | 35 | #define SERIAL_8N1 (HARDSER_STOP_BIT_1 | HARDSER_PARITY_NONE | HARDSER_DATA_8) 36 | #define SERIAL_8E1 (HARDSER_STOP_BIT_1 | HARDSER_PARITY_EVEN | HARDSER_DATA_8) 37 | 38 | class HardwareSerial : public Stream 39 | { 40 | public: 41 | virtual void begin(unsigned long) {}; 42 | virtual void end() {}; 43 | virtual int available(void) = 0; 44 | virtual int peek(void) = 0; 45 | virtual int read(void) = 0; 46 | virtual void flush(void) = 0; 47 | virtual size_t write(uint8_t) = 0; 48 | using Print::write; // pull in write(str) and write(buf, size) from Print 49 | virtual operator bool() = 0; 50 | }; 51 | 52 | extern void serialEventRun(void) __attribute__((weak)); 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /cores/arduino/IPAddress.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | IPAddress.cpp - Base class that provides IPAddress 3 | Copyright (c) 2011 Adrian McEwen. All right reserved. 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #include 21 | #include 22 | 23 | IPAddress::IPAddress() 24 | { 25 | memset(_address, 0, sizeof(_address)); 26 | } 27 | 28 | IPAddress::IPAddress(uint8_t first_octet, uint8_t second_octet, uint8_t third_octet, uint8_t fourth_octet) 29 | { 30 | _address[0] = first_octet; 31 | _address[1] = second_octet; 32 | _address[2] = third_octet; 33 | _address[3] = fourth_octet; 34 | } 35 | 36 | IPAddress::IPAddress(uint32_t address) 37 | { 38 | memcpy(_address, &address, sizeof(_address)); 39 | } 40 | 41 | IPAddress::IPAddress(const uint8_t *address) 42 | { 43 | memcpy(_address, address, sizeof(_address)); 44 | } 45 | 46 | IPAddress& IPAddress::operator=(const uint8_t *address) 47 | { 48 | memcpy(_address, address, sizeof(_address)); 49 | return *this; 50 | } 51 | 52 | IPAddress& IPAddress::operator=(uint32_t address) 53 | { 54 | memcpy(_address, (const uint8_t *)&address, sizeof(_address)); 55 | return *this; 56 | } 57 | 58 | bool IPAddress::operator==(const uint8_t* addr) const 59 | { 60 | return memcmp(addr, _address, sizeof(_address)) == 0; 61 | } 62 | 63 | size_t IPAddress::printTo(Print& p) const 64 | { 65 | size_t n = 0; 66 | for (int i =0; i < 3; i++) 67 | { 68 | n += p.print(_address[i], DEC); 69 | n += p.print('.'); 70 | } 71 | n += p.print(_address[3], DEC); 72 | return n; 73 | } 74 | 75 | -------------------------------------------------------------------------------- /cores/arduino/Printable.h: -------------------------------------------------------------------------------- 1 | /* 2 | Printable.h - Interface class that allows printing of complex types 3 | Copyright (c) 2011 Adrian McEwen. All right reserved. 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifndef Printable_h 21 | #define Printable_h 22 | 23 | #include 24 | 25 | class Print; 26 | 27 | /** The Printable class provides a way for new classes to allow themselves to be printed. 28 | By deriving from Printable and implementing the printTo method, it will then be possible 29 | for users to print out instances of this class by passing them into the usual 30 | Print::print and Print::println methods. 31 | */ 32 | 33 | class Printable 34 | { 35 | public: 36 | virtual size_t printTo(Print& p) const = 0; 37 | }; 38 | 39 | #endif 40 | 41 | -------------------------------------------------------------------------------- /cores/arduino/RingBuffer.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011 Arduino. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #include "RingBuffer.h" 20 | #include 21 | 22 | RingBuffer::RingBuffer( void ) 23 | { 24 | memset( _aucBuffer, 0, SERIAL_BUFFER_SIZE ) ; 25 | clear(); 26 | } 27 | 28 | void RingBuffer::store_char( uint8_t c ) 29 | { 30 | int i = nextIndex(_iHead); 31 | 32 | // if we should be storing the received character into the location 33 | // just before the tail (meaning that the head would advance to the 34 | // current location of the tail), we're about to overflow the buffer 35 | // and so we don't write the character or advance the head. 36 | if ( i != _iTail ) 37 | { 38 | _aucBuffer[_iHead] = c ; 39 | _iHead = i ; 40 | } 41 | } 42 | 43 | void RingBuffer::clear() 44 | { 45 | _iHead = 0; 46 | _iTail = 0; 47 | } 48 | 49 | int RingBuffer::read_char() 50 | { 51 | if(_iTail == _iHead) 52 | return -1; 53 | 54 | uint8_t value = _aucBuffer[_iTail]; 55 | _iTail = nextIndex(_iTail); 56 | 57 | return value; 58 | } 59 | 60 | int RingBuffer::available() 61 | { 62 | int delta = _iHead - _iTail; 63 | 64 | if(delta < 0) 65 | return SERIAL_BUFFER_SIZE + delta; 66 | else 67 | return delta; 68 | } 69 | 70 | int RingBuffer::peek() 71 | { 72 | if(_iTail == _iHead) 73 | return -1; 74 | 75 | return _aucBuffer[_iTail]; 76 | } 77 | 78 | int RingBuffer::nextIndex(int index) 79 | { 80 | return (uint32_t)(index + 1) % SERIAL_BUFFER_SIZE; 81 | } 82 | 83 | bool RingBuffer::isFull() 84 | { 85 | return (nextIndex(_iHead) == _iTail); 86 | } 87 | -------------------------------------------------------------------------------- /cores/arduino/RingBuffer.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011 Arduino. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef _RING_BUFFER_ 20 | #define _RING_BUFFER_ 21 | 22 | #include 23 | 24 | // Define constants and variables for buffering incoming serial data. We're 25 | // using a ring buffer (I think), in which head is the index of the location 26 | // to which to write the next incoming character and tail is the index of the 27 | // location from which to read. 28 | #define SERIAL_BUFFER_SIZE 64 29 | 30 | class RingBuffer 31 | { 32 | public: 33 | uint8_t _aucBuffer[SERIAL_BUFFER_SIZE] ; 34 | int _iHead ; 35 | int _iTail ; 36 | 37 | public: 38 | RingBuffer( void ) ; 39 | void store_char( uint8_t c ) ; 40 | void clear(); 41 | int read_char(); 42 | int available(); 43 | int peek(); 44 | bool isFull(); 45 | 46 | private: 47 | int nextIndex(int index); 48 | } ; 49 | 50 | #endif /* _RING_BUFFER_ */ 51 | -------------------------------------------------------------------------------- /cores/arduino/RingBufferT.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011 Arduino. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #include "RingBufferT.h" 20 | #include 21 | 22 | template 23 | RingBufferT::RingBufferT(){ 24 | clear(); 25 | _bufferSize = size; 26 | } 27 | 28 | template 29 | bool RingBufferT::put(T *value){ 30 | if(isFull()) return false; 31 | _buffer[_head] = *value; 32 | _head = nextIndex(_head); 33 | return true; 34 | } 35 | 36 | template 37 | bool RingBufferT::get(T *value){ 38 | if(isEmpty()) return false; 39 | *value = _buffer[_tail]; 40 | _tail = nextIndex(_tail); 41 | return true; 42 | } 43 | 44 | template 45 | bool RingBufferT::peek(T *value){ 46 | if(isEmpty()) return false; 47 | *value = _buffer[_tail]; 48 | return true; 49 | } 50 | 51 | template 52 | void RingBufferT::clear(){ 53 | _head = 0; 54 | _tail = 0; 55 | } 56 | 57 | template 58 | int RingBufferT::available(){ 59 | if(_tail > _head) return _bufferSize + _head - _tail; 60 | else return _head - _tail; 61 | } 62 | 63 | template 64 | int RingBufferT::nextIndex(int index){ 65 | return (uint32_t)(index + 1) % _bufferSize; 66 | } 67 | 68 | template 69 | bool RingBufferT::isFull(){ 70 | return nextIndex(_head) == _tail; 71 | } 72 | 73 | template 74 | bool RingBufferT::isEmpty(){ 75 | return _head == _tail; 76 | } 77 | -------------------------------------------------------------------------------- /cores/arduino/RingBufferT.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011 Arduino. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef __RING_BUFFER_T 20 | #define __RING_BUFFER_T 21 | 22 | #include 23 | 24 | // Define constants and variables for buffering incoming serial data. We're 25 | // using a ring buffer (I think), in which head is the index of the location 26 | // to which to write the next incoming character and tail is the index of the 27 | // location from which to read. 28 | #define SERIAL_BUFFER_SIZE 64 29 | 30 | template 31 | class RingBufferT 32 | { 33 | public: 34 | RingBufferT(); 35 | bool put(T *value); 36 | bool get(T *value); 37 | bool peek(T *value); 38 | void clear(); 39 | bool isEmpty(); 40 | bool isFull(); 41 | int available(); 42 | 43 | private: 44 | int nextIndex(int index); 45 | 46 | int _head; 47 | int _tail; 48 | T _buffer[size]; 49 | int _bufferSize; 50 | }; 51 | 52 | #endif /* __RING_BUFFER_T */ 53 | -------------------------------------------------------------------------------- /cores/arduino/Server.h: -------------------------------------------------------------------------------- 1 | /* 2 | Server.h - Base class that provides Server 3 | Copyright (c) 2011 Adrian McEwen. All right reserved. 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifndef server_h 21 | #define server_h 22 | 23 | #include "Print.h" 24 | 25 | class Server : public Print { 26 | public: 27 | virtual void begin() =0; 28 | }; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /cores/arduino/Tone.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Arduino. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef _WIRING_TONE_ 20 | #define _WIRING_TONE_ 21 | 22 | #include 23 | #include 24 | #include 25 | #include "wiring_digital.h" 26 | #include "nrf_pwm.h" 27 | 28 | 29 | void tone(uint8_t pin, unsigned int frequency, unsigned long duration = 0); 30 | void noTone(uint8_t pin); 31 | 32 | 33 | 34 | #endif /* _WIRING_TONE_ */ 35 | -------------------------------------------------------------------------------- /cores/arduino/Uart.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 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 _UART_CLASS 20 | #define _UART_CLASS 21 | 22 | #include "HardwareSerial.h" 23 | #include "RingBuffer.h" 24 | #include "nrf_uarte.h" 25 | 26 | #include 27 | 28 | 29 | class Uart : public HardwareSerial 30 | { 31 | public: 32 | Uart(uint8_t _pinRX, uint8_t _pinTX); 33 | void begin(unsigned long baudRate); 34 | void begin(unsigned long baudrate, uint8_t config); 35 | void end(); 36 | int available(); 37 | int peek(); 38 | int read(); 39 | void flush(); 40 | size_t write(const uint8_t data); 41 | size_t write(const char * data); 42 | 43 | void IrqHandler(); 44 | 45 | operator bool() { return true; } 46 | 47 | private: 48 | RingBuffer rxBuffer; 49 | 50 | uint8_t uc_pinRX; 51 | uint8_t uc_pinTX; 52 | 53 | nrf_uarte_baudrate_t adaptBaudrate(unsigned long baudRate); 54 | nrf_uarte_parity_t extractParity(uint8_t config); 55 | }; 56 | 57 | extern Uart Serial; 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /cores/arduino/WInterrupts.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Arduino. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef _WIRING_INTERRUPTS_ 20 | #define _WIRING_INTERRUPTS_ 21 | 22 | #include 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | #define CHANGE 2 29 | #define FALLING 3 30 | #define RISING 4 31 | #define DEFAULT 1 32 | #define EXTERNAL 0 33 | 34 | typedef void (*voidFuncPtr)( void ) ; 35 | 36 | /* 37 | * \brief Specifies a named Interrupt Service Routine (ISR) to call when an interrupt occurs. 38 | * Replaces any previous function that was attached to the interrupt. 39 | */ 40 | 41 | int attachInterrupt( uint32_t ulPin, voidFuncPtr callback, uint32_t mode ) ; 42 | 43 | /* 44 | * \brief Turns off the given interrupt. 45 | */ 46 | void detachInterrupt( uint32_t ulPin ) ; 47 | 48 | #ifdef __cplusplus 49 | } 50 | #endif 51 | 52 | #endif /* _WIRING_INTERRUPTS_ */ 53 | -------------------------------------------------------------------------------- /cores/arduino/WMath.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011 Arduino. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | extern "C" { 20 | #include "stdlib.h" 21 | #include "stdint.h" 22 | } 23 | #include "WMath.h" 24 | 25 | extern void randomSeed( uint32_t dwSeed ) 26 | { 27 | if ( dwSeed != 0 ) 28 | { 29 | srand( dwSeed ) ; 30 | } 31 | } 32 | 33 | extern long random( long howbig ) 34 | { 35 | if ( howbig == 0 ) 36 | { 37 | return 0 ; 38 | } 39 | 40 | return rand() % howbig; 41 | } 42 | 43 | extern long random( long howsmall, long howbig ) 44 | { 45 | if (howsmall >= howbig) 46 | { 47 | return howsmall; 48 | } 49 | 50 | long diff = howbig - howsmall; 51 | 52 | return random(diff) + howsmall; 53 | } 54 | 55 | extern long map(long x, long in_min, long in_max, long out_min, long out_max) 56 | { 57 | return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; 58 | } 59 | 60 | extern uint16_t makeWord( uint16_t w ) 61 | { 62 | return w ; 63 | } 64 | 65 | extern uint16_t makeWord( uint8_t h, uint8_t l ) 66 | { 67 | return (h << 8) | l ; 68 | } 69 | -------------------------------------------------------------------------------- /cores/arduino/WMath.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011 Arduino. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef _WIRING_MATH_ 20 | #define _WIRING_MATH_ 21 | 22 | extern long random( long ) ; 23 | extern long random( long, long ) ; 24 | extern void randomSeed( uint32_t dwSeed ) ; 25 | extern long map( long, long, long, long, long ) ; 26 | 27 | extern uint16_t makeWord( uint16_t w ) ; 28 | extern uint16_t makeWord( uint8_t h, uint8_t l ) ; 29 | 30 | #define word(...) makeWord(__VA_ARGS__) 31 | 32 | 33 | #endif /* _WIRING_MATH_ */ 34 | -------------------------------------------------------------------------------- /cores/arduino/avr/dtostrf.c: -------------------------------------------------------------------------------- 1 | /* 2 | dtostrf - Emulation for dtostrf function from avr-libc 3 | Copyright (c) 2013 Arduino. All rights reserved. 4 | Written by Cristian Maglie 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 | #include 22 | 23 | char *dtostrf (double val, signed char width, unsigned char prec, char *sout) { 24 | asm(".global _printf_float"); 25 | char fmt[20]; 26 | sprintf(fmt, "%%%d.%df", width, prec); 27 | sprintf(sout, fmt, val); 28 | return sout; 29 | } 30 | 31 | -------------------------------------------------------------------------------- /cores/arduino/avr/dtostrf.h: -------------------------------------------------------------------------------- 1 | /* 2 | dtostrf - Emulation for dtostrf function from avr-libc 3 | Copyright (c) 2013 Arduino. All rights reserved. 4 | Written by Cristian Maglie 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 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | char *dtostrf (double val, signed char width, unsigned char prec, char *sout); 26 | 27 | #ifdef __cplusplus 28 | } 29 | #endif 30 | -------------------------------------------------------------------------------- /cores/arduino/avr/interrupt.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduino/ArduinoCore-primo/cd54ab663d93e60e5a53d2d05f13f16e3cc147e7/cores/arduino/avr/interrupt.h -------------------------------------------------------------------------------- /cores/arduino/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 | -------------------------------------------------------------------------------- /cores/arduino/components/ble/common/ble_date_time.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduino/ArduinoCore-primo/cd54ab663d93e60e5a53d2d05f13f16e3cc147e7/cores/arduino/components/ble/common/ble_date_time.h -------------------------------------------------------------------------------- /cores/arduino/components/ble/common/ble_sensor_location.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduino/ArduinoCore-primo/cd54ab663d93e60e5a53d2d05f13f16e3cc147e7/cores/arduino/components/ble/common/ble_sensor_location.h -------------------------------------------------------------------------------- /cores/arduino/components/ble/common/ble_srv_common.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduino/ArduinoCore-primo/cd54ab663d93e60e5a53d2d05f13f16e3cc147e7/cores/arduino/components/ble/common/ble_srv_common.c -------------------------------------------------------------------------------- /cores/arduino/components/drivers_nrf/delay/nrf_delay.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2010 - 2017, Nordic Semiconductor ASA All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are met: 5 | * 6 | * 1. Redistributions of source code must retain the above copyright notice, this 7 | * list of conditions and the following disclaimer. 8 | * 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * 3. Neither the name of Nordic Semiconductor ASA nor the names of its 14 | * contributors may be used to endorse or promote products derived from this 15 | * software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE 21 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | * POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #include 31 | #include "compiler_abstraction.h" 32 | #include "nrf.h" 33 | #include "nrf_delay.h" 34 | 35 | /*lint --e{438} "Variable not used" */ 36 | void nrf_delay_ms(uint32_t volatile number_of_ms) 37 | { 38 | while(number_of_ms != 0) 39 | { 40 | number_of_ms--; 41 | nrf_delay_us(999); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /cores/arduino/components/drivers_nrf/nrf_soc_nosd/nrf_soc.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2010 - 2017, Nordic Semiconductor ASA All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are met: 5 | * 6 | * 1. Redistributions of source code must retain the above copyright notice, this 7 | * list of conditions and the following disclaimer. 8 | * 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * 3. Neither the name of Nordic Semiconductor ASA nor the names of its 14 | * contributors may be used to endorse or promote products derived from this 15 | * software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE 21 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | * POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #include 31 | #include "nrf_soc.h" 32 | #include "nrf_error.h" 33 | 34 | uint32_t sd_app_evt_wait(void) 35 | { 36 | __WFE(); 37 | return NRF_SUCCESS; 38 | } 39 | -------------------------------------------------------------------------------- /cores/arduino/components/libraries/fstorage/fstorage_nosd.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduino/ArduinoCore-primo/cd54ab663d93e60e5a53d2d05f13f16e3cc147e7/cores/arduino/components/libraries/fstorage/fstorage_nosd.c -------------------------------------------------------------------------------- /cores/arduino/components/libraries/softuart/retarget_bitbang.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2010 - 2017, Nordic Semiconductor ASA All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are met: 5 | * 6 | * 1. Redistributions of source code must retain the above copyright notice, this 7 | * list of conditions and the following disclaimer. 8 | * 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * 3. Neither the name of Nordic Semiconductor ASA nor the names of its 14 | * contributors may be used to endorse or promote products derived from this 15 | * software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE 21 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | * POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #include 31 | #include 32 | #include "app_uart.h" 33 | #include "nordic_common.h" 34 | #include "nrf_error.h" 35 | #include "uart_bitbang.h" 36 | 37 | struct __FILE 38 | { 39 | int handle; 40 | }; 41 | 42 | FILE __stdout; 43 | FILE __stdin; 44 | 45 | 46 | 47 | int fgetc(FILE * p_file) 48 | { 49 | uint8_t input; 50 | 51 | return '0'; 52 | } 53 | 54 | 55 | int fputc(int ch, FILE * p_file) 56 | { 57 | UNUSED_PARAMETER(p_file); 58 | 59 | uart_bb_put((uint8_t)ch); 60 | return ch; 61 | } 62 | 63 | -------------------------------------------------------------------------------- /cores/arduino/components/libraries/trace/app_trace.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2010 - 2017, Nordic Semiconductor ASA All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are met: 5 | * 6 | * 1. Redistributions of source code must retain the above copyright notice, this 7 | * list of conditions and the following disclaimer. 8 | * 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * 3. Neither the name of Nordic Semiconductor ASA nor the names of its 14 | * contributors may be used to endorse or promote products derived from this 15 | * software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE 21 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | * POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #include 31 | #include 32 | #include 33 | #include 34 | 35 | 36 | #ifdef ENABLE_DEBUG_LOG_SUPPORT 37 | #include "app_trace.h" 38 | #include "nrf_log.h" 39 | 40 | void app_trace_init(void) 41 | { 42 | (void)NRF_LOG_INIT(); 43 | } 44 | 45 | void app_trace_dump(uint8_t * p_buffer, uint32_t len) 46 | { 47 | app_trace_log("\r\n"); 48 | for (uint32_t index = 0; index < len; index++) 49 | { 50 | app_trace_log("0x%02X ", p_buffer[index]); 51 | } 52 | app_trace_log("\r\n"); 53 | } 54 | 55 | #endif // ENABLE_DEBUG_LOG_SUPPORT 56 | 57 | /** 58 | *@} 59 | **/ 60 | 61 | -------------------------------------------------------------------------------- /cores/arduino/components/libraries/util/nrf_assert.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2010 - 2017, Nordic Semiconductor ASA All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are met: 5 | * 6 | * 1. Redistributions of source code must retain the above copyright notice, this 7 | * list of conditions and the following disclaimer. 8 | * 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * 3. Neither the name of Nordic Semiconductor ASA nor the names of its 14 | * contributors may be used to endorse or promote products derived from this 15 | * software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE 21 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | * POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | #include "nrf_assert.h" 30 | #include "app_error.h" 31 | #include "nordic_common.h" 32 | 33 | #if defined(DEBUG_NRF) 34 | void assert_nrf_callback(uint16_t line_num, const uint8_t * file_name) 35 | { 36 | assert_info_t assert_info = 37 | { 38 | .line_num = line_num, 39 | .p_file_name = file_name, 40 | }; 41 | app_error_fault_handler(NRF_FAULT_ID_SDK_ASSERT, 0, (uint32_t)(&assert_info)); 42 | 43 | UNUSED_VARIABLE(assert_info); 44 | } 45 | #endif /* DEBUG_NRF */ 46 | -------------------------------------------------------------------------------- /cores/arduino/components/nfc/ndef/parser/record/nfc_ndef_parser_logger.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2010 - 2017, Nordic Semiconductor ASA All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are met: 5 | * 6 | * 1. Redistributions of source code must retain the above copyright notice, this 7 | * list of conditions and the following disclaimer. 8 | * 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * 3. Neither the name of Nordic Semiconductor ASA nor the names of its 14 | * contributors may be used to endorse or promote products derived from this 15 | * software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE 21 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | * POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #ifndef NFC_NDEF_PARSER_LOGGER_H__ 31 | #define NFC_NDEF_PARSER_LOGGER_H__ 32 | 33 | #ifdef NDEF_PARSER_LOG_ENABLE 34 | #ifdef ENABLE_DEBUG_LOG_SUPPORT 35 | 36 | #include "app_trace.h" 37 | 38 | #define NDEF_PARSER_TRACE app_trace_log 39 | 40 | #elif defined(NRF_LOG_USES_RTT) 41 | 42 | #include "nrf_log.h" 43 | 44 | 45 | #define NDEF_PARSER_TRACE(...) NRF_LOG_PRINTF(##__VA_ARGS__) 46 | #endif 47 | #endif 48 | 49 | #ifndef NDEF_PARSER_TRACE 50 | #define NDEF_PARSER_TRACE(...) 51 | #endif 52 | 53 | #endif // NFC_NDEF_PARSER_LOGGER_H__ 54 | -------------------------------------------------------------------------------- /cores/arduino/components/nfc/t2t_lib/hal_t2t/hal_nfc_t2t_logger.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2010 - 2017, Nordic Semiconductor ASA All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are met: 5 | * 6 | * 1. Redistributions of source code must retain the above copyright notice, this 7 | * list of conditions and the following disclaimer. 8 | * 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * 3. Neither the name of Nordic Semiconductor ASA nor the names of its 14 | * contributors may be used to endorse or promote products derived from this 15 | * software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE 21 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | * POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #ifndef HAL_NFC_LOGGER_H__ 31 | #define HAL_NFC_LOGGER_H__ 32 | 33 | #include "nrf_log.h" 34 | 35 | #define LOG_HAL_NFC(...) NRF_LOG_PRINTF(__VA_ARGS__) 36 | 37 | #endif // HAL_NFC_LOGGER_H__ 38 | -------------------------------------------------------------------------------- /cores/arduino/components/nfc/t2t_lib/licence_agreement.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010 - 2017, Nordic Semiconductor ASA 2 | 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, except as embedded into a Nordic 12 | Semiconductor ASA integrated circuit in a product or a software update for 13 | such product, must reproduce the above copyright notice, this list of 14 | conditions and the following disclaimer in the documentation and/or other 15 | materials provided with the distribution. 16 | 17 | 3. Neither the name of Nordic Semiconductor ASA nor the names of its 18 | contributors may be used to endorse or promote products derived from this 19 | software without specific prior written permission. 20 | 21 | 4. This software, with or without modification, must only be used with a 22 | Nordic Semiconductor ASA integrated circuit. 23 | 24 | 5. Any software provided in binary form under this license must not be reverse 25 | engineered, decompiled, modified and/or disassembled. 26 | 27 | THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS 28 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 29 | OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE 30 | DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE 31 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 32 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 33 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 34 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 35 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 36 | OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /cores/arduino/components/nfc/t2t_lib/nfc_t2t_lib_gcc.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduino/ArduinoCore-primo/cd54ab663d93e60e5a53d2d05f13f16e3cc147e7/cores/arduino/components/nfc/t2t_lib/nfc_t2t_lib_gcc.a -------------------------------------------------------------------------------- /cores/arduino/components/softdevice/s132/doc/s132_nrf52_2.0.0_licence_agreement.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduino/ArduinoCore-primo/cd54ab663d93e60e5a53d2d05f13f16e3cc147e7/cores/arduino/components/softdevice/s132/doc/s132_nrf52_2.0.0_licence_agreement.pdf -------------------------------------------------------------------------------- /cores/arduino/components/softdevice/s132/doc/s132_nrf52_2.0.0_licence_agreement.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010 - 2017, Nordic Semiconductor ASA 2 | License Agreement for the Nordic Semiconductor ASA S132 Bluetooth SoftDevice software package ("SoftDevice"). 3 | All rights reserved. 4 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 5 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 6 | 7 | 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA integrated circuit in a product or a software update for such product, must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 8 | 9 | 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 10 | 11 | 4. This software, with or without modification, must only be used with a Nordic Semiconductor ASA integrated circuit. 12 | 13 | 5. Any software provided in binary form under this license must not be reverse engineered, decompiled, modified and/or disassembled. 14 | 15 | THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 16 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 17 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 18 | -------------------------------------------------------------------------------- /cores/arduino/components/softdevice/s132/doc/s132_nrf52_2.0.0_readme.txt: -------------------------------------------------------------------------------- 1 | s132_nrf52_2.0.0 2 | 3 | This release consists of the following: 4 | - This readme file 5 | - The s132_nrf52_2.0.0 API (SoftDevice header files) 6 | - The s132_nrf52_2.0.0 license agreement 7 | - The s132_nrf52_2.0.0 release notes 8 | - The s132_nrf52_2.0.0 SoftDevice (binary hex file) 9 | - The s13x_nrf5x_2.0.0 migration document 10 | -------------------------------------------------------------------------------- /cores/arduino/components/softdevice/s132/doc/s132_nrf52_2.0.0_releasenotes.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduino/ArduinoCore-primo/cd54ab663d93e60e5a53d2d05f13f16e3cc147e7/cores/arduino/components/softdevice/s132/doc/s132_nrf52_2.0.0_releasenotes.pdf -------------------------------------------------------------------------------- /cores/arduino/components/softdevice/s132/doc/s13x_nrf5x_2.0.0_migration_document.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduino/ArduinoCore-primo/cd54ab663d93e60e5a53d2d05f13f16e3cc147e7/cores/arduino/components/softdevice/s132/doc/s13x_nrf5x_2.0.0_migration_document.pdf -------------------------------------------------------------------------------- /cores/arduino/components/softdevice/s132/hex/s132_nrf52_2.0.0_licence_agreement.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010 - 2017, Nordic Semiconductor ASA 2 | License Agreement for the Nordic Semiconductor ASA S132 Bluetooth SoftDevice software package ("SoftDevice"). 3 | All rights reserved. 4 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 5 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 6 | 7 | 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA integrated circuit in a product or a software update for such product, must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 8 | 9 | 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 10 | 11 | 4. This software, with or without modification, must only be used with a Nordic Semiconductor ASA integrated circuit. 12 | 13 | 5. Any software provided in binary form under this license must not be reverse engineered, decompiled, modified and/or disassembled. 14 | 15 | THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 16 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 17 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 18 | -------------------------------------------------------------------------------- /cores/arduino/components/softdevice/s132/toolchain/armgcc/armgcc_s132_nrf52832_xxaa.ld: -------------------------------------------------------------------------------- 1 | /* Linker script to configure memory regions. */ 2 | 3 | SEARCH_DIR(.) 4 | GROUP(-lgcc -lc -lnosys) 5 | 6 | MEMORY 7 | { 8 | FLASH (rx) : ORIGIN = 0x1c000, LENGTH = 0x64000 9 | RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x10000 10 | } 11 | 12 | SECTIONS 13 | { 14 | .fs_data : 15 | { 16 | PROVIDE(__start_fs_data = .); 17 | KEEP(*(.fs_data)) 18 | PROVIDE(__stop_fs_data = .); 19 | } > RAM 20 | } INSERT AFTER .data; 21 | 22 | INCLUDE "nrf5x_common.ld" -------------------------------------------------------------------------------- /cores/arduino/components/toolchain/gcc/Makefile.posix: -------------------------------------------------------------------------------- 1 | GNU_INSTALL_ROOT := /usr/local/gcc-arm-none-eabi-4_9-2015q1 2 | GNU_VERSION := 4.9.3 3 | GNU_PREFIX := arm-none-eabi 4 | 5 | -------------------------------------------------------------------------------- /cores/arduino/components/toolchain/gcc/Makefile.windows: -------------------------------------------------------------------------------- 1 | ifeq ($(findstring 86, $(ProgramFiles)), ) 2 | PROGFILES := C:/Program Files 3 | else 4 | PROGFILES := C:/Program Files (x86) 5 | endif 6 | 7 | GNU_INSTALL_ROOT := $(PROGFILES)/GNU Tools ARM Embedded/4.9 2015q1 8 | GNU_VERSION := 4.9.3 9 | GNU_PREFIX := arm-none-eabi 10 | 11 | -------------------------------------------------------------------------------- /cores/arduino/components/toolchain/gcc/nrf51_xxaa.ld: -------------------------------------------------------------------------------- 1 | /* Linker script to configure memory regions. */ 2 | 3 | SEARCH_DIR(.) 4 | GROUP(-lgcc -lc -lnosys) 5 | 6 | MEMORY 7 | { 8 | FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x40000 9 | RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x4000 10 | } 11 | 12 | 13 | INCLUDE "nrf51_common.ld" 14 | -------------------------------------------------------------------------------- /cores/arduino/components/toolchain/gcc/nrf51_xxab.ld: -------------------------------------------------------------------------------- 1 | /* Linker script to configure memory regions. */ 2 | 3 | SEARCH_DIR(.) 4 | GROUP(-lgcc -lc -lnosys) 5 | 6 | MEMORY 7 | { 8 | FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x20000 9 | RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x4000 10 | } 11 | 12 | 13 | INCLUDE "nrf51_common.ld" 14 | -------------------------------------------------------------------------------- /cores/arduino/components/toolchain/gcc/nrf51_xxac.ld: -------------------------------------------------------------------------------- 1 | /* Linker script to configure memory regions. */ 2 | 3 | SEARCH_DIR(.) 4 | GROUP(-lgcc -lc -lnosys) 5 | 6 | MEMORY 7 | { 8 | FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x40000 9 | RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x8000 10 | } 11 | 12 | 13 | INCLUDE "nrf51_common.ld" 14 | -------------------------------------------------------------------------------- /cores/arduino/components/toolchain/gcc/nrf52_xxaa.ld: -------------------------------------------------------------------------------- 1 | /* Linker script to configure memory regions. */ 2 | 3 | SEARCH_DIR(.) 4 | GROUP(-lgcc -lc -lnosys) 5 | 6 | MEMORY 7 | { 8 | FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x80000 9 | RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x10000 10 | } 11 | 12 | 13 | INCLUDE "nrf52_common.ld" 14 | -------------------------------------------------------------------------------- /cores/arduino/delay.c: -------------------------------------------------------------------------------- 1 | #include "delay.h" 2 | #include "Arduino.h" 3 | #include "nrf_delay.h" 4 | 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | /** Tick Counter united by ms */ 10 | static volatile uint32_t _ulTickCount=0; 11 | 12 | uint32_t millis( void ) 13 | { 14 | // todo: ensure no interrupts 15 | return _ulTickCount ; 16 | } 17 | 18 | 19 | // Interrupt-compatible version of micros 20 | // Theory: repeatedly take readings of SysTick counter, millis counter and SysTick interrupt pending flag. 21 | // When it appears that millis counter and pending is stable and SysTick hasn't rolled over, use these 22 | // values to calculate micros. If there is a pending SysTick, add one to the millis counter in the calculation. 23 | uint32_t micros( void ) 24 | { 25 | uint32_t ticks, ticks2; 26 | uint32_t pend, pend2; 27 | uint32_t count, count2; 28 | 29 | ticks2 = SysTick->VAL; 30 | pend2 = !!(SCB->ICSR & SCB_ICSR_PENDSTSET_Msk) ; 31 | count2 = _ulTickCount ; 32 | 33 | do 34 | { 35 | ticks=ticks2; 36 | pend=pend2; 37 | count=count2; 38 | ticks2 = SysTick->VAL; 39 | pend2 = !!(SCB->ICSR & SCB_ICSR_PENDSTSET_Msk) ; 40 | count2 = _ulTickCount ; 41 | } while ((pend != pend2) || (count != count2) || (ticks < ticks2)); 42 | 43 | return ((count+pend) * 1000) + (((SysTick->LOAD - ticks)*(1048576/(VARIANT_MCK/1000000)))>>20) ; 44 | // this is an optimization to turn a runtime division into two compile-time divisions and 45 | // a runtime multiplication and shift, saving a few cycles 46 | } 47 | 48 | void SysTick_Handler(void){ 49 | // Increment tick count each ms 50 | _ulTickCount++ ; 51 | } 52 | 53 | void delay( uint32_t ms ) 54 | { 55 | //nrf_delay_ms(ms); 56 | if ( ms == 0 ) 57 | { 58 | return ; 59 | } 60 | 61 | uint32_t start = _ulTickCount ; 62 | 63 | do 64 | { 65 | yield() ; 66 | } while ( _ulTickCount - start <= (ms-1) ) ; 67 | } 68 | 69 | void delayMicroseconds(uint32_t usec) 70 | { 71 | nrf_delay_us(usec); 72 | } 73 | 74 | #ifdef __cplusplus 75 | } 76 | #endif 77 | -------------------------------------------------------------------------------- /cores/arduino/hooks.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012 Arduino. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | /** 20 | * Empty yield() hook. 21 | * 22 | * This function is intended to be used by library writers to build 23 | * libraries or sketches that supports cooperative threads. 24 | * 25 | * Its defined as a weak symbol and it can be redefined to implement a 26 | * real cooperative scheduler. 27 | */ 28 | static void __empty() { 29 | // Empty 30 | } 31 | void yield(void) __attribute__ ((weak, alias("__empty"))); 32 | 33 | /** 34 | * SysTick hook 35 | * 36 | * This function is called from SysTick handler, before the default 37 | * handler provided by Arduino. 38 | */ 39 | static int __false() { 40 | // Return false 41 | return 0; 42 | } 43 | int sysTickHook(void) __attribute__ ((weak, alias("__false"))); 44 | 45 | /** 46 | * SVC hook 47 | * PendSV hook 48 | * 49 | * These functions are called from SVC handler, and PensSV handler. 50 | * Default action is halting. 51 | */ 52 | static void __halt() { 53 | // Halts 54 | while (1) 55 | ; 56 | } 57 | void svcHook(void) __attribute__ ((weak, alias("__halt"))); 58 | void pendSVHook(void) __attribute__ ((weak, alias("__halt"))); 59 | -------------------------------------------------------------------------------- /cores/arduino/itoa.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Arduino. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef _ITOA_ 20 | #define _ITOA_ 21 | 22 | #ifdef __cplusplus 23 | extern "C"{ 24 | #endif // __cplusplus 25 | 26 | #if 0 27 | 28 | extern void itoa( int n, char s[] ) ; 29 | 30 | #else 31 | 32 | extern char* itoa( int value, char *string, int radix ) ; 33 | extern char* ltoa( long value, char *string, int radix ) ; 34 | extern char* utoa( unsigned long value, char *string, int radix ) ; 35 | extern char* ultoa( unsigned long value, char *string, int radix ) ; 36 | #endif /* 0 */ 37 | 38 | #ifdef __cplusplus 39 | } // extern "C" 40 | #endif // __cplusplus 41 | 42 | #endif // _ITOA_ 43 | -------------------------------------------------------------------------------- /cores/arduino/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | main.cpp - Main loop for Arduino sketches 3 | Copyright (c) 2005-2016 Arduino Team. All right reserved. 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #define ARDUINO_MAIN 21 | #include "Arduino.h" 22 | 23 | 24 | /* 25 | * \brief Main entry point of Arduino application 26 | */ 27 | int main(void) 28 | { 29 | init(); 30 | 31 | delay(0); 32 | 33 | SDManager.begin(); 34 | 35 | // Register with the SoftDevice handler module for BLE events. 36 | softdevice_ble_evt_handler_set(ble_evt_dispatch); 37 | 38 | setup(); 39 | 40 | if(dfuIsEnabled()) 41 | add_dfu_service(); 42 | 43 | for(;;){ 44 | loop(); 45 | if (serialEventRun) serialEventRun(); 46 | } 47 | return 0; 48 | } -------------------------------------------------------------------------------- /cores/arduino/syscalls.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011 Arduino. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | /** 20 | * \file syscalls.h 21 | * 22 | * Implementation of newlib syscall. 23 | * 24 | */ 25 | 26 | /*---------------------------------------------------------------------------- 27 | * Headers 28 | *----------------------------------------------------------------------------*/ 29 | #include 30 | #include 31 | #include 32 | #include 33 | 34 | /*---------------------------------------------------------------------------- 35 | * Exported functions 36 | *----------------------------------------------------------------------------*/ 37 | #ifdef __cplusplus 38 | extern "C" { 39 | #endif 40 | 41 | extern void _exit( int status ) ; 42 | 43 | extern int link( char *cOld, char *cNew ) ; 44 | 45 | extern caddr_t _sbrk( int incr ) ; 46 | 47 | extern int _close( int file ) ; 48 | 49 | extern int _fstat( int file, struct stat *st ) ; 50 | 51 | extern int _isatty( int file ) ; 52 | 53 | extern int _lseek( int file, int ptr, int dir ) ; 54 | 55 | extern int _read(int file, char *ptr, int len) ; 56 | 57 | extern int _write( int file, char *ptr, int len ) ; 58 | 59 | extern void _kill( int pid, int sig ) ; 60 | 61 | extern int _getpid ( void ) ; 62 | 63 | #ifdef __cplusplus 64 | } 65 | #endif 66 | 67 | -------------------------------------------------------------------------------- /cores/arduino/wiring.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Arduino. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #include "variant.h" 20 | #include "wiring_digital.h" 21 | #include "wiring.h" 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | /* 28 | * Arduino Primo board initialization 29 | * 30 | * Configure SysTick in order to tick every 1 ms. 31 | * needed for millis function. 32 | */ 33 | void init( void ) 34 | { 35 | // Set Systick to 1ms interval, common to all Cortex-M variants 36 | if ( SysTick_Config( SystemCoreClock / 1000 ) ) 37 | { 38 | // Capture error 39 | while ( 1 ) ; 40 | } 41 | } 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | -------------------------------------------------------------------------------- /cores/arduino/wiring.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Arduino. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef _WIRING_ 20 | #define _WIRING_ 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | // Exported in CMSIS header file in system_nrf52.h 27 | //extern uint32_t SystemCoreClock ; 28 | 29 | /** 30 | * 31 | */ 32 | extern void init( void ) ; 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | 38 | #endif /* _WIRING_ */ 39 | -------------------------------------------------------------------------------- /cores/arduino/wiring_analog.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Arduino. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef _WIRING_ANALOG_ 20 | #define _WIRING_ANALOG_ 21 | 22 | #include 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | /* 29 | * \brief Configures the reference voltage used for analog input (i.e. the value used as the top of the input range). 30 | * 31 | * \param ulMode 32 | */ 33 | extern void analogReference( uint8_t ulMode ) ; 34 | 35 | /* 36 | * \brief Writes an analog value (PWM wave) to a pin. 37 | * 38 | * \param ulPin 39 | * \param ulValue 40 | */ 41 | extern void analogWrite( uint32_t ulPin, uint32_t ulValue ) ; 42 | 43 | /* 44 | * \brief Reads the value from the specified analog pin. 45 | * 46 | * \param ulPin 47 | * 48 | * \return Read value from selected pin, if no error. 49 | */ 50 | extern uint32_t analogRead( uint32_t ulPin ) ; 51 | 52 | /* 53 | * \brief Set the resolution of analogRead return values. Default is 10 bits (range from 0 to 1023). 54 | * 55 | * \param res 56 | */ 57 | extern void analogReadResolution(int res); 58 | 59 | /* 60 | * \brief Set the resolution of analogWrite parameters. Default is 8 bits (range from 0 to 255). 61 | * 62 | * \param res 63 | */ 64 | extern void analogWriteResolution(int res); 65 | 66 | 67 | #ifdef __cplusplus 68 | } 69 | #endif 70 | 71 | #endif /* _WIRING_ANALOG_ */ 72 | -------------------------------------------------------------------------------- /cores/arduino/wiring_private.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 WiringPrivate_h 20 | #define WiringPrivate_h 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | #ifdef __cplusplus 27 | extern "C"{ 28 | #endif 29 | 30 | #include "wiring_constants.h" 31 | 32 | #ifdef __cplusplus 33 | } // extern "C" 34 | 35 | #include "HardwareSerial.h" 36 | 37 | #endif 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /cores/arduino/wiring_shift.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Arduino. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #include 20 | #include "wiring_shift.h" 21 | #include "wiring_digital.h" 22 | #include "wiring_private.h" 23 | 24 | #ifdef __cplusplus 25 | extern "C"{ 26 | #endif 27 | 28 | uint32_t shiftIn( uint32_t ulDataPin, uint32_t ulClockPin, uint32_t ulBitOrder ) 29 | { 30 | uint8_t value = 0 ; 31 | uint8_t i ; 32 | 33 | for ( i=0 ; i < 8 ; ++i ) 34 | { 35 | digitalWrite( ulClockPin, HIGH ) ; 36 | 37 | if ( ulBitOrder == LSBFIRST ) 38 | { 39 | value |= digitalRead( ulDataPin ) << i ; 40 | } 41 | else 42 | { 43 | value |= digitalRead( ulDataPin ) << (7 - i) ; 44 | } 45 | 46 | digitalWrite( ulClockPin, LOW ) ; 47 | } 48 | 49 | return value ; 50 | } 51 | 52 | void shiftOut( uint32_t ulDataPin, uint32_t ulClockPin, uint32_t ulBitOrder, uint32_t ulVal ) 53 | { 54 | uint8_t i ; 55 | 56 | for ( i=0 ; i < 8 ; i++ ) 57 | { 58 | if ( ulBitOrder == LSBFIRST ) 59 | { 60 | digitalWrite( ulDataPin, !!(ulVal & (1 << i)) ) ; 61 | } 62 | else 63 | { 64 | digitalWrite( ulDataPin, !!(ulVal & (1 << (7 - i))) ) ; 65 | } 66 | 67 | digitalWrite( ulClockPin, HIGH ) ; 68 | digitalWrite( ulClockPin, LOW ) ; 69 | } 70 | } 71 | 72 | #ifdef __cplusplus 73 | } // extern "C" 74 | #endif 75 | -------------------------------------------------------------------------------- /cores/arduino/wiring_shift.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Arduino. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef _WIRING_SHIFT_ 20 | #define _WIRING_SHIFT_ 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | /* 27 | * \brief 28 | */ 29 | extern uint32_t shiftIn( uint32_t ulDataPin, uint32_t ulClockPin, uint32_t ulBitOrder ) ; 30 | 31 | 32 | /* 33 | * \brief 34 | */ 35 | extern void shiftOut( uint32_t ulDataPin, uint32_t ulClockPin, uint32_t ulBitOrder, uint32_t ulVal ) ; 36 | 37 | 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | 42 | #endif /* _WIRING_SHIFT_ */ 43 | -------------------------------------------------------------------------------- /drivers/dpinst-amd64.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduino/ArduinoCore-primo/cd54ab663d93e60e5a53d2d05f13f16e3cc147e7/drivers/dpinst-amd64.exe -------------------------------------------------------------------------------- /drivers/dpinst-x86.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduino/ArduinoCore-primo/cd54ab663d93e60e5a53d2d05f13f16e3cc147e7/drivers/dpinst-x86.exe -------------------------------------------------------------------------------- /drivers/license/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduino/ArduinoCore-primo/cd54ab663d93e60e5a53d2d05f13f16e3cc147e7/drivers/license/.DS_Store -------------------------------------------------------------------------------- /drivers/x64/desktop.ini: -------------------------------------------------------------------------------- 1 | [LocalizedFileNames] 2 | mbedSerial_x64.sys=@mbedSerial_x64.sys,0 3 | mbedClassCoInst_x64.dll=@MBEDCL~1.DLL,0 4 | mbedcomposite_x64.cat=@mbedcomposite_x64.cat,0 5 | mbedComposite_x64.inf=@mbedComposite_x64.inf,0 6 | mbedComposite_x64.sys=@mbedComposite_x64.sys,0 7 | mbedDevInst_x64.dll=@mbedDevInst_x64.dll,0 8 | mbedserial_x64.cat=@mbedserial_x64.cat,0 9 | mbedSerial_x64.inf=@mbedSerial_x64.inf,0 10 | -------------------------------------------------------------------------------- /drivers/x64/mbedClassCoInst_x64.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduino/ArduinoCore-primo/cd54ab663d93e60e5a53d2d05f13f16e3cc147e7/drivers/x64/mbedClassCoInst_x64.dll -------------------------------------------------------------------------------- /drivers/x64/mbedComposite_x64.sys: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduino/ArduinoCore-primo/cd54ab663d93e60e5a53d2d05f13f16e3cc147e7/drivers/x64/mbedComposite_x64.sys -------------------------------------------------------------------------------- /drivers/x64/mbedDevInst_x64.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduino/ArduinoCore-primo/cd54ab663d93e60e5a53d2d05f13f16e3cc147e7/drivers/x64/mbedDevInst_x64.dll -------------------------------------------------------------------------------- /drivers/x64/mbedSerial_x64.sys: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduino/ArduinoCore-primo/cd54ab663d93e60e5a53d2d05f13f16e3cc147e7/drivers/x64/mbedSerial_x64.sys -------------------------------------------------------------------------------- /drivers/x64/mbedcomposite_x64.cat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduino/ArduinoCore-primo/cd54ab663d93e60e5a53d2d05f13f16e3cc147e7/drivers/x64/mbedcomposite_x64.cat -------------------------------------------------------------------------------- /drivers/x64/mbedserial_x64.cat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduino/ArduinoCore-primo/cd54ab663d93e60e5a53d2d05f13f16e3cc147e7/drivers/x64/mbedserial_x64.cat -------------------------------------------------------------------------------- /drivers/x86/mbedClassCoInst.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduino/ArduinoCore-primo/cd54ab663d93e60e5a53d2d05f13f16e3cc147e7/drivers/x86/mbedClassCoInst.dll -------------------------------------------------------------------------------- /drivers/x86/mbedComposite.sys: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduino/ArduinoCore-primo/cd54ab663d93e60e5a53d2d05f13f16e3cc147e7/drivers/x86/mbedComposite.sys -------------------------------------------------------------------------------- /drivers/x86/mbedDevInst.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduino/ArduinoCore-primo/cd54ab663d93e60e5a53d2d05f13f16e3cc147e7/drivers/x86/mbedDevInst.dll -------------------------------------------------------------------------------- /drivers/x86/mbedSerial.sys: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduino/ArduinoCore-primo/cd54ab663d93e60e5a53d2d05f13f16e3cc147e7/drivers/x86/mbedSerial.sys -------------------------------------------------------------------------------- /drivers/x86/mbedcomposite.cat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduino/ArduinoCore-primo/cd54ab663d93e60e5a53d2d05f13f16e3cc147e7/drivers/x86/mbedcomposite.cat -------------------------------------------------------------------------------- /drivers/x86/mbedserial.cat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduino/ArduinoCore-primo/cd54ab663d93e60e5a53d2d05f13f16e3cc147e7/drivers/x86/mbedserial.cat -------------------------------------------------------------------------------- /firmwares/primo/softdevice/s132_nrf52_2.0.0_licence_agreement.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010 - 2017, Nordic Semiconductor ASA 2 | License Agreement for the Nordic Semiconductor ASA S132 Bluetooth SoftDevice software package ("SoftDevice"). 3 | All rights reserved. 4 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 5 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 6 | 7 | 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA integrated circuit in a product or a software update for such product, must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 8 | 9 | 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 10 | 11 | 4. This software, with or without modification, must only be used with a Nordic Semiconductor ASA integrated circuit. 12 | 13 | 5. Any software provided in binary form under this license must not be reverse engineered, decompiled, modified and/or disassembled. 14 | 15 | THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 16 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 17 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 18 | -------------------------------------------------------------------------------- /firmwares/primo/stm32/stm32f103xb_primo_bl_2.4.1_1.0.0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduino/ArduinoCore-primo/cd54ab663d93e60e5a53d2d05f13f16e3cc147e7/firmwares/primo/stm32/stm32f103xb_primo_bl_2.4.1_1.0.0.bin -------------------------------------------------------------------------------- /firmwares/primo/stm32/stm32f103xb_primo_if_2.4.1_1.0.1.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduino/ArduinoCore-primo/cd54ab663d93e60e5a53d2d05f13f16e3cc147e7/firmwares/primo/stm32/stm32f103xb_primo_if_2.4.1_1.0.1.bin -------------------------------------------------------------------------------- /libraries/BLE/BLEAttribute.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Sandeep Mistry. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | // Modified by Arduino.org development team 4 | 5 | #include "BLEAttribute.h" 6 | #include "BLEUuid.h" 7 | 8 | BLEAttribute::BLEAttribute(const char* uuid, enum BLEAttributeType type) : 9 | _uuid(uuid), 10 | _type(type) 11 | { 12 | } 13 | 14 | const char* BLEAttribute::uuid() const { 15 | return this->_uuid; 16 | } 17 | 18 | const char* BLEAttribute::rawUuid() const{ 19 | return (char *)BLEUuid(this->_uuid).data(); 20 | } 21 | 22 | enum BLEAttributeType BLEAttribute::type() const { 23 | return this->_type; 24 | } 25 | -------------------------------------------------------------------------------- /libraries/BLE/BLEAttribute.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Sandeep Mistry. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | // Modified by Arduino.org development team 4 | 5 | #ifndef _BLE_ATTRIBUTE_H_ 6 | #define _BLE_ATTRIBUTE_H_ 7 | 8 | enum BLEAttributeType { 9 | BLETypeService = 0x2800, 10 | BLETypeCharacteristic = 0x2803, 11 | BLETypeDescriptor = 0x2900 12 | }; 13 | 14 | enum BLEProperty { 15 | BLEBroadcast = 0x01, 16 | BLERead = 0x02, 17 | BLEWriteWithoutResponse = 0x04, 18 | BLEWrite = 0x08, 19 | BLENotify = 0x10, 20 | BLEIndicate = 0x20 21 | }; 22 | 23 | class BLEAttribute 24 | { 25 | public: 26 | BLEAttribute(const char* uuid, enum BLEAttributeType type); 27 | const char* uuid() const; 28 | const char* rawUuid() const; 29 | 30 | enum BLEAttributeType type() const; 31 | 32 | private: 33 | const char* _uuid; 34 | enum BLEAttributeType _type; 35 | }; 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /libraries/BLE/BLEBondStore.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Sandeep Mistry. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | // Modified by Arduino.org development team 4 | 5 | #ifndef _BLE_BOND_STORE_H_ 6 | #define _BLE_BOND_STORE_H_ 7 | 8 | class BLEBondStore 9 | { 10 | public: 11 | BLEBondStore(int offset = NRF_UICR->NRFFW[0]); 12 | 13 | bool hasData(); 14 | void clearData(); 15 | void putData(const unsigned char* data, unsigned int offset, unsigned int length); 16 | void getData(unsigned char* data, unsigned int offset, unsigned int length); 17 | 18 | private: 19 | #if defined(__AVR__) || defined(__MK20DX128__) || defined(__MK20DX256__) || defined(__MKL26Z64__) 20 | int _offset; 21 | #elif defined(NRF51)|| defined(NRF52) || defined(__RFduino__) 22 | uint32_t* _flashPageStartAddress; 23 | #endif 24 | }; 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /libraries/BLE/BLECentral.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Sandeep Mistry. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | // Modified by Arduino.org development team 4 | 5 | #include "Arduino.h" 6 | 7 | #include "BLEPeripheral.h" 8 | 9 | #include "BLECentral.h" 10 | #include "BLEUtil.h" 11 | 12 | BLECentral::BLECentral(BLEPeripheral* peripheral) : 13 | _peripheral(peripheral) 14 | { 15 | this->clearAddress(); 16 | } 17 | 18 | BLECentral::operator bool() const { 19 | unsigned char zero[6] = {0, 0, 0, 0, 0, 0}; 20 | 21 | return (memcmp(this->_address, zero, sizeof(this->_address)) != 0); 22 | } 23 | 24 | bool BLECentral::operator==(const BLECentral& rhs) const { 25 | return (memcmp(this->_address, rhs._address, sizeof(this->_address)) == 0); 26 | } 27 | 28 | bool BLECentral::operator!=(const BLECentral& rhs) const { 29 | return !(*this == rhs); 30 | } 31 | 32 | bool BLECentral::connected() { 33 | this->poll(); 34 | 35 | return (*this && *this == this->_peripheral->central()); 36 | } 37 | 38 | const char* BLECentral::address() const { 39 | static char address[18]; 40 | 41 | BLEUtil::addressToString(this->_address, address); 42 | 43 | return address; 44 | } 45 | 46 | void BLECentral::poll() { 47 | this->_peripheral->poll(); 48 | } 49 | 50 | void BLECentral::disconnect() { 51 | if (this->connected()) { 52 | this->_peripheral->disconnect(); 53 | } 54 | } 55 | 56 | void BLECentral::setAddress(const unsigned char* address) { 57 | memcpy(this->_address, address, sizeof(this->_address)); 58 | } 59 | 60 | void BLECentral::clearAddress() { 61 | memset(this->_address, 0x00, sizeof(this->_address)); 62 | } 63 | -------------------------------------------------------------------------------- /libraries/BLE/BLECentral.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Sandeep Mistry. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | // Modified by Arduino.org development team 4 | 5 | #ifndef _BLE_CENTRAL_H_ 6 | #define _BLE_CENTRAL_H_ 7 | 8 | class BLEPeripheral; 9 | 10 | class BLECentral 11 | { 12 | friend class BLEPeripheral; 13 | 14 | public: 15 | operator bool() const; 16 | bool operator==(const BLECentral& rhs) const; 17 | bool operator!=(const BLECentral& rhs) const; 18 | 19 | bool connected(); 20 | const char* address() const; 21 | void poll(); 22 | 23 | void disconnect(); 24 | 25 | protected: 26 | BLECentral(BLEPeripheral* peripheral); 27 | void setAddress(const unsigned char* address); 28 | void clearAddress(); 29 | 30 | private: 31 | BLEPeripheral* _peripheral; 32 | unsigned char _address[6]; 33 | }; 34 | 35 | typedef BLECentral BLECentralPeer; 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /libraries/BLE/BLEConstantCharacteristic.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Sandeep Mistry. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | // Modified by Arduino.org development team 4 | 5 | #include "BLEConstantCharacteristic.h" 6 | 7 | BLEConstantCharacteristic::BLEConstantCharacteristic(const char* uuid, const unsigned char value[], unsigned char length) : 8 | BLEFixedLengthCharacteristic(uuid, BLERead, (unsigned char)0) 9 | { 10 | this->_valueLength = this->_valueSize = length; 11 | this->_value = (unsigned char*)value; 12 | } 13 | 14 | BLEConstantCharacteristic::BLEConstantCharacteristic(const char* uuid, const char* value) : 15 | BLEFixedLengthCharacteristic(uuid, BLERead, (unsigned char)0) 16 | { 17 | this->_valueLength = this->_valueSize = strlen(value); 18 | this->_value = (unsigned char*)value; 19 | } 20 | 21 | BLEConstantCharacteristic::~BLEConstantCharacteristic() { 22 | this->_value = NULL; // null so super destructor doesn't try to free 23 | } 24 | 25 | bool BLEConstantCharacteristic::setValue(const unsigned char /*value*/[], unsigned char /*length*/) { 26 | return false; 27 | } 28 | 29 | bool BLEConstantCharacteristic::setValue(const char* /*value*/) { 30 | return false; 31 | } 32 | -------------------------------------------------------------------------------- /libraries/BLE/BLEConstantCharacteristic.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Sandeep Mistry. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | // Modified by Arduino.org development team 4 | 5 | #ifndef _BLE_CONSTANT_CHARACTERISTIC_H_ 6 | #define _BLE_CONSTANT_CHARACTERISTIC_H_ 7 | 8 | #include "Arduino.h" 9 | 10 | #include "BLEFixedLengthCharacteristic.h" 11 | 12 | class BLEConstantCharacteristic : public BLEFixedLengthCharacteristic { 13 | public: 14 | BLEConstantCharacteristic(const char* uuid, const unsigned char value[], unsigned char length); 15 | BLEConstantCharacteristic(const char* uuid, const char* value); 16 | 17 | virtual ~BLEConstantCharacteristic(); 18 | 19 | virtual bool setValue(const unsigned char value[], unsigned char length); 20 | virtual bool setValue(const char* value); 21 | }; 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /libraries/BLE/BLEDescriptor.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Sandeep Mistry. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | // Modified by Arduino.org development team 4 | 5 | #include "Arduino.h" 6 | 7 | #include "BLEDeviceLimits.h" 8 | 9 | #include "BLEDescriptor.h" 10 | 11 | BLEDescriptor::BLEDescriptor(const char* uuid, const unsigned char value[], unsigned char valueLength) : 12 | BLELocalAttribute(uuid, BLETypeDescriptor), 13 | _value(value), 14 | _valueLength(valueLength) 15 | { 16 | } 17 | 18 | BLEDescriptor::BLEDescriptor(const char* uuid, const char* value) : 19 | BLELocalAttribute(uuid, BLETypeDescriptor), 20 | _value((const unsigned char*)value), 21 | _valueLength(strlen(value)) 22 | { 23 | } 24 | 25 | BLEDescriptor::~BLEDescriptor() { 26 | } 27 | 28 | const unsigned char* BLEDescriptor::value() const { 29 | return this->_value; 30 | } 31 | 32 | unsigned char BLEDescriptor::valueLength() const { 33 | return this->_valueLength; 34 | } 35 | 36 | unsigned char BLEDescriptor::operator[] (int offset) const { 37 | return this->_value[offset]; 38 | } 39 | -------------------------------------------------------------------------------- /libraries/BLE/BLEDescriptor.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Sandeep Mistry. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | // Modified by Arduino.org development team 4 | 5 | #ifndef _BLE_DESCRIPTOR_H_ 6 | #define _BLE_DESCRIPTOR_H_ 7 | 8 | #include "BLELocalAttribute.h" 9 | 10 | class BLEDescriptor : public BLELocalAttribute 11 | { 12 | public: 13 | BLEDescriptor(const char* uuid, const unsigned char value[], unsigned char valueLength); 14 | BLEDescriptor(const char* uuid, const char* value); 15 | 16 | virtual ~BLEDescriptor(); 17 | 18 | virtual const unsigned char* value() const; 19 | virtual unsigned char valueLength() const; 20 | virtual unsigned char operator[] (int offset) const; 21 | 22 | private: 23 | const char* _uuid; 24 | const unsigned char* _value; 25 | unsigned char _valueLength; 26 | }; 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /libraries/BLE/BLEDevice.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Sandeep Mistry. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | // Modified by Arduino.org development team 4 | 5 | #include "Arduino.h" 6 | 7 | #include "BLEDevice.h" 8 | 9 | #define DEFAULT_ADVERTISING_INTERVAL 100 10 | #define DEFAULT_CONNECTABLE true 11 | 12 | BLEDevice::BLEDevice() : 13 | _connectionHandle(BLE_CONN_HANDLE_INVALID), 14 | _advertisingInterval(DEFAULT_ADVERTISING_INTERVAL), 15 | _minimumConnectionInterval(0), 16 | _maximumConnectionInterval(0), 17 | _connectable(DEFAULT_CONNECTABLE), 18 | _bondStore(NULL), 19 | _eventListener(NULL), 20 | _mitm(false), 21 | _io_caps(BLE_GAP_IO_CAPS_NONE), 22 | _passkey({0,0,0,0,0,0}), 23 | _status(1), 24 | _userConfirm(false) 25 | { 26 | } 27 | 28 | BLEDevice::~BLEDevice() { 29 | } 30 | 31 | void BLEDevice::setEventListener(BLEDeviceEventListener* eventListener) { 32 | this->_eventListener = eventListener; 33 | } 34 | 35 | void BLEDevice::setAdvertisingInterval(unsigned short advertisingInterval) { 36 | this->_advertisingInterval = advertisingInterval; 37 | } 38 | 39 | void BLEDevice::setConnectionInterval(unsigned short minimumConnectionInterval, unsigned short maximumConnectionInterval) { 40 | if (maximumConnectionInterval < minimumConnectionInterval) { 41 | maximumConnectionInterval = minimumConnectionInterval; 42 | } 43 | 44 | this->_minimumConnectionInterval = minimumConnectionInterval; 45 | this->_maximumConnectionInterval = maximumConnectionInterval; 46 | } 47 | 48 | void BLEDevice::setConnectable(bool connectable) { 49 | this->_connectable = connectable; 50 | } 51 | 52 | void BLEDevice::setBondStore(BLEBondStore& bondStore) { 53 | this->_bondStore = &bondStore; 54 | } 55 | 56 | void BLEDevice::sendPasskey(char passkey[]){ 57 | sd_ble_gap_auth_key_reply(this->_connectionHandle, BLE_GAP_AUTH_KEY_TYPE_PASSKEY, (uint8_t *)passkey); 58 | } 59 | 60 | void BLEDevice::confirmPasskey(bool confirm){ 61 | this->_userConfirm = confirm; 62 | } -------------------------------------------------------------------------------- /libraries/BLE/BLEDeviceLimits.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Sandeep Mistry. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | // Modified by Arduino.org development team 4 | 5 | #ifndef _BLE_LIMITS_H_ 6 | #define _BLE_LIMITS_H_ 7 | 8 | #include 9 | 10 | #ifndef __AVR__ 11 | 12 | #ifndef max 13 | #define max(a,b) (((a) > (b)) ? (a) : (b)) 14 | #endif 15 | 16 | #ifndef min 17 | #define min(a,b) (((a) < (b)) ? (a) : (b)) 18 | #endif 19 | 20 | #endif 21 | 22 | #if defined(NRF51) || defined(__RFduino__) || defined(NRF52) 23 | 24 | #define BLE_ADVERTISEMENT_DATA_MAX_VALUE_LENGTH 26 25 | #define BLE_SCAN_DATA_MAX_VALUE_LENGTH 29 26 | #define BLE_EIR_DATA_MAX_VALUE_LENGTH 29 27 | #define BLE_ATTRIBUTE_MAX_VALUE_LENGTH 20 28 | #define BLE_REMOTE_ATTRIBUTE_MAX_VALUE_LENGTH 22 29 | 30 | #else 31 | 32 | #define BLE_ADVERTISEMENT_DATA_MAX_VALUE_LENGTH 20 33 | #define BLE_SCAN_DATA_MAX_VALUE_LENGTH 20 34 | #define BLE_EIR_DATA_MAX_VALUE_LENGTH 20 35 | #define BLE_ATTRIBUTE_MAX_VALUE_LENGTH 20 36 | #define BLE_REMOTE_ATTRIBUTE_MAX_VALUE_LENGTH 22 37 | 38 | #endif 39 | 40 | #endif -------------------------------------------------------------------------------- /libraries/BLE/BLEFixedLengthCharacteristic.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Sandeep Mistry. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | // Modified by Arduino.org development team 4 | 5 | #include "BLEFixedLengthCharacteristic.h" 6 | 7 | BLEFixedLengthCharacteristic::BLEFixedLengthCharacteristic(const char* uuid, unsigned char properties, unsigned char valueSize) : 8 | BLECharacteristic(uuid, properties, valueSize) 9 | { 10 | this->_valueLength = valueSize; 11 | } 12 | 13 | BLEFixedLengthCharacteristic::BLEFixedLengthCharacteristic(const char* uuid, unsigned char properties, const char* value) : 14 | BLECharacteristic(uuid, properties, value) 15 | { 16 | } 17 | 18 | bool BLEFixedLengthCharacteristic::fixedLength() const { 19 | return true; 20 | } 21 | 22 | 23 | // 24 | 25 | BLEFixedLengthRemoteCharacteristic::BLEFixedLengthRemoteCharacteristic(const char* uuid, unsigned char properties) : 26 | BLERemoteCharacteristic(uuid, properties) 27 | { 28 | } 29 | 30 | bool BLEFixedLengthRemoteCharacteristic::fixedLength() const { 31 | return true; 32 | } 33 | 34 | -------------------------------------------------------------------------------- /libraries/BLE/BLEFixedLengthCharacteristic.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Sandeep Mistry. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | // Modified by Arduino.org development team 4 | 5 | #ifndef _BLE_FIXED_LENGTH_CHARACTERISTIC_H_ 6 | #define _BLE_FIXED_LENGTH_CHARACTERISTIC_H_ 7 | 8 | #include "BLECharacteristic.h" 9 | #include "BLERemoteCharacteristic.h" 10 | 11 | class BLEFixedLengthCharacteristic : public BLECharacteristic { 12 | public: 13 | BLEFixedLengthCharacteristic(const char* uuid, unsigned char properties, unsigned char valueSize); 14 | BLEFixedLengthCharacteristic(const char* uuid, unsigned char properties, const char* value); 15 | 16 | virtual bool fixedLength() const; 17 | }; 18 | 19 | class BLEFixedLengthRemoteCharacteristic : public BLERemoteCharacteristic { 20 | public: 21 | BLEFixedLengthRemoteCharacteristic(const char* uuid, unsigned char properties); 22 | 23 | virtual bool fixedLength() const; 24 | }; 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /libraries/BLE/BLEHID.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Sandeep Mistry. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | // Modified by Arduino.org development team 4 | 5 | #include "BLEHIDPeripheral.h" 6 | 7 | #include "BLEHID.h" 8 | 9 | unsigned char BLEHID::_numHids = 0; 10 | 11 | BLEHID::BLEHID(const unsigned char* descriptor, unsigned char descriptorLength, unsigned char reportIdOffset) : 12 | _reportId(0), 13 | _descriptor(descriptor), 14 | _descriptorLength(descriptorLength), 15 | _reportIdOffset(reportIdOffset) 16 | { 17 | _numHids++; 18 | } 19 | 20 | void BLEHID::setReportId(unsigned char reportId) { 21 | this->_reportId = reportId; 22 | } 23 | 24 | unsigned char BLEHID::getDescriptorLength() { 25 | return this->_descriptorLength; 26 | } 27 | 28 | unsigned char BLEHID::getDescriptorValueAtOffset(unsigned char offset) { 29 | if (offset == this->_reportIdOffset && this->_reportIdOffset) { 30 | return this->_reportId; 31 | } else { 32 | return pgm_read_byte_near(&this->_descriptor[offset]); 33 | } 34 | } 35 | 36 | unsigned char BLEHID::numHids() { 37 | return _numHids; 38 | } 39 | 40 | void BLEHID::sendData(BLECharacteristic& characteristic, unsigned char data[], unsigned char length) { 41 | // wait until we can notify 42 | while(!characteristic.canNotify()) { 43 | BLEHIDPeripheral::instance()->poll(); 44 | } 45 | 46 | characteristic.setValue(data, length); 47 | } 48 | -------------------------------------------------------------------------------- /libraries/BLE/BLEHID.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Sandeep Mistry. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | // Modified by Arduino.org development team 4 | 5 | #ifndef _BLE_HID_H_ 6 | #define _BLE_HID_H_ 7 | 8 | #include "BLELocalAttribute.h" 9 | #include "BLECharacteristic.h" 10 | 11 | class BLEHID 12 | { 13 | friend class BLEHIDPeripheral; 14 | 15 | public: 16 | BLEHID(const unsigned char* descriptor, unsigned char descriptorLength, unsigned char reportIdOffset); 17 | 18 | unsigned char getDescriptorLength(); 19 | unsigned char getDescriptorValueAtOffset(unsigned char offset); 20 | 21 | protected: 22 | static unsigned char numHids(); 23 | 24 | void sendData(BLECharacteristic& characteristic, unsigned char data[], unsigned char dataLength); 25 | 26 | virtual void setReportId(unsigned char reportId); 27 | virtual unsigned char numAttributes() { return 0; } 28 | virtual BLELocalAttribute** attributes() { return 0; } 29 | 30 | private: 31 | static unsigned char _numHids; 32 | 33 | unsigned char _reportId; 34 | const unsigned char* _descriptor; 35 | unsigned char _descriptorLength; 36 | unsigned char _reportIdOffset; 37 | }; 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /libraries/BLE/BLEHIDPeripheral.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Sandeep Mistry. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | // Modified by Arduino.org development team 4 | 5 | #ifndef _BLE_HID_PERIPHERAL_H_ 6 | #define _BLE_HID_PERIPHERAL_H_ 7 | 8 | #include "BLEHID.h" 9 | #include "BLEHIDReportMapCharacteristic.h" 10 | #include "BLEPeripheral.h" 11 | 12 | class BLEHIDPeripheral : public BLEPeripheral 13 | { 14 | friend class BLEHID; 15 | 16 | public: 17 | BLEHIDPeripheral(unsigned char req = BLE_DEFAULT_REQ, unsigned char rdy = BLE_DEFAULT_RDY, unsigned char rst = BLE_DEFAULT_RST); 18 | ~BLEHIDPeripheral(); 19 | 20 | void begin(); 21 | 22 | void setReportIdOffset(unsigned char reportIdOffset); 23 | 24 | void poll(); 25 | 26 | void addHID(BLEHID& hid); 27 | 28 | protected: 29 | static BLEHIDPeripheral* instance(); 30 | 31 | private: 32 | static BLEHIDPeripheral* _instance; 33 | 34 | BLEService _hidService; 35 | BLEHIDReportMapCharacteristic _hidReportMapCharacteristic; 36 | BLEProgmemConstantCharacteristic _hidInformationCharacteristic; 37 | BLEUnsignedCharCharacteristic _hidControlPointCharacteristic; 38 | 39 | unsigned char _reportIdOffset; 40 | 41 | BLEHID** _hids; 42 | unsigned char _numHids; 43 | }; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /libraries/BLE/BLEHIDReportMapCharacteristic.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Sandeep Mistry. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | // Modified by Arduino.org development team 4 | 5 | #include "BLEHIDReportMapCharacteristic.h" 6 | 7 | BLEHIDReportMapCharacteristic::BLEHIDReportMapCharacteristic() : 8 | BLEConstantCharacteristic("2a4b", NULL, 0), 9 | _hids(NULL), 10 | _numHids(0) 11 | { 12 | 13 | } 14 | 15 | unsigned char BLEHIDReportMapCharacteristic::valueSize() const { 16 | unsigned char valueSize = 0; 17 | 18 | for (unsigned char i = 0; i < this->_numHids; i++) { 19 | valueSize += this->_hids[i]->getDescriptorLength(); 20 | } 21 | 22 | return valueSize; 23 | } 24 | 25 | unsigned char BLEHIDReportMapCharacteristic::valueLength() const { 26 | return this->valueSize(); 27 | } 28 | 29 | unsigned char BLEHIDReportMapCharacteristic::operator[] (int offset) const { 30 | unsigned char value = 0x00; 31 | unsigned char totalOffset = 0; 32 | 33 | for (unsigned char i = 0; i < this->_numHids; i++) { 34 | unsigned char descriptorLength = this->_hids[i]->getDescriptorLength(); 35 | 36 | if ((offset >= totalOffset) && (offset < (totalOffset + descriptorLength))) { 37 | value = this->_hids[i]->getDescriptorValueAtOffset(offset - totalOffset); 38 | break; 39 | } 40 | 41 | totalOffset += descriptorLength; 42 | } 43 | 44 | return value; 45 | } 46 | 47 | void BLEHIDReportMapCharacteristic::setHids(BLEHID** hids, unsigned char numHids) { 48 | this->_hids = hids; 49 | this->_numHids = numHids; 50 | } 51 | -------------------------------------------------------------------------------- /libraries/BLE/BLEHIDReportMapCharacteristic.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Sandeep Mistry. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | // Modified by Arduino.org development team 4 | 5 | #ifndef _BLE_HID_REPORT_MAP_CHARACTERISTIC_H_ 6 | #define _BLE_HID_REPORT_MAP_CHARACTERISTIC_H_ 7 | 8 | #include "BLEHID.h" 9 | #include "BLEConstantCharacteristic.h" 10 | 11 | class BLEHIDReportMapCharacteristic : public BLEConstantCharacteristic 12 | { 13 | friend class BLEHID; 14 | 15 | public: 16 | BLEHIDReportMapCharacteristic(); 17 | 18 | virtual unsigned char valueSize() const; 19 | virtual unsigned char valueLength() const; 20 | virtual unsigned char operator[] (int offset) const; 21 | 22 | void setHids(BLEHID** hids, unsigned char numHids); 23 | 24 | private: 25 | BLEHID** _hids; 26 | unsigned char _numHids; 27 | }; 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /libraries/BLE/BLEHIDReportReferenceDescriptor.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Sandeep Mistry. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | // Modified by Arduino.org development team 4 | 5 | #include "BLEHIDReportReferenceDescriptor.h" 6 | 7 | BLEHIDReportReferenceDescriptor::BLEHIDReportReferenceDescriptor(BLEHIDDescriptorType type) : 8 | BLEDescriptor("2908", this->_value, sizeof(_value)) 9 | { 10 | this->_value[0] = 0x00; 11 | this->_value[1] = type; 12 | } 13 | 14 | BLEHIDReportReferenceDescriptor::~BLEHIDReportReferenceDescriptor() { 15 | } 16 | 17 | void BLEHIDReportReferenceDescriptor::setReportId(unsigned char reportId) { 18 | this->_value[0] = reportId; 19 | } 20 | -------------------------------------------------------------------------------- /libraries/BLE/BLEHIDReportReferenceDescriptor.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Sandeep Mistry. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | // Modified by Arduino.org development team 4 | 5 | #ifndef _BLE_HID_REPORT_REFERENCE_DESCRIPTOR_H_ 6 | #define _BLE_HID_REPORT_REFERENCE_DESCRIPTOR_H_ 7 | 8 | #include "BLEDescriptor.h" 9 | 10 | enum BLEHIDDescriptorType { 11 | BLEHIDDescriptorTypeInput = 0x01, 12 | BLEHIDDescriptorTypeOutput = 0x02 13 | }; 14 | 15 | class BLEHIDReportReferenceDescriptor : public BLEDescriptor 16 | { 17 | public: 18 | BLEHIDReportReferenceDescriptor(BLEHIDDescriptorType type); 19 | 20 | virtual ~BLEHIDReportReferenceDescriptor(); 21 | 22 | void setReportId(unsigned char reportId); 23 | 24 | private: 25 | unsigned char _value[2]; 26 | }; 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /libraries/BLE/BLELocalAttribute.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Sandeep Mistry. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | // Modified by Arduino.org development team 4 | 5 | #include "BLELocalAttribute.h" 6 | 7 | unsigned char BLELocalAttribute::_numAttributes = 0; 8 | 9 | BLELocalAttribute::BLELocalAttribute(const char* uuid, enum BLEAttributeType type) : 10 | BLEAttribute(uuid, type) 11 | { 12 | _numAttributes++; 13 | } 14 | 15 | unsigned char BLELocalAttribute::numAttributes() { 16 | return _numAttributes; 17 | } 18 | -------------------------------------------------------------------------------- /libraries/BLE/BLELocalAttribute.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Sandeep Mistry. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | // Modified by Arduino.org development team 4 | 5 | #ifndef _BLE_LOCAL_ATTRIBUTE_H_ 6 | #define _BLE_LOCAL_ATTRIBUTE_H_ 7 | 8 | #include "BLEAttribute.h" 9 | 10 | class BLELocalAttribute : public BLEAttribute 11 | { 12 | friend class BLEPeripheral; 13 | friend class BLECentralRole; 14 | 15 | public: 16 | BLELocalAttribute(const char* uuid, enum BLEAttributeType type); 17 | 18 | protected: 19 | static unsigned char numAttributes(); 20 | 21 | private: 22 | static unsigned char _numAttributes; 23 | }; 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /libraries/BLE/BLEManager.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Arduino. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | 18 | */ 19 | 20 | #ifndef __BLE_MANAGER_H 21 | #define __BLE_MANAGER_H 22 | 23 | #include "BLEPeripheral.h" 24 | #include "BLECentralRole.h" 25 | 26 | class BLECentralRole; 27 | 28 | class BLEManagerClass { 29 | public: 30 | BLEManagerClass(); 31 | 32 | static bool registerPeripheral(BLEPeripheral *peripheral); 33 | static bool registerCentral(BLECentralRole *central); 34 | 35 | static void processBleEvents(ble_evt_t *bleEvent); 36 | 37 | static BLEPeripheral *_peripheralList[1]; 38 | static BLECentralRole *_centralList[1]; 39 | }; 40 | 41 | extern BLEManagerClass BLEManager; 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /libraries/BLE/BLEMouse.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Sandeep Mistry. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | // Modified by Arduino.org development team 4 | 5 | #ifndef _BLE_MOUSE_H_ 6 | #define _BLE_MOUSE_H_ 7 | 8 | #include "Arduino.h" 9 | 10 | #include "BLECharacteristic.h" 11 | #include "BLEHIDReportReferenceDescriptor.h" 12 | #include "BLEHID.h" 13 | 14 | // From: https://github.com/adafruit/Adafruit-Trinket-USB/blob/master/TrinketHidCombo/TrinketHidCombo.h 15 | // permission to use under MIT license by @ladyada (https://github.com/adafruit/Adafruit-Trinket-USB/issues/10) 16 | 17 | // use these masks with the "move" function 18 | #define MOUSEBTN_LEFT_MASK 0x01 19 | #define MOUSEBTN_RIGHT_MASK 0x02 20 | #define MOUSEBTN_MIDDLE_MASK 0x04 21 | 22 | class BLEMouse : public BLEHID 23 | { 24 | public: 25 | BLEMouse(); 26 | 27 | void click(uint8_t b = MOUSEBTN_LEFT_MASK); 28 | void move(signed char x, signed char y, signed char wheel = 0); 29 | void press(uint8_t b = MOUSEBTN_LEFT_MASK); 30 | void release(uint8_t b = MOUSEBTN_LEFT_MASK); 31 | bool isPressed(uint8_t b = MOUSEBTN_LEFT_MASK); 32 | 33 | protected: 34 | virtual void setReportId(unsigned char reportId); 35 | virtual unsigned char numAttributes(); 36 | virtual BLELocalAttribute** attributes(); 37 | 38 | private: 39 | BLECharacteristic _reportCharacteristic; 40 | BLEHIDReportReferenceDescriptor _reportReferenceDescriptor; 41 | 42 | unsigned char _button; 43 | }; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /libraries/BLE/BLEMultimedia.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Sandeep Mistry. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | // Modified by Arduino.org development team 4 | 5 | #include "BLEMultimedia.h" 6 | 7 | static const PROGMEM unsigned char descriptorValue[] = { 8 | // From: https://github.com/adafruit/Adafruit-Trinket-USB/blob/master/TrinketHidCombo/TrinketHidComboC.c 9 | // permission to use under MIT license by @ladyada (https://github.com/adafruit/Adafruit-Trinket-USB/issues/10) 10 | 11 | // this second multimedia key report is what handles the multimedia keys 12 | 0x05, 0x0C, // USAGE_PAGE (Consumer Devices) 13 | 0x09, 0x01, // USAGE (Consumer Control) 14 | 0xA1, 0x01, // COLLECTION (Application) 15 | 0x85, 0x00, // REPORT_ID 16 | 0x19, 0x00, // USAGE_MINIMUM (Unassigned) 17 | 0x2A, 0x3C, 0x02, // USAGE_MAXIMUM 18 | 0x15, 0x00, // LOGICAL_MINIMUM (0) 19 | 0x26, 0x3C, 0x02, // LOGICAL_MAXIMUM 20 | 0x95, 0x01, // REPORT_COUNT (1) 21 | 0x75, 0x10, // REPORT_SIZE (16) 22 | 0x81, 0x00, // INPUT (Data,Ary,Abs) 23 | 0xC0 // END_COLLECTION 24 | }; 25 | 26 | BLEMultimedia::BLEMultimedia() : 27 | BLEHID(descriptorValue, sizeof(descriptorValue), 7), 28 | _reportCharacteristic("2a4d", BLERead | BLENotify, 2), 29 | _reportReferenceDescriptor(BLEHIDDescriptorTypeInput) 30 | { 31 | } 32 | 33 | size_t BLEMultimedia::write(uint8_t k) { 34 | uint8_t multimediaKeyPress[2]= { 0x00, 0x00 }; 35 | 36 | // send key code 37 | multimediaKeyPress[0] = k; 38 | 39 | for (int i = 0; i < 2; i++) { 40 | this->sendData(this->_reportCharacteristic, multimediaKeyPress, sizeof(multimediaKeyPress)); 41 | 42 | // send cleared code 43 | multimediaKeyPress[0] = 0x00; 44 | } 45 | 46 | return 1; 47 | } 48 | 49 | void BLEMultimedia::setReportId(unsigned char reportId) { 50 | BLEHID::setReportId(reportId); 51 | 52 | this->_reportReferenceDescriptor.setReportId(reportId); 53 | } 54 | 55 | unsigned char BLEMultimedia::numAttributes() { 56 | return 2; 57 | } 58 | 59 | BLELocalAttribute** BLEMultimedia::attributes() { 60 | static BLELocalAttribute* attributes[2]; 61 | 62 | attributes[0] = &this->_reportCharacteristic; 63 | attributes[1] = &this->_reportReferenceDescriptor; 64 | 65 | return attributes; 66 | } 67 | -------------------------------------------------------------------------------- /libraries/BLE/BLEMultimedia.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Sandeep Mistry. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | // Modified by Arduino.org development team 4 | 5 | #ifndef _BLE_MULTIMEDIA_H_ 6 | #define _BLE_MULTIMEDIA_H_ 7 | 8 | #include "Arduino.h" 9 | 10 | #include "BLECharacteristic.h" 11 | #include "BLEHIDReportReferenceDescriptor.h" 12 | #include "BLEHID.h" 13 | 14 | // From: https://github.com/adafruit/Adafruit-Trinket-USB/blob/master/TrinketHidCombo/TrinketHidCombo.h 15 | // permission to use under MIT license by @ladyada (https://github.com/adafruit/Adafruit-Trinket-USB/issues/10) 16 | 17 | // multimedia keys 18 | #define MMKEY_KB_VOL_UP 0x80 // do not use 19 | #define MMKEY_KB_VOL_DOWN 0x81 // do not use 20 | #define MMKEY_VOL_UP 0xE9 21 | #define MMKEY_VOL_DOWN 0xEA 22 | #define MMKEY_SCAN_NEXT_TRACK 0xB5 23 | #define MMKEY_SCAN_PREV_TRACK 0xB6 24 | #define MMKEY_STOP 0xB7 25 | #define MMKEY_PLAYPAUSE 0xCD 26 | #define MMKEY_MUTE 0xE2 27 | #define MMKEY_BASSBOOST 0xE5 28 | #define MMKEY_LOUDNESS 0xE7 29 | #define MMKEY_KB_EXECUTE 0x74 30 | #define MMKEY_KB_HELP 0x75 31 | #define MMKEY_KB_MENU 0x76 32 | #define MMKEY_KB_SELECT 0x77 33 | #define MMKEY_KB_STOP 0x78 34 | #define MMKEY_KB_AGAIN 0x79 35 | #define MMKEY_KB_UNDO 0x7A 36 | #define MMKEY_KB_CUT 0x7B 37 | #define MMKEY_KB_COPY 0x7C 38 | #define MMKEY_KB_PASTE 0x7D 39 | #define MMKEY_KB_FIND 0x7E 40 | #define MMKEY_KB_MUTE 0x7F // do not use 41 | 42 | class BLEMultimedia : public BLEHID 43 | { 44 | public: 45 | BLEMultimedia(); 46 | 47 | size_t write(uint8_t k); 48 | 49 | protected: 50 | virtual void setReportId(unsigned char reportId); 51 | virtual unsigned char numAttributes(); 52 | virtual BLELocalAttribute** attributes(); 53 | 54 | private: 55 | BLECharacteristic _reportCharacteristic; 56 | BLEHIDReportReferenceDescriptor _reportReferenceDescriptor; 57 | }; 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /libraries/BLE/BLENode.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Arduino. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | 18 | */ 19 | 20 | #ifndef _BLE_NODE_H 21 | #define _BLE_NODE_H 22 | 23 | #include "Arduino.h" 24 | 25 | class BLENode { 26 | 27 | friend class BLECentralRole; 28 | 29 | public: 30 | bool connected(); 31 | const char* address(); 32 | char* rawAdvPck(); 33 | uint8_t dataLen(); 34 | uint8_t type(); 35 | bool isScanRsp(); 36 | int8_t rssi(); 37 | void getFieldInAdvPck(uint8_t type, char* result, uint8_t& len); 38 | void printAdvertisement(); 39 | 40 | protected: 41 | BLENode(); 42 | void setAdvPck(ble_gap_evt_adv_report_t advPck); 43 | 44 | private: 45 | void printAdvData(); 46 | 47 | unsigned char _address[6]; 48 | char _advPck[31]; 49 | uint8_t _dlen; 50 | uint8_t _type; 51 | bool _sRsp; 52 | int8_t _rssi; 53 | char *_typeString[4] = {"Connectable undirected node", "Connectable directed node", "Non connectable undirected node", "Scannable undirected node"}; 54 | char *_flagsString[5] = {"LimitedDiscoverable", "GeneralDiscoverable", "BrEdrNotSupported", "LeBrEdrController", "LeBrEdrHost"}; 55 | ble_gap_evt_adv_report_t _advReport; 56 | }; 57 | 58 | typedef BLENode BLEPeripheralPeer; 59 | 60 | #endif _BLE_NODE_H -------------------------------------------------------------------------------- /libraries/BLE/BLEProgmemConstantCharacteristic.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Sandeep Mistry. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | // Modified by Arduino.org development team 4 | 5 | #include "BLEProgmemConstantCharacteristic.h" 6 | 7 | BLEProgmemConstantCharacteristic::BLEProgmemConstantCharacteristic(const char* uuid, const unsigned char value[], unsigned char length) : 8 | BLEConstantCharacteristic(uuid, value, length) 9 | { 10 | } 11 | 12 | BLEProgmemConstantCharacteristic::BLEProgmemConstantCharacteristic(const char* uuid, const char* value) : 13 | #ifdef __AVR__ 14 | BLEConstantCharacteristic(uuid, (const unsigned char *)value, strlen_P(value)) 15 | #else 16 | BLEConstantCharacteristic(uuid, value) 17 | #endif 18 | { 19 | } 20 | 21 | BLEProgmemConstantCharacteristic::~BLEProgmemConstantCharacteristic() { 22 | } 23 | 24 | unsigned char BLEProgmemConstantCharacteristic::operator[] (int offset) const { 25 | return pgm_read_byte_near(&this->_value[offset]); 26 | } 27 | -------------------------------------------------------------------------------- /libraries/BLE/BLEProgmemConstantCharacteristic.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Sandeep Mistry. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | // Modified by Arduino.org development team 4 | 5 | #ifndef _BLE_PROGMEM_CONSTANT_CHARACTERISTIC_H_ 6 | #define _BLE_PROGMEM_CONSTANT_CHARACTERISTIC_H_ 7 | 8 | #include "Arduino.h" 9 | 10 | #include "BLEConstantCharacteristic.h" 11 | 12 | class BLEProgmemConstantCharacteristic : public BLEConstantCharacteristic { 13 | public: 14 | BLEProgmemConstantCharacteristic(const char* uuid, const unsigned char value[], unsigned char length); 15 | BLEProgmemConstantCharacteristic(const char* uuid, const char* value); 16 | 17 | virtual ~BLEProgmemConstantCharacteristic(); 18 | 19 | virtual unsigned char operator[] (int offset) const; 20 | }; 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /libraries/BLE/BLERemoteAttribute.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Sandeep Mistry. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | // Modified by Arduino.org development team 4 | 5 | #include "BLERemoteAttribute.h" 6 | 7 | unsigned char BLERemoteAttribute::_numAttributes = 0; 8 | 9 | BLERemoteAttribute::BLERemoteAttribute(const char* uuid, enum BLEAttributeType type) : 10 | BLEAttribute(uuid, type) 11 | { 12 | _numAttributes++; 13 | } 14 | 15 | unsigned char BLERemoteAttribute::numAttributes() { 16 | return _numAttributes; 17 | } 18 | -------------------------------------------------------------------------------- /libraries/BLE/BLERemoteAttribute.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Sandeep Mistry. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | // Modified by Arduino.org development team 4 | 5 | #ifndef _BLE_REMOTE_ATTRIBUTE_H_ 6 | #define _BLE_REMOTE_ATTRIBUTE_H_ 7 | 8 | #include "BLEAttribute.h" 9 | 10 | class BLERemoteAttribute : public BLEAttribute 11 | { 12 | friend class BLEPeripheral; 13 | friend class BLECentralRole; 14 | 15 | public: 16 | BLERemoteAttribute(const char* uuid, enum BLEAttributeType type); 17 | 18 | protected: 19 | static unsigned char numAttributes(); 20 | 21 | private: 22 | static unsigned char _numAttributes; 23 | }; 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /libraries/BLE/BLERemoteService.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Sandeep Mistry. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | // Modified by Arduino.org development team 4 | 5 | #include "BLERemoteService.h" 6 | 7 | BLERemoteService::BLERemoteService(const char* uuid) : 8 | BLERemoteAttribute(uuid, BLETypeService) 9 | { 10 | } 11 | -------------------------------------------------------------------------------- /libraries/BLE/BLERemoteService.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Sandeep Mistry. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | // Modified by Arduino.org development team 4 | 5 | #ifndef _BLE_REMOTE_SERVICE_H_ 6 | #define _BLE_REMOTE_SERVICE_H_ 7 | 8 | #include "BLERemoteAttribute.h" 9 | 10 | class BLERemoteService : public BLERemoteAttribute 11 | { 12 | public: 13 | BLERemoteService(const char* uuid); 14 | }; 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /libraries/BLE/BLESerial.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Sandeep Mistry. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | // Modified by Arduino.org development team 4 | 5 | #ifndef _BLE_SERIAL_H_ 6 | #define _BLE_SERIAL_H_ 7 | 8 | #include 9 | #include 10 | 11 | class BLESerial : public BLEPeripheral, public Stream 12 | { 13 | public: 14 | BLESerial(unsigned char req = BLE_DEFAULT_REQ, unsigned char rdy = BLE_DEFAULT_RDY, unsigned char rst = BLE_DEFAULT_RST); 15 | 16 | void begin(...); 17 | void poll(); 18 | void end(); 19 | 20 | virtual int available(void); 21 | virtual int peek(void); 22 | virtual int read(void); 23 | virtual void flush(void); 24 | virtual size_t write(uint8_t byte); 25 | using Print::write; 26 | virtual operator bool(); 27 | 28 | private: 29 | unsigned long _flushed; 30 | static BLESerial* _instance; 31 | 32 | size_t _rxHead; 33 | size_t _rxTail; 34 | size_t _rxCount() const; 35 | uint8_t _rxBuffer[256]; 36 | size_t _txCount; 37 | uint8_t _txBuffer[BLE_ATTRIBUTE_MAX_VALUE_LENGTH]; 38 | 39 | BLEService _uartService = BLEService("6E400001-B5A3-F393-E0A9-E50E24DCCA9E"); 40 | BLEDescriptor _uartNameDescriptor = BLEDescriptor("2901", "UART"); 41 | BLECharacteristic _rxCharacteristic = BLECharacteristic("6E400002-B5A3-F393-E0A9-E50E24DCCA9E", BLEWriteWithoutResponse, BLE_ATTRIBUTE_MAX_VALUE_LENGTH); 42 | BLEDescriptor _rxNameDescriptor = BLEDescriptor("2901", "RX - Receive Data (Write)"); 43 | BLECharacteristic _txCharacteristic = BLECharacteristic("6E400003-B5A3-F393-E0A9-E50E24DCCA9E", BLENotify, BLE_ATTRIBUTE_MAX_VALUE_LENGTH); 44 | BLEDescriptor _txNameDescriptor = BLEDescriptor("2901", "TX - Transfer Data (Notify)"); 45 | 46 | void _received(const uint8_t* data, size_t size); 47 | static void _received(BLECentral& /*central*/, BLECharacteristic& rxCharacteristic); 48 | }; 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /libraries/BLE/BLEService.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Sandeep Mistry. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | // Modified by Arduino.org development team 4 | 5 | #include "BLEService.h" 6 | 7 | BLEService::BLEService(const char* uuid) : 8 | BLELocalAttribute(uuid, BLETypeService) 9 | { 10 | } 11 | -------------------------------------------------------------------------------- /libraries/BLE/BLEService.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Sandeep Mistry. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | // Modified by Arduino.org development team 4 | 5 | #ifndef _BLE_SERVICE_H_ 6 | #define _BLE_SERVICE_H_ 7 | 8 | #include "BLELocalAttribute.h" 9 | 10 | class BLEService : public BLELocalAttribute 11 | { 12 | public: 13 | BLEService(const char* uuid); 14 | }; 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /libraries/BLE/BLESystemControl.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Sandeep Mistry. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | // Modified by Arduino.org development team 4 | 5 | #ifndef _BLE_SYSTEM_CONTROL_H_ 6 | #define _BLE_SYSTEM_CONTROL_H_ 7 | 8 | #include "Arduino.h" 9 | 10 | #include "BLECharacteristic.h" 11 | #include "BLEHIDReportReferenceDescriptor.h" 12 | #include "BLEHID.h" 13 | 14 | // From: https://github.com/adafruit/Adafruit-Trinket-USB/blob/master/TrinketHidCombo/TrinketHidCombo.h 15 | // permission to use under MIT license by @ladyada (https://github.com/adafruit/Adafruit-Trinket-USB/issues/10) 16 | 17 | // system control keys 18 | #define SYSCTRLKEY_POWER 0x01 19 | #define SYSCTRLKEY_SLEEP 0x02 20 | #define SYSCTRLKEY_WAKE 0x03 21 | 22 | class BLESystemControl : public BLEHID 23 | { 24 | public: 25 | BLESystemControl(); 26 | 27 | size_t write(uint8_t k); 28 | 29 | protected: 30 | virtual void setReportId(unsigned char reportId); 31 | virtual unsigned char numAttributes(); 32 | virtual BLELocalAttribute** attributes(); 33 | 34 | private: 35 | BLECharacteristic _reportCharacteristic; 36 | BLEHIDReportReferenceDescriptor _reportReferenceDescriptor; 37 | }; 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /libraries/BLE/BLEUtil.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Sandeep Mistry. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | // Modified by Arduino.org development team 4 | 5 | #include "Arduino.h" 6 | 7 | #include "BLEUtil.h" 8 | 9 | void BLEUtil::addressToString(const unsigned char *in, char* out) { 10 | String address = ""; 11 | 12 | for (int i = 5; i >= 0; i--) { 13 | if (in[i] < 0x10) { 14 | address += "0"; 15 | } 16 | 17 | address += String(in[i], 16); 18 | 19 | if (i > 0) { 20 | address += ":"; 21 | } 22 | } 23 | 24 | address.toCharArray(out, 18); 25 | } 26 | 27 | void BLEUtil::printBuffer(const unsigned char* buffer, unsigned char length) { 28 | for (int i = 0; i < length; i++) { 29 | if ((buffer[i] & 0xf0) == 00) { 30 | Serial.print("0"); 31 | } 32 | 33 | Serial.print(buffer[i], HEX); 34 | Serial.print(" "); 35 | } 36 | Serial.println(); 37 | } 38 | 39 | -------------------------------------------------------------------------------- /libraries/BLE/BLEUtil.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Sandeep Mistry. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | // Modified by Arduino.org development team 4 | 5 | #ifndef _BLE_UTIL_H_ 6 | #define _BLE_UTIL_H_ 7 | 8 | 9 | class BLEUtil 10 | { 11 | public: 12 | static void addressToString(const unsigned char *in, char* out); 13 | 14 | static void printBuffer(const unsigned char* buffer, unsigned char length); 15 | }; 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /libraries/BLE/BLEUuid.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Sandeep Mistry. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | // Modified by Arduino.org development team 4 | 5 | #include "Arduino.h" 6 | 7 | #include "BLEUuid.h" 8 | 9 | BLEUuid::BLEUuid(const char * str) : 10 | _str(str) 11 | { 12 | char temp[] = {0, 0, 0}; 13 | 14 | this->_length = 0; 15 | for (int i = strlen(str) - 1; i >= 0 && this->_length < MAX_UUID_LENGTH; i -= 2) { 16 | if (str[i] == '-') { 17 | i++; 18 | continue; 19 | } 20 | 21 | temp[0] = str[i - 1]; 22 | temp[1] = str[i]; 23 | 24 | this->_data[this->_length] = strtoul(temp, NULL, 16); 25 | 26 | this->_length++; 27 | } 28 | } 29 | 30 | const char* BLEUuid::str() const { 31 | return this->_str; 32 | } 33 | 34 | const unsigned char* BLEUuid::data() const { 35 | return this->_data; 36 | } 37 | 38 | unsigned char BLEUuid::length() const { 39 | return this->_length; 40 | } 41 | -------------------------------------------------------------------------------- /libraries/BLE/BLEUuid.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Sandeep Mistry. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | // Modified by Arduino.org development team 4 | 5 | #ifndef _BLE_UUID_H_ 6 | #define _BLE_UUID_H_ 7 | 8 | #define MAX_UUID_LENGTH 16 9 | 10 | class BLEUuid 11 | { 12 | public: 13 | BLEUuid(const char * str); 14 | 15 | const char* str() const; 16 | const unsigned char* data() const; 17 | unsigned char length() const; 18 | 19 | private: 20 | const char* _str; 21 | unsigned char _data[MAX_UUID_LENGTH]; 22 | unsigned char _length; 23 | }; 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /libraries/BLE/EddystoneBeacon.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Sandeep Mistry. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | // Modified by Arduino.org development team 4 | 5 | #ifndef _EDDYSTONE_BEACON_H_ 6 | #define _EDDYSTONE_BEACON_H_ 7 | 8 | #include "BLEPeripheral.h" 9 | #include "BLEUuid.h" 10 | 11 | class EddystoneBeacon : public BLEPeripheral 12 | { 13 | public: 14 | EddystoneBeacon(unsigned char req = BLE_DEFAULT_REQ, unsigned char rdy = BLE_DEFAULT_RDY, unsigned char rst = BLE_DEFAULT_RST); 15 | 16 | void begin(char power, const BLEUuid& uid); 17 | void begin(char power, const char* uri); 18 | void loop(); 19 | 20 | void setURI(const char* uri); 21 | 22 | private: 23 | unsigned char compressURI(const char* uri, char *compressedUri, unsigned char compressedUriSize); 24 | 25 | char _power; 26 | 27 | BLEService _bleService; 28 | BLECharacteristic _bleCharacteristic; 29 | }; 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /libraries/BLE/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Sandeep Mistry 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /libraries/BLE/examples/Central/scanner/scanner.ino: -------------------------------------------------------------------------------- 1 | /* 2 | scanner.ino 3 | 4 | Written by Chiara Ruggeri (chiara@arduino.org) 5 | 6 | This example for the Arduino Primo board implements the 7 | Observer role of the BLE protocol. 8 | Once scan parameters are set, the sketch continuously 9 | listen for advertising packets. 10 | 11 | This example code is in the public domain. 12 | 13 | */ 14 | 15 | #include "BLECentralRole.h" 16 | // download ArduinoLowPower library from library manager to enter in low power mode 17 | #include "ArduinoLowPower.h" 18 | 19 | // create central instance 20 | BLECentralRole bleCentral = BLECentralRole(); 21 | 22 | void setup() { 23 | Serial.begin(9600); 24 | 25 | // assign event handler for scanReceived event 26 | bleCentral.setEventHandler(BLEScanReceived, receiveAdvPck); 27 | 28 | // set scan parameters 29 | // interval and window in 0.625 ms increments 30 | bleCentral.setScanInterval(3200); // 2 sec 31 | bleCentral.setScanWindow(800); // 0.5 sec 32 | // timeout in seconds. 0 disables timeout 33 | bleCentral.setScanTimeout(0); 34 | // active scan true to ask for scan response packet 35 | bleCentral.setActiveScan(true); 36 | // begin initialization and start scanning 37 | bleCentral.begin(); 38 | } 39 | 40 | void loop() { 41 | // since we want to realize a low power application we don't handle the 42 | // BLE_LED in order to save power but put the board in low power mode instead. 43 | LowPower.sleep(); 44 | } 45 | 46 | void receiveAdvPck(BLEPeripheralPeer& peer){ 47 | // print the advertising packet received 48 | peer.printAdvertisement(); 49 | } -------------------------------------------------------------------------------- /libraries/BLE/examples/Peripheral/Eddystone/EddystoneUID/EddystoneUID.ino: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Sandeep Mistry. All rights reserved. 2 | Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | Modified by Chiara Ruggeri 4 | 5 | With this example the board implements the broadcaster role. 6 | Once the beacon is set, the board will advertise the uuid continuously. 7 | */ 8 | 9 | #include 10 | // download ArduinoLowPower library from library manager to enter in low power mode 11 | #include "ArduinoLowPower.h" 12 | 13 | EddystoneBeacon eddystoneBeacon = EddystoneBeacon(); 14 | BLEUuid uid = BLEUuid("01020304050607080910-AABBCCDDEEFF"); // - 15 | 16 | void setup() { 17 | Serial.begin(9600); 18 | 19 | eddystoneBeacon.begin(-18, uid); // power, UID 20 | 21 | Serial.println(F("Eddystone UID Beacon")); 22 | } 23 | 24 | void loop() { 25 | // since we want to realize a low power application we don't handle the 26 | // BLE_LED in order to save power but put the board in low power mode instead 27 | LowPower.sleep(); 28 | } -------------------------------------------------------------------------------- /libraries/BLE/examples/Peripheral/Eddystone/EddystoneURL/EddystoneURL.ino: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Sandeep Mistry. All rights reserved. 2 | Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | Modified by Chiara Ruggeri 4 | 5 | With this example the board implements the broadcaster role. 6 | Once the beacon is set, the board will advertise the URL continuously. 7 | */ 8 | 9 | #include 10 | // download ArduinoLowPower library from library manager to enter in low power mode 11 | #include "ArduinoLowPower.h" 12 | 13 | EddystoneBeacon eddystoneBeacon = EddystoneBeacon(); 14 | 15 | void setup() { 16 | Serial.begin(9600); 17 | 18 | delay(1000); 19 | 20 | eddystoneBeacon.begin(-18, "http://www.arduino.org"); // power, URI 21 | 22 | Serial.println(F("Eddystone URL Beacon")); 23 | } 24 | 25 | void loop() { 26 | // since we want to realize a low power application we don't handle the 27 | // BLE_LED in order to save power but put the board in low power mode instead 28 | LowPower.sleep(); 29 | } -------------------------------------------------------------------------------- /libraries/BLE/examples/Peripheral/HID/HID_keyboard/HID_keyboard.ino: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Sandeep Mistry. All rights reserved. 2 | Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | Modified by Chiara Ruggeri 4 | 5 | This example shows the use of the HID BLE library. 6 | Connect the board to the phone through the phone's bluetooth settings, 7 | open a text field in the phone and try to write something in the board serial terminal. 8 | In this example BLE_LED shows the status of the board. It will blink every 200 ms when the board is advertising. 9 | It will be on when the board is connected to a central. It will be off when the board is disconnected. 10 | */ 11 | 12 | #include 13 | #include 14 | 15 | 16 | // create peripheral instance 17 | BLEHIDPeripheral bleHIDPeripheral = BLEHIDPeripheral(); 18 | BLEKeyboard bleKeyboard; 19 | 20 | void setup() { 21 | Serial.begin(9600); 22 | 23 | //initialize BLE led 24 | pinMode(BLE_LED, OUTPUT); 25 | 26 | // clear bond store data 27 | bleHIDPeripheral.clearBondStoreData(); 28 | 29 | 30 | bleHIDPeripheral.setReportIdOffset(1); 31 | 32 | 33 | bleHIDPeripheral.setLocalName("HID Keyboard"); 34 | bleHIDPeripheral.addHID(bleKeyboard); 35 | 36 | bleHIDPeripheral.begin(); 37 | 38 | Serial.println(F("BLE HID Keyboard")); 39 | } 40 | 41 | void loop() { 42 | BLECentral central = bleHIDPeripheral.central(); 43 | 44 | if (central) { 45 | // central connected to peripheral 46 | Serial.print(F("Connected to central: ")); 47 | Serial.println(central.address()); 48 | 49 | // turn on BLE_LED when connected 50 | digitalWrite(BLE_LED, HIGH); 51 | 52 | while (central.connected()) { 53 | if (Serial.available() > 0) { 54 | // read in character 55 | char c = Serial.read(); 56 | 57 | Serial.print(F("c = ")); 58 | Serial.println(c); 59 | 60 | bleKeyboard.print(c); 61 | } 62 | } 63 | 64 | // central disconnected 65 | Serial.print(F("Disconnected from central: ")); 66 | Serial.println(central.address()); 67 | } 68 | 69 | // here we are not connected. This means we are advertising 70 | digitalWrite(BLE_LED, HIGH); 71 | delay(200); 72 | digitalWrite(BLE_LED, LOW); 73 | delay(200); 74 | 75 | } -------------------------------------------------------------------------------- /libraries/BLE/examples/Peripheral/README.md: -------------------------------------------------------------------------------- 1 | # Examples 2 | 3 | * [led](led) 4 | * read/write characteristic to turn an LED on/off - polling style 5 | * [led_callback](led_callback) 6 | * read/write characteristic to turn an LED on/off - callback style 7 | * [led_switch](led_switch) 8 | * read/write characteristic + notify characteristic to turn an LED on/off and button status 9 | * [physical_web_beacon](physical_web_beacon) 10 | * broadcast [physical web](http://physical-web.org) beacon 11 | * [test](test) 12 | * read/write/notify characteristic for counter 13 | * [serial](serial) 14 | * serial port service compatible with following applications: 15 | - nRF Toolbox - [iOS](https://itunes.apple.com/us/app/nrf-toolbox/id820906058?mt=8) | [Android](https://play.google.com/store/apps/details?id=no.nordicsemi.android.nrftoolbox) 16 | - nRF UART - [iOS](https://itunes.apple.com/us/app/nrf-uart/id614594903?mt=8) | [Android](https://play.google.com/store/apps/details?id=com.nordicsemi.nrfUARTv2) 17 | - Bluefruit LE - [iOS](https://itunes.apple.com/us/app/adafruit-bluefruit-le-connect/id830125974?mt=8) | [Android](https://play.google.com/store/apps/details?id=com.adafruit.bluefruit.le.connect) 18 | 19 | # RedBearLab - BLE Controller App 20 | 21 | The following examples work with the [RedBearLab](http://redbearlab.com) BLE Controller [iOS](https://itunes.apple.com/us/app/ble-controller/id855062200?mt=8)/[Android](https://play.google.com/store/apps/details?id=com.redbear.redbearbleclient&hl=en) app and were provided by [RedBearLab](http://redbearlab.com). 22 | 23 | * [BLEControllerSketch](RedBearLab/BLEControllerSketch) 24 | * reports Arduino's pin mode and pin state 25 | * [SimpleChat](RedBearLab/SimpleChat) 26 | * Two way chat example from Arduino serial monitor to/from app 27 | * [SimpleControls](RedBearLab/SimpleControls) 28 | * Use app to configure and control Arduino pins as: DIGITAL_IN, DIGITAL_OUT, PWM, SERVO, ANALOG_IN 29 | -------------------------------------------------------------------------------- /libraries/BLE/examples/Peripheral/iBeacon/iBeacon.ino: -------------------------------------------------------------------------------- 1 | /* Copyright (c) Sandeep Mistry. All rights reserved. 2 | Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | Modified by Chiara Ruggeri 4 | 5 | This example shows the use of the BLE iBeacon library. 6 | After the beacon is created it is advertised continuously 7 | */ 8 | 9 | #include 10 | #include 11 | 12 | 13 | iBeacon beacon; 14 | 15 | void setup() { 16 | char* uuid = "a196c876-de8c-4c47-ab5a-d7afd5ae7127"; 17 | unsigned short major = 0; 18 | unsigned short minor = 0; 19 | unsigned short measuredPower = -55; 20 | 21 | beacon.begin(uuid, major, minor, measuredPower); 22 | } 23 | 24 | void loop() { 25 | beacon.loop(); 26 | } -------------------------------------------------------------------------------- /libraries/BLE/iBeacon.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Sandeep Mistry. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | // Modified by Arduino.org development team 4 | 5 | #if defined(NRF51) || defined(NRF52) || defined(__RFduino__) 6 | 7 | #include "iBeacon.h" 8 | 9 | iBeacon::iBeacon() : 10 | BLEPeripheral() 11 | { 12 | this->setConnectable(false); 13 | } 14 | 15 | void iBeacon::begin(const char* uuidString, unsigned short major, unsigned short minor, char measuredPower) { 16 | BLEUuid uuid(uuidString); 17 | int i = 0; 18 | 19 | // 0x004c = Apple, see https://www.bluetooth.org/en-us/specification/assigned-numbers/company-identifiers 20 | this->_manufacturerData[i++] = 0x4c; // Apple Company Identifier LE (16 bit) 21 | this->_manufacturerData[i++] = 0x00; 22 | 23 | // See "Beacon type" in "Building Applications with IBeacon". 24 | this->_manufacturerData[i++] = 0x02; 25 | this->_manufacturerData[i++] = uuid.length() + 5; 26 | 27 | for (int j = (uuid.length() - 1); j >= 0; j--) { 28 | this->_manufacturerData[i++] = uuid.data()[j]; 29 | } 30 | 31 | this->_manufacturerData[i++] = major >> 8; 32 | this->_manufacturerData[i++] = major; 33 | this->_manufacturerData[i++] = minor >> 8; 34 | this->_manufacturerData[i++] = minor; 35 | this->_manufacturerData[i++] = measuredPower; 36 | 37 | this->setManufacturerData(this->_manufacturerData, i); 38 | 39 | BLEPeripheral::begin(); 40 | } 41 | 42 | void iBeacon::loop() { 43 | this->poll(); 44 | } 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /libraries/BLE/iBeacon.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Sandeep Mistry. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | // Modified by Arduino.org development team 4 | 5 | #ifndef _I_BEACON_H_ 6 | #define _I_BEACON_H_ 7 | 8 | #if defined(NRF51) || defined(NRF52) || defined(__RFduino__) 9 | 10 | #include "BLEPeripheral.h" 11 | #include "BLEUuid.h" 12 | 13 | class iBeacon : public BLEPeripheral 14 | { 15 | public: 16 | iBeacon(); 17 | 18 | void begin(const char* uuidString, unsigned short major, unsigned short minor, char measuredPower); 19 | void loop(); 20 | 21 | private: 22 | unsigned char _manufacturerData[MAX_UUID_LENGTH + 9]; // 4 bytes of header and 5 bytes of trailer. 23 | }; 24 | 25 | #endif 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /libraries/BLE/library.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "BLEPeripheral", 3 | "version": "0.3.0", 4 | "keywords": "BLE, bluetooth, peripheral", 5 | "description": "Arduino library for creating custom BLE peripherals. Supports nRF8001 and nRF51822 based boards/shields.", 6 | "repository": 7 | { 8 | "type": "git", 9 | "url": "https://github.com/sandeepmistry/arduino-BLEPeripheral.git" 10 | }, 11 | "frameworks": "arduino", 12 | "platforms": "nordicnrf51, atmelavr, atmelsam, teensy" 13 | } 14 | -------------------------------------------------------------------------------- /libraries/BLE/library.properties: -------------------------------------------------------------------------------- 1 | name=BLE 2 | version=1.3.0 3 | author=Sandeep Mistry 4 | maintainer=Arduino 5 | modified by=Chiara Ruggeri , Torbjorn Ovrebekk 6 | sentence=An Arduino library for creating custom BLE nodes. 7 | paragraph=Supports Arduino Primo board and also nRF8001, nRF51822 and nrf52832 based boards/shields 8 | category=Communication 9 | url=https://github.com/sandeepmistry/arduino-BLEPeripheral 10 | architectures=* 11 | -------------------------------------------------------------------------------- /libraries/BLE/set-version.sh: -------------------------------------------------------------------------------- 1 | #/bin/bash 2 | 3 | function set_version () { 4 | local VERSION="${1}" 5 | local FILE="${2}" 6 | echo "Updating '${FILE}' to '${VERSION}'." 7 | sed -i '' -e"s|\(version.*\)[0-9]\.[0-9]\.[0-9]|\1${VERSION}|g" "${FILE}" 8 | } 9 | 10 | function man () { 11 | local _B=$(tput bold) 12 | local B_=$(tput sgr0) 13 | local _U=$(tput smul) 14 | local U_=$(tput rmul) 15 | 16 | echo "${_B}NAME${B_}" 17 | echo " ${_B}${0##*/}${B_} -- set library version" 18 | echo 19 | echo "${_B}SYNOPSIS${B_}" 20 | echo " ${_B}${0##*/}${B_} ${_U}version${U_}" 21 | echo 22 | echo "${_B}DESCRIPTION${B_}" 23 | echo " Utility for updating BLEPeripheral library to specified version." 24 | echo 25 | echo "${_B}EXAMPLE${B_}" 26 | echo " ${_B}${0##*/}${B_} 4.1.22" 27 | } 28 | 29 | 30 | 31 | if [ -z "${1}" ]; then 32 | (>&2 echo "Error: Mandatory version argument is missing!") 33 | man 34 | exit -1 35 | fi 36 | 37 | VERSION="${1}" 38 | 39 | set_version ${VERSION} "library.properties" 40 | set_version ${VERSION} "library.json" 41 | -------------------------------------------------------------------------------- /libraries/BLE/utility/README.md: -------------------------------------------------------------------------------- 1 | These files are from the [@NordicSemiconductor](https://github.com/NordicSemiconductor)[ble-sdk-arduino](https://github.com/NordicSemiconductor/ble-sdk-arduino). 2 | 3 | Some file have been slightly modified. -------------------------------------------------------------------------------- /libraries/BLE/utility/RFduino/ble_err.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved. 3 | * 4 | * The information contained herein is confidential property of Nordic Semiconductor. The use, 5 | * copying, transfer or disclosure of such information is prohibited except by express written 6 | * agreement with Nordic Semiconductor. 7 | * 8 | */ 9 | /** 10 | @addtogroup BLE_COMMON 11 | @{ 12 | @addtogroup nrf_error 13 | @{ 14 | @ingroup BLE_COMMON 15 | @} 16 | 17 | @defgroup ble_err General error codes 18 | @{ 19 | 20 | @brief General error code definitions for the BLE API. 21 | 22 | @ingroup BLE_COMMON 23 | */ 24 | #ifndef NRF_BLE_ERR_H__ 25 | #define NRF_BLE_ERR_H__ 26 | 27 | #include "nrf_error.h" 28 | 29 | /* @defgroup BLE_ERRORS Error Codes 30 | * @{ */ 31 | #define BLE_ERROR_INVALID_CONN_HANDLE (NRF_ERROR_STK_BASE_NUM+0x001) /**< Invalid connection handle. */ 32 | #define BLE_ERROR_INVALID_ATTR_HANDLE (NRF_ERROR_STK_BASE_NUM+0x002) /**< Invalid attribute handle. */ 33 | #define BLE_ERROR_NO_TX_BUFFERS (NRF_ERROR_STK_BASE_NUM+0x003) /**< Buffer capacity exceeded. */ 34 | /** @} */ 35 | 36 | 37 | /** @defgroup BLE_ERROR_SUBRANGES Module specific error code subranges 38 | * @brief Assignment of subranges for module specific error codes. 39 | * @note For specific error codes, see ble_.h or ble_error_.h. 40 | * @{ */ 41 | #define NRF_L2CAP_ERR_BASE (NRF_ERROR_STK_BASE_NUM+0x100) /**< L2CAP specific errors. */ 42 | #define NRF_GAP_ERR_BASE (NRF_ERROR_STK_BASE_NUM+0x200) /**< GAP specific errors. */ 43 | #define NRF_GATTC_ERR_BASE (NRF_ERROR_STK_BASE_NUM+0x300) /**< GATT client specific errors. */ 44 | #define NRF_GATTS_ERR_BASE (NRF_ERROR_STK_BASE_NUM+0x400) /**< GATT server specific errors. */ 45 | /** @} */ 46 | 47 | #endif 48 | 49 | 50 | /** 51 | @} 52 | @} 53 | */ 54 | -------------------------------------------------------------------------------- /libraries/BLE/utility/RFduino/nrf_error_sdm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved. 3 | * 4 | * The information contained herein is confidential property of Nordic Semiconductor. The use, 5 | * copying, transfer or disclosure of such information is prohibited except by express written 6 | * agreement with Nordic Semiconductor. 7 | * 8 | */ 9 | /** 10 | @addtogroup nrf_sdm_api 11 | @{ 12 | @defgroup nrf_sdm_error SoftDevice Manager Error Codes 13 | @{ 14 | 15 | @brief Error definitions for the SDM API 16 | */ 17 | 18 | /* Header guard */ 19 | #ifndef NRF_ERROR_SDM_H__ 20 | #define NRF_ERROR_SDM_H__ 21 | 22 | #include "nrf_error.h" 23 | 24 | #define NRF_ERROR_SDM_LFCLK_SOURCE_UNKNOWN (NRF_ERROR_SDM_BASE_NUM + 0) ///< Unknown lfclk source 25 | #define NRF_ERROR_SDM_INCORRECT_INTERRUPT_CONFIGURATION (NRF_ERROR_SDM_BASE_NUM + 1) ///< Incorrect interrupt configuration (can be caused by using illegal priority levels, or having enabled SoftDevice interrupts) 26 | #define NRF_ERROR_SDM_INCORRECT_CLENR0 (NRF_ERROR_SDM_BASE_NUM + 2) ///< Incorrect CLENR0 (can be caused by erronous SoftDevice flashing) 27 | 28 | #endif // NRF_ERROR_SDM_H__ 29 | 30 | /** 31 | @} 32 | @} 33 | */ 34 | -------------------------------------------------------------------------------- /libraries/BLE/utility/RFduino/nrf_error_soc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved. 3 | * 4 | * The information contained herein is confidential property of Nordic Semiconductor. The use, 5 | * copying, transfer or disclosure of such information is prohibited except by express written 6 | * agreement with Nordic Semiconductor. 7 | * 8 | */ 9 | /** 10 | @addtogroup nrf_soc_api 11 | @{ 12 | @defgroup nrf_soc_error SoC Library Error Codes 13 | @{ 14 | 15 | @brief Error definitions for the SoC library 16 | 17 | */ 18 | 19 | /* Header guard */ 20 | #ifndef NRF_ERROR_SOC_H__ 21 | #define NRF_ERROR_SOC_H__ 22 | 23 | #include "nrf_error.h" 24 | 25 | /* Mutex Errors */ 26 | #define NRF_ERROR_SOC_MUTEX_ALREADY_TAKEN (NRF_ERROR_SOC_BASE_NUM + 0) ///< Mutex already taken 27 | 28 | /* NVIC errors */ 29 | #define NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE (NRF_ERROR_SOC_BASE_NUM + 1) ///< NVIC interrupt not available 30 | #define NRF_ERROR_SOC_NVIC_INTERRUPT_PRIORITY_NOT_ALLOWED (NRF_ERROR_SOC_BASE_NUM + 2) ///< NVIC interrupt priority not allowed 31 | #define NRF_ERROR_SOC_NVIC_SHOULD_NOT_RETURN (NRF_ERROR_SOC_BASE_NUM + 3) ///< NVIC should not return 32 | 33 | /* Power errors */ 34 | #define NRF_ERROR_SOC_POWER_MODE_UNKNOWN (NRF_ERROR_SOC_BASE_NUM + 4) ///< Power mode unknown 35 | #define NRF_ERROR_SOC_POWER_POF_THRESHOLD_UNKNOWN (NRF_ERROR_SOC_BASE_NUM + 5) ///< Power POF threshold unknown 36 | #define NRF_ERROR_SOC_POWER_OFF_SHOULD_NOT_RETURN (NRF_ERROR_SOC_BASE_NUM + 6) ///< Power off should not return 37 | 38 | /* Rand errors */ 39 | #define NRF_ERROR_SOC_RAND_NOT_ENOUGH_VALUES (NRF_ERROR_SOC_BASE_NUM + 7) ///< RAND not enough values 40 | 41 | /* PPI errors */ 42 | #define NRF_ERROR_SOC_PPI_INVALID_CHANNEL (NRF_ERROR_SOC_BASE_NUM + 8) ///< Invalid PPI Channel 43 | #define NRF_ERROR_SOC_PPI_INVALID_GROUP (NRF_ERROR_SOC_BASE_NUM + 9) ///< Invalid PPI Group 44 | 45 | #endif // NRF_ERROR_SOC_H__ 46 | /** 47 | @} 48 | @} 49 | */ 50 | -------------------------------------------------------------------------------- /libraries/BLE/utility/RFduino/nrf_svc.h: -------------------------------------------------------------------------------- 1 | #ifndef NRF_SVC__ 2 | #define NRF_SVC__ 3 | 4 | #ifdef SVCALL_AS_NORMAL_FUNCTION 5 | #define SVCALL(number, return_type, signature) return_type signature 6 | #else 7 | 8 | #ifndef SVCALL 9 | #if defined (__CC_ARM) 10 | #define SVCALL(number, return_type, signature) return_type __svc(number) signature 11 | #elif defined (__GNUC__) 12 | #define SVCALL(number, return_type, signature) \ 13 | _Pragma("GCC diagnostic ignored \"-Wreturn-type\"") \ 14 | _Pragma("GCC diagnostic ignored \"-Wunused-function\"") \ 15 | __attribute__((naked)) static return_type signature \ 16 | { \ 17 | __asm( \ 18 | "svc %0\n" \ 19 | "bx r14" : : "I" ((uint16_t)number) : "r0" \ 20 | ); \ 21 | } 22 | #elif defined (__ICCARM__) 23 | #define PRAGMA(x) _Pragma(#x) 24 | #define SVCALL(number, return_type, signature) \ 25 | PRAGMA(swi_number = number) \ 26 | __swi return_type signature; 27 | #else 28 | #define SVCALL(number, return_type, signature) return_type signature 29 | #endif 30 | #endif // SVCALL 31 | 32 | #endif // SVCALL_AS_NORMAL_FUNCTION 33 | #endif // NRF_SVC__ 34 | -------------------------------------------------------------------------------- /libraries/BLE/utility/RFduino/softdevice_assert.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved. 3 | * 4 | * The information contained herein is confidential property of Nordic Semiconductor. The use, 5 | * copying, transfer or disclosure of such information is prohibited except by express written 6 | * agreement with Nordic Semiconductor. 7 | * 8 | */ 9 | 10 | /** @brief Utilities for verifying program logic 11 | */ 12 | 13 | #ifndef SOFTDEVICE_ASSERT_H_ 14 | #define SOFTDEVICE_ASSERT_H_ 15 | 16 | #include 17 | 18 | /** @brief This function handles assertions. 19 | * 20 | * 21 | * @note 22 | * This function is called when an assertion has triggered. 23 | * 24 | * 25 | * @param line_num The line number where the assertion is called 26 | * @param file_name Pointer to the file name 27 | */ 28 | void assert_softdevice_callback(uint16_t line_num, const uint8_t *file_name); 29 | 30 | 31 | /*lint -emacro(506, ASSERT) */ /* Suppress "Constant value Boolean */ 32 | /*lint -emacro(774, ASSERT) */ /* Suppress "Boolean within 'if' always evaluates to True" */ \ 33 | /** @brief Check intended for production code 34 | * 35 | * Check passes if "expr" evaluates to true. */ 36 | #define ASSERT(expr) \ 37 | if (expr) \ 38 | { \ 39 | } \ 40 | else \ 41 | { \ 42 | assert_softdevice_callback((uint16_t)__LINE__, (uint8_t *)__FILE__); \ 43 | /*lint -unreachable */ \ 44 | } 45 | 46 | #endif /* SOFTDEVICE_ASSERT_H_ */ 47 | -------------------------------------------------------------------------------- /libraries/BLE/utility/acilib_defs.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2014, Nordic Semiconductor ASA 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all 11 | * copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | 22 | /** 23 | * @file 24 | * 25 | * @ingroup group_acilib 26 | * 27 | * @brief Definitions for the acilib interfaces 28 | */ 29 | 30 | #ifndef _acilib_DEFS_H_ 31 | #define _acilib_DEFS_H_ 32 | 33 | #define ACIL_DECODE_EVT_GET_LENGTH(buffer_in) (*(buffer_in + OFFSET_ACI_EVT_T_LEN)) 34 | 35 | #define ACIL_DECODE_EVT_GET_OPCODE(buffer_in) (*(buffer_in + OFFSET_ACI_EVT_T_EVT_OPCODE)) 36 | 37 | #endif /* _acilib_DEFS_H_ */ 38 | -------------------------------------------------------------------------------- /libraries/BLE/utility/acilib_types.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2014, Nordic Semiconductor ASA 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all 11 | * copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | 22 | /** 23 | * @file 24 | * 25 | * @ingroup group_acilib 26 | * 27 | * @brief Type used in the acilib interfaces 28 | */ 29 | 30 | #ifndef _acilib_TYPES_H_ 31 | #define _acilib_TYPES_H_ 32 | 33 | #endif /* _acilib_TYPES_H_ */ 34 | -------------------------------------------------------------------------------- /libraries/BLE/utility/ble_assert.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2014, Nordic Semiconductor ASA 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all 11 | * copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | 22 | /** @file 23 | * @brief Declaration of assert() 24 | */ 25 | 26 | #ifndef BLE_ASSERT_H__ 27 | #define BLE_ASSERT_H__ 28 | 29 | #ifndef BLE_ASSERT 30 | 31 | #define ble_assert(expr) 32 | 33 | #else 34 | 35 | extern void __ble_assert(const char *file, uint16_t line); 36 | 37 | #define ble_assert(expr) \ 38 | ((expr) \ 39 | ? ((void) 0) \ 40 | : __ble_assert (__FILE__, __LINE__)) 41 | 42 | #endif 43 | 44 | #endif /* BLE_ASSERT_H__ */ 45 | -------------------------------------------------------------------------------- /libraries/BLE/utility/boards.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2014, Nordic Semiconductor ASA 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all 11 | * copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | 22 | /** @file 23 | * @brief Defines for the different Bluetooth low energy boards 24 | */ 25 | 26 | #ifndef _BLE_BOARDS_H_ 27 | #define _BLE_BOARDS_H_ 28 | 29 | #define BOARD_DEFAULT 0 //Use this if you do not know the board you are using or you are creating a new one 30 | #define REDBEARLAB_SHIELD_V1_1 1 //Redbearlab Bluetooth low energy shield v1.1 31 | #define REDBEARLAB_SHIELD_V2012_07 1 //Identical to Redbearlab v1.1 shield 32 | #define REDBEARLAB_SHIELD_V2 0 //Redbearlab Bluetooth low energy shield v2.x - No special handling required for pin reset same as default 33 | 34 | #endif -------------------------------------------------------------------------------- /libraries/CIR/cir.h: -------------------------------------------------------------------------------- 1 | /* 2 | **************************************************************************** 3 | * Copyright (c) 2017 Arduino srl. All right reserved. 4 | * 5 | * File : cir.h 6 | * Date : 2017/03/10 7 | * Revision : 0.0.1 $ 8 | * Author: jeff[at]arduino[dot]org 9 | * 10 | **************************************************************************** 11 | 12 | This library is free software; you can redistribute it and/or 13 | modify it under the terms of the GNU Lesser General Public 14 | License as published by the Free Software Foundation; either 15 | version 2.1 of the License, or (at your option) any later version. 16 | 17 | This library is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 | Lesser General Public License for more details. 21 | 22 | You should have received a copy of the GNU Lesser General Public 23 | License along with this library; if not, write to the Free Software 24 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | #ifndef __CIR_H__ 28 | #define __CIR_H__ 29 | 30 | #ifdef ARDUINO_NRF52_PRIMO_CORE 31 | #error "CIR library is not compatible with Arduino Primo Core" 32 | #endif //ARDUINO_NRF52_PRIMO_CORE 33 | 34 | #include 35 | #include 36 | #include "Arduino.h" 37 | 38 | extern "C" { 39 | #include "nrf_delay.h" 40 | } 41 | 42 | #define SEND_BUF_LENGTH 256 43 | #define REC_BUF_LENGTH 74 44 | 45 | class cir { 46 | public: 47 | cir(void); 48 | void enableReceiver(void); 49 | void disableReceiver(void); 50 | bool getReceiverStatus(void); 51 | uint32_t digitalRead(void); 52 | 53 | void enableTransmitter(void); 54 | void disableTransmitter(void); 55 | void digitalWrite(uint32_t data); 56 | 57 | uint16_t recData[34]; 58 | uint16_t leader_mark, leader_space, mark_max, mark_min, space_max, space_min; 59 | 60 | private: 61 | uint8_t sendBuffer[SEND_BUF_LENGTH]; 62 | uint8_t recBuffer[REC_BUF_LENGTH]; 63 | 64 | 65 | }; 66 | 67 | #endif __CIR_H___ 68 | -------------------------------------------------------------------------------- /libraries/CIR/examples/Receiver/Receiver.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Receiver.ino 3 | 4 | Written by Jeff Wu (jeff@arduino.org) 5 | 6 | This example for the Arduino Primo board shows how to use 7 | cir library. 8 | CIR data is received by 38kHz IR receiver of the Primo board, 9 | It is based on the NEC protocol to decode signals from IR 10 | receiver to get hex code, you can see the hex code using serial 11 | montior when the Primo board receive CIR data. 12 | 13 | NEC Protocol: 14 | 9ms leading pulse burst 15 | 4.5ms space 16 | 8-bit address for the receiving device 17 | 8-bit logical inverse of the address 18 | 8-bit command 19 | 8-bit logical inverse of the command 20 | Logical 0 : 560us + 560us 21 | Logical 1 : 560us + 1690us 22 | 23 | This example code is in the public domain. 24 | 25 | */ 26 | 27 | #include 28 | #include "cir.h" 29 | 30 | cir primo_cir; 31 | 32 | void setup() { 33 | // start serial port at 115200 bps: 34 | Serial.begin(115200); 35 | // initialize the LED pin as an output: 36 | pinMode(LED_BUILTIN, OUTPUT); 37 | // turn LED off: 38 | digitalWrite(LED_BUILTIN, LOW); 39 | // enable IR ready to receiver: 40 | primo_cir.enableReceiver(); 41 | // turn LED on: 42 | digitalWrite(LED_BUILTIN, HIGH); 43 | } 44 | 45 | void loop() { 46 | // check if IR receiver decodes signals and accord with NEC Protocl: 47 | if (primo_cir.getReceiverStatus()) 48 | // print hex code: 49 | printCirReceiverResult(); 50 | } 51 | 52 | void printCirReceiverResult() { 53 | // turn LED on: 54 | digitalWrite(LED_BUILTIN, HIGH); 55 | Serial.print("Data Code:"); 56 | // convert to hex code and print: 57 | Serial.println(primo_cir.digitalRead(),HEX); 58 | // new line: 59 | Serial.print('\n'); 60 | // turn LED off: 61 | digitalWrite(LED_BUILTIN, LOW); 62 | } 63 | -------------------------------------------------------------------------------- /libraries/CIR/examples/Transmitter/Transmitter.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Transmitter.ino 3 | 4 | Written by Jeff Wu (jeff@arduino.org) 5 | 6 | This example for the Arduino Primo board shows how to use 7 | cir library. 8 | The IR transmitter allows you to send hex code by infrared LED 9 | of the Primo board, the hex code is based on the NEC protocol 10 | that transmiited consits of the following, using buttons to send 11 | hex code when a button is pressed. 12 | 13 | NEC Protocol: 14 | 9ms leading pulse burst 15 | 4.5ms space 16 | 8-bit address for the receiving device 17 | 8-bit logical inverse of the address 18 | 8-bit command 19 | 8-bit logical inverse of the command 20 | Logical 0 : 560us + 560us 21 | Logical 1 : 560us + 1690us 22 | 23 | This example code is in the public domain. 24 | 25 | */ 26 | 27 | #include 28 | #include "cir.h" 29 | 30 | // define hex code: 31 | #define HEX_1 0xC1AA1107 32 | #define HEX_2 0xC1AA68F0 33 | 34 | cir primo_cir; 35 | 36 | void setup() { 37 | // initialize the LED pin as an output: 38 | pinMode(LED_BUILTIN, OUTPUT); 39 | // turn LED off: 40 | digitalWrite(LED_BUILTIN, LOW); 41 | // enable IR ready to transmitter: 42 | primo_cir.enableTransmitter(); 43 | // initialize the pushbutton pin as an input: 44 | pinMode(USER1_BUTTON, INPUT); 45 | pinMode(USER2_BUTTON, INPUT); 46 | // turn LED on: 47 | digitalWrite(LED_BUILTIN, HIGH); 48 | } 49 | 50 | void loop() { 51 | // check if the USER1 BUTTON is pressed: 52 | if (!digitalRead(USER1_BUTTON)) 53 | { 54 | // turn LED on: 55 | digitalWrite(LED_BUILTIN, HIGH); 56 | 57 | // sned hex code: 58 | primo_cir.digitalWrite(HEX_1); 59 | // turn LED off: 60 | digitalWrite(LED_BUILTIN, LOW); 61 | } 62 | // check if the USER2 BUTTON is pressed: 63 | else if (!digitalRead(USER2_BUTTON)) 64 | { 65 | // turn LED on: 66 | digitalWrite(LED_BUILTIN, HIGH); 67 | // sned hex code: 68 | primo_cir.digitalWrite(HEX_2); 69 | // turn LED off: 70 | digitalWrite(LED_BUILTIN, LOW); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /libraries/CIR/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map for cir 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | cir KEYWORD1 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | 15 | enableReceiver KEYWORD2 16 | disableReceiver KEYWORD2 17 | getReceiverStatus KEYWORD2 18 | digitalRead KEYWORD2 19 | enableTransmitter KEYWORD2 20 | disableTransmitter KEYWORD2 21 | digitalWrite KEYWORD2 22 | 23 | ####################################### 24 | # Constants (LITERAL1) 25 | ####################################### 26 | -------------------------------------------------------------------------------- /libraries/CIR/library.properties: -------------------------------------------------------------------------------- 1 | name=CIR 2 | version=0.0.1 3 | author=Jeff Wu 4 | maintainer=Arduino 5 | sentence=CIR Transmitter and Receiver 6 | paragraph= This library is designed for using Primo board to reveiving and sending CIR data 7 | category=Communication 8 | url=http://www.arduino.org/learning/reference/cir 9 | architectures=nrf52 -------------------------------------------------------------------------------- /libraries/Comparator/examples/CompareVoltages/CompareVoltages.ino: -------------------------------------------------------------------------------- 1 | /* 2 | CompareVoltages.ino 3 | 4 | Written by Chiara Ruggeri (chiara@arduino.org) 5 | 6 | This example for the Arduino Primo board shows how to use 7 | Compare library. 8 | It declare a Comparator object specifying the analog pin to 9 | monitor, the reference voltage and the detect mode (if the 10 | voltage go DOWN, UP or CROSS the reference). Then begin the 11 | module and start the comparation with compare() function. 12 | When the target event occurs the function passed as parameter 13 | of compare function will be called. 14 | For a list of all voltage references look at the documentation. 15 | 16 | This example code is in the public domain. 17 | 18 | */ 19 | 20 | #include 21 | 22 | //initialize a comparator object by monitoring analog pin A0 23 | //and compare it with pin AREF. We look for the case in which 24 | //A0 goes down the voltage on AREF pin 25 | Comparator comp(A0, AREF, DOWN); 26 | 27 | 28 | void setup() { 29 | Serial.begin(9600); 30 | comp.begin(); 31 | comp.compare(myFunction); 32 | } 33 | 34 | 35 | void loop() { 36 | } 37 | 38 | void myFunction(){ 39 | Serial.println("WARNING!\r\nInput voltage is under reference voltage!"); 40 | } 41 | -------------------------------------------------------------------------------- /libraries/Comparator/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map Comparator 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | Comparator KEYWORD1 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | begin KEYWORD2 15 | compare KEYWORD2 16 | status KEYWORD2 17 | stop KEYWORD2 18 | 19 | ####################################### 20 | # Constants (LITERAL1) 21 | ####################################### 22 | -------------------------------------------------------------------------------- /libraries/Comparator/library.properties: -------------------------------------------------------------------------------- 1 | name=Comparator 2 | version=1.0.0 3 | author=Arduino 4 | maintainer=Arduino 5 | sentence=Compare two different voltages 6 | paragraph=This library uses comparator module to detect if an external voltage is lower or greater than an internal one or AREF pin. 7 | category=Signal Input/Output 8 | url=http://www.arduino.org/learning/reference/Comparator 9 | architectures=nrf52 10 | -------------------------------------------------------------------------------- /libraries/CoreSensors/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map CoreSensors 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | coresensors KEYWORD1 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | 15 | begin KEYWORD2 16 | getHumidity KEYWORD2 17 | getTemperature KEYWORD2 18 | getMagnetometer KEYWORD2 19 | getAccelerometer KEYWORD2 20 | getGyroscope KEYWORD2 21 | 22 | ####################################### 23 | # Constants (LITERAL1) 24 | ####################################### 25 | -------------------------------------------------------------------------------- /libraries/CoreSensors/library.properties: -------------------------------------------------------------------------------- 1 | name=CoreSensors 2 | version=0.0.1 3 | author=Jeff Wu 4 | maintainer=Arduino srl 5 | sentence= CoreSensors library for Arduino Primo Core 6 | paragraph= This library allows you get data from sensors 7 | category=Sensors 8 | url=https://github.com/arduino-org/CoreSensors 9 | architectures=nrf52 10 | -------------------------------------------------------------------------------- /libraries/NFC/examples/SendText/SendText.ino: -------------------------------------------------------------------------------- 1 | /* 2 | SendText.ino 3 | 4 | Written by Chiara Ruggeri (chiara@arduino.org) 5 | 6 | This example for the Arduino Primo board shows how to use 7 | NFC library. 8 | It sets a text message specifying the language code, then 9 | starts the module, so that when a device with NFC is near 10 | to the board the message "Hello World!" will be sent. 11 | 12 | This example code is in the public domain. 13 | 14 | */ 15 | 16 | #include 17 | 18 | 19 | void setup() { 20 | // set the NFC message as first parameter and the language code as second 21 | NFC.setTXTmessage("Hello World!", "en"); 22 | // start the NFC module 23 | NFC.start(); 24 | } 25 | 26 | 27 | void loop() { 28 | } 29 | 30 | 31 | -------------------------------------------------------------------------------- /libraries/NFC/examples/SendURL/SendURL.ino: -------------------------------------------------------------------------------- 1 | /* 2 | SendURL.ino 3 | 4 | Written by Chiara Ruggeri (chiara@arduino.org) 5 | 6 | This example for the Arduino Primo board shows how to use 7 | NFC library. 8 | It sets an URI message and then starts the module, so that 9 | when a device with NFC is near to the board the message 10 | http://www.arduino.org will be sent. 11 | A list of all possible URI message can be found here: 12 | 13 | NFC_URI_HTTP_WWW "http://www." 14 | NFC_URI_HTTPS_WWW "https://www." 15 | NFC_URI_HTTP "http:" 16 | NFC_URI_HTTPS "https:" 17 | NFC_URI_TEL "tel:" 18 | NFC_URI_MAILTO "mailto:" 19 | NFC_URI_FTP_ANONYMOUS "ftp://anonymous:anonymous@" 20 | NFC_URI_FTP_FTP "ftp://ftp." 21 | NFC_URI_FTPS "ftps://" 22 | NFC_URI_SFTP, "sftp://" 23 | NFC_URI_SMB "smb://" 24 | NFC_URI_NFS "nfs://" 25 | NFC_URI_FTP "ftp://" 26 | NFC_URI_DAV "dav://" 27 | NFC_URI_NEWS "news:" 28 | NFC_URI_TELNET "telnet://" 29 | NFC_URI_IMAP "imap:" 30 | NFC_URI_RTSP "rtsp://" 31 | NFC_URI_URN "urn:" 32 | NFC_URI_POP "pop:" 33 | NFC_URI_SIP "sip:" 34 | NFC_URI_SIPS "sips:" 35 | NFC_URI_TFTP "tftp:" 36 | NFC_URI_BTSPP "btspp://" 37 | NFC_URI_BTL2CAP "btl2cap://" 38 | NFC_URI_BTGOEP "btgoep://" 39 | NFC_URI_TCPOBEX "tcpobex://" 40 | NFC_URI_IRDAOBEX "irdaobex://" 41 | NFC_URI_FILE "file://" 42 | NFC_URI_URN_EPC_ID "urn:epc:id:" 43 | NFC_URI_URN_EPC_TAG "urn:epc:tag:" 44 | NFC_URI_URN_EPC_PAT "urn:epc:pat:" 45 | NFC_URI_URN_EPC_RAW "urn:epc:raw:" 46 | NFC_URI_URN_EPC "urn:epc:" 47 | NFC_URI_URN_NFC "urn:nfc:" 48 | 49 | This example code is in the public domain. 50 | 51 | */ 52 | 53 | #include 54 | 55 | void setup() { 56 | NFC.setURImessage("arduino.org", NFC_URI_HTTP_WWW); 57 | NFC.start(); 58 | } 59 | 60 | 61 | void loop() { 62 | } -------------------------------------------------------------------------------- /libraries/NFC/examples/StartApp/StartApp.ino: -------------------------------------------------------------------------------- 1 | /* 2 | SendText.ino 3 | 4 | Written by Chiara Ruggeri (chiara@arduino.org) 5 | 6 | This example for the Arduino Primo board shows how to use 7 | NFC library. 8 | It sets a app message specifying the package name (for Android) 9 | and the ID application (for Windows phone), then starts the 10 | module, so that when a device with NFC is near to the board 11 | it will try to open the application (if present) or will 12 | look for the app in the store. Finally it register a callback 13 | function that will be called any time an NFC field is detected 14 | (it means that a device is near). 15 | 16 | This example code is in the public domain. 17 | 18 | */ 19 | 20 | #include 21 | 22 | //specify the package name for windows and android phone and insert the EOL character at the end '\0' 23 | static const char android_package_name[] = {'n', 'o', '.', 'n', 'o', 'r', 'd', 'i', 'c', 's', 24 | 'e', 'm', 'i', '.', 'a', 'n', 'd', 'r', 'o', 'i', 25 | 'd', '.', 'n', 'r', 'f', 't', 'o', 'o', 'l', 'b', 26 | 'o', 'x', '\0'}; 27 | 28 | static const char windows_application_id[] = {'{', 'e', '1', '2', 'd', '2', 'd', 'a', '7', '-', 29 | '4', '8', '8', '5', '-', '4', '0', '0', 'f', '-', 30 | 'b', 'c', 'd', '4', '-', '6', 'c', 'b', 'd', '5', 31 | 'b', '8', 'c', 'f', '6', '2', 'c', '}', '\0'}; 32 | 33 | void setup() { 34 | Serial.begin(9600); 35 | NFC.setAPPmessage(android_package_name, windows_application_id); 36 | NFC.start(); 37 | NFC.registerCallback(myFunction); 38 | } 39 | 40 | 41 | void loop() { 42 | } 43 | 44 | void myFunction(){ 45 | Serial.println("An user viewed the application"); 46 | } -------------------------------------------------------------------------------- /libraries/NFC/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map NFC 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | NFC KEYWORD1 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | start KEYWORD2 15 | stop KEYWORD2 16 | setTXTmessage KEYWORD2 17 | setURImessage KEYWORD2 18 | setAPPmessage KEYWORD2 19 | setOobPairingKey KEYWORD2 20 | registerCallback KEYWORD2 21 | 22 | ####################################### 23 | # Constants (LITERAL1) 24 | ####################################### 25 | -------------------------------------------------------------------------------- /libraries/NFC/library.properties: -------------------------------------------------------------------------------- 1 | name=NFC 2 | version=1.0 3 | author=Arduino 4 | maintainer=Arduino 5 | sentence=Allows Arduino Primo boards to use the NFC tag onboard 6 | paragraph= 7 | category=Communication 8 | url=http://www.arduino.org/learning/reference/NFC 9 | architectures=nrf52 -------------------------------------------------------------------------------- /libraries/PPI/examples/LowPowerBlink/LowPowerBlink.ino: -------------------------------------------------------------------------------- 1 | /* 2 | LowPowerBlink.ino 3 | 4 | Written by Chiara Ruggeri (chiara@arduino.org) 5 | 6 | This example for the Arduino Primo board shows how to use 7 | PPI library. 8 | With this library is possible to bind an action to a particular 9 | event. In this way, when an event occurs, the related peripheral 10 | can take the specified action without the MCU intervention. 11 | For a complete list of all events and actions that is possible to 12 | use, please refer to the library documentation. 13 | 14 | This example code is in the public domain. 15 | 16 | */ 17 | 18 | #include 19 | // download ArduinoLowPower library from library manager to enter in low power mode 20 | #include "ArduinoLowPower.h" 21 | 22 | void setup() { 23 | //bind a timer event to the toggle of the pin 24 | //set an interval for the timer (in milliseconds) 25 | PPI.setTimerInterval(1000); 26 | //select the output pin 27 | PPI.setOutputPin(LED_BUILTIN); 28 | //bind TIMER event to PIN_TOGGLE action 29 | PPI.setShortcut(TIMER, PIN_TOGGLE); 30 | } 31 | 32 | 33 | void loop() { 34 | //put the board in low power mode to save power 35 | LowPower.sleep(); 36 | } 37 | -------------------------------------------------------------------------------- /libraries/PPI/examples/SenseNFC/SenseNFC.ino: -------------------------------------------------------------------------------- 1 | /* 2 | SenseNFC.ino 3 | 4 | Written by Chiara Ruggeri (chiara@arduino.org) 5 | 6 | This example for the Arduino Primo board shows how to use 7 | PPI library. 8 | With this library is possible to bind an action to a particular 9 | event. In this way, when an event occurs, the related peripheral 10 | can take the specified action without the MCU intervention. 11 | For a complete list of all events and actions that is possible to 12 | use, please refer to the library documentation. 13 | 14 | This example code is in the public domain. 15 | 16 | */ 17 | 18 | #include 19 | // download ArduinoLowPower library from library manager to enter in low power mode 20 | #include "ArduinoLowPower.h" 21 | 22 | void setup() { 23 | 24 | //Set the comparator to stop NFC sense when voltage 25 | //on pin A0 goes below 1/8 of VDD 26 | PPI.setInputPin(A0); 27 | PPI.setCompReference(REF_VDD_1_8); 28 | // event , action 29 | PPI.setShortcut(COMP_DOWN, NFC_STOP_SENSE); 30 | 31 | //Start to sense NFC field each time an high level is detected 32 | //on pin 4 33 | PPI.setInputPin(4); 34 | PPI.setShortcut(PIN_HIGH, NFC_START_SENSE); 35 | 36 | //Toggle LED pin each time an NFC field is detected 37 | PPI.setOutputPin(LED_BUILTIN); 38 | PPI.setShortcut(NFC_FIELD_DETECTED, PIN_TOGGLE); 39 | } 40 | 41 | 42 | void loop() { 43 | //Put mcu in sleep mode to save power. 44 | LowPower.sleep(); 45 | } -------------------------------------------------------------------------------- /libraries/PPI/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map PPI 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | PPI KEYWORD1 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | setShortcut KEYWORD2 15 | setInputPin KEYWORD2 16 | setOutputPin KEYWORD2 17 | setTimerInterval KEYWORD2 18 | setCompReference KEYWORD2 19 | 20 | ####################################### 21 | # Constants (LITERAL1) 22 | ####################################### 23 | TIMER LITERAL1 24 | PIN_HIGH LITERAL1 25 | PIN_LOW LITERAL1 26 | PIN_CHANGE LITERAL1 27 | COMP_DOWN LITERAL1 28 | COMP_UP LITERAL1 29 | COMP_CROSS LITERAL1 30 | NFC_FIELD_DETECTED LITERAL1 31 | POWER_WARNING LITERAL1 32 | 33 | TIMER_START LITERAL1 34 | TIMER_STOP LITERAL1 35 | PIN_SET LITERAL1 36 | PIN_CLEAR LITERAL1 37 | PIN_TOGGLE LITERAL1 38 | NFC_START_SENSE LITERAL1 39 | NFC_STOP_SENSE LITERAL1 -------------------------------------------------------------------------------- /libraries/PPI/library.properties: -------------------------------------------------------------------------------- 1 | name=PPI 2 | version=1.0.0 3 | author=Arduino 4 | maintainer=Arduino 5 | sentence=Register an action to be performed when a given event occurs. 6 | paragraph= 7 | category=Device Control 8 | url=http://www.arduino.org/learning/reference/PPI 9 | architectures=nrf52 10 | -------------------------------------------------------------------------------- /libraries/RTC/examples/ALARM_interrupt/ALARM_interrupt.ino: -------------------------------------------------------------------------------- 1 | /***************************************************************************************************************************************************************************** 2 | * This sketch demonstrate how to use alarm in interrupt mode. 3 | This mode is more conveniently because you use processor for other tasks and when alarm match occurs interrupt routine is executed. 4 | In this way, alarm flag checking is indipendent from main program flow. 5 | 6 | NOTE: for M0/M0 pro only you can select the oscillator source for count. 7 | If you want to use a low power oscillator use rtc.begin(TIME_H24, LOW_POWER); function. 8 | If you want to use a more accurate oscillator use rtc.begin(TIME_H24, HIGH_PRECISION); function. 9 | ******************************************************************************************************************************************************************************/ 10 | 11 | 12 | #include 13 | 14 | RTCInt rtc; 15 | 16 | void setup() 17 | { 18 | Serial.begin(9600); //serial communication initializing 19 | pinMode(LED_BUILTIN,OUTPUT); 20 | rtc.begin(TIME_H24); //RTC initializing with 24 hour representation mode 21 | rtc.setTime(17,0,5,0); //setting time (hour minute and second) 22 | rtc.setDate(13,8,15); //setting date 23 | rtc.enableAlarm(SEC,ALARM_INTERRUPT,alarm_int); //enabling alarm in polled mode and match on second 24 | rtc.time.hour=17; 25 | rtc.time.minute=5; 26 | rtc.time.second=10; //setting second to match 27 | rtc.setAlarm(); //write second in alarm register 28 | } 29 | 30 | void loop() 31 | { 32 | digitalWrite(LED_BUILTIN,HIGH); //main program code 33 | delay(100); 34 | digitalWrite(LED_BUILTIN,LOW); 35 | delay(900); 36 | 37 | } 38 | 39 | 40 | /*************** Interrupt routine for alarm ******************************/ 41 | void alarm_int(void) 42 | { 43 | Serial.println("Alarm match!"); 44 | for(int i=0; i < 10; i++) 45 | { 46 | digitalWrite(LED_BUILTIN,HIGH); 47 | //delay(200); 48 | for(int j=0; j < 1000000; j++) asm("NOP"); //in interrupt routine you cannot use delay function then an alternative is NOP instruction cicled many time as you need 49 | digitalWrite(LED_BUILTIN,LOW); 50 | //delay(800); 51 | for(int j=0; j < 2000000; j++) asm("NOP"); 52 | } 53 | rtc.alarmClearFlag(); //clearing alarm flag 54 | } 55 | -------------------------------------------------------------------------------- /libraries/RTC/examples/ALARM_polled/ALARM_polled.ino: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************************************************************************************* 2 | * This sketch demonstrates how configure alarm in polled mode. 3 | In this mode you hav to check continuously ALARM flag in the main program code. 4 | 5 | NOTE: for M0/M0 pro only you can select the oscillator source for count. 6 | If you want to use a low power oscillator use rtc.begin(TIME_H24, LOW_POWER); function. 7 | If you want to use a more accurate oscillator use rtc.begin(TIME_H24, HIGH_PRECISION); function. 8 | *********************************************************************************************************************************************************************************/ 9 | 10 | 11 | #include 12 | 13 | RTCInt rtc; 14 | 15 | void setup() 16 | { 17 | Serial.begin(9600); //serial communication initializing 18 | pinMode(LED_BUILTIN,OUTPUT); 19 | rtc.begin(TIME_H24); //RTC initializing with 24 hour representation mode 20 | rtc.setTime(17,0,5,0); //setting time (hour minute and second) 21 | rtc.setDate(13,8,15); //setting date 22 | rtc.enableAlarm(SEC,ALARM_POLLED,NULL); //enabling alarm in polled mode and match on second 23 | rtc.time.hour=17; 24 | rtc.time.minute=5; 25 | rtc.time.second=10; //setting second to match 26 | rtc.setAlarm(); //write second in alarm register 27 | } 28 | 29 | void loop() 30 | { 31 | 32 | digitalWrite(LED_BUILTIN,HIGH); 33 | delay(100); 34 | digitalWrite(LED_BUILTIN,LOW); 35 | delay(400); 36 | 37 | if(rtc.alarmMatch()) //when match occurs led on pin 13 blinks ten times 38 | { 39 | Serial.println("Alarm match!"); 40 | for(int i=0; i < 10; i++) 41 | { 42 | digitalWrite(LED_BUILTIN,HIGH); 43 | delay(200); 44 | digitalWrite(LED_BUILTIN,LOW); 45 | delay(800); 46 | } 47 | rtc.alarmClearFlag(); //clearing alarm flag 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /libraries/RTC/examples/RTC_simple/RTC_simple.ino: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************************************************************** 2 | This sketch gives a simple demonstration of how to use RTC library. 3 | The code sets date and time using internal structure and then print on serial date and time. Time representation is 12 hour mode 4 | 5 | NOTE: for M0/M0 pro only you can select the oscillator source for count. 6 | If you want to use a low power oscillator use rtc.begin(TIME_H24, LOW_POWER); function. 7 | If you want to use a more accurate oscillator use rtc.begin(TIME_H24, HIGH_PRECISION); function. 8 | **********************************************************************************************************************************************************/ 9 | 10 | 11 | 12 | #include 13 | 14 | RTCInt rtc; //create an RTCInt type object 15 | 16 | 17 | void setup() 18 | { 19 | Serial.begin(9600); 20 | rtc.begin(TIME_H12); //init RTC in 12 hour mode 21 | 22 | //filling internal structure for time 23 | rtc.time.hour = 10; //hour 24 | rtc.time.minute = 44; //minute 25 | rtc.time.second = 0; //second 26 | rtc.time.Tmode = ANTI_MERIDIAN; 27 | 28 | //filling internal structure for date 29 | rtc.date.day = 13; //day 30 | rtc.date.month = 8; //month 31 | rtc.date.year = 15; //year 32 | 33 | rtc.setTime(); //setting time 34 | rtc.setDate(); //setting date 35 | 36 | 37 | 38 | 39 | 40 | } 41 | 42 | void loop() 43 | { 44 | rtc.getDate(); //getting date in local structure (local_date) 45 | rtc.getTime(); //getting time in local structure(local_time) 46 | 47 | //printing date in format YYYY/MM/DD 48 | Serial.print(rtc.date.year+2000); // year 49 | Serial.print('/'); 50 | Serial.print(rtc.date.month); // month 51 | Serial.print('/'); 52 | Serial.print(rtc.date.day); // day 53 | Serial.print(' '); 54 | 55 | //printing time 56 | Serial.print(rtc.time.hour); //hour 57 | Serial.print(':'); 58 | Serial.print(rtc.time.minute); //minute 59 | Serial.print(':'); 60 | Serial.print(rtc.time.second); //second 61 | Serial.print (' '); 62 | if(rtc.time.Tmode == ANTI_MERIDIAN) Serial.println("AM"); // print AM or PM 63 | else Serial.println("PM"); 64 | 65 | delay(1000); 66 | } 67 | -------------------------------------------------------------------------------- /libraries/RTC/examples/RTC_simple_24H_mode/RTC_simple_24H_mode.ino: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************************************************************** 2 | This sketch gives a simple demonstration of how to use RTC library. 3 | The code sets date and time using internal structure and then print on serial date and time. Time representation is 24 hour mode 4 | 5 | NOTE: for M0/M0 pro only you can select the oscillator source for count. 6 | If you want to use a low power oscillator use rtc.begin(TIME_H24, LOW_POWER); function. 7 | If you want to use a more accurate oscillator use rtc.begin(TIME_H24, HIGH_PRECISION); function. 8 | **********************************************************************************************************************************************************/ 9 | 10 | 11 | 12 | #include 13 | 14 | RTCInt rtc; //create an RTCInt type object 15 | 16 | 17 | void setup() 18 | { 19 | Serial.begin(9600); 20 | rtc.begin(TIME_H24); //init RTC in 12 hour mode 21 | 22 | //time settings 23 | rtc.setHour(15,0); //setting hour 24 | rtc.setMinute(43); //setting minute 25 | rtc.setSecond(0); //setting second 26 | 27 | 28 | rtc.setDay(13); //setting day 29 | rtc.setMonth(8); //setting month 30 | rtc.setYear(15); //setting year 31 | 32 | } 33 | 34 | void loop() 35 | { 36 | rtc.getDate(); //getting date in local structure (local_date) 37 | rtc.getTime(); //getting time in local structure(local_time) 38 | 39 | //printing date in format YYYY/MM/DD 40 | Serial.print(rtc.date.year+2000); // year 41 | Serial.print('/'); 42 | Serial.print(rtc.date.month); // month 43 | Serial.print('/'); 44 | Serial.print(rtc.date.day); // day 45 | Serial.print(' '); 46 | 47 | //printing time 48 | Serial.print(rtc.time.hour); //hour 49 | Serial.print(':'); 50 | Serial.print(rtc.time.minute); //minute 51 | Serial.print(':'); 52 | Serial.println(rtc.time.second); //second 53 | 54 | delay(1000); 55 | } 56 | -------------------------------------------------------------------------------- /libraries/SPI/examples/DigitalPotControl/DigitalPotControl.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Digital Pot Control 3 | 4 | This example controls an Analog Devices AD5206 digital potentiometer. 5 | The AD5206 has 6 potentiometer channels. Each channel's pins are labeled 6 | A - connect this to voltage 7 | W - this is the pot's wiper, which changes when you set it 8 | B - connect this to ground. 9 | 10 | The AD5206 is SPI-compatible,and to command it, you send two bytes, 11 | one with the channel number (0 - 5) and one with the resistance value for the 12 | channel (0 - 255). 13 | 14 | The circuit: 15 | * All A pins of AD5206 connected to +5V 16 | * All B pins of AD5206 connected to ground 17 | * An LED and a 220-ohm resisor in series connected from each W pin to ground 18 | * CS - to digital pin 10 (SS pin) 19 | * SDI - to digital pin 11 (MOSI pin) 20 | * CLK - to digital pin 13 (SCK pin) 21 | 22 | created 10 Aug 2010 23 | by Tom Igoe 24 | 25 | Thanks to Heather Dewey-Hagborg for the original tutorial, 2005 26 | 27 | */ 28 | 29 | 30 | // inslude the SPI library: 31 | #include 32 | 33 | // set pin 7 as the slave select for the digital pot: 34 | const int slaveSelectPin = 7; 35 | 36 | void setup() { 37 | // set the slaveSelectPin as an output: 38 | pinMode (slaveSelectPin, OUTPUT); 39 | // initialize SPI: 40 | SPI.begin(); 41 | } 42 | 43 | void loop() { 44 | // go through the six channels of the digital pot: 45 | for (int channel = 0; channel < 6; channel++) { 46 | // change the resistance on this channel from min to max: 47 | for (int level = 0; level < 255; level++) { 48 | digitalPotWrite(channel, level); 49 | delay(10); 50 | } 51 | // wait a second at the top: 52 | delay(100); 53 | // change the resistance on this channel from max to min: 54 | for (int level = 0; level < 255; level++) { 55 | digitalPotWrite(channel, 255 - level); 56 | delay(10); 57 | } 58 | } 59 | 60 | } 61 | 62 | void digitalPotWrite(int address, int value) { 63 | // take the SS pin low to select the chip: 64 | digitalWrite(slaveSelectPin, LOW); 65 | // send in the address and value via SPI: 66 | SPI.transfer(address); 67 | SPI.transfer(value); 68 | // take the SS pin high to de-select the chip: 69 | digitalWrite(slaveSelectPin, HIGH); 70 | } 71 | -------------------------------------------------------------------------------- /libraries/SPI/examples/MasterSend/MasterSend.ino: -------------------------------------------------------------------------------- 1 | /* Connection 2 | MASTER SLAVE 3 | MISO -> MOSI 4 | MOSI -> MISO 5 | SCK -> SCK 6 | D10(SS) -> D10(SS) 7 | GND -> GND 8 | */ 9 | 10 | #include 11 | 12 | #define DIM 11 13 | 14 | void setup() { 15 | 16 | pinMode (SS, OUTPUT); 17 | digitalWrite(SS, HIGH); 18 | SPI.begin(); 19 | 20 | } 21 | 22 | void loop() { 23 | 24 | String x ="hello world"; 25 | digitalWrite(SS, LOW); 26 | for (int i=0;i MOSI 4 | MOSI -> MISO 5 | SCK -> SCK 6 | D10(SS) -> D10(SS) 7 | GND -> GND 8 | */ 9 | 10 | #include 11 | 12 | #define DIM 11 13 | 14 | uint8_t data[DIM]; 15 | 16 | void setup() { 17 | 18 | Serial.begin(9600); 19 | pinMode (SS, INPUT); 20 | while(!Serial); 21 | delay(1); 22 | SPI.beginSlave(); 23 | 24 | } 25 | 26 | void loop() { 27 | while(digitalRead(SS)==LOW){ 28 | for (int i=0;i 5 | sentence=Enables the communication with devices that use the Serial Peripheral Interface (SPI) Bus. 6 | paragraph=SPI is a synchronous serial data protocol used by microcontrollers for communicating with one or more peripheral devices quickly over short distances. It uses three lines common to all devices (MISO, MOSI and SCK) and one specific for each device. 7 | category=Communication 8 | url=http://arduino.cc/en/Reference/SPI 9 | architectures=nrf52 10 | -------------------------------------------------------------------------------- /libraries/SoftwareSerial/examples/SoftwareSerialExample/SoftwareSerialExample.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Software serial multiple serial test 3 | 4 | Receives from the hardware serial, sends to software serial. 5 | Receives from software serial, sends to hardware serial. 6 | 7 | The circuit: 8 | * RX is digital pin 9 (connect to TX of other device) 9 | * TX is digital pin 10 (connect to RX of other device) 10 | 11 | This example code is in the public domain. 12 | 13 | */ 14 | 15 | #include 16 | 17 | SoftwareSerial mySerial(9, 10); // RX, TX 18 | 19 | 20 | void setup() 21 | { 22 | // Open serial communications and wait for port to open: 23 | Serial.begin(9600); 24 | Serial.println("Goodnight moon!"); 25 | 26 | // set the data rate for the SoftwareSerial port 27 | mySerial.begin(9600); 28 | mySerial.println("Hello, world?"); 29 | } 30 | 31 | void loop() // run over and over// 32 | { 33 | if (mySerial.available()) 34 | Serial.write(mySerial.read()); 35 | 36 | if (Serial.available()) 37 | mySerial.write(Serial.read()); 38 | } 39 | -------------------------------------------------------------------------------- /libraries/SoftwareSerial/examples/TwoPortReceive/TwoPortReceive.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Software serial multple serial test 3 | 4 | Receives from the two software serial ports, 5 | sends to the hardware serial port. 6 | 7 | In order to listen on a software port, you call port.listen(). 8 | When using two software serial ports, you have to switch ports 9 | by listen()ing on each one in turn. Pick a logical time to switch 10 | ports, like the end of an expected transmission, or when the 11 | buffer is empty. This example switches ports when there is nothing 12 | more to read from a port 13 | 14 | The circuit: 15 | Two devices which communicate serially are needed. 16 | * First serial device's TX attached to digital pin 9, RX to pin 11 17 | * Second serial device's TX attached to digital pin 8, RX to pin 10 18 | 19 | This example code is in the public domain. 20 | 21 | */ 22 | 23 | #include 24 | // software serial #1: TX = digital pin 11, RX = digital pin 9 25 | SoftwareSerial portOne(9, 11); 26 | 27 | // software serial #2: TX = digital pin 10, RX = digital pin 8 28 | SoftwareSerial portTwo(8, 10); 29 | 30 | void setup() 31 | { 32 | // Open serial communications and wait for port to open: 33 | Serial.begin(115200); 34 | 35 | // Start each software serial port 36 | portOne.begin(9600); 37 | portTwo.begin(9600); 38 | } 39 | 40 | void loop() 41 | { 42 | // By default, the last intialized port is listening. 43 | // when you want to listen on a port, explicitly select it: 44 | portOne.listen(); 45 | 46 | Serial.println("Data from port one:"); 47 | // while there is data coming in, read it 48 | // and send to the hardware serial port: 49 | while (portOne.available() > 0) { 50 | char inByte = portOne.read(); 51 | Serial.write(inByte); 52 | } 53 | 54 | // blank line to separate data from the two ports: 55 | Serial.println(""); 56 | 57 | // Now listen on the second port 58 | portTwo.listen(); 59 | // while there is data coming in, read it 60 | // and send to the hardware serial port: 61 | 62 | Serial.println("Data from port two:"); 63 | while (portTwo.available() > 0) { 64 | char inByte = portTwo.read(); 65 | Serial.write(inByte); 66 | } 67 | 68 | // blank line to separate data from the two ports: 69 | Serial.println(); 70 | } 71 | 72 | -------------------------------------------------------------------------------- /libraries/SoftwareSerial/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map for SoftwareSerial 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | SoftwareSerial KEYWORD1 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | 15 | begin KEYWORD2 16 | end KEYWORD2 17 | read KEYWORD2 18 | write KEYWORD2 19 | available KEYWORD2 20 | isListening KEYWORD2 21 | overflow KEYWORD2 22 | flush KEYWORD2 23 | listen KEYWORD2 24 | peek KEYWORD2 25 | 26 | ####################################### 27 | # Constants (LITERAL1) 28 | ####################################### 29 | 30 | -------------------------------------------------------------------------------- /libraries/SoftwareSerial/library.properties: -------------------------------------------------------------------------------- 1 | name=SoftwareSerial 2 | version=1.0.0 3 | author=Arduino 4 | maintainer=Arduino 5 | sentence=Enables serial communication on digital pins. 6 | paragraph=The SoftwareSerial library has been developed to allow serial communication on any digital pin of the board, using software to replicate the functionality of the hardware UART. It is possible to have multiple software serial ports with speeds up to 115200 bps. 7 | category=Communication 8 | url=http://arduino.cc/en/Reference/SoftwareSerial 9 | architectures=nrf52 10 | -------------------------------------------------------------------------------- /libraries/Wire/examples/digital_potentiometer/digital_potentiometer.pde: -------------------------------------------------------------------------------- 1 | // I2C Digital Potentiometer 2 | // by Nicholas Zambetti 3 | // and Shawn Bonkowski 4 | 5 | // Demonstrates use of the Wire library 6 | // Controls AD5171 digital potentiometer via I2C/TWI 7 | 8 | // Created 31 March 2006 9 | 10 | // This example code is in the public domain. 11 | 12 | // This example code is in the public domain. 13 | 14 | 15 | #include 16 | 17 | void setup() 18 | { 19 | Wire.begin(); // join i2c bus (address optional for master) 20 | } 21 | 22 | byte val = 0; 23 | 24 | void loop() 25 | { 26 | Wire.beginTransmission(44); // transmit to device #44 (0x2c) 27 | // device address is specified in datasheet 28 | Wire.write(byte(0x00)); // sends instruction byte 29 | Wire.write(val); // sends potentiometer value byte 30 | Wire.endTransmission(); // stop transmitting 31 | 32 | val++; // increment value 33 | if(val == 64) // if reached 64th position (max) 34 | { 35 | val = 0; // start over from lowest value 36 | } 37 | delay(500); 38 | } 39 | 40 | -------------------------------------------------------------------------------- /libraries/Wire/examples/master_reader/master_reader.ino: -------------------------------------------------------------------------------- 1 | // Wire Master Reader 2 | // by Nicholas Zambetti 3 | 4 | // Demonstrates use of the Wire library 5 | // Reads data from an I2C/TWI slave device 6 | // Refer to the "Wire Slave Sender" example for use with this 7 | 8 | // Created 29 March 2006 9 | 10 | // This example code is in the public domain. 11 | 12 | 13 | #include 14 | 15 | void setup() 16 | { 17 | Wire.begin(); // join i2c bus (address optional for master) 18 | Serial.begin(9600); // start Serial for output 19 | } 20 | 21 | void loop() 22 | { 23 | Wire.requestFrom(2, 6); // request 6 bytes from slave device #2 24 | 25 | while(Wire.available()) // slave may send less than requested 26 | { 27 | char c = Wire.read(); // receive a byte as character 28 | Serial.print(c); // print the character 29 | } 30 | 31 | delay(500); 32 | } 33 | -------------------------------------------------------------------------------- /libraries/Wire/examples/master_writer/master_writer.pde: -------------------------------------------------------------------------------- 1 | // Wire Master Writer 2 | // by Nicholas Zambetti 3 | 4 | // Demonstrates use of the Wire library 5 | // Writes data to an I2C/TWI slave device 6 | // Refer to the "Wire Slave Receiver" example for use with this 7 | 8 | // Created 29 March 2006 9 | 10 | // This example code is in the public domain. 11 | 12 | 13 | #include 14 | 15 | void setup() 16 | { 17 | Wire.begin(); // join i2c bus (address optional for master) 18 | } 19 | 20 | byte x = 0; 21 | 22 | void loop() 23 | { 24 | Wire.beginTransmission(4); // transmit to device #4 25 | Wire.write("x is "); // sends five bytes 26 | Wire.write(x); // sends one byte 27 | Wire.endTransmission(); // stop transmitting 28 | 29 | x++; 30 | delay(500); 31 | } 32 | -------------------------------------------------------------------------------- /libraries/Wire/examples/slave_receiver/slave_receiver.pde: -------------------------------------------------------------------------------- 1 | // Wire Slave Receiver 2 | // by Nicholas Zambetti 3 | 4 | // Demonstrates use of the Wire library 5 | // Receives data as an I2C/TWI slave device 6 | // Refer to the "Wire Master Writer" example for use with this 7 | 8 | // Created 29 March 2006 9 | 10 | // This example code is in the public domain. 11 | 12 | 13 | #include 14 | 15 | void setup() 16 | { 17 | Wire.begin(4); // join i2c bus with address #4 18 | Wire.onReceive(receiveEvent); // register event 19 | Serial.begin(9600); // start serial for output 20 | } 21 | 22 | void loop() 23 | { 24 | delay(100); 25 | } 26 | 27 | // function that executes whenever data is received from master 28 | // this function is registered as an event, see setup() 29 | void receiveEvent(int howMany) 30 | { 31 | while(1 < Wire.available()) // loop through all but the last 32 | { 33 | char c = Wire.read(); // receive byte as a character 34 | Serial.print(c); // print the character 35 | } 36 | int x = Wire.read(); // receive byte as an integer 37 | Serial.println(x); // print the integer 38 | } 39 | -------------------------------------------------------------------------------- /libraries/Wire/examples/slave_sender/slave_sender.pde: -------------------------------------------------------------------------------- 1 | // Wire Slave Sender 2 | // by Nicholas Zambetti 3 | 4 | // Demonstrates use of the Wire library 5 | // Sends data as an I2C/TWI slave device 6 | // Refer to the "Wire Master Reader" example for use with this 7 | 8 | // Created 29 March 2006 9 | 10 | // This example code is in the public domain. 11 | 12 | 13 | #include 14 | 15 | void setup() 16 | { 17 | Wire.begin(2); // join i2c bus with address #2 18 | Wire.onRequest(requestEvent); // register event 19 | } 20 | 21 | void loop() 22 | { 23 | delay(100); 24 | } 25 | 26 | // function that executes whenever data is requested by master 27 | // this function is registered as an event, see setup() 28 | void requestEvent() 29 | { 30 | Wire.write("hello "); // respond with message of 6 bytes 31 | // as expected by master 32 | } 33 | -------------------------------------------------------------------------------- /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 | send KEYWORD2 18 | receive KEYWORD2 19 | onReceive KEYWORD2 20 | onRequest KEYWORD2 21 | 22 | ####################################### 23 | # Instances (KEYWORD2) 24 | ####################################### 25 | 26 | Wire KEYWORD2 27 | Wire1 KEYWORD2 28 | 29 | ####################################### 30 | # Constants (LITERAL1) 31 | ####################################### 32 | 33 | -------------------------------------------------------------------------------- /libraries/Wire/library.properties: -------------------------------------------------------------------------------- 1 | name=Wire 2 | version=1.0.0 3 | author=Arduino 4 | maintainer=Arduino 5 | sentence=Allows the communication between devices or sensors connected via Two Wire Interface Bus. Specific implementation for Arduino Zero. 6 | paragraph= 7 | category=Communication 8 | url=http://www.arduino.cc/en/Reference/Wire 9 | architectures=nrf52 10 | -------------------------------------------------------------------------------- /post_install.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | set ARGS=/A /SE /SW /SA 3 | if "%PROCESSOR_ARCHITECTURE%" == "AMD64" ( 4 | drivers\dpinst-amd64.exe %ARGS% /path %CD%\drivers\x64 5 | ) ELSE IF "%PROCESSOR_ARCHITEW6432%" == "AMD64" ( 6 | drivers\dpinst-amd64.exe %ARGS% /path %CD%\drivers\x64 7 | ) ELSE ( 8 | drivers\dpinst-x86.exe %ARGS% /path %CD%\drivers\x86 9 | ) 10 | exit /b 0 -------------------------------------------------------------------------------- /programmers.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduino/ArduinoCore-primo/cd54ab663d93e60e5a53d2d05f13f16e3cc147e7/programmers.txt -------------------------------------------------------------------------------- /variants/arduino_primo/openocd_scripts/arduino_primo.cfg: -------------------------------------------------------------------------------- 1 | # 2 | # Arduino Primo board (nRF52832) 3 | # 4 | 5 | source [find interface/cmsis-dap.cfg] 6 | source [find target/nrf52.cfg] 7 | -------------------------------------------------------------------------------- /variants/arduino_primo/pins_arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Arduino Srl. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | // API compatibility 20 | #include "variant.h" -------------------------------------------------------------------------------- /variants/arduino_primo_core/openocd_scripts/arduino_primo.cfg: -------------------------------------------------------------------------------- 1 | # 2 | # Arduino Primo board (nRF52832) 3 | # 4 | 5 | source [find interface/cmsis-dap.cfg] 6 | source [find target/nrf52.cfg] 7 | -------------------------------------------------------------------------------- /variants/arduino_primo_core/pins_arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Arduino Srl. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | // API compatibility 20 | #include "variant.h" --------------------------------------------------------------------------------