API Reference

Modules

verylittlewire

Top-level package for verylittlewire.

USB Control Transfers

The Little Wire USB device firmware version 1.2 supports the following Control Transfer sequences. In the Setup Packet of the Setup Stage only the bmRequestType = 0xC0 will be accepted. That means:

D7 Data Phase Transfer Direction

1 = Device to Host

D6…5 Type

2 = Vendor

D4…0 Recipient

0 = Device

The number of bytes to transfer have to be constant wLength = 8 for each Setup Packet. That means that each Setup Stage follows a Data Stage.

USB Control Transfer Requests Overview

Little Wire Firmware all well known Control Transfer Requests

Setup Packet

Functional Classification

Firmware Status

bRequest

Name

0

ECHO

USBtiny Generic

1

READ

2

WRITE

3

CLR

4

SET

5

POWERUP

USBtinyISP/SPI Programming

6

POWERDOWN

7

SPI

8

POLL_BYTES

9

FLASH_READ

10

FLASH_WRITE

11

EEPROM_READ

12

EEPROM_WRITE

13

PIN_SET_INPUT

Little Wire GPIO

active

14

PIN_SET_OUTPUT

active

15

READ_ADC

Little Wire ADC

active

16

SETUP_PWM

Little Wire PWM

active

17

UPDATE_PWM_COMPARE

active

18

PIN_SET_HIGH

Little Wire GPIO

active

19

PIN_SET_LOW

active

20

PIN_READ

active

21

SINGLE_SPI

Little Wire SPI

obsolete with V1.2

22

CHANGE_PWM_PRESCALE

Little Wire PWM

active

23

SETUP_SPI

Little Wire SPI

accepted

24

SETUP_I2C

Little Wire I²C

obsolete with V1.2

25

I2C_BEGIN_TX

obsolete with V1.2

26

I2C_ADD_BUFFER

obsolete with V1.2

27

I2C_SEND_BUFFER

obsolete with V1.2

28

SPI_ADD_BUFFER

Little Wire SPI

obsolete with V1.2

29

SPI_SEND_BUFFER

obsolete with V1.2

30

I2C_REQUEST_FROM

Little Wire I²C

obsolete with V1.2

31

SPI_UPDATE_DELAY

Little Wire SPI

active

32

STOP_PWM

Little Wire PWM

active

33

DEBUG_SPI

Little Wire SPI

active

34

VERSION_QUERY

Little Wire Generic

active

35

SETUP_ADC

Little Wire ADC

new in V1.2

36

GAP – spare Control Transfer Requests –

37

38

39

40

READ_RESULT

Little Wire Generic

new in V1.2

41

OW_RESET_PULSE

Little Wire One-Wire

new in V1.2

42

OW_WRITE_BYTE

new in V1.2

43

OW_READ_BYTE

new in V1.2

44

I2C_INIT

Little Wire I²C

new in V1.2

45

I2C_START

new in V1.2

46

I2C_READ

new in V1.2

47

SOFT_PWM_INIT

Little Wire Soft-PWM

new in V1.2

48

SOFT_PWM_UPDATE

new in V1.2

49

I2C_UPDATE_DELAY

Little Wire I²C

new in V1.2

50

OW_READ_BIT

Little Wire One-Wire

new in V1.2

51

OW_WRITE_BIT

new in V1.2

52

PIC24F_PROG

Little Wire Experimental

experimental in V1.2

53

PIC24F_SENDSIX

experimental in V1.2

54

WS2812_EXEC

Little Wire WS2812

new in V1.2

55

SERNUM_CHANGE

Little Wire Generic

new in V1.2

56

GAP – spare Control Transfer Requests –

57

58

… … …

0xDx

PIC24F_TRANSFER

Little Wire Experimental

experimental in V1.2

0xEx

I2C_TRANSFER

Little Wire I²C

new in V1.2

0xFx

SPI_TRANSFER

Little Wire SPI

active

USBtiny Generic

Little Wire Firmware USBtiny Generic Control Transfer Requests

Setup Packet

Description / Notes

bRequest

Name

wValue

wIndex

Implementation / Interfaces

0

ECHO

echo all content in Data Stage back to host

OUTPUT ::= 
INPUT  ::= 

Implementation

Little Wire Firmware V1.2

  • main.c:448bRequest changed hard to 0x21 in response

Interfaces

Little Wire C/C++ API

  • not available

Very Little Wire Python API

  • not available

1

READ

read READ:value from memory READ:address

READ:address

OUTPUT  ::=  value
INPUT   ::=  address
value   ::=  (uint8)0…0xFF
address ::=  (uint16)0…0xFFFF

Implementation

Little Wire Firmware V1.2

Interfaces

Little Wire C/C++ API

  • not available

Very Little Wire Python API

  • not available

2

WRITE

write WRITE:value to memory WRITE:address

WRITE:value

WRITE:address

OUTPUT  ::= 
INPUT   ::=  address & value
value   ::=  (uint8)0…0xFF
address ::=  (uint16)0…0xFFFF

Implementation

Little Wire Firmware V1.2

Interfaces

Little Wire C/C++ API

  • not available

Very Little Wire Python API

  • not available

3

CLR

clear bit CLR:bitno on memory CLR:address

CLR:bitno

CLR:address

OUTPUT  ::= 
INPUT   ::=  address & bitno
bitno   ::=  (uint8)0…7
address ::=  (uint16)0…0xFFFF

Implementation

Little Wire Firmware V1.2

Interfaces

Little Wire C/C++ API

  • not available

Very Little Wire Python API

  • not available

4

SET

set bit SET:bitno on memory SET:address

SET:bitno

SET:address

OUTPUT  ::= 
INPUT   ::=  address & bitno
bitno   ::=  (uint8)0…7
address ::=  (uint16)0…0xFFFF

Implementation

Firmware

Interfaces

Little Wire C/C++ API

  • not available

Very Little Wire Python API

  • not available

USBtinyISP/SPI Programming

Little Wire Firmware USBtiny Generic Control Transfer Requests

Setup Packet

Description / Notes

bRequest

Name

wValue

wIndex

Implementation / Interfaces

5

POWERUP

POWERUP:period

POWERUP:reset

OUTPUT ::= 
INPUT  ::=  period & reset
period ::= 
reset  ::= 

Implementation

Little Wire Firmware V1.2

AVR Dude V7.0

Interfaces

Little Wire C/C++ API

  • not available

Very Little Wire Python API

  • not available

6

POWERDOWN

OUTPUT ::= 
INPUT  ::= 

Implementation

Little Wire Firmware V1.2

AVR Dude V7.0

Interfaces

Little Wire C/C++ API

  • not available

Very Little Wire Python API

  • not available

7

SPI

SPI:c1c0

SPI:c3c2

OUTPUT ::= 
INPUT  ::=  c1c0 & c3c2
c1c0   ::= 
c3c2   ::= 

Implementation

Little Wire Firmware V1.2

AVR Dude V7.0

Interfaces

Little Wire C/C++ API

  • not available

Very Little Wire Python API

  • not available

8

POLL_BYTES

POLL_BYTES:p1p2

OUTPUT ::= 
INPUT  ::=  p1p2
p1p2   ::= 

Implementation

Little Wire Firmware V1.2

AVR Dude V7.0

Interfaces

Little Wire C/C++ API

  • not available

Very Little Wire Python API

  • not available

9

FLASH_READ

FLASH_READ:address

OUTPUT  ::= 
INPUT   ::=  address
address ::= 

Implementation

Little Wire Firmware V1.2

AVR Dude V7.0

Interfaces

Little Wire C/C++ API

  • not available

Very Little Wire Python API

  • not available

10

FLASH_WRITE

FLASH_WRITE:timeout

FLASH_WRITE:address

OUTPUT  ::= 
INPUT   ::=  timeout & address
timeout ::= 
address ::= 

Implementation

Little Wire Firmware V1.2

AVR Dude V7.0

Interfaces

Little Wire C/C++ API

  • not available

Very Little Wire Python API

  • not available

11

EEPROM_READ

EEPROM_READ:address

OUTPUT  ::= 
INPUT   ::=  address
address ::= 

Implementation

Little Wire Firmware V1.2

AVR Dude V7.0

Interfaces

Little Wire C/C++ API

  • not available

Very Little Wire Python API

  • not available

12

EEPROM_WRITE

EEPROM_WRITE:timeout

EEPROM_WRITE:address

OUTPUT  ::= 
INPUT   ::=  timeout & address
timeout ::= 
address ::= 

Implementation

Little Wire Firmware V1.2

AVR Dude V7.0

Interfaces

Little Wire C/C++ API

  • not available

Very Little Wire Python API

  • not available

Little Wire Generic

Little Wire Firmware Generic Control Transfer Requests

Setup Packet

Description / Notes

bRequest

Name

wValue

wIndex

Implementation / Interfaces

34

VERSION_QUERY

OUTPUT ::= 
INPUT  ::= 

Implementation

Little Wire Firmware V1.2 – active

Interfaces

Little Wire C/C++ API

Very Little Wire Python API

40

READ_RESULT

OUTPUT ::= 
INPUT  ::= 

Implementation

Little Wire Firmware V1.2 – new in V1.2

Interfaces

Little Wire C/C++ API

Very Little Wire Python API

  • not yet ported

55

SERNUM_CHANGE

SERNUM_CHANGE:snb1snb0

SERNUM_CHANGE:snb2

OUTPUT   ::= 
INPUT    ::=  snb1snb0 & snb2
snb1snb0 ::= 
snb2     ::= 

Implementation

Little Wire Firmware V1.2 – new in V1.2

Interfaces

Little Wire C/C++ API

Very Little Wire Python API

  • not implemented

Little Wire GPIO

Little Wire Firmware GPIO Control Transfer Requests

Setup Packet

Description / Notes

bRequest

Name

wValue

wIndex

Implementation / Interfaces

13

PIN_SET_INPUT

PIN_SET_INPUT:pin

OUTPUT ::= 
INPUT  ::=  pin
pin    ::= 

Implementation

Little Wire Firmware V1.2 – active

Interfaces

Little Wire C/C++ API

Very Little Wire Python API

14

PIN_SET_OUTPUT

PIN_SET_OUTPUT:pin

OUTPUT ::= 
INPUT  ::=  pin
pin    ::= 

Implementation

Little Wire Firmware V1.2 – active

Interfaces

Little Wire C/C++ API

Very Little Wire Python API

18

PIN_SET_HIGH

PIN_SET_HIGH:pin

OUTPUT ::= 
INPUT  ::=  pin
pin    ::= 

Implementation

Little Wire Firmware V1.2 – active

Interfaces

Little Wire C/C++ API

Very Little Wire Python API

19

PIN_SET_LOW

PIN_SET_LOW:pin

OUTPUT ::= 
INPUT  ::=  pin
pin    ::= 

Implementation

Little Wire Firmware V1.2 – active

Interfaces

Little Wire C/C++ API

Very Little Wire Python API

20

PIN_READ

PIN_READ:pin

OUTPUT ::=  state
INPUT  ::=  pin
pin    ::= 
state  ::= 

Implementation

Little Wire Firmware V1.2 – active

Interfaces

Little Wire C/C++ API

Very Little Wire Python API

Little Wire ADC

Little Wire Firmware ADC Control Transfer Requests

Setup Packet

Description / Notes

bRequest

Name

wValue

wIndex

Implementation / Interfaces

35

SETUP_ADC

SETUP_ADC:vref

OUTPUT ::= 
INPUT  ::=  vref
vref   ::= 

Implementation

Little Wire Firmware V1.2 – new in V1.2

Interfaces

Little Wire C/C++ API

Very Little Wire Python API

15

READ_ADC

READ_ADC:channel

OUTPUT  ::=  value
INPUT   ::=  channel
channel ::= 
value   ::= 

Implementation

Little Wire Firmware V1.2 – active

Interfaces

Little Wire C/C++ API

Very Little Wire Python API

Little Wire PWM

Little Wire Firmware PWM Control Transfer Requests

Setup Packet

Description / Notes

bRequest

Name

wValue

wIndex

Implementation / Interfaces

16

SETUP_PWM

OUTPUT ::= 
INPUT  ::= 

Implementation

Little Wire Firmware V1.2 – active

Interfaces

Little Wire C/C++ API

Very Little Wire Python API

17

UPDATE_PWM_COMPARE

UPDATE_PWM:chAcomp

UPDATE_PWM:chBcomp

OUTPUT  ::= 
INPUT   ::=  chAcomp & chBcomp
chAcomp ::= 
chBcomp ::= 

Implementation

Little Wire Firmware V1.2 – active

Interfaces

Little Wire C/C++ API

Very Little Wire Python API

22

CHANGE_PWM_PRESCALE

CHANGE_PWM:prescale

OUTPUT   ::= 
INPUT    ::=  prescale
prescale ::= 

Implementation

Little Wire Firmware V1.2 – active

Interfaces

Little Wire C/C++ API

Very Little Wire Python API

32

STOP_PWM

OUTPUT ::= 
INPUT  ::= 

Implementation

Little Wire Firmware V1.2 – active

Interfaces

Little Wire C/C++ API

Very Little Wire Python API

Little Wire SPI

Little Wire Firmware SPI Control Transfer Requests

Setup Packet

Description / Notes

bRequest

Name

wValue

wIndex

Implementation / Interfaces

21

SINGLE_SPI

obsolete with V1.2

OUTPUT ::= 
INPUT  ::= 

Implementation

Little Wire Firmware V1.2 – obsolete with V1.2

  • not available

last time supported by firmware V1.1

Interfaces

Little Wire C/C++ API

  • not available

Very Little Wire Python API

  • not available

23

SETUP_SPI

accepted

OUTPUT ::= 
INPUT  ::= 

Implementation

Little Wire Firmware V1.2 – accepted

  • not needed anymore

last time implemented by firmware V1.1

Interfaces

Little Wire C/C++ API

Very Little Wire Python API

  • not available

28

SPI_ADD_BUFFER

obsolete with V1.2

OUTPUT ::= 
INPUT  ::= 

Implementation

Little Wire Firmware V1.2 – obsolete with V1.2

  • not available

last time supported by firmware V1.1

Interfaces

Little Wire C/C++ API

  • not available

Very Little Wire Python API

  • not available

29

SPI_SEND_BUFFER

obsolete with V1.2

OUTPUT ::= 
INPUT  ::= 

Implementation

Little Wire Firmware V1.2 – obsolete with V1.2

  • not available

last time supported by firmware V1.1

Interfaces

Little Wire C/C++ API

  • not available

Very Little Wire Python API

  • not available

31

SPI_UPDATE_DELAY

SPI_UPDATE:duration

OUTPUT   ::= 
INPUT    ::=  duration
duration ::= 

Implementation

Little Wire Firmware V1.2 – active

Interfaces

Little Wire C/C++ API

Very Little Wire Python API

  • not yet ported

33

DEBUG_SPI

OUTPUT ::= 
INPUT  ::= 

Implementation

Little Wire Firmware V1.2 – active

Interfaces

Little Wire C/C++ API

Very Little Wire Python API

  • not yet ported

0xFx

SPI_TRANSFER

SPI_TRANSFER:c1c0

SPI_TRANSFER:c3c2

OUTPUT ::= 
INPUT  ::=  c1c0 & c3c2
c1c0   ::= 
c3c2   ::= 

Implementation

Little Wire Firmware V1.2 – active

Interfaces

Little Wire C/C++ API

Very Little Wire Python API

  • not yet ported

Little Wire I²C

Little Wire Firmware I²C Control Transfer Requests

Setup Packet

Description / Notes

bRequest

Name

wValue

wIndex

Implementation / Interfaces

24

SETUP_I2C

obsolete with V1.2

OUTPUT ::= 
INPUT  ::= 

Implementation

Little Wire Firmware V1.2 – obsolete with V1.2

  • not available

last time supported by firmware V1.1

Interfaces

Little Wire C/C++ API

  • not available

Very Little Wire Python API

  • not available

25

I2C_BEGIN_TX

obsolete with V1.2

OUTPUT ::= 
INPUT  ::= 

Implementation

Little Wire Firmware V1.2 – obsolete with V1.2

  • not available

last time supported by firmware V1.1

Interfaces

Little Wire C/C++ API

  • not available

Very Little Wire Python API

  • not available

26

I2C_ADD_BUFFER

obsolete with V1.2

OUTPUT ::= 
INPUT  ::= 

Implementation

Little Wire Firmware V1.2 – obsolete with V1.2

  • not available

last time supported by firmware V1.1

Interfaces

Little Wire C/C++ API

  • not available

Very Little Wire Python API

  • not available

27

I2C_SEND_BUFFER

obsolete with V1.2

OUTPUT ::= 
INPUT  ::= 

Implementation

Little Wire Firmware V1.2 – obsolete with V1.2

  • not available

last time supported by firmware V1.1

Interfaces

Little Wire C/C++ API

  • not available

Very Little Wire Python API

  • not available

30

I2C_REQUEST_FROM

obsolete with V1.2

OUTPUT ::= 
INPUT  ::= 

Implementation

Little Wire Firmware V1.2 – obsolete with V1.2

  • not available

last time supported by firmware V1.1

Interfaces

Little Wire C/C++ API

  • not available

Very Little Wire Python API

  • not available

44

I2C_INIT

OUTPUT ::= 
INPUT  ::= 

Implementation

Little Wire Firmware V1.2 – new in V1.2

Interfaces

Little Wire C/C++ API

Very Little Wire Python API

  • not yet ported

45

I2C_START

I2C_START:diraddr

OUTPUT    ::= 
INPUT     ::=  diraddr
diraddr   ::=  direction | address
direction ::= 
address   ::= 

Implementation

Little Wire Firmware V1.2 – new in V1.2

Interfaces

Little Wire C/C++ API

Very Little Wire Python API

  • not yet ported

46

I2C_READ

I2C_READ:length

I2C_READ:stop

OUTPUT ::= 
INPUT  ::=  length & stop
length ::= 
stop   ::= 

Implementation

Little Wire Firmware V1.2 – new in V1.2

Interfaces

Little Wire C/C++ API

Very Little Wire Python API

  • not yet ported

49

I2C_UPDATE_DELAY

I2C_UPDATE:duration

OUTPUT   ::= 
INPUT    ::=  duration
duration ::= 

Implementation

Little Wire Firmware V1.2 – new in V1.2

Interfaces

Little Wire C/C++ API

Very Little Wire Python API

  • not yet ported

0xEx

I2C_TRANSFER

I2C_TRANSFER:c1c0

I2C_TRANSFER:c3c2

OUTPUT ::= 
INPUT  ::=  c1c0 & c3c2
c1c0   ::= 
c3c2   ::= 

Implementation

Little Wire Firmware V1.2 – new in V1.2

Interfaces

Little Wire C/C++ API

Very Little Wire Python API

  • not yet ported

Little Wire Soft-PWM

Little Wire Firmware Soft-PWM Control Transfer Requests

Setup Packet

Description / Notes

bRequest

Name

wValue

wIndex

Implementation / Interfaces

47

SOFT_PWM_INIT

SWPWM_INIT:state

OUTPUT ::= 
INPUT  ::=  state
state  ::= 

Implementation

Little Wire Firmware V1.2 – new in V1.2

Interfaces

Little Wire C/C++ API

Very Little Wire Python API

  • not yet ported

48

SOFT_PWM_UPDATE

SWPWM_UPDATE:ch2ch1

SWPWM_UPDATE:ch3

OUTPUT ::= 
INPUT  ::=  ch2ch1 & ch3
ch2ch1 ::= 
ch3    ::= 

Implementation

Little Wire Firmware V1.2 – new in V1.2

Interfaces

Little Wire C/C++ API

Very Little Wire Python API

  • not yet ported

Little Wire One-Wire

Little Wire Firmware One-Wire Control Transfer Requests

Setup Packet

Description / Notes

bRequest

Name

wValue

wIndex

Implementation / Interfaces

41

OW_RESET_PULSE

OUTPUT ::= 
INPUT  ::= 

Implementation

Little Wire Firmware V1.2 – new in V1.2

Interfaces

Little Wire C/C++ API

Very Little Wire Python API

  • not yet ported

42

OW_WRITE_BYTE

OW_WRITE_BYTE:message

OUTPUT  ::= 
INPUT   ::=  message
message ::= 

Implementation

Little Wire Firmware V1.2 – new in V1.2

Interfaces

Little Wire C/C++ API

Very Little Wire Python API

  • not yet ported

43

OW_READ_BYTE

OUTPUT  ::=  message
INPUT   ::= 
message ::= 

Implementation

Little Wire Firmware V1.2 – new in V1.2

Interfaces

Little Wire C/C++ API

Very Little Wire Python API

  • not yet ported

50

OW_READ_BIT

OUTPUT ::=  bitval
INPUT  ::= 
bitval ::= 

Implementation

Little Wire Firmware V1.2 – new in V1.2

Interfaces

Little Wire C/C++ API

Very Little Wire Python API

  • not yet ported

51

OW_WRITE_BIT

OW_WRITE_BIT:bitval

OUTPUT ::= 
INPUT  ::=  bitval
bitval ::= 

Implementation

Little Wire Firmware V1.2 – new in V1.2

Interfaces

Little Wire C/C++ API

Very Little Wire Python API

  • not yet ported

Little Wire WS2812

Little Wire Firmware WS2812 Control Transfer Requests

Setup Packet

Description / Notes

bRequest

Name

wValue

wIndex

Implementation / Interfaces

54

WS2812_EXEC

WS2812_EXEC:cGpincmd

WS2812_EXEC:cBcR

OUTPUT   ::= 
INPUT    ::=  cGpincmd & cBcR
cGpincmd ::=  cG + pin + cmd
cBcR     ::=  cB + cR
pin      ::= 
cmd      ::= 
cR       ::= 
cG       ::= 
cB       ::= 

Implementation

Little Wire Firmware V1.2 – new in V1.2

Interfaces

Little Wire C/C++ API

Very Little Wire Python API

  • not yet ported

Little Wire Experimental

Little Wire Firmware Experimental Control Transfer Requests

Setup Packet

Description / Notes

bRequest

Name

wValue

wIndex

Implementation / Interfaces

52

PIC24F_PROG

experimental in V1.2

OUTPUT ::= 
INPUT  ::= 

Implementation

Little Wire Firmware V1.2 – experimental in V1.2

Interfaces

Little Wire C/C++ API

  • not available

Very Little Wire Python API

  • not available

53

PIC24F_SENDSIX

experimental in V1.2

OUTPUT ::= 
INPUT  ::= 

Implementation

Little Wire Firmware V1.2 – experimental in V1.2

Interfaces

Little Wire C/C++ API

  • not available

Very Little Wire Python API

  • not available

0xDx

PIC24F_TRANSFER

PIC24F_TRANSFER:c1c0

PIC24F_TRANSFER:c3c2

experimental in V1.2

OUTPUT ::= 
INPUT  ::=  c1c0 & c3c2
c1c0   ::= 
c3c2   ::= 

Implementation

Little Wire Firmware V1.2 – experimental in V1.2

Interfaces

Little Wire C/C++ API

  • not available

Very Little Wire Python API

  • not available