User`s manual
9: SAMPLE CODE
2-38 EPSON S1D13504 PROGRAMMING NOTES
AND EXAMPLES (S19A-G-002-06)
9SAMPLE CODE
9.1 Introduction
The following code samples demonstrate two approaches to initializing the S1D13504 color graph-
ics controller with/without using the 13504HAL API. These code samples are for example purposes
only.
9.1.1 Sample Code Using 13504HAL API
/*
**-------------------------------------------------------------------------
**
** Sample Code using 1354HAL API
**
** Copyright (c) Seiko Epson Corp. 1998. All rights reserved.
**
**-------------------------------------------------------------------------
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "hal.h"
#include "appcfg.h"
/*--------------------------------------------------------------------------*/
void main(void)
{
BYTE ChipId;
int Device;
switch (seRegisterDevice(&Cfg.DeviceInfo[0], &Cfg.DeviceChip, &Device))
{
case ERR_OK:
break;
case HAL_DEVICE_ERR:
printf("ERROR: Too many devices registered.\n");
exit(1);
default:
printf("ERROR: Could not register SED1354 device.\n");
exit(1);
}
seGetId(Device, &ChipId);
if (ChipId != ID_SED1354F0A)
{
printf("ERROR: Did not detect SED1354.\n");
exit(1);
}
if (seSetInit(Device) != ERR_OK)
{
printf("ERROR: Could not initialize device.\n");
exit(1);
}
/***************************************************************************
* Fill 2 MBytes of memory with 0xffffffff (white)
* Note that 0x200000 == 2 M bytes. Divide by 4 for number of Dwords to fill
***************************************************************************/
seWriteDisplayDwords(Device, 0, 0xffffffff, 0x200000/4);
exit(0);
}