lcd.cpp (821B)
1 #include "lcd.h" 2 3 #include "mqtypes.h" 4 5 #include "mc68k/port.h" 6 7 namespace mqLib 8 { 9 bool LCD::exec(mc68k::Port& _portGp, const mc68k::Port& _portF) 10 { 11 if(_portF.getWriteCounter() == m_lastWriteCounter) 12 return false; 13 14 m_lastWriteCounter = _portF.getWriteCounter(); 15 16 const auto f = _portF.read(); 17 const auto g = _portGp.read(); 18 const auto df = _portF.getDirection(); 19 //const auto dg = _portGp.getDirection(); 20 21 const auto registerSelect = (f>>LcdRS) & 1; 22 const auto read = (f>>LcdRW) & 1; 23 const auto opEnable = ((f & df)>>LcdLatch) & 1; 24 25 // falling edge triggered 26 const auto execute = m_lastOpState && !opEnable; 27 28 m_lastOpState = opEnable; 29 30 if(!execute) 31 return false; 32 33 const auto res = hwLib::LCD::exec(registerSelect, read, g); 34 35 if(res) 36 _portGp.writeRX(*res); 37 38 return true; 39 } 40 }