Difference between revisions of "Pushbutton"

From BitWizard WIKI
Jump to: navigation, search
(The software)
(The software)
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
[[File:spi_pushbutton.jpg|thumb|300px|alt=spi_pushbutton|The pushbutton board (depicted: the SPI version)]]
 
[[File:spi_pushbutton.jpg|thumb|300px|alt=spi_pushbutton|The pushbutton board (depicted: the SPI version)]]
  
This is the documentation page for .  
+
This is the documentation page for the pushbutton boards.  
  
 
== Overview ==
 
== Overview ==
  
 +
This board adds 4 pushbuttons to your I2C or SPI enabled device.
  
 
== Assembly instructions ==
 
== Assembly instructions ==
  
 +
None: the board comes fully assembled.
  
 
=== Possible Configurations ===
 
=== Possible Configurations ===
Line 26: Line 28:
 
== Pinout ==
 
== Pinout ==
  
 +
For the SPI connector see: [[SPI_connector_pinout]].
 +
For the I2C connector see: [[I2C_connector_pinout]].
  
 
=== LEDs ===
 
=== LEDs ===
  
 +
The only LED is a power indicator.
  
 
== Jumper settings ==
 
== Jumper settings ==
  
 +
See [[solder jumpers]] on how to change the solder jumper.
 +
 +
By changing the solder jumper SJ1, you can make the connector SPI0 into an ICSP programming connector for the attiny44 on the board.
  
 
== Programming ==  
 
== Programming ==  
Line 40: Line 48:
 
Reading the pushbuttons is very much like the DIO module. The read and write ports are described below.
 
Reading the pushbuttons is very much like the DIO module. The read and write ports are described below.
  
=== write ports ===
+
=== Write ports ===
  
 
Some ports just set a single value. So writing more than one byte to such a port is redundant. Other ports are logically a stream of bytes. So writing more than one byte is encouraged.  
 
Some ports just set a single value. So writing more than one byte to such a port is redundant. Other ports are logically a stream of bytes. So writing more than one byte is encouraged.  
Line 51: Line 59:
 
|}
 
|}
  
=== read ports ===
+
=== Read ports ===
 
The pushbutton board supports several read ports:  
 
The pushbutton board supports several read ports:  
  
Line 61: Line 69:
 
| 0x02 || read eeprom (serial number).  
 
| 0x02 || read eeprom (serial number).  
 
|-
 
|-
| 0x20 || read button 1
+
| 0x10 || read all buttons
 +
|-
 +
| 0x20 || read button 1 (1 means NOT pushed, 0 means pushed)
 +
|-
 +
| 0x21 || read button 2 (1 means NOT pushed, 0 means pushed)
 +
|-
 +
| 0x22 || read button 3 (1 means NOT pushed, 0 means pushed)
 
|-
 
|-
| 0x21 || read button 2
+
| 0x23 || read button 4 (1 means NOT pushed, 0 means pushed)
 
|-
 
|-
| 0x22 || read button 3
+
| 0x30 || reports which buttons have been pushed since last read of this register
 
|-
 
|-
| 0x23 || read button 4
+
| 0x40 || read button 1 (1 means pushed, 0 means NOT pushed) (V1.1 and up)
 
|-
 
|-
| 0x24 || read button 5
+
| 0x41 || read button 2 (1 means pushed, 0 means NOT pushed) (V1.1 and up)
 
|-
 
|-
| 0x25 || read button 6
+
| 0x42 || read button 3 (1 means pushed, 0 means NOT pushed) (V1.1 and up)
 
|-
 
|-
| 0x30 || reports which buttons have been pushed since last read of this register
+
| 0x43 || read button 4 (1 means pushed, 0 means NOT pushed) (V1.1 and up)
 
|}
 
|}
  
Line 87: Line 101:
 
== Changelog ==
 
== Changelog ==
  
 +
=== 1.0 ===
  
===  ===
 
 
* Initial public release
 
* Initial public release

Latest revision as of 11:59, 11 November 2015

spi_pushbutton
The pushbutton board (depicted: the SPI version)

This is the documentation page for the pushbutton boards.

Overview

This board adds 4 pushbuttons to your I2C or SPI enabled device.

Assembly instructions

None: the board comes fully assembled.

Possible Configurations

External resources

Datasheets

Additional software

Related projects

Pinout

For the SPI connector see: SPI_connector_pinout. For the I2C connector see: I2C_connector_pinout.

LEDs

The only LED is a power indicator.

Jumper settings

See solder jumpers on how to change the solder jumper.

By changing the solder jumper SJ1, you can make the connector SPI0 into an ICSP programming connector for the attiny44 on the board.

Programming

The software

Reading the pushbuttons is very much like the DIO module. The read and write ports are described below.

Write ports

Some ports just set a single value. So writing more than one byte to such a port is redundant. Other ports are logically a stream of bytes. So writing more than one byte is encouraged.

The pushbutton board defines just one port.

port function
0xf0 change address.

Read ports

The pushbutton board supports several read ports:

port function
0x01 identification string. (terminated with 0).
0x02 read eeprom (serial number).
0x10 read all buttons
0x20 read button 1 (1 means NOT pushed, 0 means pushed)
0x21 read button 2 (1 means NOT pushed, 0 means pushed)
0x22 read button 3 (1 means NOT pushed, 0 means pushed)
0x23 read button 4 (1 means NOT pushed, 0 means pushed)
0x30 reports which buttons have been pushed since last read of this register
0x40 read button 1 (1 means pushed, 0 means NOT pushed) (V1.1 and up)
0x41 read button 2 (1 means pushed, 0 means NOT pushed) (V1.1 and up)
0x42 read button 3 (1 means pushed, 0 means NOT pushed) (V1.1 and up)
0x43 read button 4 (1 means pushed, 0 means NOT pushed) (V1.1 and up)

Default operation

Future hardware enhancements

Future software enhancements

Changelog

1.0

  • Initial public release