![]() |
PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
|
This library provides convenient functions for a variety of Parallax eBadge operations.
More...
Go to the source code of this file.
Classes | |
struct | jm_ir_hdserial |
struct | screen |
Macros | |
LEDs | |
#define | ON 1 |
For turning blue LEDs on. Example: led(0, ON) would turn the LED by the P27 label on. | |
#define | OFF 0 |
For turning off blue or RGB LEDs. Examples: led(1, OFF), would turn the LED by the P26 label off. rgb(L, OFF) would turn off the left rgb LED, and rgbs(OFF, OFF) would turn off the left and right RGB LEDs. | |
Functions | |
int | badge_setup (void) |
Set up all available badge drivers. Call this function at the start of any given program to allow access to ensure that the rest of this library's functions work properly. More... | |
Touch Buttons | |
char | button (char b) |
Gets the state of a touch button/ nav slider (1) pressed, (0) not pressed. Numbering {7, 6, 5, 4, 3, 2, 1} maps the pads/positions by [L touch][L NAV left][L NAV ctr][L NAV right][R NAV left][R NAV ctr][R NAV right][R touch]. Example: int state = button(3); If state stores 1, it means the right nav slider is pressed down. If it instead stores 0, the slider is not pressed/slid. More... | |
unsigned char | buttons (void) |
Gets the states of all eight touch buttons and nav sliders, and returns them in a value with 1s and 0s that correspond to each pad/position. Example: int states = buttons(); If states stores 0b10000010, it means: {left touchpad (B) pressed, left nav slider not in any position, right nav slider held right, right touchpad (A) not pressed}. More... | |
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 of the BadgeWX's PCB. Range is from 0 (low sensitivity) to 15 (high sensitivity). Default is 7. | |
Contact Storage | |
int | store (char *contact) |
Store a character string of up to 128 characters to EEPROM. Example: char s[] = "abcd"; store(s);. More... | |
int | stored (char *s) |
Check if a string has already been stored in EEPROM. Example: if(!stored("abcd")) store("abcd");. More... | |
void | retrieve (char *contact, int recIdx) |
Copy string with a certain index number from EEPROM to a character array. More... | |
int | eeprint (const char *fmt,...) |
Use to store strings to EEPROM in a manner similar to displaying combinations of strings and variables in the SimpleIDE terminal with the print function. Examples: eeprint("Hello EEPROM"); float f = PI; int n = 4s; char s[] = "PI and answer to universe"; eeprint("%1.3f\n%03d\n
%30s\n", f, n, s); // Result to EEPROM: "Hello EEPROM"[0]"3.141"[10]"042" [10]"PI and answer to universe"[10][0]. This information can be conveniently retrieved back from EEPROM and placed in variables with the eescan function. More... | |
int | eeprinted (const char *fmt,...) |
Can be called before storing a record with eeprint. Example: if(!eeprinted("Hello EEPROM") eeprint("Hello EEPROM");. More... | |
int | eescan (int recIdx, const char *fmt,...) |
Use to retrieve strings to EEPROM in a manner similar to retrieving strings that represent combinations of strings and variables from the SimpleIDE terminal with the scan function. Examples: This example will retrieve the what the eeprint examples stored in EEPROM: char s1[14]; eescan(1, "%s", s1); float f; int n; char s2[30]; eescan("%f%d%s", f, n, s2); // Result: s1 = "Hello EEPROM", f = 3.141, n = 42, s2 = "PI and
answer to universe". More... | |
int | contacts_count () |
Find out how many contacts are currently stored in EEPROM. This is useful for setting up a loop to fetch all contacts. More... | |
void | contacts_eraseAll () |
Erases user portion of EEPROM by placing 255 in each cell. This erasure affects addresses 32768 through 65535. | |
void | contacts_displayAll () |
Display all contacts in SimpleIDE Terminal. | |
void | contacts_setStartAddr (int address) |
Set the start address of the contacts. This can be used to reserve some user EEPROM space for other purposes before the start of the contacts. More... | |
void | ee_writeByte (unsigned char value, int addr) |
Store a byte value at a certain address in the Propeller Chip's dedicated EEPROM. More... | |
char | ee_readByte (int addr) |
Get a byte value from a certain address in the Propeller Chip's dedicated EEPROM. More... | |
void | ee_writeShort (short value, int addr) |
Store a short value at a certain address in the Propeller Chip's dedicated EEPROM. A short value occupies two bytes, so the next value should be stored at an address value that's two bytes higher. More... | |
short | ee_readShort (int addr) |
Get a short value from a certain address in the Propeller Chip's dedicated EEPROM. If you are fetching several short values, make sure to add 2 to the addr value with each successive call. More... | |
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 occupies four bytes, so the next value should be stored at an address value that's four bytes higher. More... | |
int | ee_readInt (int addr) |
Get an int value from a certain address in the Propeller Chip's dedicated EEPROM. If you are fetching several int values, make sure to add 4 to the addr value with each successive call. More... | |
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 EEPROM. A 32-bit value occupies four bytes so if you are storing values in a sequence, make sure to add 4 to each addr parameter value. More... | |
float | ee_readFloat32 (int addr) |
Fetch a 32-bit precision floating point value from a certain address in the Propeller Chip's dedicated EEPROM. A 32-bit value occupies four bytes so if you are fetching values in a sequence, make sure to add 4 to each addr parameter value. More... | |
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. More... | |
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. More... | |
void | led_pwm_start (void) |
Start the PWM driver for the discrete LEDs. Uses a cog. | |
void | led_pwm_stop (void) |
Stop the PWM driver for the discrete LEDs. Frees the cog used by the driver. | |
void | led_pwm_set (char side, char level) |
Set the brightness of the two discrete LEDs. More... | |
Infrared Communication | |
int | send (char *s) |
Send a character string to another badge. Example: char s[] = "Hello other badge"; send(s);. More... | |
int | receive (char *s) |
Receive a character string from another badge. More... | |
void | irclear (void) |
Clear the infrared send/receive buffers. The most common use of this function is to clear any stray messages that my have arrived before receiving a contact from another badge. | |
int | irprint (const char *fmt,...) |
Use to store transmit strings to another badge in a manner similar to displaying combinations of strings and variables in the SimpleIDE terminal with the print function. Examples: irprint("Hello eBadge"); float f = PI; int n = 4s; char s[] = "PI and answer to universe"; irprint("%1.3f\n%03d\n %30s\n", f, n, s); // Result to other badge: "Hello EEPROM"[0]"3.141"[10]"042"[10]"PI and answer to universe"[10][0]. This information can be conveniently received by the other badge using the irscan function. More... | |
int | irscan (const char *fmt,...) |
Use to receive strings over IR from another badge in a manner similar to retrieving strings that represent combinations of strings and variables from the SimpleIDE terminal with the scan function. Examples: This example will retrieve what the irprint examples transmitted to the other badge: char s1[14]; eescan(1, "%s", s1); float f; int n; char s2[30]; eescan("%f%d%s", f, n, s2); // Result: s1 = "Hello EEPROM", f = 3.141, n = 42, s2 = "PI and answer to universe". More... | |
void | ir_send (char *s, int ssize) |
Transmits a string with a specified number of characters over IR. More... | |
int | ir_receive (char *s, int ssize) |
Receive a string with a specified maxiumum number of characters over IR. More... | |
oLED Screen Display (Basics) | |
int | oledprint (const char *fmt,...) |
Use to display strings on the oLED display in a manner similar to displaying combinations of strings and variables in the SimpleIDE terminal with the print function. Example: oledprint("Hello!!!"); text_size(SMALL); cursor(0, 4); float f = PI; int n = 4s; char s[] = "PI and Universe"; oledprint("%1.3f, %03d\n%30s", f, n, s); // Result to oLED display: Upper half large print by default - Hello!!! Small print line 4: 1.414, 042 Line 5 "PI and Universe". More... | |
void | text_size (int size) |
Set the text size to either 32x16 pixel (LARGE) or 7x5 (SMALL) characters. Examples: text_size(LARGE);...text_size(SMALL)...text_size(LARGE). More... | |
void | cursor (int col, int row) |
Position the cursor to a certain column and row for printing text on the oLED display. Column can be 0 to 7 and row can be 0 or 1 in default LARGE text mode. In SMALL text mode, column can be 0 to 31, and row can be 0 to 7. More... | |
void | string (char *str) |
Display a character string on the oLED display. More... | |
int | clear (void) |
Clear the display. More... | |
void | invert (int i) |
Invert (or not) the pixel colors in the display. Use invert(0) for white pixels on a black background, or invert(1) for black pixels on a white background. | |
void | point (int x, int y, int color) |
Plot a point on the oLED screen. More... | |
void | line (int x0, int y0, int x1, int y1, int c) |
Plot a line on the oLED screen. More... | |
void | box (int x0, int y0, int x1, int y1, int c) |
Plot a box on the oLED screen. More... | |
void | boxFilled (int x0, int y0, int x1, int y1, int c) |
Plot a filled box on the oLED screen. More... | |
void | triangle (int x0, int y0, int x1, int y1, int x2, int y2, int c) |
Plot a triangle on the oLED screen. More... | |
void | triangleFilled (int x0, int y0, int x1, int y1, int x2, int y2, int c) |
Plot a filled triangle on the oLED screen. More... | |
void | circle (int x0, int y0, int r, int c) |
Plot a circle on the oLED screen. More... | |
void | circleFilled (int x0, int y0, int r, int c) |
Plot a filled circle on the oLED screen. More... | |
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.side for example. More... | |
void | rotate180 () |
Rotate the screen image 180 degrees. See 05 Display Upside- Down.side for example. | |
void | screen_auto (int state) |
Cause function calls like oledprint, point, and others to appear immediately after the function is called with screen_auto(1). To make multiple changes before manually updating with a call to screen_update, use screen_auto(0). See 04 Screen Auto ON OFF.side for example. More... | |
int | screen_getAuto () |
Check if function calls like oledprint, point, and others are set to appear (1) immediately after the function is called or (0) if multiple changes are made before manually updating with a call to screen_update. More... | |
int | screen_update (void) |
Manually update the screen image after. Typically used after multiple oLED function calls after screen_auto(0). See 04 Screen Auto ON OFF.side for example. More... | |
oLED Screen Display (Intermediate) | |
int | screen_scrollRight (int scrollStart, int scrollStop) |
Cause the screen to scroll to the right with screen_scrollRight(0, 15). More... | |
int | screen_scrollLeft (int scrollStart, int scrollStop) |
Cause the screen to scroll to the left with screen_scrollLeft(0, 15). More... | |
int | screen_scrollRightDiag (int scrollStart, int scrollStop) |
Cause the screen to scroll diagonally to the right with screen_scrollRightDiag(0, 15). More... | |
int | screen_scrollLeftDiag (int scrollStart, int scrollStop) |
Cause the screen to scroll diagonally to the left with screen_scrollLeftDiag(0, 15). More... | |
int | screen_scrollStop (void) |
Stop screen scrolling action. More... | |
void | screen_image (char *imgaddr) |
Display an image using an array holding an image generated by software that is compatible with the screen's scanning. See 12 Image to Display.side for an example. More... | |
Misc | |
void | dev_ee_show (int byteCount, int address) |
Display EEPROM contents as a combination of printable characters and numeric values (when not printable) in square brackets [], See 02 View First and Last 64 Bytes with Terminal.side for example. More... | |
Accelerometer | |
#define | SCR_BLACK (0) |
Sets an oLED screen pixel to black. Example: point(27, 35, SCR_BLACK) sets a pixel 27 from the right and 35 down to black. | |
#define | SCR_WHITE (1) |
Sets an oLED screen pixel to white. Example: point(100, 50, SCR_WHITE) sets a pixel 100 from the right and 50 down to white. | |
#define | SCR_XOR (3) |
Applies XOR operation to pixels in a shape. Example: shape(frog, XOR, 36, 12, 30, 40) would invert the pixels in the frog shape array. the black pixels would be made white and vice-versa. | |
#define | LARGE 1 |
For setting oLED character size to 32x16 pixels. Example: text_size(LARGE). | |
#define | SMALL 0 |
For setting oLED character size to 7x5 pixels. Example: text_size(SMALL). | |
#define | AY 0 |
For choosing the accelerometer's y-axis. Example accel(AY) returns the component of the earth's gravitational field acting on the accelerometer's y-axis. | |
#define | AX 1 |
For choosing the accelerometer's x-axis. Example accel(AX) returns the component of the earth's gravitational field acting on the accelerometer's x-axis. | |
#define | AZ 2 |
For choosing the accelerometer's z-axis. Example accel(AZ) returns the component of the earth's gravitational field acting on the accelerometer's z-axis. | |
int | accel (int axis) |
Measures acceleration and tilt on one of 3 axes (AX, AY, or AZ) in terms of centigravity (cg) units, which is 100ths of 1 gravity (1 g). With the badge laying flat on a table, the AX is left/right, AY is forward/backward, and AZ is up/down. Example: int x = accel(AX) copies the accelerometer measurement into the x variable. The result will be 0 if held flat, and could go as high as +100 if held on its left edge, or -100 if held on its right edge. Note, the accelerometer's actual resolution is in 64ths of a 1 g. More... | |
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, which is 100ths of 1 gravity (1 g). More... | |
int | accel_shaken (void) |
Check if accelerometer was shaken recently, within the last half second. More... | |
Private (used by badgetools library) | |
#define | RGB_PIN (10) |
#define | LED_PIN (9) |
#define | NAV_L (13) |
#define | NAV_C (12) |
#define | NAV_R (11) |
#define | NAV_COM_L (14) |
#define | NAV_COM_R (15) |
#define | NAV_TOUCH_L (4) |
#define | NAV_TOUCH_R (2) |
#define | IR_BAUD (2400) |
#define | IR_FREQ (36000) |
#define | IR_OUT (3) |
#define | IR_IN (23) |
#define | OLED_DAT (21) |
#define | OLED_CLK (20) |
#define | OLED_DC (22) |
#define | OLED_RST (19) |
#define | OLED_CS (18) |
#define | TV_DAC2 (26) |
#define | TV_DAC1 (25) |
#define | TV_DAC0 (24) |
#define | AUD_RT (1) |
#define | AUD_LF (0) |
#define | STX 2 |
#define | ETX 3 |
#define | LCD_BUFFER_SIZE_BOTH_TYPES (1024) |
#define | SSD1306_SWITCHCAPVCC (2) |
#define | TYPE_128X32 (32) |
#define | TYPE_128X64 (64) |
#define | EE_BADGE_DATA_START 32768 |
#define | EE_BADGE_DATA_END 65536 - 4 |
#define | XOUT 0 |
#define | YOUT 1 |
#define | ZOUT 2 |
#define | TILT 3 |
#define | SRST 4 |
#define | SPCNT 5 |
#define | INTSU 6 |
#define | MODE 7 |
#define | SR 8 |
#define | PDET 9 |
#define | PD 10 |
#define | MMA7660_I2C 0b1001100 |
#define | ALERT_BIT 0b01000000 |
#define | ALERT_XYZT 0x40404040 |
#define | BUF_SIZE (128) |
#define | BUF_MASK ((BUF_SIZE - 1)) |
#define | SSD1306_LCDWIDTH (128) |
#define | SSD1306_LCDHEIGHT32 (32) |
#define | SSD1306_LCDHEIGHT64 (64) |
#define | SSD1306_LCDCHARMAX (8) |
#define | SSD1306_SETCONTRAST (129) |
#define | SSD1306_DISPLAYALLON_RESUME (164) |
#define | SSD1306_DISPLAYALLON (165) |
#define | SSD1306_NORMALDISPLAY (166) |
#define | SSD1306_INVERTDISPLAY (167) |
#define | SSD1306_DISPLAYOFF (174) |
#define | SSD1306_DISPLAYON (175) |
#define | SSD1306_SETDISPLAYOFFSET (211) |
#define | SSD1306_SETCOMPINS (218) |
#define | SSD1306_SETVCOMDETECT (219) |
#define | SSD1306_SETDISPLAYCLOCKDIV (213) |
#define | SSD1306_SETPRECHARGE (217) |
#define | SSD1306_SETMULTIPLEX (168) |
#define | SSD1306_SETLOWCOLUMN (0) |
#define | SSD1306_SETHIGHCOLUMN (16) |
#define | SSD1306_SETSTARTLINE (64) |
#define | SSD1306_MEMORYMODE (32) |
#define | SSD1306_COMSCANINC (192) |
#define | SSD1306_COMSCANDEC (200) |
#define | SSD1306_SEGREMAP (160) |
#define | SSD1306_CHARGEPUMP (141) |
#define | SSD1306_EXTERNALVCC (1) |
#define | SSD1306_ACTIVATE_SCROLL (47) |
#define | SSD1306_DEACTIVATE_SCROLL (46) |
#define | SSD1306_SET_VERT_SCROLL_AREA (163) |
#define | SSD1306_RIGHT_HORIZ_SCROLL (38) |
#define | SSD1306_LEFT_HORIZ_SCROLL (39) |
#define | SSD1306_VERTRIGHTHORIZSCROLL (41) |
#define | SSD1306_VERTLEFTHORIZSCROLL (42) |
#define | INLINE__ static |
#define | PostEffect__(X, Y) (tmp__ = (X), (X) = (Y), tmp__) |
#define | Yield__() |
#define | waitcnt(n) _waitcnt(n) |
#define | coginit(id, code, par) _coginit((unsigned)(par)>>2, (unsigned)(code)>>2, id) |
#define | cognew(code, par) coginit(0x8, (code), (par)) |
#define | cogstop(i) _cogstop(i) |
typedef struct jm_ir_hdserial | jm_ir_hdserial |
typedef volatile struct screen | screen |
uint8_t | oleddat [] |
static int32_t | tmp__ |
int32_t | ircom_start (int32_t rxd, int32_t txd, int32_t baud, int32_t freq) |
void | ircom_stop (void) |
int32_t | ircom_rx (void) |
int32_t | ircom_rxcheck (void) |
int32_t | ircom_rxtime (int32_t mslim) |
int32_t | ircom_rxflush (void) |
int32_t | ircom_tx (int32_t c) |
int32_t | ircom_str (char *p_zstr) |
int32_t | ircom_dec (int32_t value) |
int32_t | ircom_rjdec (int32_t val, int32_t width, int32_t pchar) |
int32_t | ircom_hex (int32_t value, int32_t digits) |
int32_t | ircom_tx_bin (int32_t value, int32_t digits) |
int32_t | ircom_txflush (void) |
void | led_pwm (void) |
void | init_MMA7660FC (void) |
void | ee_init (void) |
void | screen_string8x2 (char *str, int32_t len, int32_t row, int32_t col) |
void | screen_string16x4 (char *str, int len, int row, int col) |
void | screen_char32x16 (int ch, int row, int col) |
void | screen_char7x5 (int ch, int row, int col) |
int | screen_HIGH (int Pin) |
int | screen_LOW (int Pin) |
int32_t | screen_swap (int32_t a, int32_t b) |
int | screen_AutoUpdateOn (void) |
int | screen_AutoUpdateOff (void) |
void | ee_displayIndex (int start, int end, int increment) |
void | stringView (char *s, int ssize) |
int | sscan_ct (const char *str, const char *fmt,...) |
int | _doscanf_ct (const char *str, const char *fmt, va_list args) |
void | ir_start (void) |
void | ir_stop (void) |
void | ee_badgeCheck (void) |
int | light_start (void) |
int | touch_start (int count, unsigned char *p_pins, int dms) |
int | screen_GetDisplayHeight (void) |
int | screen_GetDisplayWidth (void) |
int | screen_GetDisplayType (void) |
int | screen_ssd1306_Command (int thecmd) |
int | screen_ssd1306_Data (int thedata) |
int | screen_getSplash (void) |
int | screen_SHIFTOUT (int Dpin, int Cpin, int CSpin, int Bits, int Value) |
int | screen_WRITEBUFF (int Dpin, int Cpin, int CSpin, int Bits, int Addr) |
int | screen_init (int ChipSelect, int DataCommand, int TheData, int TheClock, int Reset, int VCC_state, int Type) |
int | screen_getBuffer (void) |
int | screen_start (void) |
int | screen_stop (void) |
int | get_bit (int bitNum, int val) |
void | set_bit (int bitNum, int *val) |
void | clear_bit (int bitNum, int *val) |
INLINE__ int32_t | Min__ (int32_t a, int32_t b) |
INLINE__ int32_t | Max__ (int32_t a, int32_t b) |
INLINE__ int32_t | Shr__ (uint32_t a, uint32_t b) |
INLINE__ int32_t | Rotl__ (uint32_t a, uint32_t b) |
INLINE__ int32_t | Rotr__ (uint32_t a, uint32_t b) |
INLINE__ int32_t | Lookup__ (int32_t x, int32_t b, int32_t a[], int32_t n) |
This library provides convenient functions for a variety of Parallax eBadge operations.
Note: This is the early adopter version of a library that is fairly new and still a work-in-progress. If you find what you feel are errors or omissions that should be addressed in an upcoming revision, please email edito. r@pa ralla x.co m
To-do:
Definition in file badgewxtools.h.
struct jm_ir_hdserial |
Definition at line 1526 of file badgetools.h.
struct screen |
Definition at line 1709 of file badgetools.h.
int accel | ( | int | axis | ) |
Measures acceleration and tilt on one of 3 axes (AX, AY, or AZ) in terms of centigravity (cg) units, which is 100ths of 1 gravity (1 g). With the badge laying flat on a table, the AX is left/right, AY is forward/backward, and AZ is up/down. Example: int x = accel(AX) copies the accelerometer measurement into the x variable. The result will be 0 if held flat, and could go as high as +100 if held on its left edge, or -100 if held on its right edge. Note, the accelerometer's actual resolution is in 64ths of a 1 g.
axis | The AX, AY, or AZ sensing axis. |
Definition at line 42 of file accelerometer.c.
int accel_shaken | ( | void | ) |
Check if accelerometer was shaken recently, within the last half second.
Definition at line 15 of file accel_shaken.c.
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, which is 100ths of 1 gravity (1 g).
*x | Address of the variable for storing the x-axis measurement. |
*y | Address of the variable for storing the y-axis measurement. |
*z | Address of the variable for storing the z-axis measurement. |
Definition at line 56 of file accelerometer.c.
int badge_setup | ( | void | ) |
Set up all available badge drivers. Call this function at the start of any given program to allow access to ensure that the rest of this library's functions work properly.
A call to this function sets up these badge subsystems: oLED display, LED, RGB LED, touch buttons, accelerometer, infrared communication, and EEPROM storage. Example badge_setup().
Definition at line 29 of file badgealpha.c.
void box | ( | int | x0, |
int | y0, | ||
int | x1, | ||
int | y1, | ||
int | c | ||
) |
Plot a box on the oLED screen.
x0 | The x coordinate of one corner of the box. Measured as a number of pixels from left side of screen. The value increases from 0 (left) to 127 (right). |
y0 | The y coordinate of one corner of the box. Measured as a number of pixels from the top of the screen. The value increases from 0 (top) to 63 (bottom). |
x1 | The x coordinate of a corner diagonal from the first corner. |
y1 | The y coordinate of the corner diagonal from the first corner. |
c | The pixel color 1 for white, 0 for black. |
void boxFilled | ( | int | x0, |
int | y0, | ||
int | x1, | ||
int | y1, | ||
int | c | ||
) |
Plot a filled box on the oLED screen.
x0 | The x coordinate of one corner of the box. Measured as a number of pixels from left side of screen. The value increases from 0 (left) to 127 (right). |
y0 | The y coordinate of one corner of the box. Measured as a number of pixels from the top of the screen. The value increases from 0 (top) to 63 (bottom). |
x1 | The x coordinate of a corner diagonal from the first corner. |
y1 | The y coordinate of the corner diagonal from the first corner. |
c | The pixel color 1 for white, 0 for black. |
Gets the state of a touch button/ nav slider (1) pressed, (0) not pressed. Numbering {7, 6, 5, 4, 3, 2, 1} maps the pads/positions by [L touch][L NAV left][L NAV ctr][L NAV right][R NAV left][R NAV ctr][R NAV right][R touch].
Example: int state = button(3); If state stores 1, it means the right nav slider is pressed down. If it instead stores 0, the slider is not pressed/slid.
Definition at line 57 of file buttons.c.
unsigned char buttons | ( | void | ) |
Gets the states of all eight touch buttons and nav sliders, and returns them in a value with 1s and 0s that correspond to each pad/position. Example: int states = buttons(); If states stores 0b10000010, it means: {left touchpad (B) pressed, left nav slider not in any position, right nav slider held right, right touchpad (A) not pressed}.
Gets the states of all eight touch buttons and nav sliders, and returns them in a value with 1s and 0s that correspond to each pad/position. Example: int states = buttons(); If states stores 0b10000010, it means: {left touchpad (B) pressed, left nav slider not in any position, right nav slider held right, right touchpad (A) not pressed}.
Definition at line 90 of file jm_touchpads.c.
void circle | ( | int | x0, |
int | y0, | ||
int | r, | ||
int | c | ||
) |
Plot a circle on the oLED screen.
x0 | The x coordinate of the center of the circle. Measured as a number of pixels from left side of screen. The value increases from 0 (left) to 127 (right). |
y0 | The y coordinate of the center of the circle. Measured as a number of pixels from the top of the screen. The value increases from 0 (top) to 63 (bottom). |
r | The radius of the circle. |
c | The pixel color 1 for white, 0 for black. |
void circleFilled | ( | int | x0, |
int | y0, | ||
int | r, | ||
int | c | ||
) |
Plot a filled circle on the oLED screen.
x0 | The x coordinate of the center of the circle. Measured as a number of pixels from left side of screen. The value increases from 0 (left) to 127 (right). |
y0 | The y coordinate of the center of the circle. Measured as a number of pixels from the top of the screen. The value increases from 0 (top) to 63 (bottom). |
r | The radius of the circle. |
c | The pixel color 1 for white, 0 for black. |
int clear | ( | void | ) |
Clear the display.
Returns cursor to top-left 0, 0.
Definition at line 7 of file oled_clear.c.
int contacts_count | ( | ) |
Find out how many contacts are currently stored in EEPROM. This is useful for setting up a loop to fetch all contacts.
Definition at line 11 of file peb_contacts_count.c.
void contacts_setStartAddr | ( | int | address | ) |
Set the start address of the contacts. This can be used to reserve some user EEPROM space for other purposes before the start of the contacts.
address | EEPROM starting address for contact storage. |
Definition at line 12 of file peb_contacts_setStartAddr.c.
void cursor | ( | int | col, |
int | row | ||
) |
Position the cursor to a certain column and row for printing text on the oLED display. Column can be 0 to 7 and row can be 0 or 1 in default LARGE text mode. In SMALL text mode, column can be 0 to 31, and row can be 0 to 7.
col | the column (character position) from left. |
row | the row (line number) from top. |
Definition at line 7 of file oled_cursor.c.
void dev_ee_show | ( | int | byteCount, |
int | address | ||
) |
Display EEPROM contents as a combination of printable characters and numeric values (when not printable) in square brackets [], See 02 View First and Last 64 Bytes with Terminal.side for example.
byteCount | Number of bytes to display. |
address | Starting EEPROM address. |
Definition at line 12 of file peb_dev_ee_show.c.
char ee_readByte | ( | int | addr | ) |
Get a byte value from a certain address in the Propeller Chip's dedicated EEPROM.
addr | The EEPROM address that with the byte value that should be fetched. |
Definition at line 13 of file peb_ee_readByte.c.
float ee_readFloat32 | ( | int | addr | ) |
Fetch a 32-bit precision floating point value from a certain address in the Propeller Chip's dedicated EEPROM. A 32-bit value occupies four bytes so if you are fetching values in a sequence, make sure to add 4 to each addr parameter value.
Make sure that the Math box is checked in the Project Manager. In Simple View, click the Show Project Manager button in SimpleIDE's bottom-left corner. Then click the Linker tab, and check the Math Lib box.
addr | The EEPROM address with the 32-bit floating point float value that should be fetched. |
Definition at line 13 of file peb_ee_readFloat32.c.
int ee_readInt | ( | int | addr | ) |
Get an int value from a certain address in the Propeller Chip's dedicated EEPROM. If you are fetching several int values, make sure to add 4 to the addr value with each successive call.
addr | The EEPROM address with the int value that should be fetched. |
Definition at line 13 of file peb_ee_readInt.c.
short ee_readShort | ( | int | addr | ) |
Get a short value from a certain address in the Propeller Chip's dedicated EEPROM. If you are fetching several short values, make sure to add 2 to the addr value with each successive call.
addr | The EEPROM address with the int value that should be fetched. |
Definition at line 13 of file peb_ee_readShort.c.
Fetch a string of byte values starting at a certain address in Propeller Chip's dedicated EEPROM.
s | Address of a char array to receive the string of bytes fetched from EEPROM. |
n | The number of bytes to copy from EEPROM to the array. |
addr | The EEPROM address of the first byte in the string. |
Definition at line 13 of file peb_ee_readStr.c.
void ee_writeByte | ( | unsigned char | value, |
int | addr | ||
) |
Store a byte value at a certain address in the Propeller Chip's dedicated EEPROM.
value | The byte value to store in EEPROM. |
addr | The EEPROM address where the value is to be stored. |
Definition at line 13 of file peb_ee_writeByte.c.
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 EEPROM. A 32-bit value occupies four bytes so if you are storing values in a sequence, make sure to add 4 to each addr parameter value.
Make sure that the Math box is checked in the Project Manager. In Simple View, click the Show Project Manager button in SimpleIDE's bottom-left corner. Then click the Linker tab, and check the Math Lib box.
fpVal | The 32-bit floating point float value to store in EEPROM. |
addr | The EEPROM address where the value is to be stored. |
Definition at line 13 of file peb_ee_writeFloat32.c.
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 occupies four bytes, so the next value should be stored at an address value that's four bytes higher.
value | The int value to store in EEPROM. |
addr | The EEPROM address where the value is to be stored. |
Definition at line 13 of file peb_ee_writeInt.c.
void ee_writeShort | ( | short | value, |
int | addr | ||
) |
Store a short value at a certain address in the Propeller Chip's dedicated EEPROM. A short value occupies two bytes, so the next value should be stored at an address value that's two bytes higher.
value | The int value to store in EEPROM. |
addr | The EEPROM address where the value is to be stored. |
Definition at line 13 of file peb_ee_writeShort.c.
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.
s | Address of a char array containing the string of bytes. |
n | The number of bytes to copy from the array. |
addr | The EEPROM address of the first byte in the string. |
Definition at line 13 of file peb_ee_writeStr.c.
int eeprint | ( | const char * | fmt, |
... | |||
) |
Use to store strings to EEPROM in a manner similar to displaying combinations of strings and variables in the SimpleIDE terminal with the print function. Examples: eeprint("Hello EEPROM"); float f = PI; int n = 4s; char s[] = "PI and answer to universe"; eeprint("%1.3f\n%03d\n %30s\n", f, n, s); // Result to EEPROM: "Hello EEPROM"[0]"3.141"[10]"042" [10]"PI and answer to universe"[10][0]. This information can be conveniently retrieved back from EEPROM and placed in variables with the eescan function.
String length can be 128 or less.
*fmt | a print compatible format string. |
... | a print compatible list of arguments. |
Definition at line 12 of file peb_eeprint.c.
int eeprinted | ( | const char * | fmt, |
... | |||
) |
Can be called before storing a record with eeprint. Example: if(!eeprinted("Hello EEPROM") eeprint("Hello EEPROM");.
String length can be 128 or less.
*fmt | a print compatible format string. |
... | a print compatible list of arguments. |
Definition at line 12 of file peb_eeprinted.c.
int eescan | ( | int | recIdx, |
const char * | fmt, | ||
... | |||
) |
Use to retrieve strings to EEPROM in a manner similar to retrieving strings that represent combinations of strings and variables from the SimpleIDE terminal with the scan function. Examples: This example will retrieve the what the eeprint examples stored in EEPROM: char s1[14]; eescan(1, "%s", s1); float f; int n; char s2[30]; eescan("%f%d%s", f, n, s2); // Result: s1 = "Hello EEPROM", f = 3.141, n = 42, s2 = "PI and
answer to universe".
String length can be 128 or less.
recIdx | An integer record index value. |
*fmt | a print compatible format string. |
... | a print compatible list of arguments. |
Definition at line 12 of file peb_eescan.c.
int ir_receive | ( | char * | s, |
int | ssize | ||
) |
Receive a string with a specified maxiumum number of characters over IR.
ssize can be 128 or less.
*s | Address of the character array to store the string that was received. |
ssize | Maximmum size of the string. |
Definition at line 31 of file peb_ir_receive.c.
void ir_send | ( | char * | s, |
int | ssize | ||
) |
Transmits a string with a specified number of characters over IR.
ssize can be 128 or less.
*s | Address of a string to send. |
ssize | Maximmum size of the string. |
Definition at line 11 of file peb_ir_send.c.
int irprint | ( | const char * | fmt, |
... | |||
) |
Use to store transmit strings to another badge in a manner similar to displaying combinations of strings and variables in the SimpleIDE terminal with the print function. Examples: irprint("Hello eBadge"); float f = PI; int n = 4s; char s[] = "PI and answer to universe"; irprint("%1.3f\n%03d\n %30s\n", f, n, s); // Result to other badge: "Hello EEPROM"[0]"3.141"[10]"042"[10]"PI and answer to universe"[10][0]. This information can be conveniently received by the other badge using the irscan function.
String length can be 128 or less.
*fmt | a print compatible format string. |
... | a print compatible list of arguments. |
Definition at line 4 of file peb_irprint.c.
int irscan | ( | const char * | fmt, |
... | |||
) |
Use to receive strings over IR from another badge in a manner similar to retrieving strings that represent combinations of strings and variables from the SimpleIDE terminal with the scan function.
Examples: This example will retrieve what the irprint examples transmitted to the other badge: char s1[14]; eescan(1, "%s", s1); float f; int n; char s2[30]; eescan("%f%d%s", f, n, s2); // Result: s1 = "Hello EEPROM", f = 3.141, n = 42, s2 = "PI and
answer to universe".
Total string length can be 128 or less.
*fmt | a print compatible format string. |
... | a print compatible list of arguments. |
Definition at line 4 of file peb_irscan.c.
void line | ( | int | x0, |
int | y0, | ||
int | x1, | ||
int | y1, | ||
int | c | ||
) |
Plot a line on the oLED screen.
x0 | The x coordinate of the first point in the line. Measured as a number of pixels from left side of screen. The value increases from 0 (left) to 127 (right). |
y0 | The y coordinate of the first point in the line. Measured as a number of pixels from the top of the screen. The value increases from 0 (top) to 63 (bottom). |
x1 | The x coordinate of the second point in the line. |
y1 | The y coordinate of the second point in the line. |
c | The pixel color 1 for white, 0 for black. |
int oledprint | ( | const char * | fmt, |
... | |||
) |
Use to display strings on the oLED display in a manner similar to displaying combinations of strings and variables in the SimpleIDE terminal with the print function. Example: oledprint("Hello!!!"); text_size(SMALL); cursor(0, 4); float f = PI; int n = 4s; char s[] = "PI and Universe"; oledprint("%1.3f, %03d\n%30s", f, n, s); // Result to oLED display: Upper half large print by default - Hello!!! Small print line 4: 1.414, 042 Line 5 "PI and Universe".
String length can be 128 or less. Word wrap is automatic if line width is exceeded.
*fmt | a print compatible format string. |
... | a print compatible list of arguments. |
Definition at line 4 of file peb_text.c.
void point | ( | int | x, |
int | y, | ||
int | color | ||
) |
Plot a point on the oLED screen.
x | Number of pixels from left side of screen. The value increases from 0 (left) to 127 (right). |
y | the number of pixels from the top of the screen. The value increases from 0 (top)to 63 (bottom). Color is 1 for white, 0 for black. |
color | The pixel color 1 for white, 0 for black. |
int receive | ( | char * | s | ) |
Receive a character string from another badge.
String length can be 128 or less.
*s | Address of the character array to store the string that was received. |
Definition at line 6 of file peb_ir_receive.c.
void retrieve | ( | char * | contact, |
int | recIdx | ||
) |
Copy string with a certain index number from EEPROM to a character array.
String length can be 128 or less.
*contact | Address of the array where the string should be copied. |
recIdx | Index number of the string. |
Definition at line 12 of file peb_retrieve.c.
void screen_auto | ( | int | state | ) |
Cause function calls like oledprint, point, and others to appear immediately after the function is called with screen_auto(1). To make multiple changes before manually updating with a call to screen_update, use screen_auto(0). See 04 Screen Auto ON OFF.side for example.
state | 1 enables auto-update, 0 disables it. |
Definition at line 7 of file oled_auto.c.
int screen_getAuto | ( | ) |
Check if function calls like oledprint, point, and others are set to appear (1) immediately after the function is called or (0) if multiple changes are made before manually updating with a call to screen_update.
Definition at line 7 of file oled_getAuto.c.
void screen_image | ( | char * | imgaddr | ) |
Display an image using an array holding an image generated by software that is compatible with the screen's scanning. See 12 Image to Display.side for an example.
Although scanning starts at the top-left, each pixel in the byte advances downward. After displaying the 8 vertical pixels, it steps to the right a pixel for the next byte. The next byte starts one pixel to the right.
*imgaddr | Address of the byte array with the 128x64 pixel image to be displayed.. |
Definition at line 6 of file peb_screen_image.c.
int screen_scrollLeft | ( | int | scrollStart, |
int | scrollStop | ||
) |
Cause the screen to scroll to the left with screen_scrollLeft(0, 15).
int screen_scrollLeftDiag | ( | int | scrollStart, |
int | scrollStop | ||
) |
Cause the screen to scroll diagonally to the left with screen_scrollLeftDiag(0, 15).
int screen_scrollRight | ( | int | scrollStart, |
int | scrollStop | ||
) |
Cause the screen to scroll to the right with screen_scrollRight(0, 15).
int screen_scrollRightDiag | ( | int | scrollStart, |
int | scrollStop | ||
) |
Cause the screen to scroll diagonally to the right with screen_scrollRightDiag(0, 15).
int screen_scrollStop | ( | void | ) |
int screen_update | ( | void | ) |
Manually update the screen image after. Typically used after multiple oLED function calls after screen_auto(0). See 04 Screen Auto ON OFF.side for example.
Definition at line 426 of file oled_asmfast.c.
int send | ( | char * | s | ) |
Send a character string to another badge. Example: char s[] = "Hello other badge"; send(s);.
*s | Address of a string to send. |
Definition at line 4 of file peb_ir_send.c.
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.side for example.
*img | array's address (its name without the square brackets). |
bw | Can be SCR_WHITE for 1s drawing white pixels, SCR_BLACK for 1s drawing black pixels, or SCR_XOR for inverting. |
xtl | The shape's x top-left coordinate. |
ytl | The shape's y top-left coordinate. |
xpics | The shape's width in pixels. |
ypics | The shape's height in pixels. |
Definition at line 6 of file peb_shape.c.
int store | ( | char * | contact | ) |
Store a character string of up to 128 characters to EEPROM. Example: char s[] = "abcd"; store(s);.
String length can be 128 or less.
contact | Address of the string. |
Definition at line 12 of file peb_store.c.
int stored | ( | char * | s | ) |
Check if a string has already been stored in EEPROM. Example: if(!stored("abcd")) store("abcd");.
*s The address of the string that should be checked against strings stored in EEPROM. String length can be 128 or less.
Definition at line 12 of file peb_already_stored.c.
void string | ( | char * | str | ) |
Display a character string on the oLED display.
String length can be 128 or less. Word wrap is automatic if line width is exceeded.
*str | Address of string to be displayed. |
Definition at line 7 of file oled_string.c.
void text_size | ( | int | size | ) |
Set the text size to either 32x16 pixel (LARGE) or 7x5 (SMALL) characters. Examples: text_size(LARGE);...text_size(SMALL)...text_size(LARGE).
size | Size of characters, either LARGE (32x16 pixels) or SMALL (7x5 pixels). |
Definition at line 7 of file oled_text_size.c.
void triangle | ( | int | x0, |
int | y0, | ||
int | x1, | ||
int | y1, | ||
int | x2, | ||
int | y2, | ||
int | c | ||
) |
Plot a triangle on the oLED screen.
x0 | The x coordinate of one corner of the triangle. Measured as a number of pixels from left side of screen. The value increases from 0 (left) to 127 (right). |
y0 | The y coordinate of one corner of the triangle. Measured as a number of pixels from the top of the screen. The value increases from 0 (top) to 63 (bottom). |
x1 | The x coordinate of the second corner. |
y1 | The y coordinate of the second corner. |
x2 | The x coordinate of the third corner. |
y2 | The y coordinate of the third corner. |
c | The pixel color 1 for white, 0 for black. |
void triangleFilled | ( | int | x0, |
int | y0, | ||
int | x1, | ||
int | y1, | ||
int | x2, | ||
int | y2, | ||
int | c | ||
) |
Plot a filled triangle on the oLED screen.
x0 | The x coordinate of one corner of the triangle. Measured as a number of pixels from left side of screen. The value increases from 0 (left) to 127 (right). |
y0 | The y coordinate of one corner of the triangle. Measured as a number of pixels from the top of the screen. The value increases from 0 (top) to 63 (bottom). |
x1 | The x coordinate of the second corner. |
y1 | The y coordinate of the second corner. |
x2 | The x coordinate of the third corner. |
y2 | The y coordinate of the third corner. |
c | The pixel color 1 for white, 0 for black. |