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 shape(
char *img,
int bw,
int xtl,
int ytl,
int xpics,
int ypics);
1019 #ifndef DOXYGEN_SHOULD_SKIP_THIS 1129 volatile int ledbits;
1131 volatile int cycleticks;
1134 void light_set_rgb1(
int bits);
1135 void light_set_rgb2(
int bits);
1136 void light_set_rgb(
int bits);
1137 void light_set_all(
int bits);
1138 void light_clear(
void );
1139 void light_stop(
void );
1140 void led_on(int32_t n);
1141 void led_off(int32_t n);
1143 int32_t ircom_start(int32_t rxd, int32_t txd, int32_t baud, int32_t freq);
1144 void ircom_stop(
void);
1145 int32_t ircom_rx(
void);
1146 int32_t ircom_rxcheck(
void);
1147 int32_t ircom_rxtime(int32_t mslim);
1148 int32_t ircom_rxflush(
void);
1149 int32_t ircom_tx(int32_t c);
1150 int32_t ircom_str(
char *p_zstr);
1151 int32_t ircom_dec(int32_t value);
1152 int32_t ircom_rjdec(int32_t val, int32_t width, int32_t pchar);
1153 int32_t ircom_hex(int32_t value, int32_t digits);
1154 int32_t ircom_tx_bin(int32_t value, int32_t digits);
1155 int32_t ircom_txflush(
void);
1160 volatile int pincount;
1162 volatile int p_pinslist;
1166 volatile int pinsmask;
1203 #define IR_BAUD (2400) 1207 #define IR_FREQ (36000) 1221 #define OLED_DAT (22) 1225 #define OLED_CLK (21) 1229 #define OLED_DC (20) 1233 #define OLED_RST (19) 1237 #define OLED_CS (18) 1242 #define TV_DAC2 (14) 1246 #define TV_DAC1 (13) 1250 #define TV_DAC0 (12) 1290 #define PB0_MASK (1) 1294 #define PB1_MASK (2) 1298 #define PB2_MASK (4) 1302 #define PB3_MASK (8) 1306 #define PB4_MASK (16) 1310 #define PB5_MASK (32) 1314 #define PB6_MASK (64) 1318 #define OFF_MASK ((PB5_MASK | PB0_MASK)) 1321 #ifndef STX //serial framing bytes 1322 #define STX 2 //serial framing bytes 1329 #ifndef LCD_BUFFER_SIZE_BOTH_TYPES 1330 #define LCD_BUFFER_SIZE_BOTH_TYPES (1024) 1333 #ifndef SSD1306_SWITCHCAPVCC 1334 #define SSD1306_SWITCHCAPVCC (2) 1338 #define TYPE_128X32 (32) 1342 #define TYPE_128X64 (64) 1345 #ifndef EE_BADGE_DATA_START 1346 #define EE_BADGE_DATA_START 32768 1349 #ifndef EE_BADGE_DATA_END 1350 #define EE_BADGE_DATA_END 65536 - 4 1353 void init_MMA7660FC(
void);
1408 #define MMA7660_I2C 0b1001100 1412 #define ALERT_BIT 0b01000000 //0x40 1416 #define ALERT_XYZT 0x40404040 1420 #define BUF_SIZE (128) 1424 #define BUF_MASK ((BUF_SIZE - 1)) 1429 volatile int32_t cog;
1431 volatile int32_t rxhead;
1433 volatile int32_t rxtail;
1435 volatile int32_t rxhub;
1437 volatile int32_t txhead;
1439 volatile int32_t txtail;
1441 volatile int32_t txhub;
1443 volatile int32_t rxpin;
1445 volatile int32_t txpin;
1447 volatile int32_t bitticks;
1449 volatile int32_t frsetup;
1451 volatile uint8_t rxbuf[BUF_SIZE];
1452 volatile uint8_t txbuf[BUF_SIZE];
1459 #ifndef SSD1306_LCDWIDTH 1460 #define SSD1306_LCDWIDTH (128) 1463 #ifndef SSD1306_LCDHEIGHT32 1464 #define SSD1306_LCDHEIGHT32 (32) 1467 #ifndef SSD1306_LCDHEIGHT64 1468 #define SSD1306_LCDHEIGHT64 (64) 1471 #ifndef SSD1306_LCDCHARMAX 1472 #define SSD1306_LCDCHARMAX (8) 1475 #ifndef SSD1306_SETCONTRAST 1476 #define SSD1306_SETCONTRAST (129) 1479 #ifndef SSD1306_DISPLAYALLON_RESUME 1480 #define SSD1306_DISPLAYALLON_RESUME (164) 1483 #ifndef SSD1306_DISPLAYALLON 1484 #define SSD1306_DISPLAYALLON (165) 1487 #ifndef SSD1306_NORMALDISPLAY 1488 #define SSD1306_NORMALDISPLAY (166) 1491 #ifndef SSD1306_INVERTDISPLAY 1492 #define SSD1306_INVERTDISPLAY (167) 1495 #ifndef SSD1306_DISPLAYOFF 1496 #define SSD1306_DISPLAYOFF (174) 1499 #ifndef SSD1306_DISPLAYON 1500 #define SSD1306_DISPLAYON (175) 1503 #ifndef SSD1306_SETDISPLAYOFFSET 1504 #define SSD1306_SETDISPLAYOFFSET (211) 1507 #ifndef SSD1306_SETCOMPINS 1508 #define SSD1306_SETCOMPINS (218) 1511 #ifndef SSD1306_SETVCOMDETECT 1512 #define SSD1306_SETVCOMDETECT (219) 1515 #ifndef SSD1306_SETDISPLAYCLOCKDIV 1516 #define SSD1306_SETDISPLAYCLOCKDIV (213) 1519 #ifndef SSD1306_SETPRECHARGE 1520 #define SSD1306_SETPRECHARGE (217) 1523 #ifndef SSD1306_SETMULTIPLEX 1524 #define SSD1306_SETMULTIPLEX (168) 1527 #ifndef SSD1306_SETLOWCOLUMN 1528 #define SSD1306_SETLOWCOLUMN (0) 1531 #ifndef SSD1306_SETHIGHCOLUMN 1532 #define SSD1306_SETHIGHCOLUMN (16) 1535 #ifndef SSD1306_SETSTARTLINE 1536 #define SSD1306_SETSTARTLINE (64) 1539 #ifndef SSD1306_MEMORYMODE 1540 #define SSD1306_MEMORYMODE (32) 1543 #ifndef SSD1306_COMSCANINC 1544 #define SSD1306_COMSCANINC (192) 1547 #ifndef SSD1306_COMSCANDEC 1548 #define SSD1306_COMSCANDEC (200) 1551 #ifndef SSD1306_SEGREMAP 1552 #define SSD1306_SEGREMAP (160) 1555 #ifndef SSD1306_CHARGEPUMP 1556 #define SSD1306_CHARGEPUMP (141) 1559 #ifndef SSD1306_EXTERNALVCC 1560 #define SSD1306_EXTERNALVCC (1) 1565 #ifndef SSD1306_ACTIVATE_SCROLL 1566 #define SSD1306_ACTIVATE_SCROLL (47) 1569 #ifndef SSD1306_DEACTIVATE_SCROLL 1570 #define SSD1306_DEACTIVATE_SCROLL (46) 1573 #ifndef SSD1306_SET_VERT_SCROLL_AREA 1574 #define SSD1306_SET_VERT_SCROLL_AREA (163) 1577 #ifndef SSD1306_RIGHT_HORIZ_SCROLL 1578 #define SSD1306_RIGHT_HORIZ_SCROLL (38) 1581 #ifndef SSD1306_LEFT_HORIZ_SCROLL 1582 #define SSD1306_LEFT_HORIZ_SCROLL (39) 1585 #ifndef SSD1306_VERTRIGHTHORIZSCROLL 1586 #define SSD1306_VERTRIGHTHORIZSCROLL (41) 1589 #ifndef SSD1306_VERTLEFTHORIZSCROLL 1590 #define SSD1306_VERTLEFTHORIZSCROLL (42) 1593 #ifndef LCD_BUFFER_SIZE_BOTH_TYPES 1594 #define LCD_BUFFER_SIZE_BOTH_TYPES (1024) 1597 #ifndef SSD1306_SWITCHCAPVCC 1598 #define SSD1306_SWITCHCAPVCC (2) 1602 #define TYPE_128X32 (32) 1606 #define TYPE_128X64 (64) 1612 volatile int command;
1618 volatile int vccstate;
1619 volatile int displayWidth;
1620 volatile int displayHeight;
1621 volatile int displayType;
1622 volatile int AutoUpdate;
1623 volatile uint8_t buffer[LCD_BUFFER_SIZE_BOTH_TYPES];
1624 volatile int charSize;
1630 extern uint8_t oleddat[];
1632 void screen_string8x2(
char *str, int32_t len, int32_t row, int32_t col);
1633 void screen_string16x4(
char *str,
int len,
int row,
int col);
1634 void screen_char32x16(
int ch,
int row,
int col);
1635 void screen_char7x5(
int ch,
int row,
int col);
1637 int screen_HIGH(
int Pin);
1638 int screen_LOW(
int Pin);
1639 int32_t screen_swap( int32_t a, int32_t b);
1640 int screen_AutoUpdateOn(
void );
1641 int screen_AutoUpdateOff(
void );
1643 void ee_displayIndex(
int start,
int end,
int increment);
1644 void stringView(
char *s,
int ssize);
1645 int sscan_ct(
const char *str,
const char *fmt, ...);
1646 int _doscanf_ct(
const char* str,
const char *fmt, va_list args);
1648 void ir_start(
void);
1650 void ee_badgeCheck(
void);
1651 int light_start(
void );
1652 int touch_start(
int count,
unsigned char *p_pins,
int dms);
1654 int screen_GetDisplayHeight(
void );
1655 int screen_GetDisplayWidth(
void );
1656 int screen_GetDisplayType(
void );
1657 int screen_ssd1306_Command(
int thecmd);
1658 int screen_ssd1306_Data(
int thedata);
1659 int screen_getSplash(
void );
1660 int screen_SHIFTOUT(
int Dpin,
int Cpin,
int CSpin,
int Bits,
int Value);
1661 int screen_WRITEBUFF(
int Dpin,
int Cpin,
int CSpin,
int Bits,
int Addr);
1662 int screen_init(
int ChipSelect,
int DataCommand,
int TheData,
int TheClock,
int Reset,
int VCC_state,
int Type);
1663 void screen_string8x2(
char *str, int32_t len, int32_t row, int32_t col);
1664 void screen_string16x4(
char *str,
int len,
int row,
int col);
1666 int screen_getBuffer(
void );
1667 int screen_start(
void );
1668 int screen_stop(
void );
1670 void screen_char32x16(
int ch,
int row,
int col);
1671 void screen_char7x5(
int ch,
int row,
int col);
1674 int get_bit(
int bitNum,
int val);
1675 void set_bit(
int bitNum,
int *val);
1676 void clear_bit(
int bitNum,
int *val);
1680 #define INLINE__ static inline 1681 #define Yield__() __asm__ volatile( "" ::: "memory" ) 1682 #define PostEffect__(X, Y) __extension__({ int32_t tmp__ = (X); (X) = (Y); tmp__; }) 1684 #define INLINE__ static 1685 static int32_t tmp__;
1686 #define PostEffect__(X, Y) (tmp__ = (X), (X) = (Y), tmp__) 1688 #define waitcnt(n) _waitcnt(n) 1689 #define coginit(id, code, par) _coginit((unsigned)(par)>>2, (unsigned)(code)>>2, id) 1690 #define cognew(code, par) coginit(0x8, (code), (par)) 1691 #define cogstop(i) _cogstop(i) 1694 INLINE__ int32_t Min__(int32_t a, int32_t b) {
return a < b ? a : b; }
1695 INLINE__ int32_t Max__(int32_t a, int32_t b) {
return a > b ? a : b; }
1696 INLINE__ int32_t Shr__(uint32_t a, uint32_t b) {
return (a>>b); }
1697 INLINE__ int32_t Rotl__(uint32_t a, uint32_t b) {
return (a<<b) | (a>>(32-b)); }
1698 INLINE__ int32_t Rotr__(uint32_t a, uint32_t b) {
return (a>>b) | (a<<(32-b)); }
1699 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]; }
1706 #endif // DOXYGEN_SHOULD_SKIP_THIS 1709 #if defined(__cplusplus)
const PropWare::Port::Mask CS