diff --git a/Distancer.cppproj b/Distancer.cppproj index f307610..dd0acdf 100644 --- a/Distancer.cppproj +++ b/Distancer.cppproj @@ -47,112 +47,66 @@ - -mmcu=attiny24 -B "%24(PackRepoDir)\Atmel\ATtiny_DFP\1.2.112\gcc\dev\attiny24" - True - True - True - True - False - True - True - - - NDEBUG - - - - - %24(PackRepoDir)\Atmel\ATtiny_DFP\1.2.112\include - - - Optimize for size (-Os) - True - True - True - True - True - - - NDEBUG - - - - - %24(PackRepoDir)\Atmel\ATtiny_DFP\1.2.112\include - - - Optimize for size (-Os) - True - True - True - - - libm - - - - - %24(PackRepoDir)\Atmel\ATtiny_DFP\1.2.112\include - - - + -mmcu=attiny24 -B "%24(PackRepoDir)\Atmel\ATtiny_DFP\1.2.112\gcc\dev\attiny24" + True + True + True + True + False + True + True + %24(PackRepoDir)\Atmel\ATtiny_DFP\1.2.112\include + True + True + True + True + True + %24(PackRepoDir)\Atmel\ATtiny_DFP\1.2.112\include + True + True + True + -std=c++11 + libm + %24(PackRepoDir)\Atmel\ATtiny_DFP\1.2.112\include + NDEBUG + Optimize for size (-Os) + NDEBUG + Optimize for size (-Os) + - -mmcu=attiny24 -B "%24(PackRepoDir)\Atmel\ATtiny_DFP\1.2.112\gcc\dev\attiny24" - True - True - True - True - False - True - True - - - DEBUG - - - - - %24(PackRepoDir)\Atmel\ATtiny_DFP\1.2.112\include - - - Optimize (-O1) - True - True - Default (-g2) - True - True - True - - - DEBUG - - - - - %24(PackRepoDir)\Atmel\ATtiny_DFP\1.2.112\include - - - Optimize (-O1) - True - True - Default (-g2) - True - - - libm - - - - - %24(PackRepoDir)\Atmel\ATtiny_DFP\1.2.112\include - - - Default (-Wa,-g) - + -mmcu=attiny24 -B "%24(PackRepoDir)\Atmel\ATtiny_DFP\1.2.112\gcc\dev\attiny24" + True + True + True + True + False + True + True + %24(PackRepoDir)\Atmel\ATtiny_DFP\1.2.112\include + True + True + True + True + True + %24(PackRepoDir)\Atmel\ATtiny_DFP\1.2.112\include + True + True + True + -std=c++11 + libm + %24(PackRepoDir)\Atmel\ATtiny_DFP\1.2.112\include + DEBUG + Optimize (-O1) + Default (-g2) + DEBUG + Optimize (-O1) + Default (-g2) + Default (-Wa,-g) + @@ -165,6 +119,12 @@ compile + + compile + + + compile + diff --git a/LcdShiftReg.cpp b/LcdShiftReg.cpp new file mode 100644 index 0000000..817ac44 --- /dev/null +++ b/LcdShiftReg.cpp @@ -0,0 +1,35 @@ +#include "LcdShiftReg.h" + +#include + +LcdShiftReg::LcdShiftReg() +{ + DDRA |= (1 << PA0) | (1 << PA1) | (1 << PA2); +} + +void LcdShiftReg::setPin(volatile uint8_t *port, uint8_t pin, bool value) const +{ + if (value == true) + { + *port |= (1 << pin); + } + else + { + *port &= ~(1 << pin); + } +} + +void LcdShiftReg::setSerialPin(bool value) +{ + setPin(&PORTA, PA2, value); +} + +void LcdShiftReg::setShiftPin(bool value) +{ + setPin(&PORTA, PA0, value); +} + +void LcdShiftReg::setStoragePin(bool value) +{ + setPin(&PORTA, PA1, value); +} diff --git a/LcdShiftReg.h b/LcdShiftReg.h new file mode 100644 index 0000000..ecbff6f --- /dev/null +++ b/LcdShiftReg.h @@ -0,0 +1,16 @@ +#pragma once + +#include "DeviceLib/ShiftRegister.h" + +class LcdShiftReg : public ShiftRegister +{ + public: + LcdShiftReg(); + + private: + void setPin(volatile uint8_t *port, uint8_t pin, bool value) const; + + virtual void setSerialPin(bool value) override; + virtual void setShiftPin(bool value) override; + virtual void setStoragePin(bool value) override; +}; \ No newline at end of file