Count up seconds on display
This commit is contained in:
parent
86df456b0f
commit
f7393f0661
2 changed files with 64 additions and 40 deletions
|
@ -1,46 +1,27 @@
|
|||
#define F_CPU 1000000
|
||||
#include "Hardware.h"
|
||||
#include "MyLcd.h"
|
||||
|
||||
#include <avr/io.h>
|
||||
#include <util/delay.h>
|
||||
|
||||
#include "LcdShiftReg.h"
|
||||
|
||||
void setupStatusLed()
|
||||
extern "C" void __cxa_pure_virtual(void)
|
||||
{
|
||||
DDRB |= (1 << PB0);
|
||||
}
|
||||
|
||||
void flashStatusLed()
|
||||
{
|
||||
PORTB |= (1 << PB0);
|
||||
_delay_ms(100);
|
||||
PORTB &= ~(1 << PB0);
|
||||
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
setupStatusLed();
|
||||
|
||||
LcdShiftReg lcdShiftReg;
|
||||
MyLcd lcd;
|
||||
delay_ms(40);
|
||||
lcd.initDisplay();
|
||||
|
||||
uint16_t counter = 0;
|
||||
|
||||
while (true)
|
||||
{
|
||||
flashStatusLed();
|
||||
_delay_ms(400);
|
||||
lcd.clear();
|
||||
lcd.output(counter++);
|
||||
lcd.output('s');
|
||||
|
||||
lcdShiftReg.set(1);
|
||||
_delay_ms(100);
|
||||
lcdShiftReg.set(0);
|
||||
_delay_ms(400);
|
||||
|
||||
lcdShiftReg.set(1 << 1);
|
||||
_delay_ms(100);
|
||||
lcdShiftReg.set(0);
|
||||
_delay_ms(400);
|
||||
|
||||
lcdShiftReg.set(1 << 7);
|
||||
_delay_ms(100);
|
||||
lcdShiftReg.set(0);
|
||||
_delay_ms(400);
|
||||
delay_ms(1000);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,23 +55,47 @@
|
|||
<avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
|
||||
<avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
|
||||
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
|
||||
<avrgcc.compiler.directories.IncludePaths><ListValues><Value>%24(PackRepoDir)\Atmel\ATtiny_DFP\1.2.112\include</Value></ListValues></avrgcc.compiler.directories.IncludePaths>
|
||||
<avrgcc.compiler.symbols.DefSymbols>
|
||||
<ListValues>
|
||||
<Value>NDEBUG</Value>
|
||||
</ListValues>
|
||||
</avrgcc.compiler.symbols.DefSymbols>
|
||||
<avrgcc.compiler.directories.IncludePaths>
|
||||
<ListValues>
|
||||
<Value>%24(PackRepoDir)\Atmel\ATtiny_DFP\1.2.112\include</Value>
|
||||
</ListValues>
|
||||
</avrgcc.compiler.directories.IncludePaths>
|
||||
<avrgcc.compiler.optimization.level>Optimize for size (-Os)</avrgcc.compiler.optimization.level>
|
||||
<avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
|
||||
<avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
|
||||
<avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
|
||||
<avrgcccpp.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcccpp.compiler.general.ChangeDefaultCharTypeUnsigned>
|
||||
<avrgcccpp.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcccpp.compiler.general.ChangeDefaultBitFieldUnsigned>
|
||||
<avrgcccpp.compiler.directories.IncludePaths><ListValues><Value>%24(PackRepoDir)\Atmel\ATtiny_DFP\1.2.112\include</Value></ListValues></avrgcccpp.compiler.directories.IncludePaths>
|
||||
<avrgcccpp.compiler.symbols.DefSymbols>
|
||||
<ListValues>
|
||||
<Value>NDEBUG</Value>
|
||||
</ListValues>
|
||||
</avrgcccpp.compiler.symbols.DefSymbols>
|
||||
<avrgcccpp.compiler.directories.IncludePaths>
|
||||
<ListValues>
|
||||
<Value>%24(PackRepoDir)\Atmel\ATtiny_DFP\1.2.112\include</Value>
|
||||
</ListValues>
|
||||
</avrgcccpp.compiler.directories.IncludePaths>
|
||||
<avrgcccpp.compiler.optimization.level>Optimize for size (-Os)</avrgcccpp.compiler.optimization.level>
|
||||
<avrgcccpp.compiler.optimization.PackStructureMembers>True</avrgcccpp.compiler.optimization.PackStructureMembers>
|
||||
<avrgcccpp.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcccpp.compiler.optimization.AllocateBytesNeededForEnum>
|
||||
<avrgcccpp.compiler.warnings.AllWarnings>True</avrgcccpp.compiler.warnings.AllWarnings>
|
||||
<avrgcccpp.compiler.miscellaneous.OtherFlags>-std=c++11</avrgcccpp.compiler.miscellaneous.OtherFlags>
|
||||
<avrgcccpp.linker.libraries.Libraries><ListValues><Value>libm</Value></ListValues></avrgcccpp.linker.libraries.Libraries>
|
||||
<avrgcccpp.assembler.general.IncludePaths><ListValues><Value>%24(PackRepoDir)\Atmel\ATtiny_DFP\1.2.112\include</Value></ListValues></avrgcccpp.assembler.general.IncludePaths>
|
||||
<avrgcc.compiler.symbols.DefSymbols><ListValues><Value>NDEBUG</Value></ListValues></avrgcc.compiler.symbols.DefSymbols>
|
||||
<avrgcc.compiler.optimization.level>Optimize for size (-Os)</avrgcc.compiler.optimization.level>
|
||||
<avrgcccpp.compiler.symbols.DefSymbols><ListValues><Value>NDEBUG</Value></ListValues></avrgcccpp.compiler.symbols.DefSymbols>
|
||||
<avrgcccpp.compiler.optimization.level>Optimize for size (-Os)</avrgcccpp.compiler.optimization.level>
|
||||
<avrgcccpp.linker.libraries.Libraries>
|
||||
<ListValues>
|
||||
<Value>libm</Value>
|
||||
</ListValues>
|
||||
</avrgcccpp.linker.libraries.Libraries>
|
||||
<avrgcccpp.assembler.general.IncludePaths>
|
||||
<ListValues>
|
||||
<Value>%24(PackRepoDir)\Atmel\ATtiny_DFP\1.2.112\include</Value>
|
||||
</ListValues>
|
||||
</avrgcccpp.assembler.general.IncludePaths>
|
||||
</AvrGccCpp>
|
||||
</ToolchainSettings>
|
||||
</PropertyGroup>
|
||||
|
@ -99,6 +123,7 @@
|
|||
<avrgcccpp.compiler.miscellaneous.OtherFlags>-std=c++11</avrgcccpp.compiler.miscellaneous.OtherFlags>
|
||||
<avrgcccpp.linker.libraries.Libraries><ListValues><Value>libm</Value></ListValues></avrgcccpp.linker.libraries.Libraries>
|
||||
<avrgcccpp.assembler.general.IncludePaths><ListValues><Value>%24(PackRepoDir)\Atmel\ATtiny_DFP\1.2.112\include</Value></ListValues></avrgcccpp.assembler.general.IncludePaths>
|
||||
<avrgcccpp.compiler.miscellaneous.Verbose>True</avrgcccpp.compiler.miscellaneous.Verbose>
|
||||
<avrgcc.compiler.symbols.DefSymbols><ListValues><Value>DEBUG</Value></ListValues></avrgcc.compiler.symbols.DefSymbols>
|
||||
<avrgcc.compiler.optimization.level>Optimize (-O1)</avrgcc.compiler.optimization.level>
|
||||
<avrgcc.compiler.optimization.DebugLevel>Default (-g2)</avrgcc.compiler.optimization.DebugLevel>
|
||||
|
@ -110,6 +135,12 @@
|
|||
</ToolchainSettings>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="DeviceLib\Lcd.cpp">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="DeviceLib\Lcd.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="DeviceLib\ShiftRegister.cpp">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
|
@ -119,12 +150,24 @@
|
|||
<Compile Include="Distancer.cpp">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="hardware.cpp">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="hardware.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="LcdShiftReg.cpp">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="LcdShiftReg.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="MyLcd.cpp">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="MyLcd.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="DeviceLib" />
|
||||
|
|
Loading…
Reference in a new issue