Simple demonstration of how to use a text LCD.
#include <iostream>
#include <thread>
#include <iomanip>
#include <assert.h>
#include <boost/exception/diagnostic_information.hpp>
constexpr int valw = 8;
bool quit = false;
void runtest(
const std::shared_ptr<duds::hardware::devices::displays::HD44780> &tmd
) try {
std::cout << "Start test" << std::endl;
int loop = -1;
do {
if ((loop & 31) == 16) {
}
tds << "Test " << std::hex << (++loop) << " \n";
std::cout << "Wrote some." << std::endl;
std::this_thread::sleep_for(std::chrono::seconds(1));
} while (!quit);
} catch (...) {
std::cerr << "Test failed in thread:\n" <<
boost::current_exception_diagnostic_information()
<< std::endl;
}
int main(void)
try {
std::vector<unsigned int> gpios = { 5, 6, 19, 26, 20, 21 };
std::shared_ptr<duds::hardware::interface::linux::SysFsPort> port =
std::make_shared<duds::hardware::interface::linux::SysFsPort>(
gpios, 0
);
assert(!port->simultaneousOperations());
std::shared_ptr<duds::hardware::interface::ChipPinSelectManager> selmgr =
std::make_shared<duds::hardware::interface::ChipPinSelectManager>(
port->access(5)
);
gpios.clear();
gpios.insert(gpios.begin(), uintIterator(0), uintIterator(5));
std::cout << "Construct" << std::endl;
std::shared_ptr<duds::hardware::devices::displays::HD44780> tmd =
std::make_shared<duds::hardware::devices::displays::HD44780>(
);
std::cout << "Init" << std::endl;
tmd->initialize();
std::thread doit(runtest, std::ref(tmd));
std::cin.get();
quit = true;
doit.join();
} catch (...) {
std::cerr << "Test failed in main():\n" <<
boost::current_exception_diagnostic_information() << std::endl;
return 1;
}