#include <stdarg.h>
#include <stdio.h>
+#ifdef __SDCC
#include <delay.h>
+#else
+#include <xc.h>
+#endif
+
#include <string.h>
#include "iodef.h"
#include "i2c_io.h"
+#include "idle.h"
#ifdef __cplusplus
extern "C" {
#endif
+#ifndef LCD_I2CADDR
+#define LCD_I2CADDR 0xa0
+#endif
// Notes: Master clock = 8MHz(0.125uS)
// Wait 5us
+#ifdef __SDCC
#define _ACM1602_TC_WAIT() delay10tcy(4)
// Wait 50us
#define _ACM1602_SHORT_WAIT() delay100tcy(4)
// Wait 5ms
#define _ACM1602_LONG_WAIT() delay10ktcy(40)
-// Wait 50ms
-#define _ACM1602_LONG_LONG_WAIT() delay10ktcy(40)
+// Wait 125ms
+#define _ACM1602_LONG_LONG_WAIT() delay1mtcy(1)
// Wait 5.5ms
#define _ACM1602_I2C_WAIT() delay1ktcy(44)
-
+#else
+#define _ACM1602_TC_WAIT() __delay_us(5)
+// Wait 50us
+#define _ACM1602_SHORT_WAIT() __delay_us(50)
+// Wait 5ms
+#define _ACM1602_LONG_WAIT() __delay_ms(50)
+// Wait 125ms
+#define _ACM1602_LONG_LONG_WAIT() idle_time_ms(125)
+// Wait 5.5ms
+#define _ACM1602_I2C_WAIT() __delay_us(5500)
+#endif
extern void acm1602_cls(unsigned char addr);
extern void acm1602_locate_16x2(unsigned char addr, char x, char y);
extern void acm1602_locate_8x2(unsigned char addr, char x, char y);
extern void acm1602_home(unsigned char addr);
-extern void acm1602_printf(unsigned char addr, const char *fmt, ...);
extern void acm1602_cursordir(unsigned char addr, unsigned char right);
extern void acm1602_init(unsigned char addr, unsigned char cls);
-extern unsigned char acm1602_getchar(unsigned char addr);
-extern void acm1602_setbacklight(unsigned char flag);
+extern void acm1602_suspend(unsigned char addr);
+
+//extern unsigned char acm1602_getchar(unsigned char addr);
+#ifdef _USE_I2C_1602
/*
* ST7032 extension functions
*/
unsigned char cmd, unsigned char busyf);
extern void st7032_setcontrast(unsigned char addr, unsigned char value,
unsigned char busyf);
-
+#endif
#ifdef __cplusplus
}
#endif