deleted obsolete shit

parent 906d80f8
......@@ -9,8 +9,6 @@
#ifndef SPI_H_
#define SPI_H_
/*SPI and OLED will use EXT1 default, uncomment to use EXT3:
This define is used by spi.c and display.c to select the correct pins */
......@@ -21,4 +19,4 @@ void SPI_MasterInit(void);
void SPI_MasterTransmit(char cData);
#endif /* SPI_H_ */
\ No newline at end of file
#endif /* SPI_H_ */
......@@ -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\atmel\ATmega_DFP\1.2.209\include</AbsolutePath>
<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\Atmel\ATmega_DFP\1.2.272\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\atmel\ATmega_DFP\1.2.209\include\avr\iom4809.h</AbsolutePath>
<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\Atmel\ATmega_DFP\1.2.272\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\atmel\ATmega_DFP\1.2.209\templates\main.c</AbsolutePath>
<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\Atmel\ATmega_DFP\1.2.272\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\atmel\ATmega_DFP\1.2.209\templates\main.cpp</AbsolutePath>
<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\Atmel\ATmega_DFP\1.2.272\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\atmel\ATmega_DFP\1.2.209\gcc\dev\atmega4809</AbsolutePath>
<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\Atmel\ATmega_DFP\1.2.272\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/atmel/ATmega_DFP/1.2.209/Atmel.ATmega_DFP.pdsc</PackPath>
<PackVersion>1.2.209</PackVersion>
<PackPath>C:/Program Files (x86)/Atmel/Studio/7.0/Packs/Atmel/ATmega_DFP/1.2.272/Atmel.ATmega_DFP.pdsc</PackPath>
<PackVersion>1.2.272</PackVersion>
<PresentInProject>true</PresentInProject>
<ReferenceConditionId>ATmega4809</ReferenceConditionId>
<RteComponents xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
......
......@@ -72,7 +72,7 @@
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<ToolchainSettings>
<AvrGcc>
<avrgcc.common.Device>-mmcu=atmega4809 -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.2.209\gcc\dev\atmega4809"</avrgcc.common.Device>
<avrgcc.common.Device>-mmcu=atmega4809 -B "%24(PackRepoDir)\Atmel\ATmega_DFP\1.2.272\gcc\dev\atmega4809"</avrgcc.common.Device>
<avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>
<avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>
<avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>
......@@ -87,7 +87,7 @@
</avrgcc.compiler.symbols.DefSymbols>
<avrgcc.compiler.directories.IncludePaths>
<ListValues>
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.2.209\include</Value>
<Value>%24(PackRepoDir)\Atmel\ATmega_DFP\1.2.272\include</Value>
</ListValues>
</avrgcc.compiler.directories.IncludePaths>
<avrgcc.compiler.optimization.level>Optimize for size (-Os)</avrgcc.compiler.optimization.level>
......@@ -101,7 +101,7 @@
</avrgcc.linker.libraries.Libraries>
<avrgcc.assembler.general.IncludePaths>
<ListValues>
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.2.209\include</Value>
<Value>%24(PackRepoDir)\Atmel\ATmega_DFP\1.2.272\include</Value>
</ListValues>
</avrgcc.assembler.general.IncludePaths>
</AvrGcc>
......@@ -110,7 +110,7 @@
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<ToolchainSettings>
<AvrGcc>
<avrgcc.common.Device>-mmcu=atmega4809 -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.2.209\gcc\dev\atmega4809"</avrgcc.common.Device>
<avrgcc.common.Device>-mmcu=atmega4809 -B "%24(PackRepoDir)\Atmel\ATmega_DFP\1.2.272\gcc\dev\atmega4809"</avrgcc.common.Device>
<avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>
<avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>
<avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>
......@@ -125,7 +125,7 @@
</avrgcc.compiler.symbols.DefSymbols>
<avrgcc.compiler.directories.IncludePaths>
<ListValues>
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.2.209\include</Value>
<Value>%24(PackRepoDir)\Atmel\ATmega_DFP\1.2.272\include</Value>
</ListValues>
</avrgcc.compiler.directories.IncludePaths>
<avrgcc.compiler.optimization.level>Optimize most (-O3)</avrgcc.compiler.optimization.level>
......@@ -140,7 +140,7 @@
</avrgcc.linker.libraries.Libraries>
<avrgcc.assembler.general.IncludePaths>
<ListValues>
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.2.209\include</Value>
<Value>%24(PackRepoDir)\Atmel\ATmega_DFP\1.2.272\include</Value>
</ListValues>
</avrgcc.assembler.general.IncludePaths>
<avrgcc.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcc.assembler.debugging.DebugLevel>
......
......@@ -30,7 +30,9 @@ int main(void)
{
uint16_t data;
SW0_PORT.DIRCLR = SW0_bm;
sei();
spi_init();
_delay_ms(2000);
oled_init();
adc_init();
......
......@@ -31,6 +31,7 @@ void oled_init() // Documentation on oled screen on: https://cdn-shop.adafruit.
oled_set_mode(1);
oled_reset();
oled_write_c(0xAE); // display off
// p32
......
......@@ -38,15 +38,17 @@ void spi_init()
SPI_PORT.DIRSET = (MOSI_bm) | (SCK_bm); //Set pins as output
CS_PORT.DIRSET = (CS_bm);
CS_PORT.OUTSET = (CS_bm); //Set CS high -> OLED inactive
// Now enable SPI, Master and set clock rate
SPI0.CTRLA |= (SPI_ENABLE_bm) | (SPI_MASTER_bm); //Default clock divisor of 4 is fine
SPI0.CTRLB |= (SPI_SSD_bm) | (SPI_BUFEN_bm);
SPI0.CTRLA |= (SPI_ENABLE_bm); //Default clock divisor of 4 is fine
SPI0.CTRLA |= (SPI_MASTER_bm);
//Make sure CS does not disable master mode
SPI0.CTRLB |= (SPI_SSD_bm);
SPI0.INTCTRL |= (1<<SPI_IF_ENABLE_bp);
SPI0.DATA=0x00;
//SPI0.INTCTRL |= (1<<SPI_IF_ENABLE_bp);
}
......@@ -55,14 +57,16 @@ void spi_transmit(char cData)
// First select the correct slave by setting the slave select (SS) bit LOW
CS_PORT.OUTCLR = (CS_bm);
SPI0.INTFLAGS = SPI_TXCIF_bm;
// Then start the transmission by assigning the data to the SPI data register
SPI0.DATA = cData;
// Now wait for the data transmission to complete by periodically checking the SPI status register
//the SPI_IF is the only interupt flag with a function in non-buffered mode.
while(!(SPI0.INTFLAGS & (SPI_IF_bm)));
SPI0.DATA; //Dummy read to clear flag
while(!(SPI0.INTFLAGS & (SPI_TXCIF_bm)));
//SPI0.DATA; //Dummy read to clear flag
// Finally set the slave select bit HIGH before leaving the function
CS_PORT.OUTSET = (CS_bm);
}
......@@ -9,9 +9,6 @@
#ifndef SPI_H_
#define SPI_H_
/*SPI and OLED will use EXT1 default, uncomment to use EXT3:
This define is used by spi.c and display.c to select the correct pins */
// Function for initializing SPI
......@@ -21,4 +18,4 @@ void spi_init(void);
void spi_transmit(char cData);
#endif /* SPI_H_ */
\ No newline at end of file
#endif /* SPI_H_ */
......@@ -9,10 +9,6 @@
#ifndef SPI_H_
#define SPI_H_
/*SPI and OLED will use EXT1 default, uncomment to use EXT3:
This define is used by spi.c and display.c to select the correct pins */
// Function for initializing SPI
void spi_init(void);
......@@ -21,4 +17,4 @@ void spi_init(void);
void spi_transmit(char cData);
#endif /* SPI_H_ */
\ No newline at end of file
#endif /* SPI_H_ */
......@@ -17,4 +17,4 @@ void spi_init(void);
void spi_transmit(char cData);
#endif /* SPI_H_ */
\ No newline at end of file
#endif /* SPI_H_ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment