Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Kroužek
safe-soldering-station
Commits
1dddb566
Commit
1dddb566
authored
Jun 13, 2016
by
Martin Vítek
Browse files
GPIO - PINxCTRL is not working
parent
2a84f0aa
Changes
1
Hide whitespace changes
Inline
Side-by-side
SW/gpio.h
View file @
1dddb566
...
...
@@ -21,6 +21,14 @@ enum directions
OUTPUT
};
enum
interrupt_levels
{
IRQ_LEVEL_OFF
=
0x00
,
IRQ_LEVEL_LOW
=
0x01
,
IRQ_LEVEL_MEDIUM
=
0x02
,
IRQ_LEVEL_HIGH
=
0x03
};
class
gpio
{
private:
...
...
@@ -41,16 +49,32 @@ class gpio
else
return
;
}
[[
deprecated
(
"Not working"
)]]
void
set_mode
(
modes
mode
)
{
*
(
&
port
.
PIN0CTRL
+
pin_bm
)
&=
(
0x38
);
*
(
&
port
.
PIN0CTRL
+
pin_bm
)
|=
mode
;
uint8_t
position
;
for
(
position
=
0
;
position
<
8
;
position
++
)
{
if
(
pin_bm
&
(
1
<<
position
))
break
;
}
*
(
&
(
port
.
PIN0CTRL
)
+
position
)
&=
(
0x38
);
*
(
&
(
port
.
PIN0CTRL
)
+
position
)
|=
mode
;
}
[[
deprecated
(
"Not working"
)]]
void
set_invert
(
bool
state
)
{
if
(
state
)
*
(
&
port
.
PIN0CTRL
+
pin_bm
)
|=
PORT_INVEN_bm
;
else
*
(
&
port
.
PIN0CTRL
+
pin_bm
)
&=
~
PORT_INVEN_bm
;
uint8_t
position
;
for
(
position
=
0
;
position
<
8
;
position
++
)
{
if
(
pin_bm
&
(
1
<<
position
))
break
;
}
if
(
state
)
*
(
&
port
.
PIN0CTRL
+
position
)
|=
PORT_INVEN_bm
;
else
*
(
&
port
.
PIN0CTRL
+
position
)
&=
~
PORT_INVEN_bm
;
}
void
on
()
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment