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
5ec6dad3
Commit
5ec6dad3
authored
Jun 13, 2016
by
Martin Vítek
Browse files
Add extern irq from encoder button
parent
1dddb566
Changes
1
Hide whitespace changes
Inline
Side-by-side
SW/main.cpp
View file @
5ec6dad3
#include
<avr/io.h>
#include
<avr/interrupt.h>
#include
<util/delay.h>
#include
<stdint.h>
...
...
@@ -14,19 +15,41 @@ static void uart_string(const char *text);
static
void
wellcome
();
gpio
led
(
PORTD
,
PIN0_bm
);
ISR
(
PORTA_INT0_vect
)
{
led
.
toggle
();
}
ISR
(
BADISR_vect
)
{
reti
();
};
const
HD44780_config
lcd_config
=
{
PORTD
,
PIN2_bm
,
PIN3_bm
,
PIN4_bm
,
PIN5_bm
,
PIN6_bm
,
PIN7_bm
};
HD44780
lcd
(
lcd_config
);
int
main
()
{
gpio
led
(
PORTD
,
PIN0_bm
);
led
.
set_direction
(
OUTPUT
);
gpio
backlight
(
PORTD
,
PIN1_bm
);
backlight
.
set_direction
(
OUTPUT
);
backlight
.
on
();
gpio
button
(
PORTA
,
PIN2_bm
);
button
.
set_direction
(
INPUT
);
//button.set_mode(TOTEM_PULL_UP);
//button.set_invert(true);
PORTA
.
INTCTRL
=
PORT_INT0LVL_HI_gc
;
PORTA
.
INT0MASK
=
PIN2_bm
;
PORTA
.
PIN2CTRL
|=
PORT_ISC_RISING_gc
|
PORT_OPC_PULLUP_gc
|
PORT_INVEN_bm
;
PMIC
.
CTRL
=
PMIC_HILVLEN_bm
|
PMIC_RREN_bm
;
PORTC
.
DIRSET
=
PIN4_bm
|
PIN5_bm
|
PIN6_bm
|
PIN7_bm
;
PORTC
.
OUTCLR
=
PIN4_bm
|
PIN5_bm
|
PIN6_bm
|
PIN7_bm
;
...
...
@@ -34,15 +57,19 @@ int main()
uart_ini
();
lcd
.
init
();
sei
();
wellcome
();
for
(;;)
{
/*
led.toggle();
_delay_ms(500);
led.toggle();
_delay_ms(500);
*/
}
}
...
...
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