Riverdi and XinaBox - Hello World

Riverdi and XinaBox - Hello World

This project demonstrates the use of XinaBox xChips interfaced with a Riverdi display. A simple 'Hello World' is displayed on the screen.

Requirements

Introduction

This project demonstrates the use of XinaBox xChips interfaced with a 4.3" Riverdi Display based off the FT801 touch display controller by FTDI. Using the ESP32 as the MCU (CW02) and the OD22 (interface to the display), we can display "Hello World" on the screen.

Required components

Hardware Setup

Connect the screen to OD22 using the flat flex cable

OD22 connected to display

Assemble the unit below and connect IP01 to your computer. I recommend to use a USB extension cable to do this. This completes the hardware portion of the project.

Entire hardware setup

Software/Libraries

The following software is required. Follow instructions in the links to install correctly. If you don't know how to install libraries in Arduino, see here.

  • Arduino IDE - Programming Environment
  • ESP32 - Board installation for CW02
  • OD22 - OD22 Arduno library

Once the board and library has been installed, restart Arduino for the changes to take effect.

Open up the Hello World example shown below.

Hello World example

Select the XinaBox CW02 board. Be sure to select the correct COM port

XinaBox CW02 board

Upload the code.

You will see the screen display "Hello World".

Hello World example running with XinaBox and Riverdi

Code

Hello World C/C++
This code runs a a Hello World example.

/*****************************************************************************
* Copyright (c) Future Technology Devices International 2014
* propriety of Future Technology devices International.
*
* Software License Agreement
*
* This code is provided as an example only and is not guaranteed by FTDI. 
* FTDI accept no responsibility for any issues resulting from its use. 
* The developer of the final application incorporating any parts of this 
* sample project is responsible for ensuring its safe and correct operation 
* and for any consequences resulting from its use.
*****************************************************************************/
/**
* @file                           HelloWorld.ino
* @brief                          Sketch to display hello world on FT801.
								  Tested platform version: Arduino 1.0.4 and later
* @version                        0.1.0
* @date                           2014/17/05
*
*/


/* This application demonstrates the usage of FT801 library on VM801P43 platform */

/* Arduino standard includes */
#include "SPI.h"
#include "Wire.h"

/* Platform specific includes */
#include "FT_VM801P43_50.h"

/* Global object for FT801 Implementation */
FT801IMPL_SPI FTImpl(FT_CS_PIN,FT_PDN_PIN,FT_INT_PIN);

/* Api to bootup FT801, verify FT801 hardware and configure display/audio pins */
/* Returns 0 in case of success and 1 in case of failure */
int16_t BootupConfigure()
{
	uint32_t chipid = 0;
	FTImpl.Init(FT_DISPLAY_RESOLUTION,0);//configure the display to the WQVGA

	delay(20);//for safer side
	chipid = FTImpl.Read32(FT_ROM_CHIPID);
	
	/* Identify the chip */
	if(FT801_CHIPID != chipid)
	{
		Serial.print("Error in chip id read ");
		Serial.println(chipid,HEX);
		return 1;
	}
	
	/* Set the Display & audio pins */
	FTImpl.SetDisplayEnablePin(FT_DISPENABLE_PIN);
    FTImpl.SetAudioEnablePin(FT_AUDIOENABLE_PIN); 
	FTImpl.DisplayOn(); 	
	FTImpl.AudioOn();  		
	return 0;
}

/* API to display Hello World string on the screen */
void HelloWorld()
{
	/* Change the below string for experimentation */
	const char Display_string[12] = "Hello World";
	
	/* Display list to display "Hello World" at the centre of display area */
	FTImpl.DLStart();//start the display list. Note DLStart and DLEnd are helper apis, Cmd_DLStart() and Display() can also be utilized.
	FTImpl.ColorRGB(0xFF,0xFF,0xFF);//set the color of the string to while color
	FTImpl.Cmd_Text(FT_DISPLAYWIDTH/2, FT_DISPLAYHEIGHT/2, 29, FT_OPT_CENTER, Display_string);//display "Hello World at the center of the screen using inbuilt font handle 29 "
	FTImpl.DLEnd();//end the display list
	FTImpl.Finish();//render the display list and wait for the completion of the DL
}

/* bootup the module and display "Hello World" on screen */
void setup()
{
	/* Initialize serial print related functionality */
	Serial.begin(9600);
	
	/* Set the Display Enable pin*/   
	Serial.println("--Start Application--");
	if(BootupConfigure())
	{
		//error case - do not do any thing
	}
  	else
	{
		HelloWorld();
	}
	Serial.println("--End Application--");
}

/* Nothing in loop api */
void loop()
{
}
Previous article Control Your Appliances with XinaBox and Google Home
Next article Panic Button using XinaBox, micro:bit and Ubidots