i2c slave integrated

Dependencies:   mbed-rtos mbed

Fork of BAE_FRDM_INTEGRATION by green rosh

fault.cpp

Committer:
raizel_varun
Date:
2014-12-09
Revision:
6:e65b1ab79f36
Parent:
5:255b43e8e21a
Child:
7:f06840d848e3

File content as of revision 6:e65b1ab79f36:

#include "fault.h"
#include "HK.h"


DigitalIn fault1(FAULT1);
DigitalIn fault2(FAULT2);
DigitalIn fault3(FAULT3);
DigitalIn fault4(FAULT4);
DigitalIn fault5(FAULT5);
DigitalIn fault6(FAULT6);
DigitalIn fault7(FAULT7);
DigitalIn fault8(FAULT8);


DigitalOut clear1(FAULT_CLEAR1,0);
DigitalOut clear2(FAULT_CLEAR2,0);
DigitalOut clear3(FAULT_CLEAR3,0);
DigitalOut clear4(FAULT_CLEAR4,0);
DigitalOut clear5(FAULT_CLEAR5,0);
DigitalOut clear6(FAULT_CLEAR6,0);
DigitalOut clear7(FAULT_CLEAR7,0);
DigitalOut clear8(FAULT_CLEAR8,0);

DigitalOut acs_active(ACS);


BusOut clear(FAULT_CLEAR1,FAULT_CLEAR2,FAULT_CLEAR3,FAULT_CLEAR4,FAULT_CLEAR5,FAULT_CLEAR6,FAULT_CLEAR7,FAULT_CLEAR8);//to send fault data along with hk

extern SensorData Sensor;
extern int beacon_sc;  //to switch beacon between low and high power mode
extern int acs_pflag;  //to activate/deactivate control algo  


void FAULTS()
{
        
        printf("Entered Fault management \n");
        clear1 = !fault1; 
        clear2 = !fault2; 
        clear3 = !fault3; 
        clear4 = !fault4; 
        clear5 = !fault5; 
        clear6 = !fault6; 
        clear7 = !fault7; 
        clear8 = !fault8; 
        Sensor.fault = clear;
        printf(" %d \n",Sensor.fault);
        
}

void POWER(char flag)                  //flag corresponds to the power mode
{
    printf("Entered Power Management \n"); 
    printf("Entering mode %c \n", flag);
    switch (flag)
    {
        case '0': beacon_sc = 6;            //least power mode
                  acs_pflag = 0;
                  acs_active = 0;            //switching off a component of acs 
        break;
        case '1': beacon_sc = 3;
                  acs_pflag = 0;
                  acs_active = 0;
        break;
        case '2': beacon_sc = 3;
                  acs_pflag = 0;
                  acs_active = 0;
        break;
        case '3': beacon_sc = 3;             //normal mode  
                  acs_pflag = 1;
                  acs_active = 1;
        break;    
    }
  /*  if (flag == '0')
    beacon_sc = 30;
    else
    beacon_sc = 3;
    if (flag == '3')
    acs_pflag = 1;
    else
    acs_pflag = 0; */
}