Commit 55bcbee3 authored by Petter Breedveld's avatar Petter Breedveld
Browse files

OLED fix

OLD now working again. EXT header can be selected through a define in spi.h
parent f0484545
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Store xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="AtmelPackComponentManagement"> <Store xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="AtmelPackComponentManagement">
<ProjectComponents> <ProjectComponents>
<ProjectComponent z:Id="i1" xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/"> <ProjectComponent z:Id="i1" xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/">
<CApiVersion></CApiVersion> <CApiVersion></CApiVersion>
<CBundle></CBundle> <CBundle></CBundle>
<CClass>Device</CClass> <CClass>Device</CClass>
<CGroup>Startup</CGroup> <CGroup>Startup</CGroup>
<CSub></CSub> <CSub></CSub>
<CVariant></CVariant> <CVariant></CVariant>
<CVendor>Atmel</CVendor> <CVendor>Atmel</CVendor>
<CVersion>1.1.0</CVersion> <CVersion>1.1.0</CVersion>
<DefaultRepoPath>D:/Atmel\7.0\Packs</DefaultRepoPath> <DefaultRepoPath>D:/Atmel\7.0\Packs</DefaultRepoPath>
<DependentComponents xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" /> <DependentComponents xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" />
<Description></Description> <Description></Description>
<Files xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <Files xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d4p1:anyType i:type="FileInfo"> <d4p1:anyType i:type="FileInfo">
<AbsolutePath>D:/Atmel\7.0\Packs\atmel\ATtiny_DFP\1.1.102\include</AbsolutePath> <AbsolutePath>D:/Atmel\7.0\Packs\atmel\ATtiny_DFP\1.1.102\include</AbsolutePath>
<Attribute></Attribute> <Attribute></Attribute>
<Category>include</Category> <Category>include</Category>
<Condition>C</Condition> <Condition>C</Condition>
<FileContentHash i:nil="true" /> <FileContentHash i:nil="true" />
<FileVersion></FileVersion> <FileVersion></FileVersion>
<Name>include</Name> <Name>include</Name>
<SelectString></SelectString> <SelectString></SelectString>
<SourcePath></SourcePath> <SourcePath></SourcePath>
</d4p1:anyType> </d4p1:anyType>
<d4p1:anyType i:type="FileInfo"> <d4p1:anyType i:type="FileInfo">
<AbsolutePath>D:/Atmel\7.0\Packs\atmel\ATtiny_DFP\1.1.102\include\avr\iotn817.h</AbsolutePath> <AbsolutePath>D:/Atmel\7.0\Packs\atmel\ATtiny_DFP\1.1.102\include\avr\iotn817.h</AbsolutePath>
<Attribute></Attribute> <Attribute></Attribute>
<Category>header</Category> <Category>header</Category>
<Condition>C</Condition> <Condition>C</Condition>
<FileContentHash>GzsE/dwQAz37AkZENa/sHg==</FileContentHash> <FileContentHash>GzsE/dwQAz37AkZENa/sHg==</FileContentHash>
<FileVersion></FileVersion> <FileVersion></FileVersion>
<Name>include/avr/iotn817.h</Name> <Name>include/avr/iotn817.h</Name>
<SelectString></SelectString> <SelectString></SelectString>
<SourcePath></SourcePath> <SourcePath></SourcePath>
</d4p1:anyType> </d4p1:anyType>
<d4p1:anyType i:type="FileInfo"> <d4p1:anyType i:type="FileInfo">
<AbsolutePath>D:/Atmel\7.0\Packs\atmel\ATtiny_DFP\1.1.102\templates\main.c</AbsolutePath> <AbsolutePath>D:/Atmel\7.0\Packs\atmel\ATtiny_DFP\1.1.102\templates\main.c</AbsolutePath>
<Attribute>template</Attribute> <Attribute>template</Attribute>
<Category>source</Category> <Category>source</Category>
<Condition>C Exe</Condition> <Condition>C Exe</Condition>
<FileContentHash>RtJJIrracgoBJUhAmsGN5g==</FileContentHash> <FileContentHash>RtJJIrracgoBJUhAmsGN5g==</FileContentHash>
<FileVersion></FileVersion> <FileVersion></FileVersion>
<Name>templates/main.c</Name> <Name>templates/main.c</Name>
<SelectString>Main file (.c)</SelectString> <SelectString>Main file (.c)</SelectString>
<SourcePath></SourcePath> <SourcePath></SourcePath>
</d4p1:anyType> </d4p1:anyType>
<d4p1:anyType i:type="FileInfo"> <d4p1:anyType i:type="FileInfo">
<AbsolutePath>D:/Atmel\7.0\Packs\atmel\ATtiny_DFP\1.1.102\templates\main.cpp</AbsolutePath> <AbsolutePath>D:/Atmel\7.0\Packs\atmel\ATtiny_DFP\1.1.102\templates\main.cpp</AbsolutePath>
<Attribute>template</Attribute> <Attribute>template</Attribute>
<Category>source</Category> <Category>source</Category>
<Condition>C Exe</Condition> <Condition>C Exe</Condition>
<FileContentHash>YXFphlh0CtZJU+ebktABgQ==</FileContentHash> <FileContentHash>YXFphlh0CtZJU+ebktABgQ==</FileContentHash>
<FileVersion></FileVersion> <FileVersion></FileVersion>
<Name>templates/main.cpp</Name> <Name>templates/main.cpp</Name>
<SelectString>Main file (.cpp)</SelectString> <SelectString>Main file (.cpp)</SelectString>
<SourcePath></SourcePath> <SourcePath></SourcePath>
</d4p1:anyType> </d4p1:anyType>
<d4p1:anyType i:type="FileInfo"> <d4p1:anyType i:type="FileInfo">
<AbsolutePath>D:/Atmel\7.0\Packs\atmel\ATtiny_DFP\1.1.102\gcc\dev\attiny817</AbsolutePath> <AbsolutePath>D:/Atmel\7.0\Packs\atmel\ATtiny_DFP\1.1.102\gcc\dev\attiny817</AbsolutePath>
<Attribute></Attribute> <Attribute></Attribute>
<Category>libraryPrefix</Category> <Category>libraryPrefix</Category>
<Condition>GCC</Condition> <Condition>GCC</Condition>
<FileContentHash i:nil="true" /> <FileContentHash i:nil="true" />
<FileVersion></FileVersion> <FileVersion></FileVersion>
<Name>gcc/dev/attiny817</Name> <Name>gcc/dev/attiny817</Name>
<SelectString></SelectString> <SelectString></SelectString>
<SourcePath></SourcePath> <SourcePath></SourcePath>
</d4p1:anyType> </d4p1:anyType>
</Files> </Files>
<PackName>ATtiny_DFP</PackName> <PackName>ATtiny_DFP</PackName>
<PackPath>D:/Atmel/7.0/Packs/atmel/ATtiny_DFP/1.1.102/Atmel.ATtiny_DFP.pdsc</PackPath> <PackPath>D:/Atmel/7.0/Packs/atmel/ATtiny_DFP/1.1.102/Atmel.ATtiny_DFP.pdsc</PackPath>
<PackVersion>1.1.102</PackVersion> <PackVersion>1.1.102</PackVersion>
<PresentInProject>true</PresentInProject> <PresentInProject>true</PresentInProject>
<ReferenceConditionId>ATtiny817</ReferenceConditionId> <ReferenceConditionId>ATtiny817</ReferenceConditionId>
<RteComponents xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <RteComponents xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d4p1:string></d4p1:string> <d4p1:string></d4p1:string>
</RteComponents> </RteComponents>
<Status>Resolved</Status> <Status>Resolved</Status>
<VersionMode>Fixed</VersionMode> <VersionMode>Fixed</VersionMode>
<IsComponentInAtProject>true</IsComponentInAtProject> <IsComponentInAtProject>true</IsComponentInAtProject>
</ProjectComponent> </ProjectComponent>
</ProjectComponents> </ProjectComponents>
</Store> </Store>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0"> <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0">
<PropertyGroup> <PropertyGroup>
<SchemaVersion>2.0</SchemaVersion> <SchemaVersion>2.0</SchemaVersion>
<ProjectVersion>7.0</ProjectVersion> <ProjectVersion>7.0</ProjectVersion>
<ToolchainName>com.Atmel.AVRGCC8.C</ToolchainName> <ToolchainName>com.Atmel.AVRGCC8.C</ToolchainName>
<ProjectGuid>dce6c7e3-ee26-4d79-826b-08594b9ad897</ProjectGuid> <ProjectGuid>dce6c7e3-ee26-4d79-826b-08594b9ad897</ProjectGuid>
<avrdevice>ATtiny817</avrdevice> <avrdevice>ATtiny817</avrdevice>
<avrdeviceseries>none</avrdeviceseries> <avrdeviceseries>none</avrdeviceseries>
<OutputType>Executable</OutputType> <OutputType>Executable</OutputType>
<Language>C</Language> <Language>C</Language>
<OutputFileName>$(MSBuildProjectName)</OutputFileName> <OutputFileName>$(MSBuildProjectName)</OutputFileName>
<OutputFileExtension>.elf</OutputFileExtension> <OutputFileExtension>.elf</OutputFileExtension>
<OutputDirectory>$(MSBuildProjectDirectory)\$(Configuration)</OutputDirectory> <OutputDirectory>$(MSBuildProjectDirectory)\$(Configuration)</OutputDirectory>
<AssemblyName>Task2_LF</AssemblyName> <AssemblyName>Task2_LF</AssemblyName>
<Name>Task2_LF</Name> <Name>Task2_LF</Name>
<RootNamespace>Task2_LF</RootNamespace> <RootNamespace>Task2_LF</RootNamespace>
<ToolchainFlavour>Native</ToolchainFlavour> <ToolchainFlavour>Native</ToolchainFlavour>
<KeepTimersRunning>true</KeepTimersRunning> <KeepTimersRunning>true</KeepTimersRunning>
<OverrideVtor>false</OverrideVtor> <OverrideVtor>false</OverrideVtor>
<CacheFlash>true</CacheFlash> <CacheFlash>true</CacheFlash>
<ProgFlashFromRam>true</ProgFlashFromRam> <ProgFlashFromRam>true</ProgFlashFromRam>
<RamSnippetAddress /> <RamSnippetAddress />
<UncachedRange /> <UncachedRange />
<preserveEEPROM>true</preserveEEPROM> <preserveEEPROM>true</preserveEEPROM>
<OverrideVtorValue /> <OverrideVtorValue />
<BootSegment>2</BootSegment> <BootSegment>2</BootSegment>
<eraseonlaunchrule>0</eraseonlaunchrule> <eraseonlaunchrule>0</eraseonlaunchrule>
<AsfFrameworkConfig> <AsfFrameworkConfig>
<framework-data xmlns=""> <framework-data xmlns="">
<options /> <options />
<configurations /> <configurations />
<files /> <files />
<documentation help="" /> <documentation help="" />
<offline-documentation help="" /> <offline-documentation help="" />
<dependencies> <dependencies>
<content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.32.0" /> <content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.32.0" />
</dependencies> </dependencies>
</framework-data> </framework-data>
</AsfFrameworkConfig> </AsfFrameworkConfig>
</PropertyGroup> <ResetRule>0</ResetRule>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> <EraseKey />
<ToolchainSettings> </PropertyGroup>
<AvrGcc> <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<avrgcc.common.Device>-mmcu=attiny817 -B "%24(PackRepoDir)\atmel\ATtiny_DFP\1.1.102\gcc\dev\attiny817"</avrgcc.common.Device> <ToolchainSettings>
<avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex> <AvrGcc>
<avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss> <avrgcc.common.Device>-mmcu=attiny817 -B "%24(PackRepoDir)\atmel\ATtiny_DFP\1.1.102\gcc\dev\attiny817"</avrgcc.common.Device>
<avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep> <avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>
<avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec> <avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>
<avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures> <avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>
<avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned> <avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned> <avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
<avrgcc.compiler.symbols.DefSymbols> <avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
<ListValues> <avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
<Value>NDEBUG</Value> <avrgcc.compiler.symbols.DefSymbols>
</ListValues> <ListValues>
</avrgcc.compiler.symbols.DefSymbols> <Value>NDEBUG</Value>
<avrgcc.compiler.directories.IncludePaths> </ListValues>
<ListValues> </avrgcc.compiler.symbols.DefSymbols>
<Value>%24(PackRepoDir)\atmel\ATtiny_DFP\1.1.102\include</Value> <avrgcc.compiler.directories.IncludePaths>
</ListValues> <ListValues>
</avrgcc.compiler.directories.IncludePaths> <Value>%24(PackRepoDir)\atmel\ATtiny_DFP\1.1.102\include</Value>
<avrgcc.compiler.optimization.level>Optimize for size (-Os)</avrgcc.compiler.optimization.level> </ListValues>
<avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers> </avrgcc.compiler.directories.IncludePaths>
<avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum> <avrgcc.compiler.optimization.level>Optimize for size (-Os)</avrgcc.compiler.optimization.level>
<avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings> <avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
<avrgcc.linker.libraries.Libraries> <avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
<ListValues> <avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
<Value>libm</Value> <avrgcc.linker.libraries.Libraries>
</ListValues> <ListValues>
</avrgcc.linker.libraries.Libraries> <Value>libm</Value>
<avrgcc.assembler.general.IncludePaths> </ListValues>
<ListValues> </avrgcc.linker.libraries.Libraries>
<Value>%24(PackRepoDir)\atmel\ATtiny_DFP\1.1.102\include</Value> <avrgcc.assembler.general.IncludePaths>
</ListValues> <ListValues>
</avrgcc.assembler.general.IncludePaths> <Value>%24(PackRepoDir)\atmel\ATtiny_DFP\1.1.102\include</Value>
</AvrGcc> </ListValues>
</ToolchainSettings> </avrgcc.assembler.general.IncludePaths>
</PropertyGroup> </AvrGcc>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> </ToolchainSettings>
<ToolchainSettings> </PropertyGroup>
<AvrGcc> <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<avrgcc.common.Device>-mmcu=attiny817 -B "%24(PackRepoDir)\atmel\ATtiny_DFP\1.1.102\gcc\dev\attiny817"</avrgcc.common.Device> <ToolchainSettings>
<avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex> <AvrGcc>
<avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss> <avrgcc.common.Device>-mmcu=attiny817 -B "%24(PackRepoDir)\atmel\ATtiny_DFP\1.1.102\gcc\dev\attiny817"</avrgcc.common.Device>
<avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep> <avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>
<avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec> <avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>
<avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures> <avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>
<avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned> <avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned> <avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
<avrgcc.compiler.symbols.DefSymbols> <avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
<ListValues> <avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
<Value>DEBUG</Value> <avrgcc.compiler.symbols.DefSymbols>
</ListValues> <ListValues>
</avrgcc.compiler.symbols.DefSymbols> <Value>DEBUG</Value>
<avrgcc.compiler.directories.IncludePaths> </ListValues>
<ListValues> </avrgcc.compiler.symbols.DefSymbols>
<Value>%24(PackRepoDir)\atmel\ATtiny_DFP\1.1.102\include</Value> <avrgcc.compiler.directories.IncludePaths>
</ListValues> <ListValues>
</avrgcc.compiler.directories.IncludePaths> <Value>%24(PackRepoDir)\atmel\ATtiny_DFP\1.1.102\include</Value>
<avrgcc.compiler.optimization.level>Optimize (-O1)</avrgcc.compiler.optimization.level> </ListValues>
<avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers> </avrgcc.compiler.directories.IncludePaths>
<avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum> <avrgcc.compiler.optimization.level>Optimize (-O1)</avrgcc.compiler.optimization.level>
<avrgcc.compiler.optimization.DebugLevel>Default (-g2)</avrgcc.compiler.optimization.DebugLevel> <avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
<avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings> <avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
<avrgcc.linker.libraries.Libraries> <avrgcc.compiler.optimization.DebugLevel>Default (-g2)</avrgcc.compiler.optimization.DebugLevel>
<ListValues> <avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
<Value>libm</Value> <avrgcc.linker.libraries.Libraries>
</ListValues> <ListValues>
</avrgcc.linker.libraries.Libraries> <Value>libm</Value>
<avrgcc.assembler.general.IncludePaths> </ListValues>
<ListValues> </avrgcc.linker.libraries.Libraries>
<Value>%24(PackRepoDir)\atmel\ATtiny_DFP\1.1.102\include</Value> <avrgcc.assembler.general.IncludePaths>
</ListValues> <ListValues>
</avrgcc.assembler.general.IncludePaths> <Value>%24(PackRepoDir)\atmel\ATtiny_DFP\1.1.102\include</Value>
<avrgcc.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcc.assembler.debugging.DebugLevel> </ListValues>
</AvrGcc> </avrgcc.assembler.general.IncludePaths>
</ToolchainSettings> <avrgcc.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcc.assembler.debugging.DebugLevel>
</PropertyGroup> </AvrGcc>
<ItemGroup> </ToolchainSettings>
<Compile Include="display.c"> </PropertyGroup>
<SubType>compile</SubType> <ItemGroup>
</Compile> <Compile Include="display.c">
<Compile Include="display.h"> <SubType>compile</SubType>
<SubType>compile</SubType> </Compile>
</Compile> <Compile Include="display.h">
<Compile Include="font8x8.h"> <SubType>compile</SubType>
<SubType>compile</SubType> </Compile>
</Compile> <Compile Include="font8x8.h">
<Compile Include="main.c"> <SubType>compile</SubType>
<SubType>compile</SubType> </Compile>
</Compile> <Compile Include="main.c">
<Compile Include="spi.c"> <SubType>compile</SubType>
<SubType>compile</SubType> </Compile>
</Compile> <Compile Include="spi.c">
<Compile Include="spi.h"> <SubType>compile</SubType>
<SubType>compile</SubType> </Compile>
</Compile> <Compile Include="spi.h">
</ItemGroup> <SubType>compile</SubType>
<Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" /> </Compile>
</ItemGroup>
<Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" />
</Project> </Project>
\ No newline at end of file
...@@ -4,14 +4,6 @@ ...@@ -4,14 +4,6 @@
#define F_CPU 3333333UL #define F_CPU 3333333UL
#define DSP_MODE_bm 1<<5
#define DSP_MODE_PORT PORTC
#define DSP_RST_bm 1<<5
#define DSP_RST_PORT PORTB
// System headers // System headers
#include <avr/io.h> #include <avr/io.h>
#include <util/delay.h> #include <util/delay.h>
...@@ -23,6 +15,27 @@ ...@@ -23,6 +15,27 @@
#include "font8x8.h" #include "font8x8.h"
//From spi.h:
#ifndef EXT3 // for using EXT1 header:
#define DSP_MODE_bm (1 << 7)
#define DSP_MODE_PORT PORTB
#define DSP_RST_bm (1 << 4)
#define DSP_RST_PORT PORTA
#else //For using EXT3 header:
#define DSP_MODE_bm (1 << 5)
#define DSP_MODE_PORT PORTC
#define DSP_RST_bm (1 << 5)
#define DSP_RST_PORT PORTB
#endif /* EXT3 */
// This file contains a simple driver for the display so that one can print characters and strings. // This file contains a simple driver for the display so that one can print characters and strings.
// You shouldn't need to do anything in this file for things to work. // You shouldn't need to do anything in this file for things to work.
// Of course, you're welcome to check it out if you want to see how things work under the hood. // Of course, you're welcome to check it out if you want to see how things work under the hood.
......
...@@ -11,20 +11,6 @@ ...@@ -11,20 +11,6 @@
#include "display.h" #include "display.h"
/*
In this exercise you will write a driver for the SPI module. You will connect the OLED screen to the EXT3 header
and use your SPI driver to write bitmaps and text to the screen.
A finished driver for the screen is provided (display.c), as as a font for it. These build uppon the SPI driver.
You can read display.h to see what functions you can use with the screen.
No help beyond the function headers is provided. To start, it's recommend you:
a) glance over the chapter on SPI in the ATtiny817 datasheet
b) find out what pins of the ATtiny the screen is connected to
*/
const uint8_t bitmap[512] PROGMEM = const uint8_t bitmap[512] PROGMEM =
{ {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
...@@ -64,14 +50,16 @@ const uint8_t bitmap[512] PROGMEM = ...@@ -64,14 +50,16 @@ const uint8_t bitmap[512] PROGMEM =
int main(void) int main(void)
{ {
// The EXT header can be selected though a define in spi.h
DISP_init(); DISP_init();
DISP_write_bitmap(bitmap); //Printing Bitmap DISP_write_bitmap(bitmap); //Printing Bitmap
//DISP_print("Hello World!"); //Printing text //DISP_print("Hello World!"); //Printing text
while (1) while (1)
{ {
} }
} }
...@@ -9,17 +9,30 @@ ...@@ -9,17 +9,30 @@
// Project headers // Project headers
#include "spi.h" #include "spi.h"
// In this file, you will need to write the contents of the SPI communication routines.
// You need to setup SPI communication in SPI_MasterInit() and
// transmit data in SPI_MasterTransmit(...).
//
// HINT: Check out the defines in the file defines.h to see defines
// such as data direction registers and bit positions, and as always:
// RTFD
//Oled is connected to alternate SPI pins #define MOSI_bm (1 << 2) //on port C
#define MOSI_bm 1<<2 //on port C #define SCK_bm (1 << 0) //on port C
#define SCK_bm 1<<0 //on port C #define SPI_PORT PORTC //
#define SS_bm 1<<3 //on port A
#define SPI_PORT PORTC //We can now use SPI_PORT.DIR, .OUT etc.
#define SS_PORT PORTA //SS is on a different port
//We could also have defined bit positions for MOSI, SCL and SS. #ifndef EXT3 // for using EXT1 header:
#define SS_bm (1 << 3)
#define SS_PORT PORTC
#else // for using EXT3 header:
#define SS_bm (1 << 3)
#define SS_PORT PORTA
#endif /* EXT3 */
void SPI_MasterInit() void SPI_MasterInit()
...@@ -27,42 +40,38 @@ void SPI_MasterInit() ...@@ -27,42 +40,38 @@ void SPI_MasterInit()
// Initialize the SPI port as master // Initialize the SPI port as master
// You will need to set MOSI, SCK, SS (slave select) as outputs // You will need to set MOSI, SCK, SS (slave select) as outputs
//Connect OLED to EXT3 PORTMUX.CTRLB |= (PORTMUX_SPI0_bm); //To use alternative SPI pins
PORTMUX.CTRLB |= PORTMUX_SPI0_bm; //To use alternative SPI pins
SPI_PORT.DIR |= MOSI_bm | SCK_bm; //Set pins as output SPI_PORT.DIRSET = (MOSI_bm) | (SCK_bm); //Set pins as output
SS_PORT.DIR |= SS_bm; SS_PORT.DIRSET = (SS_bm);
SS_PORT.OUTSET = SS_bm; //Set SS high -> OLED inactive SS_PORT.OUTSET = (SS_bm); //Set SS high -> OLED inactive
// Now enable SPI, Master and set clock rate // Now enable SPI, Master and set clock rate
SPI0.CTRLA |= SPI_ENABLE_bm | SPI_MASTER_bm; //Default clock divisor of 4 is fine SPI0.CTRLA |= (SPI_ENABLE_bm) | (SPI_MASTER_bm); //Default clock divisor of 4 is fine
//Make sure SS does not disable master mode (Possibly not required) //Make sure SS does not disable master mode
SPI0.CTRLB |= SPI_SSD_bm; SPI0.CTRLB |= (SPI_SSD_bm);
} }
void SPI_MasterTransmit(char cData) void SPI_MasterTransmit(char cData)
{ {
// First select the correct slave by setting its slave select (SS) LOW // First select the correct slave by setting the slave select (SS) bit LOW
SS_PORT.OUTCLR = SS_bm; SS_PORT.OUTCLR = <