Skip to Content
Embedded Programming with Modern C++ Cookbook
book

Embedded Programming with Modern C++ Cookbook

by Igor Viarheichyk
April 2020
Intermediate to advanced
412 pages
9h 58m
English
Packt Publishing
Content preview from Embedded Programming with Modern C++ Cookbook

How to do it...

We will create an application that displays text on a 1602 LCD display attached to our Raspberry Pi board:

  1. In your ~/test working directory, create a subdirectory called i2c.
  2. Use your favorite text editor to create an i2c.cpp file in the i2c subdirectory.
  3. Put the following include directives and constants' definitions into the i2c.cpp file:
#include <thread>#include <system_error>#include <unistd.h>#include <fcntl.h>#include <errno.h>#include <sys/ioctl.h>#include <linux/i2c-dev.h>using namespace std::literals::chrono_literals;enum class Function : uint8_t {  clear = 0x01,  home = 0x02,  entry_mode_set = 0x04,  display_control = 0x08,  cursor_shift = 0x10,  fn_set = 0x20,  set_ddram_addr = 0x80};constexpr int En = 0b00000100;
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

C++ System Programming Cookbook

C++ System Programming Cookbook

Onorato Vaticone
C++ Cookbook

C++ Cookbook

D. Ryan Stephens, Christopher Diggins, Jonathan Turkanis, Jeff Cogswell

Publisher Resources

ISBN: 9781838821043Supplemental Content