#include "lcd.h" #include "i2c.h" #include "spyglass.h"
SPYGLASS PINOUT for 10-pin I/O header:
----
+5V - 1 |++| 2 - +5V
SCL - 3 |++| 4 - GND
SDA - 5 |++| 6 - GND
7 |++| 8 - BEEPER PWR (+5V)
9 |++| 10
----
Defines | |
#define | PCF8574_I2C_BASE_ADDR 0x40 |
#define | MAX517_I2C_BASE_ADDR 0x58 |
#define | PCF_NODE_BUTTONS 0x00 |
#define | PCF_NODE_LCD_DATA 0x01 |
#define | PCF_NODE_CONTROL 0x02 |
#define | SPYGLASS_LED0 0x01 |
#define | SPYGLASS_LED1 0x02 |
#define | SPYGLASS_BEEPER 0x04 |
#define | SPYGLASS_LCD_RS 0x20 |
#define | SPYGLASS_LCD_RW 0x40 |
#define | SPYGLASS_LCD_E 0x80 |
#define | lcdInit spyglassLcdInit |
#define | lcdHome spyglassLcdHome |
#define | lcdClear spyglassLcdClear |
#define | lcdGotoXY spyglassLcdGotoXY |
#define | lcdDataWrite spyglassLcdWriteChar |
Functions | |
void | spyglassInit (void) |
initialize the I2C bus for communication with the spyglass UI. | |
u08 | spyglassGetPushbuttons (void) |
void | spyglassSetLeds (u08 leds) |
void | spyglassSetBeeper (u08 state) |
u08 | spyglassSetLcdContrast (u08 contrast) |
void | spyglassLcdInit (void) |
Initialize LCD for operation. | |
void | spyglassLcdHome (void) |
Set write/cursor position to upper left. | |
void | spyglassLcdClear (void) |
Clear LCD display. | |
void | spyglassLcdGotoXY (u08 x, u08 y) |
Set write/cursor posision on LCD display (x=col, y=line). | |
void | spyglassLcdWrite (u08 rs, u08 data) |
Write control or display data to LCD. | |
void | spyglassLcdWriteChar (u08 c) |
Write character to LCD. | |
u08 | pcf8574Write (u08 nodeAddr, u08 data) |
Write I/O Data to PCF8574 I2C<->Digital I/O chip. | |
u08 | pcf8574Read (u08 nodeAddr) |
Read I/O Data from PCF8574 I2C<->Digital I/O chip. |
|
Read the state of pushbuttons on the spyglass UI. Returns an 8-bit number representing the state of buttons S1-S7 in bits 0-6 respectively.
Definition at line 51 of file spyglass.c. |
|
Sets the state of the beeper on the spyglass UI.
Definition at line 62 of file spyglass.c. |
|
Sets the contrast voltage of the spyglass LCD. Lower numbers are darker contrast, higher numbers are lighter contrast. Definition at line 71 of file spyglass.c. |
|
Sets the state of LEDs on the spyglass UI. Argument is a 2-bit number representing the desired state of LEDs D2 & D3 respectively.
Definition at line 56 of file spyglass.c. |