Subversion Repositories NaviCtrl

Rev

Rev 233 | Rev 242 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 233 Rev 241
Line 59... Line 59...
59
#include "91x_lib.h"
59
#include "91x_lib.h"
60
#include "led.h"
60
#include "led.h"
61
#include "gps.h"
61
#include "gps.h"
62
#include "uart1.h"
62
#include "uart1.h"
63
#include "spi_slave.h"
63
#include "spi_slave.h"
64
#include "i2c.h"
64
#include "mk3mag.h"
65
#include "timer1.h"
65
#include "timer1.h"
66
#include "timer2.h"
66
#include "timer2.h"
67
#include "config.h"
67
#include "config.h"
68
#include "main.h"
68
#include "main.h"
69
#include "fifo.h"
69
#include "fifo.h"
Line 280... Line 280...
280
 
280
 
281
        if (SPI_RxBuffer_Request)
281
        if (SPI_RxBuffer_Request)
282
        {
282
        {
283
                // avoid sending data via SPI during the update of the  ToFlightCtrl structure
283
                // avoid sending data via SPI during the update of the  ToFlightCtrl structure
284
                VIC_ITCmd(SSP0_ITLine, DISABLE); // disable SPI interrupt
284
                VIC_ITCmd(SSP0_ITLine, DISABLE); // disable SPI interrupt
285
                ToFlightCtrl.CompassHeading = I2C_Heading.Heading;
285
                ToFlightCtrl.CompassHeading = MK3MAG_Heading.Heading;
286
                DebugOut.Analog[10] = ToFlightCtrl.CompassHeading;
286
                DebugOut.Analog[10] = ToFlightCtrl.CompassHeading;
287
                if(ToFlightCtrl.CompassHeading >= 0) ToFlightCtrl.CompassHeading = (360 + ToFlightCtrl.CompassHeading + FromFlightCtrl.GyroYaw / 12) % 360;
287
                if(ToFlightCtrl.CompassHeading >= 0) ToFlightCtrl.CompassHeading = (360 + ToFlightCtrl.CompassHeading + FromFlightCtrl.GyroYaw / 12) % 360;
288
                // cycle spi commands
288
                // cycle spi commands
289
                ToFlightCtrl.Command = SPI_CommandSequence[SPI_CommandCounter++];
289
                ToFlightCtrl.Command = SPI_CommandSequence[SPI_CommandCounter++];