add dip8 module for reading bitfields from SPI
authorTero Marttila <terom@fixme.fi>
Sat, 08 May 2010 21:27:32 +0300
changeset 27 359c1771c366
parent 26 db2ec641c955
child 28 51344df466ca
add dip8 module for reading bitfields from SPI
dip.inc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dip.inc	Sat May 08 21:27:32 2010 +0300
@@ -0,0 +1,17 @@
+;;
+;; Reading DIP switches from SPI
+;;
+
+.set DIP_BUFFER = spi_inbuf + 1
+
+;; Read state of dip switches
+;;  Output: r16
+DIP_Read8:
+		; update
+		rcall		SPI_SendRecv
+		
+		; get bits
+		lds			r16, DIP_BUFFER
+
+		ret
+