Satellite Observers Workbench. NOT yet complete, just published for forum posters to \"cherry pick\" pieces of code as requiered as an example.

Dependencies:   mbed

Committer:
AjK
Date:
Mon Oct 11 10:34:55 2010 +0000
Revision:
0:0a841b89d614
Totally Alpha quality as this project isn\t completed. Just publishing it as it answers many questions asked in the forums

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AjK 0:0a841b89d614 1 /****************************************************************************
AjK 0:0a841b89d614 2 * Copyright 2010 Andy Kirkham, Stellar Technologies Ltd
AjK 0:0a841b89d614 3 *
AjK 0:0a841b89d614 4 * This file is part of the Satellite Observers Workbench (SOWB).
AjK 0:0a841b89d614 5 *
AjK 0:0a841b89d614 6 * SOWB is free software: you can redistribute it and/or modify
AjK 0:0a841b89d614 7 * it under the terms of the GNU General Public License as published by
AjK 0:0a841b89d614 8 * the Free Software Foundation, either version 3 of the License, or
AjK 0:0a841b89d614 9 * (at your option) any later version.
AjK 0:0a841b89d614 10 *
AjK 0:0a841b89d614 11 * SOWB is distributed in the hope that it will be useful,
AjK 0:0a841b89d614 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
AjK 0:0a841b89d614 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
AjK 0:0a841b89d614 14 * GNU General Public License for more details.
AjK 0:0a841b89d614 15 *
AjK 0:0a841b89d614 16 * You should have received a copy of the GNU General Public License
AjK 0:0a841b89d614 17 * along with SOWB. If not, see <http://www.gnu.org/licenses/>.
AjK 0:0a841b89d614 18 *
AjK 0:0a841b89d614 19 * $Id: main.cpp 5 2010-07-12 20:51:11Z ajk $
AjK 0:0a841b89d614 20 *
AjK 0:0a841b89d614 21 ***************************************************************************/
AjK 0:0a841b89d614 22
AjK 0:0a841b89d614 23 #include "sowb.h"
AjK 0:0a841b89d614 24 #include "debug.h"
AjK 0:0a841b89d614 25 #include "gpioirq.h"
AjK 0:0a841b89d614 26
AjK 0:0a841b89d614 27 /* Declare the external interrupt callback functions. */
AjK 0:0a841b89d614 28 extern void MAX7456_vsync_rise(void);
AjK 0:0a841b89d614 29 extern void MAX7456_vsync_fall(void);
AjK 0:0a841b89d614 30 //extern void max7456_los_rise(void);
AjK 0:0a841b89d614 31 //extern void max7456_los_fall(void);
AjK 0:0a841b89d614 32 extern void gps_pps_rise(void);
AjK 0:0a841b89d614 33 extern void gps_pps_fall(void);
AjK 0:0a841b89d614 34
AjK 0:0a841b89d614 35 /** EINT3_IRQHandler
AjK 0:0a841b89d614 36 */
AjK 0:0a841b89d614 37 extern "C" void GPIOIRQ_IRQHandler (void) {
AjK 0:0a841b89d614 38
AjK 0:0a841b89d614 39 /* Test for IRQ on Port0. */
AjK 0:0a841b89d614 40 if (LPC_GPIOINT->IntStatus & 0x1) {
AjK 0:0a841b89d614 41
AjK 0:0a841b89d614 42 /* GPS PPS is connected to MBED P29 (Port0.5) */
AjK 0:0a841b89d614 43 //if (LPC_GPIOINT->IO0IntStatR & (1 << 5)) gps_pps_rise();
AjK 0:0a841b89d614 44
AjK 0:0a841b89d614 45 /* GPS PPS is connected to MBED P29 (Port0.5) */
AjK 0:0a841b89d614 46 if (LPC_GPIOINT->IO0IntStatF & (1 << 5)) gps_pps_fall();
AjK 0:0a841b89d614 47
AjK 0:0a841b89d614 48 /* MAX7456 Vertical Sync is connected to MBED P15 (Port0.23) */
AjK 0:0a841b89d614 49 if (LPC_GPIOINT->IO0IntStatF & (1 << 23)) MAX7456_vsync_fall();
AjK 0:0a841b89d614 50
AjK 0:0a841b89d614 51 /* MAX7456 LOS is connected to P17 (Port0.25) */
AjK 0:0a841b89d614 52 //if (LPC_GPIOINT->IO0IntStatR & (1 << 25)) max7456_los_rise();
AjK 0:0a841b89d614 53
AjK 0:0a841b89d614 54 LPC_GPIOINT->IO0IntClr = (LPC_GPIOINT->IO0IntStatR | LPC_GPIOINT->IO0IntStatF);
AjK 0:0a841b89d614 55 }
AjK 0:0a841b89d614 56
AjK 0:0a841b89d614 57 /* Test for IRQ on Port2. */
AjK 0:0a841b89d614 58 if (LPC_GPIOINT->IntStatus & 0x4) {
AjK 0:0a841b89d614 59
AjK 0:0a841b89d614 60 LPC_GPIOINT->IO2IntClr = (LPC_GPIOINT->IO2IntStatR | LPC_GPIOINT->IO2IntStatF);
AjK 0:0a841b89d614 61 }
AjK 0:0a841b89d614 62 }
AjK 0:0a841b89d614 63
AjK 0:0a841b89d614 64 /** gpioirq_init
AjK 0:0a841b89d614 65 */
AjK 0:0a841b89d614 66 void gpioirq_init(void) {
AjK 0:0a841b89d614 67
AjK 0:0a841b89d614 68 DEBUG_INIT_START;
AjK 0:0a841b89d614 69
AjK 0:0a841b89d614 70 /* Enable the interrupts for connected signals.
AjK 0:0a841b89d614 71 For bit definitions see the ISR function above. */
AjK 0:0a841b89d614 72 LPC_GPIOINT->IO0IntEnR |= ( (1UL << 5) | (1UL << 25) | (1UL << 23) );
AjK 0:0a841b89d614 73 LPC_GPIOINT->IO0IntEnF |= ( (1UL << 5) | (1UL << 25) | (1UL << 23) );
AjK 0:0a841b89d614 74 //LPC_GPIOINT->IO2IntEnR |= ( (1UL << 5) );
AjK 0:0a841b89d614 75 //LPC_GPIOINT->IO2IntEnF |= ( (1UL << 5) );
AjK 0:0a841b89d614 76
AjK 0:0a841b89d614 77 NVIC_SetVector(EINT3_IRQn, (uint32_t)GPIOIRQ_IRQHandler);
AjK 0:0a841b89d614 78 NVIC_EnableIRQ(EINT3_IRQn);
AjK 0:0a841b89d614 79
AjK 0:0a841b89d614 80 DEBUG_INIT_END;
AjK 0:0a841b89d614 81 }
AjK 0:0a841b89d614 82
AjK 0:0a841b89d614 83 void gpioirq_process(void) {
AjK 0:0a841b89d614 84 /* Does nothing, no periodic house keeping required. */
AjK 0:0a841b89d614 85 }
AjK 0:0a841b89d614 86
AjK 0:0a841b89d614 87
AjK 0:0a841b89d614 88