summaryrefslogtreecommitdiff
path: root/bootloader/com-16f887-spi.inc
diff options
context:
space:
mode:
Diffstat (limited to 'bootloader/com-16f887-spi.inc')
-rw-r--r--bootloader/com-16f887-spi.inc13
1 files changed, 5 insertions, 8 deletions
diff --git a/bootloader/com-16f887-spi.inc b/bootloader/com-16f887-spi.inc
index e4b8d2a..08a3b84 100644
--- a/bootloader/com-16f887-spi.inc
+++ b/bootloader/com-16f887-spi.inc
@@ -20,8 +20,6 @@
;; along with spreadspace pic utils. If not, see <http://www.gnu.org/licenses/>.
;;
-#define INTPIN PORTA,4
-
;; --- transmit byte and add it to csum
com_tx_byte
movwf SSPBUF
@@ -53,12 +51,11 @@ com_rx_got_byte
movf SSPBUF,w
return
- ;; ----- initialize com (not a subroutine, com_init is called by generic_init
+ ;; ----- initialize com (this is called by bootmacro, it's not a subroutine - no return at the end)
com_init
- ;; bank 3
- bsf STATUS,RP0
- bsf STATUS,RP1
- bcf ANSEL,ANS4 ; RA5/SS as digital input
+ ;; bank 3 - we are already there, see bootmacro
+ btfsc BOOTPIN
+ goto USERVECT
;; bank 1
bcf STATUS,RP1
@@ -68,7 +65,7 @@ com_init
movwf SSPSTAT
bcf TRISC,5 ; RC5(SDO) = out
bcf INTPIN ; interrupt line to master
-
+
;; bank 0
bcf STATUS,RP0
movlw b'00100100' ; SSPEN=1,CKP=0,SSPM=0100(SPI Slave with SS)