blink1.clib

Barebones C wrapper for the blink(1) C library.

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/

Members

Aliases

blink1_device
alias blink1_device = hid_device_

< opaque blink1 structure

blink1_device
alias blink1_device = usbDevice

< opaque blink1 structure

blink1_device
alias blink1_device = hid_device_

< opaque blink1 structure

hid_device
alias hid_device = hid_device_

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

Enums

blink1Type_t
enum blink1Type_t

Enumeration of supported blink(1) devices.

Functions

blink1_adjustBrightness
void blink1_adjustBrightness(ubyte brightness, ubyte* r, ubyte* g, ubyte* b)

Using a brightness value, update an r,g,b triplet Modifies r,g,b in place

blink1_bootloaderGo
int blink1_bootloaderGo(blink1_device* dev)

Tell blink(1) to reset into bootloader.

blink1_bootloaderLock
int blink1_bootloaderLock(blink1_device* dev)

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

blink1_clearCacheDev
int blink1_clearCacheDev(blink1_device* dev)

Clear the blink1 device cache for a given device.

blink1_close_internal
void blink1_close_internal(blink1_device* dev)

Close opened blink1 device.

blink1_degamma
int blink1_degamma(int n)

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

blink1_deviceType
blink1Type_t blink1_deviceType(blink1_device* dev)
blink1_deviceTypeById
blink1Type_t blink1_deviceTypeById(int i)

Returns device "mk" type at cache index i

blink1_deviceTypeToStr
char* blink1_deviceTypeToStr(blink1Type_t t)

Return a string representation of the blink(1) device type (e.g. "mk2" or "mk3")

blink1_disableDegamma
void blink1_disableDegamma()

Disable blink1-lib gamma curve. @note should probably always have it disabled

blink1_eeread
int blink1_eeread(blink1_device* dev, ushort addr, ubyte* val)

Read eeprom on mk1 devices

blink1_eewrite
int blink1_eewrite(blink1_device* dev, ushort addr, ubyte val)

Write eeprom on mk1 devices

blink1_enableDegamma
void blink1_enableDegamma()

Enable blink1-lib gamma curve.

blink1_enumerate
int blink1_enumerate()

Scan USB for blink(1) devices.

blink1_enumerateByVidPid
int blink1_enumerateByVidPid(int vid, int pid)

Scan USB for devices by given VID,PID.

blink1_error_msg
char* blink1_error_msg(int errCode)

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

blink1_fadeToRGB
int blink1_fadeToRGB(blink1_device* dev, ushort fadeMillis, ubyte r, ubyte g, ubyte b)

Fade blink1 to given RGB color over specified time.

blink1_fadeToRGBN
int blink1_fadeToRGBN(blink1_device* dev, ushort fadeMillis, ubyte r, ubyte g, ubyte b, ubyte n)

Fade specific LED on blink1mk2 to given RGB color over specified time.

blink1_getCacheIndexByDev
int blink1_getCacheIndexByDev(blink1_device* dev)

Return cache index for a given blink1_device object.

blink1_getCacheIndexById
int blink1_getCacheIndexById(ushort i)

Return cache index for a given blink1 id (0-max or serial number as uint32)

blink1_getCacheIndexByPath
int blink1_getCacheIndexByPath(char* path)

Return cache index for a given platform-specific USB path.

blink1_getCacheIndexBySerial
int blink1_getCacheIndexBySerial(char* serial)

Return cache index for a given blink1 serial number.

blink1_getCachedCount
int blink1_getCachedCount()

Return number of entries in blink1 device cache.

blink1_getCachedPath
char* blink1_getCachedPath(int i)

Return platform-specific USB path for given cache index.

blink1_getCachedSerial
char* blink1_getCachedSerial(int i)

Return bilnk1 serial number for given cache index.

blink1_getId
int blink1_getId(blink1_device* dev, ubyte** idbuf)

Internal testing

blink1_getSerialForDev
char* blink1_getSerialForDev(blink1_device* dev)

Return serial number string for give blink1 device.

blink1_getStartupParams
int blink1_getStartupParams(blink1_device* dev, ubyte* bootmode, ubyte* playstart, ubyte* playend, ubyte* playcount)

@note only for devices with fw val 206+ or mk3

blink1_getVersion
int blink1_getVersion(blink1_device* dev)

Get blink1 firmware version.

blink1_isMk2
int blink1_isMk2(blink1_device* dev)

Returns if given blink1_device is a mk2 or not

blink1_isMk2ById
int blink1_isMk2ById(int i)

Returns version of device at cache index i is a mk2

blink1_open
blink1_device* blink1_open()

Open first found blink(1) device.

blink1_openById
blink1_device* blink1_openById(uint id)

Open by "id", which if from 0-blink1_max_devices is index or if blink1_max_devices, is numerical representation of serial number

blink1_openByPath
blink1_device* blink1_openByPath(char* path)

Open blink(1) by USB path.

blink1_openBySerial
blink1_device* blink1_openBySerial(char* serial)

Open blink(1) by 8-digit serial number.

blink1_pid
int blink1_pid()

Product ID for blink1 devices.

blink1_play
int blink1_play(blink1_device* dev, ubyte play, ubyte pos)

Play color pattern stored in blink1.

blink1_playloop
int blink1_playloop(blink1_device* dev, ubyte play, ubyte startpos, ubyte endpos, ubyte count)

Play color pattern stored in blink1mk2.

blink1_read
int blink1_read(blink1_device* dev, void* buf, int len)

Low-level read from blink1 device.

blink1_readNote
int blink1_readNote(blink1_device* dev, ubyte noteid, ubyte** notebuf)

writes into notebuf

blink1_readPatternLine
int blink1_readPatternLine(blink1_device* dev, ushort* fadeMillis, ubyte* r, ubyte* g, ubyte* b, ubyte pos)

Read a color pattern line to blink1.

blink1_readPatternLineN
int blink1_readPatternLineN(blink1_device* dev, ushort* fadeMillis, ubyte* r, ubyte* g, ubyte* b, ubyte* ledn, ubyte pos)

Read a color pattern line to blink1. ledn param only works on fw204+ devices

blink1_readPlayState
int blink1_readPlayState(blink1_device* dev, ubyte* playing, ubyte* playstart, ubyte* playend, ubyte* playcount, ubyte* playpos)

Read the current state of a playing pattern.

blink1_readRGB
int blink1_readRGB(blink1_device* dev, ushort* fadeMillis, ubyte* r, ubyte* g, ubyte* b, ubyte ledn)

Read current RGB value on specified LED.

blink1_readRGB_mk1
int blink1_readRGB_mk1(blink1_device* dev, ushort* fadeMillis, ubyte* r, ubyte* g, ubyte* b)

Attempt to read current RGB value for mk1 devices.

blink1_read_nosend
int blink1_read_nosend(blink1_device* dev, void* buf, int len)

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

blink1_savePattern
int blink1_savePattern(blink1_device* dev)

Save color pattern in RAM to nonvolatile storage.

blink1_serialnumread
int blink1_serialnumread(blink1_device* dev, ubyte** serialnumstr)

Read serial number from mk1 device. Does not work.

blink1_serialnumwrite
int blink1_serialnumwrite(blink1_device* dev, ubyte* serialnumstr)

Write serial number to mk1 device. Does not work.

blink1_serverdown
int blink1_serverdown(blink1_device* dev, ubyte on, ushort millis, ubyte st, ubyte startpos, ubyte endpos)

Tickle blink1 serverdown functionality.

blink1_setLEDN
int blink1_setLEDN(blink1_device* dev, ubyte ledn)

Sets 'ledn' parameter for blink1_savePatternLine()

blink1_setRGB
int blink1_setRGB(blink1_device* dev, ubyte r, ubyte g, ubyte b)

Set blink1 immediately to a specific RGB color.

blink1_setStartupParams
int blink1_setStartupParams(blink1_device* dev, ubyte bootmode, ubyte playstart, ubyte playend, ubyte playcount)

Only for devices with fw val 206+ or mk3 FIXME: make 'params' a struct

blink1_sleep
void blink1_sleep(ushort delayMillis)

Simple wrapper for cross-platform millisecond delay.

blink1_testtest
int blink1_testtest(blink1_device* dev, ubyte reportid)

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

blink1_vid
int blink1_vid()

Vendor ID for blink1 devices.

blink1_write
int blink1_write(blink1_device* dev, void* buf, int len)

Low-level write to blink1 device.

blink1_writeNote
int blink1_writeNote(blink1_device* dev, ubyte noteid, ubyte* notebuf)

reads from notebuf

blink1_writePatternLine
int blink1_writePatternLine(blink1_device* dev, ushort fadeMillis, ubyte r, ubyte g, ubyte b, ubyte pos)

Write a color pattern line to blink1.

hexdump
void hexdump(FILE* fp, ubyte* buffer, int len)
hexread
int hexread(ubyte* buffer, char* str, int buflen)
hsbtorgb
void hsbtorgb(rgb_t* rgb, ubyte* hsb)
msg
void msg(char* fmt, ...)

printf that can be shut up

msg_setquiet
void msg_setquiet(int q)

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

parsePattern
int parsePattern(char* str, int* repeats, patternline_t* pattern)
parsecolor
void parsecolor(rgb_t* color, char* colorstr)

Structs

hid_device_
struct hid_device_

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

patternline_t
struct patternline_t

Struct representing a pattern line.

rgb_t
struct rgb_t

Struct representing a RGB color.

Variables

BLINK1_DEVICE_ID
int BLINK1_DEVICE_ID;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

BLINK1_VENDOR_ID
int BLINK1_VENDOR_ID;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

blink1_buf2_size
int blink1_buf2_size;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

blink1_buf_size
int blink1_buf_size;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

blink1_max_devices
int blink1_max_devices;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

blink1_note_size
int blink1_note_size;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

blink1_report2_id
int blink1_report2_id;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

blink1_report2_size
int blink1_report2_size;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

blink1_report_id
int blink1_report_id;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

blink1_report_size
int blink1_report_size;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

blink1mk2_serialstart
int blink1mk2_serialstart;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

blink1mk3_serialstart
int blink1mk3_serialstart;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

cache_max
int cache_max;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

pathstrmax
int pathstrmax;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

serialstrmax
int serialstrmax;

Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

Meta