PropWare  3.0.0.229
C++ objects and CMake build system for Parallax Propeller
badgewxtools.h
Go to the documentation of this file.
1 
44 #include "simpletools.h"
45 #include <stdint.h>
46 
47 #ifndef BADGETOOLS_H
48 #define BADGETOOLS_H
49 
50 #if defined(__cplusplus)
51 extern "C" {
52 #endif
53 
59 #ifndef ON
60 
64 #define ON 1
65 #endif
66 
67 #ifndef OFF
68 
73 #define OFF 0
74 #endif
75 
76 
84 #ifndef SCR_BLACK
85 
89 #define SCR_BLACK (0)
90 #endif
91 
92 #ifndef SCR_WHITE
93 
97 #define SCR_WHITE (1)
98 #endif
99 
100 #ifndef SCR_XOR
101 
106 #define SCR_XOR (3)
107 #endif
108 
109 #ifndef LARGE
110 
114 #define LARGE 1
115 #endif
116 
117 #ifndef SMALL
118 
122 #define SMALL 0
123 #endif
124 
132 #ifndef AY
133 
137 #define AY 0
138 #endif
139 
140 #ifndef AX
141 
145 #define AX 1
146 #endif
147 
148 #ifndef AZ
149 
153 #define AZ 2
154 #endif
155 
171 int badge_setup( void );
172 
197 char button( char b );
198 
212 unsigned char buttons( void );
213 
219 void touch_sensitivity_set( char sens );
220 
221 
241 int accel(int axis);
242 
253 void accels(int *x, int *y, int *z);
254 
261 int accel_shaken(void);
262 
281 int store(char *contact);
282 
293 int stored(char * s);
294 
306 void retrieve(char *contact, int recIdx);
307 
325 int eeprint(const char *fmt, ...);
326 
339 int eeprinted(const char *fmt, ...);
340 
360 int eescan(int recIdx, const char *fmt, ...);
361 
368 int contacts_count();
369 
374 void contacts_eraseAll();
375 
379 void contacts_displayAll();
380 
388 void contacts_setStartAddr(int address);
389 
399 void ee_writeByte(unsigned char value, int addr);
400 
410 char ee_readByte(int addr);
411 
421 void ee_writeShort(short value, int addr);
422 
432 short ee_readShort(int addr);
433 
443 void ee_writeInt(int value, int addr);
444 
454 int ee_readInt(int addr);
455 
470 void ee_writeFloat32(float fpVal, int addr);
471 
472 
488 float ee_readFloat32(int addr);
489 
500 void ee_writeStr(char *s, int n, int addr);
501 
516 char* ee_readStr(unsigned char *s, int n, int addr);
517 
518 
522 void led_pwm_start( void );
523 
527 void led_pwm_stop( void );
528 
536 void led_pwm_set( char side, char level );
537 
538 
539 
540 //void contacts_clear(void);
541 //void contacts_setEndAddr(int address);
542 
558 int send(char *s);
559 
570 int receive(char *s);
571 
577 void irclear(void);
578 
597 int irprint(const char *fmt, ...);
598 
617 int irscan(const char *fmt, ...);
618 
629 void ir_send(char *s, int ssize);
630 
644 int ir_receive(char *s, int ssize);
645 
671 int oledprint(const char *fmt, ...);
672 
680 void text_size(int size);
681 
692 void cursor(int col, int row);
693 
702 void string(char *str);
703 
709 int clear( void );
710 
716 void invert(int i);
717 
729 void point( int x, int y, int color);
730 
748 void line( int x0, int y0, int x1, int y1, int c);
749 
767 void box( int x0, int y0, int x1, int y1, int c);
768 
786 void boxFilled( int x0, int y0, int x1, int y1, int c);
787 
809 void triangle( int x0, int y0, int x1, int y1, int x2, int y2, int c);
810 
832 void triangleFilled( int x0, int y0, int x1, int y1, int x2, int y2, int c);
833 
849 void circle( int x0, int y0, int r, int c);
850 
866 void circleFilled( int x0, int y0, int r, int c);
867 
885 void shape(char *img, int bw, int xtl, int ytl, int xpics, int ypics);
886 
891 void rotate180();
892 
901 void screen_auto(int state);
902 
911 int screen_getAuto();
912 
920 int screen_update( void );
921 
934 int screen_scrollRight( int scrollStart, int scrollStop);
935 
941 int screen_scrollLeft( int scrollStart, int scrollStop);
942 
949 int screen_scrollRightDiag( int scrollStart, int scrollStop);
950 
957 int screen_scrollLeftDiag( int scrollStart, int scrollStop);
958 
964 int screen_scrollStop( void );
965 
981 void screen_image(char *imgaddr);
982 
990 // Handy tools
991 
1001 void dev_ee_show(int byteCount, int address);
1002 
1003 
1009 #ifndef DOXYGEN_SHOULD_SKIP_THIS
1010 
1011 /* =========================================================================== */
1012 // PRIVATE FUNCTIONS/MACROS
1013 /* =========================================================================== */
1014 
1021 int32_t ircom_start(int32_t rxd, int32_t txd, int32_t baud, int32_t freq);
1022 void ircom_stop(void);
1023 int32_t ircom_rx(void);
1024 int32_t ircom_rxcheck(void);
1025 int32_t ircom_rxtime(int32_t mslim);
1026 int32_t ircom_rxflush(void);
1027 int32_t ircom_tx(int32_t c);
1028 int32_t ircom_str(char *p_zstr);
1029 int32_t ircom_dec(int32_t value);
1030 int32_t ircom_rjdec(int32_t val, int32_t width, int32_t pchar);
1031 int32_t ircom_hex(int32_t value, int32_t digits);
1032 int32_t ircom_tx_bin(int32_t value, int32_t digits);
1033 int32_t ircom_txflush(void);
1034 void led_pwm(void);
1035 
1036 
1037 //extern char beanie[LCD_BUFFER_SIZE_BOTH_TYPES];
1038 
1039 // LED pins
1040 #ifndef RGB_PIN
1041 #define RGB_PIN (10)
1042 #endif
1043 
1044 #ifndef LED_PIN
1045 #define LED_PIN (9)
1046 #endif
1047 
1048 
1049 
1050 // touch buttons and nav sliders
1051 #ifndef NAV_L
1052 #define NAV_L (13)
1053 #endif
1054 
1055 #ifndef NAV_C
1056 #define NAV_C (12)
1057 #endif
1058 
1059 #ifndef NAV_R
1060 #define NAV_R (11)
1061 #endif
1062 
1063 #ifndef NAV_COM_L
1064 #define NAV_COM_L (14)
1065 #endif
1066 
1067 #ifndef NAV_COM_R
1068 #define NAV_COM_R (15)
1069 #endif
1070 
1071 #ifndef NAV_TOUCH_L
1072 #define NAV_TOUCH_L (4)
1073 #endif
1074 
1075 #ifndef NAV_TOUCH_R
1076 #define NAV_TOUCH_R (2)
1077 #endif
1078 
1079 
1080 /* max supported using IR connection */
1081 #ifndef IR_BAUD
1082 #define IR_BAUD (2400)
1083 #endif
1084 
1085 /* matches receiver on DC22 badge */
1086 #ifndef IR_FREQ
1087 #define IR_FREQ (36000)
1088 #endif
1089 
1090 // IR coms
1091 #ifndef IR_OUT
1092 #define IR_OUT (3)
1093 #endif
1094 
1095 #ifndef IR_IN
1096 #define IR_IN (23)
1097 #endif
1098 
1099 // OLED connections
1100 #ifndef OLED_DAT
1101 #define OLED_DAT (21)
1102 #endif
1103 
1104 #ifndef OLED_CLK
1105 #define OLED_CLK (20)
1106 #endif
1107 
1108 #ifndef OLED_DC
1109 #define OLED_DC (22)
1110 #endif
1111 
1112 #ifndef OLED_RST
1113 #define OLED_RST (19)
1114 #endif
1115 
1116 #ifndef OLED_CS
1117 #define OLED_CS (18)
1118 #endif
1119 
1120 // composite video (J503)
1121 #ifndef TV_DAC2
1122 #define TV_DAC2 (26)
1123 #endif
1124 
1125 #ifndef TV_DAC1
1126 #define TV_DAC1 (25)
1127 #endif
1128 
1129 #ifndef TV_DAC0
1130 #define TV_DAC0 (24)
1131 #endif
1132 // audio (J503)
1133 #ifndef AUD_RT
1134 #define AUD_RT (1)
1135 #endif
1136 
1137 #ifndef AUD_LF
1138 #define AUD_LF (0)
1139 #endif
1140 
1141 #ifndef STX
1142 #define STX 2 //serial framing bytes
1143 #endif
1144 
1145 #ifndef ETX
1146 #define ETX 3
1147 #endif
1148 
1149 #ifndef LCD_BUFFER_SIZE_BOTH_TYPES
1150 #define LCD_BUFFER_SIZE_BOTH_TYPES (1024)
1151 #endif
1152 
1153 #ifndef SSD1306_SWITCHCAPVCC
1154 #define SSD1306_SWITCHCAPVCC (2)
1155 #endif
1156 
1157 #ifndef TYPE_128X32
1158 #define TYPE_128X32 (32)
1159 #endif
1160 
1161 #ifndef TYPE_128X64
1162 #define TYPE_128X64 (64)
1163 #endif
1164 
1165 #ifndef EE_BADGE_DATA_START
1166 #define EE_BADGE_DATA_START 32768
1167 #endif
1168 
1169 #ifndef EE_BADGE_DATA_END
1170 #define EE_BADGE_DATA_END 65536 - 4
1171 #endif
1172 
1173 void init_MMA7660FC(void);
1174 void ee_init(void);
1175 
1176 
1177 
1178 // accelerometer interrupt in
1179 //#ifndef ACC_INT
1180 //#define ACC_INT (4) // Unused in Badge WX
1181 //#endif
1182 
1183 #ifndef XOUT
1184 #define XOUT 0
1185 #endif
1186 
1187 #ifndef YOUT
1188 #define YOUT 1
1189 #endif
1190 
1191 #ifndef ZOUT
1192 #define ZOUT 2
1193 #endif
1194 
1195 #ifndef TILT
1196 #define TILT 3
1197 #endif
1198 
1199 #ifndef SRST
1200 #define SRST 4
1201 #endif
1202 
1203 #ifndef SPCNT
1204 #define SPCNT 5
1205 #endif
1206 
1207 #ifndef INTSU
1208 #define INTSU 6
1209 #endif
1210 
1211 #ifndef MODE
1212 #define MODE 7
1213 #endif
1214 
1215 #ifndef SR
1216 #define SR 8
1217 #endif
1218 
1219 #ifndef PDET
1220 #define PDET 9
1221 #endif
1222 
1223 #ifndef PD
1224 #define PD 10
1225 #endif
1226 
1227 #ifndef MMA7660_I2C
1228 #define MMA7660_I2C 0b1001100
1229 #endif
1230 
1231 #ifndef ALERT_BIT
1232 #define ALERT_BIT 0b01000000 //0x40
1233 #endif
1234 
1235 #ifndef ALERT_XYZT
1236 #define ALERT_XYZT 0x40404040
1237 #endif
1238 
1239 #ifndef BUF_SIZE
1240 #define BUF_SIZE (128)
1241 #endif
1242 
1243 #ifndef BUF_MASK
1244 #define BUF_MASK ((BUF_SIZE - 1))
1245 #endif
1246 
1247 typedef struct jm_ir_hdserial {
1248 // cog flag/id
1249  volatile int32_t cog;
1250 // rx head index
1251  volatile int32_t rxhead;
1252 // rx tail index
1253  volatile int32_t rxtail;
1254 // hub address of rxbuf
1255  volatile int32_t rxhub;
1256 // tx head index
1257  volatile int32_t txhead;
1258 // tx tail index
1259  volatile int32_t txtail;
1260 // hub address of txbuf
1261  volatile int32_t txhub;
1262 // rx pin (in)
1263  volatile int32_t rxpin;
1264 // tx pin (out)
1265  volatile int32_t txpin;
1266 // bit timing (ticks)
1267  volatile int32_t bitticks;
1268 // ctrx setup for freq
1269  volatile int32_t frsetup;
1270 // rx and tx buffers
1271  volatile uint8_t rxbuf[BUF_SIZE];
1272  volatile uint8_t txbuf[BUF_SIZE];
1273 } jm_ir_hdserial;
1274 
1275 
1276 
1277 //define TYPE_128X32 (32)
1278 //define TYPE_128X64 (64)
1279 #ifndef SSD1306_LCDWIDTH
1280 #define SSD1306_LCDWIDTH (128)
1281 #endif
1282 
1283 #ifndef SSD1306_LCDHEIGHT32
1284 #define SSD1306_LCDHEIGHT32 (32)
1285 #endif
1286 
1287 #ifndef SSD1306_LCDHEIGHT64
1288 #define SSD1306_LCDHEIGHT64 (64)
1289 #endif
1290 
1291 #ifndef SSD1306_LCDCHARMAX
1292 #define SSD1306_LCDCHARMAX (8)
1293 #endif
1294 
1295 #ifndef SSD1306_SETCONTRAST
1296 #define SSD1306_SETCONTRAST (129)
1297 #endif
1298 
1299 #ifndef SSD1306_DISPLAYALLON_RESUME
1300 #define SSD1306_DISPLAYALLON_RESUME (164)
1301 #endif
1302 
1303 #ifndef SSD1306_DISPLAYALLON
1304 #define SSD1306_DISPLAYALLON (165)
1305 #endif
1306 
1307 #ifndef SSD1306_NORMALDISPLAY
1308 #define SSD1306_NORMALDISPLAY (166)
1309 #endif
1310 
1311 #ifndef SSD1306_INVERTDISPLAY
1312 #define SSD1306_INVERTDISPLAY (167)
1313 #endif
1314 
1315 #ifndef SSD1306_DISPLAYOFF
1316 #define SSD1306_DISPLAYOFF (174)
1317 #endif
1318 
1319 #ifndef SSD1306_DISPLAYON
1320 #define SSD1306_DISPLAYON (175)
1321 #endif
1322 
1323 #ifndef SSD1306_SETDISPLAYOFFSET
1324 #define SSD1306_SETDISPLAYOFFSET (211)
1325 #endif
1326 
1327 #ifndef SSD1306_SETCOMPINS
1328 #define SSD1306_SETCOMPINS (218)
1329 #endif
1330 
1331 #ifndef SSD1306_SETVCOMDETECT
1332 #define SSD1306_SETVCOMDETECT (219)
1333 #endif
1334 
1335 #ifndef SSD1306_SETDISPLAYCLOCKDIV
1336 #define SSD1306_SETDISPLAYCLOCKDIV (213)
1337 #endif
1338 
1339 #ifndef SSD1306_SETPRECHARGE
1340 #define SSD1306_SETPRECHARGE (217)
1341 #endif
1342 
1343 #ifndef SSD1306_SETMULTIPLEX
1344 #define SSD1306_SETMULTIPLEX (168)
1345 #endif
1346 
1347 #ifndef SSD1306_SETLOWCOLUMN
1348 #define SSD1306_SETLOWCOLUMN (0)
1349 #endif
1350 
1351 #ifndef SSD1306_SETHIGHCOLUMN
1352 #define SSD1306_SETHIGHCOLUMN (16)
1353 #endif
1354 
1355 #ifndef SSD1306_SETSTARTLINE
1356 #define SSD1306_SETSTARTLINE (64)
1357 #endif
1358 
1359 #ifndef SSD1306_MEMORYMODE
1360 #define SSD1306_MEMORYMODE (32)
1361 #endif
1362 
1363 #ifndef SSD1306_COMSCANINC
1364 #define SSD1306_COMSCANINC (192)
1365 #endif
1366 
1367 #ifndef SSD1306_COMSCANDEC
1368 #define SSD1306_COMSCANDEC (200)
1369 #endif
1370 
1371 #ifndef SSD1306_SEGREMAP
1372 #define SSD1306_SEGREMAP (160)
1373 #endif
1374 
1375 #ifndef SSD1306_CHARGEPUMP
1376 #define SSD1306_CHARGEPUMP (141)
1377 #endif
1378 
1379 #ifndef SSD1306_EXTERNALVCC
1380 #define SSD1306_EXTERNALVCC (1)
1381 #endif
1382 
1383 
1384 // Scrolling #defines
1385 #ifndef SSD1306_ACTIVATE_SCROLL
1386 #define SSD1306_ACTIVATE_SCROLL (47)
1387 #endif
1388 
1389 #ifndef SSD1306_DEACTIVATE_SCROLL
1390 #define SSD1306_DEACTIVATE_SCROLL (46)
1391 #endif
1392 
1393 #ifndef SSD1306_SET_VERT_SCROLL_AREA
1394 #define SSD1306_SET_VERT_SCROLL_AREA (163)
1395 #endif
1396 
1397 #ifndef SSD1306_RIGHT_HORIZ_SCROLL
1398 #define SSD1306_RIGHT_HORIZ_SCROLL (38)
1399 #endif
1400 
1401 #ifndef SSD1306_LEFT_HORIZ_SCROLL
1402 #define SSD1306_LEFT_HORIZ_SCROLL (39)
1403 #endif
1404 
1405 #ifndef SSD1306_VERTRIGHTHORIZSCROLL
1406 #define SSD1306_VERTRIGHTHORIZSCROLL (41)
1407 #endif
1408 
1409 #ifndef SSD1306_VERTLEFTHORIZSCROLL
1410 #define SSD1306_VERTLEFTHORIZSCROLL (42)
1411 #endif
1412 
1413 #ifndef LCD_BUFFER_SIZE_BOTH_TYPES
1414 #define LCD_BUFFER_SIZE_BOTH_TYPES (1024)
1415 #endif
1416 
1417 #ifndef SSD1306_SWITCHCAPVCC
1418 #define SSD1306_SWITCHCAPVCC (2)
1419 #endif
1420 
1421 #ifndef TYPE_128X32
1422 #define TYPE_128X32 (32)
1423 #endif
1424 
1425 #ifndef TYPE_128X64
1426 #define TYPE_128X64 (64)
1427 #endif
1428 
1429 
1430 typedef volatile struct screen {
1431  volatile int cog;
1432  volatile int command;
1433  volatile int CS;
1434  volatile int DC;
1435  volatile int DATA;
1436  volatile int CLK;
1437  volatile int RST;
1438  volatile int vccstate;
1439  volatile int displayWidth;
1440  volatile int displayHeight;
1441  volatile int displayType;
1442  volatile int AutoUpdate;
1443  volatile uint8_t buffer[LCD_BUFFER_SIZE_BOTH_TYPES];
1444  volatile int charSize;
1445  volatile int crsrX;
1446  volatile int crsrY;
1447 } screen;
1448 
1449 
1450 extern uint8_t oleddat[];
1451 
1452 void screen_string8x2(char *str, int32_t len, int32_t row, int32_t col);
1453 void screen_string16x4( char *str, int len, int row, int col);
1454 void screen_char32x16( int ch, int row, int col);
1455 void screen_char7x5( int ch, int row, int col);
1456 
1457 int screen_HIGH( int Pin);
1458 int screen_LOW( int Pin);
1459 int32_t screen_swap( int32_t a, int32_t b);
1460 int screen_AutoUpdateOn( void );
1461 int screen_AutoUpdateOff( void );
1462 
1463 void ee_displayIndex(int start, int end, int increment);
1464 void stringView(char *s, int ssize);
1465 int sscan_ct(const char *str, const char *fmt, ...);
1466 int _doscanf_ct(const char* str, const char *fmt, va_list args);
1467 int ir_receive(char *s, int ssize);
1468 void ir_start(void);
1469 void ir_stop(void);
1470 void ee_badgeCheck(void);
1471 int light_start( void );
1472 int touch_start(int count, unsigned char *p_pins, int dms);
1473 
1474 int screen_GetDisplayHeight( void );
1475 int screen_GetDisplayWidth( void );
1476 int screen_GetDisplayType( void );
1477 int screen_ssd1306_Command( int thecmd);
1478 int screen_ssd1306_Data( int thedata);
1479 int screen_getSplash( void );
1480 int screen_SHIFTOUT( int Dpin, int Cpin, int CSpin, int Bits, int Value);
1481 int screen_WRITEBUFF( int Dpin, int Cpin, int CSpin, int Bits, int Addr);
1482 int screen_init( int ChipSelect, int DataCommand, int TheData, int TheClock, int Reset, int VCC_state, int Type);
1483 void screen_string8x2(char *str, int32_t len, int32_t row, int32_t col);
1484 void screen_string16x4( char *str, int len, int row, int col);
1485 
1486 int screen_getBuffer( void );
1487 int screen_start( void );
1488 int screen_stop( void );
1489 
1490 void screen_char32x16( int ch, int row, int col);
1491 void screen_char7x5( int ch, int row, int col);
1492 
1493 
1494 int get_bit(int bitNum, int val);
1495 void set_bit(int bitNum, int *val);
1496 void clear_bit(int bitNum, int *val);
1497 
1498 
1499 #ifdef __GNUC__
1500 #define INLINE__ static inline
1501 #define Yield__() __asm__ volatile( "" ::: "memory" )
1502 #define PostEffect__(X, Y) __extension__({ int32_t tmp__ = (X); (X) = (Y); tmp__; })
1503 #else
1504 #define INLINE__ static
1505 static int32_t tmp__;
1506 #define PostEffect__(X, Y) (tmp__ = (X), (X) = (Y), tmp__)
1507 #define Yield__()
1508 #define waitcnt(n) _waitcnt(n)
1509 #define coginit(id, code, par) _coginit((unsigned)(par)>>2, (unsigned)(code)>>2, id)
1510 #define cognew(code, par) coginit(0x8, (code), (par))
1511 #define cogstop(i) _cogstop(i)
1512 #endif
1513 
1514 INLINE__ int32_t Min__(int32_t a, int32_t b) { return a < b ? a : b; }
1515 INLINE__ int32_t Max__(int32_t a, int32_t b) { return a > b ? a : b; }
1516 INLINE__ int32_t Shr__(uint32_t a, uint32_t b) { return (a>>b); }
1517 INLINE__ int32_t Rotl__(uint32_t a, uint32_t b) { return (a<<b) | (a>>(32-b)); }
1518 INLINE__ int32_t Rotr__(uint32_t a, uint32_t b) { return (a>>b) | (a<<(32-b)); }
1519 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]; }
1520 
1521 
1526 #endif // DOXYGEN_SHOULD_SKIP_THIS
1527 
1528 
1529 #if defined(__cplusplus)
1530 }
1531 #endif
1532 /* __cplusplus */
1533 #endif
1534 /* SIMPLETOOLS_H */
1535 
1536 
1537 /*
1538 #ifdef __GNUC__
1539 #define INLINE__ static inline
1540 #define PostEffect__(X, Y) __extension__({ int tmp__ = (X); (X) = (Y); tmp__; })
1541 #else
1542 #define INLINE__ static
1543 static int tmp__;
1544 #define PostEffect__(X, Y) (tmp__ = (X), (X) = (Y), tmp__)
1545 #define waitcnt(n) _waitcnt(n)
1546 #define coginit(id, code, par) _coginit((unsigned)(par)>>2, (unsigned)(code)>>2, id)
1547 #define cognew(code, par) coginit(0x8, (code), (par))
1548 #define cogstop(i) _cogstop(i)
1549 #endif
1550 
1551 __asm__ volatile( " .global __clkfreqval\n" );
1552 __asm__ volatile( " __clkfreqval = 0x4c4b400\n" );
1553 __asm__ volatile( " .global __clkmodeval\n" );
1554 __asm__ volatile( " __clkmodeval = 0x6f\n" );
1555 */
1556 
1557 
1558 /*
1559  TERMS OF USE: MIT License
1560 
1561  Permission is hereby granted, free of charge, to any person obtaining a
1562  copy of this software and associated documentation files (the "Software"),
1563  to deal in the Software without restriction, including without limitation
1564  the rights to use, copy, modify, merge, publish, distribute, sublicense,
1565  and/or sell copies of the Software, and to permit persons to whom the
1566  Software is furnished to do so, subject to the following conditions:
1567 
1568  The above copyright notice and this permission notice shall be included in
1569  all copies or substantial portions of the Software.
1570 
1571  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1572  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1573  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
1574  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1575  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1576  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1577  DEALINGS IN THE SOFTWARE.
1578 */
1579 
1580 
ee_writeByte
void ee_writeByte(unsigned char value, int addr)
Store a byte value at a certain address in the Propeller Chip's dedicated EEPROM.
Definition: peb_ee_writeByte.c:13
line
void line(int x0, int y0, int x1, int y1, int c)
Plot a line on the oLED screen.
jm_ir_hdserial
Definition: badgetools.h:1526
cursor
void cursor(int col, int row)
Position the cursor to a certain column and row for printing text on the oLED display....
Definition: oled_cursor.c:7
contacts_displayAll
void contacts_displayAll()
Display all contacts in SimpleIDE Terminal.
Definition: peb_contacts_displayAll.c:12
invert
void invert(int i)
Invert (or not) the pixel colors in the display. Use invert(0) for white pixels on a black background...
Definition: oled_invert.c:7
stored
int stored(char *s)
Check if a string has already been stored in EEPROM. Example: if(!stored("abcd")) store("abcd");.
Definition: peb_already_stored.c:12
led_pwm_start
void led_pwm_start(void)
Start the PWM driver for the discrete LEDs. Uses a cog.
Definition: led_pwm.c:61
button
char button(char b)
Gets the state of a touch button/ nav slider (1) pressed, (0) not pressed. Numbering {7,...
Definition: buttons.c:57
contacts_eraseAll
void contacts_eraseAll()
Erases user portion of EEPROM by placing 255 in each cell. This erasure affects addresses 32768 thr...
Definition: peb_contacts_eraseAll.c:12
clear
int clear(void)
Clear the display.
Definition: oled_clear.c:7
accel
int accel(int axis)
Measures acceleration and tilt on one of 3 axes (AX, AY, or AZ) in terms of centigravity (cg) units,...
Definition: accelerometer.c:42
triangle
void triangle(int x0, int y0, int x1, int y1, int x2, int y2, int c)
Plot a triangle on the oLED screen.
circle
void circle(int x0, int y0, int r, int c)
Plot a circle on the oLED screen.
text_size
void text_size(int size)
Set the text size to either 32x16 pixel (LARGE) or 7x5 (SMALL) characters. Examples: text_size(LARGE)...
Definition: oled_text_size.c:7
screen_scrollLeft
int screen_scrollLeft(int scrollStart, int scrollStop)
Cause the screen to scroll to the left with screen_scrollLeft(0, 15).
boxFilled
void boxFilled(int x0, int y0, int x1, int y1, int c)
Plot a filled box on the oLED screen.
string
void string(char *str)
Display a character string on the oLED display.
Definition: oled_string.c:7
receive
int receive(char *s)
Receive a character string from another badge.
Definition: peb_ir_receive.c:6
ir_receive
int ir_receive(char *s, int ssize)
Receive a string with a specified maxiumum number of characters over IR.
Definition: peb_ir_receive.c:31
screen_update
int screen_update(void)
Manually update the screen image after. Typically used after multiple oLED function calls after scree...
Definition: oled_asmfast.c:426
box
void box(int x0, int y0, int x1, int y1, int c)
Plot a box on the oLED screen.
oledprint
int oledprint(const char *fmt,...)
Use to display strings on the oLED display in a manner similar to displaying combinations of strings ...
Definition: peb_text.c:4
ee_readByte
char ee_readByte(int addr)
Get a byte value from a certain address in the Propeller Chip's dedicated EEPROM.
Definition: peb_ee_readByte.c:13
screen_scrollRight
int screen_scrollRight(int scrollStart, int scrollStop)
Cause the screen to scroll to the right with screen_scrollRight(0, 15).
led_pwm_stop
void led_pwm_stop(void)
Stop the PWM driver for the discrete LEDs. Frees the cog used by the driver.
Definition: led_pwm.c:65
screen_auto
void screen_auto(int state)
Cause function calls like oledprint, point, and others to appear immediately after the function is ca...
Definition: oled_auto.c:7
eescan
int eescan(int recIdx, const char *fmt,...)
Use to retrieve strings to EEPROM in a manner similar to retrieving strings that represent combinatio...
Definition: peb_eescan.c:12
simpletools.h
This library provides convenient functions for a variety of microcontroller I/O, timing,...
ee_readStr
char * ee_readStr(unsigned char *s, int n, int addr)
Fetch a string of byte values starting at a certain address in Propeller Chip's dedicated EEPROM.
Definition: peb_ee_readStr.c:13
irscan
int irscan(const char *fmt,...)
Use to receive strings over IR from another badge in a manner similar to retrieving strings that repr...
Definition: peb_irscan.c:4
accels
void accels(int *x, int *y, int *z)
Measures acceleration and tilt on all 3 axes (x, y, and z) in terms of centigravity (cg) units,...
Definition: accelerometer.c:56
badge_setup
int badge_setup(void)
Set up all available badge drivers. Call this function at the start of any given program to allow acc...
Definition: badgealpha.c:29
triangleFilled
void triangleFilled(int x0, int y0, int x1, int y1, int x2, int y2, int c)
Plot a filled triangle on the oLED screen.
shape
void shape(char *img, int bw, int xtl, int ytl, int xpics, int ypics)
Place a shape defined by a char array of pixels on the oLED display. See 11 Shapes to Display....
Definition: peb_shape.c:6
rotate180
void rotate180()
Rotate the screen image 180 degrees. See 05 Display Upside- Down.side for example.
Definition: peb_image180.c:6
ir_send
void ir_send(char *s, int ssize)
Transmits a string with a specified number of characters over IR.
Definition: peb_ir_send.c:11
irprint
int irprint(const char *fmt,...)
Use to store transmit strings to another badge in a manner similar to displaying combinations of stri...
Definition: peb_irprint.c:4
circleFilled
void circleFilled(int x0, int y0, int r, int c)
Plot a filled circle on the oLED screen.
screen_scrollRightDiag
int screen_scrollRightDiag(int scrollStart, int scrollStop)
Cause the screen to scroll diagonally to the right with screen_scrollRightDiag(0, 15).
touch_sensitivity_set
void touch_sensitivity_set(char sens)
Used to set the RC time threshold used to detect a button press on the A and B touchpads on the back ...
Definition: buttons.c:66
accel_shaken
int accel_shaken(void)
Check if accelerometer was shaken recently, within the last half second.
Definition: accel_shaken.c:15
led_pwm_set
void led_pwm_set(char side, char level)
Set the brightness of the two discrete LEDs.
Definition: led_pwm.c:34
irclear
void irclear(void)
Clear the infrared send/receive buffers. The most common use of this function is to clear any stray m...
Definition: peb_irclear.c:4
count
long count(int pin, long duration)
Count number of low to high transitions an external input applies to an I/O pin over a certain period...
Definition: count.c:19
ee_readShort
short ee_readShort(int addr)
Get a short value from a certain address in the Propeller Chip's dedicated EEPROM....
Definition: peb_ee_readShort.c:13
ee_writeInt
void ee_writeInt(int value, int addr)
Store an int value at a certain address in the Propeller Chip's dedicated EEPROM. An int value occupi...
Definition: peb_ee_writeInt.c:13
x
int x
Definition: 07 Box and Lines.c:13
retrieve
void retrieve(char *contact, int recIdx)
Copy string with a certain index number from EEPROM to a character array.
Definition: peb_retrieve.c:12
send
int send(char *s)
Send a character string to another badge. Example: char s[] = "Hello other badge"; send(s);.
Definition: peb_ir_send.c:4
screen_scrollLeftDiag
int screen_scrollLeftDiag(int scrollStart, int scrollStop)
Cause the screen to scroll diagonally to the left with screen_scrollLeftDiag(0, 15).
point
void point(int x, int y, int color)
Plot a point on the oLED screen.
screen_getAuto
int screen_getAuto()
Check if function calls like oledprint, point, and others are set to appear (1) immediately after the...
Definition: oled_getAuto.c:7
screen_image
void screen_image(char *imgaddr)
Display an image using an array holding an image generated by software that is compatible with the sc...
Definition: peb_screen_image.c:6
contacts_setStartAddr
void contacts_setStartAddr(int address)
Set the start address of the contacts. This can be used to reserve some user EEPROM space for other p...
Definition: peb_contacts_setStartAddr.c:12
ee_writeFloat32
void ee_writeFloat32(float fpVal, int addr)
Store a 32-bit precision floating point value at a certain address in the Propeller Chip's dedicated ...
Definition: peb_ee_writeFloat32.c:13
contacts_count
int contacts_count()
Find out how many contacts are currently stored in EEPROM. This is useful for setting up a loop to fe...
Definition: peb_contacts_count.c:11
eeprinted
int eeprinted(const char *fmt,...)
Can be called before storing a record with eeprint. Example: if(!eeprinted("Hello EEPROM") eeprint("H...
Definition: peb_eeprinted.c:12
buttons
unsigned char buttons(void)
Gets the states of all eight touch buttons and nav sliders, and returns them in a value with 1s and 0...
Definition: jm_touchpads.c:90
screen_scrollStop
int screen_scrollStop(void)
Stop screen scrolling action.
Definition: oled_scrollStop.c:7
eeprint
int eeprint(const char *fmt,...)
Use to store strings to EEPROM in a manner similar to displaying combinations of strings and variable...
Definition: peb_eeprint.c:12
ee_readInt
int ee_readInt(int addr)
Get an int value from a certain address in the Propeller Chip's dedicated EEPROM. If you are fetching...
Definition: peb_ee_readInt.c:13
dev_ee_show
void dev_ee_show(int byteCount, int address)
Display EEPROM contents as a combination of printable characters and numeric values (when not printab...
Definition: peb_dev_ee_show.c:12
ee_writeStr
void ee_writeStr(char *s, int n, int addr)
Store a string of byte values starting at a certain address in the Propeller Chip's dedicated EEPROM.
Definition: peb_ee_writeStr.c:13
ee_readFloat32
float ee_readFloat32(int addr)
Fetch a 32-bit precision floating point value from a certain address in the Propeller Chip's dedicate...
Definition: peb_ee_readFloat32.c:13
store
int store(char *contact)
Store a character string of up to 128 characters to EEPROM. Example: char s[] = "abcd"; store(s);.
Definition: peb_store.c:12
ee_writeShort
void ee_writeShort(short value, int addr)
Store a short value at a certain address in the Propeller Chip's dedicated EEPROM....
Definition: peb_ee_writeShort.c:13
screen
Definition: badgetools.h:1709