From 976f4448944685e437a4c8bf34fab83cad6ac371 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sat, 27 Jul 2013 00:18:03 +0000 Subject: added bat interrupt and spi stub git-svn-id: https://svn.spreadspace.org/mur.sat@817 7de4ea59-55d0-425e-a1af-a3118ea81d4c --- software/ihu/ihu.asm | 16 ++++++++++++++-- software/ihu/spi.inc | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 software/ihu/spi.inc (limited to 'software/ihu') diff --git a/software/ihu/ihu.asm b/software/ihu/ihu.asm index 1b483e1..b9cbdad 100644 --- a/software/ihu/ihu.asm +++ b/software/ihu/ihu.asm @@ -145,6 +145,7 @@ STATUS_TEMP EQU H'007F' goto interrupt_end int_ctr + ;; TODO: get byte from CTR (via SPI) bcf INTCON,INTF goto interrupt_end @@ -152,6 +153,13 @@ int_ctr int_portchange btfsc RTC_RST call rtc_init + btfsc BAT_INT + goto int_bat + bcf INTCON,RBIF + goto interrupt_end + +int_bat + ;; TODO: get byte from BAT (via SPI) bcf INTCON,RBIF goto interrupt_end @@ -197,8 +205,8 @@ init bcf STATUS,RP1 movlw b'00111111' ; Weak Pull-UPS for movwf WPUB ; RTC_RST, DEPLOY, CAPGOOD, POWER_FAIL, BAT_INT, CTR_INT - movlw b'00100000' ; Port Change Interrup on - movwf IOCB ; RTC_RST + movlw b'00101000' ; Port Change Interrup on + movwf IOCB ; RTC_RST, BAT_INT movlw b'00000010' ; Weak-Pull-UPs enabled, INT -> falling edge, TMR0 internal clock movwf OPTION_REG ; Prescaler @ TMR0, Prescaler 1:8 clrf PSTRCON ; disable pulse steering @@ -240,6 +248,7 @@ init movwf INTCON call i2c_init + call spi_init clrf TMR0 clrf TMP bsf INTCON,GIE @@ -277,6 +286,9 @@ wait_loop ;; ------------------------------------- include "rtc.inc" + ;; ------------------------------------- + include "spi.inc" + ;; ------------------------------------- ;; include "temp.inc" diff --git a/software/ihu/spi.inc b/software/ihu/spi.inc new file mode 100644 index 0000000..ff8e3c6 --- /dev/null +++ b/software/ihu/spi.inc @@ -0,0 +1,43 @@ + ;; + ;; mur.sat + ;; + ;; Somewhen in the year 2012, mur.at will have a nano satellite launched + ;; into a low earth orbit (310 km above the surface of our planet). The + ;; satellite itself is a TubeSat personal satellite kit, developed and + ;; launched by interorbital systems. mur.sat is a joint venture of mur.at, + ;; ESC im Labor and realraum. + ;; + ;; Please visit the project hompage at sat.mur.at for further information. + ;; + ;; + ;; Copyright (C) 2011-2013 Christian Pointner + ;; + ;; This file is part of mur.sat. + ;; + ;; mur.sat is free software: you can redistribute it and/or modify + ;; it under the terms of the GNU General Public License as published by + ;; the Free Software Foundation, either version 3 of the License, or + ;; any later version. + ;; + ;; mur.sat is distributed in the hope that it will be useful, + ;; but WITHOUT ANY WARRANTY; without even the implied warranty of + ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ;; GNU General Public License for more details. + ;; + ;; You should have received a copy of the GNU General Public License + ;; along with mur.sat. If not, see . + ;; + + ;; ------------------------------------- +spi_init + return + + ;; ------------------ +spi_send_byte + return + + ;; ------------------ +spi_recv_byte + return + + ;; ------------------------------------- -- cgit v1.2.3