├── .gitattributes
├── .gitignore
├── .gitlab-ci.yml
├── .gitlab
└── issue_templates
│ ├── Bug.md
│ ├── Discussion.md
│ ├── Feature Request.md
│ └── Text Change.md
├── .gitmodules
├── ClearCore.atsln
├── ClearCoreArduino.cppproj
├── LICENSE
├── README.md
├── Style
├── README.txt
├── configuration
│ ├── astyle.cfg
│ ├── cppcheck_rules.xml
│ └── cppcheck_suppressions.xml
├── run_astyle.bat
└── run_cppcheck.bat
├── TestSketch
├── Device_Startup
│ ├── flash_with_bootloader.ld
│ ├── flash_without_bootloader.ld
│ └── startup_same53.c
├── TestSketch.cpp
└── TestSketch.cppproj
├── boards.txt
├── bootloader
├── bootloader-ClearCore-v2.3.1-Teknic.4.bin
├── bootloader-ClearCore-v2.3.1-Teknic.4.elf
└── update-bootloader-ClearCore-v2.3.1-Teknic.4.uf2
├── cores
└── arduino
│ ├── Arduino.h
│ ├── Ethernet.cpp
│ ├── Ethernet.h
│ ├── EthernetClient.cpp
│ ├── EthernetServer.cpp
│ ├── EthernetUDP.cpp
│ ├── Reset.cpp
│ ├── Reset.h
│ ├── SERCOM.cpp
│ ├── SERCOM.h
│ ├── Tone.cpp
│ ├── Uart.cpp
│ ├── Uart.h
│ ├── Udp.h
│ ├── WMath.cpp
│ ├── WVariant.h
│ ├── abi.cpp
│ ├── api
│ ├── ArduinoAPI.h
│ ├── ArduinoString.h
│ ├── Binary.h
│ ├── Client.h
│ ├── Common.cpp
│ ├── Common.h
│ ├── HardwareI2C.h
│ ├── HardwareSerial.h
│ ├── IPAddress.cpp
│ ├── IPAddress.h
│ ├── Interrupts.h
│ ├── Print.cpp
│ ├── Print.h
│ ├── Printable.h
│ ├── SPI.cpp
│ ├── SPI.h
│ ├── Server.h
│ ├── Stream.cpp
│ ├── Stream.h
│ ├── String.cpp
│ ├── Udp.h
│ ├── WCharacter.h
│ ├── deprecated-avr-comp
│ │ └── avr
│ │ │ ├── dtostrf.h
│ │ │ ├── interrupt.h
│ │ │ └── pgmspace.h
│ ├── deprecated
│ │ ├── Client.h
│ │ ├── HardwareSerial.h
│ │ ├── IPAddress.h
│ │ ├── Print.h
│ │ ├── Printable.h
│ │ ├── Server.h
│ │ ├── Stream.h
│ │ ├── Udp.h
│ │ └── WString.h
│ ├── dtostrf.c
│ ├── itoa.c
│ └── itoa.h
│ ├── delay.cpp
│ ├── delay.h
│ ├── hooks.c
│ ├── main.cpp
│ ├── new.cpp
│ ├── startup_same53.c
│ ├── wiring_analog.cpp
│ ├── wiring_digital.c
│ ├── wiring_digital.h
│ └── wiring_shift.c
├── drivers
├── TeknicClearCore.inf
└── teknicclearcore.cat
├── keywordify.py
├── keywords.txt
├── libraries
├── AnalogIO
│ ├── examples
│ │ ├── ReadAnalogInput
│ │ │ └── ReadAnalogInput.ino
│ │ ├── WriteAnalogCurrentOutput
│ │ │ └── WriteAnalogCurrentOutput.ino
│ │ └── WritePwmOutput
│ │ │ └── WritePwmOutput.ino
│ ├── library.properties
│ └── src
│ │ └── AnalogIO-examples.h
├── CCIO-8
│ ├── examples
│ │ ├── ClearCoreIOExpansionBoard
│ │ │ └── ClearCoreIOExpansionBoard.ino
│ │ ├── ReadCCIODigitalInput
│ │ │ └── ReadCCIODigitalInput.ino
│ │ ├── WriteCCIODigitalOutput
│ │ │ └── WriteCCIODigitalOutput.ino
│ │ └── WriteCCIODigitalOutputPulses
│ │ │ └── WriteCCIODigitalOutputPulses.ino
│ ├── library.properties
│ └── src
│ │ └── ccio8-examples.h
├── ClearCoreBoardStatus
│ ├── examples
│ │ └── ClearCoreStatusRegister
│ │ │ └── ClearCoreStatusRegister.ino
│ ├── library.properties
│ └── src
│ │ └── clearcore-board-status-examples.h
├── ClearPathModeExamples
│ ├── examples
│ │ ├── ClearPath-MC Series
│ │ │ ├── FollowDigitalPosition
│ │ │ │ └── FollowDigitalPosition.ino
│ │ │ ├── FollowDigitalTorque
│ │ │ │ └── FollowDigitalTorque.ino
│ │ │ ├── FollowDigitalVelocity
│ │ │ │ └── FollowDigitalVelocity.ino
│ │ │ ├── FollowDigitalVelocityWithVariableTorque
│ │ │ │ └── FollowDigitalVelocityWithVariableTorque.ino
│ │ │ ├── ManualVelocity
│ │ │ │ └── ManualVelocity.ino
│ │ │ ├── MoveAbsolutePosition
│ │ │ │ ├── Abs16PositionsHomeToHardStop
│ │ │ │ │ └── Abs16PositionsHomeToHardStop.ino
│ │ │ │ ├── Abs2PositionsHomeToSwitch
│ │ │ │ │ └── Abs2PositionsHomeToSwitch.ino
│ │ │ │ └── Abs4PositionsHomeToHardStop
│ │ │ │ │ └── Abs4PositionsHomeToHardStop.ino
│ │ │ ├── MoveIncrementalDistance
│ │ │ │ ├── Move2IncrementsHomeToSwitch
│ │ │ │ │ └── Move2IncrementsHomeToSwitch.ino
│ │ │ │ └── Move4IncrementsHomeToHardStop
│ │ │ │ │ └── Move4IncrementsHomeToHardStop.ino
│ │ │ ├── PulseBurstPositioning
│ │ │ │ └── PulseBurstPositioning.ino
│ │ │ ├── RampUpDownToSelectedVelocity
│ │ │ │ └── RampUpDownToSelectedVelocity.ino
│ │ │ └── library.properties
│ │ ├── ClearPath-SD Series
│ │ │ ├── DualAxisSynchronized
│ │ │ │ └── DualAxisSynchronized.ino
│ │ │ ├── MotorStatusRegister
│ │ │ │ └── MotorStatusRegister.ino
│ │ │ ├── MovePositionAbsolute
│ │ │ │ └── MovePositionAbsolute.ino
│ │ │ ├── MovePositionRelative
│ │ │ │ └── MovePositionRelative.ino
│ │ │ ├── MoveVelocity
│ │ │ │ └── MoveVelocity.ino
│ │ │ ├── UserSeeksHome
│ │ │ │ └── UserSeeksHome.ino
│ │ │ └── library.properties
│ │ └── High-Level Feedback (HLFB)
│ │ │ ├── AsgWithMeasuredTorque
│ │ │ └── AsgWithMeasuredTorque.ino
│ │ │ ├── SpeedOutput
│ │ │ └── SpeedOutput.ino
│ │ │ └── library.properties
│ ├── library.properties
│ └── src
│ │ └── clearpath-mode-examples.h
├── DigitalIO
│ ├── examples
│ │ ├── InputInterrupts
│ │ │ └── InputInterrupts.ino
│ │ ├── PlayTone
│ │ │ ├── PlayTone.ino
│ │ │ └── pitches.h
│ │ ├── ReadDigitalInput
│ │ │ └── ReadDigitalInput.ino
│ │ ├── ReadDigitalInputRiseFall
│ │ │ └── ReadDigitalInputRiseFall.ino
│ │ ├── WriteDigitalOutput
│ │ │ └── WriteDigitalOutput.ino
│ │ ├── WriteHBridgeOutput
│ │ │ └── WriteHBridgeOutput.ino
│ │ └── WritePwmOutput
│ │ │ └── WritePwmOutput.ino
│ ├── library.properties
│ └── src
│ │ └── digitalIO-examples.h
├── EncoderInput
│ ├── examples
│ │ └── FollowEncoder
│ │ │ └── FollowEncoder.ino
│ ├── library.properties
│ └── src
│ │ └── encoder-input-examples.h
├── Ethernet
│ ├── examples
│ │ ├── EthernetTCPClientHelloWorld
│ │ │ └── EthernetTCPClientHelloWorld.ino
│ │ ├── EthernetTCPServer_autoClientManagement
│ │ │ └── EthernetTCPServer_autoClientManagement.ino
│ │ ├── EthernetTCPServer_manualClientManagement
│ │ │ └── EthernetTCPServer_manualClientManagement.ino
│ │ └── EthernetUdpHelloWorld
│ │ │ └── EthernetUdpHelloWorld.ino
│ ├── library.properties
│ └── src
│ │ └── ethernet-examples.h
├── README.md
├── SD
│ ├── examples
│ │ └── ReadWrite
│ │ │ └── ReadWrite.ino
│ ├── library.properties
│ └── src
│ │ └── sd-examples.h
├── SerialCommunication
│ ├── examples
│ │ ├── ClearCoreCommandProtocol
│ │ │ └── ClearCoreCommandProtocol.ino
│ │ ├── ReadSerialInput
│ │ │ └── ReadSerialInput.ino
│ │ ├── SerialPrint
│ │ │ └── SerialPrint.ino
│ │ ├── SpiComPortInitialization
│ │ │ └── SpiComPortInitialization.ino
│ │ ├── SpiSerialDisplay
│ │ │ └── SpiSerialDisplay.ino
│ │ └── TtlSerialDisplay
│ │ │ └── TtlSerialDisplay.ino
│ ├── library.properties
│ └── src
│ │ └── serial-comm-examples.h
├── StepAndDirection
│ ├── examples
│ │ └── StepAndDirection
│ │ │ └── StepAndDirection.ino
│ ├── library.properties
│ └── src
│ │ └── step-and-direction-examples.h
└── XBee
│ ├── examples
│ └── WriteXbeeOutput
│ │ └── WriteXbeeOutput.ino
│ ├── library.properties
│ └── src
│ └── xbee-examples.h
├── package_clearcore_index.json
├── platform.txt
├── variants
└── clearcore
│ ├── Third Party
│ └── SAME53
│ │ └── CMSIS
│ │ └── Device
│ │ └── Include
│ │ ├── component-version.h
│ │ ├── component
│ │ ├── ac.h
│ │ ├── adc.h
│ │ ├── aes.h
│ │ ├── ccl.h
│ │ ├── cmcc.h
│ │ ├── dac.h
│ │ ├── dmac.h
│ │ ├── dsu.h
│ │ ├── eic.h
│ │ ├── evsys.h
│ │ ├── freqm.h
│ │ ├── gclk.h
│ │ ├── gmac.h
│ │ ├── hmatrixb.h
│ │ ├── i2s.h
│ │ ├── icm.h
│ │ ├── mclk.h
│ │ ├── nvmctrl.h
│ │ ├── osc32kctrl.h
│ │ ├── oscctrl.h
│ │ ├── pac.h
│ │ ├── pcc.h
│ │ ├── pdec.h
│ │ ├── pm.h
│ │ ├── port.h
│ │ ├── qspi.h
│ │ ├── ramecc.h
│ │ ├── rstc.h
│ │ ├── rtc.h
│ │ ├── sdhc.h
│ │ ├── sercom.h
│ │ ├── supc.h
│ │ ├── tc.h
│ │ ├── tcc.h
│ │ ├── trng.h
│ │ ├── usb.h
│ │ └── wdt.h
│ │ ├── instance
│ │ ├── ac.h
│ │ ├── adc0.h
│ │ ├── adc1.h
│ │ ├── aes.h
│ │ ├── ccl.h
│ │ ├── cmcc.h
│ │ ├── dac.h
│ │ ├── dmac.h
│ │ ├── dsu.h
│ │ ├── eic.h
│ │ ├── evsys.h
│ │ ├── freqm.h
│ │ ├── gclk.h
│ │ ├── gmac.h
│ │ ├── hmatrix.h
│ │ ├── i2s.h
│ │ ├── icm.h
│ │ ├── mclk.h
│ │ ├── nvmctrl.h
│ │ ├── osc32kctrl.h
│ │ ├── oscctrl.h
│ │ ├── pac.h
│ │ ├── pcc.h
│ │ ├── pdec.h
│ │ ├── pm.h
│ │ ├── port.h
│ │ ├── pukcc.h
│ │ ├── qspi.h
│ │ ├── ramecc.h
│ │ ├── rstc.h
│ │ ├── rtc.h
│ │ ├── sdhc0.h
│ │ ├── sdhc1.h
│ │ ├── sercom0.h
│ │ ├── sercom1.h
│ │ ├── sercom2.h
│ │ ├── sercom3.h
│ │ ├── sercom4.h
│ │ ├── sercom5.h
│ │ ├── sercom6.h
│ │ ├── sercom7.h
│ │ ├── supc.h
│ │ ├── tc0.h
│ │ ├── tc1.h
│ │ ├── tc2.h
│ │ ├── tc3.h
│ │ ├── tc4.h
│ │ ├── tc5.h
│ │ ├── tc6.h
│ │ ├── tc7.h
│ │ ├── tcc0.h
│ │ ├── tcc1.h
│ │ ├── tcc2.h
│ │ ├── tcc3.h
│ │ ├── tcc4.h
│ │ ├── trng.h
│ │ ├── usb.h
│ │ └── wdt.h
│ │ ├── pio
│ │ ├── same53j18a.h
│ │ ├── same53j19a.h
│ │ ├── same53j20a.h
│ │ ├── same53n19a.h
│ │ └── same53n20a.h
│ │ ├── sam.h
│ │ ├── same53.h
│ │ ├── same53j18a.h
│ │ ├── same53j19a.h
│ │ ├── same53j20a.h
│ │ ├── same53n19a.h
│ │ ├── same53n20a.h
│ │ └── system_same53.h
│ ├── linker_scripts
│ └── gcc
│ │ ├── flash_with_bootloader.ld
│ │ └── flash_without_bootloader.ld
│ ├── pins_arduino.h
│ ├── sync.h
│ ├── variant.cpp
│ └── variant.h
└── zipClearCore.cmd
/.gitattributes:
--------------------------------------------------------------------------------
1 | *.exe filter=lfs diff=lfs merge=lfs -text
2 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Prerequisites
2 | *.d
3 |
4 | # Compiled Object files
5 | *.slo
6 | *.lo
7 | *.o
8 | *.obj
9 |
10 | # Precompiled Headers
11 | *.gch
12 | *.pch
13 |
14 | # Compiled Dynamic libraries
15 | *.so
16 | *.dylib
17 | *.dll
18 |
19 | # Fortran module files
20 | *.mod
21 | *.smod
22 |
23 | # Compiled Static libraries
24 | *.lai
25 | *.la
26 | *.a
27 | *.lib
28 |
29 | # Executables
30 | *.exe
31 | *.out
32 | *.app
33 | .vs/
34 | Release/
35 | Debug/
36 | drivers/signinf.cmd
37 | drivers/verifyinf.cmd
38 | *.zip
39 | *.componentinfo.xml
40 | jlink.*
41 | .vscode/
42 |
--------------------------------------------------------------------------------
/.gitlab-ci.yml:
--------------------------------------------------------------------------------
1 | stages:
2 | - ClearCore
3 |
4 | ClearCore:
5 | stage: ClearCore
6 | script:
7 | - cd %USERPROFILE%\AppData\Local\Arduino15\packages\ClearCore
8 | - rmdir /S /Q hardware\sam\1.0.1
9 | - rmdir /S /Q hardware\sam\1.0.2
10 | - rmdir /S /Q hardware\sam\1.0.3
11 | - rmdir /S /Q hardware\sam\1.0.4
12 | - rmdir /S /Q hardware\sam\1.0.5
13 | - rmdir /S /Q hardware\sam\1.0.6
14 | - rmdir /S /Q hardware\sam\1.0.7
15 | - rmdir /S /Q hardware\sam\1.0.8
16 | - rmdir /S /Q hardware\sam\1.0.9
17 | - rmdir /S /Q hardware\sam\1.0.10
18 | - rmdir /S /Q hardware\sam\1.0.11
19 | - rmdir /S /Q hardware\sam\1.0.12
20 | - rmdir /S /Q hardware\sam\1.0.13
21 | - git clone git@git-server.teknic.com:CustomerPackages/ClearCore_Arduino.git --branch "%CI_COMMIT_REF_NAME%" --single-branch "hardware\sam\1.0.13" || ( git clone git@git-server.teknic.com:CustomerPackages/ClearCore_Arduino.git --branch "develop" --single-branch "hardware\sam\1.0.13" )
22 | - git clone git@git-server.teknic.com:CustomerPackages/libClearCore.git --branch "%CI_COMMIT_REF_NAME%" --single-branch "hardware\sam\1.0.13\Teknic\libClearCore" || ( git clone git@git-server.teknic.com:CustomerPackages/libClearCore.git --branch "develop" --single-branch "hardware\sam\1.0.13\Teknic\libClearCore" )
23 | - git clone git@git-server.teknic.com:CustomerPackages/same53.git --branch "master" --single-branch "hardware\sam\1.0.13\variants\clearcore\Third Party\SAME53"
24 | - git clone git@git-server.teknic.com:CustomerPackages/LwIP.git --branch "master" --single-branch "hardware\sam\1.0.13\Teknic\LwIP"
25 | - git clone git@git-server.teknic.com:CustomerPackages/uf2-builder.git --branch "master" --single-branch "hardware\sam\1.0.13\Teknic\Tools\uf2-builder"
26 | - cd "hardware\sam\1.0.13"
27 | - mkdir TestSketch
28 | - echo void setup(){} void loop(){} > TestSketch/TestSketch.ino
29 | - atmelstudio.exe ClearCore.atsln /build debug /out output.txt || ( type output.txt & EXIT /B 1 )
30 | - python build.py -c -b
--------------------------------------------------------------------------------
/.gitlab/issue_templates/Bug.md:
--------------------------------------------------------------------------------
1 | **Summary**
2 |
3 | (Summarize the bug encountered concisely)
4 |
5 |
6 | **What is the current bug behavior?**
7 |
8 | (What actually happens)
9 |
10 |
11 | **What is the expected correct behavior?**
12 |
13 | (What you should see instead)
14 |
15 |
16 | **Steps to reproduce**
17 |
18 | (How one can reproduce the issue - this is very important)
19 |
20 |
21 | **Example code**
22 |
23 | ```
24 | (If possible, please include example code that exhibits the problematic behaviour)
25 | ```
26 |
27 | **Relevant logs and/or screenshots**
28 |
29 | (Paste any relevant logs)
30 |
31 |
32 | /label ~Bug
--------------------------------------------------------------------------------
/.gitlab/issue_templates/Discussion.md:
--------------------------------------------------------------------------------
1 | **Summary**
2 |
3 | (Summarize the topic for the discussion)
4 |
5 |
6 | **Who is required to participate?**
7 |
8 |
9 | **What is the estimated time for the discussion?**
10 |
11 |
12 | **Provide any additional details or background information for the discussion**
13 |
14 |
15 | /label ~Discussion
--------------------------------------------------------------------------------
/.gitlab/issue_templates/Feature Request.md:
--------------------------------------------------------------------------------
1 | **Summary**
2 |
3 | (Summarize the feature requested concisely)
4 |
5 |
6 | **Who is the requesting Customer?**
7 |
8 | Customer name -
9 | Project Name -
10 | Expected Annual volume -
11 |
12 |
13 | **What is the closest current solution with our products?**
14 |
15 |
16 | **What is the likely project outcome if the feature is not implemented?**
17 |
18 |
19 | **What is the "best" expected solution?**
20 |
21 |
22 |
23 |
24 | **Relevant logs and/or screenshots**
25 |
26 | (Please attach any relevant screenshots/pictures/documentation describing the desired behavior etc.)
27 |
28 |
29 |
30 | /label ~Feature Request
--------------------------------------------------------------------------------
/.gitlab/issue_templates/Text Change.md:
--------------------------------------------------------------------------------
1 | **Location**
2 |
3 | (Where is the location of the intended change?)
4 |
5 |
6 | **What is the error?**
7 |
8 | (Specifically state what the problem with the text is whether it's a typo, a grammatical error, a formatting error, or just unclear text descriptions)
9 |
10 |
11 | **Steps to reproduce?**
12 |
13 | (If there was any setup to illicit the typo/formatting error/grammatical error, list them)
14 |
15 |
16 | **What is the suggested correction?**
17 |
18 | (Specifically state your suggestion to correct the spelling or make the text more clear)
19 |
20 |
21 | /label ~Text Change
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "Teknic"]
2 | path = Teknic
3 | url = https://github.com/Teknic-Inc/ClearCore-library.git
4 |
--------------------------------------------------------------------------------
/ClearCore.atsln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Atmel Studio Solution File, Format Version 11.00
4 | VisualStudioVersion = 14.0.23107.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{E66E83B9-2572-4076-B26E-6BE79FF3018A}") = "ClearCoreArduino", "ClearCoreArduino.cppproj", "{DC06454F-445D-4E8C-A03E-22236431B9DE}"
7 | ProjectSection(ProjectDependencies) = postProject
8 | {C373696C-5D45-4B91-AD62-A21552361596} = {C373696C-5D45-4B91-AD62-A21552361596}
9 | {2530D5B1-8A40-4A55-95CA-2EC0B63E2088} = {2530D5B1-8A40-4A55-95CA-2EC0B63E2088}
10 | EndProjectSection
11 | EndProject
12 | Project("{E66E83B9-2572-4076-B26E-6BE79FF3018A}") = "ClearCore", "Teknic\libClearCore\ClearCore.cppproj", "{2530D5B1-8A40-4A55-95CA-2EC0B63E2088}"
13 | EndProject
14 | Project("{E66E83B9-2572-4076-B26E-6BE79FF3018A}") = "LwIP", "Teknic\LwIP\LwIP.cppproj", "{C373696C-5D45-4B91-AD62-A21552361596}"
15 | EndProject
16 | Project("{E66E83B9-2572-4076-B26E-6BE79FF3018A}") = "TestSketch", "TestSketch\TestSketch.cppproj", "{DCE6C7E3-EE26-4D79-826B-08594B9AD897}"
17 | ProjectSection(ProjectDependencies) = postProject
18 | {DC06454F-445D-4E8C-A03E-22236431B9DE} = {DC06454F-445D-4E8C-A03E-22236431B9DE}
19 | {C373696C-5D45-4B91-AD62-A21552361596} = {C373696C-5D45-4B91-AD62-A21552361596}
20 | {2530D5B1-8A40-4A55-95CA-2EC0B63E2088} = {2530D5B1-8A40-4A55-95CA-2EC0B63E2088}
21 | EndProjectSection
22 | EndProject
23 | Global
24 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
25 | Debug|ARM = Debug|ARM
26 | Release|ARM = Release|ARM
27 | EndGlobalSection
28 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
29 | {DC06454F-445D-4E8C-A03E-22236431B9DE}.Debug|ARM.ActiveCfg = Debug|ARM
30 | {DC06454F-445D-4E8C-A03E-22236431B9DE}.Debug|ARM.Build.0 = Debug|ARM
31 | {DC06454F-445D-4E8C-A03E-22236431B9DE}.Release|ARM.ActiveCfg = Release|ARM
32 | {DC06454F-445D-4E8C-A03E-22236431B9DE}.Release|ARM.Build.0 = Release|ARM
33 | {2530D5B1-8A40-4A55-95CA-2EC0B63E2088}.Debug|ARM.ActiveCfg = Debug|ARM
34 | {2530D5B1-8A40-4A55-95CA-2EC0B63E2088}.Debug|ARM.Build.0 = Debug|ARM
35 | {2530D5B1-8A40-4A55-95CA-2EC0B63E2088}.Release|ARM.ActiveCfg = Release|ARM
36 | {2530D5B1-8A40-4A55-95CA-2EC0B63E2088}.Release|ARM.Build.0 = Release|ARM
37 | {C373696C-5D45-4B91-AD62-A21552361596}.Debug|ARM.ActiveCfg = Debug|ARM
38 | {C373696C-5D45-4B91-AD62-A21552361596}.Debug|ARM.Build.0 = Debug|ARM
39 | {C373696C-5D45-4B91-AD62-A21552361596}.Release|ARM.ActiveCfg = Release|ARM
40 | {C373696C-5D45-4B91-AD62-A21552361596}.Release|ARM.Build.0 = Release|ARM
41 | {DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Debug|ARM.ActiveCfg = Debug|ARM
42 | {DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Debug|ARM.Build.0 = Debug|ARM
43 | {DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Release|ARM.ActiveCfg = Release|ARM
44 | {DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Release|ARM.Build.0 = Release|ARM
45 | EndGlobalSection
46 | GlobalSection(SolutionProperties) = preSolution
47 | HideSolutionNode = FALSE
48 | EndGlobalSection
49 | EndGlobal
50 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # ClearCore-Arduino-wrapper
2 |
3 | This repository contains the source code for the ClearCore Arduino Wrapper, which allows users to interact with a Teknic ClearCore using common Arduino functions.
4 |
5 | Instead of interfacing directly to the processor pins, the ClearCore Arduino Wrapper uses the ClearCore libraries and provides an interface to the ClearCore connectors. This leverages all of the ClearCore library features with the ease of programming in the Arduino IDE.
6 |
7 | Installation of the ClearCore board within the Arduino IDE should be performed using the Arduino board manager. This repository is intended for building new packages for use with the board manager.
8 |
9 | ### Installers and Resources
10 |
11 | https://www.teknic.com/downloads/
12 |
13 | ### Example Programs
14 |
15 | To help you quickly get started programming your ClearCore application, several ClearCore examples are included. Once you have the Teknic ClearCore selected as the active board, the Arduino File/Examples menu will include examples demonstrating how to use various features of the ClearCore, as well as the standard examples.
16 |
17 | ### Updating ClearCore-library (Teknic) Git Submodule
18 | If it's the first time you check-out a repo you need to use --init first:
19 |
20 | `git submodule update --init --recursive`
21 |
22 | For git 1.8.2 or above, the option --remote was added to support updating to latest tips of remote branches:
23 |
24 | `git submodule update --recursive --remote`
25 |
26 | ### Creating a new version for release
27 | 1. Make necessary changes to arduino wrapper code
28 | 2. Make necessary changes to ClearCore-library and pull in those changes by updating the submodule (see above)
29 | 3. Open `zipClearCore.cmd` and set the `ver` variable to your desired version (1.X.X)
30 | 4. Run `zipClearCore.cmd`
31 | 1. This builds/compiles libClearCore and LwIP and zips up necessary packages into a file called `ClearCore-1.X.X.zip`
32 | 2. It also hashes the zip it just created with SHA256 to be placed in the new entry in package_clearcore_index.json
33 | 5. Copy the SHA256 hash and the size in bytes to make a new entry in the `package_clearcore_index.json`
34 | 1. Reference previous entries for syntax
35 |
--------------------------------------------------------------------------------
/Style/README.txt:
--------------------------------------------------------------------------------
1 | Code Style Tool Guide:
2 |
3 | ================================================================================
4 | TL;DR
5 | 0. (Do this once for your system) Install cppcheck by downloading it from
6 | the interwebs.
7 | 1. Execute the run_[toolname].bat script from the desired project directory
8 | (e.g. ClearCore/run_cppcheck.bat). cppcheck puts its suggestions in
9 | a file called issues.txt. Astyle just makes its changes without getting
10 | your permission.
11 |
12 | ================================================================================
13 | Tool Overview:
14 |
15 | Astyle: A syntax formatter that conforms to the C/C++ Style guide. (Yes,
16 | it corrects your files for you, so be careful)
17 | http://astyle.sourceforge.net/astyle.html
18 |
19 | Astyle edits files to conform to the Software team's coding styles.
20 | Its configuration file is in ClearCore/configuration. Astyle's
21 | purpose is to make the code for the project look like it was all
22 | written by one person. It does not change the meaning (semantics)
23 | of what's going on. The extent of its changes is purely cosmetic.
24 | Cppcheck: A semantic checker that makes sure you don't do something dumb
25 | like plowing off the end of an array, or tickling null pointers.
26 | http://cppcheck.sourceforge.net/
27 |
28 | NOTE: Cppcheck must be installed on your system by by downloading it
29 | from the interwebs. The other application is a standalone exe file.
30 |
31 | Cppcheck doesn't care about how the code is formatted--that's
32 | Astyle's job. Cppcheck does not make any changes for you.
33 | It simply dumps its suggestions in a file called issues.txt
34 | (in the same directory you execute run_cppcheck.bat from).
35 |
36 | ================================================================================
37 |
--------------------------------------------------------------------------------
/Style/configuration/astyle.cfg:
--------------------------------------------------------------------------------
1 | # Don't make copies of every file in the project
2 | --suffix=none
3 |
4 | # Brace style
5 | --style=attach # "same-line" braces
6 | --add-braces # require braces on all blocks even if the contents
7 | # are a single line.
8 | #--break-one-line-headers # annihilate things like if (foo) { bar(); }
9 | --break-closing-braces # makes a newline between the end of an if
10 | # and its else.
11 |
12 | # Sane Indentation options
13 | # --indent-preproc-block
14 | --indent-switches
15 |
16 | # Pointer operator alignment
17 | --align-pointer=name # make pointer ops touch the name-- *foo, &foo, etc.
18 | --align-reference=name # make & and -> touch the name
19 |
20 | # General operator alignment
21 | --pad-oper # surround math operators with spaces on both sides
22 | --pad-comma # Make sure commas have a trailing space, and no
23 | # leading space.
24 | --pad-header # Add a space between if/while/for and (. e.g.:
25 | # while(foo) { ...
26 | # becomes
27 | # while (foo) { ...
28 |
29 | # Whitespace options
30 | --indent=spaces=4 # tabstop = 4 spaces
31 | --convert-tabs # substitute 4 spaces for tabs
32 | # --max-code-length=80 # enforce 80 characters maximum per line
33 | --break-after-logical # make it so && or || ends the line if wrapping
34 | --unpad-paren # Remove extra spaces around parenthesis
35 | # if ( ( bar() == baz ) ) { ...
36 | # becomes
37 | # if ((bar() == baz)) { ...
38 | #--break-blocks # put whitespace lines around if/for/while blocks
39 | #--delete-empty-lines # delete empty lines within a function or method
40 | # (except those inserted with break-blocks)
--------------------------------------------------------------------------------
/Style/configuration/cppcheck_suppressions.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | unusedFunction
5 |
6 |
7 | ConfigurationNotChecked
8 |
9 |
10 | redundantAssignment
11 | selfAssignment
12 |
13 |
14 | multipleInheritance
15 |
16 |
17 | usedLongKeyword
18 | usedIntKeyword
19 |
20 |
--------------------------------------------------------------------------------
/Style/run_astyle.bat:
--------------------------------------------------------------------------------
1 | SET version=1.0.12
2 |
3 | SET root_teknic="%LOCALAPPDATA%\Arduino15\packages\ClearCore\hardware\sam\%version%\Teknic\libClearCore"
4 | SET root_atmel_examples="%LOCALAPPDATA%\Arduino15\packages\ClearCore\hardware\sam\%version%\Teknic\Atmel_Examples"
5 | SET root_arduino_examples="%LOCALAPPDATA%\Arduino15\packages\ClearCore\hardware\sam\%version%\libraries"
6 | SET root_arduino="%LOCALAPPDATA%\Arduino15\packages\ClearCore\hardware\sam\%version%\cores\arduino"
7 |
8 | .\tools\AStyle.exe --options=configuration\astyle.cfg -r "%root_teknic%\inc\*.h" "%root_teknic%\src\*.cpp" "%root_teknic%\UnitTests\src\*.cpp" "%root_arduino%\*.h" "%root_arduino%\*.cpp" "%root_arduino_examples%\*.ino" "%root_atmel_examples%\*.cpp"
--------------------------------------------------------------------------------
/Style/run_cppcheck.bat:
--------------------------------------------------------------------------------
1 | SET version=1.0.12
2 |
3 | SET src="%LOCALAPPDATA%\Arduino15\packages\ClearCore\hardware\sam\%version%\Teknic\libClearCore\src"
4 | SET inc="%LOCALAPPDATA%\Arduino15\packages\ClearCore\hardware\sam\%version%\Teknic\libClearCore\inc"
5 | SET libClearCore_issues="cppCheck_issues_libClearCore.txt"
6 |
7 | SET unitTests="%LOCALAPPDATA%\Arduino15\packages\ClearCore\hardware\sam\%version%\Teknic\libClearCore\UnitTests\src"
8 | SET unitTests_issues="cppCheck_issues_unitTests.txt"
9 |
10 | SET examples="%LOCALAPPDATA%\Arduino15\packages\ClearCore\hardware\sam\%version%\Teknic\Atmel_Examples"
11 | SET examples_issues="cppCheck_issues_examples.txt"
12 |
13 | SET arduino_src="%LOCALAPPDATA%\Arduino15\packages\ClearCore\hardware\sam\%version%\cores\arduino"
14 | SET arduino_issues="cppCheck_issues_arduino.txt"
15 |
16 | SET cppCheck="C:\Program Files\Cppcheck\cppcheck.exe"
17 |
18 | mkdir clearcore_build_dir
19 |
20 | %cppCheck% -I "%inc%" --cppcheck-build-dir="clearcore_build_dir" --enable=all --rule-file="configuration\cppcheck_rules.xml" --output-file="%libClearCore_issues%" --suppress-xml="configuration\cppcheck_suppressions.xml" "%src%"
21 |
22 | %cppCheck% --cppcheck-build-dir="clearcore_build_dir" --enable=all --rule-file="configuration\cppcheck_rules.xml" --output-file="%unitTests_issues%" --suppress-xml="configuration\cppcheck_suppressions.xml" "%unitTests%"
23 |
24 | %cppCheck% --cppcheck-build-dir="clearcore_build_dir" --enable=all --rule-file="configuration\cppcheck_rules.xml" --output-file="%examples_issues%" --suppress-xml="configuration\cppcheck_suppressions.xml" "%examples%"
25 |
26 | %cppCheck% --cppcheck-build-dir="clearcore_build_dir" --enable=all --rule-file="configuration\cppcheck_rules.xml" --output-file="%arduino_issues%" --suppress-xml="configuration\cppcheck_suppressions.xml" "%arduino_src%"
27 |
28 | rmdir /s /q clearcore_build_dir
29 |
--------------------------------------------------------------------------------
/TestSketch/TestSketch.cpp:
--------------------------------------------------------------------------------
1 | #include "Arduino.h"
2 | #include "ClearCore.h"
3 |
4 | bool outputState = false;
5 |
6 | void setup() {
7 | // Put your setup code here, it will run once:
8 | }
9 |
10 | void loop() {
11 | // Put your main code here, it will run repeatedly:
12 |
13 | // Toggle and write the digital output state.
14 | outputState = !outputState;
15 | digitalWrite(LED_BUILTIN, outputState);
16 |
17 | // Wait a second, then repeat.
18 | delay(1000);
19 | }
--------------------------------------------------------------------------------
/boards.txt:
--------------------------------------------------------------------------------
1 | # See: http://code.google.com/p/arduino/wiki/Platforms
2 |
3 | menu.cpu=Processor
4 |
5 | ##############################################################
6 |
7 | clearcore.name=Teknic ClearCore
8 | clearcore.vid.0=0x2890
9 | clearcore.pid.0=0x0022
10 | clearcore.vid.1=0x2890
11 | clearcore.pid.1=0x8022
12 |
13 | clearcore.upload.tool=bossac
14 | clearcore.upload.protocol=sam-ba
15 | clearcore.upload.maximum_size=507904
16 | clearcore.upload.use_1200bps_touch=true
17 | clearcore.upload.wait_for_upload_port=true
18 | clearcore.upload.native_usb=true
19 | clearcore.upload.offset=0x4000
20 | clearcore.tools.bossac.upload.params.verbose=-i -d -a
21 |
22 | clearcore.bootloader.tool=openocd
23 | clearcore.bootloader.unlock_bits=0x3F
24 | clearcore.bootloader.lock_bits=0x2F
25 |
26 | clearcore.build.mcu=cortex-m4
27 | clearcore.build.float=hard
28 | clearcore.build.fpu=fpv4-sp-d16
29 | clearcore.build.f_cpu=120000000L
30 | clearcore.build.vid=0x2890
31 | clearcore.build.pid=0x0022
32 | clearcore.build.usb_product="Teknic ClearCore"
33 | clearcore.build.usb_manufacturer="Teknic, Inc."
34 | clearcore.build.board=ARM_ClearCore
35 | clearcore.build.core=arduino
36 | clearcore.build.variant=clearcore
37 | clearcore.build.extra_flags={build.usb_flags} -lc -DDEBUG
38 | clearcore.build.ldscript=linker_scripts/gcc/flash_with_bootloader.ld
39 |
40 | ##############################################################
41 |
42 |
--------------------------------------------------------------------------------
/bootloader/bootloader-ClearCore-v2.3.1-Teknic.4.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Teknic-Inc/ClearCore-Arduino-wrapper/6fa1d810705c518b78962cb2a7bd7326bddf9d08/bootloader/bootloader-ClearCore-v2.3.1-Teknic.4.bin
--------------------------------------------------------------------------------
/bootloader/bootloader-ClearCore-v2.3.1-Teknic.4.elf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Teknic-Inc/ClearCore-Arduino-wrapper/6fa1d810705c518b78962cb2a7bd7326bddf9d08/bootloader/bootloader-ClearCore-v2.3.1-Teknic.4.elf
--------------------------------------------------------------------------------
/bootloader/update-bootloader-ClearCore-v2.3.1-Teknic.4.uf2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Teknic-Inc/ClearCore-Arduino-wrapper/6fa1d810705c518b78962cb2a7bd7326bddf9d08/bootloader/update-bootloader-ClearCore-v2.3.1-Teknic.4.uf2
--------------------------------------------------------------------------------
/cores/arduino/Arduino.h:
--------------------------------------------------------------------------------
1 | /*
2 | Arduino.h - Main include file for the Arduino SDK
3 | Copyright (c) 2014 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_h
21 | #define Arduino_h
22 |
23 | #include
24 | #include
25 |
26 | #define clockCyclesPerMicrosecond() (SystemCoreClock / 1000000L)
27 | #define clockCyclesToMicroseconds(a) (((a) * 1000L) / (SystemCoreClock / 1000L))
28 | #define microsecondsToClockCycles(a) ((a) * (SystemCoreClock / 1000000L))
29 |
30 | #include "WVariant.h"
31 | #include "delay.h"
32 |
33 | typedef enum {
34 | AR_INTERNAL,
35 | AR_INTVCC0 = 2, // 1/2 VDDANA
36 | AR_INTVCC1 = 3, // VDDANA
37 | AR_EXTERNAL_A = 4,
38 | AR_EXTERNAL_B = 5,
39 | AR_EXTERNAL_C = 6,
40 | } eAnalogReference ;
41 |
42 | #ifdef __cplusplus
43 | extern "C" {
44 | #endif // __cplusplus
45 | void init(void);
46 | void delay(unsigned long ms);
47 | void setup(void);
48 | void loop(void);
49 | #ifdef __cplusplus
50 | } // extern "C"
51 | #endif
52 |
53 | #endif // Arduino_h
54 |
--------------------------------------------------------------------------------
/cores/arduino/EthernetClient.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include "EthernetUtils.h"
3 | #include "IpAddress.h"
4 |
5 | EthernetClient::EthernetClient()
6 | : m_tcpClient(),
7 | m_dnsInitialized(false) {}
8 |
9 | EthernetClient::EthernetClient(ClearCore::EthernetTcpClient tcpClient)
10 | : m_tcpClient(tcpClient),
11 | m_dnsInitialized(false) {}
12 |
13 | int EthernetClient::connect(IPAddress ip, uint16_t port) {
14 | ClearCore::IpAddress nativeIp = ClearCore::IpAddress(uint32_t(ip));
15 | return m_tcpClient.Connect(nativeIp, port) ? 1 : 0;
16 | }
17 |
18 | int EthernetClient::connect(const char *host, uint16_t port) {
19 | int result = -1;
20 | // Attempt to resolve the host.
21 | ip_addr_t remoteIp = {};
22 | err_t err = ClearCore::DnsGetHostByName(host, &remoteIp);
23 | IPAddress ip = Ethernet.convertIp(&remoteIp);
24 |
25 | switch (err) {
26 | case ERR_OK:
27 | if (connect(ip, port) == 1) {
28 | result = 1; // SUCCESS
29 | }
30 | else {
31 | result = -4; // INVALID_RESPONSE
32 | }
33 | break;
34 | case ERR_INPROGRESS:
35 | result = -1; // TIMED_OUT
36 | break;
37 | case ERR_VAL:
38 | result = -2; // INVALID_SERVER
39 | break;
40 | case ERR_MEM:
41 | result = -3; // TRUNCATED
42 | break;
43 | case ERR_ARG:
44 | default:
45 | result = -4; // INVALID_RESPONSE
46 | break;
47 | }
48 | return result;
49 | }
50 |
51 | size_t EthernetClient::write(uint8_t c) {
52 | return write(&c, 1);
53 | }
54 |
55 | size_t EthernetClient::write(const uint8_t *buffer, size_t size) {
56 | return m_tcpClient.Send(buffer, size);
57 | }
58 |
59 | int EthernetClient::available() {
60 | return m_tcpClient.BytesAvailable();
61 | }
62 |
63 | int EthernetClient::read() {
64 | return m_tcpClient.Read();
65 | }
66 |
67 | int EthernetClient::read(uint8_t *buf, size_t size) {
68 | return m_tcpClient.Read(buf, size);
69 | }
70 |
71 | // wait until all outgoing data to the client has been sent
72 | void EthernetClient::flush() {
73 | m_tcpClient.Flush();
74 | }
75 |
76 | void EthernetClient::stop() {
77 | m_tcpClient.Close();
78 | }
79 |
80 | // A client is considered connected if the connection has been closed but
81 | // there is still unread data.
82 | uint8_t EthernetClient::connected() {
83 | if (m_tcpClient.BytesAvailable() > 0 || m_tcpClient.Connected()) {
84 | return 1;
85 | }
86 | return 0;
87 | }
88 |
89 | int EthernetClient::peek() {
90 | return m_tcpClient.Peek();
91 | }
92 |
93 | uint16_t EthernetClient::localPort() {
94 | return m_tcpClient.LocalPort();
95 | }
96 |
97 | IPAddress EthernetClient::remoteIP() {
98 | IPAddress ip = IPAddress(uint32_t(m_tcpClient.RemoteIp()));
99 | return ip;
100 | }
101 |
102 | uint16_t EthernetClient::remotePort() {
103 | return m_tcpClient.RemotePort();
104 | }
105 |
106 | void EthernetClient::setConnectionTimeout(uint16_t milliseconds) {
107 | m_tcpClient.ConnectionTimeout(milliseconds);
108 | }
109 | EthernetClient::operator bool() {
110 | return m_tcpClient.ConnectionState() != nullptr;
111 | }
112 |
113 | bool EthernetClient::operator==(const EthernetClient &client) {
114 | return m_tcpClient == client.m_tcpClient;
115 | }
--------------------------------------------------------------------------------
/cores/arduino/EthernetServer.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | EthernetServer::EthernetServer(uint16_t port/* = 80*/) : m_tcpServer(port) {}
4 |
5 | void EthernetServer::begin() {
6 | m_tcpServer.Begin();
7 | }
8 |
9 | // EthernetServer gives a client only once, regardless of it it has sent data.
10 | // Then, the user is responsible for keeping track of connected clients.
11 | EthernetClient EthernetServer::accept() {
12 | return EthernetClient(m_tcpServer.Accept());
13 | }
14 |
15 | // EthernetServer manages the clients. A client is only identified and returned
16 | // when data has been received from the client and is available for reading.
17 | EthernetClient EthernetServer::available() {
18 | return EthernetClient(m_tcpServer.Available());
19 | }
20 |
21 | size_t EthernetServer::write(uint8_t c) {
22 | return write(&c, 1);
23 | }
24 |
25 | size_t EthernetServer::write(const uint8_t *buf, size_t size) {
26 | return m_tcpServer.Send(buf, size);
27 | }
28 |
29 | EthernetServer::operator bool() {
30 | return m_tcpServer.Ready();
31 | }
--------------------------------------------------------------------------------
/cores/arduino/EthernetUDP.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include "EthernetUdp.h"
3 | #include "EthernetUtils.h"
4 | #include "IpAddress.h"
5 |
6 |
7 | EthernetUDP::EthernetUDP(): m_udp() {}
8 |
9 | uint8_t EthernetUDP::begin(uint16_t localPort) {
10 | return m_udp.Begin(localPort) ? 1 : 0;
11 | }
12 |
13 | void EthernetUDP::stop() {
14 | m_udp.End();
15 | }
16 |
17 | int EthernetUDP::beginPacket(IPAddress ip, uint16_t port) {
18 | ClearCore::IpAddress nativeIp = ClearCore::IpAddress(uint32_t(ip));
19 | return m_udp.Connect(nativeIp, port) ? 1 : 0;
20 | }
21 |
22 | int EthernetUDP::beginPacket(const char *host, uint16_t remotePort) {
23 | // Attempt to resolve the host.
24 | ip_addr_t remoteIp = {};
25 | if (ClearCore::DnsGetHostByName(host, &remoteIp) != ERR_OK) {
26 | return 0; // Unable to resolve hostname or timed out.
27 | }
28 |
29 | IPAddress ip = Ethernet.convertIp(&remoteIp);
30 |
31 | return beginPacket(ip, remotePort);
32 | }
33 |
34 | int EthernetUDP::endPacket() {
35 | return m_udp.PacketSend() ? 1 : 0;
36 | }
37 |
38 | size_t EthernetUDP::write(uint8_t c) {
39 | return write(&c, 1);
40 | }
41 |
42 | size_t EthernetUDP::write(const uint8_t *buffer, size_t size) {
43 | return m_udp.PacketWrite(buffer, size);
44 | }
45 |
46 | int EthernetUDP::parsePacket() {
47 | return m_udp.PacketParse();
48 | }
49 |
50 | int EthernetUDP::available() {
51 | return m_udp.BytesAvailable();
52 | }
53 |
54 | int EthernetUDP::read() {
55 | unsigned char c;
56 | return (read(&c, 1) == 1) ? c : -1;
57 | }
58 |
59 | int EthernetUDP::read(unsigned char *buffer, size_t len) {
60 | return m_udp.PacketRead(buffer, len);
61 | }
62 |
63 | int EthernetUDP::peek() {
64 | return m_udp.Peek();
65 | }
66 |
67 | void EthernetUDP::flush() {
68 | m_udp.PacketFlush();
69 | }
70 |
71 | IPAddress EthernetUDP::remoteIP() {
72 | IPAddress ip = IPAddress(uint32_t(m_udp.RemoteIp()));
73 | return ip;
74 | }
75 |
76 | uint16_t EthernetUDP::remotePort() {
77 | return m_udp.RemotePort();
78 | }
--------------------------------------------------------------------------------
/cores/arduino/Reset.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2015 Arduino LLC. All right reserved.
3 |
4 | This library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Lesser General Public
6 | License as published by the Free Software Foundation; either
7 | version 2.1 of the License, or (at your option) any later version.
8 |
9 | This library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | See the GNU Lesser General Public License for more details.
13 |
14 | You should have received a copy of the GNU Lesser General Public
15 | License along with this library; if not, write to the Free Software
16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | #include
20 | #include "Reset.h"
21 |
22 | #ifdef __cplusplus
23 | extern "C" {
24 | #endif
25 |
26 | #define NVM_MEMORY ((volatile uint16_t *)0x000000)
27 |
28 | #if (ARDUINO_SAMD_VARIANT_COMPLIANCE >= 10610)
29 |
30 | extern const uint32_t __text_start__;
31 | #define APP_START ((volatile uint32_t)(&__text_start__) + 4)
32 |
33 | #else
34 | #define APP_START 0x00002004
35 | #endif
36 |
37 | static inline bool nvmReady(void) {
38 | return NVMCTRL->STATUS.bit.READY;
39 | }
40 |
41 | __attribute__((long_call, section(".ramfunc")))
42 | static void banzai() {
43 | // Disable all interrupts
44 | __disable_irq();
45 |
46 | // Get a copy of the NVM "user page"
47 | uint32_t userspace = *((uint32_t *)NVMCTRL_FUSES_BOOTPROT_ADDR);
48 | uint32_t bootsize = NVMCTRL_BLOCK_SIZE *
49 | (15 - ((userspace & NVMCTRL_FUSES_BOOTPROT_Msk)
50 | >> NVMCTRL_FUSES_BOOTPROT_Pos));
51 | // Avoid erasing the application if APP_START is < than the minimum
52 | // bootloader sizea
53 | // This could happen if without_bootloader linker script was chosen
54 | if ((APP_START - 4) < bootsize) {
55 | goto reset;
56 | }
57 |
58 | // Erase application
59 | while (!nvmReady()) {
60 | continue;
61 | }
62 | NVMCTRL->STATUS.reg |= NVMCTRL_STATUS_MASK;
63 | // Set address to starting address
64 | NVMCTRL->ADDR.reg = (APP_START - 4);
65 | NVMCTRL->CTRLB.reg = NVMCTRL_CTRLB_CMD_EB | NVMCTRL_CTRLB_CMDEX_KEY;
66 | while (!nvmReady()) {
67 | continue;
68 | }
69 | reset:
70 | // Reset the device
71 | NVIC_SystemReset() ;
72 |
73 | while (true) {
74 | continue;
75 | }
76 | }
77 |
78 | static int ticks = -1;
79 |
80 | void initiateReset(int _ticks) {
81 | ticks = _ticks;
82 | }
83 |
84 | void cancelReset() {
85 | ticks = -1;
86 | }
87 |
88 | void tickReset() {
89 | if (ticks == -1) {
90 | return;
91 | }
92 | ticks--;
93 | if (ticks == 0) {
94 | banzai();
95 | }
96 | }
97 |
98 | #ifdef __cplusplus
99 | }
100 | #endif
101 |
--------------------------------------------------------------------------------
/cores/arduino/Reset.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2015 Arduino LLC. All right reserved.
3 |
4 | This library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Lesser General Public
6 | License as published by the Free Software Foundation; either
7 | version 2.1 of the License, or (at your option) any later version.
8 |
9 | This library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | See the GNU Lesser General Public License for more details.
13 |
14 | You should have received a copy of the GNU Lesser General Public
15 | License along with this library; if not, write to the Free Software
16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | #pragma once
20 |
21 | #ifdef __cplusplus
22 | extern "C" {
23 | #endif
24 |
25 | void initiateReset(int ms);
26 | void tickReset();
27 | void cancelReset();
28 |
29 | #ifdef __cplusplus
30 | }
31 | #endif
32 |
--------------------------------------------------------------------------------
/cores/arduino/Tone.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2015 Arduino LLC. All right reserved.
3 |
4 | This library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Lesser General Public
6 | License as published by the Free Software Foundation; either
7 | version 2.1 of the License, or (at your option) any later version.
8 |
9 | This library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | See the GNU Lesser General Public License for more details.
13 |
14 | You should have received a copy of the GNU Lesser General Public
15 | License along with this library; if not, write to the Free Software
16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 | #include "Arduino.h"
19 | #include "DigitalInOutHBridge.h"
20 | #include "SysConnectors.h"
21 | #include "SysManager.h"
22 | #include "WVariant.h"
23 | #include "variant.h"
24 | #include
25 | #include
26 |
27 | namespace ClearCore {
28 | extern SysManager SysMgr;
29 | }
30 |
31 | // Board resource controller
32 | extern const uint32_t SystemCoreClock;
33 | uint32_t toneMaxFrequency = SystemCoreClock / 2;
34 |
35 | void noTone(uint8_t outputPin) {
36 | ClearCore::Connector *myConnector =
37 | ClearCore::SysMgr.ConnectorByIndex(static_cast(outputPin));
38 | // Only playing tones on the H-Bridge connectors
39 | if (myConnector->Type() != ClearCore::Connector::H_BRIDGE_TYPE) {
40 | return;
41 | }
42 |
43 | if (static_cast(myConnector)->ToneActiveState()
44 | != ClearCore::DigitalInOutHBridge::ToneState::TONE_TIMED) {
45 | // Stop the tone on the specified pin
46 | static_cast(myConnector)->ToneStop();
47 | }
48 | }
49 |
50 | void tone(
51 | unsigned char outputPin, unsigned int frequency, unsigned long duration) {
52 |
53 | ClearCore::Connector *myConnector =
54 | ClearCore::SysMgr.ConnectorByIndex(static_cast(outputPin));
55 | // Only playing tones on the H-Bridge connectors
56 | if (myConnector->Type() != ClearCore::Connector::H_BRIDGE_TYPE) {
57 | return;
58 | }
59 |
60 | // Put the pin in tone mode
61 | static_cast(myConnector)
62 | ->Mode(ClearCore::DigitalInOutHBridge::OUTPUT_TONE);
63 |
64 | static_cast(myConnector)
65 | ->ToneTimed(frequency, duration);
66 | }
67 |
68 | void toneVolume(unsigned char outputPin, float volume) {
69 |
70 | ClearCore::Connector *myConnector =
71 | ClearCore::SysMgr.ConnectorByIndex(static_cast(outputPin));
72 | // Only playing tones on the H-Bridge connectors
73 | if (myConnector->Type() != ClearCore::Connector::H_BRIDGE_TYPE) {
74 | return;
75 | }
76 |
77 | // Set the tone amplitude for this pin
78 | static_cast(myConnector)
79 | ->ToneAmplitude(static_cast(volume * INT16_MAX));
80 | }
--------------------------------------------------------------------------------
/cores/arduino/Uart.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2015 Arduino LLC. All right reserved.
3 |
4 | This library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Lesser General Public
6 | License as published by the Free Software Foundation; either
7 | version 2.1 of the License, or (at your option) any later version.
8 |
9 | This library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | See the GNU Lesser General Public License for more details.
13 |
14 | You should have received a copy of the GNU Lesser General Public
15 | License along with this library; if not, write to the Free Software
16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | #pragma once
20 |
21 | #include "SerialDriver.h"
22 | #include "SerialUsb.h"
23 | #include "SysConnectors.h"
24 | #include "SysManager.h"
25 | #include "HardwareSerial.h"
26 | #include "SERCOM.h"
27 |
28 | class Uart : public HardwareSerial {
29 | public:
30 | Uart(ClearCorePins connectorPin, bool isUsbCon = false);
31 | void begin(unsigned long baudRate);
32 | void begin(unsigned long baudrate, uint16_t config);
33 | void end();
34 | int available();
35 | int availableForWrite();
36 | int peek();
37 | int read();
38 | void flush();
39 | void flushInput();
40 | size_t write(const uint8_t data);
41 | void ttl(bool newState);
42 | bool ttl();
43 | using Print::write; // pull in write(str) and write(buf, size) from Print
44 |
45 | operator bool();
46 |
47 | private:
48 |
49 | ClearCore::ISerial *m_serial;
50 | ClearCore::SerialDriver *m_serialConnector;
51 |
52 | uint8_t extractNbStopBit(uint16_t config);
53 | uint8_t extractCharSize(uint16_t config);
54 | ClearCore::ISerial::Parities extractParity(uint16_t config);
55 | };
56 |
57 |
58 | extern Uart Serial;
59 | extern Uart Serial0;
60 | extern Uart Serial1;
--------------------------------------------------------------------------------
/cores/arduino/WMath.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2014 Arduino. All right reserved.
3 |
4 | This library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Lesser General Public
6 | License as published by the Free Software Foundation; either
7 | version 2.1 of the License, or (at your option) any later version.
8 |
9 | This library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | See the GNU Lesser General Public License for more details.
13 |
14 | You should have received a copy of the GNU Lesser General Public
15 | License along with this library; if not, write to the Free Software
16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | extern "C" {
20 | #include "stdlib.h"
21 | #include "stdint.h"
22 | }
23 |
24 | void randomSeed(uint32_t dwSeed) {
25 | if (dwSeed != 0) {
26 | srand(dwSeed);
27 | }
28 | }
29 |
30 | long random(long howbig) {
31 | if (howbig == 0) {
32 | return 0;
33 | }
34 |
35 | return rand() % howbig;
36 | }
37 |
38 | long random(long howsmall, long howbig) {
39 | if (howsmall >= howbig) {
40 | return howsmall;
41 | }
42 |
43 | long diff = howbig - howsmall;
44 |
45 | return random(diff) + howsmall;
46 | }
47 |
--------------------------------------------------------------------------------
/cores/arduino/WVariant.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2015 Arduino LLC. All right reserved.
3 |
4 | This library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Lesser General Public
6 | License as published by the Free Software Foundation; either
7 | version 2.1 of the License, or (at your option) any later version.
8 |
9 | This library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | See the GNU Lesser General Public License for more details.
13 |
14 | You should have received a copy of the GNU Lesser General Public
15 | License along with this library; if not, write to the Free Software
16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | #pragma once
20 |
21 | #include
22 | #include "sam.h"
23 | #include "Common.h"
24 | #include "pins_arduino.h"
25 | #include "SysConnectors.h"
26 | #include "SysManager.h"
27 |
28 |
29 |
30 | #ifdef __cplusplus
31 | extern "C" {
32 | #endif
33 |
34 | #define LED_BUILTIN CLEARCORE_PIN_LED
35 |
36 | /**
37 | PIN Modes
38 | **/
39 | typedef enum {
40 | CLEARCORE_MODE_INPUT = INPUT, // Match standard name
41 | CLEARCORE_MODE_OUTPUT = OUTPUT,
42 | CLEARCORE_MODE_ANALOG
43 | } ClearCorePinModes;
44 |
45 | // Parallel version of pinMode to setup ClearCore "connectors" using the
46 | // connector index.
47 | void pinModeClearCore(ClearCorePins thePin, PinMode ulMode);
48 |
49 | // Mapping of ClearCore pins to interrupts
50 | pin_size_t digitalPinToInterrupt(pin_size_t pin);
51 |
52 | #ifdef __cplusplus
53 | } // extern "C"
54 | #endif
--------------------------------------------------------------------------------
/cores/arduino/abi.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2014 Arduino LLC. All right reserved.
3 |
4 | This library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Lesser General Public
6 | License as published by the Free Software Foundation; either
7 | version 2.1 of the License, or (at your option) any later version.
8 |
9 | This library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | See the GNU Lesser General Public License for more details.
13 |
14 | You should have received a copy of the GNU Lesser General Public
15 | License along with this library; if not, write to the Free Software
16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | #include
20 |
21 | extern "C" void __cxa_pure_virtual(void) __attribute__((__noreturn__));
22 | extern "C" void __cxa_deleted_virtual(void) __attribute__((__noreturn__));
23 |
24 | extern "C" {
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 | continue;
30 | }
31 | }
32 |
33 | void __cxa_deleted_virtual(void) {
34 | // We might want to write some diagnostics to uart in this case
35 | //std::terminate();
36 | while (1) {
37 | continue;
38 | }
39 | }
40 | };
41 |
42 |
--------------------------------------------------------------------------------
/cores/arduino/api/ArduinoAPI.h:
--------------------------------------------------------------------------------
1 | /*
2 | Arduino API main include
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_API_H
21 | #define ARDUINO_API_H
22 |
23 | // version 1.0.0
24 | #define ARDUINO_API_VERSION 10000
25 |
26 | #include "Binary.h"
27 |
28 | #ifdef __cplusplus
29 | #include "Client.h"
30 | #include "HardwareI2C.h"
31 | #include "HardwareSerial.h"
32 | #include "Interrupts.h"
33 | #include "IPAddress.h"
34 | #include "Print.h"
35 | #include "Printable.h"
36 | #include "Server.h"
37 | #include "ArduinoString.h"
38 | #include "Stream.h"
39 | #include "Uart.h"
40 | #include "Udp.h"
41 | #include "WCharacter.h"
42 | #endif
43 |
44 | /* Standard C library includes */
45 | #include
46 | #include
47 | #include
48 | #include
49 | #include
50 |
51 | // Misc Arduino core functions
52 | #include "Common.h"
53 |
54 | #endif
55 |
--------------------------------------------------------------------------------
/cores/arduino/api/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 | #pragma once
21 |
22 | #include "Stream.h"
23 | #include "IPAddress.h"
24 |
25 | class Client : public Stream {
26 |
27 | public:
28 | virtual int connect(IPAddress ip, uint16_t port) = 0;
29 | virtual int connect(const char *host, uint16_t port) = 0;
30 | virtual size_t write(uint8_t) = 0;
31 | virtual size_t write(const uint8_t *buf, size_t size) = 0;
32 | virtual int available() = 0;
33 | virtual int read() = 0;
34 | virtual int read(uint8_t *buf, size_t size) = 0;
35 | virtual int peek() = 0;
36 | virtual void flush() = 0;
37 | virtual void stop() = 0;
38 | virtual uint8_t connected() = 0;
39 | virtual operator bool() = 0;
40 | protected:
41 | uint8_t *rawIPAddress(IPAddress &addr) {
42 | return addr.raw_address();
43 | };
44 | };
45 |
46 |
--------------------------------------------------------------------------------
/cores/arduino/api/Common.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2019 Arduino LLC. All right reserved.
3 |
4 | This library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Lesser General Public
6 | License as published by the Free Software Foundation; either
7 | version 2.1 of the License, or (at your option) any later version.
8 |
9 | This library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | See the GNU Lesser General Public License for more details.
13 |
14 | You should have received a copy of the GNU Lesser General Public
15 | License along with this library; if not, write to the Free Software
16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | #include "Common.h"
20 |
21 | /* C++ prototypes */
22 | long map(long x, long in_min, long in_max, long out_min, long out_max) {
23 | return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
24 | }
25 |
26 | uint16_t makeWord(uint16_t w) {
27 | return w;
28 | }
29 | uint16_t makeWord(uint8_t h, uint8_t l) {
30 | return (h << 8) | l;
31 | }
--------------------------------------------------------------------------------
/cores/arduino/api/HardwareI2C.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2016 Arduino LLC. All right reserved.
3 |
4 | This library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Lesser General Public
6 | License as published by the Free Software Foundation; either
7 | version 2.1 of the License, or (at your option) any later version.
8 |
9 | This library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | See the GNU Lesser General Public License for more details.
13 |
14 | You should have received a copy of the GNU Lesser General Public
15 | License along with this library; if not, write to the Free Software
16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | #pragma once
20 |
21 | #include
22 | #include "Stream.h"
23 |
24 | class HardwareI2C : public Stream {
25 | public:
26 | virtual void begin() = 0;
27 | virtual void begin(uint8_t address) = 0;
28 | virtual void end() = 0;
29 |
30 | virtual void setClock(uint32_t freq) = 0;
31 |
32 | virtual void beginTransmission(uint8_t address) = 0;
33 | virtual uint8_t endTransmission(bool stopBit) = 0;
34 | virtual uint8_t endTransmission(void) = 0;
35 |
36 | virtual uint8_t requestFrom(uint8_t address, size_t len, bool stopBit) = 0;
37 | virtual uint8_t requestFrom(uint8_t address, size_t len) = 0;
38 |
39 | virtual void onReceive(void(*)(int)) = 0;
40 | virtual void onRequest(void(*)(void)) = 0;
41 | };
42 |
43 |
--------------------------------------------------------------------------------
/cores/arduino/api/IPAddress.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | IPAddress.cpp - Base class that provides IPAddress
3 | Copyright (c) 2011 Adrian McEwen. All right reserved.
4 |
5 | This library is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU Lesser General Public
7 | License as published by the Free Software Foundation; either
8 | version 2.1 of the License, or (at your option) any later version.
9 |
10 | This library is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 | Lesser General Public License for more details.
14 |
15 | You should have received a copy of the GNU Lesser General Public
16 | License along with this library; if not, write to the Free Software
17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 | */
19 |
20 | #include "IPAddress.h"
21 | #include "Print.h"
22 |
23 | IPAddress::IPAddress() {
24 | _address.dword = 0;
25 | }
26 |
27 | IPAddress::IPAddress(uint8_t first_octet, uint8_t second_octet,
28 | uint8_t third_octet, uint8_t fourth_octet) {
29 | _address.bytes[0] = first_octet;
30 | _address.bytes[1] = second_octet;
31 | _address.bytes[2] = third_octet;
32 | _address.bytes[3] = fourth_octet;
33 | }
34 |
35 | IPAddress::IPAddress(uint32_t address) {
36 | _address.dword = address;
37 | }
38 |
39 | IPAddress::IPAddress(const uint8_t *address) {
40 | memcpy(_address.bytes, address, sizeof(_address.bytes));
41 | }
42 |
43 | bool IPAddress::fromString(const char *address) {
44 |
45 | uint16_t acc = 0; // Accumulator
46 | uint8_t dots = 0;
47 |
48 | while (*address) {
49 | char c = *address++;
50 | if (c >= '0' && c <= '9') {
51 | acc = acc * 10 + (c - '0');
52 | if (acc > 255) {
53 | // Value out of [0..255] range
54 | return false;
55 | }
56 | }
57 | else if (c == '.') {
58 | if (dots == 3) {
59 | // Too much dots (there must be 3 dots)
60 | return false;
61 | }
62 | _address.bytes[dots++] = acc;
63 | acc = 0;
64 | }
65 | else {
66 | // Invalid char
67 | return false;
68 | }
69 | }
70 |
71 | if (dots != 3) {
72 | // Too few dots (there must be 3 dots)
73 | return false;
74 | }
75 | _address.bytes[3] = acc;
76 | return true;
77 | }
78 |
79 | IPAddress &IPAddress::operator=(const uint8_t *address) {
80 | memcpy(_address.bytes, address, sizeof(_address.bytes));
81 | return *this;
82 | }
83 |
84 | IPAddress &IPAddress::operator=(uint32_t address) {
85 | _address.dword = address;
86 | return *this;
87 | }
88 |
89 | bool IPAddress::operator==(const uint8_t *addr) const {
90 | return memcmp(addr, _address.bytes, sizeof(_address.bytes)) == 0;
91 | }
92 |
93 | size_t IPAddress::printTo(Print &p) const {
94 | size_t n = 0;
95 | for (int i = 0; i < 3; i++) {
96 | n += p.print(_address.bytes[i], DEC);
97 | n += p.print('.');
98 | }
99 | n += p.print(_address.bytes[3], DEC);
100 | return n;
101 | }
102 |
103 | const IPAddress INADDR_NONE(0, 0, 0, 0);
104 |
--------------------------------------------------------------------------------
/cores/arduino/api/IPAddress.h:
--------------------------------------------------------------------------------
1 | /*
2 | IPAddress.h - Base class that provides IPAddress
3 | Copyright (c) 2011 Adrian McEwen. All right reserved.
4 |
5 | This library is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU Lesser General Public
7 | License as published by the Free Software Foundation; either
8 | version 2.1 of the License, or (at your option) any later version.
9 |
10 | This library is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 | Lesser General Public License for more details.
14 |
15 | You should have received a copy of the GNU Lesser General Public
16 | License along with this library; if not, write to the Free Software
17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 | #include "Printable.h"
24 | #include "ArduinoString.h"
25 |
26 | // A class to make it easier to handle and pass around IP addresses
27 |
28 | class IPAddress : public Printable {
29 | private:
30 | union {
31 | uint8_t bytes[4]; // IPv4 address
32 | uint32_t dword;
33 | } _address;
34 |
35 | // Access the raw byte array containing the address. Because this returns a
36 | // pointer to the internal structure rather than a copy of the address this
37 | // function should only be used when you know that the usage of the returned
38 | // uint8_t* will be transient and not stored.
39 | uint8_t *raw_address() {
40 | return _address.bytes;
41 | };
42 |
43 | public:
44 | // Constructors
45 | IPAddress();
46 | IPAddress(uint8_t first_octet, uint8_t second_octet,
47 | uint8_t third_octet, uint8_t fourth_octet);
48 | IPAddress(uint32_t address);
49 | IPAddress(const uint8_t *address);
50 |
51 | bool fromString(const char *address);
52 | bool fromString(const String &address) {
53 | return fromString(address.c_str());
54 | }
55 |
56 | // Overloaded cast operator to allow IPAddress objects to be used where a
57 | // pointer to a four-byte uint8_t array is expected
58 | operator uint32_t() const {
59 | return _address.dword;
60 | };
61 | bool operator==(const IPAddress &addr) const {
62 | return _address.dword == addr._address.dword;
63 | };
64 | bool operator!=(const IPAddress &addr) const {
65 | return _address.dword != addr._address.dword;
66 | };
67 | bool operator==(const uint8_t *addr) const;
68 |
69 | // Overloaded index operator to allow getting and setting individual octets
70 | // of the address
71 | uint8_t operator[](int index) const {
72 | return _address.bytes[index];
73 | };
74 | uint8_t &operator[](int index) {
75 | return _address.bytes[index];
76 | };
77 |
78 | // Overloaded copy operators to allow initialisation of IPAddress objects
79 | // from other types
80 | IPAddress &operator=(const uint8_t *address);
81 | IPAddress &operator=(uint32_t address);
82 |
83 | virtual size_t printTo(Print &p) const;
84 |
85 | friend class EthernetClass;
86 | friend class UDP;
87 | friend class Client;
88 | friend class Server;
89 | friend class DhcpClass;
90 | friend class DNSClient;
91 | };
92 |
93 | extern const IPAddress INADDR_NONE;
--------------------------------------------------------------------------------
/cores/arduino/api/Interrupts.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2019 Arduino LLC. All right reserved.
3 |
4 | This library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Lesser General Public
6 | License as published by the Free Software Foundation; either
7 | version 2.1 of the License, or (at your option) any later version.
8 |
9 | This library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | See the GNU Lesser General Public License for more details.
13 |
14 | You should have received a copy of the GNU Lesser General Public
15 | License along with this library; if not, write to the Free Software
16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | #ifndef W_INTERRUPTS_CPP
20 | #define W_INTERRUPTS_CPP
21 | #ifdef __cplusplus
22 |
23 | #include
24 | #include
25 | #include
26 | #include "Common.h"
27 |
28 | template
29 | using voidTemplateFuncPtrParam = void (*)(T param);
30 |
31 | template struct __container__ {
32 | void *param;
33 | voidTemplateFuncPtrParam function;
34 | };
35 |
36 | // C++ only overloaded version of attachInterrupt function
37 | template void attachInterrupt(pin_size_t interruptNum,
38 | voidTemplateFuncPtrParam userFunc, PinStatus mode, T ¶m) {
39 |
40 | struct __container__ *cont = new __container__();
41 | cont->param = ¶m;
42 | cont->function = userFunc;
43 |
44 | auto f = [](void *a) -> void {
45 | T param = *(T *)((struct __container__ *)a)->param;
46 | (((struct __container__ *)a)->function)(param);
47 | };
48 |
49 | attachInterruptParam(interruptNum, f, mode, cont);
50 | }
51 |
52 | template void attachInterrupt(pin_size_t interruptNum,
53 | voidTemplateFuncPtrParam userFunc, PinStatus mode, T *param) {
54 | attachInterruptParam(interruptNum, (voidFuncPtrParam)userFunc, mode,
55 | (void *)param);
56 | }
57 |
58 | #endif
59 | #endif
60 |
--------------------------------------------------------------------------------
/cores/arduino/api/Print.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2016 Arduino LLC. All right reserved.
3 |
4 | This library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Lesser General Public
6 | License as published by the Free Software Foundation; either
7 | version 2.1 of the License, or (at your option) any later version.
8 |
9 | This library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | See the GNU Lesser General Public License for more details.
13 |
14 | You should have received a copy of the GNU Lesser General Public
15 | License along with this library; if not, write to the Free Software
16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | #pragma once
20 |
21 | #include
22 | #include // for size_t
23 |
24 | #include "ArduinoString.h"
25 | #include "Printable.h"
26 |
27 | #define DEC 10
28 | #define HEX 16
29 | #define OCT 8
30 | #define BIN 2
31 |
32 | class Print {
33 | private:
34 | int write_error;
35 | size_t printNumber(unsigned long, uint8_t);
36 | size_t printULLNumber(unsigned long long, uint8_t);
37 | size_t printFloat(double, uint8_t);
38 | protected:
39 | void setWriteError(int err = 1) {
40 | write_error = err;
41 | }
42 | public:
43 | Print() : write_error(0) {}
44 |
45 | int getWriteError() {
46 | return write_error;
47 | }
48 | void clearWriteError() {
49 | setWriteError(0);
50 | }
51 |
52 | virtual size_t write(uint8_t) = 0;
53 | size_t write(const char *str) {
54 | if (str == NULL) {
55 | return 0;
56 | }
57 | return write((const uint8_t *)str, strlen(str));
58 | }
59 | virtual size_t write(const uint8_t *buffer, size_t size);
60 | size_t write(const char *buffer, size_t size) {
61 | return write((const uint8_t *)buffer, size);
62 | }
63 |
64 | size_t print(const __FlashStringHelper *);
65 | size_t print(const String &);
66 | size_t print(const char[]);
67 | size_t print(char);
68 | size_t print(unsigned char, int = DEC);
69 | size_t print(int, int = DEC);
70 | size_t print(unsigned int, int = DEC);
71 | size_t print(long, int = DEC);
72 | size_t print(unsigned long, int = DEC);
73 | size_t print(long long, int = DEC);
74 | size_t print(unsigned long long, int = DEC);
75 | size_t print(double, int = 2);
76 | size_t print(const Printable &);
77 |
78 | size_t println(const __FlashStringHelper *);
79 | size_t println(const String &s);
80 | size_t println(const char[]);
81 | size_t println(char);
82 | size_t println(unsigned char, int = DEC);
83 | size_t println(int, int = DEC);
84 | size_t println(unsigned int, int = DEC);
85 | size_t println(long, int = DEC);
86 | size_t println(unsigned long, int = DEC);
87 | size_t println(long long, int = DEC);
88 | size_t println(unsigned long long, int = DEC);
89 | size_t println(double, int = 2);
90 | size_t println(const Printable &);
91 | size_t println(void);
92 | };
93 |
94 |
--------------------------------------------------------------------------------
/cores/arduino/api/Printable.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2016 Arduino LLC. All right reserved.
3 |
4 | This library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Lesser General Public
6 | License as published by the Free Software Foundation; either
7 | version 2.1 of the License, or (at your option) any later version.
8 |
9 | This library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | See the GNU Lesser General Public License for more details.
13 |
14 | You should have received a copy of the GNU Lesser General Public
15 | License along with this library; if not, write to the Free Software
16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | #pragma once
20 |
21 | #include
22 |
23 | class Print;
24 |
25 | /** The Printable class provides a way for new classes to allow themselves to be
26 | printed. By deriving from Printable and implementing the printTo method, it
27 | will then be possible for users to print out instances of this class by
28 | passing them into the usual Print::print and Print::println methods.
29 | */
30 |
31 | class Printable {
32 | public:
33 | virtual size_t printTo(Print &p) const = 0;
34 | };
35 |
36 |
--------------------------------------------------------------------------------
/cores/arduino/api/SPI.h:
--------------------------------------------------------------------------------
1 | /*
2 | * SPI Master library for Teknic ClearCore.
3 | * Copyright (c) 2015 Arduino LLC
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 _SPI_H_INCLUDED
21 | #define _SPI_H_INCLUDED
22 |
23 | #include
24 | #include "SerialBase.h"
25 |
26 | // SPI_HAS_TRANSACTION means SPI has
27 | // - beginTransaction()
28 | // - endTransaction()
29 | // - usingInterrupt()
30 | // - SPISetting(clock, bitOrder, dataMode)
31 | #define SPI_HAS_TRANSACTION 1
32 |
33 | // SPI_HAS_NOTUSINGINTERRUPT means that SPI has notUsingInterrupt() method
34 | #define SPI_HAS_NOTUSINGINTERRUPT 1
35 |
36 | #define SPI_MODE0 0x00
37 | #define SPI_MODE1 0x01
38 | #define SPI_MODE2 0x02
39 | #define SPI_MODE3 0x03
40 |
41 | #define MAX_SPI 10000000
42 | #define SPI_MIN_CLOCK_DIVIDER 1
43 |
44 | class SPISettings {
45 | public:
46 | SPISettings(uint32_t clock, BitOrder bitOrder, uint8_t dataMode)
47 | : m_clockFreq(clock),
48 | m_bitOrder(bitOrder),
49 | m_dataMode(dataMode) {
50 | }
51 |
52 | // Default speed set to 4MHz, SPI mode set to MODE 0 and Bit order set to
53 | // MSB first.
54 | SPISettings()
55 | : m_clockFreq(10000000),
56 | m_bitOrder(BitOrder::MSBFIRST),
57 | m_dataMode(SPI_MODE0) {
58 | }
59 |
60 | private:
61 | uint32_t m_clockFreq;
62 | BitOrder m_bitOrder;
63 | uint8_t m_dataMode;
64 |
65 | friend class SPIClass;
66 | };
67 |
68 | class SPIClass {
69 | public:
70 | SPIClass(ClearCore::SerialBase &thePort, bool isCom);
71 |
72 | byte transfer(uint8_t data);
73 | uint16_t transfer16(uint16_t data);
74 | void transfer(void *buf, size_t count);
75 | void transfer(const void *txbuf, void *rxbuf, size_t count,
76 | bool block = true);
77 | void waitForTransfer(void);
78 |
79 | // Transaction Functions
80 | void usingInterrupt(int interruptNumber);
81 | void notUsingInterrupt(int interruptNumber);
82 | void beginTransaction(SPISettings settings);
83 | void endTransaction(void);
84 |
85 | // SPI Configuration methods
86 | void attachInterrupt();
87 | void detachInterrupt();
88 |
89 | void begin();
90 | void end();
91 |
92 | void setBitOrder(BitOrder order);
93 | void setDataMode(uint8_t uc_mode);
94 | void setClockDivider(uint8_t uc_div);
95 |
96 | private:
97 | void config();
98 |
99 | ClearCore::SerialBase *m_serial;
100 | bool m_isCom;
101 | SPISettings m_settings;
102 |
103 | };
104 |
105 | extern SPIClass SPI;
106 | extern SPIClass SPI1;
107 | extern SPIClass SPI2;
108 |
109 | // For compatibility with sketches designed for AVR @ 16 MHz
110 | // New programs should use SPI.beginTransaction to set the SPI clock
111 | #define SPI_CLOCK_DIV2 (MAX_SPI * 2 / 8000000)
112 | #define SPI_CLOCK_DIV4 (MAX_SPI * 2 / 4000000)
113 | #define SPI_CLOCK_DIV8 (MAX_SPI * 2 / 2000000)
114 | #define SPI_CLOCK_DIV16 (MAX_SPI * 2 / 1000000)
115 | #define SPI_CLOCK_DIV32 (MAX_SPI * 2 / 500000)
116 | #define SPI_CLOCK_DIV64 (MAX_SPI * 2 / 250000)
117 | #define SPI_CLOCK_DIV128 (MAX_SPI * 2 / 125000)
118 |
119 | #endif
120 |
--------------------------------------------------------------------------------
/cores/arduino/api/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 | #pragma once
21 |
22 | #include "Print.h"
23 |
24 | class Server : public Print {
25 | public:
26 | virtual void begin() = 0;
27 | };
28 |
29 |
--------------------------------------------------------------------------------
/cores/arduino/api/deprecated-avr-comp/avr/dtostrf.h:
--------------------------------------------------------------------------------
1 | /*
2 | dtostrf - Emulation for dtostrf function from avr-libc
3 | Copyright (c) 2015 Arduino LLC. All rights reserved.
4 |
5 | This library is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU Lesser General Public
7 | License as published by the Free Software Foundation; either
8 | version 2.1 of the License, or (at your option) any later version.
9 |
10 | This library is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 | Lesser General Public License for more details.
14 |
15 | You should have received a copy of the GNU Lesser General Public
16 | License along with this library; if not, write to the Free Software
17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 | */
19 |
20 | #pragma once
21 |
22 | #if !defined(ARDUINO_ARCH_AVR)
23 |
24 | #ifdef __cplusplus
25 | extern "C" {
26 | #endif
27 |
28 | char *dtostrf(double val, signed char width, unsigned char prec, char *sout);
29 |
30 | #ifdef __cplusplus
31 | }
32 | #endif
33 |
34 | #endif
35 |
--------------------------------------------------------------------------------
/cores/arduino/api/deprecated-avr-comp/avr/interrupt.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2015 Arduino LCC. All right reserved.
3 |
4 | This library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Lesser General Public
6 | License as published by the Free Software Foundation; either
7 | version 2.1 of the License, or (at your option) any later version.
8 |
9 | This library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | See the GNU Lesser General Public License for more details.
13 |
14 | You should have received a copy of the GNU Lesser General Public
15 | License along with this library; if not, write to the Free Software
16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | /*
20 | Empty file.
21 | This file is here to allow compatibility with sketches (made for AVR)
22 | that includes
23 | */
24 |
--------------------------------------------------------------------------------
/cores/arduino/api/deprecated/Client.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2016 Arduino LLC. All right reserved.
3 |
4 | This library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Lesser General Public
6 | License as published by the Free Software Foundation; either
7 | version 2.1 of the License, or (at your option) any later version.
8 |
9 | This library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | See the GNU Lesser General Public License for more details.
13 |
14 | You should have received a copy of the GNU Lesser General Public
15 | License along with this library; if not, write to the Free Software
16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | // including Client.h is deprecated, for all future projects use Arduino.h instead
20 |
21 | // This include is added for compatibility, it will be remove on the next
22 | // major release of the API
23 | #include "../Client.h"
24 |
25 |
26 |
--------------------------------------------------------------------------------
/cores/arduino/api/deprecated/HardwareSerial.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2016 Arduino LLC. All right reserved.
3 |
4 | This library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Lesser General Public
6 | License as published by the Free Software Foundation; either
7 | version 2.1 of the License, or (at your option) any later version.
8 |
9 | This library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | See the GNU Lesser General Public License for more details.
13 |
14 | You should have received a copy of the GNU Lesser General Public
15 | License along with this library; if not, write to the Free Software
16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | // including HardwareSerial.h is deprecated, for all future projects use Arduino.h instead
20 |
21 | // This include is added for compatibility, it will be remove on the next
22 | // major release of the API
23 | #include "../HardwareSerial.h"
24 |
25 |
26 |
--------------------------------------------------------------------------------
/cores/arduino/api/deprecated/IPAddress.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2016 Arduino LLC. All right reserved.
3 |
4 | This library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Lesser General Public
6 | License as published by the Free Software Foundation; either
7 | version 2.1 of the License, or (at your option) any later version.
8 |
9 | This library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | See the GNU Lesser General Public License for more details.
13 |
14 | You should have received a copy of the GNU Lesser General Public
15 | License along with this library; if not, write to the Free Software
16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | // including IPAddress.h is deprecated, for all future projects use Arduino.h instead
20 |
21 | // This include is added for compatibility, it will be remove on the next
22 | // major release of the API
23 | #include "../IPAddress.h"
24 |
25 |
26 |
--------------------------------------------------------------------------------
/cores/arduino/api/deprecated/Print.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2016 Arduino LLC. All right reserved.
3 |
4 | This library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Lesser General Public
6 | License as published by the Free Software Foundation; either
7 | version 2.1 of the License, or (at your option) any later version.
8 |
9 | This library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | See the GNU Lesser General Public License for more details.
13 |
14 | You should have received a copy of the GNU Lesser General Public
15 | License along with this library; if not, write to the Free Software
16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | // including Print.h is deprecated, for all future projects use Arduino.h instead
20 |
21 | // This include is added for compatibility, it will be remove on the next
22 | // major release of the API
23 | #include "../Print.h"
24 |
25 |
--------------------------------------------------------------------------------
/cores/arduino/api/deprecated/Printable.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2016 Arduino LLC. All right reserved.
3 |
4 | This library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Lesser General Public
6 | License as published by the Free Software Foundation; either
7 | version 2.1 of the License, or (at your option) any later version.
8 |
9 | This library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | See the GNU Lesser General Public License for more details.
13 |
14 | You should have received a copy of the GNU Lesser General Public
15 | License along with this library; if not, write to the Free Software
16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | // including Printable.h is deprecated, for all future projects use Arduino.h instead
20 |
21 | // This include is added for compatibility, it will be remove on the next
22 | // major release of the API
23 | #include "../Printable.h"
24 |
25 |
--------------------------------------------------------------------------------
/cores/arduino/api/deprecated/Server.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2016 Arduino LLC. All right reserved.
3 |
4 | This library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Lesser General Public
6 | License as published by the Free Software Foundation; either
7 | version 2.1 of the License, or (at your option) any later version.
8 |
9 | This library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | See the GNU Lesser General Public License for more details.
13 |
14 | You should have received a copy of the GNU Lesser General Public
15 | License along with this library; if not, write to the Free Software
16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | // including Server.h is deprecated, for all future projects use Arduino.h instead
20 |
21 | // This include is added for compatibility, it will be remove on the next
22 | // major release of the API
23 | #include "../Server.h"
24 |
25 |
26 |
--------------------------------------------------------------------------------
/cores/arduino/api/deprecated/Stream.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2016 Arduino LLC. All right reserved.
3 |
4 | This library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Lesser General Public
6 | License as published by the Free Software Foundation; either
7 | version 2.1 of the License, or (at your option) any later version.
8 |
9 | This library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | See the GNU Lesser General Public License for more details.
13 |
14 | You should have received a copy of the GNU Lesser General Public
15 | License along with this library; if not, write to the Free Software
16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | // including Stream.h is deprecated, for all future projects use Arduino.h instead
20 |
21 | // This include is added for compatibility, it will be remove on the next
22 | // major release of the API
23 | #include "../Stream.h"
24 |
25 |
26 |
--------------------------------------------------------------------------------
/cores/arduino/api/deprecated/Udp.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2016 Arduino LLC. All right reserved.
3 |
4 | This library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Lesser General Public
6 | License as published by the Free Software Foundation; either
7 | version 2.1 of the License, or (at your option) any later version.
8 |
9 | This library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | See the GNU Lesser General Public License for more details.
13 |
14 | You should have received a copy of the GNU Lesser General Public
15 | License along with this library; if not, write to the Free Software
16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | // including Udp.h is deprecated, for all future projects use Arduino.h instead
20 |
21 | // This include is added for compatibility, it will be remove on the next
22 | // major release of the API
23 | #include "../Udp.h"
24 |
25 |
26 |
--------------------------------------------------------------------------------
/cores/arduino/api/deprecated/WString.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2016, Arduino LLC. All Right Reserved.
3 |
4 | This library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Lesser General Public
6 | License as published by the Free Software Foundation; either
7 | version 2.1 of the License, or (at your option) any later version.
8 |
9 | This library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 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 St, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | // including WString.h is deprecated, for all future projects use Arduino.h instead
20 |
21 | // This include is added for compatibility, it will be remove on the next
22 | // major release of the API
23 | #include "../String.h"
24 |
25 |
--------------------------------------------------------------------------------
/cores/arduino/api/dtostrf.c:
--------------------------------------------------------------------------------
1 | /*
2 | dtostrf - Emulation for dtostrf function from avr-libc
3 | Copyright (c) 2016 Arduino LLC. All rights reserved.
4 |
5 | This library is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU Lesser General Public
7 | License as published by the Free Software Foundation; either
8 | version 2.1 of the License, or (at your option) any later version.
9 |
10 | This library is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 | Lesser General Public License for more details.
14 |
15 | You should have received a copy of the GNU Lesser General Public
16 | License along with this library; if not, write to the Free Software
17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 | */
19 |
20 | // This is a default implementation for dtostrf function.
21 | // This file should be used if the standard lib doesn't provide an
22 | // implementation of dtostrf.
23 |
24 | // Create a file called "dtostrf.c" with the following include:
25 | // #include "api/deprecated-avr-comp/avr/dtostrf.c.impl"
26 |
27 | #include
28 |
29 | char *dtostrf (double val, signed char width, unsigned char prec, char *sout) {
30 | asm(".global _printf_float");
31 |
32 | char fmt[20];
33 | sprintf(fmt, "%%%d.%df", width, prec);
34 | sprintf(sout, fmt, val);
35 | return sout;
36 | }
37 |
38 |
--------------------------------------------------------------------------------
/cores/arduino/api/itoa.c:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2014 Arduino LLC. All right reserved.
3 |
4 | This library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Lesser General Public
6 | License as published by the Free Software Foundation; either
7 | version 2.1 of the License, or (at your option) any later version.
8 |
9 | This library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | See the GNU Lesser General Public License for more details.
13 |
14 | You should have received a copy of the GNU Lesser General Public
15 | License along with this library; if not, write to the Free Software
16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | #include "itoa.h"
20 | #include
21 |
22 | #ifdef __cplusplus
23 | extern "C" {
24 | #endif
25 |
26 | #ifdef IMPL_ITOA
27 | // DCB: We need to keep the implementations of the functions in this file!
28 | // ltoa, itoa, etc. are not in the ANSI-C or C++ standards, so not
29 | // all compilers support them. You may be able to replace these with
30 | // standard versions in some cases, but they won't always work for everyone.
31 |
32 | char* ltoa( long value, char *string, int radix )
33 | {
34 | char tmp[33];
35 | char *tp = tmp;
36 | long i;
37 | unsigned long v;
38 | int sign;
39 | char *sp;
40 |
41 | if ( string == NULL )
42 | {
43 | return 0 ;
44 | }
45 |
46 | if (radix > 36 || radix <= 1)
47 | {
48 | return 0 ;
49 | }
50 |
51 | sign = (radix == 10 && value < 0);
52 | if (sign)
53 | {
54 | v = -value;
55 | }
56 | else
57 | {
58 | v = (unsigned long)value;
59 | }
60 |
61 | while (v || tp == tmp)
62 | {
63 | i = v % radix;
64 | v = v / radix;
65 | if (i < 10)
66 | *tp++ = i+'0';
67 | else
68 | *tp++ = i + 'a' - 10;
69 | }
70 |
71 | sp = string;
72 |
73 | if (sign)
74 | *sp++ = '-';
75 | while (tp > tmp)
76 | *sp++ = *--tp;
77 | *sp = 0;
78 |
79 | return string;
80 | }
81 |
82 | char* ultoa( unsigned long value, char *string, int radix )
83 | {
84 | char tmp[33];
85 | char *tp = tmp;
86 | long i;
87 | unsigned long v = value;
88 | char *sp;
89 |
90 | if ( string == NULL )
91 | {
92 | return 0;
93 | }
94 |
95 | if (radix > 36 || radix <= 1)
96 | {
97 | return 0;
98 | }
99 |
100 | while (v || tp == tmp)
101 | {
102 | i = v % radix;
103 | v = v / radix;
104 | if (i < 10)
105 | *tp++ = i+'0';
106 | else
107 | *tp++ = i + 'a' - 10;
108 | }
109 |
110 | sp = string;
111 |
112 |
113 | while (tp > tmp)
114 | *sp++ = *--tp;
115 | *sp = 0;
116 |
117 | return string;
118 | }
119 |
120 | char* itoa( int value, char *string, int radix )
121 | {
122 | return ltoa( value, string, radix ) ;
123 | }
124 |
125 | char* utoa( unsigned int value, char *string, int radix )
126 | {
127 | return ultoa( value, string, radix ) ;
128 | }
129 | #endif
130 |
131 | #ifdef __cplusplus
132 | } // extern "C"
133 | #endif
134 |
--------------------------------------------------------------------------------
/cores/arduino/api/itoa.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2016 Arduino LLC. All right reserved.
3 |
4 | This library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Lesser General Public
6 | License as published by the Free Software Foundation; either
7 | version 2.1 of the License, or (at your option) any later version.
8 |
9 | This library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | See the GNU Lesser General Public License for more details.
13 |
14 | You should have received a copy of the GNU Lesser General Public
15 | License along with this library; if not, write to the Free Software
16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | #pragma once
20 |
21 | // Standard C functions required in Arduino API
22 | // If these functions are not provided by the standard library, the
23 | // core should supply an implementation of them.
24 |
25 | #ifdef __cplusplus
26 | extern "C" {
27 | #endif
28 |
29 | #ifdef IMPL_ITOA
30 | extern char *itoa(int value, char *string, int radix);
31 | extern char *ltoa(long value, char *string, int radix);
32 | extern char *utoa(unsigned value, char *string, int radix);
33 | extern char *ultoa(unsigned long value, char *string, int radix);
34 |
35 | #else
36 |
37 | #include "stdlib.h"
38 | extern char *ltoa(long value, char *string, int radix) {
39 | return itoa((int)value, string, radix);
40 | }
41 |
42 | extern char *ultoa(unsigned long value, char *string, int radix) {
43 | return utoa((unsigned)value, string, radix);
44 | }
45 | #endif
46 |
47 | #ifdef __cplusplus
48 | } // extern "C"
49 | #endif
50 |
51 |
--------------------------------------------------------------------------------
/cores/arduino/delay.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2015 Arduino LLC. All right reserved.
3 |
4 | This library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Lesser General Public
6 | License as published by the Free Software Foundation; either
7 | version 2.1 of the License, or (at your option) any later version.
8 |
9 | This library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | See the GNU Lesser General Public License for more details.
13 |
14 | You should have received a copy of the GNU Lesser General Public
15 | License along with this library; if not, write to the Free Software
16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | #include
20 | #include
21 | #include "Reset.h" // for tickReset()
22 | #include "SysTiming.h"
23 |
24 | #ifdef __cplusplus
25 | extern "C" {
26 | #endif
27 |
28 | /** Tick Counter united by ms */
29 | static volatile uint32_t _ulTickCount = 0;
30 |
31 | unsigned long millis(void) {
32 | return Milliseconds();
33 | }
34 |
35 | unsigned long micros(void) {
36 | return Microseconds();
37 | }
38 |
39 | void delay(unsigned long ms) {
40 | Delay_ms(ms);
41 | }
42 |
43 | void delayMicroseconds(unsigned int usec) {
44 | Delay_us(usec);
45 | }
46 |
47 | void SysTick_DefaultHandler(void) {
48 | // Increment tick count each ms
49 | _ulTickCount++;
50 | // See if USB Serial or others have caused a reset to bootloader cycle
51 | tickReset();
52 | }
53 |
54 | #ifdef __cplusplus
55 | }
56 | #endif
57 |
--------------------------------------------------------------------------------
/cores/arduino/delay.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2015 Arduino LLC. All right reserved.
3 |
4 | This library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Lesser General Public
6 | License as published by the Free Software Foundation; either
7 | version 2.1 of the License, or (at your option) any later version.
8 |
9 | This library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | See the GNU Lesser General Public License for more details.
13 |
14 | You should have received a copy of the GNU Lesser General Public
15 | License along with this library; if not, write to the Free Software
16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | #ifndef _DELAY_
20 | #define _DELAY_
21 |
22 | #include
23 | #include "variant.h"
24 |
25 | #ifdef __cplusplus
26 | extern "C" {
27 | #endif
28 |
29 | /**
30 | * \brief Returns the number of milliseconds since the Arduino board began
31 | * running the current program.
32 | *
33 | * This number will overflow (go back to zero), after approximately 50 days.
34 | *
35 | * \return Number of milliseconds since the program started (uint32_t)
36 | */
37 | extern unsigned long millis(void) ;
38 |
39 | /**
40 | * \brief Returns the number of microseconds since the Arduino board began
41 | * running the current program.
42 | *
43 | * This number will overflow (go back to zero), after approximately 70 minutes.
44 | *
45 | * \note There are 1,000 microseconds in a millisecond and 1,000,000
46 | * microseconds in a second.
47 | */
48 | extern unsigned long micros(void) ;
49 |
50 | /**
51 | * \brief Pauses the program for the amount of time (in milliseconds) specified
52 | * as parameter.
53 | * (There are 1000 milliseconds in a second.)
54 | *
55 | * \param dwMs the number of milliseconds to pause (uint32_t)
56 | */
57 | extern void delay(unsigned long dwMs) ;
58 |
59 | /**
60 | * \brief Pauses the program for the amount of time (in microseconds) specified
61 | * as parameter.
62 | *
63 | * \param usec the number of microseconds to pause (uint32_t)
64 | */
65 | extern void delayMicroseconds(unsigned int usec) ;
66 |
67 | #ifdef __cplusplus
68 | }
69 | #endif
70 |
71 | #endif /* _DELAY_ */
72 |
--------------------------------------------------------------------------------
/cores/arduino/hooks.c:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2015 Arduino LLC. All right reserved.
3 |
4 | This library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Lesser General Public
6 | License as published by the Free Software Foundation; either
7 | version 2.1 of the License, or (at your option) any later version.
8 |
9 | This library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | See the GNU Lesser General Public License for more details.
13 |
14 | You should have received a copy of the GNU Lesser General Public
15 | License along with this library; if not, write to the Free Software
16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | /**
20 | * Empty yield() hook.
21 | *
22 | * This function is intended to be used by library writers to build
23 | * libraries or sketches that supports cooperative threads.
24 | *
25 | * Its defined as a weak symbol and it can be redefined to implement a
26 | * real cooperative scheduler.
27 | */
28 | static void __empty() {
29 | // Empty
30 | }
31 | void yield(void) __attribute__ ((weak, alias("__empty")));
32 |
33 | /**
34 | * SysTick hook
35 | *
36 | * This function is called from SysTick handler, before the default
37 | * handler provided by Arduino.
38 | */
39 | static int __false() {
40 | // Return false
41 | return 0;
42 | }
43 | int sysTickHook(void) __attribute__ ((weak, alias("__false")));
44 |
45 | /**
46 | * SVC hook
47 | * PendSV hook
48 | *
49 | * These functions are called from SVC handler, and PensSV handler.
50 | * Default action is halting.
51 | */
52 | static void __halt() {
53 | // Halts
54 | while (1)
55 | ;
56 | }
57 | void svcHook(void) __attribute__ ((weak, alias("__halt")));
58 | void pendSVHook(void) __attribute__ ((weak, alias("__halt")));
59 |
--------------------------------------------------------------------------------
/cores/arduino/main.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2015 Arduino LLC. All right reserved.
3 |
4 | This library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Lesser General Public
6 | License as published by the Free Software Foundation; either
7 | version 2.1 of the License, or (at your option) any later version.
8 |
9 | This library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | See the GNU Lesser General Public License for more details.
13 |
14 | You should have received a copy of the GNU Lesser General Public
15 | License along with this library; if not, write to the Free Software
16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | #define ARDUINO_MAIN
20 | #include "SysManager.h"
21 | #include "SerialDriver.h"
22 | #include "SerialUsb.h"
23 | #include "SysTiming.h"
24 | #include "sam.h"
25 | #include
26 |
27 | // Board resource controller
28 | namespace ClearCore {
29 | extern SysManager SysMgr;
30 | extern SerialUsb ConnectorUsb;
31 | extern SerialDriver ConnectorCOM0;
32 | extern SerialDriver ConnectorCOM1;
33 | }
34 |
35 | /*
36 | * \brief Main entry point of Arduino application
37 | */
38 | int main(void) {
39 | // - - - - - - - - - - - - - - - - - - - - - -
40 | // Perform C++ initializations before sketch
41 | // - - - - - - - - - - - - - - - - - - - - - -
42 | delay(1);
43 | // Start sketch "setup"
44 | setup();
45 |
46 | for (;;) {
47 | // sketch "loop"
48 | loop();
49 | if (serialEventRun) {
50 | serialEventRun();
51 | }
52 | }
53 |
54 | return 0;
55 | }
56 |
57 | /* Default Arduino systick handler */
58 | extern "C" int sysTickHook(void);
59 | extern "C" void SysTick_DefaultHandler(void);
60 |
61 | extern "C" void SysTick_Handler(void) __attribute__((weak));
62 | extern "C" void SysTick_Handler(void) {
63 | ClearCore::SysMgr.SysTickUpdate();
64 | if (sysTickHook()) {
65 | return;
66 | }
67 | SysTick_DefaultHandler();
68 | }
--------------------------------------------------------------------------------
/cores/arduino/new.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2014 Arduino. All right reserved.
3 |
4 | This library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Lesser General Public
6 | License as published by the Free Software Foundation; either
7 | version 2.1 of the License, or (at your option) any later version.
8 |
9 | This library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | See the GNU Lesser General Public License for more details.
13 |
14 | You should have received a copy of the GNU Lesser General Public
15 | License along with this library; if not, write to the Free Software
16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | #include
20 |
21 | void *operator new (size_t size) {
22 | return malloc(size);
23 | }
24 |
25 | void *operator new[](size_t size) {
26 | return malloc(size);
27 | }
28 |
29 | void operator delete (void *ptr) {
30 | free(ptr);
31 | }
32 |
33 | void operator delete[](void *ptr) {
34 | free(ptr);
35 | }
36 |
37 |
--------------------------------------------------------------------------------
/cores/arduino/wiring_analog.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2014 Arduino LLC. All right reserved.
3 |
4 | This library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Lesser General Public
6 | License as published by the Free Software Foundation; either
7 | version 2.1 of the License, or (at your option) any later version.
8 |
9 | This library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | See the GNU Lesser General Public License for more details.
13 |
14 | You should have received a copy of the GNU Lesser General Public
15 | License along with this library; if not, write to the Free Software
16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | #include
20 | #include "Arduino.h"
21 |
22 | void analogWrite(pin_size_t ulPin, uint32_t ulVal, AnalogOutMode mode,
23 | AnalogOutputUnits units) {
24 | analogWriteAPI(ulPin, (int)ulVal, mode, units);
25 | }
26 |
27 | int analogRead(pin_size_t ulPin, AnalogInputUnits units) {
28 | return analogReadAPI(ulPin, units);
29 | }
--------------------------------------------------------------------------------
/cores/arduino/wiring_digital.c:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2015 Arduino LLC. All right reserved.
3 |
4 | This library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Lesser General Public
6 | License as published by the Free Software Foundation; either
7 | version 2.1 of the License, or (at your option) any later version.
8 |
9 | This library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | See the GNU Lesser General Public License for more details.
13 |
14 | You should have received a copy of the GNU Lesser General Public
15 | License along with this library; if not, write to the Free Software
16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | #include
20 | #include "WVariant.h"
21 | #include "Common.h"
22 |
23 | #ifdef __cplusplus
24 | extern "C" {
25 | #endif
26 |
27 | void digitalWrite(pin_size_t ulPin, uint32_t ulVal) {
28 | digitalWriteClearCore(ulPin, (PinStatus)ulVal);
29 | }
30 |
31 | PinStatus digitalRead(pin_size_t ulPin) {
32 | return digitalReadClearCore(ulPin);
33 | }
34 |
35 | #ifdef __cplusplus
36 | }
37 | #endif
--------------------------------------------------------------------------------
/cores/arduino/wiring_digital.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2015 Arduino LLC. All right reserved.
3 |
4 | This library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Lesser General Public
6 | License as published by the Free Software Foundation; either
7 | version 2.1 of the License, or (at your option) any later version.
8 |
9 | This library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | See the GNU Lesser General Public License for more details.
13 |
14 | You should have received a copy of the GNU Lesser General Public
15 | License along with this library; if not, write to the Free Software
16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | #pragma once
20 |
21 | #include "variant.h"
--------------------------------------------------------------------------------
/cores/arduino/wiring_shift.c:
--------------------------------------------------------------------------------
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 | #ifdef __cplusplus
22 | extern "C"{
23 | #endif
24 |
25 | uint8_t shiftIn(pin_size_t ulDataPin,
26 | pin_size_t ulClockPin,
27 | BitOrder ulBitOrder) {
28 | uint8_t value = 0 ;
29 | uint8_t i ;
30 |
31 | for ( i=0 ; i < 8 ; ++i ) {
32 | digitalWrite( ulClockPin, HIGH ) ;
33 |
34 | if ( ulBitOrder == LSBFIRST ) {
35 | value |= digitalRead( ulDataPin ) << i ;
36 | }
37 | else {
38 | value |= digitalRead( ulDataPin ) << (7 - i) ;
39 | }
40 |
41 | digitalWrite( ulClockPin, LOW ) ;
42 | }
43 |
44 | return value ;
45 | }
46 |
47 | void shiftOut(pin_size_t ulDataPin,
48 | pin_size_t ulClockPin,
49 | BitOrder ulBitOrder,
50 | uint8_t ulVal) {
51 | uint8_t i ;
52 |
53 | for ( i=0 ; i < 8 ; i++ ) {
54 | if ( ulBitOrder == LSBFIRST ) {
55 | digitalWrite( ulDataPin, !!(ulVal & (1 << i)) ) ;
56 | }
57 | else {
58 | digitalWrite( ulDataPin, !!(ulVal & (1 << (7 - i))) ) ;
59 | }
60 |
61 | digitalWrite( ulClockPin, HIGH ) ;
62 | digitalWrite( ulClockPin, LOW ) ;
63 | }
64 | }
65 |
66 | #ifdef __cplusplus
67 | } // extern "C"
68 | #endif
69 |
--------------------------------------------------------------------------------
/drivers/TeknicClearCore.inf:
--------------------------------------------------------------------------------
1 | ; Windows 2000, XP, Vista, 7 and 8 (x32 and x64) setup file for Atmel CDC Devices
2 | ; Copyright (c) 2000-2013 ATMEL, Inc.
3 |
4 | [Version]
5 | Signature = "$Windows NT$"
6 | Class = Ports
7 | ClassGuid = {4D36E978-E325-11CE-BFC1-08002BE10318}
8 |
9 | Provider = %Manufacturer%
10 | LayoutFile = layout.inf
11 | CatalogFile = teknicclearcore.cat
12 | DriverVer = 01/09/2020,1.0.0.7
13 |
14 | ;----------------------------------------------------------
15 | ; Targets
16 | ;----------------------------------------------------------
17 | [Manufacturer]
18 | %Manufacturer%=DeviceList, NTAMD64, NTIA64, NT
19 |
20 | [DeviceList]
21 | %TEK_CORE% = DriverInstall, USB\VID_2890&PID_8022
22 | %TEK_BOOT% = DriverInstall, USB\VID_2890&PID_0022&MI_00
23 |
24 | [DeviceList.NTAMD64]
25 | %TEK_CORE% = DriverInstall, USB\VID_2890&PID_8022
26 | %TEK_BOOT% = DriverInstall, USB\VID_2890&PID_0022&MI_00
27 |
28 | [DeviceList.NTIA64]
29 | %TEK_CORE% = DriverInstall, USB\VID_2890&PID_8022
30 | %TEK_BOOT% = DriverInstall, USB\VID_2890&PID_0022&MI_00
31 |
32 | [DeviceList.NT]
33 | %TEK_CORE% = DriverInstall, USB\VID_2890&PID_8022
34 | %TEK_BOOT% = DriverInstall, USB\VID_2890&PID_0022&MI_00
35 |
36 | ;----------------------------------------------------------
37 | ; Windows 2000, XP, Vista, Windows 7, Windows 8 - 32bit
38 | ;----------------------------------------------------------
39 | [Reader_Install.NTx86]
40 |
41 |
42 | [DestinationDirs]
43 | DefaultDestDir=12
44 | DriverInstall.NT.Copy=12
45 |
46 | [DriverInstall.NT]
47 | include=mdmcpq.inf
48 | CopyFiles=DriverInstall.NT.Copy
49 | AddReg=DriverInstall.NT.AddReg
50 |
51 | [DriverInstall.NT.Copy]
52 | usbser.sys
53 |
54 | [DriverInstall.NT.AddReg]
55 | HKR,,DevLoader,,*ntkern
56 | HKR,,NTMPDriver,,usbser.sys
57 | HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
58 |
59 | [DriverInstall.NT.Services]
60 | AddService = usbser, 0x00000002, DriverService.NT
61 |
62 | [DriverService.NT]
63 | DisplayName = %Serial.SvcDesc%
64 | ServiceType = 1 ; SERVICE_KERNEL_DRIVER
65 | StartType = 3 ; SERVICE_DEMAND_START
66 | ErrorControl = 1 ; SERVICE_ERROR_NORMAL
67 | ServiceBinary = %12%\usbser.sys
68 | LoadOrderGroup = Base
69 |
70 | ;----------------------------------------------------------
71 | ; Windows XP, Vista, Windows 7, Windows 8 - 64bit
72 | ;----------------------------------------------------------
73 |
74 | [DriverInstall.NTamd64]
75 | include=mdmcpq.inf
76 | CopyFiles=DriverCopyFiles.NTamd64
77 | AddReg=DriverInstall.NTamd64.AddReg
78 |
79 | [DriverCopyFiles.NTamd64]
80 | usbser.sys,,,0x20
81 |
82 | [DriverInstall.NTamd64.AddReg]
83 | HKR,,DevLoader,,*ntkern
84 | HKR,,NTMPDriver,,usbser.sys
85 | HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
86 |
87 | [DriverInstall.NTamd64.Services]
88 | AddService=usbser, 0x00000002, DriverService.NTamd64
89 |
90 | [DriverService.NTamd64]
91 | DisplayName=%Serial.SvcDesc%
92 | ServiceType=1
93 | StartType=3
94 | ErrorControl=1
95 | ServiceBinary=%12%\usbser.sys
96 |
97 | ;----------------------------------------------------------
98 | ; String
99 | ;----------------------------------------------------------
100 |
101 | [Strings]
102 | Manufacturer = "Teknic, Inc."
103 | MFGFILENAME="TeknicClearCore"
104 | ManufacturerName="Teknic, Inc."
105 | INSTDISK="Teknic ClearCore USB Installer"
106 | DESCRIPTION="Teknic ClearCore Module"
107 | ServiceName="ClearCore USB Serial Emulation Driver"
108 | TEK_CORE="Teknic ClearCore"
109 | TEK_BOOT="Teknic ClearCore UF2 Bootloader"
110 |
111 | Serial.SvcDesc = "USB Serial emulation driver"
112 |
113 |
--------------------------------------------------------------------------------
/drivers/teknicclearcore.cat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Teknic-Inc/ClearCore-Arduino-wrapper/6fa1d810705c518b78962cb2a7bd7326bddf9d08/drivers/teknicclearcore.cat
--------------------------------------------------------------------------------
/libraries/AnalogIO/examples/WriteAnalogCurrentOutput/WriteAnalogCurrentOutput.ino:
--------------------------------------------------------------------------------
1 | /*
2 | * Title: WriteAnalogCurrentOutput
3 | *
4 | * Objective:
5 | * This example demonstrates how to write analog current values to an analog
6 | * current output connector.
7 | *
8 | * Description:
9 | * This example configures pin IO-0 as an analog current output. It outputs
10 | * a repeating analog signal, starting at 0mA, increasing to 20mA, and
11 | * decreasing back to 0mA.
12 | *
13 | * Requirements:
14 | * ** Connect a device to IO-0 which takes in analog current.
15 | *
16 | * Links:
17 | * ** ClearCore Documentation: https://teknic-inc.github.io/ClearCore-library/
18 | * ** ClearCore Manual: https://www.teknic.com/files/downloads/clearcore_user_manual.pdf
19 | *
20 | *
21 | * Copyright (c) 2020 Teknic Inc. This work is free to use, copy and distribute under the terms of
22 | * the standard MIT permissive software license which can be found at https://opensource.org/licenses/MIT
23 | */
24 |
25 |
26 | void setup() {
27 | // Put your setup code here, it will run once:
28 |
29 | // Set up connector IO-0 to be an output. We will specify that it outputs
30 | // current in our analogWrite functions later (as opposed to a digital
31 | // signal or PWM).
32 | // Note that only connector IO-0 is capable of analog current output.
33 | pinMode(IO0, OUTPUT);
34 | }
35 |
36 | void loop() {
37 | // Put your main code here, it will run repeatedly:
38 |
39 | // Ramp the current output of IO-0 up to 20 mA. If using an operating
40 | // range of 4-20 mA, change the lower bounds of the loops below to 410
41 | // instead of 0.
42 | for (uint16_t value = 0; value < 2047; value++) {
43 | // ClearCore's analog current output has 11-bit resolution, so we write
44 | // values of 0 to 2047 (corresponding to 0-20 mA) or 410 to 2047
45 | // (corresponding to 4-20 mA).
46 | analogWrite(IO0, value, CURRENT);
47 | delay(2);
48 | }
49 |
50 | // Ramp the current output of IO-0 back down.
51 | for (uint16_t value = 2047; value > 0; value--) {
52 | analogWrite(IO0, value, CURRENT);
53 | delay(2);
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/libraries/AnalogIO/examples/WritePwmOutput/WritePwmOutput.ino:
--------------------------------------------------------------------------------
1 | /*
2 | * Title: WritePwmOutput
3 | *
4 | * Objective:
5 | * This example demonstrates how to write a digital PWM signal to a ClearCore
6 | * digital output.
7 | *
8 | * Description:
9 | * This example sets the defined pin as an output then writes a series of
10 | * PWM signals with varying duty cycles to the output.
11 | *
12 | * Requirements:
13 | * ** Connect a device that takes in a PWM signal to IO-1
14 | *
15 | * Links:
16 | * ** ClearCore Documentation: https://teknic-inc.github.io/ClearCore-library/
17 | * ** ClearCore Manual: https://www.teknic.com/files/downloads/clearcore_user_manual.pdf
18 | *
19 | *
20 | * Copyright (c) 2020 Teknic Inc. This work is free to use, copy and distribute under the terms of
21 | * the standard MIT permissive software license which can be found at https://opensource.org/licenses/MIT
22 | */
23 |
24 | // Specify which output pin to write digital PWM to.
25 | // PWM-capable pins: IO-0 through IO-5.
26 | // Note: IO-4 and IO-5 are capable of bi-directional and higher-current PWM
27 | // output using an H-Bridge. See the WriteHBridgeOutput example.
28 | #define outputPin IO1
29 |
30 | void setup() {
31 | // Put your setup code here, it will run once:
32 |
33 | // Set up the output pin to be an output
34 | pinMode(outputPin, OUTPUT);
35 | }
36 |
37 | void loop() {
38 | // Put your main code here, it will run repeatedly:
39 |
40 | // Write some digital PWM signals to the output connector.
41 | // Note: analogWrite() is the Arduino wrapper function used to write PWM,
42 | // despite the fact that it is not a "true" analog signal
43 | // Valid values range from 0 (0% duty cycle / always off)
44 | // to 255 (100% duty cycle / always on).
45 |
46 | // Output a low duty cycle for 1 second.
47 | analogWrite(outputPin, 10);
48 | delay(1000);
49 |
50 | // Output a medium duty cycle for 1 second.
51 | analogWrite(outputPin, 120);
52 | delay(1000);
53 |
54 | // Output a high duty cycle for 1 second.
55 | analogWrite(outputPin, 230);
56 | delay(1000);
57 | }
58 |
--------------------------------------------------------------------------------
/libraries/AnalogIO/library.properties:
--------------------------------------------------------------------------------
1 | name=ClearCore Analog I/O
2 | version=1.0.0
3 | author=Teknic
4 | maintainer=Teknic
5 | sentence=Teknic Analog I/O Examples
6 | paragraph=Teknic Analog I/O Examples
7 | category=Device Control
8 | url=https://github.com/Teknic-Inc/ClearCore-Arduino-wrapper
9 | architectures=sam
10 |
--------------------------------------------------------------------------------
/libraries/AnalogIO/src/AnalogIO-examples.h:
--------------------------------------------------------------------------------
1 |
2 | // This is just an empty header file to make this a valid Arduino library
--------------------------------------------------------------------------------
/libraries/CCIO-8/examples/ReadCCIODigitalInput/ReadCCIODigitalInput.ino:
--------------------------------------------------------------------------------
1 | /*
2 | * Title: ReadCCIODigitalInput
3 | *
4 | * Objective:
5 | * This example demonstrates how to initialize a CCIO-8 Expansion Board and
6 | * read from one of its inputs.
7 | *
8 | * Description:
9 | * This example sets up COM-0 to control a CCIO-8 Expansion Board then reads
10 | * the state of an input on the CCIO-8's connector 0. During operation, the
11 | * state of the input is printed to the USB serial port.
12 | *
13 | * Requirements:
14 | * ** A CCIO-8 Expansion Board powered and connected to COM-0.
15 | * ** An digital input device such as a switch connected to the CCIO-8's
16 | * connector 0.
17 | *
18 | * Links:
19 | * ** ClearCore Documentation: https://teknic-inc.github.io/ClearCore-library/
20 | * ** ClearCore Manual: https://www.teknic.com/files/downloads/clearcore_user_manual.pdf
21 | *
22 | *
23 | * Copyright (c) 2020 Teknic Inc. This work is free to use, copy and distribute under the terms of
24 | * the standard MIT permissive software license which can be found at https://opensource.org/licenses/MIT
25 | */
26 |
27 | #include "ClearCore.h"
28 |
29 |
30 | // Specify which ClearCore serial COM port is connected to the COM IN port
31 | // of the CCIO-8 board: ConnectorCOM0 or ConnectorCOM1.
32 | #define CcioPort ConnectorCOM0
33 |
34 | // Select the baud rate to match the target serial device.
35 | #define baudRate 9600
36 |
37 | void setup() {
38 | // Put your setup code here, it will run once:
39 |
40 | // Set up serial communication to display CCIO-8 state.
41 | Serial.begin(baudRate);
42 | uint32_t timeout = 5000;
43 | uint32_t startTime = millis();
44 | while (!Serial && millis() - startTime < timeout) {
45 | continue;
46 | }
47 |
48 | // Set up the CCIO-8 COM port.
49 | CcioPort.Mode(Connector::CCIO);
50 | CcioPort.PortOpen();
51 |
52 | // Make sure the input connector is in input mode (the default for all
53 | // CCIO-8 pins).
54 | pinMode(CLEARCORE_PIN_CCIOA0, INPUT);
55 | }
56 |
57 | void loop() {
58 | // Put your main code here, it will run repeatedly:
59 |
60 | // Read the state of the input connector
61 | PinStatus state = digitalRead(CLEARCORE_PIN_CCIOA0);
62 |
63 | // Display the state of the input connector.
64 | Serial.print("CCIOA0 Input state: ");
65 | if (state) {
66 | Serial.println("ON");
67 | }
68 | else {
69 | Serial.println("OFF");
70 | }
71 |
72 | // Wait a second then repeat...
73 | delay(1000);
74 | }
75 |
--------------------------------------------------------------------------------
/libraries/CCIO-8/examples/WriteCCIODigitalOutput/WriteCCIODigitalOutput.ino:
--------------------------------------------------------------------------------
1 | /*
2 | * Title: WriteCCIODigitalOutput
3 | *
4 | * Objective:
5 | * This example demonstrates how to initialize a CCIO-8 Expansion Board and
6 | * write to its outputs.
7 | *
8 | * Description:
9 | * This example sets up COM-0 to control a CCIO-8 Expansion Board then
10 | * toggles the state of all of the CCIO-8's outputs from true to false.
11 | *
12 | * Requirements:
13 | * ** A CCIO-8 Expansion Board powered and connected to COM-0.
14 | * ** An output such as an LED connected to one or more of the CCIO-8's
15 | * connectors.
16 | * Note: You can leave the I/O points disconnected and still see the
17 | * built-in I/O LEDs toggle with the connector state.
18 | *
19 | * Links:
20 | * ** ClearCore Documentation: https://teknic-inc.github.io/ClearCore-library/
21 | * ** ClearCore Manual: https://www.teknic.com/files/downloads/clearcore_user_manual.pdf
22 | *
23 | *
24 | * Copyright (c) 2020 Teknic Inc. This work is free to use, copy and distribute under the terms of
25 | * the standard MIT permissive software license which can be found at https://opensource.org/licenses/MIT
26 | */
27 |
28 | #include "ClearCore.h"
29 |
30 | // Specify which ClearCore serial COM port is connected to the COM IN port
31 | // of the CCIO-8 board: ConnectorCOM0 or ConnectorCOM1.
32 | #define CcioPort ConnectorCOM0
33 |
34 | // The state to be written to each output connector.
35 | bool outputState;
36 |
37 | void setup() {
38 | // Put your setup code here, it will run once:
39 |
40 | // Set up the CCIO-8 COM port.
41 | CcioPort.Mode(Connector::CCIO);
42 | CcioPort.PortOpen();
43 |
44 | // Using the CCIO-8 Board Manager, configure each connector on a single
45 | // ClearCore I/O Expansion Board as an output. They can be either digital
46 | // inputs or digital outputs.
47 | // Note: If there is more than one CCIO-8 in the link, you may want to
48 | // to change the limit of the for-loop from "CLEARCORE_PIN_CCIOA7" to the
49 | // value of the last CCIO-8 connector to accommodate the additional boards.
50 | // For example, if you are using three CCIO-8 boards, change this value to
51 | // "CLEARCORE_PIN_CCIOC7", and do the same for the for-loop in the loop()
52 | // function below.
53 | for (int pin = CLEARCORE_PIN_CCIOA0; pin <= CLEARCORE_PIN_CCIOA7; pin++) {
54 | pinMode(pin, OUTPUT);
55 | }
56 |
57 | // The connectors are all set up; start the loop with turning them all on.
58 | outputState = true;
59 | }
60 |
61 | void loop() {
62 | // Put your main code here, it will run repeatedly:
63 |
64 | // Send the current state to each of the outputs.
65 | for (int pin = CLEARCORE_PIN_CCIOA0; pin <= CLEARCORE_PIN_CCIOA7; pin++) {
66 | digitalWrite(pin, outputState);
67 | }
68 |
69 | // Toggle the state to be written next time.
70 | outputState = !outputState;
71 |
72 | // Wait 1 second.
73 | delay(1000);
74 | }
75 |
--------------------------------------------------------------------------------
/libraries/CCIO-8/examples/WriteCCIODigitalOutputPulses/WriteCCIODigitalOutputPulses.ino:
--------------------------------------------------------------------------------
1 | /*
2 | * Title: WriteCCIODigitalOutputPulses
3 | *
4 | * Objective:
5 | * This example demonstrates how to initialize a CCIO-8 Expansion Board and
6 | * write digital pulses to its outputs.
7 | *
8 | * Description:
9 | * This example sets up COM-0 to control a CCIO-8 Expansion Board then
10 | * writes a series of digital pulses to the defined connector.
11 | *
12 | * Requirements:
13 | * ** A CCIO-8 Expansion Board powered and connected to COM-0
14 | * ** An output such as an LED connected to defined connector (CCIO-0)
15 | * Note: You can leave the I/O point disconnected and still see the
16 | * built-in I/O LED toggle with the connector state.
17 | *
18 | * Links:
19 | * ** ClearCore Documentation: https://teknic-inc.github.io/ClearCore-library/
20 | * ** ClearCore Manual: https://www.teknic.com/files/downloads/clearcore_user_manual.pdf
21 | *
22 | *
23 | * Copyright (c) 2020 Teknic Inc. This work is free to use, copy and distribute under the terms of
24 | * the standard MIT permissive software license which can be found at https://opensource.org/licenses/MIT
25 | */
26 |
27 | #include "ClearCore.h"
28 |
29 | // Specify which ClearCore serial COM port is connected to the COM IN port
30 | // of the CCIO-8 board: ConnectorCOM0 or ConnectorCOM1.
31 | #define CcioPort ConnectorCOM0
32 |
33 | // Specify which output pin to write digital output pulses.
34 | // All connectors on the ClearCore I/O Expansion Board are capable of
35 | // pulsing the output.
36 | #define OutputPin CLEARCORE_PIN_CCIOA0
37 |
38 | void setup() {
39 | // Put your setup code here, it will run once:
40 |
41 | // Set up the CCIO-8 COM port.
42 | CcioPort.Mode(Connector::CCIO);
43 | CcioPort.PortOpen();
44 |
45 | // Set up the output connector in output mode.
46 | pinMode(OutputPin, OUTPUT);
47 | }
48 |
49 | void loop() {
50 | // Put your main code here, it will run repeatedly:
51 |
52 | // Generate a 100ms on/100ms off pulse that runs until
53 | // the stop function is called.
54 | OutputPulsesStart(OutputPin, 100, 100);
55 | delay(1000);
56 |
57 | // Stop any further pulses on the pin. The second argument controls how
58 | // output pulses are stopped. If true, the output pulses will be stopped
59 | // immediately (this is the default behavior); if false, the active pulse
60 | // cycle will be completed first.
61 | OutputPulsesStop(OutputPin, true);
62 |
63 | // Generate a 250ms on/50ms off pulse that continues until
64 | // 20 on/off cycles are complete or until the stop function
65 | // is called.
66 | OutputPulsesStart(OutputPin, 250, 50, 20);
67 | delay(6000);
68 |
69 | // Pulses should be complete, but call stop to be safe.
70 | OutputPulsesStop(OutputPin, true);
71 |
72 | // Generate a 300ms on/500ms off pulse that runs for 5
73 | // complete cycles. With the final true argument, the sketch will pause here
74 | // until all the pulse cycles are complete.
75 | OutputPulsesStart(OutputPin, 300, 500, 5, true);
76 | delay(3000);
77 | }
78 |
--------------------------------------------------------------------------------
/libraries/CCIO-8/library.properties:
--------------------------------------------------------------------------------
1 | name=ClearCore CCIO-8 (I/O Expansion Board)
2 | version=1.0.0
3 | author=Teknic
4 | maintainer=Teknic
5 | sentence=Teknic CCIO-8 Examples
6 | paragraph=Teknic CCIO-8 Examples
7 | category=Device Control
8 | url=https://github.com/Teknic-Inc/ClearCore-Arduino-wrapper
9 | architectures=sam
10 |
--------------------------------------------------------------------------------
/libraries/CCIO-8/src/ccio8-examples.h:
--------------------------------------------------------------------------------
1 |
2 | // This is just an empty header file to make this a valid Arduino library
--------------------------------------------------------------------------------
/libraries/ClearCoreBoardStatus/library.properties:
--------------------------------------------------------------------------------
1 | name=ClearCore Board Status
2 | version=1.0.0
3 | author=Teknic
4 | maintainer=Teknic
5 | sentence=Teknic ClearCore Board Status Examples
6 | paragraph=Teknic ClearCore Board Status Examples
7 | category=Device Control
8 | url=https://github.com/Teknic-Inc/ClearCore-Arduino-wrapper
9 | architectures=sam
10 |
--------------------------------------------------------------------------------
/libraries/ClearCoreBoardStatus/src/clearcore-board-status-examples.h:
--------------------------------------------------------------------------------
1 |
2 | // This is just an empty header file to make this a valid Arduino library
--------------------------------------------------------------------------------
/libraries/ClearPathModeExamples/examples/ClearPath-MC Series/library.properties:
--------------------------------------------------------------------------------
1 | name=ClearPath-MC Series
2 | version=0.0.1
3 | author=Teknic
4 | maintainer=Teknic
5 | sentence=Teknic ClearCore Library
6 | paragraph=Teknic ClearCore Library
7 | category=Device Control
8 | url=https://git-server.teknic.com/Git-Playground/clearcore-examples
9 | architectures=sam
10 |
--------------------------------------------------------------------------------
/libraries/ClearPathModeExamples/examples/ClearPath-SD Series/library.properties:
--------------------------------------------------------------------------------
1 | name=ClearPath-SD Series
2 | version=0.0.1
3 | author=Teknic
4 | maintainer=Teknic
5 | sentence=Teknic ClearCore Library
6 | paragraph=Teknic ClearCore Library
7 | category=Device Control
8 | url=https://git-server.teknic.com/Git-Playground/clearcore-examples
9 | architectures=sam
10 |
--------------------------------------------------------------------------------
/libraries/ClearPathModeExamples/examples/High-Level Feedback (HLFB)/library.properties:
--------------------------------------------------------------------------------
1 | name=High Level Feedback (HLFB)
2 | version=0.0.1
3 | author=Teknic
4 | maintainer=Teknic
5 | sentence=Teknic ClearCore Library
6 | paragraph=Teknic ClearCore Library
7 | category=Device Control
8 | url=https://git-server.teknic.com/Git-Playground/clearcore-examples
9 | architectures=sam
10 |
--------------------------------------------------------------------------------
/libraries/ClearPathModeExamples/library.properties:
--------------------------------------------------------------------------------
1 | name=ClearCore ClearPath Mode Examples
2 | version=1.0.0
3 | author=Teknic
4 | maintainer=Teknic
5 | sentence=Teknic ClearCore ClearPath Mode Examples
6 | paragraph=Teknic ClearCore ClearPath Mode Examples
7 | category=Device Control
8 | url=https://github.com/Teknic-Inc/ClearCore-Arduino-wrapper
9 | architectures=sam
10 |
--------------------------------------------------------------------------------
/libraries/ClearPathModeExamples/src/clearpath-mode-examples.h:
--------------------------------------------------------------------------------
1 |
2 | // This is just an empty header file to make this a valid Arduino library
--------------------------------------------------------------------------------
/libraries/DigitalIO/examples/InputInterrupts/InputInterrupts.ino:
--------------------------------------------------------------------------------
1 | /*
2 | * Title: InputInterrupts
3 | *
4 | * Objective:
5 | * This example demonstrates how to configure a digital interrupt on a
6 | * ClearCore input.
7 | *
8 | * Description:
9 | * This example sets up and attaches a callback function to be triggered by
10 | * a digital interrupt. Interrupts are useful when a function needs to be
11 | * called asynchronously from the rest of the code's execution.
12 | *
13 | * This example's interrupt blinks the on-board user LED when the interrupt
14 | * pin goes from on to off (aka "falling"). You may notice multiple blinks
15 | * depending on how much bounce the input device has.
16 | *
17 | * The interrupt callback function's ability to run is turned on and off
18 | * periodically by this example. The callback function can only run when
19 | * interrupts are turned "on", regardless of the interrupt pin state. If the
20 | * interrupt pin is triggered while interrupts are "off", the callback will
21 | * execute when interrupts are next turned on. This on/off state is printed
22 | * to the USB serial port.
23 | *
24 | * Requirements:
25 | * ** A digital signal source, such as a switch or sensor, connected to DI-6 to
26 | * trigger the interrupt
27 | *
28 | * Links:
29 | * ** ClearCore Documentation: https://teknic-inc.github.io/ClearCore-library/
30 | * ** ClearCore Manual: https://www.teknic.com/files/downloads/clearcore_user_manual.pdf
31 | *
32 | *
33 | * Copyright (c) 2020 Teknic Inc. This work is free to use, copy and distribute under the terms of
34 | * the standard MIT permissive software license which can be found at https://opensource.org/licenses/MIT
35 | */
36 |
37 | // Pins that support digital interrupts are:
38 | // DI-6, DI-7, DI-8, A-9, A-10, A-11, A-12
39 | #define interruptPin DI6
40 |
41 | // Declare the signature for our interrupt service routine (ISR). The function
42 | // is defined below
43 | void MyCallback();
44 |
45 | void setup() {
46 | // Put your setup code here, it will run once:
47 |
48 | // Set up the interrupt pin in digital input mode.
49 | pinMode(interruptPin, INPUT);
50 |
51 | // Set an ISR to be called when the state of the interrupt pin goes from
52 | // true to false.
53 | attachInterrupt(digitalPinToInterrupt(interruptPin), MyCallback, FALLING);
54 |
55 | // Set up serial communication and wait up to 5 seconds for a port to open
56 | // Serial communication is not required for this example to run
57 | Serial.begin(9600);
58 | uint32_t timeout = 5000;
59 | uint32_t startTime = millis();
60 | while (!Serial && millis() - startTime < timeout) {
61 | continue;
62 | }
63 | }
64 |
65 | void loop() {
66 | // Put your main code here, it will run repeatedly:
67 |
68 | // Enable digital interrupts.
69 | interrupts();
70 |
71 | Serial.println("Interrupts are turned on.");
72 |
73 | // Test that the ISR is triggered when the state of the interrupt pin
74 | // transitions from true to false by toggling your switch.
75 |
76 | // Wait while the interrupt is triggered.
77 | delay(5000);
78 |
79 | // Disable digital interrupts.
80 | noInterrupts();
81 |
82 | Serial.println("Interrupts are turned off.");
83 |
84 | // Test that the ISR does not get triggered when the state of the interrupt
85 | // pin transitions from true to false by toggling your switch.
86 | delay(5000);
87 | }
88 |
89 | // The function to be triggered on an interrupt.
90 | // This function blinks the user-controlled LED once.
91 | /*------------------------------------------------------------------------------
92 | * MyCallback
93 | *
94 | * Flashes the ClearCore's built-in LED (next to the USB port) on and off.
95 | *
96 | * Parameters:
97 | * None
98 | *
99 | * Returns: None
100 | */
101 | void MyCallback() {
102 | digitalWrite(LED_BUILTIN, true);
103 | delay(100);
104 | digitalWrite(LED_BUILTIN, false);
105 | delay(100);
106 | }
107 | //------------------------------------------------------------------------------
108 |
--------------------------------------------------------------------------------
/libraries/DigitalIO/examples/PlayTone/PlayTone.ino:
--------------------------------------------------------------------------------
1 | /*
2 | * Title: PlayTone
3 | *
4 | * Objective:
5 | * This example demonstrates how to play a sequence of tones on the
6 | * ClearCore's H-Bridge connectors using the musical frequency values defined
7 | * in the pitches.h header file.
8 | *
9 | * Description:
10 | * This example sets up an H-Bridge connector into output mode, sets the
11 | * volume, and plays a melodic sequence of tones of equal duration.
12 | *
13 | * Requirements:
14 | * ** A speaker or other audio output device connected to IO-4
15 | *
16 | * Links:
17 | * ** ClearCore Documentation: https://teknic-inc.github.io/ClearCore-library/
18 | * ** ClearCore Manual: https://www.teknic.com/files/downloads/clearcore_user_manual.pdf
19 | *
20 | * Last Modified: 1/21/2020
21 | * Copyright (c) 2020 Teknic Inc. This work is free to use, copy and distribute under the terms of
22 | * the standard MIT permissive software license which can be found at https://opensource.org/licenses/MIT
23 | */
24 |
25 | #include "pitches.h"
26 |
27 | // Notes to be played in sequence as part of a melody.
28 | // The maximum tone frequency is 1/4 of the tone interrupt rate, i.e. 5512 Hz.
29 | // Any commanded frequency above 5512 Hz will get clipped to 5512 Hz.
30 | // See the "pitches.h" file for the frequency definitions of these notes
31 | const int melody[] = {NOTE_C4, NOTE_E4, NOTE_G4, NOTE_C5,
32 | NOTE_CS4, NOTE_FS4, NOTE_AS4, NOTE_CS5,
33 | NOTE_E4, NOTE_G4, NOTE_C5, NOTE_E5,
34 | NOTE_FS4, NOTE_AS4, NOTE_CS5, NOTE_FS5
35 | };
36 | const uint32_t noteCount = sizeof(melody) / sizeof(melody[0]);
37 |
38 | const uint32_t toneDuration = 200; // in milliseconds
39 | const float toneAmplitude = 0.01; // max volume is 1
40 |
41 | // Tone output is supported on connectors IO-4 and IO-5 only
42 | #define tonePin IO4
43 |
44 | void setup() {
45 | // Put your setup code here, it will run once:
46 |
47 | // Set the tone connector into output mode.
48 | pinMode(tonePin, OUTPUT);
49 |
50 | // Set the volume of the tone connector to the value specified
51 | // by toneAmplitude.
52 | toneVolume(tonePin, toneAmplitude);
53 | }
54 |
55 | void loop() {
56 | // Put your main code here, it will run repeatedly:
57 |
58 | // Play the melody in order with equal note durations
59 | for (int note = 0; note < noteCount; note++) {
60 | tone(tonePin, melody[note]);
61 | delay(toneDuration);
62 | }
63 |
64 | // Stop the tone generation
65 | noTone(tonePin);
66 |
67 | // Wait a second, then repeat...
68 | delay(1000);
69 | }
70 |
--------------------------------------------------------------------------------
/libraries/DigitalIO/examples/PlayTone/pitches.h:
--------------------------------------------------------------------------------
1 | /*************************************************
2 | * Public Constants
3 | *************************************************/
4 |
5 | #define NOTE_B0 31
6 | #define NOTE_C1 33
7 | #define NOTE_CS1 35
8 | #define NOTE_D1 37
9 | #define NOTE_DS1 39
10 | #define NOTE_E1 41
11 | #define NOTE_F1 44
12 | #define NOTE_FS1 46
13 | #define NOTE_G1 49
14 | #define NOTE_GS1 52
15 | #define NOTE_A1 55
16 | #define NOTE_AS1 58
17 | #define NOTE_B1 62
18 | #define NOTE_C2 65
19 | #define NOTE_CS2 69
20 | #define NOTE_D2 73
21 | #define NOTE_DS2 78
22 | #define NOTE_E2 82
23 | #define NOTE_F2 87
24 | #define NOTE_FS2 93
25 | #define NOTE_G2 98
26 | #define NOTE_GS2 104
27 | #define NOTE_A2 110
28 | #define NOTE_AS2 117
29 | #define NOTE_B2 123
30 | #define NOTE_C3 131
31 | #define NOTE_CS3 139
32 | #define NOTE_D3 147
33 | #define NOTE_DS3 156
34 | #define NOTE_E3 165
35 | #define NOTE_F3 175
36 | #define NOTE_FS3 185
37 | #define NOTE_G3 196
38 | #define NOTE_GS3 208
39 | #define NOTE_A3 220
40 | #define NOTE_AS3 233
41 | #define NOTE_B3 247
42 | #define NOTE_C4 262
43 | #define NOTE_CS4 277
44 | #define NOTE_D4 294
45 | #define NOTE_DS4 311
46 | #define NOTE_E4 330
47 | #define NOTE_F4 349
48 | #define NOTE_FS4 370
49 | #define NOTE_G4 392
50 | #define NOTE_GS4 415
51 | #define NOTE_A4 440
52 | #define NOTE_AS4 466
53 | #define NOTE_B4 494
54 | #define NOTE_C5 523
55 | #define NOTE_CS5 554
56 | #define NOTE_D5 587
57 | #define NOTE_DS5 622
58 | #define NOTE_E5 659
59 | #define NOTE_F5 698
60 | #define NOTE_FS5 740
61 | #define NOTE_G5 784
62 | #define NOTE_GS5 831
63 | #define NOTE_A5 880
64 | #define NOTE_AS5 932
65 | #define NOTE_B5 988
66 | #define NOTE_C6 1047
67 | #define NOTE_CS6 1109
68 | #define NOTE_D6 1175
69 | #define NOTE_DS6 1245
70 | #define NOTE_E6 1319
71 | #define NOTE_F6 1397
72 | #define NOTE_FS6 1480
73 | #define NOTE_G6 1568
74 | #define NOTE_GS6 1661
75 | #define NOTE_A6 1760
76 | #define NOTE_AS6 1865
77 | #define NOTE_B6 1976
78 | #define NOTE_C7 2093
79 | #define NOTE_CS7 2217
80 | #define NOTE_D7 2349
81 | #define NOTE_DS7 2489
82 | #define NOTE_E7 2637
83 | #define NOTE_F7 2794
84 | #define NOTE_FS7 2960
85 | #define NOTE_G7 3136
86 | #define NOTE_GS7 3322
87 | #define NOTE_A7 3520
88 | #define NOTE_AS7 3729
89 | #define NOTE_B7 3951
90 | #define NOTE_C8 4186
91 | #define NOTE_CS8 4435
92 | #define NOTE_D8 4699
93 | #define NOTE_DS8 4978
94 |
--------------------------------------------------------------------------------
/libraries/DigitalIO/examples/ReadDigitalInput/ReadDigitalInput.ino:
--------------------------------------------------------------------------------
1 | /*
2 | * Title: ReadDigitalInput
3 | *
4 | * Objective:
5 | * This example demonstrates how to read the state of a ClearCore digital
6 | * input.
7 | *
8 | * Description:
9 | * This example repeatedly reads the state of a defined digital input. During
10 | * operation, the state of the input is printed to the USB serial port.
11 | *
12 | * Requirements:
13 | * ** A digital input device, such as a switch or sensor, connected to DI-6
14 | *
15 | * Links:
16 | * ** ClearCore Documentation: https://teknic-inc.github.io/ClearCore-library/
17 | * ** ClearCore Manual: https://www.teknic.com/files/downloads/clearcore_user_manual.pdf
18 | *
19 | * Last Modified: 1/21/2020
20 | * Copyright (c) 2020 Teknic Inc. This work is free to use, copy and distribute under the terms of
21 | * the standard MIT permissive software license which can be found at https://opensource.org/licenses/MIT
22 | */
23 |
24 | // Specify which input pin to read from.
25 | // IO-0 through A-12 are all available as digital inputs.
26 | #define inputPin DI6
27 |
28 | // The current state of the input pin
29 | PinStatus state;
30 |
31 | // Select the baud rate to match the target serial device.
32 | #define baudRate 9600
33 |
34 | void setup() {
35 | // Put your setup code here, it will run once:
36 |
37 | pinMode(inputPin, INPUT); // Set the pin as an INPUT
38 |
39 | // Set up serial communication at a baud rate of 9600 bps then wait up to
40 | // 5 seconds for a port to open.
41 | // Serial communication is not required for this example to run, however the
42 | // example will appear to do nothing without serial output.
43 | Serial.begin(baudRate);
44 | uint32_t timeout = 5000;
45 | uint32_t startTime = millis();
46 | while (!Serial && millis() - startTime < timeout) {
47 | continue;
48 | }
49 | }
50 |
51 | void loop() {
52 | // Put your main code here, it will run repeatedly:
53 |
54 | // Read the state of the input connector.
55 | state = digitalRead(inputPin);
56 |
57 | // Display the state of the input connector.
58 | Serial.print("DI-6 Input state: ");
59 | if (state) {
60 | Serial.println("ON");
61 | }
62 | else {
63 | Serial.println("OFF");
64 | }
65 |
66 | // Wait a second then repeat...
67 | delay(1000);
68 | }
69 |
--------------------------------------------------------------------------------
/libraries/DigitalIO/examples/ReadDigitalInputRiseFall/ReadDigitalInputRiseFall.ino:
--------------------------------------------------------------------------------
1 | /*
2 | * Title: ReadDigitalInputRiseFall
3 | *
4 | * Objective:
5 | * This example demonstrates how to read the transition state (risen or
6 | * fallen since last checked) of a ClearCore digital input.
7 | *
8 | * Description:
9 | * This example repeatedly reads the transition state of a defined digital
10 | * input. Information on how the input state has transitioned is printed
11 | * to the USB serial port every 2 seconds.
12 | *
13 | * Requirements:
14 | * ** An input device, such as a switch or sensor, connected to DI-6.
15 | *
16 | * Links:
17 | * ** ClearCore Documentation: https://teknic-inc.github.io/ClearCore-library/
18 | * ** ClearCore Manual: https://www.teknic.com/files/downloads/clearcore_user_manual.pdf
19 | *
20 | * Last Modified: 1/21/2020
21 | * Copyright (c) 2020 Teknic Inc. This work is free to use, copy and distribute under the terms of
22 | * the standard MIT permissive software license which can be found at https://opensource.org/licenses/MIT
23 | */
24 |
25 | #include "ClearCore.h"
26 |
27 | // Specify which input connector to use.
28 | // ConnectorIO0 through ConnectorA12 all have digital input capability.
29 | #define InputConnector ConnectorDI6
30 |
31 | // Declares two boolean variables used to hold information on whether the input
32 | // has risen or fallen
33 | bool risen, fallen;
34 |
35 | // Select the baud rate to match the target serial device
36 | #define baudRate 9600
37 |
38 | void setup() {
39 | // Put your setup code here, it will run once:
40 |
41 | pinMode(DI6, INPUT); //Set connector as an Input
42 |
43 | // Set up serial communication at a baud rate of 9600 bps then wait up to
44 | // 5 seconds for a port to open.
45 | // Serial communication is not required for this example to run, however the
46 | // example will appear to do nothing without serial output.
47 | Serial.begin(baudRate);
48 | uint32_t timeout = 5000;
49 | uint32_t startTime = millis();
50 | while (!Serial && millis() - startTime < timeout) {
51 | continue;
52 | }
53 | }
54 |
55 | void loop() {
56 | // Put your main code here, it will run repeatedly:
57 |
58 | // Check whether the digital input has risen, fallen, or is unchanged
59 | // since the last time we checked.
60 | risen = InputConnector.InputRisen();
61 | fallen = InputConnector.InputFallen();
62 |
63 | Serial.print("DI-6 Transitions: ");
64 |
65 | if (risen && fallen) {
66 | Serial.println("RISEN and FALLEN");
67 | }
68 | else if (risen) {
69 | Serial.println("RISEN");
70 | }
71 | else if (fallen) {
72 | Serial.println("FALLEN");
73 | }
74 | else {
75 | Serial.println("NO CHANGE");
76 | }
77 |
78 | // Wait a couple seconds then repeat...
79 | delay(2000);
80 | }
81 |
--------------------------------------------------------------------------------
/libraries/DigitalIO/examples/WriteDigitalOutput/WriteDigitalOutput.ino:
--------------------------------------------------------------------------------
1 | /*
2 | * Title: WriteDigitalOutput
3 | *
4 | * Objective:
5 | * This example demonstrates how to write the state of a ClearCore digital
6 | * output.
7 | *
8 | * Description:
9 | * This example repeatedly toggles the state of the ClearCore's six digital
10 | * outputs, IO-0 through IO-5.
11 | *
12 | * Requirements:
13 | * ** A device that takes in a digital signal connected to any of the I/O's,
14 | * IO-0 through IO-5.
15 | * Note: You can leave the I/O points disconnected and still see the
16 | * built-in I/O LEDs toggle with the connector state.
17 | *
18 | * Links:
19 | * ** ClearCore Documentation: https://teknic-inc.github.io/ClearCore-library/
20 | * ** ClearCore Manual: https://www.teknic.com/files/downloads/clearcore_user_manual.pdf
21 | *
22 | * Last Modified: 1/21/2020
23 | * Copyright (c) 2020 Teknic Inc. This work is free to use, copy and distribute under the terms of
24 | * the standard MIT permissive software license which can be found at https://opensource.org/licenses/MIT
25 | */
26 |
27 | // Declares a variable used to write new states to the output. We will toggle
28 | // this true/false.
29 | bool outputState;
30 |
31 | void setup() {
32 | // Put your setup code here, it will run once:
33 |
34 | // Configure pins IO-0 through IO-5 as digital outputs. These are the only
35 | // pins that support digital output mode.
36 | pinMode(IO0, OUTPUT);
37 | pinMode(IO1, OUTPUT);
38 | pinMode(IO2, OUTPUT);
39 | pinMode(IO3, OUTPUT);
40 | pinMode(IO4, OUTPUT);
41 | pinMode(IO5, OUTPUT);
42 |
43 | // The connectors are all set up; start the loop with turning them all on.
44 | outputState = true;
45 | }
46 |
47 | void loop() {
48 | // Put your main code here, it will run repeatedly:
49 |
50 | // Toggle the digital output state.
51 | if (outputState) {
52 | digitalWrite(IO0, true);
53 | digitalWrite(IO1, true);
54 | digitalWrite(IO2, true);
55 | digitalWrite(IO3, true);
56 | digitalWrite(IO4, true);
57 | digitalWrite(IO5, true);
58 | }
59 | else {
60 | digitalWrite(IO0, false);
61 | digitalWrite(IO1, false);
62 | digitalWrite(IO2, false);
63 | digitalWrite(IO3, false);
64 | digitalWrite(IO4, false);
65 | digitalWrite(IO5, false);
66 | }
67 |
68 | // Toggle the state to write in the next loop.
69 | outputState = !outputState;
70 |
71 | // Wait a second, then repeat.
72 | delay(1000);
73 | }
74 |
--------------------------------------------------------------------------------
/libraries/DigitalIO/examples/WriteHBridgeOutput/WriteHBridgeOutput.ino:
--------------------------------------------------------------------------------
1 | /*
2 | * Title: WriteHBridgeOutput
3 | *
4 | * Objective:
5 | * This example demonstrates how to output a differential/bi-directional PWM
6 | * signal from a ClearCore H-Bridge connector.
7 | *
8 | * Description:
9 | * This example sets up a ClearCore H-Bridge connector for H-Bridge output,
10 | * then repeatedly ramps the PWM duty cycle output up and down, both sourcing
11 | * and sinking current.
12 | *
13 | * Requirements:
14 | * ** A device capable of receiving an H-Bridge bi-directional PWM signal, like
15 | * a bi-directional brushed DC motor, connected to IO-4. Refer to the
16 | * ClearCore System Diagram on how to wire a device to the H-Bridge capable
17 | * connectors.
18 | *
19 | * Links:
20 | * ** ClearCore Documentation: https://teknic-inc.github.io/ClearCore-library/
21 | * ** ClearCore Manual: https://www.teknic.com/files/downloads/clearcore_user_manual.pdf
22 | *
23 | * Last Modified: 1/21/2020
24 | * Copyright (c) 2020 Teknic Inc. This work is free to use, copy and distribute under the terms of
25 | * the standard MIT permissive software license which can be found at https://opensource.org/licenses/MIT
26 | */
27 |
28 | #include "ClearCore.h"
29 |
30 | // Defines which H-Bridge capable connector to use: ConnectorIO4 or ConnectorIO5
31 | #define HBridgeConnector ConnectorIO4
32 |
33 | // Declares our user-defined helper function, which is used to check for
34 | // overloads and reset the H-Bridge output as necessary. The definition/
35 | // implementation of this function is at the bottom of the example.
36 | void CheckHBridgeOverload();
37 |
38 | void setup() {
39 | // Put your setup code here, it will run once:
40 |
41 | // H-Bridge output is supported on connectors IO-4 and IO-5 only.
42 | // Set the H-Bridge connector into H-Bridge output mode.
43 | HBridgeConnector.Mode(Connector::OUTPUT_H_BRIDGE);
44 | }
45 |
46 | void loop() {
47 | // Put your main code here, it will run repeatedly:
48 |
49 | // Output bi-directional PWM on the H-Bridge connector over the full range
50 | // of output values/duty cycles (-INT16_MAX-1 to INT16_MAX).
51 |
52 | // Positive values (between 1 and INT16_MAX) will sink current into the
53 | // signal pin.
54 | // Negative values (between -1 and -INT16_MAX-1) will source current
55 | // from the signal pin.
56 |
57 | for (int16_t i = 0; i < INT16_MAX; i++) {
58 | // Check for overloads and reset if needed
59 | CheckHBridgeOverload();
60 |
61 | // Write to the output.
62 | HBridgeConnector.State(i);
63 | delayMicroseconds(125);
64 | }
65 |
66 | for (int16_t i = 0; i < INT16_MAX; i++) {
67 | CheckHBridgeOverload();
68 |
69 | HBridgeConnector.State(INT16_MAX - i);
70 | delayMicroseconds(125);
71 | }
72 |
73 | for (int16_t i = 0; i < INT16_MAX; i++) {
74 | CheckHBridgeOverload();
75 |
76 | HBridgeConnector.State(-i);
77 | delayMicroseconds(125);
78 | }
79 |
80 | for (int16_t i = 0; i < INT16_MAX; i++) {
81 | CheckHBridgeOverload();
82 |
83 | HBridgeConnector.State(-INT16_MAX + i);
84 | delayMicroseconds(125);
85 | }
86 | }
87 |
88 | /*------------------------------------------------------------------------------
89 | * CheckHBridgeOverload
90 | *
91 | * Checks whether any of the ClearCore's H-Bridge connectors are experiencing
92 | * an overload. If an overload is detected the H-Bridge connectors are reset.
93 | *
94 | * Parameters:
95 | * None
96 | *
97 | * Returns: None
98 | */
99 | void CheckHBridgeOverload() {
100 | if (StatusMgr.StatusRT().bit.HBridgeOverloaded) {
101 | StatusMgr.HBridgeReset();
102 | delay(10);
103 | }
104 | }
105 | //------------------------------------------------------------------------------
106 |
--------------------------------------------------------------------------------
/libraries/DigitalIO/examples/WritePwmOutput/WritePwmOutput.ino:
--------------------------------------------------------------------------------
1 | /*
2 | * Title: WritePwmOutput
3 | *
4 | * Objective:
5 | * This example demonstrates how to write a digital PWM signal to a ClearCore
6 | * digital output.
7 | *
8 | * Description:
9 | * This example sets the defined pin as an output then writes a series of
10 | * PWM signals with varying duty cycles to the output.
11 | *
12 | * Requirements:
13 | * ** Connect a device that takes in a PWM signal to IO-1.
14 | *
15 | * Links:
16 | * ** ClearCore Documentation: https://teknic-inc.github.io/ClearCore-library/
17 | * ** ClearCore Manual: https://www.teknic.com/files/downloads/clearcore_user_manual.pdf
18 | *
19 | * Last Modified: 1/21/2020
20 | * Copyright (c) 2020 Teknic Inc. This work is free to use, copy and distribute under the terms of
21 | * the standard MIT permissive software license which can be found at https://opensource.org/licenses/MIT
22 | */
23 |
24 | // Specify which output pin to write digital PWM to.
25 | // PWM-capable pins: IO-0 through IO-5.
26 | // Note: IO-4 and IO-5 are capable of bi-directional and higher-current PWM
27 | // output using an H-Bridge. See the WriteHBridgeOutput example.
28 | #define outputPin IO1
29 |
30 | void setup() {
31 | // Put your setup code here, it will run once:
32 |
33 | // Set up the output pin to be an output.
34 | pinMode(outputPin, OUTPUT);
35 | }
36 |
37 | void loop() {
38 | // Put your main code here, it will run repeatedly:
39 |
40 | // Write some digital PWM signals to the output connector.
41 | // Note: analogWrite() is the Arduino wrapper function used to write PWM,
42 | // despite the fact that it is not a "true" analog signal.
43 | // Valid values range from 0 (0% duty cycle / always off)
44 | // to 255 (100% duty cycle / always on).
45 |
46 | // Output a low duty cycle for 1 second.
47 | analogWrite(outputPin, 10);
48 | delay(1000);
49 |
50 | // Output a medium duty cycle for 1 second.
51 | analogWrite(outputPin, 120);
52 | delay(1000);
53 |
54 | // Output a high duty cycle for 1 second.
55 | analogWrite(outputPin, 230);
56 | delay(1000);
57 | }
58 |
--------------------------------------------------------------------------------
/libraries/DigitalIO/library.properties:
--------------------------------------------------------------------------------
1 | name=ClearCore Digital I/O
2 | version=1.0.0
3 | author=Teknic
4 | maintainer=Teknic
5 | sentence=Teknic ClearCore Digital I/O Examples
6 | paragraph=Teknic ClearCore Digital I/O Examples
7 | category=Device Control
8 | url=https://github.com/Teknic-Inc/ClearCore-Arduino-wrapper
9 | architectures=sam
10 |
--------------------------------------------------------------------------------
/libraries/DigitalIO/src/digitalIO-examples.h:
--------------------------------------------------------------------------------
1 |
2 | // This is just an empty header file to make this a valid Arduino library
--------------------------------------------------------------------------------
/libraries/EncoderInput/library.properties:
--------------------------------------------------------------------------------
1 | name=ClearCore Encoder Input
2 | version=1.0.0
3 | author=Teknic
4 | maintainer=Teknic
5 | sentence=Teknic ClearCore Encoder Input Examples
6 | paragraph=Teknic ClearCore Encoder Input Examples
7 | category=Device Control
8 | url=https://github.com/Teknic-Inc/ClearCore-Arduino-wrapper
9 | architectures=sam
10 |
--------------------------------------------------------------------------------
/libraries/EncoderInput/src/encoder-input-examples.h:
--------------------------------------------------------------------------------
1 |
2 | // This is just an empty header file to make this a valid Arduino library
--------------------------------------------------------------------------------
/libraries/Ethernet/library.properties:
--------------------------------------------------------------------------------
1 | name=ClearCore Ethernet
2 | version=1.0.0
3 | author=Teknic
4 | maintainer=Teknic
5 | sentence=Teknic ClearCore Ethernet Examples
6 | paragraph=Teknic ClearCore Ethernet Examples
7 | category=Device Control
8 | url=https://github.com/Teknic-Inc/ClearCore-Arduino-wrapper
9 | architectures=sam
10 |
--------------------------------------------------------------------------------
/libraries/Ethernet/src/ethernet-examples.h:
--------------------------------------------------------------------------------
1 |
2 | // This is just an empty header file to make this a valid Arduino library
--------------------------------------------------------------------------------
/libraries/README.md:
--------------------------------------------------------------------------------
1 | # Examples for Teknic ClearCore
2 |
3 | When you have the Teknic ClearCore device selected in the Arduino IDE, these examples will appear in the File/Examples menu item under the "Examples for Teknic ClearCore" heading.
--------------------------------------------------------------------------------
/libraries/SD/examples/ReadWrite/ReadWrite.ino:
--------------------------------------------------------------------------------
1 | /*
2 | * Title: ReadWrite
3 | *
4 | * Objective:
5 | * This example demonstrates how to read from and write to a file on the
6 | * SD card.
7 | *
8 | * Description:
9 | * This example writes to a text file on the SD card then reads the file
10 | * back to the USB serial port.
11 | *
12 | * Requirements:
13 | * ** A micro SD card installed in the ClearCore.
14 | *
15 | * Links:
16 | * ** ClearCore Documentation: https://teknic-inc.github.io/ClearCore-library/
17 | * ** ClearCore Manual: https://www.teknic.com/files/downloads/clearcore_user_manual.pdf
18 | *
19 | * Last Modified: 11/25/2020
20 | * This is a slightly modified version of the builtin Arduino SD ReadWrite sketch.
21 | * This example code is in the public domain.
22 | */
23 | #include
24 | #include
25 |
26 | File myFile;
27 |
28 | void setup() {
29 | // Open serial communications and wait for port to open:
30 | Serial.begin(9600);
31 | while (!Serial) {
32 | // Wait for the USB serial port to open.
33 | continue;
34 | }
35 |
36 | Serial.print("Initializing SD card...");
37 |
38 | if (!SD.begin()) {
39 | Serial.println("initialization failed!");
40 | while (true) {
41 | // We can't continue without a working SD card
42 | continue;
43 | }
44 | }
45 | Serial.println("initialization done.");
46 |
47 | // open the file. note that only one file can be open at a time,
48 | // so you have to close this one before opening another.
49 | myFile = SD.open("test.txt", FILE_WRITE);
50 |
51 | // If the file opened okay, write to it:
52 | if (myFile) {
53 | Serial.print("Writing to test.txt...");
54 | myFile.println("testing 1, 2, 3.");
55 | // Close the file:
56 | myFile.close();
57 | Serial.println("done.");
58 | }
59 | else {
60 | // If the file didn't open, print an error:
61 | Serial.println("error opening test.txt");
62 | while (true) {
63 | continue;
64 | }
65 | }
66 |
67 | // Re-open the file for reading:
68 | myFile = SD.open("test.txt");
69 | if (myFile) {
70 | Serial.println("test.txt:");
71 |
72 | // Read from the file until there's nothing else in it:
73 | while (myFile.available()) {
74 | Serial.write(myFile.read());
75 | }
76 | // Close the file:
77 | myFile.close();
78 | }
79 | else {
80 | // If the file didn't open, print an error:
81 | Serial.println("error opening test.txt");
82 | }
83 | }
84 |
85 | void loop() {
86 | // Nothing happens after setup
87 | }
88 |
89 |
--------------------------------------------------------------------------------
/libraries/SD/library.properties:
--------------------------------------------------------------------------------
1 | name=ClearCore SD Card
2 | version=1.0.0
3 | author=Teknic
4 | maintainer=Teknic
5 | sentence=Teknic ClearCore Serial Communication Examples
6 | paragraph=Teknic ClearCore Serial Communication Examples
7 | category=Device Control
8 | url=https://github.com/Teknic-Inc/ClearCore-Arduino-wrapper
9 | architectures=sam
10 |
--------------------------------------------------------------------------------
/libraries/SD/src/sd-examples.h:
--------------------------------------------------------------------------------
1 |
2 | // This is just an empty header file to make this a valid Arduino library
--------------------------------------------------------------------------------
/libraries/SerialCommunication/examples/ReadSerialInput/ReadSerialInput.ino:
--------------------------------------------------------------------------------
1 | /*
2 | * Title: ReadSerialInput
3 | *
4 | * Objective:
5 | * This example demonstrates how to read and display incoming data from a
6 | * serial port.
7 | *
8 | * Description:
9 | * This example will read one byte per second from the serial input buffer.
10 | * During operation, if a byte has been received, it will be printed to the
11 | * USB serial port as a character.
12 | *
13 | * Requirements:
14 | * ** A serial input source connected to Serial0 (COM-0 on the ClearCore)
15 | *
16 | * Links:
17 | * ** ClearCore Documentation: https://teknic-inc.github.io/ClearCore-library/
18 | * ** ClearCore Manual: https://www.teknic.com/files/downloads/clearcore_user_manual.pdf
19 | *
20 | * Last Modified: 1/21/2020
21 | * Copyright (c) 2020 Teknic Inc. This work is free to use, copy and distribute under the terms of
22 | * the standard MIT permissive software license which can be found at https://opensource.org/licenses/MIT
23 | */
24 |
25 | // Select the baud rate to match the target device.
26 | #define baudRateSerialPort 115200
27 | #define baudRateInputPort 115200
28 |
29 | // When using COM ports, is the device TTL or RS232?
30 | #define isTtlInputPort false
31 |
32 | // Container for the byte to be read-in
33 | int input;
34 |
35 | void setup() {
36 | // Put your setup code here, it will run once:
37 |
38 | // Set up serial communication to print out the serial input.
39 | Serial.begin(baudRateSerialPort);
40 | while (!Serial) {
41 | continue;
42 | }
43 |
44 | // Set up serial communication to send serial input over.
45 | Serial0.begin(baudRateInputPort);
46 | Serial0.ttl(isTtlInputPort);
47 | while (!Serial0) {
48 | continue;
49 | }
50 | }
51 |
52 | void loop() {
53 | // Put your main code here, it will run repeatedly:
54 |
55 | // Read the input.
56 | input = Serial0.read();
57 |
58 | // If there was a valid byte read-in, print it.
59 | if (input != -1) {
60 | // Display the input character received.
61 | Serial.print("Received: ");
62 | Serial.println((char)input);
63 | }
64 | else {
65 | Serial.println("No data received...");
66 | }
67 |
68 | // Wait a second then repeat...
69 | delay(1000);
70 | }
71 |
--------------------------------------------------------------------------------
/libraries/SerialCommunication/examples/SerialPrint/SerialPrint.ino:
--------------------------------------------------------------------------------
1 | /*
2 | * Title: SerialPrint
3 | *
4 | * Objective:
5 | * This example demonstrates how to print text using serial output.
6 | *
7 | * Description:
8 | * This example will print the basic "Hello World" message to the USB serial
9 | * port.
10 | *
11 | * Requirements:
12 | * ** None
13 | *
14 | * Links:
15 | * ** ClearCore Documentation: https://teknic-inc.github.io/ClearCore-library/
16 | * ** ClearCore Manual: https://www.teknic.com/files/downloads/clearcore_user_manual.pdf
17 | *
18 | * Last Modified: 1/21/2020
19 | * Copyright (c) 2020 Teknic Inc. This work is free to use, copy and distribute under the terms of
20 | * the standard MIT permissive software license which can be found at https://opensource.org/licenses/MIT
21 | */
22 |
23 | // ClearCore provides three separate serial interfaces for communications.
24 | // The three options are Serial (USB), Serial0 (COM-0), or Serial1 (COM-1)
25 | #define SerialPort Serial
26 |
27 | void setup() {
28 | // Put your setup code here, it will run once:
29 |
30 | // Set up serial communication to print.
31 | SerialPort.begin(9600);
32 | while (!SerialPort) {
33 | continue;
34 | }
35 |
36 | // The port is open and ready to talk.
37 | SerialPort.println("Hello World!");
38 | }
39 |
40 | void loop() {
41 | // This example doesn't have any ongoing tasks to perform.
42 | }
43 |
--------------------------------------------------------------------------------
/libraries/SerialCommunication/examples/SpiComPortInitialization/SpiComPortInitialization.ino:
--------------------------------------------------------------------------------
1 | /*
2 | * Title: SpiComPortInitialization
3 | *
4 | * Objective:
5 | * This example demonstrates how to configure a COM port for use with an
6 | * SPI device.
7 | *
8 | * Description:
9 | * This example will explain the basic configuration settings of an SPI
10 | * device then perform a brief transaction with the SPI device connected to
11 | * COM-0.
12 | *
13 | * Requirements:
14 | * ** An SPI device connected to COM-0.
15 | *
16 | * Links:
17 | * ** ClearCore Documentation: https://teknic-inc.github.io/ClearCore-library/
18 | * ** ClearCore Manual: https://www.teknic.com/files/downloads/clearcore_user_manual.pdf
19 | *
20 | * Last Modified: 1/21/2020
21 | * Copyright (c) 2020 Teknic Inc. This work is free to use, copy and distribute under the terms of
22 | * the standard MIT permissive software license which can be found at https://opensource.org/licenses/MIT
23 | */
24 |
25 | #include "ClearCore.h"
26 | #include
27 |
28 | // Select the baud rate to match the target device.
29 | #define baudRate 80000
30 |
31 | // Select the clock polarity to match the target device. The clock polarity
32 | // setting indicates whether the device expects a low signal when idle or a
33 | // high signal when idle. It also indicates whether the leading or trailing
34 | // edge of the clock cycle are rising or falling edges.
35 | // Selecting SCK_LOW indicates that SCK is low when idle and the leading edge
36 | // of the clock cycle is a rising edge while the trailing edge is a falling
37 | // edge.
38 | // Selecting SCK_HIGH indicates that SCK is high when idle and the leading edge
39 | // of the clock cycle is a falling edge while the trailing edge is a rising
40 | // edge.
41 | // The default value for a COM connector's clock polarity is SCK_LOW.
42 | #define clockPolarity SerialDriver::SCK_LOW
43 |
44 | // Select the clock phase setting to match the target device. The clock phase
45 | // setting indicates whether data is sampled or changed on the leading or
46 | // trailing edge in the clock cycle.
47 | // Selecting LEAD_SAMPLE indicates that data is sampled on the leading edge and
48 | // changed on the trailing edge.
49 | // Selecting LEAD_CHANGE indicates that data is sampled on the trailing edge
50 | // and changed on the leading edge.
51 | // The default value for a COM connector's clock phase is LEAD_CHANGE.
52 | #define clockPhase SerialDriver::LEAD_CHANGE
53 |
54 | void setup() {
55 | // Put your setup code here, it will run once:
56 |
57 | // With the user settings, decide which SPI mode is needed
58 | int spiMode;
59 | if (clockPolarity == SerialDriver::SCK_LOW) {
60 | if (clockPhase == SerialDriver::LEAD_SAMPLE) {
61 | spiMode = SPI_MODE0;
62 | }
63 | else {
64 | spiMode = SPI_MODE1;
65 | }
66 | }
67 | else {
68 | if (clockPhase == SerialDriver::LEAD_SAMPLE) {
69 | spiMode = SPI_MODE2;
70 | }
71 | else {
72 | spiMode = SPI_MODE3;
73 | }
74 | }
75 |
76 | // Create the settings object to be passed when beginning SPI communications
77 | SPISettings spiConfig(baudRate, MSBFIRST, spiMode);
78 |
79 | // Open the SPI port on ConnectorCOM0
80 | SPI.begin();
81 |
82 | // Output some arbitrary sample data to the SPI device. This data is not
83 | // required for set up, just to demonstrate the transfer process.
84 | SPI.beginTransaction(spiConfig);
85 | SPI.transfer('a');
86 | SPI.transfer(98);
87 | SPI.transfer(0x63);
88 | SPI.endTransaction();
89 | }
90 |
91 | void loop() {
92 | // This example doesn't have any ongoing tasks to perform.
93 | }
94 |
--------------------------------------------------------------------------------
/libraries/SerialCommunication/library.properties:
--------------------------------------------------------------------------------
1 | name=ClearCore Serial Communication
2 | version=1.0.0
3 | author=Teknic
4 | maintainer=Teknic
5 | sentence=Teknic ClearCore Serial Communication Examples
6 | paragraph=Teknic ClearCore Serial Communication Examples
7 | category=Device Control
8 | url=https://github.com/Teknic-Inc/ClearCore-Arduino-wrapper
9 | architectures=sam
10 |
--------------------------------------------------------------------------------
/libraries/SerialCommunication/src/serial-comm-examples.h:
--------------------------------------------------------------------------------
1 |
2 | // This is just an empty header file to make this a valid Arduino library
--------------------------------------------------------------------------------
/libraries/StepAndDirection/library.properties:
--------------------------------------------------------------------------------
1 | name=ClearCore Step and Direction (non-ClearPath)
2 | version=1.0.0
3 | author=Teknic
4 | maintainer=Teknic
5 | sentence=Teknic ClearCore Step and Direction Examples
6 | paragraph=Teknic ClearCore Step and Direction Examples
7 | category=Device Control
8 | url=https://github.com/Teknic-Inc/ClearCore-Arduino-wrapper
9 | architectures=sam
10 |
--------------------------------------------------------------------------------
/libraries/StepAndDirection/src/step-and-direction-examples.h:
--------------------------------------------------------------------------------
1 |
2 | // This is just an empty header file to make this a valid Arduino library
--------------------------------------------------------------------------------
/libraries/XBee/examples/WriteXbeeOutput/WriteXbeeOutput.ino:
--------------------------------------------------------------------------------
1 | /*
2 | * Title: WriteXBeeOutput
3 | *
4 | * Objective:
5 | * This example demonstrates how to write data to an XBee device conncted to
6 | * the ClearCore's XBee port.
7 | *
8 | * Description:
9 | * This example sets up the XBee connector and writes data to the XBee
10 | * device. Any data received is then read-in and written to the USB serial
11 | * port.
12 | *
13 | * Requirements:
14 | * ** An XBee device connected to ClearCore's XBee connector. Use the XBee in
15 | * Transparent Mode to simply send and receive data without packet structuring.
16 | * ** Another remote XBee, also in transparent mode and configured to communicate
17 | * with the first.
18 | *
19 | * Links:
20 | * ** ClearCore Documentation: https://teknic-inc.github.io/ClearCore-library/
21 | * ** ClearCore Manual: https://www.teknic.com/files/downloads/clearcore_user_manual.pdf
22 | *
23 | * Last Modified: 1/21/2020
24 | * Copyright (c) 2020 Teknic Inc. This work is free to use, copy and distribute under the terms of
25 | * the standard MIT permissive software license which can be found at https://opensource.org/licenses/MIT
26 | */
27 |
28 | #include "ClearCore.h"
29 |
30 | // ClearCore provides three separate serial interfaces to send communications.
31 | // The three options are Serial (USB), Serial0 (COM-0), or Serial1 (COM-1)
32 | #define SerialPort Serial
33 |
34 | void setup() {
35 | // Put your setup code here, it will run once:
36 |
37 | // Set up serial communication to print.
38 | // A port must be open to continue and view incoming data.
39 | SerialPort.begin(9600);
40 | while (!SerialPort) {
41 | continue;
42 | }
43 |
44 | //Uncomment the line below if you have turned RTS flow control on in the XBee's parameters
45 | //XBee.FlowControl(true);
46 |
47 | // Set the XBee communication speed and open the XBee port
48 | XBee.Speed(115200);
49 | XBee.PortOpen();
50 |
51 | // Send a message to the XBee.
52 | XBee.Send("Hello XBee");
53 | }
54 |
55 | void loop() {
56 | // Put your main code here, it will run repeatedly:
57 |
58 | // As long as there are characters to be read-in, print the character at the
59 | // top of the receive buffer.
60 | if (XBee.AvailableForRead()) {
61 | SerialPort.println(XBee.CharGet());
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/libraries/XBee/library.properties:
--------------------------------------------------------------------------------
1 | name=ClearCore XBee
2 | version=1.0.0
3 | author=Teknic
4 | maintainer=Teknic
5 | sentence=Teknic ClearCore XBee Examples
6 | paragraph=Teknic ClearCore XBee Examples
7 | category=Device Control
8 | url=https://github.com/Teknic-Inc/ClearCore-Arduino-wrapper
9 | architectures=sam
10 |
--------------------------------------------------------------------------------
/libraries/XBee/src/xbee-examples.h:
--------------------------------------------------------------------------------
1 |
2 | // This is just an empty header file to make this a valid Arduino library
--------------------------------------------------------------------------------
/variants/clearcore/Third Party/SAME53/CMSIS/Device/Include/component-version.h:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * \brief Component version header file
5 | *
6 | * Copyright (c) 2019 Atmel Corporation, a wholly owned subsidiary of Microchip Technology Inc.
7 | *
8 | * \license_start
9 | *
10 | * \page License
11 | *
12 | * Licensed under the Apache License, Version 2.0 (the "License");
13 | * you may not use this file except in compliance with the License.
14 | * You may obtain a copy of the License at
15 | *
16 | * http://www.apache.org/licenses/LICENSE-2.0
17 | *
18 | * Unless required by applicable law or agreed to in writing, software
19 | * distributed under the License is distributed on an "AS IS" BASIS,
20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 | * See the License for the specific language governing permissions and
22 | * limitations under the License.
23 | *
24 | * \license_stop
25 | *
26 | */
27 |
28 | #ifndef _COMPONENT_VERSION_H_INCLUDED
29 | #define _COMPONENT_VERSION_H_INCLUDED
30 |
31 | #define COMPONENT_VERSION_MAJOR 1
32 | #define COMPONENT_VERSION_MINOR 1
33 |
34 | //
35 | // The COMPONENT_VERSION define is composed of the major and the minor version number.
36 | //
37 | // The last four digits of the COMPONENT_VERSION is the minor version with leading zeros.
38 | // The rest of the COMPONENT_VERSION is the major version.
39 | //
40 | #define COMPONENT_VERSION 10001
41 |
42 | //
43 | // The build number does not refer to the component, but to the build number
44 | // of the device pack that provides the component.
45 | //
46 | #define BUILD_NUMBER 118
47 |
48 | //
49 | // The COMPONENT_VERSION_STRING is a string (enclosed in ") that can be used for logging or embedding.
50 | //
51 | #define COMPONENT_VERSION_STRING "1.1"
52 |
53 | //
54 | // The COMPONENT_DATE_STRING contains a timestamp of when the pack was generated.
55 | //
56 | // The COMPONENT_DATE_STRING is written out using the following strftime pattern.
57 | //
58 | // "%Y-%m-%d %H:%M:%S"
59 | //
60 | //
61 | #define COMPONENT_DATE_STRING "2019-04-09 08:16:24"
62 |
63 | #endif/* #ifndef _COMPONENT_VERSION_H_INCLUDED */
64 |
65 |
--------------------------------------------------------------------------------
/variants/clearcore/Third Party/SAME53/CMSIS/Device/Include/component/hmatrixb.h:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * \brief Component description for HMATRIXB
5 | *
6 | * Copyright (c) 2019 Microchip Technology Inc.
7 | *
8 | * \asf_license_start
9 | *
10 | * \page License
11 | *
12 | * SPDX-License-Identifier: Apache-2.0
13 | *
14 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
15 | * not use this file except in compliance with the License.
16 | * You may obtain a copy of the Licence at
17 | *
18 | * http://www.apache.org/licenses/LICENSE-2.0
19 | *
20 | * Unless required by applicable law or agreed to in writing, software
21 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT
22 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23 | * See the License for the specific language governing permissions and
24 | * limitations under the License.
25 | *
26 | * \asf_license_stop
27 | *
28 | */
29 |
30 | #ifndef _SAME53_HMATRIXB_COMPONENT_
31 | #define _SAME53_HMATRIXB_COMPONENT_
32 |
33 | /* ========================================================================== */
34 | /** SOFTWARE API DEFINITION FOR HMATRIXB */
35 | /* ========================================================================== */
36 | /** \addtogroup SAME53_HMATRIXB HSB Matrix */
37 | /*@{*/
38 |
39 | #define HMATRIXB_I7638
40 | #define REV_HMATRIXB 0x214
41 |
42 | /* -------- HMATRIXB_PRAS : (HMATRIXB Offset: 0x080) (R/W 32) PRS Priority A for Slave -------- */
43 | #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
44 | typedef union {
45 | uint32_t reg; /*!< Type used for register access */
46 | } HMATRIXB_PRAS_Type;
47 | #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
48 |
49 | #define HMATRIXB_PRAS_OFFSET 0x080 /**< \brief (HMATRIXB_PRAS offset) Priority A for Slave */
50 | #define HMATRIXB_PRAS_RESETVALUE _U_(0x00000000) /**< \brief (HMATRIXB_PRAS reset_value) Priority A for Slave */
51 |
52 | #define HMATRIXB_PRAS_MASK _U_(0x00000000) /**< \brief (HMATRIXB_PRAS) MASK Register */
53 |
54 | /* -------- HMATRIXB_PRBS : (HMATRIXB Offset: 0x084) (R/W 32) PRS Priority B for Slave -------- */
55 | #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
56 | typedef union {
57 | uint32_t reg; /*!< Type used for register access */
58 | } HMATRIXB_PRBS_Type;
59 | #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
60 |
61 | #define HMATRIXB_PRBS_OFFSET 0x084 /**< \brief (HMATRIXB_PRBS offset) Priority B for Slave */
62 | #define HMATRIXB_PRBS_RESETVALUE _U_(0x00000000) /**< \brief (HMATRIXB_PRBS reset_value) Priority B for Slave */
63 |
64 | #define HMATRIXB_PRBS_MASK _U_(0x00000000) /**< \brief (HMATRIXB_PRBS) MASK Register */
65 |
66 | /** \brief HmatrixbPrs hardware registers */
67 | #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
68 | typedef struct {
69 | __IO HMATRIXB_PRAS_Type PRAS; /**< \brief Offset: 0x000 (R/W 32) Priority A for Slave */
70 | __IO HMATRIXB_PRBS_Type PRBS; /**< \brief Offset: 0x004 (R/W 32) Priority B for Slave */
71 | } HmatrixbPrs;
72 | #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
73 |
74 | /** \brief HMATRIXB hardware registers */
75 | #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
76 | typedef struct {
77 | RoReg8 Reserved1[0x80];
78 | HmatrixbPrs Prs[16]; /**< \brief Offset: 0x080 HmatrixbPrs groups */
79 | } Hmatrixb;
80 | #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
81 |
82 | /*@}*/
83 |
84 | #endif /* _SAME53_HMATRIXB_COMPONENT_ */
85 |
--------------------------------------------------------------------------------
/variants/clearcore/Third Party/SAME53/CMSIS/Device/Include/instance/ccl.h:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * \brief Instance description for CCL
5 | *
6 | * Copyright (c) 2019 Microchip Technology Inc.
7 | *
8 | * \asf_license_start
9 | *
10 | * \page License
11 | *
12 | * SPDX-License-Identifier: Apache-2.0
13 | *
14 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
15 | * not use this file except in compliance with the License.
16 | * You may obtain a copy of the Licence at
17 | *
18 | * http://www.apache.org/licenses/LICENSE-2.0
19 | *
20 | * Unless required by applicable law or agreed to in writing, software
21 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT
22 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23 | * See the License for the specific language governing permissions and
24 | * limitations under the License.
25 | *
26 | * \asf_license_stop
27 | *
28 | */
29 |
30 | #ifndef _SAME53_CCL_INSTANCE_
31 | #define _SAME53_CCL_INSTANCE_
32 |
33 | /* ========== Register definition for CCL peripheral ========== */
34 | #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
35 | #define REG_CCL_CTRL (0x42003800) /**< \brief (CCL) Control */
36 | #define REG_CCL_SEQCTRL0 (0x42003804) /**< \brief (CCL) SEQ Control x 0 */
37 | #define REG_CCL_SEQCTRL1 (0x42003805) /**< \brief (CCL) SEQ Control x 1 */
38 | #define REG_CCL_LUTCTRL0 (0x42003808) /**< \brief (CCL) LUT Control x 0 */
39 | #define REG_CCL_LUTCTRL1 (0x4200380C) /**< \brief (CCL) LUT Control x 1 */
40 | #define REG_CCL_LUTCTRL2 (0x42003810) /**< \brief (CCL) LUT Control x 2 */
41 | #define REG_CCL_LUTCTRL3 (0x42003814) /**< \brief (CCL) LUT Control x 3 */
42 | #else
43 | #define REG_CCL_CTRL (*(RwReg8 *)0x42003800UL) /**< \brief (CCL) Control */
44 | #define REG_CCL_SEQCTRL0 (*(RwReg8 *)0x42003804UL) /**< \brief (CCL) SEQ Control x 0 */
45 | #define REG_CCL_SEQCTRL1 (*(RwReg8 *)0x42003805UL) /**< \brief (CCL) SEQ Control x 1 */
46 | #define REG_CCL_LUTCTRL0 (*(RwReg *)0x42003808UL) /**< \brief (CCL) LUT Control x 0 */
47 | #define REG_CCL_LUTCTRL1 (*(RwReg *)0x4200380CUL) /**< \brief (CCL) LUT Control x 1 */
48 | #define REG_CCL_LUTCTRL2 (*(RwReg *)0x42003810UL) /**< \brief (CCL) LUT Control x 2 */
49 | #define REG_CCL_LUTCTRL3 (*(RwReg *)0x42003814UL) /**< \brief (CCL) LUT Control x 3 */
50 | #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
51 |
52 | /* ========== Instance parameters for CCL peripheral ========== */
53 | #define CCL_GCLK_ID 33 // GCLK index for CCL
54 | #define CCL_LUT_NUM 4 // Number of LUT in a CCL
55 | #define CCL_SEQ_NUM 2 // Number of SEQ in a CCL
56 |
57 | #endif /* _SAME53_CCL_INSTANCE_ */
58 |
--------------------------------------------------------------------------------
/variants/clearcore/Third Party/SAME53/CMSIS/Device/Include/instance/cmcc.h:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * \brief Instance description for CMCC
5 | *
6 | * Copyright (c) 2019 Microchip Technology Inc.
7 | *
8 | * \asf_license_start
9 | *
10 | * \page License
11 | *
12 | * SPDX-License-Identifier: Apache-2.0
13 | *
14 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
15 | * not use this file except in compliance with the License.
16 | * You may obtain a copy of the Licence at
17 | *
18 | * http://www.apache.org/licenses/LICENSE-2.0
19 | *
20 | * Unless required by applicable law or agreed to in writing, software
21 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT
22 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23 | * See the License for the specific language governing permissions and
24 | * limitations under the License.
25 | *
26 | * \asf_license_stop
27 | *
28 | */
29 |
30 | #ifndef _SAME53_CMCC_INSTANCE_
31 | #define _SAME53_CMCC_INSTANCE_
32 |
33 | /* ========== Register definition for CMCC peripheral ========== */
34 | #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
35 | #define REG_CMCC_TYPE (0x41006000) /**< \brief (CMCC) Cache Type Register */
36 | #define REG_CMCC_CFG (0x41006004) /**< \brief (CMCC) Cache Configuration Register */
37 | #define REG_CMCC_CTRL (0x41006008) /**< \brief (CMCC) Cache Control Register */
38 | #define REG_CMCC_SR (0x4100600C) /**< \brief (CMCC) Cache Status Register */
39 | #define REG_CMCC_LCKWAY (0x41006010) /**< \brief (CMCC) Cache Lock per Way Register */
40 | #define REG_CMCC_MAINT0 (0x41006020) /**< \brief (CMCC) Cache Maintenance Register 0 */
41 | #define REG_CMCC_MAINT1 (0x41006024) /**< \brief (CMCC) Cache Maintenance Register 1 */
42 | #define REG_CMCC_MCFG (0x41006028) /**< \brief (CMCC) Cache Monitor Configuration Register */
43 | #define REG_CMCC_MEN (0x4100602C) /**< \brief (CMCC) Cache Monitor Enable Register */
44 | #define REG_CMCC_MCTRL (0x41006030) /**< \brief (CMCC) Cache Monitor Control Register */
45 | #define REG_CMCC_MSR (0x41006034) /**< \brief (CMCC) Cache Monitor Status Register */
46 | #else
47 | #define REG_CMCC_TYPE (*(RoReg *)0x41006000UL) /**< \brief (CMCC) Cache Type Register */
48 | #define REG_CMCC_CFG (*(RwReg *)0x41006004UL) /**< \brief (CMCC) Cache Configuration Register */
49 | #define REG_CMCC_CTRL (*(WoReg *)0x41006008UL) /**< \brief (CMCC) Cache Control Register */
50 | #define REG_CMCC_SR (*(RoReg *)0x4100600CUL) /**< \brief (CMCC) Cache Status Register */
51 | #define REG_CMCC_LCKWAY (*(RwReg *)0x41006010UL) /**< \brief (CMCC) Cache Lock per Way Register */
52 | #define REG_CMCC_MAINT0 (*(WoReg *)0x41006020UL) /**< \brief (CMCC) Cache Maintenance Register 0 */
53 | #define REG_CMCC_MAINT1 (*(WoReg *)0x41006024UL) /**< \brief (CMCC) Cache Maintenance Register 1 */
54 | #define REG_CMCC_MCFG (*(RwReg *)0x41006028UL) /**< \brief (CMCC) Cache Monitor Configuration Register */
55 | #define REG_CMCC_MEN (*(RwReg *)0x4100602CUL) /**< \brief (CMCC) Cache Monitor Enable Register */
56 | #define REG_CMCC_MCTRL (*(WoReg *)0x41006030UL) /**< \brief (CMCC) Cache Monitor Control Register */
57 | #define REG_CMCC_MSR (*(RoReg *)0x41006034UL) /**< \brief (CMCC) Cache Monitor Status Register */
58 | #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
59 |
60 |
61 | #endif /* _SAME53_CMCC_INSTANCE_ */
62 |
--------------------------------------------------------------------------------
/variants/clearcore/Third Party/SAME53/CMSIS/Device/Include/instance/freqm.h:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * \brief Instance description for FREQM
5 | *
6 | * Copyright (c) 2019 Microchip Technology Inc.
7 | *
8 | * \asf_license_start
9 | *
10 | * \page License
11 | *
12 | * SPDX-License-Identifier: Apache-2.0
13 | *
14 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
15 | * not use this file except in compliance with the License.
16 | * You may obtain a copy of the Licence at
17 | *
18 | * http://www.apache.org/licenses/LICENSE-2.0
19 | *
20 | * Unless required by applicable law or agreed to in writing, software
21 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT
22 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23 | * See the License for the specific language governing permissions and
24 | * limitations under the License.
25 | *
26 | * \asf_license_stop
27 | *
28 | */
29 |
30 | #ifndef _SAME53_FREQM_INSTANCE_
31 | #define _SAME53_FREQM_INSTANCE_
32 |
33 | /* ========== Register definition for FREQM peripheral ========== */
34 | #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
35 | #define REG_FREQM_CTRLA (0x40002C00) /**< \brief (FREQM) Control A Register */
36 | #define REG_FREQM_CTRLB (0x40002C01) /**< \brief (FREQM) Control B Register */
37 | #define REG_FREQM_CFGA (0x40002C02) /**< \brief (FREQM) Config A register */
38 | #define REG_FREQM_INTENCLR (0x40002C08) /**< \brief (FREQM) Interrupt Enable Clear Register */
39 | #define REG_FREQM_INTENSET (0x40002C09) /**< \brief (FREQM) Interrupt Enable Set Register */
40 | #define REG_FREQM_INTFLAG (0x40002C0A) /**< \brief (FREQM) Interrupt Flag Register */
41 | #define REG_FREQM_STATUS (0x40002C0B) /**< \brief (FREQM) Status Register */
42 | #define REG_FREQM_SYNCBUSY (0x40002C0C) /**< \brief (FREQM) Synchronization Busy Register */
43 | #define REG_FREQM_VALUE (0x40002C10) /**< \brief (FREQM) Count Value Register */
44 | #else
45 | #define REG_FREQM_CTRLA (*(RwReg8 *)0x40002C00UL) /**< \brief (FREQM) Control A Register */
46 | #define REG_FREQM_CTRLB (*(WoReg8 *)0x40002C01UL) /**< \brief (FREQM) Control B Register */
47 | #define REG_FREQM_CFGA (*(RwReg16*)0x40002C02UL) /**< \brief (FREQM) Config A register */
48 | #define REG_FREQM_INTENCLR (*(RwReg8 *)0x40002C08UL) /**< \brief (FREQM) Interrupt Enable Clear Register */
49 | #define REG_FREQM_INTENSET (*(RwReg8 *)0x40002C09UL) /**< \brief (FREQM) Interrupt Enable Set Register */
50 | #define REG_FREQM_INTFLAG (*(RwReg8 *)0x40002C0AUL) /**< \brief (FREQM) Interrupt Flag Register */
51 | #define REG_FREQM_STATUS (*(RwReg8 *)0x40002C0BUL) /**< \brief (FREQM) Status Register */
52 | #define REG_FREQM_SYNCBUSY (*(RoReg *)0x40002C0CUL) /**< \brief (FREQM) Synchronization Busy Register */
53 | #define REG_FREQM_VALUE (*(RoReg *)0x40002C10UL) /**< \brief (FREQM) Count Value Register */
54 | #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
55 |
56 | /* ========== Instance parameters for FREQM peripheral ========== */
57 | #define FREQM_GCLK_ID_MSR 5 // Index of measure generic clock
58 |
59 | #endif /* _SAME53_FREQM_INSTANCE_ */
60 |
--------------------------------------------------------------------------------
/variants/clearcore/Third Party/SAME53/CMSIS/Device/Include/instance/mclk.h:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * \brief Instance description for MCLK
5 | *
6 | * Copyright (c) 2019 Microchip Technology Inc.
7 | *
8 | * \asf_license_start
9 | *
10 | * \page License
11 | *
12 | * SPDX-License-Identifier: Apache-2.0
13 | *
14 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
15 | * not use this file except in compliance with the License.
16 | * You may obtain a copy of the Licence at
17 | *
18 | * http://www.apache.org/licenses/LICENSE-2.0
19 | *
20 | * Unless required by applicable law or agreed to in writing, software
21 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT
22 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23 | * See the License for the specific language governing permissions and
24 | * limitations under the License.
25 | *
26 | * \asf_license_stop
27 | *
28 | */
29 |
30 | #ifndef _SAME53_MCLK_INSTANCE_
31 | #define _SAME53_MCLK_INSTANCE_
32 |
33 | /* ========== Register definition for MCLK peripheral ========== */
34 | #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
35 | #define REG_MCLK_INTENCLR (0x40000801) /**< \brief (MCLK) Interrupt Enable Clear */
36 | #define REG_MCLK_INTENSET (0x40000802) /**< \brief (MCLK) Interrupt Enable Set */
37 | #define REG_MCLK_INTFLAG (0x40000803) /**< \brief (MCLK) Interrupt Flag Status and Clear */
38 | #define REG_MCLK_HSDIV (0x40000804) /**< \brief (MCLK) HS Clock Division */
39 | #define REG_MCLK_CPUDIV (0x40000805) /**< \brief (MCLK) CPU Clock Division */
40 | #define REG_MCLK_AHBMASK (0x40000810) /**< \brief (MCLK) AHB Mask */
41 | #define REG_MCLK_APBAMASK (0x40000814) /**< \brief (MCLK) APBA Mask */
42 | #define REG_MCLK_APBBMASK (0x40000818) /**< \brief (MCLK) APBB Mask */
43 | #define REG_MCLK_APBCMASK (0x4000081C) /**< \brief (MCLK) APBC Mask */
44 | #define REG_MCLK_APBDMASK (0x40000820) /**< \brief (MCLK) APBD Mask */
45 | #else
46 | #define REG_MCLK_INTENCLR (*(RwReg8 *)0x40000801UL) /**< \brief (MCLK) Interrupt Enable Clear */
47 | #define REG_MCLK_INTENSET (*(RwReg8 *)0x40000802UL) /**< \brief (MCLK) Interrupt Enable Set */
48 | #define REG_MCLK_INTFLAG (*(RwReg8 *)0x40000803UL) /**< \brief (MCLK) Interrupt Flag Status and Clear */
49 | #define REG_MCLK_HSDIV (*(RoReg8 *)0x40000804UL) /**< \brief (MCLK) HS Clock Division */
50 | #define REG_MCLK_CPUDIV (*(RwReg8 *)0x40000805UL) /**< \brief (MCLK) CPU Clock Division */
51 | #define REG_MCLK_AHBMASK (*(RwReg *)0x40000810UL) /**< \brief (MCLK) AHB Mask */
52 | #define REG_MCLK_APBAMASK (*(RwReg *)0x40000814UL) /**< \brief (MCLK) APBA Mask */
53 | #define REG_MCLK_APBBMASK (*(RwReg *)0x40000818UL) /**< \brief (MCLK) APBB Mask */
54 | #define REG_MCLK_APBCMASK (*(RwReg *)0x4000081CUL) /**< \brief (MCLK) APBC Mask */
55 | #define REG_MCLK_APBDMASK (*(RwReg *)0x40000820UL) /**< \brief (MCLK) APBD Mask */
56 | #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
57 |
58 | /* ========== Instance parameters for MCLK peripheral ========== */
59 | #define MCLK_SYSTEM_CLOCK 48000000 // System Clock Frequency at Reset
60 |
61 | #endif /* _SAME53_MCLK_INSTANCE_ */
62 |
--------------------------------------------------------------------------------
/variants/clearcore/Third Party/SAME53/CMSIS/Device/Include/instance/osc32kctrl.h:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * \brief Instance description for OSC32KCTRL
5 | *
6 | * Copyright (c) 2019 Microchip Technology Inc.
7 | *
8 | * \asf_license_start
9 | *
10 | * \page License
11 | *
12 | * SPDX-License-Identifier: Apache-2.0
13 | *
14 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
15 | * not use this file except in compliance with the License.
16 | * You may obtain a copy of the Licence at
17 | *
18 | * http://www.apache.org/licenses/LICENSE-2.0
19 | *
20 | * Unless required by applicable law or agreed to in writing, software
21 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT
22 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23 | * See the License for the specific language governing permissions and
24 | * limitations under the License.
25 | *
26 | * \asf_license_stop
27 | *
28 | */
29 |
30 | #ifndef _SAME53_OSC32KCTRL_INSTANCE_
31 | #define _SAME53_OSC32KCTRL_INSTANCE_
32 |
33 | /* ========== Register definition for OSC32KCTRL peripheral ========== */
34 | #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
35 | #define REG_OSC32KCTRL_INTENCLR (0x40001400) /**< \brief (OSC32KCTRL) Interrupt Enable Clear */
36 | #define REG_OSC32KCTRL_INTENSET (0x40001404) /**< \brief (OSC32KCTRL) Interrupt Enable Set */
37 | #define REG_OSC32KCTRL_INTFLAG (0x40001408) /**< \brief (OSC32KCTRL) Interrupt Flag Status and Clear */
38 | #define REG_OSC32KCTRL_STATUS (0x4000140C) /**< \brief (OSC32KCTRL) Power and Clocks Status */
39 | #define REG_OSC32KCTRL_RTCCTRL (0x40001410) /**< \brief (OSC32KCTRL) RTC Clock Selection */
40 | #define REG_OSC32KCTRL_XOSC32K (0x40001414) /**< \brief (OSC32KCTRL) 32kHz External Crystal Oscillator (XOSC32K) Control */
41 | #define REG_OSC32KCTRL_CFDCTRL (0x40001416) /**< \brief (OSC32KCTRL) Clock Failure Detector Control */
42 | #define REG_OSC32KCTRL_EVCTRL (0x40001417) /**< \brief (OSC32KCTRL) Event Control */
43 | #define REG_OSC32KCTRL_OSCULP32K (0x4000141C) /**< \brief (OSC32KCTRL) 32kHz Ultra Low Power Internal Oscillator (OSCULP32K) Control */
44 | #else
45 | #define REG_OSC32KCTRL_INTENCLR (*(RwReg *)0x40001400UL) /**< \brief (OSC32KCTRL) Interrupt Enable Clear */
46 | #define REG_OSC32KCTRL_INTENSET (*(RwReg *)0x40001404UL) /**< \brief (OSC32KCTRL) Interrupt Enable Set */
47 | #define REG_OSC32KCTRL_INTFLAG (*(RwReg *)0x40001408UL) /**< \brief (OSC32KCTRL) Interrupt Flag Status and Clear */
48 | #define REG_OSC32KCTRL_STATUS (*(RoReg *)0x4000140CUL) /**< \brief (OSC32KCTRL) Power and Clocks Status */
49 | #define REG_OSC32KCTRL_RTCCTRL (*(RwReg8 *)0x40001410UL) /**< \brief (OSC32KCTRL) RTC Clock Selection */
50 | #define REG_OSC32KCTRL_XOSC32K (*(RwReg16*)0x40001414UL) /**< \brief (OSC32KCTRL) 32kHz External Crystal Oscillator (XOSC32K) Control */
51 | #define REG_OSC32KCTRL_CFDCTRL (*(RwReg8 *)0x40001416UL) /**< \brief (OSC32KCTRL) Clock Failure Detector Control */
52 | #define REG_OSC32KCTRL_EVCTRL (*(RwReg8 *)0x40001417UL) /**< \brief (OSC32KCTRL) Event Control */
53 | #define REG_OSC32KCTRL_OSCULP32K (*(RwReg *)0x4000141CUL) /**< \brief (OSC32KCTRL) 32kHz Ultra Low Power Internal Oscillator (OSCULP32K) Control */
54 | #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
55 |
56 | /* ========== Instance parameters for OSC32KCTRL peripheral ========== */
57 | #define OSC32KCTRL_OSC32K_COARSE_CALIB_MSB 0 // OSC32K coarse calibration size
58 |
59 | #endif /* _SAME53_OSC32KCTRL_INSTANCE_ */
60 |
--------------------------------------------------------------------------------
/variants/clearcore/Third Party/SAME53/CMSIS/Device/Include/instance/pcc.h:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * \brief Instance description for PCC
5 | *
6 | * Copyright (c) 2019 Microchip Technology Inc.
7 | *
8 | * \asf_license_start
9 | *
10 | * \page License
11 | *
12 | * SPDX-License-Identifier: Apache-2.0
13 | *
14 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
15 | * not use this file except in compliance with the License.
16 | * You may obtain a copy of the Licence at
17 | *
18 | * http://www.apache.org/licenses/LICENSE-2.0
19 | *
20 | * Unless required by applicable law or agreed to in writing, software
21 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT
22 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23 | * See the License for the specific language governing permissions and
24 | * limitations under the License.
25 | *
26 | * \asf_license_stop
27 | *
28 | */
29 |
30 | #ifndef _SAME53_PCC_INSTANCE_
31 | #define _SAME53_PCC_INSTANCE_
32 |
33 | /* ========== Register definition for PCC peripheral ========== */
34 | #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
35 | #define REG_PCC_MR (0x43002C00) /**< \brief (PCC) Mode Register */
36 | #define REG_PCC_IER (0x43002C04) /**< \brief (PCC) Interrupt Enable Register */
37 | #define REG_PCC_IDR (0x43002C08) /**< \brief (PCC) Interrupt Disable Register */
38 | #define REG_PCC_IMR (0x43002C0C) /**< \brief (PCC) Interrupt Mask Register */
39 | #define REG_PCC_ISR (0x43002C10) /**< \brief (PCC) Interrupt Status Register */
40 | #define REG_PCC_RHR (0x43002C14) /**< \brief (PCC) Reception Holding Register */
41 | #define REG_PCC_WPMR (0x43002CE0) /**< \brief (PCC) Write Protection Mode Register */
42 | #define REG_PCC_WPSR (0x43002CE4) /**< \brief (PCC) Write Protection Status Register */
43 | #else
44 | #define REG_PCC_MR (*(RwReg *)0x43002C00UL) /**< \brief (PCC) Mode Register */
45 | #define REG_PCC_IER (*(WoReg *)0x43002C04UL) /**< \brief (PCC) Interrupt Enable Register */
46 | #define REG_PCC_IDR (*(WoReg *)0x43002C08UL) /**< \brief (PCC) Interrupt Disable Register */
47 | #define REG_PCC_IMR (*(RoReg *)0x43002C0CUL) /**< \brief (PCC) Interrupt Mask Register */
48 | #define REG_PCC_ISR (*(RoReg *)0x43002C10UL) /**< \brief (PCC) Interrupt Status Register */
49 | #define REG_PCC_RHR (*(RoReg *)0x43002C14UL) /**< \brief (PCC) Reception Holding Register */
50 | #define REG_PCC_WPMR (*(RwReg *)0x43002CE0UL) /**< \brief (PCC) Write Protection Mode Register */
51 | #define REG_PCC_WPSR (*(RoReg *)0x43002CE4UL) /**< \brief (PCC) Write Protection Status Register */
52 | #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
53 |
54 | /* ========== Instance parameters for PCC peripheral ========== */
55 | #define PCC_DATA_SIZE 14
56 | #define PCC_DMAC_ID_RX 80
57 |
58 | #endif /* _SAME53_PCC_INSTANCE_ */
59 |
--------------------------------------------------------------------------------
/variants/clearcore/Third Party/SAME53/CMSIS/Device/Include/instance/pm.h:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * \brief Instance description for PM
5 | *
6 | * Copyright (c) 2019 Microchip Technology Inc.
7 | *
8 | * \asf_license_start
9 | *
10 | * \page License
11 | *
12 | * SPDX-License-Identifier: Apache-2.0
13 | *
14 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
15 | * not use this file except in compliance with the License.
16 | * You may obtain a copy of the Licence at
17 | *
18 | * http://www.apache.org/licenses/LICENSE-2.0
19 | *
20 | * Unless required by applicable law or agreed to in writing, software
21 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT
22 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23 | * See the License for the specific language governing permissions and
24 | * limitations under the License.
25 | *
26 | * \asf_license_stop
27 | *
28 | */
29 |
30 | #ifndef _SAME53_PM_INSTANCE_
31 | #define _SAME53_PM_INSTANCE_
32 |
33 | /* ========== Register definition for PM peripheral ========== */
34 | #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
35 | #define REG_PM_CTRLA (0x40000400) /**< \brief (PM) Control A */
36 | #define REG_PM_SLEEPCFG (0x40000401) /**< \brief (PM) Sleep Configuration */
37 | #define REG_PM_INTENCLR (0x40000404) /**< \brief (PM) Interrupt Enable Clear */
38 | #define REG_PM_INTENSET (0x40000405) /**< \brief (PM) Interrupt Enable Set */
39 | #define REG_PM_INTFLAG (0x40000406) /**< \brief (PM) Interrupt Flag Status and Clear */
40 | #define REG_PM_STDBYCFG (0x40000408) /**< \brief (PM) Standby Configuration */
41 | #define REG_PM_HIBCFG (0x40000409) /**< \brief (PM) Hibernate Configuration */
42 | #define REG_PM_BKUPCFG (0x4000040A) /**< \brief (PM) Backup Configuration */
43 | #define REG_PM_PWSAKDLY (0x40000412) /**< \brief (PM) Power Switch Acknowledge Delay */
44 | #else
45 | #define REG_PM_CTRLA (*(RwReg8 *)0x40000400UL) /**< \brief (PM) Control A */
46 | #define REG_PM_SLEEPCFG (*(RwReg8 *)0x40000401UL) /**< \brief (PM) Sleep Configuration */
47 | #define REG_PM_INTENCLR (*(RwReg8 *)0x40000404UL) /**< \brief (PM) Interrupt Enable Clear */
48 | #define REG_PM_INTENSET (*(RwReg8 *)0x40000405UL) /**< \brief (PM) Interrupt Enable Set */
49 | #define REG_PM_INTFLAG (*(RwReg8 *)0x40000406UL) /**< \brief (PM) Interrupt Flag Status and Clear */
50 | #define REG_PM_STDBYCFG (*(RwReg8 *)0x40000408UL) /**< \brief (PM) Standby Configuration */
51 | #define REG_PM_HIBCFG (*(RwReg8 *)0x40000409UL) /**< \brief (PM) Hibernate Configuration */
52 | #define REG_PM_BKUPCFG (*(RwReg8 *)0x4000040AUL) /**< \brief (PM) Backup Configuration */
53 | #define REG_PM_PWSAKDLY (*(RwReg8 *)0x40000412UL) /**< \brief (PM) Power Switch Acknowledge Delay */
54 | #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
55 |
56 | /* ========== Instance parameters for PM peripheral ========== */
57 | #define PM_PD_NUM 0 // Number of switchable Power Domains
58 |
59 | #endif /* _SAME53_PM_INSTANCE_ */
60 |
--------------------------------------------------------------------------------
/variants/clearcore/Third Party/SAME53/CMSIS/Device/Include/instance/pukcc.h:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * \brief Instance description for PUKCC
5 | *
6 | * Copyright (c) 2019 Microchip Technology Inc.
7 | *
8 | * \asf_license_start
9 | *
10 | * \page License
11 | *
12 | * SPDX-License-Identifier: Apache-2.0
13 | *
14 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
15 | * not use this file except in compliance with the License.
16 | * You may obtain a copy of the Licence at
17 | *
18 | * http://www.apache.org/licenses/LICENSE-2.0
19 | *
20 | * Unless required by applicable law or agreed to in writing, software
21 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT
22 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23 | * See the License for the specific language governing permissions and
24 | * limitations under the License.
25 | *
26 | * \asf_license_stop
27 | *
28 | */
29 |
30 | #ifndef _SAME53_PUKCC_INSTANCE_
31 | #define _SAME53_PUKCC_INSTANCE_
32 |
33 | /* ========== Instance parameters for PUKCC peripheral ========== */
34 | #define PUKCC_CLK_AHB_ID 20
35 | #define PUKCC_RAM_ADDR_SIZE 12
36 | #define PUKCC_ROM_ADDR_SIZE 16
37 |
38 | #endif /* _SAME53_PUKCC_INSTANCE_ */
39 |
--------------------------------------------------------------------------------
/variants/clearcore/Third Party/SAME53/CMSIS/Device/Include/instance/qspi.h:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * \brief Instance description for QSPI
5 | *
6 | * Copyright (c) 2019 Microchip Technology Inc.
7 | *
8 | * \asf_license_start
9 | *
10 | * \page License
11 | *
12 | * SPDX-License-Identifier: Apache-2.0
13 | *
14 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
15 | * not use this file except in compliance with the License.
16 | * You may obtain a copy of the Licence at
17 | *
18 | * http://www.apache.org/licenses/LICENSE-2.0
19 | *
20 | * Unless required by applicable law or agreed to in writing, software
21 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT
22 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23 | * See the License for the specific language governing permissions and
24 | * limitations under the License.
25 | *
26 | * \asf_license_stop
27 | *
28 | */
29 |
30 | #ifndef _SAME53_QSPI_INSTANCE_
31 | #define _SAME53_QSPI_INSTANCE_
32 |
33 | /* ========== Register definition for QSPI peripheral ========== */
34 | #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
35 | #define REG_QSPI_CTRLA (0x42003400) /**< \brief (QSPI) Control A */
36 | #define REG_QSPI_CTRLB (0x42003404) /**< \brief (QSPI) Control B */
37 | #define REG_QSPI_BAUD (0x42003408) /**< \brief (QSPI) Baud Rate */
38 | #define REG_QSPI_RXDATA (0x4200340C) /**< \brief (QSPI) Receive Data */
39 | #define REG_QSPI_TXDATA (0x42003410) /**< \brief (QSPI) Transmit Data */
40 | #define REG_QSPI_INTENCLR (0x42003414) /**< \brief (QSPI) Interrupt Enable Clear */
41 | #define REG_QSPI_INTENSET (0x42003418) /**< \brief (QSPI) Interrupt Enable Set */
42 | #define REG_QSPI_INTFLAG (0x4200341C) /**< \brief (QSPI) Interrupt Flag Status and Clear */
43 | #define REG_QSPI_STATUS (0x42003420) /**< \brief (QSPI) Status Register */
44 | #define REG_QSPI_INSTRADDR (0x42003430) /**< \brief (QSPI) Instruction Address */
45 | #define REG_QSPI_INSTRCTRL (0x42003434) /**< \brief (QSPI) Instruction Code */
46 | #define REG_QSPI_INSTRFRAME (0x42003438) /**< \brief (QSPI) Instruction Frame */
47 | #define REG_QSPI_SCRAMBCTRL (0x42003440) /**< \brief (QSPI) Scrambling Mode */
48 | #define REG_QSPI_SCRAMBKEY (0x42003444) /**< \brief (QSPI) Scrambling Key */
49 | #else
50 | #define REG_QSPI_CTRLA (*(RwReg *)0x42003400UL) /**< \brief (QSPI) Control A */
51 | #define REG_QSPI_CTRLB (*(RwReg *)0x42003404UL) /**< \brief (QSPI) Control B */
52 | #define REG_QSPI_BAUD (*(RwReg *)0x42003408UL) /**< \brief (QSPI) Baud Rate */
53 | #define REG_QSPI_RXDATA (*(RoReg *)0x4200340CUL) /**< \brief (QSPI) Receive Data */
54 | #define REG_QSPI_TXDATA (*(WoReg *)0x42003410UL) /**< \brief (QSPI) Transmit Data */
55 | #define REG_QSPI_INTENCLR (*(RwReg *)0x42003414UL) /**< \brief (QSPI) Interrupt Enable Clear */
56 | #define REG_QSPI_INTENSET (*(RwReg *)0x42003418UL) /**< \brief (QSPI) Interrupt Enable Set */
57 | #define REG_QSPI_INTFLAG (*(RwReg *)0x4200341CUL) /**< \brief (QSPI) Interrupt Flag Status and Clear */
58 | #define REG_QSPI_STATUS (*(RoReg *)0x42003420UL) /**< \brief (QSPI) Status Register */
59 | #define REG_QSPI_INSTRADDR (*(RwReg *)0x42003430UL) /**< \brief (QSPI) Instruction Address */
60 | #define REG_QSPI_INSTRCTRL (*(RwReg *)0x42003434UL) /**< \brief (QSPI) Instruction Code */
61 | #define REG_QSPI_INSTRFRAME (*(RwReg *)0x42003438UL) /**< \brief (QSPI) Instruction Frame */
62 | #define REG_QSPI_SCRAMBCTRL (*(RwReg *)0x42003440UL) /**< \brief (QSPI) Scrambling Mode */
63 | #define REG_QSPI_SCRAMBKEY (*(WoReg *)0x42003444UL) /**< \brief (QSPI) Scrambling Key */
64 | #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
65 |
66 | /* ========== Instance parameters for QSPI peripheral ========== */
67 | #define QSPI_DMAC_ID_RX 83
68 | #define QSPI_DMAC_ID_TX 84
69 | #define QSPI_HADDR_MSB 23
70 | #define QSPI_OCMS 1
71 |
72 | #endif /* _SAME53_QSPI_INSTANCE_ */
73 |
--------------------------------------------------------------------------------
/variants/clearcore/Third Party/SAME53/CMSIS/Device/Include/instance/ramecc.h:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * \brief Instance description for RAMECC
5 | *
6 | * Copyright (c) 2019 Microchip Technology Inc.
7 | *
8 | * \asf_license_start
9 | *
10 | * \page License
11 | *
12 | * SPDX-License-Identifier: Apache-2.0
13 | *
14 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
15 | * not use this file except in compliance with the License.
16 | * You may obtain a copy of the Licence at
17 | *
18 | * http://www.apache.org/licenses/LICENSE-2.0
19 | *
20 | * Unless required by applicable law or agreed to in writing, software
21 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT
22 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23 | * See the License for the specific language governing permissions and
24 | * limitations under the License.
25 | *
26 | * \asf_license_stop
27 | *
28 | */
29 |
30 | #ifndef _SAME53_RAMECC_INSTANCE_
31 | #define _SAME53_RAMECC_INSTANCE_
32 |
33 | /* ========== Register definition for RAMECC peripheral ========== */
34 | #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
35 | #define REG_RAMECC_INTENCLR (0x41020000) /**< \brief (RAMECC) Interrupt Enable Clear */
36 | #define REG_RAMECC_INTENSET (0x41020001) /**< \brief (RAMECC) Interrupt Enable Set */
37 | #define REG_RAMECC_INTFLAG (0x41020002) /**< \brief (RAMECC) Interrupt Flag */
38 | #define REG_RAMECC_STATUS (0x41020003) /**< \brief (RAMECC) Status */
39 | #define REG_RAMECC_ERRADDR (0x41020004) /**< \brief (RAMECC) Error Address */
40 | #define REG_RAMECC_DBGCTRL (0x4102000F) /**< \brief (RAMECC) Debug Control */
41 | #else
42 | #define REG_RAMECC_INTENCLR (*(RwReg8 *)0x41020000UL) /**< \brief (RAMECC) Interrupt Enable Clear */
43 | #define REG_RAMECC_INTENSET (*(RwReg8 *)0x41020001UL) /**< \brief (RAMECC) Interrupt Enable Set */
44 | #define REG_RAMECC_INTFLAG (*(RwReg8 *)0x41020002UL) /**< \brief (RAMECC) Interrupt Flag */
45 | #define REG_RAMECC_STATUS (*(RoReg8 *)0x41020003UL) /**< \brief (RAMECC) Status */
46 | #define REG_RAMECC_ERRADDR (*(RoReg *)0x41020004UL) /**< \brief (RAMECC) Error Address */
47 | #define REG_RAMECC_DBGCTRL (*(RwReg8 *)0x4102000FUL) /**< \brief (RAMECC) Debug Control */
48 | #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
49 |
50 | /* ========== Instance parameters for RAMECC peripheral ========== */
51 | #define RAMECC_RAMADDR_BITS 13 // Number of RAM address bits
52 | #define RAMECC_RAMBANK_NUM 4 // Number of RAM banks
53 |
54 | #endif /* _SAME53_RAMECC_INSTANCE_ */
55 |
--------------------------------------------------------------------------------
/variants/clearcore/Third Party/SAME53/CMSIS/Device/Include/instance/rstc.h:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * \brief Instance description for RSTC
5 | *
6 | * Copyright (c) 2019 Microchip Technology Inc.
7 | *
8 | * \asf_license_start
9 | *
10 | * \page License
11 | *
12 | * SPDX-License-Identifier: Apache-2.0
13 | *
14 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
15 | * not use this file except in compliance with the License.
16 | * You may obtain a copy of the Licence at
17 | *
18 | * http://www.apache.org/licenses/LICENSE-2.0
19 | *
20 | * Unless required by applicable law or agreed to in writing, software
21 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT
22 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23 | * See the License for the specific language governing permissions and
24 | * limitations under the License.
25 | *
26 | * \asf_license_stop
27 | *
28 | */
29 |
30 | #ifndef _SAME53_RSTC_INSTANCE_
31 | #define _SAME53_RSTC_INSTANCE_
32 |
33 | /* ========== Register definition for RSTC peripheral ========== */
34 | #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
35 | #define REG_RSTC_RCAUSE (0x40000C00) /**< \brief (RSTC) Reset Cause */
36 | #define REG_RSTC_BKUPEXIT (0x40000C02) /**< \brief (RSTC) Backup Exit Source */
37 | #else
38 | #define REG_RSTC_RCAUSE (*(RoReg8 *)0x40000C00UL) /**< \brief (RSTC) Reset Cause */
39 | #define REG_RSTC_BKUPEXIT (*(RoReg8 *)0x40000C02UL) /**< \brief (RSTC) Backup Exit Source */
40 | #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
41 |
42 | /* ========== Instance parameters for RSTC peripheral ========== */
43 | #define RSTC_BACKUP_IMPLEMENTED 1
44 | #define RSTC_HIB_IMPLEMENTED 1
45 | #define RSTC_NUMBER_OF_EXTWAKE 0 // number of external wakeup line
46 | #define RSTC_NVMRST_IMPLEMENTED 1
47 |
48 | #endif /* _SAME53_RSTC_INSTANCE_ */
49 |
--------------------------------------------------------------------------------
/variants/clearcore/Third Party/SAME53/CMSIS/Device/Include/instance/supc.h:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * \brief Instance description for SUPC
5 | *
6 | * Copyright (c) 2019 Microchip Technology Inc.
7 | *
8 | * \asf_license_start
9 | *
10 | * \page License
11 | *
12 | * SPDX-License-Identifier: Apache-2.0
13 | *
14 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
15 | * not use this file except in compliance with the License.
16 | * You may obtain a copy of the Licence at
17 | *
18 | * http://www.apache.org/licenses/LICENSE-2.0
19 | *
20 | * Unless required by applicable law or agreed to in writing, software
21 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT
22 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23 | * See the License for the specific language governing permissions and
24 | * limitations under the License.
25 | *
26 | * \asf_license_stop
27 | *
28 | */
29 |
30 | #ifndef _SAME53_SUPC_INSTANCE_
31 | #define _SAME53_SUPC_INSTANCE_
32 |
33 | /* ========== Register definition for SUPC peripheral ========== */
34 | #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
35 | #define REG_SUPC_INTENCLR (0x40001800) /**< \brief (SUPC) Interrupt Enable Clear */
36 | #define REG_SUPC_INTENSET (0x40001804) /**< \brief (SUPC) Interrupt Enable Set */
37 | #define REG_SUPC_INTFLAG (0x40001808) /**< \brief (SUPC) Interrupt Flag Status and Clear */
38 | #define REG_SUPC_STATUS (0x4000180C) /**< \brief (SUPC) Power and Clocks Status */
39 | #define REG_SUPC_BOD33 (0x40001810) /**< \brief (SUPC) BOD33 Control */
40 | #define REG_SUPC_VREG (0x40001818) /**< \brief (SUPC) VREG Control */
41 | #define REG_SUPC_VREF (0x4000181C) /**< \brief (SUPC) VREF Control */
42 | #define REG_SUPC_BBPS (0x40001820) /**< \brief (SUPC) Battery Backup Power Switch */
43 | #define REG_SUPC_BKOUT (0x40001824) /**< \brief (SUPC) Backup Output Control */
44 | #define REG_SUPC_BKIN (0x40001828) /**< \brief (SUPC) Backup Input Control */
45 | #else
46 | #define REG_SUPC_INTENCLR (*(RwReg *)0x40001800UL) /**< \brief (SUPC) Interrupt Enable Clear */
47 | #define REG_SUPC_INTENSET (*(RwReg *)0x40001804UL) /**< \brief (SUPC) Interrupt Enable Set */
48 | #define REG_SUPC_INTFLAG (*(RwReg *)0x40001808UL) /**< \brief (SUPC) Interrupt Flag Status and Clear */
49 | #define REG_SUPC_STATUS (*(RoReg *)0x4000180CUL) /**< \brief (SUPC) Power and Clocks Status */
50 | #define REG_SUPC_BOD33 (*(RwReg *)0x40001810UL) /**< \brief (SUPC) BOD33 Control */
51 | #define REG_SUPC_VREG (*(RwReg *)0x40001818UL) /**< \brief (SUPC) VREG Control */
52 | #define REG_SUPC_VREF (*(RwReg *)0x4000181CUL) /**< \brief (SUPC) VREF Control */
53 | #define REG_SUPC_BBPS (*(RwReg *)0x40001820UL) /**< \brief (SUPC) Battery Backup Power Switch */
54 | #define REG_SUPC_BKOUT (*(RwReg *)0x40001824UL) /**< \brief (SUPC) Backup Output Control */
55 | #define REG_SUPC_BKIN (*(RoReg *)0x40001828UL) /**< \brief (SUPC) Backup Input Control */
56 | #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
57 |
58 | /* ========== Instance parameters for SUPC peripheral ========== */
59 | #define SUPC_BOD12_CALIB_MSB 5
60 | #define SUPC_BOD33_CALIB_MSB 5
61 |
62 | #endif /* _SAME53_SUPC_INSTANCE_ */
63 |
--------------------------------------------------------------------------------
/variants/clearcore/Third Party/SAME53/CMSIS/Device/Include/instance/trng.h:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * \brief Instance description for TRNG
5 | *
6 | * Copyright (c) 2019 Microchip Technology Inc.
7 | *
8 | * \asf_license_start
9 | *
10 | * \page License
11 | *
12 | * SPDX-License-Identifier: Apache-2.0
13 | *
14 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
15 | * not use this file except in compliance with the License.
16 | * You may obtain a copy of the Licence at
17 | *
18 | * http://www.apache.org/licenses/LICENSE-2.0
19 | *
20 | * Unless required by applicable law or agreed to in writing, software
21 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT
22 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23 | * See the License for the specific language governing permissions and
24 | * limitations under the License.
25 | *
26 | * \asf_license_stop
27 | *
28 | */
29 |
30 | #ifndef _SAME53_TRNG_INSTANCE_
31 | #define _SAME53_TRNG_INSTANCE_
32 |
33 | /* ========== Register definition for TRNG peripheral ========== */
34 | #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
35 | #define REG_TRNG_CTRLA (0x42002800) /**< \brief (TRNG) Control A */
36 | #define REG_TRNG_EVCTRL (0x42002804) /**< \brief (TRNG) Event Control */
37 | #define REG_TRNG_INTENCLR (0x42002808) /**< \brief (TRNG) Interrupt Enable Clear */
38 | #define REG_TRNG_INTENSET (0x42002809) /**< \brief (TRNG) Interrupt Enable Set */
39 | #define REG_TRNG_INTFLAG (0x4200280A) /**< \brief (TRNG) Interrupt Flag Status and Clear */
40 | #define REG_TRNG_DATA (0x42002820) /**< \brief (TRNG) Output Data */
41 | #else
42 | #define REG_TRNG_CTRLA (*(RwReg8 *)0x42002800UL) /**< \brief (TRNG) Control A */
43 | #define REG_TRNG_EVCTRL (*(RwReg8 *)0x42002804UL) /**< \brief (TRNG) Event Control */
44 | #define REG_TRNG_INTENCLR (*(RwReg8 *)0x42002808UL) /**< \brief (TRNG) Interrupt Enable Clear */
45 | #define REG_TRNG_INTENSET (*(RwReg8 *)0x42002809UL) /**< \brief (TRNG) Interrupt Enable Set */
46 | #define REG_TRNG_INTFLAG (*(RwReg8 *)0x4200280AUL) /**< \brief (TRNG) Interrupt Flag Status and Clear */
47 | #define REG_TRNG_DATA (*(RoReg *)0x42002820UL) /**< \brief (TRNG) Output Data */
48 | #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
49 |
50 |
51 | #endif /* _SAME53_TRNG_INSTANCE_ */
52 |
--------------------------------------------------------------------------------
/variants/clearcore/Third Party/SAME53/CMSIS/Device/Include/instance/wdt.h:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * \brief Instance description for WDT
5 | *
6 | * Copyright (c) 2019 Microchip Technology Inc.
7 | *
8 | * \asf_license_start
9 | *
10 | * \page License
11 | *
12 | * SPDX-License-Identifier: Apache-2.0
13 | *
14 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
15 | * not use this file except in compliance with the License.
16 | * You may obtain a copy of the Licence at
17 | *
18 | * http://www.apache.org/licenses/LICENSE-2.0
19 | *
20 | * Unless required by applicable law or agreed to in writing, software
21 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT
22 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23 | * See the License for the specific language governing permissions and
24 | * limitations under the License.
25 | *
26 | * \asf_license_stop
27 | *
28 | */
29 |
30 | #ifndef _SAME53_WDT_INSTANCE_
31 | #define _SAME53_WDT_INSTANCE_
32 |
33 | /* ========== Register definition for WDT peripheral ========== */
34 | #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
35 | #define REG_WDT_CTRLA (0x40002000) /**< \brief (WDT) Control */
36 | #define REG_WDT_CONFIG (0x40002001) /**< \brief (WDT) Configuration */
37 | #define REG_WDT_EWCTRL (0x40002002) /**< \brief (WDT) Early Warning Interrupt Control */
38 | #define REG_WDT_INTENCLR (0x40002004) /**< \brief (WDT) Interrupt Enable Clear */
39 | #define REG_WDT_INTENSET (0x40002005) /**< \brief (WDT) Interrupt Enable Set */
40 | #define REG_WDT_INTFLAG (0x40002006) /**< \brief (WDT) Interrupt Flag Status and Clear */
41 | #define REG_WDT_SYNCBUSY (0x40002008) /**< \brief (WDT) Synchronization Busy */
42 | #define REG_WDT_CLEAR (0x4000200C) /**< \brief (WDT) Clear */
43 | #else
44 | #define REG_WDT_CTRLA (*(RwReg8 *)0x40002000UL) /**< \brief (WDT) Control */
45 | #define REG_WDT_CONFIG (*(RwReg8 *)0x40002001UL) /**< \brief (WDT) Configuration */
46 | #define REG_WDT_EWCTRL (*(RwReg8 *)0x40002002UL) /**< \brief (WDT) Early Warning Interrupt Control */
47 | #define REG_WDT_INTENCLR (*(RwReg8 *)0x40002004UL) /**< \brief (WDT) Interrupt Enable Clear */
48 | #define REG_WDT_INTENSET (*(RwReg8 *)0x40002005UL) /**< \brief (WDT) Interrupt Enable Set */
49 | #define REG_WDT_INTFLAG (*(RwReg8 *)0x40002006UL) /**< \brief (WDT) Interrupt Flag Status and Clear */
50 | #define REG_WDT_SYNCBUSY (*(RoReg *)0x40002008UL) /**< \brief (WDT) Synchronization Busy */
51 | #define REG_WDT_CLEAR (*(WoReg8 *)0x4000200CUL) /**< \brief (WDT) Clear */
52 | #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
53 |
54 |
55 | #endif /* _SAME53_WDT_INSTANCE_ */
56 |
--------------------------------------------------------------------------------
/variants/clearcore/Third Party/SAME53/CMSIS/Device/Include/sam.h:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * \brief Top level header file
5 | *
6 | * Copyright (c) 2019 Microchip Technology Inc.
7 | *
8 | * \license_start
9 | *
10 | * \page License
11 | *
12 | * SPDX-License-Identifier: Apache-2.0
13 | *
14 | * Licensed under the Apache License, Version 2.0 (the "License");
15 | * you may not use this file except in compliance with the License.
16 | * You may obtain a copy of the License at
17 | *
18 | * http://www.apache.org/licenses/LICENSE-2.0
19 | *
20 | * Unless required by applicable law or agreed to in writing, software
21 | * distributed under the License is distributed on an "AS IS" BASIS,
22 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23 | * See the License for the specific language governing permissions and
24 | * limitations under the License.
25 | *
26 | * \license_stop
27 | *
28 | */
29 |
30 | #ifndef _SAM_
31 | #define _SAM_
32 |
33 | #if defined(__SAME53J18A__) || defined(__ATSAME53J18A__)
34 | #include "same53j18a.h"
35 | #elif defined(__SAME53J19A__) || defined(__ATSAME53J19A__)
36 | #include "same53j19a.h"
37 | #elif defined(__SAME53J20A__) || defined(__ATSAME53J20A__)
38 | #include "same53j20a.h"
39 | #elif defined(__SAME53N19A__) || defined(__ATSAME53N19A__)
40 | #include "same53n19a.h"
41 | #elif defined(__SAME53N20A__) || defined(__ATSAME53N20A__)
42 | #include "same53n20a.h"
43 | #else
44 | #error Library does not support the specified device
45 | #endif
46 |
47 | #endif /* _SAM_ */
48 |
49 |
--------------------------------------------------------------------------------
/variants/clearcore/Third Party/SAME53/CMSIS/Device/Include/same53.h:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * \brief Top header file for SAME53
5 | *
6 | * Copyright (c) 2019 Microchip Technology Inc.
7 | *
8 | * \asf_license_start
9 | *
10 | * \page License
11 | *
12 | * SPDX-License-Identifier: Apache-2.0
13 | *
14 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
15 | * not use this file except in compliance with the License.
16 | * You may obtain a copy of the Licence at
17 | *
18 | * http://www.apache.org/licenses/LICENSE-2.0
19 | *
20 | * Unless required by applicable law or agreed to in writing, software
21 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT
22 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23 | * See the License for the specific language governing permissions and
24 | * limitations under the License.
25 | *
26 | * \asf_license_stop
27 | *
28 | */
29 |
30 | #ifndef _SAME53_
31 | #define _SAME53_
32 |
33 | /**
34 | * \defgroup SAME53_definitions SAME53 Device Definitions
35 | * \brief SAME53 CMSIS Definitions.
36 | */
37 |
38 | #if defined(__SAME53J18A__) || defined(__ATSAME53J18A__)
39 | #include "same53j18a.h"
40 | #elif defined(__SAME53J19A__) || defined(__ATSAME53J19A__)
41 | #include "same53j19a.h"
42 | #elif defined(__SAME53J20A__) || defined(__ATSAME53J20A__)
43 | #include "same53j20a.h"
44 | #elif defined(__SAME53N19A__) || defined(__ATSAME53N19A__)
45 | #include "same53n19a.h"
46 | #elif defined(__SAME53N20A__) || defined(__ATSAME53N20A__)
47 | #include "same53n20a.h"
48 | #else
49 | #error Library does not support the specified device.
50 | #endif
51 |
52 | #endif /* _SAME53_ */
53 |
--------------------------------------------------------------------------------
/variants/clearcore/Third Party/SAME53/CMSIS/Device/Include/system_same53.h:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * \brief Low-level initialization functions called upon chip startup
5 | *
6 | * Copyright (c) 2019 Microchip Technology Inc.
7 | *
8 | * \asf_license_start
9 | *
10 | * \page License
11 | *
12 | * SPDX-License-Identifier: Apache-2.0
13 | *
14 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
15 | * not use this file except in compliance with the License.
16 | * You may obtain a copy of the Licence at
17 | *
18 | * http://www.apache.org/licenses/LICENSE-2.0
19 | *
20 | * Unless required by applicable law or agreed to in writing, software
21 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT
22 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23 | * See the License for the specific language governing permissions and
24 | * limitations under the License.
25 | *
26 | * \asf_license_stop
27 | *
28 | */
29 |
30 | #ifndef _SYSTEM_SAME53_H_INCLUDED_
31 | #define _SYSTEM_SAME53_H_INCLUDED_
32 |
33 | #ifdef __cplusplus
34 | extern "C" {
35 | #endif
36 |
37 | #include
38 |
39 | extern const uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */
40 |
41 | void SystemInit(void);
42 | void SystemCoreClockUpdate(void);
43 |
44 | #ifdef __cplusplus
45 | }
46 | #endif
47 |
48 | #endif /* SYSTEM_SAME53_H_INCLUDED */
49 |
--------------------------------------------------------------------------------
/variants/clearcore/sync.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2019 Arduino LLC. All right reserved.
3 |
4 | This library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Lesser General Public
6 | License as published by the Free Software Foundation; either
7 | version 2.1 of the License, or (at your option) any later version.
8 |
9 | This library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | See the GNU Lesser General Public License for more details.
13 |
14 | You should have received a copy of the GNU Lesser General Public
15 | License along with this library; if not, write to the Free Software
16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 | */
18 |
19 | #include
20 |
21 | #ifndef _SYNC_H_
22 | #define _SYNC_H_
23 | /*
24 | * Synchronization primitives.
25 | */
26 |
27 | class __Guard {
28 | public:
29 | __Guard() : primask(__get_PRIMASK()), loops(1) {
30 | __disable_irq();
31 | }
32 | ~__Guard() {
33 | if (primask == 0) {
34 | __enable_irq();
35 | // http://infocenter.arm.com/help/topic/com.arm.doc.dai0321a/BIHBFEIB.html
36 | __ISB();
37 | }
38 | }
39 | uint32_t enter() { return loops--; }
40 | private:
41 | uint32_t primask;
42 | uint32_t loops;
43 | };
44 |
45 | #define synchronized for (__Guard __guard; __guard.enter(); )
46 |
47 | #endif
--------------------------------------------------------------------------------
/variants/clearcore/variant.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2020, Teknic, Inc.
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 __CLEARCORE_VARIANT_H__
20 | #define __CLEARCORE_VARIANT_H__
21 |
22 | // The definitions here needs a SAMD core >=1.6.10
23 | #define ARDUINO_SAMD_VARIANT_COMPLIANCE 10610
24 | // Core clock frequency
25 | #define VARIANT_MCK 120000000 // __SYSTEM_CLOCK
26 |
27 |
28 | #include "WVariant.h"
29 | #include "Common.h"
30 |
31 | #ifdef __cplusplus
32 | #include "SERCOM.h"
33 | #include "Uart.h"
34 | #endif
35 |
36 | enum _ADC_CHANNELS {
37 | SDRVR3_IMON = PIN_PC00,
38 | SDRVR2_IMON = PIN_PC01,
39 | VSUPP_MON = PIN_PC02,
40 | V5VOB_MON = PIN_PB04,
41 | AIN09 = PIN_PB07,
42 | AIN10 = PIN_PB06,
43 | AIN11 = PIN_PB05,
44 | AIN12 = PIN_PC03
45 | };
46 |
47 |
48 | #endif //__CLEARCORE_VARIANT_H__
49 |
50 |
--------------------------------------------------------------------------------
/zipClearCore.cmd:
--------------------------------------------------------------------------------
1 | set ver=1.7.0
2 | rem set version=shell git describe --dirty --always --tags
3 |
4 | rem Build libClearCore and LwIP
5 | "C:\Program Files (x86)\Atmel\Studio\7.0\AtmelStudio.exe" Teknic\libClearCore\ClearCore.atsln /build release
6 | "C:\Program Files (x86)\Atmel\Studio\7.0\AtmelStudio.exe" Teknic\LwIP\LwIP.atsln /build release
7 |
8 | .\keywordify.py -S -p .\
9 |
10 | set zipDir=ClearCore-%ver%
11 |
12 | rem Make the directory to zip
13 | md %zipDir%
14 |
15 | rem Copy everything into the zip directory
16 | robocopy .\ .\%zipDir% *.* /E
17 |
18 | cd %zipDir%
19 |
20 | rem Remove the copied (empty) zip directory
21 | rd /s /q .\%zipDir%
22 |
23 | rem Remove various files not intended for release
24 | rd /s /q .\Style
25 | rd /s /q .\Debug
26 | rd /s /q .\Release
27 | rd /s /q .\.vscode
28 | rd /s /q .\Teknic\libClearCore\inc-doc
29 | del .\zipClearCore.cmd
30 | del .\package_clearcore_index.json
31 |
32 | rem Delete all the git repos in the directory structure
33 | for /d /r . %%d in (.git) do @if exist "%%d" rd /s /q "%%d"
34 | for /d /r . %%d in (.gitlab) do @if exist "%%d" rd /s /q "%%d"
35 |
36 | rem Delete all git-related files in the directory structure
37 | del /s .\*.git*
38 |
39 | rem Delete all object and dependency files in the directory structure
40 | del /s .\*.o .\*.d
41 |
42 | cd ..
43 |
44 | rem Zip it
45 | "C:\Program Files\7-Zip\7z.exe" a -r "%zipDir%.zip" ".\%zipDir%"
46 |
47 | rem Hash it
48 | "C:\Program Files\7-Zip\7z.exe" h -scrcsha256 "%zipDir%.zip"
49 |
50 | rem Remove the temp directory
51 | rd /s /q .\%zipDir%
--------------------------------------------------------------------------------