Using a brightness value, update an r,g,b triplet Modifies r,g,b in place
Tell blink(1) to reset into bootloader. mk3 devices only
Clear the blink1 device cache for a given device. @param dev blink1 device @return cache index that was cleared, or -1 if not found
Close opened blink1 device. Safe to call blink1_close on already closed device. @param dev blink1_device
@return blink1Type_t (BLINK1_MK2, BLINK1_MK2, BLINK1_MK1)
Returns device "mk" type at cache index i @return blink1Type_t (BLINK1_MK2, BLINK1_MK2, BLINK1_MK1)
Return a string representation of the blink(1) device type (e.g. "mk2" or "mk3") @return const string
Disable blink1-lib gamma curve. @note should probably always have it disabled
Read eeprom on mk1 devices @note For mk1 devices only
Write eeprom on mk1 devices @note For mk1 devices only
Enable blink1-lib gamma curve.
Scan USB for blink(1) devices. @return number of devices found
Scan USB for devices by given VID,PID. @param vid vendor ID @param pid product ID @return number of devices found
Fade blink1 to given RGB color over specified time. @param dev blink1 device to command @param fadeMillis time to fade in milliseconds @param r red part of RGB color @param g green part of RGB color @param b blue part of RGB color @return -1 on error, 0 on success
Fade specific LED on blink1mk2 to given RGB color over specified time. @note For mk2 devices. @param dev blink1 device to command @param fadeMillis time to fade in milliseconds @param r red part of RGB color @param g green part of RGB color @param b blue part of RGB color @param n which LED to address (0=all, 1=1st LED, 2=2nd LED) @return -1 on error, 0 on success
Return cache index for a given blink1_device object. @param dev blink1 device to lookup @return cache index or -1 if not found
Return cache index for a given blink1 id (0-max or serial number as uint32) @param i blink1 id (0-blink1_max_devices or serial as uint32) @return cache index or -1 if not found
Return cache index for a given platform-specific USB path. @param path platform-specific path string @return cache index or -1 if not found
Return cache index for a given blink1 serial number. @param path platform-specific path string @return cache index or -1 if not found
Return number of entries in blink1 device cache. @note This is the number of devices found with blink1_enumerate() @return number of cache entries
Return platform-specific USB path for given cache index. @param i cache index @return path string
Return bilnk1 serial number for given cache index. @param i cache index @return 8-hexdigit serial number as string
Internal testing
Return serial number string for give blink1 device. @param dev blink device to lookup @return 8-hexdigit serial number string
@note only for devices with fw val 206+ or mk3
Get blink1 firmware version. @param dev opened blink1 device @return version as scaled int number (e.g. "v1.1" = 101)
Returns if given blink1_device is a mk2 or not @param dev blink1 device to check @return mk2=1, mk1=0
Returns version of device at cache index i is a mk2
Open first found blink(1) device. @return pointer to opened blink1_device or NULL if no blink1 found
Open by "id", which if from 0-blink1_max_devices is index or if >blink1_max_devices, is numerical representation of serial number @param id ordinal 0-15 id of blink1 or numerical rep of 8-hex digit serial @return blink1_device or NULL if no blink1 found
Open blink(1) by USB path. note: this is platform-specific, and port-specific. @param path string of platform-specific path to blink1 @return blink1_device or NULL if no blink1 found
Open blink(1) by 8-digit serial number. @param serial 8-hex digit serial number @return blink1_device or NULL if no blink1 found
Product ID for blink1 devices. @return blink1 PID
Play color pattern stored in blink1. @param dev blink1 device to command @param play boolean: 1=play, 0=stop @param pos position to start playing from @return -1 on error, 0 on success
Play color pattern stored in blink1mk2. @note For mk2 devices only. @param dev blink1 device to command @param play boolean: 1=play, 0=stop @param startpos position to start playing from @param endpos position to end playing @param count number of times to play (0=forever) @return -1 on error, 0 on success
Low-level read from blink1 device. Used internally by blink1-lib
Read a color pattern line to blink1. @param dev blink1 device to command @param fadeMillis pointer to milliseconds to fade to RGB color @param r pointer to store red color component @param g pointer to store green color component @param b pointer to store blue color component @return -1 on error, 0 on success
Read a color pattern line to blink1. @note ledn param only works on fw204+ devices @param dev blink1 device to command @param fadeMillis pointer to milliseconds to fade to RGB color @return -1 on error, 0 on success
Read the current state of a playing pattern. @note For mk2 devices only. @param dev blink1 device to command @param playing pointer to play/stop boolean @param playstart pointer to start position @param playend pointer to end position @param playcount pointer to count left @param playpos pointer to play position @return -1 on error, 0 on success
Read current RGB value on specified LED. @note For mk2 devices only. @param dev blink1 device to command @param r pointer to red part of RGB color @param g pointer to green part of RGB color @param b pointer to blue part of RGB color @param n which LED to get (0=1st, 1=1st LED, 2=2nd LED) @return -1 on error, 0 on success
Attempt to read current RGB value for mk1 devices. @note Called by blink1_setRGB() if device is mk1. @note Does not always work. @param dev blink1 device to command @param r pointer to red part of RGB color @param g pointer to green part of RGB color @param b pointer to blue part of RGB color @return -1 on error, 0 on success
Save color pattern in RAM to nonvolatile storage. @note For mk2 devices only. @note this doesn't actually return a proper return value, as the time it takes to write to flash actually exceeds USB timeout @param dev blink1 device to command @return -1 on error, 0 on success
Read serial number from mk1 device. Does not work. @note Use USB descriptor serial number instead. @note for mk1 devices only. @note does not work.
Write serial number to mk1 device. Does not work. @note for mk1 devices only. @note does not work.
Tickle blink1 serverdown functionality. @note 'st' param for mk2 firmware only @param on enable or disable: enable=1, disable=0 @param millis milliseconds to wait until triggering (up to 65,355 millis) @param stay lit (st=1) or set off() (st=0) @param startpos pattern start position (fw 205+) @param endpos pattern end pos (fw 205+)
Sets 'ledn' parameter for blink1_savePatternLine() @note only works on fw 204+ devices
Set blink1 immediately to a specific RGB color. @note If mk2, sets all LEDs immediately @param dev blink1 device to command @param r red part of RGB color @param g green part of RGB color @param b blue part of RGB color @return -1 on error, 0 on success
@note only for devices with fw val 206+ or mk3 FIXME: make 'params' a struct
Simple wrapper for cross-platform millisecond delay. @param delayMillis number of milliseconds to wait
Vendor ID for blink1 devices. @return blink1 VID
Low-level write to blink1 device. Used internally by blink1-lib
Write a color pattern line to blink1. @note on mk1 devices, this saves the pattern line to nonvolatile storage. @note on mk2 devices, this only saves to RAM (see savePattern() for nonvol) @param dev blink1 device to command @param r red part of RGB color @param g green part of RGB color @param b blue part of RGB color @param pos pattern line number 0-max_patt (FIXME: put note about this) @return -1 on error, 0 on success
printf that can be shut up
blink(1) C library -- aka "blink1-lib"
Part of the blink(1) open source hardware project See https://github.com/todbot/blink1 for details
2012-2014, Tod E. Kurt, http://todbot.com/blog/ , http://thingm.com/