Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
avrkurs
avrkurs
Commits
2b902f90
Commit
2b902f90
authored
Mar 11, 2019
by
Johan Vaarlid - M19939
Browse files
copy is just cus pls. Fungerende 'lf' med adc ut på screen
parent
e9aefd6b
Changes
4
Show whitespace changes
Inline
Side-by-side
Session3-LF/Task2_LF - Copy/Task2_LF/driv_OLED.c
View file @
2b902f90
...
...
@@ -69,7 +69,9 @@ void oled_reset(){
void
oled_clear_line
(
uint8_t
line
){
oled_write_c
(
0xb0
+
line
);
// selects row/page
for
(
int
byte
=
0
;
byte
<
128
;
byte
++
){
oled_d
[
byte
]
=
0x00
;
// Clear current column
// Clear current column
DISP_set_mode
(
1
);
SPI_MasterTransmit
(
0x00
);
}
}
...
...
Session3-LF/Task2_LF - Copy/Task2_LF/main.c
View file @
2b902f90
...
...
@@ -52,20 +52,23 @@ const uint8_t OV[512] PROGMEM =
};
#define KLAKK 0x00
#define LED0 5
#define LED0_bm 0x20
#define LED0_PORT PORTF
#define FONTSIZE 5
#define ADC_PRINT_START 82
#define SW0_bm 0x40
#define SW0_PORT PORTF
int
main
(
void
)
{
sei
();
_delay_ms
(
500
);
DISP_init
();
//
DISP_init();
adc_init
();
//DISP_write_bitmap(OV); //Printing Bitmap
//DISP_print("Hello World!"); //Printing text
PORT
F
.
DIRSET
=
(
1
<<
LED0
)
;
LED0_
PORT
.
DIRSET
=
LED0
_bm
;
SW0_PORT
.
DIRCLR
=
SW0_bm
;
oled_pos
(
1
,
12
);
oled_write_d
(
0xf8
);
oled_pos
(
2
,
12
);
...
...
@@ -85,6 +88,7 @@ int main(void)
fprintf
(
FONT5
,
"OV-POT read: "
);
uint8_t
software_timer_print_adc
=
0
;
uint8_t
blinkled
=
0
;
uint16_t
data
;
...
...
@@ -92,18 +96,7 @@ int main(void)
while
(
1
)
{
/*
for (uint8_t i=0;i<255;i++)
{
oled_set_brightness(i);
_delay_ms(10);
}
for (uint8_t i=255;i>0;i--)
{
oled_set_brightness(i);
_delay_ms(10);
}
*/
software_timer_print_adc
++
;
blinkled
++
;
uint8_t
adc_curser_position
=
82
;
...
...
@@ -172,7 +165,7 @@ int main(void)
}
if
(
blinkled
==
15
)
{
PORTF
.
OUTTGL
=
(
1
<<
LED0
)
;
PORTF
.
OUTTGL
=
LED0
_bm
;
blinkled
=
0
;
}
...
...
@@ -183,6 +176,31 @@ int main(void)
uint8_t
voltage_fraction
=
(
data
*
323ul
%
100000ul
)
/
1000
;
fprintf
(
FONT5
,
"Voltage: %u.%02u V"
,
voltage_integer
,
voltage_fraction
);
if
(
!
(
SW0_PORT
.
IN
&
(
SW0_bm
)))
{
oled_pos
(
0
,
0
);
DISP_write_bitmap
(
OV
);
while
(
!
(
SW0_PORT
.
IN
&
(
SW0_bm
)))
{
}
DISP_clear
();
oled_pos
(
1
,
12
);
oled_write_d
(
0xf8
);
oled_pos
(
2
,
12
);
oled_write_d
(
0x1f
);
oled_pos
(
1
,
115
);
oled_write_d
(
0xf8
);
oled_pos
(
2
,
115
);
oled_write_d
(
0x1f
);
for
(
uint8_t
i
=
0
;
i
<
101
;
i
++
)
{
oled_pos
(
1
,
13
+
i
);
oled_write_d
(
0x08
);
oled_pos
(
2
,
13
+
i
);
oled_write_d
(
0x10
);
}
oled_pos
(
0
,
12
);
fprintf
(
FONT5
,
"OV-POT read: "
);
}
}
}
Session3-LF/Task2_LF - Copy/Task2_LF/spi.c
View file @
2b902f90
...
...
@@ -27,7 +27,7 @@
#define CS_bm (1 << 6) //on port C
#define CS_PORT PORTC //
#define SPI_I
NTERRUPT
_ENABLE_bp 0
#define SPI_I
F
_ENABLE_bp 0
void
SPI_MasterInit
()
{
...
...
@@ -46,7 +46,7 @@ void SPI_MasterInit()
//Make sure CS does not disable master mode
SPI0
.
CTRLB
|=
(
SPI_SSD_bm
);
SPI0
.
INTCTRL
|=
(
1
<<
SPI_I
NTERRUPT
_ENABLE_bp
);
SPI0
.
INTCTRL
|=
(
1
<<
SPI_I
F
_ENABLE_bp
);
}
...
...
Session3-LF/Task2_LF/Task2_LF/Task2_LF.componentinfo.xml
View file @
2b902f90
...
...
@@ -15,7 +15,7 @@
<Description></Description>
<Files
xmlns:d4p1=
"http://schemas.microsoft.com/2003/10/Serialization/Arrays"
>
<d4p1:anyType
i:type=
"FileInfo"
>
<AbsolutePath>
C:/Program Files (x86)\Atmel\Studio\7.0\Packs\
a
tmel\ATmega_DFP\1.2.2
09
\include
</AbsolutePath>
<AbsolutePath>
C:/Program Files (x86)\Atmel\Studio\7.0\Packs\
A
tmel\ATmega_DFP\1.2.2
72
\include
</AbsolutePath>
<Attribute></Attribute>
<Category>
include
</Category>
<Condition>
C
</Condition>
...
...
@@ -26,18 +26,18 @@
<SourcePath></SourcePath>
</d4p1:anyType>
<d4p1:anyType
i:type=
"FileInfo"
>
<AbsolutePath>
C:/Program Files (x86)\Atmel\Studio\7.0\Packs\
a
tmel\ATmega_DFP\1.2.2
09
\include\avr\iom4809.h
</AbsolutePath>
<AbsolutePath>
C:/Program Files (x86)\Atmel\Studio\7.0\Packs\
A
tmel\ATmega_DFP\1.2.2
72
\include\avr\iom4809.h
</AbsolutePath>
<Attribute></Attribute>
<Category>
header
</Category>
<Condition>
C
</Condition>
<FileContentHash>
mWiFIOAGwUPlW0rYsXcjkg
==
</FileContentHash>
<FileContentHash>
fQaG1DJ4X5qUUwRvErAbNQ
==
</FileContentHash>
<FileVersion></FileVersion>
<Name>
include/avr/iom4809.h
</Name>
<SelectString></SelectString>
<SourcePath></SourcePath>
</d4p1:anyType>
<d4p1:anyType
i:type=
"FileInfo"
>
<AbsolutePath>
C:/Program Files (x86)\Atmel\Studio\7.0\Packs\
a
tmel\ATmega_DFP\1.2.2
09
\templates\main.c
</AbsolutePath>
<AbsolutePath>
C:/Program Files (x86)\Atmel\Studio\7.0\Packs\
A
tmel\ATmega_DFP\1.2.2
72
\templates\main.c
</AbsolutePath>
<Attribute>
template
</Attribute>
<Category>
source
</Category>
<Condition>
C Exe
</Condition>
...
...
@@ -48,7 +48,7 @@
<SourcePath></SourcePath>
</d4p1:anyType>
<d4p1:anyType
i:type=
"FileInfo"
>
<AbsolutePath>
C:/Program Files (x86)\Atmel\Studio\7.0\Packs\
a
tmel\ATmega_DFP\1.2.2
09
\templates\main.cpp
</AbsolutePath>
<AbsolutePath>
C:/Program Files (x86)\Atmel\Studio\7.0\Packs\
A
tmel\ATmega_DFP\1.2.2
72
\templates\main.cpp
</AbsolutePath>
<Attribute>
template
</Attribute>
<Category>
source
</Category>
<Condition>
C Exe
</Condition>
...
...
@@ -59,7 +59,7 @@
<SourcePath></SourcePath>
</d4p1:anyType>
<d4p1:anyType
i:type=
"FileInfo"
>
<AbsolutePath>
C:/Program Files (x86)\Atmel\Studio\7.0\Packs\
a
tmel\ATmega_DFP\1.2.2
09
\gcc\dev\atmega4809
</AbsolutePath>
<AbsolutePath>
C:/Program Files (x86)\Atmel\Studio\7.0\Packs\
A
tmel\ATmega_DFP\1.2.2
72
\gcc\dev\atmega4809
</AbsolutePath>
<Attribute></Attribute>
<Category>
libraryPrefix
</Category>
<Condition>
GCC
</Condition>
...
...
@@ -71,8 +71,8 @@
</d4p1:anyType>
</Files>
<PackName>
ATmega_DFP
</PackName>
<PackPath>
C:/Program Files (x86)/Atmel/Studio/7.0/Packs/
a
tmel/ATmega_DFP/1.2.2
09
/Atmel.ATmega_DFP.pdsc
</PackPath>
<PackVersion>
1.2.2
09
</PackVersion>
<PackPath>
C:/Program Files (x86)/Atmel/Studio/7.0/Packs/
A
tmel/ATmega_DFP/1.2.2
72
/Atmel.ATmega_DFP.pdsc
</PackPath>
<PackVersion>
1.2.2
72
</PackVersion>
<PresentInProject>
true
</PresentInProject>
<ReferenceConditionId>
ATmega4809
</ReferenceConditionId>
<RteComponents
xmlns:d4p1=
"http://schemas.microsoft.com/2003/10/Serialization/Arrays"
>
...
...
Write
Preview
Markdown
is supported
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