├── system └── libarc32_arduino101 │ ├── .gitignore │ ├── framework │ ├── src │ │ ├── services │ │ │ ├── ble │ │ │ │ ├── dtm_tcmd.c │ │ │ │ ├── l2cap_internal.h │ │ │ │ ├── hci_core.h │ │ │ │ └── l2cap.c │ │ │ └── ble_service │ │ │ │ ├── nble_driver.h │ │ │ │ ├── ble_protocol.h │ │ │ │ └── ble_service_int.h │ │ ├── os │ │ │ ├── panic.c │ │ │ └── memory_pool_list.def │ │ ├── infra │ │ │ ├── factory_data.c │ │ │ ├── uptime.c │ │ │ └── log_impl_printk.c │ │ └── cfw │ │ │ └── cfw_private.h │ └── include │ │ ├── log_modules │ │ ├── panic_api.h │ │ ├── cfw │ │ ├── cfw_debug.h │ │ └── cfw_internal.h │ │ ├── cfw_platform.h │ │ └── infra │ │ ├── time.h │ │ └── log_backend.h │ ├── bootcode │ ├── conf.h │ ├── interrupt.h │ ├── version.c │ └── c_init.c │ ├── common │ ├── misc │ │ └── byteorder.h │ └── compiler.h │ └── drivers │ ├── ss_spi.h │ ├── bluetooth │ └── att.h │ ├── clk_system.c │ ├── clk_system.h │ └── ss_dw_i2c.h ├── drivers ├── dpinst-x86.exe ├── dpinst-amd64.exe ├── intc_libusb.cat ├── intc_libusb.inf ├── intc_serial.cat ├── intc_composite.cat ├── x86 │ ├── WdfCoInstaller01009.dll │ └── winusbcoinstaller2.dll ├── amd64 │ ├── WdfCoInstaller01009.dll │ └── winusbcoinstaller2.dll ├── intc_composite.inf └── intc_serial.inf ├── .gitignore ├── variants └── arduino_101 │ ├── libarc32drv_arduino101.a │ └── pins_arduino.h ├── libraries ├── CurieSerialFlash │ ├── CurieSerialFlash.h │ └── examples │ │ ├── FileWrite │ │ └── FileWrite.ino │ │ └── ListFiles │ │ └── ListFiles.ino ├── CurieTime │ ├── library.properties │ ├── readme.txt │ ├── keywords.txt │ ├── src │ │ └── CurieTime.h │ └── examples │ │ ├── ReadTest │ │ └── ReadTest.ino │ │ └── SetTime │ │ └── SetTime.ino ├── CurieTimerOne │ ├── library.properties │ ├── examples │ │ ├── CurieTimer1PWM │ │ │ └── CurieTimer1PWM.ino │ │ ├── CurieTimer1BlinkSpeed │ │ │ └── CurieTimer1BlinkSpeed.ino │ │ └── CurieTimer1Interrupt │ │ │ └── CurieTimer1Interrupt.ino │ └── keywords.txt ├── CurieI2S │ ├── library.properties │ ├── examples │ │ ├── I2S_TxCallback │ │ │ └── I2S_TxCallback.ino │ │ ├── I2S_RxCallback │ │ │ └── I2S_RxCallback.ino │ │ └── I2SDMA_TXCallBack │ │ │ └── I2SDMA_TXCallBack.ino │ └── keywords.txt ├── CuriePowerManagement │ ├── library.properties │ ├── examples │ │ ├── TimedWakeup │ │ │ └── TimedWakeup.ino │ │ └── WakeFromIMU │ │ │ └── WakeFromIMU.ino │ └── keywords.txt ├── MemoryFree │ ├── keywords.txt │ ├── library.properties │ ├── examples │ │ └── freeMemory │ │ │ └── freeMemory.ino │ ├── src │ │ ├── MemoryFree.h │ │ └── MemoryFree.cpp │ └── README.md ├── Servo │ ├── library.properties │ ├── keywords.txt │ ├── examples │ │ ├── Knob │ │ │ └── Knob.ino │ │ └── Sweep │ │ │ └── Sweep.ino │ └── README.adoc ├── CurieIMU │ ├── library.properties │ └── examples │ │ ├── Gyro │ │ └── Gyro.ino │ │ ├── Accelerometer │ │ └── Accelerometer.ino │ │ └── FreeFallDetect │ │ └── FreeFallDetect.ino ├── CurieBLE │ ├── library.properties │ ├── README.md │ └── src │ │ ├── CurieBLE.h │ │ ├── internal │ │ ├── BLEUtils.h │ │ ├── BLEAttribute.cpp │ │ └── BLEAttribute.h │ │ ├── BLECentral.cpp │ │ ├── BLECentral.h │ │ └── BLEAttributeWithValue.h ├── EEPROM │ ├── library.properties │ ├── keywords.txt │ └── examples │ │ ├── eeprom_clear │ │ └── eeprom_clear.ino │ │ ├── eeprom_iteration │ │ └── eeprom_iteration.ino │ │ ├── eeprom_put │ │ └── eeprom_put.ino │ │ ├── eeprom_read │ │ └── eeprom_read.ino │ │ ├── eeprom_crc │ │ └── eeprom_crc.ino │ │ ├── eeprom_write │ │ └── eeprom_write.ino │ │ ├── eeprom_get │ │ └── eeprom_get.ino │ │ └── eeprom_update │ │ └── eeprom_update.ino ├── Wire │ ├── library.properties │ ├── examples │ │ ├── master_reader │ │ │ └── master_reader.ino │ │ ├── master_writer │ │ │ └── master_writer.ino │ │ ├── digital_potentiometer │ │ │ └── digital_potentiometer.ino │ │ └── bus_scan │ │ │ └── bus_scan.ino │ └── src │ │ └── Wire.h ├── SPI │ ├── library.properties │ ├── keywords.txt │ └── examples │ │ └── DigitalPotControl │ │ └── DigitalPotControl.ino └── CurieSoftwareSerial │ ├── library.properties │ ├── keywords.txt │ └── examples │ └── SoftwareSerialExample │ └── SoftwareSerialExample.ino ├── programmers.txt ├── post_install.bat ├── cores └── arduino │ ├── mailbox.h │ ├── Server.h │ ├── new.h │ ├── dccm │ ├── dccm_alloc.h │ └── dccm_alloc.c │ ├── error.h │ ├── WMath.h │ ├── WInterrupts.h │ ├── wiring_shift.h │ ├── new.cpp │ ├── itoa.h │ ├── abi.cpp │ ├── Tone.h │ ├── Printable.h │ ├── HardwareSerial.h │ ├── main.cpp │ ├── error.cpp │ ├── stdlib_noniso.h │ ├── RingBuffer.h │ ├── Client.h │ ├── wiring_pulse.h │ ├── RingBuffer.cpp │ ├── WMath.cpp │ ├── i2c.h │ ├── wiring_shift.c │ ├── hooks.c │ ├── wiring.c │ ├── printk.cpp │ ├── soc_i2c.h │ ├── wiring_private.h │ └── CDCSerialClass.h ├── scripts └── create_dfu_udev_rule └── boards.txt /system/libarc32_arduino101/.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.a 3 | *.map 4 | *.elf 5 | *.swp 6 | *.bin 7 | -------------------------------------------------------------------------------- /drivers/dpinst-x86.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduino/ArduinoCore-arc32/master/drivers/dpinst-x86.exe -------------------------------------------------------------------------------- /drivers/dpinst-amd64.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduino/ArduinoCore-arc32/master/drivers/dpinst-amd64.exe -------------------------------------------------------------------------------- /drivers/intc_libusb.cat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduino/ArduinoCore-arc32/master/drivers/intc_libusb.cat -------------------------------------------------------------------------------- /drivers/intc_libusb.inf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduino/ArduinoCore-arc32/master/drivers/intc_libusb.inf -------------------------------------------------------------------------------- /drivers/intc_serial.cat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduino/ArduinoCore-arc32/master/drivers/intc_serial.cat -------------------------------------------------------------------------------- /drivers/intc_composite.cat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduino/ArduinoCore-arc32/master/drivers/intc_composite.cat -------------------------------------------------------------------------------- /drivers/x86/WdfCoInstaller01009.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduino/ArduinoCore-arc32/master/drivers/x86/WdfCoInstaller01009.dll -------------------------------------------------------------------------------- /drivers/x86/winusbcoinstaller2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduino/ArduinoCore-arc32/master/drivers/x86/winusbcoinstaller2.dll -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | /system/libarc32_arduino101/libarc32drv_arduino101.a 3 | *.map 4 | *.elf 5 | *.swp 6 | *.bin 7 | .* 8 | cscope.* 9 | -------------------------------------------------------------------------------- /drivers/amd64/WdfCoInstaller01009.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduino/ArduinoCore-arc32/master/drivers/amd64/WdfCoInstaller01009.dll -------------------------------------------------------------------------------- /drivers/amd64/winusbcoinstaller2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduino/ArduinoCore-arc32/master/drivers/amd64/winusbcoinstaller2.dll -------------------------------------------------------------------------------- /variants/arduino_101/libarc32drv_arduino101.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arduino/ArduinoCore-arc32/master/variants/arduino_101/libarc32drv_arduino101.a -------------------------------------------------------------------------------- /libraries/CurieSerialFlash/CurieSerialFlash.h: -------------------------------------------------------------------------------- 1 | #if !defined (__arc__) 2 | #error These examples only work with onboard SPI flash on Arduino/Genuino 101 board 3 | #endif 4 | #include "SerialFlash.h" 5 | -------------------------------------------------------------------------------- /libraries/CurieTime/library.properties: -------------------------------------------------------------------------------- 1 | name=CurieTime 2 | version=1.0 3 | author=Intel 4 | maintainer=Intel 5 | sentence=Curie Time library. 6 | paragraph= 7 | category=Timing 8 | url= 9 | architectures=arc32 10 | -------------------------------------------------------------------------------- /programmers.txt: -------------------------------------------------------------------------------- 1 | arduino101fw.name=Arduino/Genuino 101 Firmware Updater 2 | arduino101fw.communication=USB 3 | arduino101fw.protocol= 4 | arduino101fw.program.protocol= 5 | arduino101fw.program.tool=arduino101load 6 | arduino101fw.program.extra_params= 7 | -------------------------------------------------------------------------------- /libraries/CurieTime/readme.txt: -------------------------------------------------------------------------------- 1 | Readme file for CurieTime Library 2 | 3 | The CurieTime library is provided to demonstrate the Arduino101 Time library. 4 | 5 | See the CurieTime example sketches provided with the Arduino101 Time library download for usage 6 | 7 | 8 | -------------------------------------------------------------------------------- /libraries/CurieTimerOne/library.properties: -------------------------------------------------------------------------------- 1 | name=CurieTimerOne 2 | version=1.0 3 | author=Intel 4 | maintainer=Intel 5 | sentence=Curie ARC subsystem Timer-1 utilities and software PWM 6 | paragraph= 7 | category=Timing 8 | url= 9 | architectures=arc32 10 | 11 | -------------------------------------------------------------------------------- /system/libarc32_arduino101/framework/src/services/ble/dtm_tcmd.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include "uart.h" 4 | #include "ipc_uart_ns16550.h" 5 | 6 | void on_nble_gap_dtm_init_rsp(void *user_data) 7 | { 8 | #ifdef CONFIG_UART_NS16550 9 | uart_ipc_disable(); 10 | #endif 11 | } 12 | 13 | -------------------------------------------------------------------------------- /post_install.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | set ARGS=/A /SE /SW /SA 3 | if "%PROCESSOR_ARCHITECTURE%" == "AMD64" ( 4 | drivers\dpinst-amd64.exe %ARGS% 5 | ) ELSE IF "%PROCESSOR_ARCHITEW6432%" == "AMD64" ( 6 | drivers\dpinst-amd64.exe %ARGS% 7 | ) ELSE ( 8 | drivers\dpinst-x86.exe %ARGS% 9 | ) 10 | exit /b 0 11 | -------------------------------------------------------------------------------- /libraries/CurieI2S/library.properties: -------------------------------------------------------------------------------- 1 | name=CurieI2S 2 | version=1.0 3 | author=Intel 4 | maintainer=Intel 5 | email=dino.tinitigan@intel.com 6 | sentence=Curie I2S Library for Arduino/Genuino 101 7 | paragraph= 8 | category=Communication 9 | url=http://makers.intel.com 10 | architectures=arc32 11 | core-dependencies=arduino (>=1.6.3) 12 | -------------------------------------------------------------------------------- /libraries/CuriePowerManagement/library.properties: -------------------------------------------------------------------------------- 1 | name=CuriePowerManagement 2 | version=1.0 3 | author=Intel 4 | maintainer=Intel 5 | sentence=Curie Power Management library for Curie based boards. 6 | paragraph=Allows to manage the power states of Curie based boards. 7 | category=Device Control 8 | url= 9 | architectures=arc32 10 | -------------------------------------------------------------------------------- /libraries/MemoryFree/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For MemoryFree 3 | ####################################### 4 | 5 | ####################################### 6 | # Methods and Functions (KEYWORD2) 7 | ####################################### 8 | 9 | freeStack KEYWORD2 10 | freeHeap KEYWORD2 11 | freeMemory KEYWORD2 12 | -------------------------------------------------------------------------------- /libraries/CuriePowerManagement/examples/TimedWakeup/TimedWakeup.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void setup() { 4 | pinMode(LED_BUILTIN, OUTPUT); 5 | } 6 | 7 | void loop() { 8 | for(int i = 0; i < 5; i++) 9 | { 10 | digitalWrite(LED_BUILTIN, HIGH); 11 | delay(100); 12 | digitalWrite(LED_BUILTIN, LOW); 13 | delay(100); 14 | } 15 | PM.sleep(1000); 16 | } -------------------------------------------------------------------------------- /libraries/MemoryFree/library.properties: -------------------------------------------------------------------------------- 1 | name=MemoryFree 2 | version=1.0 3 | author=Erik Nyquist 4 | maintainer=Erik Nyquist 5 | sentence=Determines the amount of available memory in the heap 6 | paragraph=Determines the amount of memory, in bytes, that is available for allocation using malloc() 7 | category=Uncategorized 8 | url= 9 | architectures=arc32 10 | 11 | -------------------------------------------------------------------------------- /libraries/Servo/library.properties: -------------------------------------------------------------------------------- 1 | name=Servo 2 | version=1.0 3 | author=Intel/Emutex 4 | maintainer=Intel/Emutex 5 | sentence=Servo Library for Curie Core. 6 | paragraph=This library can control a great number of servos.
It makes careful use of timers: the library can control 12 servos using only 1 timer. 7 | category=Device Control 8 | url=http://www.arduino.cc/en/Reference/Servo 9 | architectures=arc32 10 | -------------------------------------------------------------------------------- /libraries/CurieIMU/library.properties: -------------------------------------------------------------------------------- 1 | name=CurieIMU 2 | version=1.0 3 | author=Emutex 4 | maintainer=Emutex 5 | sentence=IMU Sensor Library for BMI160 on Curie Core boards. 6 | paragraph=Provides access to Accelerometer and Gyroscope data from the IMU, together with the full control of the features available like step count, tap, shock and freefall detection. 7 | category=Sensors 8 | url= 9 | architectures=arc32 10 | 11 | -------------------------------------------------------------------------------- /libraries/CurieBLE/library.properties: -------------------------------------------------------------------------------- 1 | name=CurieBLE 2 | version=2.0 3 | author=Lianggao 4 | maintainer=Lianggao 5 | sentence=Library to manage the Bluetooth Low Energy module with Curie Core boards. 6 | paragraph=Using this library, it is possible to use BLE features to communicate and interact with other devices like smartphones and tablets. This library enables multiple types of functionalities through a number of different classes. 7 | category=Communication 8 | url= 9 | architectures=arc32 10 | -------------------------------------------------------------------------------- /libraries/EEPROM/library.properties: -------------------------------------------------------------------------------- 1 | name=EEPROM 2 | version=2.0 3 | author=Arduino, Christopher Andrews, Intel 4 | maintainer=Arduino 5 | sentence=Enables reading and writing to the permanent board storage. 6 | paragraph=This library allows to read and write data in a memory type, the EEPROM, that keeps its content also when the board is powered off. The amount of EEPROM available depends on the microcontroller type. 7 | category=Data Storage 8 | url=http://www.arduino.cc/en/Reference/EEPROM 9 | architectures=arc32 10 | 11 | -------------------------------------------------------------------------------- /libraries/Wire/library.properties: -------------------------------------------------------------------------------- 1 | name=Wire 2 | version=1.0 3 | author=Intel 4 | maintainer=Intel 5 | email=dave@emutex.com 6 | sentence=This library allows you to communicate with I2C and Two Wire Interface devices. 7 | paragraph=This library is compatible with Curie Core. It allows the communication with I2C devices like temperature sensors, realtime clocks and many others using SDA (Data Line) and SCL (Clock Line). 8 | url=http://makers.intel.com 9 | architectures=arc32 10 | category=Communication 11 | core-dependencies=arduino (>=1.6.3) 12 | -------------------------------------------------------------------------------- /libraries/SPI/library.properties: -------------------------------------------------------------------------------- 1 | name=SPI 2 | version=1.0 3 | author=Intel/Emutex 4 | maintainer=Intel/Emutex 5 | sentence=Enables the communication with devices that use the Serial Peripheral Interface (SPI) Bus. For Curie Core boards. 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://www.arduino.cc/en/Reference/SPI 9 | architectures=arc32 10 | -------------------------------------------------------------------------------- /libraries/EEPROM/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For EEPROM 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | EEPROM KEYWORD1 10 | EERef KEYWORD1 11 | EEPtr KEYWORD2 12 | 13 | ####################################### 14 | # Methods and Functions (KEYWORD2) 15 | ####################################### 16 | 17 | update KEYWORD2 18 | 19 | ####################################### 20 | # Constants (LITERAL1) 21 | ####################################### 22 | 23 | -------------------------------------------------------------------------------- /libraries/CurieSoftwareSerial/library.properties: -------------------------------------------------------------------------------- 1 | name=CurieSoftwareSerial 2 | version=0.1 3 | author=Intel 4 | maintainer=Intel 5 | sentence=Enables serial communication on any digital pin, port for Curie Core. 6 | paragraph=The CurieSoftwareSerial 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://www.arduino.cc/en/Reference/SoftwareSerial 9 | architectures=arc32 10 | 11 | -------------------------------------------------------------------------------- /cores/arduino/mailbox.h: -------------------------------------------------------------------------------- 1 | #ifndef _MAILBOX_H_ 2 | #define _MAILBOX_H_ 3 | 4 | #define NUM_MAILBOX_CHANNELS 8 5 | #define CHANNEL_DATA_WORDS 4 6 | #define MBOX_BYTES 16 7 | 8 | class CurieMailboxMsg { 9 | public: 10 | uint32_t data[CHANNEL_DATA_WORDS]; 11 | uint32_t id; 12 | int channel = 0; 13 | }; 14 | 15 | void mailbox_init (bool master); 16 | void mailbox_register (int channel, void(*callback)(CurieMailboxMsg)); 17 | void mailbox_unregister (int channel); 18 | void mailbox_enable_receive (int channel); 19 | void mailbox_disable_receive (int channel); 20 | void mailbox_write(CurieMailboxMsg& msg); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /libraries/CurieTimerOne/examples/CurieTimer1PWM/CurieTimer1PWM.ino: -------------------------------------------------------------------------------- 1 | #include "CurieTimerOne.h" 2 | 3 | void setup() { 4 | // Setup a PWM signal on pin 13, onboard LED, with a 25% duty cycle 5 | // of a 1 second period (1000000 usec), as follow (please note the 6 | // decimal point to indicate double): 7 | 8 | CurieTimerOne.pwmStart(13, 25.0, 1000000); 9 | 10 | // Or, use discrete number range, 0-1023, to define the duty period, 11 | // 255 is 24.9%, as follow: 12 | 13 | // CurieTimerOne.pwmStart(13, 255, 1000000); 14 | } 15 | 16 | void loop() { 17 | // put your main code here, to run repeatedly: 18 | 19 | delay( 10000 ); 20 | } 21 | -------------------------------------------------------------------------------- /scripts/create_dfu_udev_rule: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | 4 | if [ "$(id -u)" != "0" ]; then 5 | echo "This script must be run as root" 6 | exit 7 | fi 8 | 9 | NAME=99-arduino-101.rules 10 | 11 | echo >/etc/udev/rules.d/$NAME 12 | echo \# Arduino 101 in DFU Mode >>/etc/udev/rules.d/$NAME 13 | echo SUBSYSTEM==\"tty\", ENV{ID_REVISION}==\"8087\", ENV{ID_MODEL_ID}==\"0ab6\", MODE=\"0666\", ENV{ID_MM_DEVICE_IGNORE}=\"1\", ENV{ID_MM_CANDIDATE}=\"0\" >>/etc/udev/rules.d/$NAME 14 | echo SUBSYSTEM==\"usb\", ATTR{idVendor}==\"8087\", ATTR{idProduct}==\"0aba\", MODE=\"0666\", ENV{ID_MM_DEVICE_IGNORE}=\"1\" >>/etc/udev/rules.d/$NAME 15 | 16 | udevadm control --reload-rules 17 | udevadm trigger 18 | -------------------------------------------------------------------------------- /libraries/Servo/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map Servo 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | Servo KEYWORD1 Servo 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | attach KEYWORD2 15 | detach KEYWORD2 16 | write KEYWORD2 17 | read KEYWORD2 18 | attached KEYWORD2 19 | writeMicroseconds KEYWORD2 20 | readMicroseconds KEYWORD2 21 | 22 | ####################################### 23 | # Constants (LITERAL1) 24 | ####################################### 25 | -------------------------------------------------------------------------------- /libraries/CuriePowerManagement/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For Curie Power Library 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | ####################################### 10 | # Methods and Functions (KEYWORD2) 11 | ####################################### 12 | sleep KEYWORD2 13 | deepSleep KEYWORD2 14 | idle KEYWORD2 15 | doze KEYWORD2 16 | wakeFromDoze KEYWORD2 17 | 18 | ####################################### 19 | # Instances (KEYWORD2) 20 | ####################################### 21 | 22 | ####################################### 23 | # Constants (LITERAL1) 24 | ####################################### 25 | -------------------------------------------------------------------------------- /system/libarc32_arduino101/framework/src/os/panic.c: -------------------------------------------------------------------------------- 1 | 2 | #include "os/os.h" 3 | 4 | #include "infra/log.h" 5 | #include "aux_regs.h" 6 | 7 | extern void _do_fault(); 8 | void panic(int x) 9 | { 10 | _do_fault(); 11 | } 12 | 13 | 14 | void __assert_fail() 15 | { 16 | panic(-10); 17 | } 18 | 19 | 20 | void __attribute__((weak)) _Fault(void) 21 | { 22 | uint32_t exc_addr = aux_reg_read(ARC_V2_EFA); 23 | uint32_t ecr = aux_reg_read(ARC_V2_ECR); 24 | 25 | pr_error(0, "Exception vector: 0x%x, cause code: 0x%x, parameter 0x%x\n", 26 | ARC_V2_ECR_VECTOR(ecr), 27 | ARC_V2_ECR_CODE(ecr), 28 | ARC_V2_ECR_PARAMETER(ecr)); 29 | pr_error(0, "Address 0x%x\n", exc_addr); 30 | while (1); // Sid. Acknowledge KW warning. 31 | } 32 | 33 | -------------------------------------------------------------------------------- /libraries/CurieBLE/README.md: -------------------------------------------------------------------------------- 1 | # Enable debug interface on Serail1 2 | 3 | * Default disable the debug interface. 4 | 5 | If you want to enable debug trace on Serial1 to debug corelib, follow these instructions. 6 | 7 | 1. Shut down the IDE 8 | 2. Go to Arduino15 directory 9 | * Windows: `C:\Users\\AppData\Roaming\Arduino15` 10 | * OS X: `~/Library/Arduino15` 11 | * Linux: `~/.arduino15` 12 | 3. Modify the platform.txt 13 | * Find `compiler.c.flags` and add `-DCONFIGURE_DEBUG_CORELIB_ENABLED` at the end of this line 14 | * Find `compiler.cpp.flags` and add `-DCONFIGURE_DEBUG_CORELIB_ENABLED` at the end of this line 15 | 4. Initial Serial1 in your sketch 16 | * Add `Serial1.begin(115200);` in your `setup()` 17 | 5. Adjust the output level at log_init function in log.c 18 | 19 | -------------------------------------------------------------------------------- /libraries/CurieTime/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For CurieTime 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | ####################################### 10 | # Methods and Functions (KEYWORD2) 11 | ####################################### 12 | now KEYWORD2 13 | second KEYWORD2 14 | minute KEYWORD2 15 | hour KEYWORD2 16 | day KEYWORD2 17 | month KEYWORD2 18 | year KEYWORD2 19 | setTime KEYWORD2 20 | 21 | ####################################### 22 | # Instances (KEYWORD2) 23 | ####################################### 24 | 25 | ####################################### 26 | # Constants (LITERAL1) 27 | ####################################### 28 | -------------------------------------------------------------------------------- /system/libarc32_arduino101/framework/src/os/memory_pool_list.def: -------------------------------------------------------------------------------- 1 | /* 2 | * Definition of the memory pools used by balloc/bfree: 3 | * DECLARE_MEMORY_POOL( , , , ) 4 | * : must start at 0 and be of consecutive values * 5 | * : size in bytes of each block from the pool 6 | * : number of blocks in the pool 7 | * 8 | * * Pool definitions must be sorted according the block size 9 | * value: pool with 0 must have the smallest . 10 | */ 11 | 12 | DECLARE_MEMORY_POOL(0,8,32) 13 | DECLARE_MEMORY_POOL(1,16,32) 14 | DECLARE_MEMORY_POOL(2,32,32) 15 | DECLARE_MEMORY_POOL(3,64,8) 16 | DECLARE_MEMORY_POOL(4,128,4) 17 | DECLARE_MEMORY_POOL(5,256,2) 18 | DECLARE_MEMORY_POOL(6,512,2) 19 | DECLARE_MEMORY_POOL(7,2096,1) 20 | 21 | #undef DECLARE_MEMORY_POOL 22 | -------------------------------------------------------------------------------- /libraries/CurieSoftwareSerial/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map for SoftwareSerial 3 | # (formerly NewSoftSerial) 4 | ####################################### 5 | 6 | ####################################### 7 | # Datatypes (KEYWORD1) 8 | ####################################### 9 | 10 | SoftwareSerial KEYWORD1 11 | 12 | ####################################### 13 | # Methods and Functions (KEYWORD2) 14 | ####################################### 15 | 16 | begin KEYWORD2 17 | end KEYWORD2 18 | read KEYWORD2 19 | write KEYWORD2 20 | available KEYWORD2 21 | isListening KEYWORD2 22 | overflow KEYWORD2 23 | flush KEYWORD2 24 | listen KEYWORD2 25 | peek KEYWORD2 26 | 27 | ####################################### 28 | # Constants (LITERAL1) 29 | ####################################### 30 | 31 | -------------------------------------------------------------------------------- /libraries/CurieTimerOne/examples/CurieTimer1BlinkSpeed/CurieTimer1BlinkSpeed.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | const int blinkPin = 13; 4 | 5 | void setup(void) 6 | { 7 | CurieTimerOne.initialize(50000); 8 | Serial.begin(9600); // initialize Serial communication 9 | while(!Serial) ; // wait for serial port to connect. 10 | } 11 | 12 | void loop(void) 13 | { 14 | unsigned int range; 15 | 16 | Serial.println("PWM blink: low -> high duty cycle"); 17 | 18 | for (float dutyCycle = 5.0; dutyCycle <= 100.0; dutyCycle++) { 19 | range = (dutyCycle / 100) * 1023; 20 | CurieTimerOne.pwm(blinkPin, range); 21 | delay(50); 22 | } 23 | 24 | Serial.println("PWM blink: high -> low duty cycle"); 25 | 26 | for (float dutyCycle = 100.0; dutyCycle > 5.0; dutyCycle--) { 27 | range = (dutyCycle / 100) * 1023; 28 | CurieTimerOne.setPwmDuty(blinkPin, range); 29 | delay(50); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /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 | Serial.begin(9600); // start serial for output 18 | while(!Serial); 19 | Wire.begin(); // join i2c bus (address optional for master) 20 | } 21 | 22 | void loop() 23 | { 24 | Wire.requestFrom(8, 6, true); // request 6 bytes from slave device #8 25 | 26 | while (Wire.available()) // slave may send less than requested 27 | { 28 | char c = Wire.read(); // receive a byte as character 29 | Serial.print(c, HEX); // print the character 30 | Serial.println(); 31 | } 32 | 33 | delay(500); 34 | } 35 | -------------------------------------------------------------------------------- /libraries/CuriePowerManagement/examples/WakeFromIMU/WakeFromIMU.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include "CurieIMU.h" 3 | 4 | 5 | void setup() { 6 | pinMode(LED_BUILTIN, OUTPUT); 7 | CurieIMU.begin(); 8 | CurieIMU.attachInterrupt(wakeup); 9 | CurieIMU.setDetectionThreshold(CURIE_IMU_MOTION, 20); // 100mg 10 | CurieIMU.setDetectionDuration(CURIE_IMU_MOTION, 10); // trigger times of consecutive slope data points 11 | CurieIMU.interrupts(CURIE_IMU_MOTION); 12 | 13 | } 14 | 15 | void loop() { 16 | PM.sleep(); 17 | digitalWrite(LED_BUILTIN, HIGH); 18 | delay(3000); 19 | digitalWrite(LED_BUILTIN, LOW); 20 | } 21 | 22 | void wakeup() 23 | { 24 | PM.wakeFromDoze(); 25 | // This function will be called once on device wakeup 26 | // You can do some little operations here (like changing variables which will be used in the loop) 27 | // Remember to avoid calling delay() and long running functions since this functions executes in interrupt context 28 | } 29 | -------------------------------------------------------------------------------- /libraries/CurieTimerOne/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For CurieTimerOne 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | CurieTimer KEYWORD1 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | initialize KEYWORD2 15 | setPeriod KEYWORD2 16 | start KEYWORD2 17 | stop KEYWORD2 18 | restart KEYWORD2 19 | resume KEYWORD2 20 | setPwmDuty KEYWORD2 21 | pwm KEYWORD2 22 | disablePwm KEYWORD2 23 | attachInterrupt KEYWORD2 24 | detachInterrupt KEYWORD2 25 | kill KEYWORD2 26 | readTickCount KEYWORD2 27 | rdRstTickCount KEYWORD2 28 | pause KEYWORD2 29 | pwmStart KEYWORD2 30 | pwmStop KEYWORD2 31 | ####################################### 32 | # Instances (KEYWORD2) 33 | ####################################### 34 | CurieTimerOne KEYWORD2 35 | -------------------------------------------------------------------------------- /libraries/SPI/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map SPI 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | SPI KEYWORD1 10 | SPI1 KEYWORD1 11 | 12 | ####################################### 13 | # Methods and Functions (KEYWORD2) 14 | ####################################### 15 | begin KEYWORD2 16 | end KEYWORD2 17 | transfer KEYWORD2 18 | setBitOrder KEYWORD2 19 | setDataMode KEYWORD2 20 | setClockDivider KEYWORD2 21 | 22 | 23 | ####################################### 24 | # Constants (LITERAL1) 25 | ####################################### 26 | SPI_CLOCK_DIV4 LITERAL1 27 | SPI_CLOCK_DIV16 LITERAL1 28 | SPI_CLOCK_DIV64 LITERAL1 29 | SPI_CLOCK_DIV128 LITERAL1 30 | SPI_CLOCK_DIV2 LITERAL1 31 | SPI_CLOCK_DIV8 LITERAL1 32 | SPI_CLOCK_DIV32 LITERAL1 33 | SPI_CLOCK_DIV64 LITERAL1 34 | SPI_MODE0 LITERAL1 35 | SPI_MODE1 LITERAL1 36 | SPI_MODE2 LITERAL1 37 | SPI_MODE3 LITERAL1 -------------------------------------------------------------------------------- /libraries/Wire/examples/master_writer/master_writer.ino: -------------------------------------------------------------------------------- 1 | // Wire Master Writer 2 | // by Nicholas Zambetti 3 | 4 | // Demonstrates use of the Wire library 5 | // Writes data to an I2C/TWI slave device 6 | // Refer to the "Wire Slave Receiver" example for use with this 7 | 8 | // Created 29 March 2006 9 | 10 | // This example code is in the public domain. 11 | 12 | 13 | #include 14 | 15 | void setup() 16 | { 17 | Wire.begin(); // join i2c bus (address optional for master) 18 | Serial.begin(9600); 19 | while(!Serial); 20 | } 21 | 22 | byte x = 1; 23 | byte rdata; 24 | void loop() 25 | { 26 | Wire.beginTransmission(8); // transmit to device #8 27 | //Wire.write("x is "); // sends five bytes 28 | Wire.write(x); // sends one byte 29 | int result = Wire.endTransmission(); // stop transmitting 30 | if (result == 0) 31 | { 32 | Serial.println(); 33 | Serial.print("x = "); 34 | Serial.print(x); 35 | } 36 | x++; 37 | delay(500); 38 | } 39 | -------------------------------------------------------------------------------- /system/libarc32_arduino101/framework/src/services/ble/l2cap_internal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Intel Corporation 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef L2CAP_INTERNAL_H_ 18 | #define L2CAP_INTERNAL_H_ 19 | 20 | /* Notify L2CAP channels of a new connection */ 21 | void bt_l2cap_connected(struct bt_conn *conn); 22 | 23 | /* Notify L2CAP channels of a disconnect event */ 24 | void bt_l2cap_disconnected(struct bt_conn *conn); 25 | 26 | 27 | #endif /* L2CAP_INTERNAL_H_ */ 28 | -------------------------------------------------------------------------------- /libraries/Servo/examples/Knob/Knob.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Controlling a servo position using a potentiometer (variable resistor) 3 | by Michal Rinott 4 | 5 | modified on 8 Nov 2013 6 | by Scott Fitzgerald 7 | http://www.arduino.cc/en/Tutorial/Knob 8 | */ 9 | 10 | #include 11 | 12 | Servo myservo; // create servo object to control a servo 13 | 14 | int potpin = 0; // analog pin used to connect the potentiometer 15 | int val; // variable to read the value from the analog pin 16 | 17 | void setup() 18 | { 19 | myservo.attach(9); // attaches the servo on pin 9 to the servo object 20 | } 21 | 22 | void loop() 23 | { 24 | val = analogRead(potpin); // reads the value of the potentiometer (value between 0 and 1023) 25 | val = map(val, 0, 1023, 0, 180); // scale it to use it with the servo (value between 0 and 180) 26 | myservo.write(val); // sets the servo position according to the scaled value$ 27 | delay(15); // waits for the servo to get there 28 | } 29 | 30 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /libraries/EEPROM/examples/eeprom_clear/eeprom_clear.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * EEPROM Clear 3 | * 4 | * Sets all of the bytes of the EEPROM to 0. 5 | * Please see eeprom_iteration for a more in depth 6 | * look at how to traverse the EEPROM. 7 | * 8 | * This example code is in the public domain. 9 | */ 10 | 11 | #include 12 | 13 | void setup() { 14 | // initialize the LED pin as an output. 15 | pinMode(13, OUTPUT); 16 | 17 | /*** 18 | Iterate through each byte of the EEPROM storage. 19 | 20 | Larger AVR processors have larger EEPROM sizes, E.g: 21 | - Arduno Duemilanove: 512b EEPROM storage. 22 | - Arduino Uno: 1kb EEPROM storage. 23 | - Arduino Mega: 4kb EEPROM storage. 24 | 25 | Rather than hard-coding the length, you should use the pre-provided length function. 26 | This will make your code portable to all AVR processors. 27 | ***/ 28 | 29 | for (int i = 0 ; i < EEPROM.length() ; i++) { 30 | EEPROM.write(i, 0); 31 | } 32 | 33 | // turn the LED on when we're done 34 | digitalWrite(13, HIGH); 35 | } 36 | 37 | void loop() { 38 | /** Empty loop. **/ 39 | } 40 | -------------------------------------------------------------------------------- /libraries/Servo/README.adoc: -------------------------------------------------------------------------------- 1 | = Servo Library for Arduino = 2 | 3 | This library allows an Arduino 101 board to control RC (hobby) servo motors. 4 | 5 | For more information about this library please visit us at 6 | http://www.arduino.cc/en/Reference/Servo 7 | 8 | == License == 9 | 10 | Copyright (c) 2013 Arduino LLC. All right reserved. 11 | Copyright (c) 2009 Michael Margolis. All right reserved. 12 | 13 | This library is free software; you can redistribute it and/or 14 | modify it under the terms of the GNU Lesser General Public 15 | License as published by the Free Software Foundation; either 16 | version 2.1 of the License, or (at your option) any later version. 17 | 18 | This library is distributed in the hope that it will be useful, 19 | but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21 | Lesser General Public License for more details. 22 | 23 | You should have received a copy of the GNU Lesser General Public 24 | License along with this library; if not, write to the Free Software 25 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 26 | -------------------------------------------------------------------------------- /cores/arduino/new.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014 Arduino. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef NEW_H 20 | #define NEW_H 21 | 22 | #ifdef __cplusplus 23 | 24 | #include 25 | 26 | void * operator new(size_t size); 27 | void * operator new[](size_t size); 28 | void operator delete(void * ptr); 29 | void operator delete[](void * ptr); 30 | 31 | #endif 32 | #endif 33 | 34 | -------------------------------------------------------------------------------- /libraries/Wire/examples/digital_potentiometer/digital_potentiometer.ino: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /boards.txt: -------------------------------------------------------------------------------- 1 | # See: http://code.google.com/p/arduino/wiki/Platforms 2 | 3 | ############################################################## 4 | 5 | arduino_101.name=Arduino/Genuino 101 6 | 7 | arduino_101.vid.0=0x8087 8 | arduino_101.pid.0=0x0AB6 9 | arduino_101.vid.0x2A03.warning=Uncertified 10 | 11 | arduino_101.upload.tool=arduino101load 12 | arduino_101.upload.protocol=script 13 | arduino_101.upload.maximum_size=155648 14 | arduino_101.upload.use_1200bps_touch=true 15 | arduino_101.upload.wait_for_upload_port=false 16 | arduino_101.upload.native_usb=false 17 | arduino_101.upload.params.quiet=-q 18 | arduino_101.upload.params.verbose=-q 19 | 20 | arduino_101.build.usb_product="Arduino 101" 21 | arduino_101.build.mcu=ARCv2EM 22 | arduino_101.build.f_cpu=32000000L 23 | arduino_101.build.board=ARC32_TOOLS 24 | arduino_101.build.core=arduino 25 | arduino_101.build.ldscript=linker_scripts/flash.ld 26 | arduino_101.build.variant=arduino_101 27 | arduino_101.build.variant_system_lib=arc32drv_arduino101 28 | arduino_101.build.vid=0x8087 29 | arduino_101.build.pid=0x0AB6 30 | 31 | arduino_101.bootloader.tool=arduino101load 32 | 33 | ############################################################## 34 | 35 | 36 | -------------------------------------------------------------------------------- /cores/arduino/dccm/dccm_alloc.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Intel Corporation. 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. See the GNU 12 | Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | 18 | */ 19 | 20 | #include 21 | 22 | #define DCCM_START 0x80000000 23 | #define DCCM_SIZE 8192 24 | 25 | #ifndef _DCCM_ALLOC_ 26 | #define _DCCM_ALLOC_ 27 | 28 | #ifdef __cplusplus 29 | extern "C" { 30 | #endif 31 | 32 | void* dccm_malloc(uint16_t size); 33 | 34 | void *dccm_memalign(uint16_t size); 35 | 36 | #ifdef __cplusplus 37 | } 38 | #endif 39 | 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /cores/arduino/error.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 Intel Corporation. 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. See the GNU 12 | Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | 18 | */ 19 | 20 | #ifndef _Error_h 21 | #define _Error_h 22 | 23 | #include 24 | #include "os/os.h" 25 | #include "infra/log.h" 26 | #include "aux_regs.h" 27 | #include "platform.h" 28 | 29 | extern void error_halt(); 30 | 31 | extern void error_halt(uint8_t error_code); 32 | 33 | extern void error_continue(); 34 | 35 | extern void error_continue(uint8_t error_code); 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /libraries/Servo/examples/Sweep/Sweep.ino: -------------------------------------------------------------------------------- 1 | 2 | 3 | /* 4 | Sweep 5 | by BARRAGAN 6 | This example code is in the public domain. 7 | 8 | modified 8 Nov 2013 9 | by Scott Fitzgerald 10 | http://www.arduino.cc/en/Tutorial/Sweep 11 | */ 12 | 13 | #include 14 | 15 | Servo myservo; // create servo object to control a servo 16 | // twelve servo objects can be created on most boards 17 | 18 | int pos = 0; // variable to store the servo position 19 | 20 | void setup() 21 | { 22 | myservo.attach(9); // attaches the servo on pin 9 to the servo object 23 | } 24 | 25 | void loop() 26 | { 27 | for(pos = 0; pos <= 180; pos += 1) // goes from 0 degrees to 180 degrees 28 | { // in steps of 1 degree 29 | myservo.write(pos); // tell servo to go to position in variable 'pos' 30 | delay(15); // waits 15ms for the servo to reach the position 31 | } 32 | for(pos = 180; pos>=0; pos-=1) // goes from 180 degrees to 0 degrees 33 | { 34 | myservo.write(pos); // tell servo to go to position in variable 'pos' 35 | delay(15); // waits 15ms for the servo to reach the position 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /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/WInterrupts.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011-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 | #ifndef _WIRING_INTERRUPTS_ 20 | #define _WIRING_INTERRUPTS_ 21 | 22 | #include "Arduino.h" 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | void attachInterrupt(uint32_t pin, void (*callback)(void), uint32_t mode); 29 | 30 | void detachInterrupt(uint32_t pin); 31 | 32 | void interrupts(void); 33 | 34 | void noInterrupts(void); 35 | 36 | #ifdef __cplusplus 37 | } 38 | #endif 39 | 40 | #endif /* _WIRING_INTERRUPTS_ */ 41 | -------------------------------------------------------------------------------- /libraries/EEPROM/examples/eeprom_iteration/eeprom_iteration.ino: -------------------------------------------------------------------------------- 1 | /*** 2 | eeprom_iteration example. 3 | 4 | A set of example snippets highlighting the 5 | simplest methods for traversing the EEPROM. 6 | 7 | Running this sketch is not necessary, this is 8 | simply highlighting certain programming methods. 9 | 10 | Written by Christopher Andrews 2015 11 | Released under MIT licence. 12 | ***/ 13 | 14 | #include 15 | 16 | void setup() { 17 | 18 | /*** 19 | Iterate the EEPROM using a for loop. 20 | ***/ 21 | 22 | for (int index = 0 ; index < EEPROM.length() ; index++) { 23 | 24 | //Add one to each cell in the EEPROM 25 | EEPROM[ index ] += 1; 26 | } 27 | 28 | /*** 29 | Iterate the EEPROM using a while loop. 30 | ***/ 31 | 32 | int index = 0; 33 | 34 | while (index < EEPROM.length()) { 35 | 36 | //Add one to each cell in the EEPROM 37 | EEPROM[ index ] += 1; 38 | index++; 39 | } 40 | 41 | /*** 42 | Iterate the EEPROM using a do-while loop. 43 | ***/ 44 | 45 | int idx = 0; //Used 'idx' to avoid name conflict with 'index' above. 46 | 47 | do { 48 | 49 | //Add one to each cell in the EEPROM 50 | EEPROM[ idx ] += 1; 51 | idx++; 52 | } while (idx < EEPROM.length()); 53 | 54 | 55 | } //End of setup function. 56 | 57 | void loop() {} -------------------------------------------------------------------------------- /cores/arduino/wiring_shift.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011 Arduino. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef _WIRING_SHIFT_ 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 | -------------------------------------------------------------------------------- /cores/arduino/new.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014 Arduino. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #include 20 | #include "new.h" 21 | 22 | void *operator new(size_t size) { 23 | return malloc(size); 24 | } 25 | 26 | void *operator new[](size_t size) { 27 | return malloc(size); 28 | } 29 | 30 | void operator delete(void * ptr) { 31 | free(ptr); 32 | } 33 | 34 | void operator delete[](void * ptr) { 35 | free(ptr); 36 | } 37 | 38 | extern "C" { 39 | __extension__ typedef int __guard __attribute__((mode (__DI__))); 40 | 41 | int __cxa_guard_acquire(__guard g) {return !(char )(g);}; 42 | void __cxa_guard_release (__guard *g) {*(char *)g = 1;}; 43 | }; 44 | -------------------------------------------------------------------------------- /cores/arduino/itoa.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011 Arduino. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef _ITOA_ 20 | #define _ITOA_ 21 | 22 | #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/abi.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014 Arduino. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #include 20 | 21 | extern "C" void __cxa_pure_virtual(void) __attribute__ ((__noreturn__)); 22 | extern "C" void __cxa_deleted_virtual(void) __attribute__ ((__noreturn__)); 23 | 24 | 25 | void __cxa_pure_virtual(void) { 26 | // We might want to write some diagnostics to uart in this case 27 | //std::terminate(); 28 | while (1) 29 | ; 30 | } 31 | 32 | void __cxa_deleted_virtual(void) { 33 | // We might want to write some diagnostics to uart in this case 34 | //std::terminate(); 35 | while (1) 36 | ; 37 | } 38 | 39 | extern "C" 40 | { 41 | void *__dso_handle = NULL; 42 | } 43 | -------------------------------------------------------------------------------- /cores/arduino/Tone.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011 Arduino. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef _Tone_h 20 | #define _Tone_h 21 | 22 | #include 23 | 24 | /* 25 | * \brief Generates a square wave of the specified frequency (and 50% duty cycle) on a pin. 26 | * A duration can be specified, otherwise the wave continues until a call to noTone() 27 | * \param pin 28 | * \param val 29 | */ 30 | extern void tone( uint32_t _pin, unsigned int frequency, unsigned long duration = 0); 31 | /* 32 | * \brief Stops the generation of a square wave triggered by tone(). Has no effect if no tone is being generated. 33 | * 34 | * \param pin 35 | */ 36 | 37 | extern void noTone( uint32_t _pin ) ; 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /libraries/CurieSerialFlash/examples/FileWrite/FileWrite.ino: -------------------------------------------------------------------------------- 1 | // This example depends on Paul Stoffregen's SerialFlash library 2 | // Download at https://github.com/PaulStoffregen/SerialFlash 3 | 4 | #include 5 | #include 6 | 7 | #define FSIZE 256 8 | 9 | const char *filename = "myfile.txt"; 10 | const char *contents = "0123456789ABCDEF"; 11 | 12 | void setup() { 13 | Serial.begin(9600); 14 | 15 | // wait for Arduino Serial Monitor 16 | while (!Serial) ; 17 | delay(100); 18 | 19 | // Init. SPI Flash chip 20 | if (!SerialFlash.begin(ONBOARD_FLASH_SPI_PORT, ONBOARD_FLASH_CS_PIN)) { 21 | Serial.println("Unable to access SPI Flash chip"); 22 | } 23 | 24 | SerialFlashFile file; 25 | 26 | // Create the file if it doesn't exist 27 | if (!create_if_not_exists(filename)) { 28 | Serial.println("Not enough space to create file " + String(filename)); 29 | return; 30 | } 31 | 32 | // Open the file and write test data 33 | file = SerialFlash.open(filename); 34 | file.write(contents, strlen(contents) + 1); 35 | Serial.println("String \"" + String(contents) + "\" written to file " + String(filename)); 36 | } 37 | 38 | bool create_if_not_exists (const char *filename) { 39 | if (!SerialFlash.exists(filename)) { 40 | Serial.println("Creating file " + String(filename)); 41 | return SerialFlash.create(filename, FSIZE); 42 | } 43 | 44 | Serial.println("File " + String(filename) + " already exists"); 45 | return true; 46 | } 47 | 48 | void loop() { 49 | } 50 | -------------------------------------------------------------------------------- /system/libarc32_arduino101/framework/include/log_modules: -------------------------------------------------------------------------------- 1 | /* DEFINE_LOGGER_MODULE(, , ) */ 2 | 3 | DEFINE_LOGGER_MODULE(LOG_MODULE_MAIN, "MAIN", 0) 4 | DEFINE_LOGGER_MODULE(LOG_MODULE_LOG, "LOG", 0) 5 | DEFINE_LOGGER_MODULE(LOG_MODULE_OS, "OS", 0) 6 | DEFINE_LOGGER_MODULE(LOG_MODULE_FG, "FG_S", 0) 7 | DEFINE_LOGGER_MODULE(LOG_MODULE_BS, "BATT_S", 0) 8 | DEFINE_LOGGER_MODULE(LOG_MODULE_UTIL, "UTIL", 0) 9 | DEFINE_LOGGER_MODULE(LOG_MODULE_USB, "USB", 0) 10 | DEFINE_LOGGER_MODULE(LOG_MODULE_UI_SVC, "UI_SVC", 0) 11 | DEFINE_LOGGER_MODULE(LOG_MODULE_LED, "LED", 0) 12 | DEFINE_LOGGER_MODULE(LOG_MODULE_VIBR, "DRV2605", 0) 13 | DEFINE_LOGGER_MODULE(LOG_MODULE_IPC, "IPC_UA", 0) 14 | DEFINE_LOGGER_MODULE(LOG_MODULE_PHY_SS, "PHY_SS", 0) 15 | DEFINE_LOGGER_MODULE(LOG_MODULE_BMI160, "BMI160", 0) 16 | DEFINE_LOGGER_MODULE(LOG_MODULE_PSH_CORE, "PSH_CORE", 0) 17 | DEFINE_LOGGER_MODULE(LOG_MODULE_OPEN_CORE, "OPEN_CORE", 0) 18 | DEFINE_LOGGER_MODULE(LOG_MODULE_SS_SVC, "SS_SVC", 0) 19 | DEFINE_LOGGER_MODULE(LOG_MODULE_SC_IPC, "SC_IPC", 0) 20 | DEFINE_LOGGER_MODULE(LOG_MODULE_BP, "BAT_P", 0) 21 | DEFINE_LOGGER_MODULE(LOG_MODULE_PS, "PWR_SUP", 0) 22 | DEFINE_LOGGER_MODULE(LOG_MODULE_CH, "CHGR", 0) 23 | DEFINE_LOGGER_MODULE(LOG_MODULE_BLE, "BLE", 0) 24 | DEFINE_LOGGER_MODULE(LOG_MODULE_DRV, "DRV", 0) 25 | DEFINE_LOGGER_MODULE(LOG_MODULE_CUNIT, "CUNIT", 0) 26 | DEFINE_LOGGER_MODULE(LOG_MODULE_CFW, "CFW", 0) 27 | DEFINE_LOGGER_MODULE(LOG_MODULE_GPIO_SVC, "GPIO_SVC", 0) 28 | DEFINE_LOGGER_MODULE(LOG_MODULE_APP, "APP", 0) 29 | -------------------------------------------------------------------------------- /cores/arduino/dccm/dccm_alloc.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Intel Corporation. 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. See the GNU 12 | Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | 18 | */ 19 | 20 | #include "dccm_alloc.h" 21 | 22 | uint16_t dccm_index = 0; 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | void* dccm_malloc(uint16_t size) 29 | { 30 | if((size + dccm_index) > DCCM_SIZE) 31 | { 32 | return 0; 33 | } 34 | 35 | void* addr = (void*)(DCCM_START + dccm_index); 36 | dccm_index += size; 37 | return addr; 38 | } 39 | 40 | void *dccm_memalign(uint16_t size) 41 | { 42 | if ((dccm_index +3) > DCCM_SIZE) 43 | return 0; 44 | 45 | dccm_index = (dccm_index + 3) & ~((uint16_t)0x3); /* 4 byte addr alignment */ 46 | return dccm_malloc(size); 47 | } 48 | 49 | #ifdef __cplusplus 50 | } 51 | #endif 52 | -------------------------------------------------------------------------------- /drivers/intc_composite.inf: -------------------------------------------------------------------------------- 1 | ;********************************************************************************************* 2 | ; Windows USB Composite Setup File for Arduino 101 3 | ; 4 | ; Copyright (c) 2015 Intel Corporation 5 | ; 6 | ; For use only on Windows operating systems. 7 | ;********************************************************************************************* 8 | [Version] 9 | Signature = "$WINDOWS NT$" 10 | Class = USB 11 | ClassGUID = {4D36E978-E325-11CE-BFC1-08002BE10318} 12 | Provider = %ProviderName% 13 | DriverVer = 10/13/2015,1.1.0.0 14 | CatalogFile = intc_composite.cat 15 | 16 | [Manufacturer] 17 | %ProviderName% = Generic,NTx86,NTamd64 18 | 19 | [Generic.NTx86] 20 | ; Arduino 101 21 | %USBCompositeDevice% = Composite.Device,USB\VID_8087&PID_0AB6 ; ACM+ACM 22 | 23 | [Generic.NTamd64] 24 | ; Arduino 101 25 | %USBCompositeDevice% = Composite.Device,USB\VID_8087&PID_0AB6 ; ACM+ACM 26 | 27 | [ControlFlags] 28 | ExcludeFromSelect=* 29 | 30 | ; Common Class Generic Parent for root ID 31 | [Composite.Device] 32 | Include=usb.inf 33 | Needs=Composite.Dev.NT 34 | 35 | [Composite.Device.Services] 36 | Include=usb.inf 37 | Needs=Composite.Dev.NT.Services 38 | 39 | [SourceDisksNames] 40 | 1=%SourceDisk%,,1 41 | 42 | [Strings] 43 | ProviderName = "Intel Corporation" 44 | ServiceDisplayName = "Arduino 101 USB Composite Device Driver" 45 | USBCompositeDevice = "Arduino 101 USB Composite Device" 46 | SourceDisk = "Arduino 101 USB Composite Device Install Disk" 47 | -------------------------------------------------------------------------------- /cores/arduino/HardwareSerial.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011 Arduino. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef HardwareSerial_h 20 | #define HardwareSerial_h 21 | 22 | #include 23 | 24 | #include "Stream.h" 25 | 26 | class HardwareSerial : public Stream 27 | { 28 | public: 29 | virtual void begin(unsigned long) = 0; 30 | virtual void end() = 0; 31 | virtual int available(void) = 0; 32 | virtual int peek(void) = 0; 33 | virtual int read(void) = 0; 34 | virtual void flush(void) = 0; 35 | virtual size_t write(uint8_t) = 0; 36 | using Print::write; // pull in write(str) and write(buf, size) from Print 37 | virtual operator bool() = 0; 38 | }; 39 | 40 | extern void serialEventRun(void) __attribute__((weak)); 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /libraries/CurieBLE/src/CurieBLE.h: -------------------------------------------------------------------------------- 1 | /* 2 | BLE API 3 | Copyright (c) 2016 Arduino LLC. 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 ARDUINO_BLE_H 21 | #define ARDUINO_BLE_H 22 | 23 | #define ARDUINO_BLE_API_VERSION 10000 // version 1.0.0 24 | 25 | class BLEDevice; 26 | class BLECentral; 27 | class BLECharacteristic; 28 | class BLEDescriptor; 29 | class BLEService; 30 | class BLECharacteristicImp; 31 | class BLEDescriptorImp; 32 | 33 | #include "BLECommon.h" 34 | 35 | #include "BLEDevice.h" 36 | #include "BLEAttributeWithValue.h" 37 | #include "BLECharacteristic.h" 38 | #include "BLEDescriptor.h" 39 | #include "BLEService.h" 40 | 41 | #include "BLETypedCharacteristics.h" 42 | 43 | #include "BLECentral.h" 44 | #include "BLEPeripheral.h" 45 | 46 | extern BLEDevice BLE; 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /cores/arduino/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | main.cpp userspace main loop for Arduino 101 family boards 3 | Copyright (C) 2014 Intel Corporation 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 Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | */ 20 | // Arduino hooks 21 | #include "Arduino.h" 22 | 23 | // Weak empty variant initialization function. 24 | // May be redefined by variant files. 25 | void initVariant() __attribute__((weak)); 26 | void initVariant() { } 27 | 28 | /* 29 | * \brief Main entry point of Arduino application 30 | */ 31 | int main( void ) 32 | { 33 | //init(); 34 | 35 | initVariant(); 36 | 37 | // delay(1); 38 | 39 | #if defined(USBCON) 40 | USBDevice.attach(); 41 | #endif 42 | 43 | setup(); 44 | 45 | for (;;) /* This infinite loop is intentional and requested by design */ 46 | { 47 | loop(); 48 | if (serialEventRun) serialEventRun(); 49 | } 50 | 51 | return 0; 52 | } 53 | -------------------------------------------------------------------------------- /libraries/CurieI2S/examples/I2S_TxCallback/I2S_TxCallback.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | //I2S_TX -> Pin 7 4 | //I2S_TSK -> Pin 4 5 | //I2S_TSCK -> pin 2 6 | 7 | void setup() 8 | { 9 | Serial.begin(115200); // initialize Serial communication 10 | while(!Serial) ; // wait for serial port to connect. 11 | Serial.println("CurieI2S Tx Callback"); 12 | CurieI2S.begin(I2S_44K, I2S_32bit); 13 | CurieI2S.setI2SMode(PHILIPS_MODE); 14 | CurieI2S.attachTxEmptyInterrupt(doneTX); 15 | CurieI2S.attachTxInterrupt(fillTxBuffer); 16 | CurieI2S.initTX(); 17 | } 18 | 19 | void loop() 20 | { 21 | Serial.println("+++"); 22 | 23 | //start filling the tx buffer 24 | CurieI2S.pushData(0xFFFFFFFF); 25 | CurieI2S.pushData(0x00000000); 26 | CurieI2S.pushData(0xDEADFACE); 27 | CurieI2S.pushData(0x10101010); 28 | Serial.println("start transmitting"); 29 | //Start Transmission 30 | CurieI2S.startTX(); 31 | for(int i = 0; i < 40; i++) 32 | { 33 | //keep filling the buffer 34 | while(!CurieI2S.pushData(0xFFFFFFFF)); 35 | while(!CurieI2S.pushData(0x00000000)); 36 | while(!CurieI2S.pushData(0xDEADFACE)); 37 | while(!CurieI2S.pushData(0x10101010)); 38 | } 39 | //Tx is automatically stopped after the tx buffer is emptied 40 | 41 | delay(500); 42 | Serial.println("+++"); 43 | } 44 | 45 | void doneTX() 46 | { 47 | Serial.println("done transmitting"); 48 | } 49 | 50 | void fillTxBuffer() 51 | { 52 | //you can fill the tx buffer here if you want 53 | //CurieI2S.pushData(0xDEADDEAD); 54 | //CurieI2S.pushData(0xDEADFACE); 55 | } 56 | 57 | -------------------------------------------------------------------------------- /cores/arduino/error.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 Intel Corporation. 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. See the GNU 12 | Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | 18 | */ 19 | 20 | #include "error.h" 21 | 22 | void error_continue() 23 | { 24 | error_continue(1); 25 | } 26 | 27 | void error_continue(uint8_t error_code) 28 | { 29 | uint32_t exc_addr = aux_reg_read(ARC_V2_EFA); 30 | uint32_t ecr = aux_reg_read(ARC_V2_ECR); 31 | 32 | pr_error(0, "Exception vector: 0x%x, cause code: 0x%x, parameter 0x%x\n", 33 | ARC_V2_ECR_VECTOR(ecr), 34 | ARC_V2_ECR_CODE(ecr), 35 | ARC_V2_ECR_PARAMETER(ecr)); 36 | pr_error(0, "Address 0x%x\n", exc_addr); 37 | shared_data->error_code = error_code; 38 | } 39 | 40 | void error_halt() 41 | { 42 | error_halt(1); 43 | } 44 | 45 | void error_halt(uint8_t error_code) 46 | { 47 | error_continue(error_code); 48 | __asm__("flag 0x01") ; /* Halt the CPU */ 49 | } 50 | -------------------------------------------------------------------------------- /libraries/CurieI2S/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For CurieI2S CurieI2SDMA 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | Curie_I2S KEYWORD1 10 | 11 | Curie_I2SDMA KEYWORD1 12 | 13 | ####################################### 14 | # Methods and Functions (KEYWORD2) 15 | ####################################### 16 | 17 | begin KEYWORD2 18 | start KEYWORD2 19 | stop KEYWORD2 20 | begin KEYWORD2 21 | enableRX KEYWORD2 22 | enableTX KEYWORD2 23 | startRX KEYWORD2 24 | startTX KEYWORD2 25 | stopRX KEYWORD2 26 | stopTX KEYWORD2 27 | setI2SMode KEYWORD2 28 | setResolution KEYWORD2 29 | initRX KEYWORD2 30 | initTX KEYWORD2 31 | end KEYWORD2 32 | pushData KEYWORD2 33 | fastPushData KEYWORD2 34 | write KEYWORD2 35 | pullData KEYWORD2 36 | read KEYWORD2 37 | requestdword KEYWORD2 38 | available KEYWORD2 39 | availableTx KEYWORD2 40 | attachRxInterrupt KEYWORD2 41 | detachRxInterrupt KEYWORD2 42 | attachTxInterrupt KEYWORD2 43 | detachTxInterrupt KEYWORD2 44 | attachTxEmptyInterrupt KEYWORD2 45 | beginTX KEYWORD2 46 | beginRX KEYWORD2 47 | transTX KEYWORD2 48 | transRX KEYWORD2 49 | mergeData KEYWORD2 50 | separateData KEYWORD2 51 | ####################################### 52 | # Instances (KEYWORD2) 53 | ####################################### 54 | CurieI2S KEYWORD2 55 | CurieI2SDMA KEYWORD2 56 | ####################################### 57 | # Constants (LITERAL1) 58 | ####################################### 59 | -------------------------------------------------------------------------------- /libraries/CurieBLE/src/internal/BLEUtils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Intel Corporation. All rights reserved. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | * 18 | */ 19 | 20 | 21 | namespace BLEUtils 22 | { 23 | String macAddressBT2String(const bt_addr_le_t &bd_addr); 24 | void macAddressString2BT(const char* mac_str, bt_addr_le_t &bd_addr); 25 | bool macAddressValid(const bt_addr_le_t &bd_addr); 26 | bool macAddressSame(const bt_addr_le_t &bd_addr1, const bt_addr_le_t &bd_addr2); 27 | bt_addr_le_t* bleGetLoalAddress(); 28 | void uuidString2BT(const char* uuid, bt_uuid_t* pstuuid); 29 | void uuidBT2String(const bt_uuid_t* pstuuid, char* uuid); 30 | bool uuidBTSame(const bt_uuid_t* pstuuid1, 31 | const bt_uuid_t* pstuuid2); 32 | 33 | BLEDevice& getLoacalBleDevice(); 34 | bool isLocalBLE(const BLEDevice& device); 35 | } 36 | 37 | -------------------------------------------------------------------------------- /libraries/EEPROM/examples/eeprom_put/eeprom_put.ino: -------------------------------------------------------------------------------- 1 | /*** 2 | eeprom_put example. 3 | 4 | This shows how to use the EEPROM.put() method. 5 | Also, this sketch will pre-set the EEPROM data for the 6 | example sketch eeprom_get. 7 | 8 | Note, unlike the single byte version EEPROM.write(), 9 | the put method will use update semantics. As in a byte 10 | will only be written to the EEPROM if the data is actually 11 | different. 12 | 13 | Written by Christopher Andrews 2015 14 | Released under MIT licence. 15 | ***/ 16 | 17 | #include 18 | 19 | struct MyObject { 20 | float field1; 21 | byte field2; 22 | char name[10]; 23 | }; 24 | 25 | void setup() { 26 | 27 | Serial.begin(9600); 28 | while (!Serial) { 29 | ; // wait for serial port to connect. Needed for native USB port only 30 | } 31 | 32 | float f = 123.456f; //Variable to store in EEPROM. 33 | int eeAddress = 0; //Location we want the data to be put. 34 | 35 | 36 | //One simple call, with the address first and the object second. 37 | EEPROM.put(eeAddress, f); 38 | 39 | Serial.println("Written float data type!"); 40 | 41 | /** Put is designed for use with custom structures also. **/ 42 | 43 | //Data to store. 44 | MyObject customVar = { 45 | 3.14f, 46 | 65, 47 | "Working!" 48 | }; 49 | 50 | eeAddress += sizeof(float); //Move address to the next byte after float 'f'. 51 | 52 | EEPROM.put(eeAddress, customVar); 53 | Serial.print("Written custom data type! \n\nView the example sketch eeprom_get to see how you can retrieve the values!"); 54 | } 55 | 56 | void loop() { 57 | /* Empty loop */ 58 | } 59 | -------------------------------------------------------------------------------- /libraries/CurieSoftwareSerial/examples/SoftwareSerialExample/SoftwareSerialExample.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Software serial multple 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 2 (connect to TX of other device) 9 | * TX is digital pin 3 (connect to RX of other device) 10 | 11 | Note: 12 | Not all pins on the Mega and Mega 2560 support change interrupts, 13 | so only the following can be used for RX: 14 | 10, 11, 12, 13, 50, 51, 52, 53, 62, 63, 64, 65, 66, 67, 68, 69 15 | 16 | Not all pins on the Leonardo support change interrupts, 17 | so only the following can be used for RX: 18 | 8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI). 19 | 20 | created back in the mists of time 21 | modified 25 May 2012 22 | by Tom Igoe 23 | based on Mikal Hart's example 24 | 25 | This example code is in the public domain. 26 | 27 | */ 28 | #include 29 | 30 | SoftwareSerial mySerial(2, 3); // RX, TX 31 | 32 | void setup() 33 | { 34 | // Open serial communications and wait for port to open: 35 | Serial.begin(115200); 36 | while (!Serial) { 37 | ; // wait for serial port to connect. Needed for Native USB only 38 | } 39 | 40 | 41 | Serial.println("Goodnight moon!"); 42 | 43 | // set the data rate for the SoftwareSerial port 44 | mySerial.begin(38400); 45 | mySerial.println("Hello, world?"); 46 | } 47 | 48 | void loop() // run over and over 49 | { 50 | if (mySerial.available()) 51 | Serial.write(mySerial.read()); 52 | if (Serial.available()) 53 | mySerial.write(Serial.read()); 54 | } 55 | 56 | -------------------------------------------------------------------------------- /system/libarc32_arduino101/bootcode/conf.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015 Intel Corporation. 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. See the GNU 12 | Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | 18 | */ 19 | 20 | #ifndef _ARCV2_CONF__H_ 21 | #define _ARCV2_CONF__H_ 22 | 23 | 24 | #define SS_NUM_IRQS 53 25 | #define SS_NUM_EXCEPTIONS 16 26 | 27 | #define _RAM_END (0xa8010000 + 0x4000) 28 | 29 | #define STACK_SIZE 1024 30 | #define ISR_STACK_SIZE 1024 31 | 32 | #define ARCV2_IRQ_TIMER0 16 33 | #define ARCV2_IRQ_TIMER1 17 34 | 35 | #define ARCV2_TIMER0_CLOCK_FREQ 32000000 /* 32MHz reference clock */ 36 | #define ARCV2_TIMER1_CLOCK_FREQ 32000000 /* 32MHz reference clock */ 37 | 38 | #define ARC_V2_TMR_CTRL_IE 0x1 /* interrupt enable */ 39 | #define ARC_V2_TMR_CTRL_NH 0x2 /* count only while not halted */ 40 | #define ARC_V2_TMR_CTRL_W 0x4 /* watchdog mode enable */ 41 | #define ARC_V2_TMR_CTRL_IP 0x8 /* interrupt pending flag */ 42 | 43 | 44 | 45 | #endif /* _ARCV2_CONF__H_ */ 46 | -------------------------------------------------------------------------------- /cores/arduino/stdlib_noniso.h: -------------------------------------------------------------------------------- 1 | /* 2 | stdlib_noniso.h - nonstandard (but usefull) conversion functions 3 | Copyright (c) 2014 Ivan Grokhotkov. All rights reserved. 4 | This file is part of the esp8266 core for Arduino environment. 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 | 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 | 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 STDLIB_NONISO_H 20 | #define STDLIB_NONISO_H 21 | 22 | #ifdef __cplusplus 23 | extern "C"{ 24 | #endif 25 | 26 | int atoi(const char *s); 27 | 28 | long atol(const char* s); 29 | 30 | double atof(const char* s); 31 | 32 | char* itoa (int val, char *s, int radix); 33 | 34 | char* ltoa (long val, char *s, int radix); 35 | 36 | char* utoa (unsigned int val, char *s, int radix); 37 | 38 | char* ultoa (unsigned long val, char *s, int radix); 39 | 40 | char* dtostrf (double val, signed char width, unsigned char prec, char *s); 41 | 42 | int digitsBe4Decimal(double number); 43 | 44 | #ifdef __cplusplus 45 | } // extern "C" 46 | #endif 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /libraries/EEPROM/examples/eeprom_read/eeprom_read.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * EEPROM Read 3 | * 4 | * Reads the value of each byte of the EEPROM and prints it 5 | * to the computer. 6 | * This example code is in the public domain. 7 | */ 8 | 9 | #include 10 | 11 | // start reading from the first byte (address 0) of the EEPROM 12 | int address = 0; 13 | byte value; 14 | 15 | void setup() { 16 | // initialize serial and wait for port to open: 17 | Serial.begin(9600); 18 | while (!Serial) { 19 | ; // wait for serial port to connect. Needed for native USB port only 20 | } 21 | } 22 | 23 | void loop() { 24 | // read a byte from the current address of the EEPROM 25 | value = EEPROM.read(address); 26 | 27 | Serial.print(address); 28 | Serial.print("\t"); 29 | Serial.print(value, DEC); 30 | Serial.println(); 31 | 32 | /*** 33 | Advance to the next address, when at the end restart at the beginning. 34 | 35 | Larger AVR processors have larger EEPROM sizes, E.g: 36 | - Arduno Duemilanove: 512b EEPROM storage. 37 | - Arduino Uno: 1kb EEPROM storage. 38 | - Arduino Mega: 4kb EEPROM storage. 39 | 40 | Rather than hard-coding the length, you should use the pre-provided length function. 41 | This will make your code portable to all AVR processors. 42 | ***/ 43 | address = address + 1; 44 | if (address == EEPROM.length()) { 45 | address = 0; 46 | } 47 | 48 | /*** 49 | As the EEPROM sizes are powers of two, wrapping (preventing overflow) of an 50 | EEPROM address is also doable by a bitwise and of the length - 1. 51 | 52 | ++address &= EEPROM.length() - 1; 53 | ***/ 54 | 55 | delay(500); 56 | } 57 | -------------------------------------------------------------------------------- /libraries/EEPROM/examples/eeprom_crc/eeprom_crc.ino: -------------------------------------------------------------------------------- 1 | /*** 2 | Written by Christopher Andrews. 3 | CRC algorithm generated by pycrc, MIT licence ( https://github.com/tpircher/pycrc ). 4 | 5 | A CRC is a simple way of checking whether data has changed or become corrupted. 6 | This example calculates a CRC value directly on the EEPROM values. 7 | The purpose of this example is to highlight how the EEPROM object can be used just like an array. 8 | ***/ 9 | 10 | #include 11 | #include 12 | 13 | void setup() { 14 | 15 | //Start serial 16 | Serial.begin(9600); 17 | while (!Serial) { 18 | ; // wait for serial port to connect. Needed for native USB port only 19 | } 20 | 21 | //Print length of data to run CRC on. 22 | Serial.print("EEPROM length: "); 23 | Serial.println(EEPROM.length()); 24 | 25 | //Print the result of calling eeprom_crc() 26 | Serial.print("CRC32 of EEPROM data: 0x"); 27 | Serial.println(eeprom_crc(), HEX); 28 | Serial.print("\n\nDone!"); 29 | } 30 | 31 | void loop() { 32 | /* Empty loop */ 33 | } 34 | 35 | unsigned long eeprom_crc(void) { 36 | 37 | const unsigned long crc_table[16] = { 38 | 0x00000000, 0x1db71064, 0x3b6e20c8, 0x26d930ac, 39 | 0x76dc4190, 0x6b6b51f4, 0x4db26158, 0x5005713c, 40 | 0xedb88320, 0xf00f9344, 0xd6d6a3e8, 0xcb61b38c, 41 | 0x9b64c2b0, 0x86d3d2d4, 0xa00ae278, 0xbdbdf21c 42 | }; 43 | 44 | unsigned long crc = ~0L; 45 | 46 | for (int index = 0 ; index < EEPROM.length() ; ++index) { 47 | crc = crc_table[(crc ^ EEPROM[index]) & 0x0f] ^ (crc >> 4); 48 | crc = crc_table[(crc ^ (EEPROM[index] >> 4)) & 0x0f] ^ (crc >> 4); 49 | crc = ~crc; 50 | } 51 | return crc; 52 | } 53 | -------------------------------------------------------------------------------- /cores/arduino/RingBuffer.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011 Arduino. All right reserved. 3 | This library is free software; you can redistribute it and/or 4 | modify it under the terms of the GNU Lesser General Public 5 | License as published by the Free Software Foundation; either 6 | version 2.1 of the License, or (at your option) any later version. 7 | This library is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | See the GNU Lesser General Public License for more details. 11 | You should have received a copy of the GNU Lesser General Public 12 | License along with this library; if not, write to the Free Software 13 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 14 | Modified by Dan O'Donovan Apr 29 2014: add buffer overflow control 15 | */ 16 | 17 | #ifndef _RING_BUFFER_ 18 | #define _RING_BUFFER_ 19 | 20 | #include 21 | #include "dccm/dccm_alloc.h" 22 | 23 | // Define constants and variables for buffering incoming serial data. We're 24 | // using a ring buffer (I think), in which head is the index of the location 25 | // to which to write the next incoming character and tail is the index of the 26 | // location from which to read. 27 | #define UART_BUFFER_SIZE 64 28 | 29 | class RingBuffer 30 | { 31 | public: 32 | uint8_t *_aucBuffer; 33 | volatile int _iHead ; 34 | volatile int _iTail ; 35 | volatile bool _buffer_overflow ; 36 | 37 | RingBuffer( void ) ; 38 | void store_char( uint8_t c ) ; 39 | bool overflow() { bool ret = _buffer_overflow; _buffer_overflow = false; return ret; } 40 | } ; 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /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/wiring_pulse.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011 Arduino. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef _WIRING_PULSE_ 20 | #define _WIRING_PULSE_ 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | /* 27 | * \brief Measures the length (in microseconds) of a pulse on the pin; state is HIGH 28 | * or LOW, the type of pulse to measure. Works on pulses from 2-3 microseconds 29 | * to 5 minutes in length, but must be called at least a few dozen microseconds 30 | * before the start of the pulse. The pulseIn() function is not designed to detect 31 | * high frequencies. The consequences of using this function to detect frequencies 32 | * such as a 100KHz PWM signal could possibly cause a sketch to hang at the 33 | * pulseIn() function call. 34 | */ 35 | extern uint32_t pulseIn( uint32_t ulPin, uint32_t ulState, uint32_t ulTimeout = 1000000UL ) ; 36 | 37 | 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | 42 | #endif /* _WIRING_PULSE_ */ 43 | -------------------------------------------------------------------------------- /libraries/CurieSerialFlash/examples/ListFiles/ListFiles.ino: -------------------------------------------------------------------------------- 1 | // This example depends on Paul Stoffregen's SerialFlash library 2 | // Download at https://github.com/PaulStoffregen/SerialFlash 3 | 4 | #include 5 | #include 6 | 7 | void setup() { 8 | //uncomment these if using Teensy audio shield 9 | //SPI.setSCK(14); // Audio shield has SCK on pin 14 10 | //SPI.setMOSI(7); // Audio shield has MOSI on pin 7 11 | 12 | //uncomment these if you have other SPI chips connected 13 | //to keep them disabled while using only SerialFlash 14 | //pinMode(4, INPUT_PULLUP); 15 | //pinMode(10, INPUT_PULLUP); 16 | 17 | Serial.begin(9600); 18 | 19 | // wait for Arduino Serial Monitor 20 | while (!Serial) ; 21 | delay(100); 22 | Serial.println("All Files on SPI Flash chip:"); 23 | 24 | if (!SerialFlash.begin(ONBOARD_FLASH_SPI_PORT, ONBOARD_FLASH_CS_PIN)) { 25 | error("Unable to access SPI Flash chip"); 26 | } 27 | 28 | SerialFlash.opendir(); 29 | unsigned int count = 0; 30 | while (1) { 31 | char filename[64]; 32 | unsigned long filesize; 33 | 34 | if (SerialFlash.readdir(filename, sizeof(filename), filesize)) { 35 | Serial.print(" "); 36 | Serial.print(filename); 37 | spaces(20 - strlen(filename)); 38 | Serial.print(" "); 39 | Serial.print(filesize); 40 | Serial.print(" bytes"); 41 | Serial.println(); 42 | } else { 43 | break; // no more files 44 | } 45 | } 46 | } 47 | 48 | void spaces(int num) { 49 | for (int i=0; i < num; i++) { 50 | Serial.print(" "); 51 | } 52 | } 53 | 54 | void loop() { 55 | } 56 | 57 | void error(const char *message) { 58 | while (1) { 59 | Serial.println(message); 60 | delay(2500); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /libraries/EEPROM/examples/eeprom_write/eeprom_write.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * EEPROM Write 3 | * 4 | * Stores values read from analog input 0 into the EEPROM. 5 | * These values will stay in the EEPROM when the board is 6 | * turned off and may be retrieved later by another sketch. 7 | */ 8 | 9 | #include 10 | 11 | /** the current address in the EEPROM (i.e. which byte we're going to write to next) **/ 12 | int addr = 0; 13 | 14 | void setup() { 15 | /** Empty setup. **/ 16 | } 17 | 18 | void loop() { 19 | /*** 20 | Need to divide by 4 because analog inputs range from 21 | 0 to 1023 and each byte of the EEPROM can only hold a 22 | value from 0 to 255. 23 | ***/ 24 | 25 | int val = analogRead(0) / 4; 26 | 27 | /*** 28 | Write the value to the appropriate byte of the EEPROM. 29 | these values will remain there when the board is 30 | turned off. 31 | ***/ 32 | 33 | EEPROM.write(addr, val); 34 | 35 | /*** 36 | Advance to the next address, when at the end restart at the beginning. 37 | 38 | Larger AVR processors have larger EEPROM sizes, E.g: 39 | - Arduno Duemilanove: 512b EEPROM storage. 40 | - Arduino Uno: 1kb EEPROM storage. 41 | - Arduino Mega: 4kb EEPROM storage. 42 | 43 | Rather than hard-coding the length, you should use the pre-provided length function. 44 | This will make your code portable to all AVR processors. 45 | ***/ 46 | addr = addr + 1; 47 | if (addr == EEPROM.length()) { 48 | addr = 0; 49 | } 50 | 51 | /*** 52 | As the EEPROM sizes are powers of two, wrapping (preventing overflow) of an 53 | EEPROM address is also doable by a bitwise and of the length - 1. 54 | 55 | ++addr &= EEPROM.length() - 1; 56 | ***/ 57 | 58 | 59 | delay(100); 60 | } 61 | -------------------------------------------------------------------------------- /libraries/CurieBLE/src/BLECentral.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | BLE Central API (deprecated) 3 | Copyright (c) 2016 Arduino LLC. 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 "CurieBLE.h" 21 | 22 | BLECentral::BLECentral(BLEDevice& device) : 23 | _device(&device) 24 | { 25 | 26 | } 27 | 28 | bool BLECentral::connected(void) 29 | { 30 | return _device.connected(); 31 | } 32 | 33 | const char* BLECentral::address(void) const 34 | { 35 | return _device.address().c_str(); 36 | } 37 | 38 | bool BLECentral::disconnect(void) 39 | { 40 | return _device.disconnect(); 41 | } 42 | 43 | void BLECentral::poll(void) 44 | { 45 | _device.poll(); 46 | } 47 | 48 | BLECentral::operator bool(void) const 49 | { 50 | return _device; 51 | } 52 | 53 | bool BLECentral::operator==(const BLECentral& rhs) const 54 | { 55 | return (_device == rhs._device); 56 | } 57 | 58 | bool BLECentral::operator!=(const BLECentral& rhs) const 59 | { 60 | return (_device != rhs._device); 61 | } 62 | -------------------------------------------------------------------------------- /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 | Modified by Dan O'Donovan Apr 29 2014: add buffer overflow control 19 | */ 20 | 21 | #include "RingBuffer.h" 22 | #include 23 | 24 | RingBuffer::RingBuffer( void ) 25 | { 26 | _aucBuffer = (uint8_t*)dccm_malloc(UART_BUFFER_SIZE); 27 | memset( _aucBuffer, 0, UART_BUFFER_SIZE ) ; 28 | _iHead=0 ; 29 | _iTail=0 ; 30 | } 31 | 32 | void RingBuffer::store_char( uint8_t c ) 33 | { 34 | int i = (uint32_t)(_iHead + 1) % UART_BUFFER_SIZE ; 35 | 36 | // if we should be storing the received character into the location 37 | // just before the tail (meaning that the head would advance to the 38 | // current location of the tail), we're about to overflow the buffer 39 | // and so we don't write the character or advance the head. 40 | if ( i != _iTail ) 41 | { 42 | _aucBuffer[_iHead] = c ; 43 | _iHead = i ; 44 | _buffer_overflow = false; 45 | } 46 | else 47 | { 48 | _buffer_overflow = true; 49 | } 50 | } 51 | 52 | -------------------------------------------------------------------------------- /system/libarc32_arduino101/common/misc/byteorder.h: -------------------------------------------------------------------------------- 1 | /* byteorder.h - Byte order helpers */ 2 | 3 | /* 4 | * Copyright (c) 2015, Intel Corporation. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #define bswap_16(x) ((uint16_t) ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8))) 20 | 21 | #define bswap_32(x) ((uint32_t) ((((x) >> 24) & 0xff) | (((x) >> 8) & 0xff00) \ 22 | | (((x) & 0xff00) << 8) | (((x) & 0xff) << 24))) 23 | 24 | #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ 25 | #define sys_le16_to_cpu(val) (val) 26 | #define sys_cpu_to_le16(val) (val) 27 | #define sys_be16_to_cpu(val) bswap_16(val) 28 | #define sys_cpu_to_be16(val) bswap_16(val) 29 | #define sys_le32_to_cpu(val) (val) 30 | #define sys_cpu_to_le32(val) (val) 31 | #define sys_be32_to_cpu(val) bswap_32(val) 32 | #define sys_cpu_to_be32(val) bswap_32(val) 33 | #elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ 34 | #define sys_le16_to_cpu(val) bswap_16(val) 35 | #define sys_cpu_to_le16(val) bswap_16(val) 36 | #define sys_be16_to_cpu(val) (val) 37 | #define sys_cpu_to_be16(val) (val) 38 | #define sys_le32_to_cpu(val) bswap_32(val) 39 | #define sys_cpu_to_le32(val) bswap_32(val) 40 | #define sys_be32_to_cpu(val) (val) 41 | #define sys_cpu_to_be32(val) (val) 42 | #else 43 | #error "Unknown byte order" 44 | #endif 45 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /libraries/MemoryFree/examples/freeMemory/freeMemory.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * freeMemory.ino: This sketch demonstrates the use of the freeMemory() 3 | * function to measure the amount of free memory available in the system, 4 | * before and after using 'malloc' to allocate some memory. 5 | * 6 | * Copyright (c) 2016 Intel Corporation. All rights reserved. 7 | * See the bottom of this file for the license terms. 8 | */ 9 | 10 | #include 11 | 12 | void setup () { 13 | Serial.begin(9600); 14 | while(!Serial); 15 | } 16 | 17 | void loop() { 18 | char *p; 19 | 20 | Serial.println("Free memory: " + String(freeMemory())); 21 | Serial.println("Allocating 24 bytes ..."); 22 | 23 | p = (char *)malloc(24); 24 | Serial.println("Free memory: " + String(freeMemory())); 25 | 26 | Serial.println("Freeing 24 bytes ..."); 27 | free(p); 28 | Serial.println("Free memory: " + String(freeMemory())); 29 | 30 | delay(2000); 31 | } 32 | 33 | /* 34 | * Copyright (c) 2017 Intel Corporation. All rights reserved. 35 | * 36 | * This library is free software; you can redistribute it and/or 37 | * modify it under the terms of the GNU Lesser General Public 38 | * License as published by the Free Software Foundation; either 39 | * version 2.1 of the License, or (at your option) any later version. 40 | * 41 | * This library is distributed in the hope that it will be useful, 42 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 43 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 44 | * Lesser General Public License for more details. 45 | * 46 | * You should have received a copy of the GNU Lesser General Public 47 | * License along with this library; if not, write to the Free Software 48 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 49 | * 50 | */ 51 | -------------------------------------------------------------------------------- /libraries/Wire/examples/bus_scan/bus_scan.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Sketch: I2CBusScan.ino 3 | 4 | This sketch demonstrates the usage of the Curie Wire Library. 5 | It scan the I2C bus to find slave devices 6 | 7 | You can see the found I2C slave device shown in serial output 8 | with the following message: 9 | address:xxx found 10 | 11 | created by Intel 12 | Modified 18 May 2016 13 | 14 | This example code is in the public domain. 15 | */ 16 | 17 | 18 | #include 19 | 20 | byte startAddress = 1; 21 | byte endAddress = 127; 22 | 23 | void I2CBusScan(byte startAddress, byte endAddress) 24 | { 25 | byte retval; 26 | char temp[64]; 27 | for( byte address = startAddress; address <= endAddress; address++ ) { 28 | Wire.beginTransmission(address); 29 | retval = Wire.endTransmission(); 30 | sprintf(temp, "address: %-4d%-5s", address, (retval == 0 || retval == 3) ? "found" : ""); 31 | Serial.print(temp); 32 | Serial.print((address % 4) ? '\t' : '\n'); 33 | } 34 | } 35 | 36 | void setup() 37 | { 38 | // Initialize pin 13 as an output - onboard LED. 39 | pinMode(LED_BUILTIN, OUTPUT); 40 | 41 | // join i2c bus (address optional for master) 42 | Wire.begin(); 43 | 44 | // initialize Serial communication 45 | Serial.begin(115200); 46 | // wait for the Serial port to connect. Open the Serial Monitor to continue executing the sketch 47 | while(!Serial); 48 | } 49 | 50 | bool toggle = false; // state of the LED 51 | void loop() 52 | { 53 | toggle = !toggle; 54 | digitalWrite(LED_BUILTIN, toggle); 55 | delay(5000); 56 | 57 | Serial.print("Start I2C Bus Scan from "); 58 | Serial.print(startAddress); 59 | Serial.print(" to "); 60 | Serial.print(endAddress); 61 | Serial.println("....."); 62 | 63 | I2CBusScan(startAddress, endAddress); 64 | 65 | Serial.println("\ndone"); 66 | } 67 | -------------------------------------------------------------------------------- /system/libarc32_arduino101/framework/include/panic_api.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, Intel Corporation. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * 3. Neither the name of the copyright holder nor the names of its contributors 15 | * may be used to endorse or promote products derived from this software without 16 | * specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | * POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | // TODO - replace with a proper implementation of panic() 32 | //#define panic(x) _do_fault(); 33 | #define force_panic() panic(-1) 34 | -------------------------------------------------------------------------------- /cores/arduino/i2c.h: -------------------------------------------------------------------------------- 1 | /* 2 | * i2c.h 3 | * 4 | * Copyright (c) 2013 Parav Nagarsheth 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 17 | * Public License along with this library; if not, write to the 18 | * Free Software Foundation, Inc., 59 Temple Place, Suite 330, 19 | * Boston, MA 02111-1307 USA 20 | */ 21 | 22 | #ifndef i2c_h 23 | #define i2c_h 24 | 25 | #include 26 | #include 27 | #include "ss_i2c_iface.h" 28 | 29 | #ifdef __cplusplus 30 | extern "C"{ 31 | #endif 32 | 33 | #define I2C_OK 0 34 | #define I2C_TIMEOUT -10 35 | #define I2C_ERROR -20 /* Qi, 2016. */ 36 | #define I2C_ERROR_ADDRESS_NOACK (-2) 37 | #define I2C_ERROR_DATA_NOACK (-3) 38 | #define I2C_ERROR_OTHER (-4) 39 | 40 | #define I2C_ABRT_7B_ADDR_NOACK (1 << 0) 41 | #define I2C_ABRT_TXDATA_NOACK (1 << 3) 42 | 43 | int i2c_openadapter(I2C_CONTROLLER controller_id); 44 | int i2c_openadapter_speed(I2C_CONTROLLER controller_id, int i2c_speed); 45 | void i2c_setslave(I2C_CONTROLLER controller_id, uint8_t addr); 46 | int i2c_writebytes(I2C_CONTROLLER controller_id, uint8_t *bytes, uint8_t length, bool no_stop); 47 | int i2c_readbytes(I2C_CONTROLLER controller_id, uint8_t *buf, int length, bool no_stop); 48 | 49 | #ifdef __cplusplus 50 | } 51 | #endif 52 | #endif /* i2c_h */ 53 | -------------------------------------------------------------------------------- /system/libarc32_arduino101/framework/src/infra/factory_data.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, Intel Corporation. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * 3. Neither the name of the copyright holder nor the names of its contributors 15 | * may be used to endorse or promote products derived from this software without 16 | * specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | * POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #include 32 | #include "platform.h" 33 | 34 | const struct factory_data* global_factory_data = (struct factory_data*)FACTORY_DATA_ADDR; 35 | -------------------------------------------------------------------------------- /libraries/CurieBLE/src/BLECentral.h: -------------------------------------------------------------------------------- 1 | /* 2 | BLE Central API (deprecated) 3 | Copyright (c) 2016 Arduino LLC. 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 | // The API in this file is in DEPRECATED MODE, please DO NOT use it for Sketch construction 20 | #ifndef ARDUINO_CENTRAL_H 21 | #define ARDUINO_CENTRAL_H 22 | 23 | class BLECentral { 24 | public: 25 | bool connected(void); // is the central connected 26 | 27 | const char* address(void) const; // address of the Central in string form 28 | 29 | bool disconnect(void); // Disconnect the central if it is connected 30 | void poll(void); // Poll the central for events 31 | 32 | operator bool(void) const; 33 | bool operator==(const BLECentral& rhs) const; 34 | bool operator!=(const BLECentral& rhs) const; 35 | protected: 36 | friend class BLECharacteristicImp; 37 | friend void bleBackCompatiblePeripheralConnectHandler(BLEDevice central); 38 | friend void bleBackCompatiblePeripheralDisconnectHandler(BLEDevice central); 39 | friend class BLEPeripheral; 40 | BLECentral(BLEDevice& device); 41 | private: 42 | 43 | BLEDevice _device; 44 | }; 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /libraries/CurieTime/src/CurieTime.h: -------------------------------------------------------------------------------- 1 | /* 2 | * CurieTime.h - Time library for Arduino101 3 | */ 4 | 5 | #ifndef CurieTime_h 6 | #define CurieTime_h 7 | 8 | #define RTC_CCVR (volatile int*)0xb0000400 // Current Counter Value Register 9 | #define RTC_CMR 0xb0000404 // Counter Match Register 10 | #define RTC_CLR (volatile int*)0xb0000408 // Counter Load Register 11 | #define RTC_CCR 0xb000040C // Counter Control Register 12 | #define RTC_STAT 0xb0000410 // Interrupt Status Register 13 | #define RTC_RSTAT 0xb0000414 // Interrupt Raw Status Register 14 | #define RTC_EOI 0xb0000418 // End of Interrupt Register 15 | 16 | // The following API is based on Paul Stoffregen's Arduino Time Library: 17 | // https://github.com/PaulStoffregen/Time 18 | 19 | unsigned long now(); // current time as seconds since Jan 1 1970 20 | 21 | int year(); // current year as an integer 22 | int year(unsigned long t); // year of t as an integer 23 | int month(); // current month as an integer (1 - 12) 24 | int month(unsigned long t); // month of t as an integer (1 - 12) 25 | int day(); // current day as an integer (1 - 31) 26 | int day(unsigned long t); // day of t as an integer (1 - 31) 27 | int hour(); // current hour as an integer (0 - 23) 28 | int hour(unsigned long t); // hour of t as an integer (0 - 23) 29 | int minute(); // current minute as an integer (0 - 59) 30 | int minute(unsigned long t); // minute of t as an integer (0 - 59) 31 | int second(); // current second as an integer (0 - 59) 32 | int second(unsigned long t); // second of t as an integer (0 - 59) 33 | 34 | void setTime(int hour, int minute, int second, int day, int month, int year); // set the current time 35 | void setTime(unsigned long t); // set the current time from seconds since Jan 1 1970 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /libraries/MemoryFree/src/MemoryFree.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This library is free software; you can redistribute it and/or 3 | * modify it under the terms of the GNU Lesser General Public 4 | * License as published by the Free Software Foundation; either 5 | * version 2.1 of the License, or (at your option) any later version. 6 | 7 | * This library is distributed in the hope that it will be useful, 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 10 | * Lesser General Public License for more details. 11 | 12 | * You should have received a copy of the GNU Lesser General Public 13 | * License along with this library; if not, write to the Free Software 14 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | * 16 | */ 17 | 18 | #ifndef MEMORYFREE_H 19 | #define MEMORYFREE_H 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | /* freeHeap: returns the size (in bytes) of unused space on the heap, 26 | * i.e. the number of bytes available for allocation by 'malloc()' */ 27 | int freeHeap(void); 28 | 29 | /* freeStack: returns the size (in bytes) of remaining free space in the stack, 30 | * i.e. the difference between our current position in the stack, and the end 31 | * of usable stack space. 32 | * 33 | * NOTE: This function will return a negative number to indicate a stack 34 | * overflow, i.e. a return value of -20 means you have overrun the allocated 35 | * stack area by 20 bytes. */ 36 | int freeStack(void); 37 | 38 | /* freeMemory: returns the combined free memory in both the stack and heap, 39 | * except in the case where a stack overflow has occurred (i.e. freeStack 40 | * returns a negative number). In this case, only the amount of free heap 41 | * space will be returned. */ 42 | int freeMemory(void); 43 | 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /libraries/CurieTime/examples/ReadTest/ReadTest.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Intel Corporation. All rights reserved. 3 | * See the bottom of this file for the license terms. 4 | */ 5 | 6 | #include 7 | 8 | void setup() { 9 | Serial.begin(9600); // initialize Serial communication 10 | while (!Serial); // wait for serial port to connect. 11 | 12 | Serial.println("CurieTime Read Test"); 13 | Serial.println("-------------------"); 14 | } 15 | 16 | void loop() { 17 | Serial.print("Ok, Time = "); 18 | print2digits(hour()); 19 | Serial.write(':'); 20 | print2digits(minute()); 21 | Serial.write(':'); 22 | print2digits(second()); 23 | Serial.print(", Date (D/M/Y) = "); 24 | Serial.print(day()); 25 | Serial.write('/'); 26 | Serial.print(month()); 27 | Serial.write('/'); 28 | Serial.print(year()); 29 | Serial.println(); 30 | delay(1000); 31 | } 32 | 33 | void print2digits(int number) { 34 | if (number >= 0 && number < 10) { 35 | Serial.write('0'); 36 | } 37 | Serial.print(number); 38 | } 39 | 40 | /* 41 | * Copyright (c) 2016 Intel Corporation. All rights reserved. 42 | * 43 | * This library is free software; you can redistribute it and/or 44 | * modify it under the terms of the GNU Lesser General Public 45 | * License as published by the Free Software Foundation; either 46 | * version 2.1 of the License, or (at your option) any later version. 47 | * 48 | * This library is distributed in the hope that it will be useful, 49 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 50 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 51 | * Lesser General Public License for more details. 52 | * 53 | * You should have received a copy of the GNU Lesser General Public 54 | * License along with this library; if not, write to the Free Software 55 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 56 | */ 57 | -------------------------------------------------------------------------------- /system/libarc32_arduino101/framework/include/cfw/cfw_debug.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, Intel Corporation. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * 3. Neither the name of the copyright holder nor the names of its contributors 15 | * may be used to endorse or promote products derived from this software without 16 | * specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | * POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef __CFW_DEBUG_H__ 32 | #define __CFW_DEBUG_H__ 33 | 34 | char * cfw_get_msg_type_str(struct cfw_message *msg); 35 | void cfw_dump_message(struct cfw_message * msg); 36 | 37 | #endif /* __CFW_DEBUG_H__ */ 38 | -------------------------------------------------------------------------------- /cores/arduino/wiring_shift.c: -------------------------------------------------------------------------------- 1 | /* 2 | wiring_shift.c - shiftOut() function 3 | Part of Arduino - http://www.arduino.cc/ 4 | Copyright (c) 2005-2006 David A. Mellis" 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 "Arduino.h" 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | 27 | uint32_t shiftIn( uint32_t ulDataPin, uint32_t ulClockPin, uint32_t ulBitOrder ) { 28 | 29 | uint32_t value = 0; 30 | uint32_t i; 31 | for (i = 0; i < 8 ; i++) { 32 | digitalWrite(ulClockPin, HIGH); 33 | if (ulBitOrder == LSBFIRST) 34 | value |= digitalRead(ulDataPin) << i; 35 | else 36 | value |= digitalRead(ulDataPin) << (7-i); 37 | 38 | digitalWrite(ulClockPin,LOW); 39 | } 40 | 41 | return value; 42 | 43 | } 44 | 45 | 46 | void shiftOut( uint32_t ulDataPin, uint32_t ulClockPin, uint32_t ulBitOrder, uint32_t ulVal ) { 47 | 48 | int i; 49 | for(i = 0; i < 8; i++) { 50 | if(ulBitOrder == LSBFIRST) 51 | digitalWrite(ulDataPin, !!(ulVal & (1 << i))); 52 | else 53 | digitalWrite(ulDataPin, !!(ulVal & (1 << (7-i)))); 54 | 55 | digitalWrite(ulClockPin, HIGH); 56 | digitalWrite(ulClockPin, LOW); 57 | } 58 | } 59 | 60 | 61 | #ifdef __cplusplus 62 | } 63 | #endif 64 | 65 | 66 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /libraries/CurieTime/examples/SetTime/SetTime.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Intel Corporation. All rights reserved. 3 | * See the bottom of this file for the license terms. 4 | */ 5 | 6 | #include 7 | 8 | void setup() { 9 | Serial.begin(9600); // initialize Serial communication 10 | while(!Serial) ; // wait for serial port to connect. 11 | 12 | // set the current time to 14:27:00, December 14th, 2015 13 | setTime(14, 27, 00, 14, 12, 2015); 14 | } 15 | 16 | void loop() { 17 | Serial.print("Time now is: "); 18 | 19 | print2digits(hour()); 20 | Serial.print(":"); 21 | print2digits(minute()); 22 | Serial.print(":"); 23 | print2digits(second()); 24 | 25 | Serial.print(" "); 26 | 27 | Serial.print(day()); 28 | Serial.print("/"); 29 | Serial.print(month()); 30 | Serial.print("/"); 31 | Serial.print(year()); 32 | 33 | Serial.println(); 34 | 35 | delay(1000); 36 | } 37 | 38 | void print2digits(int number) { 39 | if (number >= 0 && number < 10) { 40 | Serial.print('0'); 41 | } 42 | Serial.print(number); 43 | } 44 | 45 | /* 46 | * Copyright (c) 2016 Intel Corporation. All rights reserved. 47 | * 48 | * This library is free software; you can redistribute it and/or 49 | * modify it under the terms of the GNU Lesser General Public 50 | * License as published by the Free Software Foundation; either 51 | * version 2.1 of the License, or (at your option) any later version. 52 | * 53 | * This library is distributed in the hope that it will be useful, 54 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 55 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 56 | * Lesser General Public License for more details. 57 | * 58 | * You should have received a copy of the GNU Lesser General Public 59 | * License along with this library; if not, write to the Free Software 60 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 61 | */ 62 | -------------------------------------------------------------------------------- /system/libarc32_arduino101/drivers/ss_spi.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Intel Corporation. All rights reserved. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | * 18 | */ 19 | 20 | #ifndef _SS_SPI_H_ 21 | #define _SS_SPI_H_ 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | #include "common_spi.h" 28 | 29 | /** 30 | * List of all controllers 31 | */ 32 | typedef enum { 33 | SPI_SENSING_0, /* Sensing SPI controller 0, accessible by Sensor Subsystem Core only */ 34 | SPI_SENSING_1 /* Sensing SPI controller 1, accessible by Sensor Subsystem Core only */ 35 | } SPI_CONTROLLER; 36 | 37 | void ss_spi_init(SPI_CONTROLLER controller_id, uint32_t speed, 38 | SPI_BUS_MODE mode, SPI_DATA_FRAME_SIZE data_frame_size, 39 | SPI_SLAVE_ENABLE slave); 40 | void ss_spi_disable(SPI_CONTROLLER controller_id); 41 | int ss_spi_xfer(SPI_CONTROLLER controller_id, uint8_t *buf, unsigned tx_cnt, 42 | unsigned rx_cnt); 43 | void ss_spi_set_data_mode(SPI_CONTROLLER controller_id, uint8_t dataMode); 44 | void ss_spi_set_clock_divider(SPI_CONTROLLER controller_id, uint8_t clockDiv); 45 | 46 | #ifdef __cplusplus 47 | } 48 | #endif 49 | 50 | #endif // _SS_SPI_H_ 51 | -------------------------------------------------------------------------------- /system/libarc32_arduino101/framework/src/cfw/cfw_private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, Intel Corporation. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * 3. Neither the name of the copyright holder nor the names of its contributors 15 | * may be used to endorse or promote products derived from this software without 16 | * specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | * POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef __CFW_PRIVATE_H__ 32 | #define __CFW_PRIVATE_H__ 33 | 34 | #include "cfw/cfw_service.h" 35 | int _cfw_register_service(service_t * svc); 36 | int _cfw_deregister_service(cfw_handle_t handle, service_t * svc); 37 | #endif 38 | -------------------------------------------------------------------------------- /variants/arduino_101/pins_arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | pins_arduino.h - Pin definition functions for Arduino 3 | Part of Arduino - http://www.arduino.cc/ 4 | 5 | Copyright (c) 2007 David A. Mellis 6 | 7 | This library is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU Lesser General Public 9 | License as published by the Free Software Foundation; either 10 | version 2.1 of the License, or (at your option) any later version. 11 | 12 | This library is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | Lesser General Public License for more details. 16 | 17 | You should have received a copy of the GNU Lesser General 18 | Public License along with this library; if not, write to the 19 | Free Software Foundation, Inc., 59 Temple Place, Suite 330, 20 | Boston, MA 02111-1307 USA 21 | 22 | $Id: wiring.h 249 2007-02-03 16:52:51Z mellis $ 23 | */ 24 | 25 | #ifndef Pins_Arduino_h 26 | #define Pins_Arduino_h 27 | 28 | #define NUM_DIGITAL_PINS 32 29 | #define NUM_ANALOG_INPUTS 6 30 | #define NUM_PWM 4 31 | #define NUM_UARTS 1 32 | #define NUM_SPI 1 33 | #define NUM_I2C 1 34 | 35 | #define analogInputToDigitalPin(p) ((p < 6) ? (p) + 14 : -1) 36 | 37 | #define digitalPinHasPWM(p) ((p) == 3 || (p) == 5 || (p) == 6 || (p) == 9) 38 | 39 | static const uint8_t SS = 10; 40 | static const uint8_t MOSI = 11; 41 | static const uint8_t MISO = 12; 42 | static const uint8_t SCK = 13; 43 | 44 | static const uint8_t SDA = 18; 45 | static const uint8_t SCL = 19; 46 | static const uint8_t LED_BUILTIN = 13; 47 | 48 | static const uint8_t A0 = 14; 49 | static const uint8_t A1 = 15; 50 | static const uint8_t A2 = 16; 51 | static const uint8_t A3 = 17; 52 | static const uint8_t A4 = 18; 53 | static const uint8_t A5 = 19; 54 | 55 | static const uint8_t ATN = 20; 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /system/libarc32_arduino101/drivers/bluetooth/att.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | * @brief Attribute Protocol handling. 3 | */ 4 | 5 | /* 6 | * Copyright (c) 2016 Intel Corporation 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | #ifndef __BT_ATT_H 21 | #define __BT_ATT_H 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | /* Error codes for Error response PDU */ 28 | #define BT_ATT_ERR_INVALID_HANDLE 0x01 29 | #define BT_ATT_ERR_READ_NOT_PERMITTED 0x02 30 | #define BT_ATT_ERR_WRITE_NOT_PERMITTED 0x03 31 | #define BT_ATT_ERR_INVALID_PDU 0x04 32 | #define BT_ATT_ERR_AUTHENTICATION 0x05 33 | #define BT_ATT_ERR_NOT_SUPPORTED 0x06 34 | #define BT_ATT_ERR_INVALID_OFFSET 0x07 35 | #define BT_ATT_ERR_AUTHORIZATION 0x08 36 | #define BT_ATT_ERR_PREPARE_QUEUE_FULL 0x09 37 | #define BT_ATT_ERR_ATTRIBUTE_NOT_FOUND 0x0a 38 | #define BT_ATT_ERR_ATTRIBUTE_NOT_LONG 0x0b 39 | #define BT_ATT_ERR_ENCRYPTION_KEY_SIZE 0x0c 40 | #define BT_ATT_ERR_INVALID_ATTRIBUTE_LEN 0x0d 41 | #define BT_ATT_ERR_UNLIKELY 0x0e 42 | #define BT_ATT_ERR_INSUFFICIENT_ENCRYPTION 0x0f 43 | #define BT_ATT_ERR_UNSUPPORTED_GROUP_TYPE 0x10 44 | #define BT_ATT_ERR_INSUFFICIENT_RESOURCES 0x11 45 | 46 | /* Common Profile Error Codes (from CSS) */ 47 | #define BT_ATT_ERR_CCC_IMPROPER_CONF 0xfd 48 | #define BT_ATT_ERR_PROCEDURE_IN_PROGRESS 0xfe 49 | #define BT_ATT_ERR_OUT_OF_RANGE 0xff 50 | 51 | #ifdef __cplusplus 52 | } 53 | #endif 54 | 55 | #endif /* __BT_ATT_H */ 56 | -------------------------------------------------------------------------------- /system/libarc32_arduino101/framework/src/infra/uptime.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, Intel Corporation. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * 3. Neither the name of the copyright holder nor the names of its contributors 15 | * may be used to endorse or promote products derived from this software without 16 | * specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | * POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #include 32 | #include "platform.h" 33 | #include "portable.h" 34 | 35 | uint32_t get_uptime_32k() 36 | { 37 | return SCSS_REG_VAL(SCSS_AONC_CNT); 38 | } 39 | 40 | uint32_t get_uptime_ms() 41 | { 42 | return ((uint64_t)get_uptime_32k() * 1000) / 32768; 43 | } 44 | -------------------------------------------------------------------------------- /system/libarc32_arduino101/bootcode/interrupt.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015 Intel Corporation. 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. See the GNU 12 | Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | 18 | */ 19 | #ifndef __INTERRUPT_H__ 20 | #define __INTERRUPT_H__ 21 | 22 | #define INTERRUPT_ENABLE (1 << 4) 23 | /* According to IRQ_BUILD register the ARC core has only 2 interrupt priority 24 | * levels (0 and 1). 25 | * */ 26 | #define INTERRUPT_THRESHOLD (1) 27 | 28 | #ifdef __cplusplus 29 | extern "C" { 30 | #endif 31 | 32 | extern void interrupt_connect(unsigned int irq, void (*isr)(void)); 33 | extern void interrupt_disconnect(unsigned int irq); 34 | extern void interrupt_enable(unsigned int irq); 35 | extern void interrupt_disable(unsigned int irq); 36 | extern void interrupt_priority_set (int irq, unsigned char priority); 37 | 38 | extern void interrupt_unit_device_init(void); 39 | 40 | static inline __attribute__((always_inline)) 41 | unsigned int interrupt_lock(void) 42 | { 43 | unsigned int key; 44 | 45 | __asm__ volatile ("clri %0" : "=r" (key)); 46 | return key; 47 | } 48 | 49 | static inline __attribute__((always_inline)) 50 | void interrupt_unlock(unsigned int key) 51 | { 52 | __asm__ volatile ("seti %0" :: "ir" (key)); 53 | } 54 | #ifdef __cplusplus 55 | } 56 | #endif 57 | 58 | #endif /* __INTERRUPT_H__ */ 59 | -------------------------------------------------------------------------------- /libraries/CurieIMU/examples/Gyro/Gyro.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Intel Corporation. All rights reserved. 3 | * See the bottom of this file for the license terms. 4 | */ 5 | 6 | /* 7 | This sketch example demonstrates how the BMI160 on the 8 | Intel(R) Curie(TM) module can be used to read gyroscope data 9 | */ 10 | 11 | #include "CurieIMU.h" 12 | 13 | void setup() { 14 | Serial.begin(9600); // initialize Serial communication 15 | while (!Serial); // wait for the serial port to open 16 | 17 | // initialize device 18 | Serial.println("Initializing IMU device..."); 19 | CurieIMU.begin(); 20 | 21 | // Set the accelerometer range to 250 degrees/second 22 | CurieIMU.setGyroRange(250); 23 | } 24 | 25 | void loop() { 26 | float gx, gy, gz; //scaled Gyro values 27 | 28 | // read gyro measurements from device, scaled to the configured range 29 | CurieIMU.readGyroScaled(gx, gy, gz); 30 | 31 | // display tab-separated gyro x/y/z values 32 | Serial.print("g:\t"); 33 | Serial.print(gx); 34 | Serial.print("\t"); 35 | Serial.print(gy); 36 | Serial.print("\t"); 37 | Serial.print(gz); 38 | Serial.println(); 39 | } 40 | 41 | /* 42 | Copyright (c) 2016 Intel Corporation. All rights reserved. 43 | 44 | This library is free software; you can redistribute it and/or 45 | modify it under the terms of the GNU Lesser General Public 46 | License as published by the Free Software Foundation; either 47 | version 2.1 of the License, or (at your option) any later version. 48 | 49 | This library is distributed in the hope that it will be useful, 50 | but WITHOUT ANY WARRANTY; without even the implied warranty of 51 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 52 | Lesser General Public License for more details. 53 | 54 | You should have received a copy of the GNU Lesser General Public 55 | License along with this library; if not, write to the Free Software 56 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 57 | 58 | */ 59 | -------------------------------------------------------------------------------- /libraries/CurieI2S/examples/I2S_RxCallback/I2S_RxCallback.ino: -------------------------------------------------------------------------------- 1 | /** 2 | * A simple sketch to test the rx channel of the i2s interface. 3 | * A callback function is used to fill up a buffer whenever data is received 4 | * 5 | * To test this sketch you will need a second Arduino/Genuino 101 board with the I2S_TxCallback sketch uploaded 6 | * 7 | * Connection: 8 | * I2S_RSCK(pin 8) -> I2S_TSCK(pin 2) 9 | * I2S_RWS (pin 3) -> I2S_TWS (pin 4) 10 | * I2S_RXD (pin 5) -> I2S_TXD (pin 7) 11 | * Ground (GND) -> Ground (GND) 12 | * Notes: 13 | * Transmission is sensitive to noise. To reduce noise: 14 | * - Power both boards with an external power supply. Usb power is not always clean. 15 | * - Insure that both boards are sharing the same ground. 16 | * - Use short wires to connect between the board or use shielded wire. 17 | **/ 18 | #include 19 | 20 | const int BUFF_SIZE=128; 21 | 22 | uint32_t dataBuff[BUFF_SIZE]; 23 | volatile int count = 0; 24 | 25 | void setup() 26 | { 27 | // put your setup code here, to run once: 28 | Serial.begin(115200); // initialize Serial communication 29 | while(!Serial) ; // wait for serial port to connect. 30 | Serial.println("CurieI2S Rx Callback Example"); 31 | CurieI2S.begin(I2S_44K, I2S_32bit); 32 | CurieI2S.setI2SMode(PHILIPS_MODE); 33 | CurieI2S.attachRxInterrupt(rxDataReceived); 34 | CurieI2S.initRX(); 35 | CurieI2S.startRX(); 36 | 37 | } 38 | 39 | void loop() 40 | { 41 | if(count>0) 42 | { 43 | for(int i =0; i < count; i++) 44 | { 45 | Serial.print("data: "); 46 | Serial.println(dataBuff[i], HEX); 47 | } 48 | count = 0; 49 | } 50 | delay(500); 51 | } 52 | 53 | //This function is called inside an ISR so it is important to make this as atomic/fast as possible 54 | void rxDataReceived() 55 | { 56 | while(CurieI2S.available()) 57 | { 58 | dataBuff[count++] = CurieI2S.requestdword(); 59 | count %= BUFF_SIZE; //prevent buffer overflow and just write data in front of the buffer. 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /libraries/CurieBLE/src/internal/BLEAttribute.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Intel Corporation. All rights reserved. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | * 18 | */ 19 | 20 | #include "CurieBLE.h" 21 | #include "BLEAttribute.h" 22 | 23 | #include "./internal/BLEUtils.h" 24 | 25 | 26 | BLEAttribute::BLEAttribute(const char* uuid, BLEAttributeType type) : 27 | _type(type) 28 | { 29 | memset(&_uuid, 0, sizeof (_uuid)); 30 | BLEUtils::uuidString2BT(uuid, (bt_uuid_t*)&_uuid); 31 | } 32 | 33 | BLEAttribute::BLEAttribute(const bt_uuid_t* uuid, BLEAttributeType type) : 34 | _type(type) 35 | { 36 | memcpy(&_uuid, uuid, sizeof (_uuid)); 37 | } 38 | 39 | const bt_uuid_t *BLEAttribute::bt_uuid(void) 40 | { 41 | return (bt_uuid_t *)&_uuid; 42 | } 43 | 44 | 45 | BLEAttributeType 46 | BLEAttribute::type() const { 47 | return this->_type; 48 | } 49 | 50 | bool BLEAttribute::compareUuid(const bt_uuid_t* uuid) 51 | { 52 | int cmpresult = 0; 53 | cmpresult = bt_uuid_cmp(uuid, (const bt_uuid_t*)&_uuid); 54 | return (cmpresult == 0); 55 | 56 | } 57 | 58 | bool BLEAttribute::compareUuid(const char* uuid) 59 | { 60 | bt_uuid_128_t temp; 61 | BLEUtils::uuidString2BT(uuid,(bt_uuid_t *)&temp); 62 | return compareUuid((bt_uuid_t *)&temp); 63 | } 64 | 65 | -------------------------------------------------------------------------------- /libraries/MemoryFree/README.md: -------------------------------------------------------------------------------- 1 | ## MemoryFree library for Arduino/Genuino101 and tinyTILE 2 | 3 | This library is a re-write of http://playground.arduino.cc/Code/AvailableMemory 4 | specifically for Curie-based devices. This library defines the same header file 5 | `MemoryFree.h`, and provides the function `freeMemory()`. In addition, two extra 6 | functions are provided; `freeHeap()`, for heap space only, and `freeStack()`, 7 | for free stack space. `freeStack()` can also be used to detect a stack overflow. 8 | 9 | The rewrite is necessary for two reasons: 10 | 11 | * AVR-based boards use a different implementation of `malloc()` than Curie-based 12 | boards, and in order to determine the amount of free heap space, we depend 13 | on specific symbols defined by the `malloc()` implementation. The `malloc()` 14 | implementation used by Curie-based devices 15 | [can be seen here](https://github.com/foss-for-synopsys-dwc-arc-processors/glibc). 16 | 17 | * Curie-based boards have a different memory layout than AVR-based boards. See 18 | the [linker script](https://github.com/01org/corelibs-arduino101/blob/master/variants/arduino_101/linker_scripts/flash.ld) 19 | for Arduino/Genuino 101 for details of the memory layout 20 | for Curie-based devices. 21 | 22 | ## Functions 23 | 24 | 25 | `int freeHeap (void)` 26 | 27 | Returns the number of bytes free in the heap, i.e. the number of bytes free 28 | to be allocated using `malloc()`. 29 | 30 | `int freeStack (void)` 31 | 32 | Returns the number of bytes free in the stack, i.e. the space between the 33 | current stack frame and the end of the stack area. This function will return 34 | a negative number in the event of a stack overflow, representing the size of 35 | the overflow; for example, a return value of -20 means that the current stack 36 | frame is 20 bytes past the end of the stack area. 37 | 38 | `int freeMemory (void)` 39 | 40 | Returns the number of bytes free in both the stack and the heap. If a stack 41 | overflow has occurred, only the number of bytes free in the heap is returned. 42 | -------------------------------------------------------------------------------- /libraries/MemoryFree/src/MemoryFree.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * MemoryFree.cpp: taken from http://playground.arduino.cc/Code/AvailableMemory, 3 | * re-written for the Arduino 101 which uses a different malloc implementation. 4 | * 5 | * Arduino 101 malloc source: 6 | * https://github.com/foss-for-synopsys-dwc-arc-processors/glibc 7 | * 8 | * mallinfo() struct details: 9 | * http://man7.org/linux/man-pages/man3/mallinfo.3.html 10 | * 11 | * Copyright (c) 2017 Intel Corporation. All rights reserved. 12 | * 13 | * This library is free software; you can redistribute it and/or 14 | * modify it under the terms of the GNU Lesser General Public 15 | * License as published by the Free Software Foundation; either 16 | * version 2.1 of the License, or (at your option) any later version. 17 | 18 | * This library is distributed in the hope that it will be useful, 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21 | * Lesser General Public License for more details. 22 | 23 | * You should have received a copy of the GNU Lesser General Public 24 | * License along with this library; if not, write to the Free Software 25 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 26 | * 27 | */ 28 | 29 | #include 30 | #include "MemoryFree.h" 31 | 32 | extern char __start_heap; 33 | extern char __end_heap; 34 | extern char __stack_size; 35 | extern char __stack_start; 36 | 37 | int freeStack() { 38 | int stack_end; 39 | int mark; 40 | 41 | stack_end = ((int)&__stack_start) - ((int)&__stack_size); 42 | return ((int)&mark) - stack_end; 43 | } 44 | 45 | int freeHeap (void) { 46 | int hsize; 47 | struct mallinfo mi; 48 | 49 | mi = mallinfo(); 50 | hsize = (int)&__end_heap - (int)&__start_heap; 51 | return (hsize - mi.arena) + mi.fordblks; 52 | } 53 | 54 | int freeMemory (void) { 55 | int heap = freeHeap(); 56 | int stack = freeStack(); 57 | return (stack < 0) ? heap : stack + heap; 58 | } 59 | -------------------------------------------------------------------------------- /system/libarc32_arduino101/framework/include/cfw_platform.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, Intel Corporation. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * 3. Neither the name of the copyright holder nor the names of its contributors 15 | * may be used to endorse or promote products derived from this software without 16 | * specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | * POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef __CFW_PLATFORM_H_ 32 | #define __CFW_PLATFORM_H_ 33 | 34 | #include 35 | #include "os/os_types.h" 36 | 37 | #ifdef __cplusplus 38 | extern "C" { 39 | #endif 40 | 41 | void cfw_platform_init(void); 42 | T_QUEUE cfw_get_service_queue(void); 43 | 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /system/libarc32_arduino101/bootcode/version.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, Intel Corporation. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * 3. Neither the name of the copyright holder nor the names of its contributors 15 | * may be used to endorse or promote products derived from this software without 16 | * specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | * POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #include "infra/version.h" 32 | 33 | /* The content of this struct is overwritten in a post-build script */ 34 | const struct version_header version_header __attribute__((section(".version_header"))) = { 35 | .magic = {'$', 'B', '!', 'N'}, 36 | .version = 0x01, 37 | .reserved_1 = {0, 0, 0, 0}, 38 | .reserved_2 = {0, 0, 0, 0}, 39 | }; 40 | -------------------------------------------------------------------------------- /system/libarc32_arduino101/framework/include/infra/time.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, Intel Corporation. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * 3. Neither the name of the copyright holder nor the names of its contributors 15 | * may be used to endorse or promote products derived from this software without 16 | * specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | * POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef __INFRA_TIME_H__ 32 | #define __INFRA_TIME_H__ 33 | #include 34 | 35 | /** 36 | * returns the platform uptime in ms unit 37 | */ 38 | uint32_t get_uptime_ms(void); 39 | 40 | /** 41 | * returns the platform uptime in 32k clock unit 42 | */ 43 | uint32_t get_uptime_32k(void); 44 | 45 | #endif /* __INFRA_TIME_H__ */ 46 | -------------------------------------------------------------------------------- /system/libarc32_arduino101/common/compiler.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, Intel Corporation. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * 3. Neither the name of the copyright holder nor the names of its contributors 15 | * may be used to endorse or promote products derived from this software without 16 | * specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | * POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef _COMPILER_H__ 32 | #define _COMPILER_H__ 33 | 34 | #ifdef __GNUC__ 35 | 36 | #define _Usually(x) __builtin_expect(!!((x)), 1) 37 | #define _Rarely(x) __builtin_expect(!!((x)), 0) 38 | #define _sr(_src_, _reg_) __builtin_arc_sr((unsigned int)_src_, _reg_) 39 | #define _lr(_reg_) __builtin_arc_lr(_reg_) 40 | #define _nop() 41 | 42 | #endif 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /libraries/CurieIMU/examples/Accelerometer/Accelerometer.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Intel Corporation. All rights reserved. 3 | * See the bottom of this file for the license terms. 4 | */ 5 | 6 | /* 7 | This sketch example demonstrates how the BMI160 on the 8 | Intel(R) Curie(TM) module can be used to read accelerometer data 9 | */ 10 | 11 | #include "CurieIMU.h" 12 | 13 | void setup() { 14 | Serial.begin(9600); // initialize Serial communication 15 | while (!Serial); // wait for the serial port to open 16 | 17 | // initialize device 18 | Serial.println("Initializing IMU device..."); 19 | CurieIMU.begin(); 20 | 21 | // Set the accelerometer range to 2G 22 | CurieIMU.setAccelerometerRange(2); 23 | } 24 | 25 | void loop() { 26 | float ax, ay, az; //scaled accelerometer values 27 | 28 | // read accelerometer measurements from device, scaled to the configured range 29 | CurieIMU.readAccelerometerScaled(ax, ay, az); 30 | 31 | // display tab-separated accelerometer x/y/z values 32 | Serial.print("a:\t"); 33 | Serial.print(ax); 34 | Serial.print("\t"); 35 | Serial.print(ay); 36 | Serial.print("\t"); 37 | Serial.print(az); 38 | Serial.println(); 39 | } 40 | 41 | /* 42 | Copyright (c) 2016 Intel Corporation. All rights reserved. 43 | 44 | This library is free software; you can redistribute it and/or 45 | modify it under the terms of the GNU Lesser General Public 46 | License as published by the Free Software Foundation; either 47 | version 2.1 of the License, or (at your option) any later version. 48 | 49 | This library is distributed in the hope that it will be useful, 50 | but WITHOUT ANY WARRANTY; without even the implied warranty of 51 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 52 | Lesser General Public License for more details. 53 | 54 | You should have received a copy of the GNU Lesser General Public 55 | License along with this library; if not, write to the Free Software 56 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 57 | 58 | */ 59 | 60 | -------------------------------------------------------------------------------- /system/libarc32_arduino101/drivers/clk_system.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, Intel Corporation. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * 3. Neither the name of the copyright holder nor the names of its contributors 15 | * may be used to endorse or promote products derived from this software without 16 | * specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | * POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #include "clk_system.h" 32 | #include "scss_registers.h" 33 | 34 | void set_clock_gate(struct clk_gate_info_s* clk_gate_info, uint32_t value) 35 | { 36 | uint32_t tmp ; 37 | tmp = MMIO_REG_VAL(clk_gate_info->clk_gate_register); 38 | tmp &= ~(clk_gate_info->bits_mask); 39 | tmp |= ((clk_gate_info->bits_mask) & value); 40 | MMIO_REG_VAL(clk_gate_info->clk_gate_register) = tmp; 41 | } 42 | -------------------------------------------------------------------------------- /libraries/EEPROM/examples/eeprom_get/eeprom_get.ino: -------------------------------------------------------------------------------- 1 | /*** 2 | eeprom_get example. 3 | 4 | This shows how to use the EEPROM.get() method. 5 | 6 | To pre-set the EEPROM data, run the example sketch eeprom_put. 7 | This sketch will run without it, however, the values shown 8 | will be shown from what ever is already on the EEPROM. 9 | 10 | This may cause the serial object to print out a large string 11 | of garbage if there is no null character inside one of the strings 12 | loaded. 13 | 14 | Written by Christopher Andrews 2015 15 | Released under MIT licence. 16 | ***/ 17 | 18 | #include 19 | 20 | void setup() { 21 | 22 | float f = 0.00f; //Variable to store data read from EEPROM. 23 | int eeAddress = 0; //EEPROM address to start reading from 24 | 25 | Serial.begin(9600); 26 | while (!Serial) { 27 | ; // wait for serial port to connect. Needed for native USB port only 28 | } 29 | Serial.print("Read float from EEPROM: "); 30 | 31 | //Get the float data from the EEPROM at position 'eeAddress' 32 | EEPROM.get(eeAddress, f); 33 | Serial.println(f, 3); //This may print 'ovf, nan' if the data inside the EEPROM is not a valid float. 34 | 35 | /*** 36 | As get also returns a reference to 'f', you can use it inline. 37 | E.g: Serial.print( EEPROM.get( eeAddress, f ) ); 38 | ***/ 39 | 40 | /*** 41 | Get can be used with custom structures too. 42 | I have separated this into an extra function. 43 | ***/ 44 | 45 | secondTest(); //Run the next test. 46 | } 47 | 48 | struct MyObject { 49 | float field1; 50 | byte field2; 51 | char name[10]; 52 | }; 53 | 54 | void secondTest() { 55 | int eeAddress = sizeof(float); //Move address to the next byte after float 'f'. 56 | 57 | MyObject customVar; //Variable to store custom object read from EEPROM. 58 | EEPROM.get(eeAddress, customVar); 59 | 60 | Serial.println("Read custom object from EEPROM: "); 61 | Serial.println(customVar.field1); 62 | Serial.println(customVar.field2); 63 | Serial.println(customVar.name); 64 | } 65 | 66 | void loop() { 67 | /* Empty loop */ 68 | } 69 | -------------------------------------------------------------------------------- /libraries/EEPROM/examples/eeprom_update/eeprom_update.ino: -------------------------------------------------------------------------------- 1 | /*** 2 | EEPROM Update method 3 | 4 | Stores values read from analog input 0 into the EEPROM. 5 | These values will stay in the EEPROM when the board is 6 | turned off and may be retrieved later by another sketch. 7 | 8 | If a value has not changed in the EEPROM, it is not overwritten 9 | which would reduce the life span of the EEPROM unnecessarily. 10 | 11 | Released using MIT licence. 12 | ***/ 13 | 14 | #include 15 | 16 | /** the current address in the EEPROM (i.e. which byte we're going to write to next) **/ 17 | int address = 0; 18 | 19 | void setup() { 20 | /** EMpty setup **/ 21 | } 22 | 23 | void loop() { 24 | /*** 25 | need to divide by 4 because analog inputs range from 26 | 0 to 1023 and each byte of the EEPROM can only hold a 27 | value from 0 to 255. 28 | ***/ 29 | int val = analogRead(0) / 4; 30 | 31 | /*** 32 | Update the particular EEPROM cell. 33 | these values will remain there when the board is 34 | turned off. 35 | ***/ 36 | EEPROM.update(address, val); 37 | 38 | /*** 39 | The function EEPROM.update(address, val) is equivalent to the following: 40 | 41 | if( EEPROM.read(address) != val ){ 42 | EEPROM.write(address, val); 43 | } 44 | ***/ 45 | 46 | 47 | /*** 48 | Advance to the next address, when at the end restart at the beginning. 49 | 50 | Larger AVR processors have larger EEPROM sizes, E.g: 51 | - Arduno Duemilanove: 512b EEPROM storage. 52 | - Arduino Uno: 1kb EEPROM storage. 53 | - Arduino Mega: 4kb EEPROM storage. 54 | 55 | Rather than hard-coding the length, you should use the pre-provided length function. 56 | This will make your code portable to all AVR processors. 57 | ***/ 58 | address = address + 1; 59 | if (address == EEPROM.length()) { 60 | address = 0; 61 | } 62 | 63 | /*** 64 | As the EEPROM sizes are powers of two, wrapping (preventing overflow) of an 65 | EEPROM address is also doable by a bitwise and of the length - 1. 66 | 67 | ++address &= EEPROM.length() - 1; 68 | ***/ 69 | 70 | delay(100); 71 | } 72 | -------------------------------------------------------------------------------- /system/libarc32_arduino101/framework/src/services/ble/hci_core.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Intel Corporation 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* State tracking for the local Bluetooth controller */ 18 | struct bt_dev { 19 | atomic_t flags[1]; 20 | }; 21 | extern struct bt_dev bt_dev; 22 | 23 | #if defined(CONFIG_BLUETOOTH_SMP) || defined(CONFIG_BLUETOOTH_BREDR) 24 | extern const struct bt_conn_auth_cb *bt_auth; 25 | #endif /* CONFIG_BLUETOOTH_SMP || CONFIG_BLUETOOTH_BREDR */ 26 | 27 | static inline bool bt_addr_le_is_rpa(const bt_addr_le_t *addr) 28 | { 29 | if (addr->type != BT_ADDR_LE_RANDOM) 30 | return false; 31 | 32 | if ((addr->val[5] & 0xc0) == 0x40) 33 | return true; 34 | 35 | return false; 36 | } 37 | 38 | static inline bool bt_addr_le_is_identity(const bt_addr_le_t *addr) 39 | { 40 | if (addr->type == BT_ADDR_LE_PUBLIC) 41 | return true; 42 | 43 | /* Check for Random Static address type */ 44 | if ((addr->val[5] & 0xc0) == 0xc0) 45 | return true; 46 | 47 | return false; 48 | } 49 | 50 | static inline bool bt_le_conn_params_valid(uint16_t min, uint16_t max, 51 | uint16_t latency, uint16_t timeout) 52 | { 53 | if (min > max || min < 6 || max > 3200) { 54 | return false; 55 | } 56 | 57 | /* Limits according to BT Core spec 4.2 [Vol 2, Part E, 7.8.12] */ 58 | if (timeout < 10 || timeout > 3200) { 59 | return false; 60 | } 61 | 62 | /* Limits according to BT Core spec 4.2 [Vol 6, Part B, 4.5.1] */ 63 | if (latency > 499 || ((latency + 1) * max) > (timeout * 4)) { 64 | return false; 65 | } 66 | 67 | return true; 68 | } 69 | 70 | 71 | -------------------------------------------------------------------------------- /cores/arduino/wiring.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015 Intel Corporation. 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. See the GNU 12 | Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | 18 | */ 19 | 20 | #include "Arduino.h" 21 | 22 | #include "wiring.h" 23 | #include "data_type.h" 24 | #include "conf.h" 25 | #include "interrupt.h" 26 | #include "aux_regs.h" 27 | #include "board.h" 28 | 29 | #define FREQ_MHZ ((ARCV2_TIMER0_CLOCK_FREQ)/1000000) 30 | static const uint64_t MS_TO_CLKS = (FREQ_MHZ * 1000); 31 | 32 | static inline __attribute__((always_inline)) 33 | uint64_t getTimeStampClks(void) 34 | { 35 | uint32_t time_stamp; 36 | int key = interrupt_lock(); 37 | uint64_t ret = timer0_overflows; 38 | time_stamp = aux_reg_read(ARC_V2_TMR0_COUNT); 39 | if (aux_reg_read(ARC_V2_TMR0_CONTROL) & (0x01 << 3)) { 40 | time_stamp = aux_reg_read(ARC_V2_TMR0_COUNT); 41 | ret++; 42 | } 43 | interrupt_unlock(key); 44 | return ((ret << 32) | time_stamp); 45 | } 46 | 47 | void delay(uint32_t msec) 48 | { 49 | uint64_t initial_timestamp = getTimeStampClks(); 50 | uint64_t delay_clks = msec * MS_TO_CLKS; 51 | 52 | while (getTimeStampClks() - initial_timestamp < delay_clks) { 53 | yield(); 54 | } 55 | } 56 | 57 | 58 | uint64_t millis(void) 59 | { 60 | uint64_t timestamp = getTimeStampClks(); 61 | return (uint64_t)(timestamp / (FREQ_MHZ * 1000)); 62 | } 63 | 64 | uint64_t micros(void) 65 | { 66 | uint64_t timestamp = getTimeStampClks(); 67 | /* Divide by FREQ_MHZ and return */ 68 | return (timestamp >> 5); 69 | } 70 | -------------------------------------------------------------------------------- /cores/arduino/printk.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, Intel Corporation. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * 3. Neither the name of the copyright holder nor the names of its contributors 15 | * may be used to endorse or promote products derived from this software without 16 | * specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | * POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #include 32 | #include 33 | #include "UARTClass.h" 34 | 35 | extern "C" void printk(const char *fmt, va_list args); 36 | extern UARTClass Serial1; 37 | #define PRINTK_BUFSIZ 256 38 | 39 | void printk(const char *fmt, va_list args) 40 | { 41 | #ifdef CONFIGURE_DEBUG_CORELIB_ENABLED 42 | int len = 0; 43 | 44 | char tmp[PRINTK_BUFSIZ]; 45 | 46 | len = vsnprintf(tmp, PRINTK_BUFSIZ, fmt, args); 47 | 48 | tmp[len] = '\0'; 49 | Serial1.println(tmp); 50 | #endif 51 | } 52 | 53 | -------------------------------------------------------------------------------- /system/libarc32_arduino101/framework/src/services/ble/l2cap.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Intel Corporation 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include 19 | 20 | #include 21 | 22 | #include "conn_internal.h" 23 | #include "gatt_internal.h" 24 | #include "smp.h" 25 | 26 | /* #define BT_GATT_DEBUG 1 */ 27 | 28 | extern void on_nble_curie_log(char *fmt, ...); 29 | extern void __assert_fail(void); 30 | #ifdef BT_GATT_DEBUG 31 | #define BT_DBG(fmt, ...) on_nble_curie_log(fmt, ##__VA_ARGS__) 32 | #define BT_ERR(fmt, ...) on_nble_curie_log(fmt, ##__VA_ARGS__) 33 | #define BT_WARN(fmt, ...) on_nble_curie_log(fmt, ##__VA_ARGS__) 34 | #define BT_INFO(fmt, ...) on_nble_curie_log(fmt, ##__VA_ARGS__) 35 | #define BT_ASSERT(cond) ((cond) ? (void)0 : __assert_fail()) 36 | #else 37 | #define BT_DBG(fmt, ...) do {} while (0) 38 | #define BT_ERR(fmt, ...) on_nble_curie_log(fmt, ##__VA_ARGS__) 39 | #define BT_WARN(fmt, ...) on_nble_curie_log(fmt, ##__VA_ARGS__) 40 | #define BT_INFO(fmt, ...) on_nble_curie_log(fmt, ##__VA_ARGS__) 41 | #define BT_ASSERT(cond) ((cond) ? (void)0 : __assert_fail()) 42 | #endif 43 | 44 | void bt_l2cap_connected(struct bt_conn *conn) 45 | { 46 | /* TODO Add support for fixed channels on BR/EDR transport */ 47 | if (conn->type != BT_CONN_TYPE_LE) { 48 | return; 49 | } 50 | #if defined(CONFIG_BLUETOOTH_SMP) 51 | bt_smp_connected(conn); 52 | #endif 53 | bt_gatt_connected(conn); 54 | } 55 | 56 | void bt_l2cap_disconnected(struct bt_conn *conn) 57 | { 58 | #if defined(CONFIG_BLUETOOTH_SMP) 59 | bt_smp_disconnected(conn); 60 | #endif 61 | bt_gatt_disconnected(conn); 62 | } 63 | -------------------------------------------------------------------------------- /system/libarc32_arduino101/framework/src/infra/log_impl_printk.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, Intel Corporation. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * 3. Neither the name of the copyright holder nor the names of its contributors 15 | * may be used to endorse or promote products derived from this software without 16 | * specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | * POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #include 32 | #include "log_impl.h" 33 | #include "infra/log_backend.h" 34 | 35 | //extern int printk(const char * format, ...); 36 | extern void printk(const char *fmt, va_list args); 37 | 38 | uint32_t log_write_msg(uint8_t level, uint8_t module, const char *format, 39 | va_list args) 40 | { 41 | // TODO - implement printk 42 | printk(format, args); 43 | return 0; 44 | } 45 | 46 | void log_flush() { 47 | return; 48 | } 49 | 50 | void log_impl_init() { 51 | return; 52 | } 53 | 54 | void log_set_backend(struct log_backend backend) { 55 | return; 56 | } 57 | -------------------------------------------------------------------------------- /libraries/SPI/examples/DigitalPotControl/DigitalPotControl.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Digital Pot Control 3 | 4 | This example controls an Analog Devices AD5206 digital potentiometer. 5 | The AD5206 has 6 potentiometer channels. Each channel's pins are labeled 6 | A - connect this to voltage 7 | W - this is the pot's wiper, which changes when you set it 8 | B - connect this to ground. 9 | 10 | The AD5206 is SPI-compatible,and to command it, you send two bytes, 11 | one with the channel number (0 - 5) and one with the resistance value for the 12 | channel (0 - 255). 13 | 14 | The circuit: 15 | * All A pins of AD5206 connected to +5V 16 | * All B pins of AD5206 connected to ground 17 | * An LED and a 220-ohm resisor in series connected from each W pin to ground 18 | * CS - to digital pin 10 (SS pin) 19 | * SDI - to digital pin 11 (MOSI pin) 20 | * CLK - to digital pin 13 (SCK pin) 21 | 22 | created 10 Aug 2010 23 | by Tom Igoe 24 | 25 | Thanks to Heather Dewey-Hagborg for the original tutorial, 2005 26 | 27 | */ 28 | 29 | 30 | // inslude the SPI library: 31 | #include 32 | 33 | 34 | // set pin 10 as the slave select for the digital pot: 35 | const int slaveSelectPin = 10; 36 | 37 | void setup() { 38 | // set the slaveSelectPin as an output: 39 | pinMode (slaveSelectPin, OUTPUT); 40 | // initialize SPI: 41 | SPI.begin(); 42 | } 43 | 44 | void loop() { 45 | // go through the six channels of the digital pot: 46 | for (int channel = 0; channel < 6; channel++) { 47 | // change the resistance on this channel from min to max: 48 | for (int level = 0; level < 255; level++) { 49 | digitalPotWrite(channel, level); 50 | delay(10); 51 | } 52 | // wait a second at the top: 53 | delay(100); 54 | // change the resistance on this channel from max to min: 55 | for (int level = 0; level < 255; level++) { 56 | digitalPotWrite(channel, 255 - level); 57 | delay(10); 58 | } 59 | } 60 | 61 | } 62 | 63 | void digitalPotWrite(int address, int value) { 64 | // take the SS pin low to select the chip: 65 | digitalWrite(slaveSelectPin, LOW); 66 | delay(100); 67 | // send in the address and value via SPI: 68 | SPI.transfer(address); 69 | SPI.transfer(value); 70 | delay(100); 71 | // take the SS pin high to de-select the chip: 72 | digitalWrite(slaveSelectPin, HIGH); 73 | } 74 | -------------------------------------------------------------------------------- /libraries/CurieI2S/examples/I2SDMA_TXCallBack/I2SDMA_TXCallBack.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Intel Corporation. All rights reserved. 3 | * See the bottom of this file for the license terms. 4 | */ 5 | 6 | //I2S_TX -> Pin 7 7 | //I2S_TSK -> Pin 4 8 | //I2S_TSCK -> pin 2 9 | 10 | #include 11 | 12 | const int BUFF_SIZE=64; 13 | bool blinkState = true; // state of the LED 14 | uint32_t dataBuff[BUFF_SIZE]; 15 | uint32_t loop_count = 0; 16 | void setup() 17 | { 18 | Serial.begin(115200); // initialize Serial communication 19 | while(!Serial) ; // wait for serial port to connect. 20 | Serial.println("CurieI2SDMA Tx Callback"); 21 | 22 | CurieI2SDMA.iniTX(); 23 | /* 24 | * CurieI2SDMA.beginTX(sample_rate, resolution, master,mode) 25 | * mode 1 : PHILIPS_MODE 26 | * 2 : RIGHT_JST_MODE 27 | * 3 : LEFT_JST_MODE 28 | * 4 : DSP_MODE 29 | */ 30 | CurieI2SDMA.beginTX(44100, 32,1, 1); 31 | digitalWrite(13, blinkState); 32 | } 33 | 34 | void loop() 35 | { 36 | for(uint32_t i = 0; i 26 | #include 27 | #include "intel_qrk_i2c.h" 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | #define I2C_ABRT_10ADDR1_NOACK (1 << 1) 34 | #define I2C_ABRT_10ADDR2_NOACK (1 << 2) 35 | 36 | int soc_i2c_open_adapter(SOC_I2C_CONTROLLER controller_id, uint32_t address, int i2c_speed, int i2c_addr_mode); 37 | void soc_i2c_close_adapter(SOC_I2C_CONTROLLER controller_id); 38 | void soc_i2c_set_speed(SOC_I2C_CONTROLLER controller_id, uint32_t speed); 39 | void soc_i2c_set_address_mode(SOC_I2C_CONTROLLER controller_id, uint32_t mode); 40 | void soc_i2c_master_set_slave_address(SOC_I2C_CONTROLLER controller_id, uint32_t addr); 41 | int soc_i2c_master_witebytes(SOC_I2C_CONTROLLER controller_id, uint8_t *bytes, uint8_t length, bool no_stop); 42 | int soc_i2c_master_readbytes(SOC_I2C_CONTROLLER controller_id, uint8_t *buf, int length, bool no_stop); 43 | void soc_i2c_slave_set_rx_user_callback(SOC_I2C_CONTROLLER controller_id, void (*onReceiveCallback)(int, void *), void *callerDataPtr); 44 | void soc_i2c_slave_set_tx_user_callback(SOC_I2C_CONTROLLER controller_id, void (*onRequestCallback)(void *), void *callerDataPtr); 45 | void soc_i2c_slave_set_rx_user_buffer(SOC_I2C_CONTROLLER controller_id, uint8_t *buffer, uint8_t length); 46 | void soc_i2c_slave_set_tx_user_buffer(SOC_I2C_CONTROLLER controller_id, uint8_t *buffer, uint8_t length); 47 | 48 | #ifdef __cplusplus 49 | } 50 | #endif 51 | #endif /* soc_i2c_h */ 52 | -------------------------------------------------------------------------------- /libraries/CurieBLE/src/internal/BLEAttribute.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Intel Corporation. All rights reserved. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | * 18 | */ 19 | 20 | #ifndef _BLE_ATTRIBUTE_H_INCLUDED 21 | #define _BLE_ATTRIBUTE_H_INCLUDED 22 | 23 | #include "BLECommon.h" 24 | 25 | /// BLE attribute tyep enum 26 | typedef enum { 27 | BLETypeService = 0x2800, ///< the service type 28 | BLETypeCharacteristic = 0x2803, ///< the characteristic type 29 | BLETypeDescriptor = 0x2900 ///< the descriptor type 30 | }BLEAttributeType; 31 | 32 | 33 | class BLEAttribute { 34 | public: 35 | /** 36 | * @brief Get the UUID raw data 37 | * 38 | * @param none 39 | * 40 | * @return bt_uuid_t* The pointer of UUID 41 | * 42 | * @note none 43 | */ 44 | const bt_uuid_t *bt_uuid(void); 45 | 46 | /** 47 | * @brief Compare the UUID with the paramater data 48 | * 49 | * @param[in] data The pointer of data 50 | * 51 | * @param[in] uuidsize The max size of UUID 52 | * 53 | * @return bool true - UUID is the same with data 54 | * false- UUID is not the same with data 55 | * 56 | * @note none 57 | */ 58 | bool compareUuid(const char* uuid); 59 | bool compareUuid(const bt_uuid_t* uuid); 60 | 61 | BLEAttributeType type(void) const; 62 | 63 | protected: 64 | BLEAttribute(const char* uuid, BLEAttributeType type); 65 | BLEAttribute(const bt_uuid_t* uuid, BLEAttributeType type); 66 | private: 67 | bt_uuid_128_t _uuid; 68 | 69 | BLEAttributeType _type; 70 | 71 | }; 72 | 73 | #endif // _BLE_ATTRIBUTE_H_INCLUDED 74 | -------------------------------------------------------------------------------- /system/libarc32_arduino101/framework/include/infra/log_backend.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, Intel Corporation. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * 3. Neither the name of the copyright holder nor the names of its contributors 15 | * may be used to endorse or promote products derived from this software without 16 | * specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | * POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef __LOG_BACKEND_H 32 | #define __LOG_BACKEND_H 33 | 34 | #include 35 | 36 | /** 37 | * @ingroup infra_log 38 | * @{ 39 | */ 40 | 41 | /** 42 | * Provide the final low level function used to output logs on a backend. 43 | * 44 | * Implementation of a log_backend need to provide valid functions for these 2 45 | * callbacks. 46 | */ 47 | struct log_backend { 48 | /** 49 | * Print the content of the passed buffer to the backend. 50 | * Note that no additional line return is added at the end of the string. 51 | * @param buffer the ASCII text buffer 52 | * @param len the length of the buffer to print 53 | */ 54 | void (*put_one_msg)(const char *buffer, uint16_t len); 55 | }; 56 | 57 | /** @} */ 58 | 59 | #endif /* __LOG_BACKEND_H */ 60 | -------------------------------------------------------------------------------- /cores/arduino/wiring_private.h: -------------------------------------------------------------------------------- 1 | /* 2 | wiring_private.h - Internal header file. 3 | Part of Arduino - http://www.arduino.cc/ 4 | 5 | Copyright (c) 2005-2006 David A. Mellis 6 | 7 | This library is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU Lesser General Public 9 | License as published by the Free Software Foundation; either 10 | version 2.1 of the License, or (at your option) any later version. 11 | 12 | This library is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | Lesser General Public License for more details. 16 | 17 | You should have received a copy of the GNU Lesser General 18 | Public License along with this library; if not, write to the 19 | Free Software Foundation, Inc., 59 Temple Place, Suite 330, 20 | Boston, MA 02111-1307 USA 21 | 22 | $Id: wiring.h 239 2007-01-12 17:58:39Z mellis $ 23 | 24 | Modified to allow compiling for Arduino 101 - September 2015 25 | */ 26 | 27 | #ifndef WiringPrivate_h 28 | #define WiringPrivate_h 29 | 30 | #include 31 | #include 32 | 33 | #include "Arduino.h" 34 | 35 | #ifdef __cplusplus 36 | extern "C"{ 37 | #endif 38 | 39 | #ifndef cbi 40 | #define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit)) 41 | #endif 42 | #ifndef sbi 43 | #define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit)) 44 | #endif 45 | 46 | uint32_t countPulseASM(volatile uint8_t *port, uint8_t bit, uint8_t stateMask, unsigned long maxloops); 47 | 48 | #define EXTERNAL_INT_0 0 49 | #define EXTERNAL_INT_1 1 50 | #define EXTERNAL_INT_2 2 51 | #define EXTERNAL_INT_3 3 52 | #define EXTERNAL_INT_4 4 53 | #define EXTERNAL_INT_5 5 54 | #define EXTERNAL_INT_6 6 55 | #define EXTERNAL_INT_7 7 56 | 57 | #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega128RFA1__) || defined(__AVR_ATmega256RFR2__) 58 | #define EXTERNAL_NUM_INTERRUPTS 8 59 | #elif defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) || defined(__AVR_ATmega644__) || defined(__AVR_ATmega644A__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644PA__) 60 | #define EXTERNAL_NUM_INTERRUPTS 3 61 | #elif defined(__AVR_ATmega32U4__) 62 | #define EXTERNAL_NUM_INTERRUPTS 5 63 | #else 64 | #define EXTERNAL_NUM_INTERRUPTS 2 65 | #endif 66 | 67 | typedef void (*voidFuncPtr)(void); 68 | 69 | #ifdef __cplusplus 70 | } // extern "C" 71 | #endif 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /system/libarc32_arduino101/framework/src/services/ble_service/nble_driver.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, Intel Corporation. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * 3. Neither the name of the copyright holder nor the names of its contributors 15 | * may be used to endorse or promote products derived from this software without 16 | * specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | * POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef NBLE_DRIVER_H_ 32 | #define NBLE_DRIVER_H_ 33 | 34 | #include "os/os.h" 35 | #include "infra/message.h" 36 | 37 | struct ble_rpc_callin { 38 | struct message msg; /**< Message header, MUST be first element of structure */ 39 | uint8_t *p_data; /**< RPC buffer, must be freed after deserializing */ 40 | uint16_t len; /**< length of above buffer */ 41 | }; 42 | 43 | /** 44 | * This resets and initializes the uart/ipc mechanism of nble. 45 | * 46 | * This this will trigger the call to @ref on_nble_up indicating that rpc 47 | * mechanism is up and running. 48 | */ 49 | void nble_driver_init(void); 50 | 51 | void nble_driver_configure(T_QUEUE queue, void (*handler)(struct message*, void*)); 52 | 53 | void uart_ipc_disable(void); 54 | 55 | #endif /* NBLE_DRIVER_H_ */ 56 | -------------------------------------------------------------------------------- /system/libarc32_arduino101/framework/src/services/ble_service/ble_protocol.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, Intel Corporation. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * 3. Neither the name of the copyright holder nor the names of its contributors 15 | * may be used to endorse or promote products derived from this software without 16 | * specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | * POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef __BLE_PROTOCOL_H__ 32 | #define __BLE_PROTOCOL_H__ 33 | 34 | /** 35 | * @defgroup ble_protocol BLE protocol definitions 36 | * 37 | * BT Spec definitions. 38 | * @ingroup ble_service 39 | * @{ 40 | * 41 | * Bluetooth SIG defined macros and enum extracted from Bluetooth Spec 4.2 42 | */ 43 | #define BLE_MAX_DEVICE_NAME 20 /**< Max BLE device name length 20 + NULL, spec size: 248 */ 44 | #define BLE_MAX_ADV_SIZE 31 45 | 46 | #define BLE_GATT_MTU_SIZE 23 /**< Default MTU size */ 47 | 48 | /** Manufacturer IDs */ 49 | #define INTEL_MANUFACTURER 0x0002 50 | 51 | /* HCI status (error) codes as per BT spec */ 52 | #define HCI_REMOTE_DEV_TERMINATION_DUE_TO_POWER_OFF 0x15 53 | #define HCI_LOCAL_HOST_TERMINATED_CONNECTION 0x16 54 | 55 | /** @} */ 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /cores/arduino/CDCSerialClass.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011 Arduino. All right reserved. 3 | Copyright (c) 2015 Intel Corporation. All rights reserved. 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | See the GNU Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | CDC-ACM class for Arduino 101 - Aug 2015 20 | 21 | */ 22 | 23 | #ifndef _CFWSERIAL_CLASS_ 24 | #define _CFWSERIAL_CLASS_ 25 | 26 | #include "HardwareSerial.h" 27 | #include "platform.h" 28 | #include "wiring.h" 29 | #include "mailbox.h" 30 | 31 | #include 32 | #include 33 | 34 | class CDCSerialClass : public HardwareSerial 35 | { 36 | public: 37 | CDCSerialClass(uart_init_info *info); 38 | 39 | void setSharedData(struct cdc_acm_shared_data *cdc_acm_shared_data); 40 | 41 | struct cdc_acm_shared_data *_shared_data; 42 | struct cdc_ring_buffer *_rx_buffer; 43 | struct cdc_ring_buffer *_tx_buffer; 44 | 45 | void begin(const uint32_t dwBaudRate); 46 | void begin(const uint32_t dwBaudRate, const uint8_t config); 47 | void end(void); 48 | int available(void); 49 | int availableForWrite(void); 50 | int peek(void); 51 | int read(void); 52 | void flush(void); 53 | size_t write(const uint8_t c); 54 | size_t write(const char *str); 55 | size_t write(const uint8_t *buffer, size_t size); 56 | using Print::write; // pull in write(str) and write(buf, size) from Print 57 | 58 | operator bool() { 59 | /* In case bool() is called in a very tight while loop, give LMT space 60 | * to set the variable */ 61 | delay(1); 62 | return (_shared_data && _shared_data->host_open); 63 | }; 64 | 65 | protected: 66 | void init(uint32_t dwBaudRate, const uint8_t config); 67 | 68 | uart_init_info *info; 69 | uint32_t _writeDelayUsec; 70 | uint32_t _dwId; 71 | }; 72 | 73 | #endif // _CDCSerial_CLASS_ 74 | -------------------------------------------------------------------------------- /system/libarc32_arduino101/bootcode/c_init.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015 Intel Corporation. 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. See the GNU 12 | Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | 18 | */ 19 | #include 20 | #include 21 | 22 | #include "interrupt.h" 23 | #include "arcv2_timer0.h" 24 | #include "os/os.h" 25 | 26 | /* Application main() function prototype */ 27 | extern int main (void); 28 | 29 | /* C++ constructor function prototype */ 30 | typedef void (*cpp_ctor_fn) (void); 31 | /* C++ constructor list */ 32 | extern cpp_ctor_fn __CTOR_LIST__[]; 33 | 34 | /* BSS section markers */ 35 | extern char __bss_start[]; 36 | extern char __bss_end[]; 37 | 38 | /* DATA section markers */ 39 | extern char __data_rom_start[]; 40 | extern char __data_ram_start[]; 41 | extern char __data_ram_end[]; 42 | 43 | static void _exec_ctors (void) 44 | { 45 | unsigned long i, nctors = (unsigned long)(__CTOR_LIST__[0]); 46 | 47 | for (i = nctors; i > 0; i--) 48 | __CTOR_LIST__[i](); 49 | } 50 | 51 | __attribute__((__noreturn__)) void _main (void) 52 | { 53 | /* Zero BSS section */ 54 | memset(__bss_start, 0, __bss_end - __bss_start); 55 | /* Relocate DATA section to RAM */ 56 | memcpy(__data_ram_start, __data_rom_start, __data_ram_end - __data_ram_start); 57 | /* Execute C++ Constructors */ 58 | _exec_ctors(); 59 | /* Init the the interrupt unit device - disable all the interrupts; The 60 | * default value of IRQ_ENABLE is 0x01 for all configured interrupts */ 61 | interrupt_unit_device_init(); 62 | /* Start the system's virtual 64-bit Real Time Counter */ 63 | timer0_driver_init(); 64 | /* Initialize the memory buffer for balloc() calls. */ 65 | os_abstraction_init_malloc(); 66 | /* Jump to application main() */ 67 | main (); 68 | /* Never reached */ 69 | __builtin_unreachable(); 70 | } 71 | -------------------------------------------------------------------------------- /libraries/CurieIMU/examples/FreeFallDetect/FreeFallDetect.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Intel Corporation. All rights reserved. 3 | See the bottom of this file for license terms. 4 | */ 5 | 6 | /* 7 | This sketch example demonstrates how the BMI160 accelerometer on the 8 | Intel(R) Curie(TM) module can be used to detect free fall events 9 | */ 10 | 11 | #include "CurieIMU.h" 12 | 13 | bool blinkState = false; // state of the LED 14 | unsigned long loopTime = 0; // get the time since program started 15 | unsigned long interruptsTime = 0; // get the time when free fall event is detected 16 | 17 | 18 | void setup() { 19 | Serial.begin(9600); // initialize Serial communication 20 | while(!Serial) ; // wait for serial port to connect. 21 | 22 | /* Initialise the IMU */ 23 | CurieIMU.begin(); 24 | CurieIMU.attachInterrupt(eventCallback); 25 | 26 | /* Enable Free Fall Detection */ 27 | CurieIMU.setDetectionThreshold(CURIE_IMU_FREEFALL, 1000); // 1g=1000mg 28 | CurieIMU.setDetectionDuration(CURIE_IMU_FREEFALL, 50); // 50ms 29 | CurieIMU.interrupts(CURIE_IMU_FREEFALL); 30 | 31 | Serial.println("IMU initialisation complete, waiting for events..."); 32 | } 33 | 34 | void loop() { 35 | // if free fall event is detected in 1000ms, LED will be turned up 36 | loopTime = millis(); 37 | if(abs(loopTime -interruptsTime) < 1000 ) 38 | blinkState = true; 39 | else 40 | blinkState = false; 41 | digitalWrite(13, blinkState); 42 | } 43 | 44 | static void eventCallback(){ 45 | if (CurieIMU.getInterruptStatus(CURIE_IMU_FREEFALL)) { 46 | Serial.println("free fall detected! "); 47 | interruptsTime = millis(); 48 | } 49 | } 50 | 51 | /* 52 | Copyright (c) 2016 Intel Corporation. All rights reserved. 53 | 54 | This library is free software; you can redistribute it and/or 55 | modify it under the terms of the GNU Lesser General Public 56 | License as published by the Free Software Foundation; either 57 | version 2.1 of the License, or (at your option) any later version. 58 | 59 | This library is distributed in the hope that it will be useful, 60 | but WITHOUT ANY WARRANTY; without even the implied warranty of 61 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 62 | Lesser General Public License for more details. 63 | 64 | You should have received a copy of the GNU Lesser General Public 65 | License along with this library; if not, write to the Free Software 66 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 67 | 68 | */ 69 | -------------------------------------------------------------------------------- /drivers/intc_serial.inf: -------------------------------------------------------------------------------- 1 | ;************************************************************ 2 | ; Windows USB CDC ACM Setup File 3 | ; Copyright (c) 2000 Microsoft Corporation 4 | 5 | 6 | [Version] 7 | Signature="$Windows NT$" 8 | Class=Ports 9 | ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318} 10 | Provider=%MFGNAME% 11 | DriverVer=10/13/2015,5.1.2600.0 12 | CatalogFile = intc_serial.cat 13 | 14 | [Manufacturer] 15 | %MFGNAME%=DeviceList, NTamd64 16 | 17 | [DestinationDirs] 18 | DefaultDestDir=12 19 | 20 | 21 | ;------------------------------------------------------------------------------ 22 | ; Vendor and Product ID Definitions 23 | ;------------------------------------------------------------------------------ 24 | ; When developing your USB device, the VID and PID used in the PC side 25 | ; application program and the firmware on the microcontroller must match. 26 | ; Modify the below line to use your VID and PID. Use the format as shown below. 27 | ; Note: One INF file can be used for multiple devices with different VID and PIDs. 28 | ; For each supported device, append ",USB\VID_xxxx&PID_yyyy" to the end of the line. 29 | ;------------------------------------------------------------------------------ 30 | 31 | [DeviceList] 32 | %DESCRIPTION%=DriverInstall, USB\VID_8087&PID_0AB6 33 | 34 | [DeviceList.NTamd64] 35 | %DESCRIPTION%=DriverInstall, USB\VID_8087&PID_0AB6 36 | 37 | 38 | 39 | ;------------------------------------------------------------------------------ 40 | ; String Definitions 41 | ;------------------------------------------------------------------------------ 42 | ;Modify these strings to customize your device 43 | ;------------------------------------------------------------------------------ 44 | [Strings] 45 | MFGFILENAME="CDC_vista" 46 | DRIVERFILENAME ="usbser" 47 | MFGNAME="http://www.intel.com" 48 | INSTDISK="Arduino 101 Driver Installer" 49 | DESCRIPTION="Arduino 101 Serial Monitor" 50 | SERVICE="USB RS-232 Emulation Driver" 51 | 52 | 53 | [DriverInstall] 54 | include=mdmcpq.inf,usb.inf 55 | CopyFiles = FakeModemCopyFileSection 56 | AddReg=DriverAddReg 57 | 58 | [DriverAddReg] 59 | HKR,,DevLoader,,*ntkern 60 | HKR,,NTMPDriver,,usbser.sys 61 | HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider" 62 | 63 | [DriverInstall.Services] 64 | include=mdmcpq.inf 65 | AddService=usbser, 0x00000002, DriverService 66 | 67 | [DriverService] 68 | DisplayName=%ServiceName% 69 | ServiceType=1 70 | StartType=3 71 | ErrorControl=1 72 | ServiceBinary=%12%\usbser.sys 73 | LoadOrderGroup=Base 74 | -------------------------------------------------------------------------------- /system/libarc32_arduino101/framework/include/cfw/cfw_internal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, Intel Corporation. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * 3. Neither the name of the copyright holder nor the names of its contributors 15 | * may be used to endorse or promote products derived from this software without 16 | * specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | * POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef __CFW_INTERNAL_H__ 32 | #define __CFW_INTERNAL_H__ 33 | 34 | #include "cfw/cfw.h" 35 | #include "cfw/cfw_service.h" 36 | #include "infra/ipc_requests.h" 37 | 38 | #define MAX_SERVICES 16 39 | typedef struct { 40 | handle_msg_cb_t handle_msg; 41 | void *data; 42 | uint16_t client_port_id; 43 | }_cfw_handle_t; 44 | 45 | /** 46 | * This function is called when an sync IPC request is issued 47 | * from a secondary CPU. 48 | * 49 | * \param cpu_id the cpu_id that originated the request 50 | * \param request the request id. 51 | * \param param1 first param 52 | * \param param2 second param 53 | * \param ptr third param 54 | * 55 | * \return the value to be passed as response to the requestor 56 | */ 57 | int handle_ipc_sync_request(uint8_t cpu_id, int request, int param1, 58 | int param2, void * ptr); 59 | 60 | #endif /* __CFW_INTERNAL_H__ */ 61 | -------------------------------------------------------------------------------- /libraries/CurieBLE/src/BLEAttributeWithValue.h: -------------------------------------------------------------------------------- 1 | /* 2 | BLE Attribute with value API 3 | Copyright (c) 2016 Arduino LLC. 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 ARDUINO_BLE_ATTRIBUTE_WITH_VALUE__H 21 | #define ARDUINO_BLE_ATTRIBUTE_WITH_VALUE__H 22 | 23 | class BLEAttributeWithValue 24 | { 25 | public: 26 | BLEAttributeWithValue(); 27 | 28 | virtual int valueSize() const = 0; // returns the length of the attribute value 29 | virtual const byte* value() const = 0; // returns the value of the attribute array 30 | virtual byte operator[] (int offset) const = 0; // access an attribute value at the specified offset 31 | virtual bool writeValue(const byte value[], int length) = 0; 32 | 33 | // intepret the value of the attribute with the specified type 34 | String stringValue() const; 35 | char charValue() const; 36 | unsigned char unsignedCharValue() const; 37 | byte byteValue() const; 38 | short shortValue() const; 39 | unsigned short unsignedShortValue() const; 40 | int intValue() const; 41 | unsigned int unsignedIntValue() const; 42 | long longValue() const; 43 | unsigned long unsignedLongValue() const; 44 | float floatValue() const; 45 | double doubleValue() const; 46 | 47 | // write the value of the attribute with the specified type 48 | bool writeString(const String& s); 49 | bool writeString(const char* s); 50 | bool writeChar(char c); 51 | bool writeUnsignedChar(unsigned char c); 52 | bool writeByte(byte b); 53 | bool writeShort(short s); 54 | bool writeUnsignedShort(unsigned short s); 55 | bool writeInt(int i); 56 | bool writeUnsignedInt(unsigned int i); 57 | bool writeLong(long l); 58 | bool writeUnsignedLong(unsigned int l); 59 | bool writeFloat(float f); 60 | bool writeDouble(double d); 61 | }; 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /libraries/Wire/src/Wire.h: -------------------------------------------------------------------------------- 1 | /* 2 | * TwoWire.h - TWI/I2C library for Linux Userspace 3 | * Copyright (c) 2013 Parav https://github.com/meanbot. 4 | * All rights reserved. 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef TwoWire_h 22 | #define TwoWire_h 23 | 24 | #include "Stream.h" 25 | #include "variant.h" 26 | #include "ss_i2c_iface.h" 27 | 28 | #define BUFFER_LENGTH 32 29 | #define I2C_SPEED_SLOW 1 30 | #define I2C_SPEED_FAST 2 31 | 32 | class TwoWire : public Stream { 33 | public: 34 | TwoWire(I2C_CONTROLLER _controller_id); 35 | void begin(void); 36 | void begin(int speed); 37 | void setClock(long speed); 38 | void beginTransmission(uint8_t); 39 | void beginTransmission(int); 40 | uint8_t endTransmission(void); 41 | uint8_t endTransmission(uint8_t); 42 | uint8_t requestFrom(uint8_t, uint8_t); 43 | uint8_t requestFrom(uint8_t, uint8_t, uint8_t); 44 | uint8_t requestFrom(int, int); 45 | uint8_t requestFrom(int, int, int); 46 | virtual size_t write(uint8_t); 47 | virtual size_t write(const uint8_t *, size_t); 48 | virtual int available(void); 49 | virtual int read(void); 50 | virtual int peek(void); 51 | virtual void flush(void); 52 | 53 | inline size_t write(unsigned long n) { return write((uint8_t)n); } 54 | inline size_t write(long n) { return write((uint8_t)n); } 55 | inline size_t write(unsigned int n) { return write((uint8_t)n); } 56 | inline size_t write(int n) { return write((uint8_t)n); } 57 | using Print::write; 58 | 59 | private: 60 | // RX Buffer 61 | uint8_t *rxBuffer; 62 | uint8_t rxBufferIndex; 63 | uint8_t rxBufferLength; 64 | 65 | // TX Buffer 66 | uint8_t txAddress; 67 | uint8_t *txBuffer; 68 | uint8_t txBufferLength; 69 | 70 | int init_status; 71 | 72 | I2C_CONTROLLER controller_id; 73 | }; 74 | 75 | #if WIRE_INTERFACES_COUNT > 0 76 | extern TwoWire Wire; 77 | #endif 78 | 79 | #endif 80 | 81 | -------------------------------------------------------------------------------- /system/libarc32_arduino101/drivers/clk_system.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, Intel Corporation. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * 3. Neither the name of the copyright holder nor the names of its contributors 15 | * may be used to endorse or promote products derived from this software without 16 | * specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | * POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef CLK_SYSTEM_H_ 32 | #define CLK_SYSTEM_H_ 33 | 34 | #include 35 | 36 | #define CLK_GATE_OFF (0) 37 | #define CLK_GATE_ON (~CLK_GATE_OFF) 38 | 39 | /** 40 | * @defgroup clk_gate Clock gating driver 41 | * Clk Gate driver API. 42 | * @ingroup common_drivers 43 | * @{ 44 | */ 45 | 46 | /** 47 | * Clock gate data which contain register and bits implicated. 48 | */ 49 | struct clk_gate_info_s { 50 | uint32_t clk_gate_register; /*!< register changed for clock gate */ 51 | uint32_t bits_mask; /*!< mask used for clock gate */ 52 | }; 53 | 54 | /** 55 | * Configure clock gate to specified device 56 | * 57 | * @param clk_gate_info : pointer to a clock gate data structure 58 | * @param value : state of clock gate desired 59 | */ 60 | void set_clock_gate(struct clk_gate_info_s* clk_gate_info, uint32_t value); 61 | 62 | /** @} */ 63 | 64 | #endif /* CLK_SYSTEM_H_ */ 65 | -------------------------------------------------------------------------------- /libraries/CurieTimerOne/examples/CurieTimer1Interrupt/CurieTimer1Interrupt.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Sketch: Timer1Interrupt.ino 3 | 4 | This sketch demonstrates the usage of the Curie Timer One Library. 5 | It uses timer-1 to blink the onboard LED, pin 13, at different 6 | intervals (speed) in four steps. 7 | 8 | You can see the time interval and the number of interrupt counted 9 | in 10 seconds if you keep serial logging active, but this may require 10 | a MASTER_RESET to reprogram the board. 11 | 12 | Blinking of the LED will start only when you open the Serial Monitor 13 | unless you comment the "#define SERIAL_PORT_LOG_ENABLE 1"; don't 14 | forget to uncomment "CurieTimerOne.restart(time);" 15 | 16 | created by Intel 17 | Modified 14 March 2016 18 | by Simone Majocchi 19 | 20 | This example code is in the public domain. 21 | */ 22 | 23 | #include "CurieTimerOne.h" 24 | 25 | // Comment the following statement to disable logging on serial port. 26 | #define SERIAL_PORT_LOG_ENABLE 1 27 | 28 | const int oneSecInUsec = 1000000; // A second in mirco second unit. 29 | bool toggle = 0; // The LED status toggle 30 | int time; // the variable used to set the Timer 31 | 32 | void timedBlinkIsr() // callback function when interrupt is asserted 33 | { 34 | digitalWrite(13, toggle); 35 | toggle = !toggle; // use NOT operator to invert toggle value 36 | } 37 | 38 | void setup() { 39 | 40 | #ifdef SERIAL_PORT_LOG_ENABLE 41 | Serial.begin(115200); // initialize Serial communication 42 | while (!Serial); // wait for the serial monitor to open 43 | #endif 44 | 45 | // Initialize pin 13 as an output - onboard LED. 46 | pinMode(13, OUTPUT); 47 | } 48 | 49 | void loop() { 50 | 51 | for (int i = 1; i < 9; i = i * 2) { 52 | // We set a blink rate of 1000000, 500000, 250000, 125000 microseconds 53 | time = oneSecInUsec / i; // time is used to toggle the LED is divided by i 54 | CurieTimerOne.start(time, &timedBlinkIsr); // set timer and callback 55 | 56 | #ifdef SERIAL_PORT_LOG_ENABLE 57 | Serial.print("The blink period: "); 58 | Serial.println(time); 59 | #endif 60 | 61 | delay(10000); // 10 seconds of delay, regularly 'interrupted' by the timer interrupt 62 | 63 | #ifdef SERIAL_PORT_LOG_ENABLE 64 | Serial.print("Total number of ticks in 10 seconds: "); 65 | Serial.println(CurieTimerOne.rdRstTickCount()); // Reads and Resets tick count 66 | Serial.println("----"); 67 | #endif 68 | // Uncomment the following line if the serial logging is disabled 69 | // CurieTimerOne.restart(time); // Restarts Timer 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /system/libarc32_arduino101/drivers/ss_dw_i2c.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * 3 | * Synopsys DesignWare Sensor and Control IP Subsystem IO Software Driver and 4 | * documentation (hereinafter, "Software") is an Unsupported proprietary work 5 | * of Synopsys, Inc. unless otherwise expressly agreed to in writing between 6 | * Synopsys and you. 7 | * 8 | * The Software IS NOT an item of Licensed Software or Licensed Product under 9 | * any End User Software License Agreement or Agreement for Licensed Product 10 | * with Synopsys or any supplement thereto. You are permitted to use and 11 | * redistribute this Software in source and binary forms, with or without 12 | * modification, provided that redistributions of source code must retain this 13 | * notice. You may not view, use, disclose, copy or distribute this file or 14 | * any information contained herein except pursuant to this license grant from 15 | * Synopsys. If you do not agree with this notice, including the disclaimer 16 | * below, then you are not authorized to use the Software. 17 | * 18 | * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, 22 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 28 | * DAMAGE. 29 | * 30 | ******************************************************************************/ 31 | 32 | /******************************************************************************* 33 | * 34 | * Modifications Copyright (c) 2015, Intel Corporation. All rights reserved. 35 | * 36 | ******************************************************************************/ 37 | 38 | #ifndef SS_DW_I2C_H_ 39 | #define SS_DW_I2C_H_ 40 | #include 41 | void i2c_mst_err_ISR_proc(i2c_info_pt dev); 42 | void i2c_fill_fifo(i2c_info_pt dev); 43 | void i2c_mst_rx_avail_ISR_proc(i2c_info_pt dev); 44 | void i2c_mst_tx_req_ISR_proc(i2c_info_pt dev); 45 | void i2c_mst_stop_detected_ISR_proc(i2c_info_pt dev); 46 | 47 | #endif // SS_DW_I2C_H 48 | -------------------------------------------------------------------------------- /system/libarc32_arduino101/framework/src/services/ble_service/ble_service_int.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, Intel Corporation. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * 1. Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * 3. Neither the name of the copyright holder nor the names of its contributors 15 | * may be used to endorse or promote products derived from this software without 16 | * specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | * POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef BLE_SERVICE_INT_H_ 32 | #define BLE_SERVICE_INT_H_ 33 | 34 | #include 35 | 36 | /* For cfw_service_conn_t, cfw_client_t, T_QUEUE */ 37 | #include "cfw/cfw.h" 38 | 39 | /* Forward declarations */ 40 | struct ble_init_svc_req; 41 | struct ble_init_svc_rsp; 42 | struct bt_conn_cb; 43 | struct bt_gatt_attr; 44 | 45 | enum BLE_STATE { 46 | BLE_ST_NOT_READY = 0, 47 | BLE_ST_DISABLED, 48 | BLE_ST_ENABLED, 49 | BLE_ST_DTM 50 | }; 51 | 52 | struct _ble_service_cb { 53 | T_QUEUE queue; /* Queue for the messages */ 54 | uint8_t ble_state; 55 | }; 56 | 57 | extern struct _ble_service_cb _ble_cb; 58 | 59 | /** Send advertisement timeout event to application */ 60 | void ble_gap_advertisement_timeout(void); 61 | 62 | #ifdef CONFIG_BLE_CORE_TEST 63 | void test_ble_service_init(void); 64 | T_QUEUE get_service_queue(void); 65 | #endif 66 | 67 | #endif /* BLE_SERVICE_INT_H_ */ 68 | --------------------------------------------------------------------------------