Page 66 Epson Research and Development
Vancouver Design Center
S1D13705 Programming Notes and Examples
X27A-G-002-03 Issue Date: 02/01/22
10 Sample Code

Included in the sample code section are two examples of programing the S1D13705. The

first sample uses the HAL to draw a red square, wait for user input then rotates to portrait

mode and draws a blue square. The second sample code performs the same pro cedure s but

directly accesses the registers of the S 1 D13705. These code samples are for exam ple

purposes only.

10.1 Sample code using the S1D13705 HAL API

/*
**===========================================================================
** SAMPLE1.C - Sample code demonstrating a program using the S1D13705 HAL.
**-------------------------------------------------------------------------
** Created 1998, Vancouver Design Centre
** Copyright (c) 1998, 1999 Epson Research and Development, Inc.
** All Rights Reserved.
**-------------------------------------------------------------------------
**
** The HAL API code is configured for the following:
**
** 320x240 Single Color 4-bit STN
** 8 bpp - 70 Hz Frame Rate (6 MHz CLKi)
** High Performance enabled
**
**===========================================================================
*/
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "hal.h" /* Structures, constants and prototypes. */
#include "appcfg.h" /* HAL configuration information. */
/*--------------------------------------------------------------------------*/
void main(void)
{int ChipId;
/*
** Initialize the HAL.
** The call to seRegisterDevice() actually prepares the HAL library
** for use. The S1D13705 is not accessed, except to read the revision
** code register.
*/
if (ERR_OK != seRegisterDevice(&HalInfo))
{printf("\nERROR: Could not register S1D13705 device.");
exit(1);
}