44 #include "simpletools.h" 50 #if defined(__cplusplus) 167 #define SCR_BLACK (0) 175 #define SCR_WHITE (1) 275 void led(
int n,
int state);
305 void rgb(
int side,
int color);
315 void rgbs(
int colorL,
int colorR);
383 void accels(
int *x,
int *y,
int *z);
411 int store(
char *contact);
436 void retrieve(
char *contact,
int recIdx);
455 int eeprint(
const char *fmt, ...);
490 int eescan(
int recIdx,
const char *fmt, ...);
646 char*
ee_readStr(
unsigned char *s,
int n,
int addr);
706 int irprint(
const char *fmt, ...);
726 int irscan(
const char *fmt, ...);
738 void ir_send(
char *s,
int ssize);
801 void cursor(
int col,
int row);
838 void point(
int x,
int y,
int color);
857 void line(
int x0,
int y0,
int x1,
int y1,
int c);
876 void box(
int x0,
int y0,
int x1,
int y1,
int c);
895 void boxFilled(
int x0,
int y0,
int x1,
int y1,
int c);
918 void triangle(
int x0,
int y0,
int x1,
int y1,
int x2,
int y2,
int c);
941 void triangleFilled(
int x0,
int y0,
int x1,
int y1,
int x2,
int y2,
int c);
958 void circle(
int x0,
int y0,
int r,
int c);
994 void shape(
char *img,
int bw,
int xtl,
int ytl,
int xpics,
int ypics);
1118 #ifndef DOXYGEN_SHOULD_SKIP_THIS 1224 typedef struct light {
1228 volatile int ledbits;
1230 volatile int cycleticks;
1233 void light_set_rgb1(
int bits);
1234 void light_set_rgb2(
int bits);
1235 void light_set_rgb(
int bits);
1236 void light_set_all(
int bits);
1237 void light_clear(
void );
1238 void light_stop(
void );
1239 void led_on(int32_t n);
1240 void led_off(int32_t n);
1242 int32_t ircom_start(int32_t rxd, int32_t txd, int32_t baud, int32_t freq);
1243 void ircom_stop(
void);
1244 int32_t ircom_rx(
void);
1245 int32_t ircom_rxcheck(
void);
1246 int32_t ircom_rxtime(int32_t mslim);
1247 int32_t ircom_rxflush(
void);
1248 int32_t ircom_tx(int32_t c);
1249 int32_t ircom_str(
char *p_zstr);
1250 int32_t ircom_dec(int32_t value);
1251 int32_t ircom_rjdec(int32_t val, int32_t width, int32_t pchar);
1252 int32_t ircom_hex(int32_t value, int32_t digits);
1253 int32_t ircom_tx_bin(int32_t value, int32_t digits);
1254 int32_t ircom_txflush(
void);
1257 typedef struct touch {
1259 volatile int pincount;
1261 volatile int p_pinslist;
1265 volatile int pinsmask;
1302 #define IR_BAUD (2400) 1306 #define IR_FREQ (36000) 1320 #define OLED_DAT (22) 1324 #define OLED_CLK (21) 1328 #define OLED_DC (20) 1332 #define OLED_RST (19) 1336 #define OLED_CS (18) 1341 #define TV_DAC2 (14) 1345 #define TV_DAC1 (13) 1349 #define TV_DAC0 (12) 1389 #define PB0_MASK (1) 1393 #define PB1_MASK (2) 1397 #define PB2_MASK (4) 1401 #define PB3_MASK (8) 1405 #define PB4_MASK (16) 1409 #define PB5_MASK (32) 1413 #define PB6_MASK (64) 1417 #define OFF_MASK ((PB5_MASK | PB0_MASK)) 1420 #ifndef STX //serial framing bytes 1421 #define STX 2 //serial framing bytes 1428 #ifndef LCD_BUFFER_SIZE_BOTH_TYPES 1429 #define LCD_BUFFER_SIZE_BOTH_TYPES (1024) 1432 #ifndef SSD1306_SWITCHCAPVCC 1433 #define SSD1306_SWITCHCAPVCC (2) 1437 #define TYPE_128X32 (32) 1441 #define TYPE_128X64 (64) 1444 #ifndef EE_BADGE_DATA_START 1445 #define EE_BADGE_DATA_START 32768 1448 #ifndef EE_BADGE_DATA_END 1449 #define EE_BADGE_DATA_END 65536 - 4 1452 void init_MMA7660FC(
void);
1507 #define MMA7660_I2C 0b1001100 1511 #define ALERT_BIT 0b01000000 //0x40 1515 #define ALERT_XYZT 0x40404040 1519 #define BUF_SIZE (128) 1523 #define BUF_MASK ((BUF_SIZE - 1)) 1526 typedef struct jm_ir_hdserial {
1528 volatile int32_t cog;
1530 volatile int32_t rxhead;
1532 volatile int32_t rxtail;
1534 volatile int32_t rxhub;
1536 volatile int32_t txhead;
1538 volatile int32_t txtail;
1540 volatile int32_t txhub;
1542 volatile int32_t rxpin;
1544 volatile int32_t txpin;
1546 volatile int32_t bitticks;
1548 volatile int32_t frsetup;
1550 volatile uint8_t rxbuf[BUF_SIZE];
1551 volatile uint8_t txbuf[BUF_SIZE];
1558 #ifndef SSD1306_LCDWIDTH 1559 #define SSD1306_LCDWIDTH (128) 1562 #ifndef SSD1306_LCDHEIGHT32 1563 #define SSD1306_LCDHEIGHT32 (32) 1566 #ifndef SSD1306_LCDHEIGHT64 1567 #define SSD1306_LCDHEIGHT64 (64) 1570 #ifndef SSD1306_LCDCHARMAX 1571 #define SSD1306_LCDCHARMAX (8) 1574 #ifndef SSD1306_SETCONTRAST 1575 #define SSD1306_SETCONTRAST (129) 1578 #ifndef SSD1306_DISPLAYALLON_RESUME 1579 #define SSD1306_DISPLAYALLON_RESUME (164) 1582 #ifndef SSD1306_DISPLAYALLON 1583 #define SSD1306_DISPLAYALLON (165) 1586 #ifndef SSD1306_NORMALDISPLAY 1587 #define SSD1306_NORMALDISPLAY (166) 1590 #ifndef SSD1306_INVERTDISPLAY 1591 #define SSD1306_INVERTDISPLAY (167) 1594 #ifndef SSD1306_DISPLAYOFF 1595 #define SSD1306_DISPLAYOFF (174) 1598 #ifndef SSD1306_DISPLAYON 1599 #define SSD1306_DISPLAYON (175) 1602 #ifndef SSD1306_SETDISPLAYOFFSET 1603 #define SSD1306_SETDISPLAYOFFSET (211) 1606 #ifndef SSD1306_SETCOMPINS 1607 #define SSD1306_SETCOMPINS (218) 1610 #ifndef SSD1306_SETVCOMDETECT 1611 #define SSD1306_SETVCOMDETECT (219) 1614 #ifndef SSD1306_SETDISPLAYCLOCKDIV 1615 #define SSD1306_SETDISPLAYCLOCKDIV (213) 1618 #ifndef SSD1306_SETPRECHARGE 1619 #define SSD1306_SETPRECHARGE (217) 1622 #ifndef SSD1306_SETMULTIPLEX 1623 #define SSD1306_SETMULTIPLEX (168) 1626 #ifndef SSD1306_SETLOWCOLUMN 1627 #define SSD1306_SETLOWCOLUMN (0) 1630 #ifndef SSD1306_SETHIGHCOLUMN 1631 #define SSD1306_SETHIGHCOLUMN (16) 1634 #ifndef SSD1306_SETSTARTLINE 1635 #define SSD1306_SETSTARTLINE (64) 1638 #ifndef SSD1306_MEMORYMODE 1639 #define SSD1306_MEMORYMODE (32) 1642 #ifndef SSD1306_COMSCANINC 1643 #define SSD1306_COMSCANINC (192) 1646 #ifndef SSD1306_COMSCANDEC 1647 #define SSD1306_COMSCANDEC (200) 1650 #ifndef SSD1306_SEGREMAP 1651 #define SSD1306_SEGREMAP (160) 1654 #ifndef SSD1306_CHARGEPUMP 1655 #define SSD1306_CHARGEPUMP (141) 1658 #ifndef SSD1306_EXTERNALVCC 1659 #define SSD1306_EXTERNALVCC (1) 1664 #ifndef SSD1306_ACTIVATE_SCROLL 1665 #define SSD1306_ACTIVATE_SCROLL (47) 1668 #ifndef SSD1306_DEACTIVATE_SCROLL 1669 #define SSD1306_DEACTIVATE_SCROLL (46) 1672 #ifndef SSD1306_SET_VERT_SCROLL_AREA 1673 #define SSD1306_SET_VERT_SCROLL_AREA (163) 1676 #ifndef SSD1306_RIGHT_HORIZ_SCROLL 1677 #define SSD1306_RIGHT_HORIZ_SCROLL (38) 1680 #ifndef SSD1306_LEFT_HORIZ_SCROLL 1681 #define SSD1306_LEFT_HORIZ_SCROLL (39) 1684 #ifndef SSD1306_VERTRIGHTHORIZSCROLL 1685 #define SSD1306_VERTRIGHTHORIZSCROLL (41) 1688 #ifndef SSD1306_VERTLEFTHORIZSCROLL 1689 #define SSD1306_VERTLEFTHORIZSCROLL (42) 1692 #ifndef LCD_BUFFER_SIZE_BOTH_TYPES 1693 #define LCD_BUFFER_SIZE_BOTH_TYPES (1024) 1696 #ifndef SSD1306_SWITCHCAPVCC 1697 #define SSD1306_SWITCHCAPVCC (2) 1701 #define TYPE_128X32 (32) 1705 #define TYPE_128X64 (64) 1709 typedef volatile struct screen {
1711 volatile int command;
1717 volatile int vccstate;
1718 volatile int displayWidth;
1719 volatile int displayHeight;
1720 volatile int displayType;
1721 volatile int AutoUpdate;
1722 volatile uint8_t buffer[LCD_BUFFER_SIZE_BOTH_TYPES];
1723 volatile int charSize;
1729 extern uint8_t oleddat[];
1731 void screen_string8x2(
char *str, int32_t len, int32_t row, int32_t col);
1732 void screen_string16x4(
char *str,
int len,
int row,
int col);
1733 void screen_char32x16(
int ch,
int row,
int col);
1734 void screen_char7x5(
int ch,
int row,
int col);
1736 int screen_HIGH(
int Pin);
1737 int screen_LOW(
int Pin);
1738 int32_t screen_swap( int32_t a, int32_t b);
1739 int screen_AutoUpdateOn(
void );
1740 int screen_AutoUpdateOff(
void );
1742 void ee_displayIndex(
int start,
int end,
int increment);
1743 void stringView(
char *s,
int ssize);
1744 int sscan_ct(
const char *str,
const char *fmt, ...);
1745 int _doscanf_ct(
const char* str,
const char *fmt, va_list args);
1747 void ir_start(
void);
1749 void ee_badgeCheck(
void);
1750 int light_start(
void );
1751 int touch_start(
int count,
unsigned char *p_pins,
int dms);
1753 int screen_GetDisplayHeight(
void );
1754 int screen_GetDisplayWidth(
void );
1755 int screen_GetDisplayType(
void );
1756 int screen_ssd1306_Command(
int thecmd);
1757 int screen_ssd1306_Data(
int thedata);
1758 int screen_getSplash(
void );
1759 int screen_SHIFTOUT(
int Dpin,
int Cpin,
int CSpin,
int Bits,
int Value);
1760 int screen_WRITEBUFF(
int Dpin,
int Cpin,
int CSpin,
int Bits,
int Addr);
1761 int screen_init(
int ChipSelect,
int DataCommand,
int TheData,
int TheClock,
int Reset,
int VCC_state,
int Type);
1762 void screen_string8x2(
char *str, int32_t len, int32_t row, int32_t col);
1763 void screen_string16x4(
char *str,
int len,
int row,
int col);
1765 int screen_getBuffer(
void );
1766 int screen_start(
void );
1767 int screen_stop(
void );
1769 void screen_char32x16(
int ch,
int row,
int col);
1770 void screen_char7x5(
int ch,
int row,
int col);
1773 int get_bit(
int bitNum,
int val);
1774 void set_bit(
int bitNum,
int *val);
1775 void clear_bit(
int bitNum,
int *val);
1779 #define INLINE__ static inline 1780 #define Yield__() __asm__ volatile( "" ::: "memory" ) 1781 #define PostEffect__(X, Y) __extension__({ int32_t tmp__ = (X); (X) = (Y); tmp__; }) 1783 #define INLINE__ static 1784 static int32_t tmp__;
1785 #define PostEffect__(X, Y) (tmp__ = (X), (X) = (Y), tmp__) 1787 #define waitcnt(n) _waitcnt(n) 1788 #define coginit(id, code, par) _coginit((unsigned)(par)>>2, (unsigned)(code)>>2, id) 1789 #define cognew(code, par) coginit(0x8, (code), (par)) 1790 #define cogstop(i) _cogstop(i) 1793 INLINE__ int32_t Min__(int32_t a, int32_t b) {
return a < b ? a : b; }
1794 INLINE__ int32_t Max__(int32_t a, int32_t b) {
return a > b ? a : b; }
1795 INLINE__ int32_t Shr__(uint32_t a, uint32_t b) {
return (a>>b); }
1796 INLINE__ int32_t Rotl__(uint32_t a, uint32_t b) {
return (a<<b) | (a>>(32-b)); }
1797 INLINE__ int32_t Rotr__(uint32_t a, uint32_t b) {
return (a>>b) | (a<<(32-b)); }
1798 INLINE__ int32_t Lookup__(int32_t x, int32_t b, int32_t a[], int32_t n) { int32_t i = (x)-(b);
return ((
unsigned)i >= n) ? 0 : (a)[i]; }
1805 #endif // DOXYGEN_SHOULD_SKIP_THIS 1808 #if defined(__cplusplus)