Gjsify LogoGjsify Logo

Index

Enumerations

Classes

Interfaces

Type Aliases

Variables

Functions

Type Aliases

Cmd: number

Variables

BUFFER_INPUT_CMD: number
BUFFER_INPUT_DATA: number
BUFFER_OUTPUT_CMD: number
BUFFER_OUTPUT_DATA: number
BUFFER_OUTPUT_RETVAL: number
CALIBRATION_DESCRIPTION_LEN: number
CALIBRATION_INDEX_CRT: number
CALIBRATION_INDEX_FACTORY_ONLY: number
CALIBRATION_INDEX_LCD: number
CALIBRATION_INDEX_LED: number
CALIBRATION_INDEX_MAX: number
CALIBRATION_INDEX_PROJECTOR: number
CALIBRATION_MAX: number
CALIBRATION_SPECTRAL: number
CALIBRATION_TYPE_ALL: number
CALIBRATION_TYPE_CRT: number
CALIBRATION_TYPE_LCD: number
CALIBRATION_TYPE_LED: number
CALIBRATION_TYPE_PROJECTOR: number
CCD_SPECTRAL_RESOLUTION: number
CMD_BOOT_FLASH: number

Boot into to the flash memory.

IN: [1:cmd] OUT: [1:retval][1:cmd]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | ✓ | × ColorHug2 | ✓ | × ColorHug+ | ✓ | × ColorHugALS | ✓ | ×

CMD_CLEAR_ERROR: number

Clears any recorded error on the device.

PROTOCOLv2: bRequest: [cmd] wValue: 0x00 wIndex: interface wLength: 0x00 Direction: DEVICE->HOST Data: []

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | × | × ColorHug2 | × | × ColorHug+ | × | ✓ ColorHugALS | × | ×

CMD_ERASE_FLASH: number

Erases flash memory before a write is done. Erasing flash can only be done in 1k byte chunks and should be aligned to 1k.

IN: [1:cmd][2:address][2:length] OUT: [1:retval][1:cmd]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | ✓ | × ColorHug2 | ✓ | × ColorHug+ | ✓ | × ColorHugALS | ✓ | ×

CMD_GET_ADC_CALIBRATION_NEG: number

Gets the value of the Vref- ADC adjustment. vref is a packed float.

IN: [1:cmd] OUT: [1:retval][1:cmd][4:vref]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | × | × ColorHug2 | × | × ColorHug+ | × | ✓ ColorHugALS | × | ×

CMD_GET_ADC_CALIBRATION_POS: number

Gets the value of the Vref+ ADC adjustment. vref is a packed float.

IN: [1:cmd] OUT: [1:retval][1:cmd][4:vref]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | × | × ColorHug2 | × | × ColorHug+ | × | ✓ ColorHugALS | × | ×

CMD_GET_CALIBRATION: number

Gets the calibration matrix. The description does not have to be NULL terminated.

types is a bitmask which corresponds to:

bit: 0 Can be used with LCD panels 1 Can be used with CRT monitors 2 Can be used with projectors 3 Can be used with LED panels 4-7 Reserved for future use

IN: [1:cmd][2:index] OUT: [1:retval][1:cmd][2*9:matrix_value][1:types][23:description]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | × | ✓ ColorHug2 | × | ✓ ColorHug+ | × | × ColorHugALS | × | ×

CMD_GET_CALIBRATION_MAP: number

Get the mappings from default calibration type to calibration indexes.

The calibration types are as follows: LCD = 0 CRT = 1 Projector = 2 LED = 3 Custom1 = 4 Custom2 = 5

In the future CustomX may be renamed to another display technology, e.g. e-ink.

IN: [1:cmd] OUT: [1:retval][1:cmd][6*2:types]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | × | ✓ ColorHug2 | × | ✓ ColorHug+ | × | × ColorHugALS | × | ×

CMD_GET_CCD_CALIBRATION: number

Gets the spectral indexes for the RGB calibration which are values between 0 and %CH_CCD_SPECTRAL_RESOLUTION pointing to the dominant peak for the color. Red is nominally 625nm, green 520nm and blue 465nm.

IN: [1:cmd] OUT: [1:retval][1:cmd][2:red-idx][2:green-idx][2:blue-idx]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | × | × ColorHug2 | × | × ColorHug+ | × | ✓ ColorHugALS | × | ×

CMD_GET_COLOR_SELECT: number

Get the color select state.

IN: [1:cmd] OUT: [1:retval][1:cmd][1:color_select]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | × | ✓ ColorHug2 | × | × ColorHug+ | × | × ColorHugALS | × | ✓

CMD_GET_DAC_VALUE: number

Get the DAC value. scale is a packed float, where 1.0f is 3.3V

IN: [1:cmd] OUT: [1:retval][1:cmd][4:value]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | × | × ColorHug2 | × | × ColorHug+ | × | ✓ ColorHugALS | × | ×

CMD_GET_DARK_OFFSETS: number

Get the dark offsets.

IN: [1:cmd] OUT: [1:retval][1:cmd][2:red][2:green][2:blue]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | × | ✓ ColorHug2 | × | × ColorHug+ | × | ✓ ColorHugALS | × | ×

CMD_GET_ERROR: number

Gets any recorded error from the device.

PROTOCOLv2: bRequest: [cmd] wValue: 0x00 wIndex: interface wLength: 0x00 Direction: DEVICE->HOST Data: [1:error][1:cmd]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | × | × ColorHug2 | × | × ColorHug+ | × | ✓ ColorHugALS | × | ×

CMD_GET_FIRMWARE_VERSION: number

Gets the firmware version.

IN: [1:cmd] OUT: [1:retval][1:cmd][2:major][2:minor][2:micro]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | ✓ | ✓ ColorHug2 | ✓ | ✓ ColorHug+ | ✓ | ✓ ColorHugALS | ✓ | ✓

CMD_GET_HARDWARE_VERSION: number

Get the hardware version.

The hardware versions are as follows: 0x00 = Pre-production hardware 0x01 = ColorHug 0x02 = ColorHug2 0x03 = ColorHug+ 0x04 = ColorHugALS 0x05-0x0f = Reserved for future use

IN: [1:cmd] OUT: [1:retval][1:cmd][1:hw_version]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | ✓ | ✓ ColorHug2 | ✓ | ✓ ColorHug+ | ✓ | ✓ ColorHugALS | ✓ | ✓

CMD_GET_ILLUMINANTS: number

Get the illuminant state.

IN: [1:cmd] OUT: [1:retval][1:cmd][1:illuminants]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | × | × ColorHug2 | × | × ColorHug+ | × | ✓ ColorHugALS | × | ×

CMD_GET_INTEGRAL_TIME: number

Gets the integral time.

IN: [1:cmd] OUT: [1:retval][1:cmd][2:integral_time]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | × | ✓ ColorHug2 | × | × ColorHug+ | × | ✓ ColorHugALS | × | ✓

CMD_GET_LEDS: number

Get the LED state.

IN: [1:cmd] OUT: [1:retval][1:cmd][1:led_state]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | × | ✓ ColorHug2 | × | ✓ ColorHug+ | × | ✓ ColorHugALS | ✓ | ✓

CMD_GET_MEASURE_MODE: number

Gets the measurement mode.

IN: [1:cmd] OUT: [1:retval][1:cmd][1:measure_mode]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | × | ✓ ColorHug2 | × | × ColorHug+ | × | × ColorHugALS | × | ×

CMD_GET_MULTIPLIER: number

Gets the multiplier value.

IN: [1:cmd] OUT: [1:retval][1:cmd][1:multiplier_value]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | × | ✓ ColorHug2 | × | × ColorHug+ | × | × ColorHugALS | × | ✓

CMD_GET_OWNER_EMAIL: number

Get User's Email Address

IN: [1:cmd] OUT: [1:retval][1:cmd][60:owner-email]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | × | ✓ ColorHug2 | × | ✓ ColorHug+ | × | ✓ ColorHugALS | × | ×

CMD_GET_OWNER_NAME: number

Get User's Name

IN: [1:cmd] OUT: [1:retval][1:cmd][60:owner-name]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | × | ✓ ColorHug2 | × | ✓ ColorHug+ | × | ✓ ColorHugALS | × | ×

CMD_GET_PCB_ERRATA: number

Gets the board errata value.

IN: [1:cmd] OUT: [1:retval][1:cmd][2:pcb_errata]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | × | ✓ ColorHug2 | × | ✓ ColorHug+ | × | ✓ ColorHugALS | × | ×

CMD_GET_POST_SCALE: number

Get the post XYZ scaling constant. scale is a packed float.

IN: [1:cmd] OUT: [1:retval][1:cmd][4:scale]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | × | ✓ ColorHug2 | × | × ColorHug+ | × | × ColorHugALS | × | ×

CMD_GET_PRE_SCALE: number

Get the pre XYZ scaling constant. scale is a packed float.

IN: [1:cmd] OUT: [1:retval][1:cmd][4:scale]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | × | ✓ ColorHug2 | × | × ColorHug+ | × | × ColorHugALS | × | ×

CMD_GET_REMOTE_HASH: number

Gets the remote hash which is used to get the last profile saved to a public web service.

IN: [1:cmd] OUT: [1:retval][1:cmd][20:sha1_hash]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | × | ✓ ColorHug2 | × | ✓ ColorHug+ | × | ✓ ColorHugALS | × | ×

CMD_GET_SERIAL_NUMBER: number

Gets the device serial number.

IN: [1:cmd] OUT: [1:retval][1:cmd][4:serial_number]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | × | ✓ ColorHug2 | × | ✓ ColorHug+ | × | ✓ ColorHugALS | × | ✓

CMD_GET_TEMPERATURE: number

Gets the temperature of the sensor in degrees celsius

IN: [1:cmd] OUT: [1:retval][1:cmd][4:temperature]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | × | × ColorHug2 | × | ✓ ColorHug+ | × | ✓ ColorHugALS | × | ×

CMD_LOAD_SRAM: number

Load the SRAM from the EEPROM.

PROTOCOLv2: bRequest: [cmd] wValue: 0x00 wIndex: interface wLength: 0x00 Direction: DEVICE->HOST Data: [1:error][1:cmd]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | × | × ColorHug2 | × | × ColorHug+ | × | ✓ ColorHugALS | × | ×

CMD_READ_FLASH: number

Read in raw data from the flash memory.

IN: [1:cmd][2:address][1:length] OUT: [1:retval][1:cmd][1:checksum][1-60:data]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | ✓ | × ColorHug2 | ✓ | × ColorHug+ | ✓ | × ColorHugALS | ✓ | ×

CMD_READ_SRAM: number

Read in raw data from the SRAM memory.

PROTOCOLv1: IN: [1:cmd][2:address][1:length] OUT: [1:retval][1:cmd][1-60:data]

PROTOCOLv2: bRequest: [cmd] wValue: [address-index/64] wIndex: interface wLength: 0x64 Direction: DEVICE->HOST Data: [64:DATA]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | × | × ColorHug2 | × | ✓ ColorHug+ | × | ✓ ColorHugALS | × | ×

CMD_RESET: number

Reset the processor.

IN: [1:cmd] OUT: [1:retval][1:cmd] (but with success the device will disconnect)

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | ✓ | ✓ ColorHug2 | ✓ | ✓ ColorHug+ | ✓ | ✓ ColorHugALS | ✓ | ✓

CMD_SAVE_SRAM: number

Save the SRAM to the EEPROM.

PROTOCOLv2: bRequest: [cmd] wValue: 0x00 wIndex: interface wLength: 0x00 Direction: DEVICE->HOST Data: [1:error][1:cmd]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | × | × ColorHug2 | × | × ColorHug+ | × | ✓ ColorHugALS | × | ×

CMD_SELF_TEST: number

Tests the device by trying to get a non-zero reading from each color channel.

IN: [1:cmd] OUT: [1:retval][1:cmd]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | ✓ | ✓ ColorHug2 | ✓ | ✓ ColorHug+ | ✓ | ✓ ColorHugALS | ✓ | ×

CMD_SET_CALIBRATION: number

Sets the calibration matrix.

IN: [1:cmd][2:index][4*9:matrix_value][1:types][23:description] OUT: [1:retval][1:cmd]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | × | ✓ ColorHug2 | × | ✓ ColorHug+ | × | × ColorHugALS | × | ×

CMD_SET_CALIBRATION_MAP: number

Set the calibration type to index map.

IN: [1:cmd][6*2:types] OUT: [1:retval][1:cmd]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | × | ✓ ColorHug2 | × | ✓ ColorHug+ | × | × ColorHugALS | × | ×

CMD_SET_CCD_CALIBRATION: number

Sets the spectral indexes for the RGB calibration.

IN: [1:cmd][2:red-idx][2:green-idx][2:blue-idx] OUT: [1:retval][1:cmd]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | × | × ColorHug2 | × | × ColorHug+ | × | ✓ ColorHugALS | × | ×

CMD_SET_COLOR_SELECT: number

Set the color select state.

IN: [1:cmd][1:color_select] OUT: [1:retval][1:cmd]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | × | ✓ ColorHug2 | × | × ColorHug+ | × | × ColorHugALS | × | ✓

CMD_SET_CRYPTO_KEY: number

Sets the 128 bit encyption key for the device.

PROTOCOLv2: bRequest: [cmd] wValue: 0x00 wIndex: interface wLength: 0x00 Direction: DEVICE->HOST Data: [4:key0][4:key1][4:key2][4:key3]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | × | × ColorHug2 | × | × ColorHug+ | × | ✓ ColorHugALS | × | ×

CMD_SET_DAC_VALUE: number

Set the DAC value. scale is a packed float, where 1.0f is 3.3V

IN: [1:cmd][4:value] OUT: [1:retval][1:cmd]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | × | × ColorHug2 | × | × ColorHug+ | × | ✓ ColorHugALS | × | ×

CMD_SET_DARK_OFFSETS: number

Set the dark offsets for use when taking samples when the measure mode is FREQUENCY. When the measure mode is DURATION these values have no effect.

IN: [1:cmd][2:red][2:green][2:blue] OUT: [1:retval][1:cmd]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | × | ✓ ColorHug2 | × | × ColorHug+ | × | ✓ ColorHugALS | × | ×

CMD_SET_FLASH_SUCCESS: number

Sets the result of the firmware flashing. The idea of this command is that the flashing interaction is thus:

  1. Reset()			device goes to bootloader mode
    
    1. SetFlashSuccess(FALSE)
      
      1. WriteFlash($data)
        
        1. ReadFlash($data)	to verify
          
          1. BootFlash()		switch to program mode
            
            1. SetFlashSuccess(TRUE)
              

The idea is that we only set the success FALSE from the bootoloader to indicate that on booting we should not boot into the program. We can only set the success true from the new program code so as to verify that the new program boots, and can accept HID commands.

IN: [1:cmd][1:success] OUT: [1:retval][1:cmd]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | ✓ | ✓ ColorHug2 | ✓ | ✓ ColorHug+ | ✓ | ✓ ColorHugALS | ✓ | ✓

Different values of success are permitted in each mode.

CMD_SET_ILLUMINANTS: number

Set the illuminants.

IN: [1:cmd][1:illuminant] OUT: [1:retval][1:cmd]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | × | × ColorHug2 | × | × ColorHug+ | × | ✓ ColorHugALS | × | ×

CMD_SET_INTEGRAL_TIME: number

Sets the integral time.

IN: [1:cmd][2:integral_time] OUT: [1:retval][1:cmd]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | × | ✓ ColorHug2 | × | × ColorHug+ | × | ✓ ColorHugALS | × | ✓

CMD_SET_LEDS: number

Set the LED state. Using a repeat value of anything other than 0 will block the processor for the duration of the command.

If repeat is not 0, then the LEDs are reset to all off at the end of the sequence.

IN: [1:cmd][1:led_state][1:repeat][1:on-time][1:off-time] OUT: [1:retval][1:cmd]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | × | ✓ ColorHug2 | × | ✓ ColorHug+ | × | ✓ ColorHugALS | × | ✓

CMD_SET_MEASURE_MODE: number

Sets the measurement mode. The mode can either be frequency or pulse duration. The former is well tested, but the latter is much more precise.

IN: [1:cmd][1:measure_mode] OUT: [1:retval][1:cmd]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | × | ✓ ColorHug2 | × | × ColorHug+ | × | × ColorHugALS | × | ×

CMD_SET_MULTIPLIER: number

Sets the multiplier value.

IN: [1:cmd][1:multiplier_value] OUT: [1:retval][1:cmd]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | × | ✓ ColorHug2 | × | × ColorHug+ | × | × ColorHugALS | × | ✓

CMD_SET_OWNER_EMAIL: number

Set User's Email Address

IN: [1:cmd][60:owner-email] OUT: [1:retval][1:cmd]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | × | ✓ ColorHug2 | × | ✓ ColorHug+ | × | ✓ ColorHugALS | × | ×

CMD_SET_OWNER_NAME: number

Set User's Name

IN: [1:cmd][60:owner-name] OUT: [1:retval][1:cmd]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | × | ✓ ColorHug2 | × | ✓ ColorHug+ | × | ✓ ColorHugALS | × | ×

CMD_SET_PCB_ERRATA: number

Sets the board errata value. Board errata is used to correct swapped LEDs and any future problems discovered that only affect some batches of hardware version 1.

The errata bitmask is as follows: 0x00 = No errata for this PCB 0x01 = Leds are swapped 0x02-0xffff = Reserved for future use

IN: [1:cmd][2:pcb_errata] OUT: [1:retval][1:cmd]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | × | ✓ ColorHug2 | × | ✓ ColorHug+ | × | ✓ ColorHugALS | × | ×

CMD_SET_POST_SCALE: number

Set the post XYZ scaling constant. scale is a packed float.

IN: [1:cmd][4:scale] OUT: [1:retval][1:cmd]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | × | ✓ ColorHug2 | × | × ColorHug+ | × | × ColorHugALS | × | ×

CMD_SET_PRE_SCALE: number

Set the pre XYZ scaling constant. scale is a packed float.

IN: [1:cmd][4:scale] OUT: [1:retval][1:cmd]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | × | ✓ ColorHug2 | × | × ColorHug+ | × | × ColorHugALS | × | ×

CMD_SET_REMOTE_HASH: number

Sets the remote SHA1 hash of the profile. This is designed to be used by the calibration program to indicate the key which allows the completed profile to be found from a public web service.

IN: [1:cmd][20:sha1_hash] OUT: [1:retval][1:cmd]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | × | ✓ ColorHug2 | × | ✓ ColorHug+ | × | ✓ ColorHugALS | × | ×

CMD_SET_SERIAL_NUMBER: number

Sets the device serial number.

IN: [1:cmd][4:serial_number] OUT: [1:retval][1:cmd]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | × | ✓ ColorHug2 | × | ✓ ColorHug+ | × | ✓ ColorHugALS | × | ×

CMD_TAKE_READINGS: number

Take a reading taking into account just dark offsets. All of red, green and blue are packed float values.

This command is useful if you want to do an ambient reading.

IN: [1:cmd] OUT: [1:retval][1:cmd][4:red][4:green][4:blue]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | × | ✓ ColorHug2 | × | ✓ ColorHug+ | × | ✓ ColorHugALS | × | ×

CMD_TAKE_READING_ARRAY: number

Takes 30 raw samples and returns them in an array.

This command can be used to find the optimum delay between patches by showing a black sample area, then white, and then using this command to find out how long the actual hardware delay is.

It can also be used to find out how stable the device or output is over a small amount of time, typically ~2.5 seconds for the maximum integral time.

IN: [1:cmd] OUT: [1:retval][1:cmd][30:reading_array]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | × | ✓ ColorHug2 | × | × ColorHug+ | × | × ColorHugALS | × | ×

CMD_TAKE_READING_RAW: number

Take a raw reading.

IN: [1:cmd] OUT: [1:retval][1:cmd][4:count]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | × | ✓ ColorHug2 | × | × ColorHug+ | × | ✓ ColorHugALS | × | ✓

CMD_TAKE_READING_SPECTRAL: number

Takes a spectral reading putting %CH_CCD_SPECTRAL_RESOLUTION uint16_t values (typically 7296 bytes) in SRAM. The values are scaled from 0x0000 to 0x03ff and correspond to the actual signal amplitude once Vref- and Vref+ have been taken into account.

IN: [1:cmd] OUT: [1:retval][1:cmd][4:addr]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | × | × ColorHug2 | × | × ColorHug+ | × | ✓ ColorHugALS | × | ×

CMD_TAKE_READING_XYZ: number

Take a reading taking into account:

  1. dark offsets
  2. the calibration matrix

If the calibration index > %CH_CALIBRATION_MAX then the calibration map is used to find the default calibration index to use.

If the calibration index is set to %CH_CALIBRATION_SPECTRAL then the spectral hardware is used if it is available. The CIE 1931 luminosity function data is used by default.

IN: [1:cmd][2:calibration-index] OUT: [1:retval][1:cmd][4:red][4:green][4:blue]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | × | ✓ ColorHug2 | × | ✓ ColorHug+ | × | ✓ ColorHugALS | × | ×

CMD_WRITE_EEPROM: number

Write values to EEPROM.

IN: [1:cmd][8:eeprom_magic] OUT: [1:retval][1:cmd]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | × | ✓ ColorHug2 | × | ✓ ColorHug+ | × | ✓ ColorHugALS | × | ×

CMD_WRITE_FLASH: number

Write raw data to the flash memory. You can only write aligned to a 32 byte boundary, and you must flush any incomplete 64 byte block.

IN: [1:cmd][2:address][1:length][1:checksum][1-32:data] OUT: [1:retval][1:cmd]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | ✓ | × ColorHug2 | ✓ | × ColorHug+ | ✓ | × ColorHugALS | ✓ | ×

CMD_WRITE_SRAM: number

Write raw data to the SRAM memory.

IN: [1:cmd][2:address][1:length][1-60:data] OUT: [1:retval][1:cmd]

This command is available under these conditions:

           |  Bootloader  |  Firmware

---------------+--------------+----------- ColorHug | × | × ColorHug2 | × | ✓ ColorHug+ | × | ✓ ColorHugALS | × | ×

DEVICE_GUID_COLORHUG: string
DEVICE_GUID_COLORHUG2: string
DEVICE_GUID_COLORHUG_ALS: string
DEVICE_GUID_COLORHUG_PLUS: string
DEVICE_USB_TIMEOUT: number
EEPROM_ADDR_RUNCODE: number
EEPROM_ADDR_RUNCODE_ALS: number
EP0_TRANSFER_SIZE: number
EP0_TRANSFER_SIZE_V2: number
FIRMWARE_ID_TOKEN1: string
FIRMWARE_ID_TOKEN2: string
FIRMWARE_ID_TOKEN_ALS: string
FIRMWARE_ID_TOKEN_PLUS: string
FLASH_ERASE_BLOCK_SIZE: number
FLASH_RECONNECT_TIMEOUT: number
FLASH_TRANSFER_BLOCK_SIZE: number
FLASH_WRITE_BLOCK_SIZE: number
INTEGRAL_TIME_VALUE_100MS: number
INTEGRAL_TIME_VALUE_200MS: number
INTEGRAL_TIME_VALUE_50MS: number
INTEGRAL_TIME_VALUE_5MS: number
INTEGRAL_TIME_VALUE_MAX: number
OWNER_LENGTH_MAX: number
USB_CONFIG: number
USB_HID_EP: number
USB_HID_EP_IN: number
USB_HID_EP_OUT: number
USB_HID_EP_SIZE: number
USB_INTERFACE: number
USB_PID_BOOTLOADER: number
USB_PID_BOOTLOADER2: number
USB_PID_BOOTLOADER_ALS: number
USB_PID_BOOTLOADER_PLUS: number
USB_PID_FIRMWARE: number
USB_PID_FIRMWARE2: number
USB_PID_FIRMWARE_ALS: number
USB_PID_FIRMWARE_ALS_SENSOR_HID: number
USB_PID_FIRMWARE_PLUS: number
USB_PID_LEGACY: number
USB_VID: number
USB_VID_LEGACY: number
WRITE_EEPROM_MAGIC: string

Functions

  • commandToString(cmd: number): string
  • deviceCheckFirmware(device: GUsb.Device, data: number, dataLen: number): boolean
  • Checks the firmware is suitable for the ColorHug device that is attached.

    Parameters

    • device: GUsb.Device
    • data: number

      firmware binary data

    • dataLen: number

      size of data

    Returns boolean

  • deviceErrorQuark(): Quark
  • deviceGetCcdCalibration(device: GUsb.Device, nmStart: number, c0: number, c1: number, c2: number, cancellable: Gio.Cancellable): boolean
  • Gets any PCB wavelength_cal from the device.

    Parameters

    • device: GUsb.Device

      A #GUsbDevice

    • nmStart: number
    • c0: number
    • c1: number
    • c2: number
    • cancellable: Gio.Cancellable

      a #GCancellable, or %NULL

    Returns boolean

  • deviceGetRuncodeAddress(device: GUsb.Device): number
  • Gets the device mode from the unique code stored in the firmware data. The firmware identifier has been present since colorhug-1.2.2.bin for ColorHug and all firmware versions for ColorHug2 and ColorHug+.

    Parameters

    • data: number

      firmware binary data

    • dataLen: number

      size of data

    Returns ColorHug.DeviceMode

  • deviceSetCcdCalibration(device: GUsb.Device, nmStart: number, c0: number, c1: number, c2: number, cancellable: Gio.Cancellable): boolean
  • Sets any PCB wavelength_cal on the device

    Parameters

    • device: GUsb.Device

      A #GUsbDevice

    • nmStart: number
    • c0: number
    • c1: number
    • c2: number
    • cancellable: Gio.Cancellable

      a #GCancellable, or %NULL

    Returns boolean

  • Sets the firmware signing keys on the device.

    IMPORTANT: This can only be called once until the device is unlocked.

    Parameters

    • device: GUsb.Device

      A #GUsbDevice

    • keys: number

      a set of XTEA keys

    • cancellable: Gio.Cancellable

      a #GCancellable, or %NULL

    Returns boolean

  • Sets the integration value for the next sample.

    Parameters

    • device: GUsb.Device

      A #GUsbDevice

    • value: number

      integration time in ms

    • cancellable: Gio.Cancellable

      a #GCancellable, or %NULL

    Returns boolean

  • deviceWriteCommand(device: GUsb.Device, cmd: number, bufferIn: number, bufferInLen: number, bufferOut: number, bufferOutLen: number, cancellable: Gio.Cancellable): boolean
  • Sends a message to the device and waits for a reply.

    Parameters

    • device: GUsb.Device

      A #GUsbDevice

    • cmd: number

      The command to use, e.g. %CH_CMD_GET_COLOR_SELECT

    • bufferIn: number

      The input buffer of data, or %NULL

    • bufferInLen: number

      The input buffer length

    • bufferOut: number

      The output buffer of data, or %NULL

    • bufferOutLen: number

      The output buffer length

    • cancellable: Gio.Cancellable

      A #GCancellable or %NULL

    Returns boolean

  • Sends a message to the device and waits for a reply.

    Parameters

    • device: GUsb.Device

      A #GUsbDevice

    • cmd: number

      The command to use, e.g. %CH_CMD_GET_COLOR_SELECT

    • bufferIn: number

      The input buffer of data, or %NULL

    • bufferInLen: number

      The input buffer length

    • bufferOut: number

      The output buffer of data, or %NULL

    • bufferOutLen: number

      The output buffer length

    • cancellable: Gio.Cancellable

      A #GCancellable, or %NULL

    • callback: AsyncReadyCallback

      A #GAsyncReadyCallback that will be called when finished.

    Returns void

  • multiplierToString(multiplier: FreqScale): string
  • sha1Parse(value: string, sha1: Sha1): boolean
  • Parses a SHA1 hash from a string value.

    Parameters

    • value: string

      A string representation of the SHA1 hash

    • sha1: Sha1

      A %ChSha1

    Returns boolean

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method