Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
ring
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pub
ring
Merge requests
!2
fix typo, mixed refs
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
fix typo, mixed refs
jake
into
master
Overview
1
Commits
1
Pipelines
0
Changes
3
Merged
Jake Read
requested to merge
jake
into
master
7 years ago
Overview
1
Commits
1
Pipelines
0
Changes
3
Expand
sorry to do this twice - just noticed the page was a bit mixed up
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
4b22131f
1 commit,
7 years ago
3 files
+
61
−
71
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
Search (e.g. *.vue) (Ctrl+P)
gpio/m0/m0_port/m0_port.ino
+
16
−
22
Options
/*
I found most of these definitions in the arduino cores in
AppData/Local/Arduino15/packages/adafruit/hardware/samd/1.0.19/cores/arduino/wiring_digital.c & wiring_digital.h
also samd/1.0.19/variants/variant.h and variant.cpp and pins_arduino.h
*/
#define PIN_LED_PORT 0
#define PIN_LED_PIN 17
#define PIN_10_PORT 0
#define PIN_10_PIN 18
#define PIN_11_PORT 0
#define PIN_11_PIN 16
uint32_t
ulPin
=
11
;
#define RING_PORT_OUTSET PORT->Group[PIN_10_PORT].OUTSET.reg
#define RING_PORT_OUTCLR PORT->Group[PIN_10_PORT].OUTCLR.reg
#define RING_PORT_OUT_MASK (1UL << PIN_10_PIN)
#define RING_PORT_IN PORT->Group[PIN_11_PORT].IN.reg
#define RING_PORT_IN_MASK (1UL << PIN_11_PIN)
void
setup
()
{
// set a pin to in / out ... starting
PORT
->
Group
[
g_APinDescription
[
ulPin
].
ulPort
].
PINCFG
[
g_APinDescription
[
ulPin
].
ulPin
].
reg
=
(
uint8_t
)(
PORT_PINCFG_INEN
)
;
PORT
->
Group
[
g_APinDescription
[
ulPin
].
ulPort
].
DIRSET
.
reg
=
(
uint32_t
)(
1
<<
g_APinDescription
[
ulPin
].
ulPin
)
;
// set 10 to output
PORT
->
Group
[
PIN_10_PORT
].
DIRSET
.
reg
=
(
uint32_t
)(
1
<<
PIN_10_PIN
);
//
pinMode(10, OUTPUT);
//pinMode(11, INPUT
);
//
set 11 to input
PORT
->
Group
[
PIN_11_PORT
].
PINCFG
[
PIN_11_PIN
].
reg
=
(
uint8_t
)(
PORT_PINCFG_INEN
);
// do loop
while
(
1
)
{
// no loop just c
RING_PORT_IN
&
RING_PORT_IN_MASK
?
RING_PORT_OUTCLR
=
RING_PORT_OUT_MASK
:
RING_PORT_OUTSET
=
RING_PORT_OUT_MASK
;
}
}
void
loop
()
{
EPortType
port
=
g_APinDescription
[
ulPin
].
ulPort
;
uint32_t
pin
=
g_APinDescription
[
ulPin
].
ulPin
;
uint32_t
pinMask
=
(
1ul
<<
pin
);
Serial
.
print
(
"11, port: "
);
Serial
.
print
(
port
);
Serial
.
print
(
" pin: "
);
Serial
.
print
(
pin
);
Serial
.
println
(
""
);
PORT
->
Group
[
port
].
OUTSET
.
reg
=
pinMask
;
delay
(
100
);
PORT
->
Group
[
port
].
OUTCLR
.
reg
=
pinMask
;
delay
(
100
);
}
Loading