Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of TFOX_CDMS_VR_1_0_WORKING by
Revision 8:f3b50b921414, committed 2015-06-17
- Comitter:
- sakthipriya
- Date:
- Wed Jun 17 09:55:09 2015 +0000
- Parent:
- 7:4f17f1afe95e
- Commit message:
- final code for IM review
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
power.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Tue Jun 16 20:14:03 2015 +0000 +++ b/main.cpp Wed Jun 17 09:55:09 2015 +0000 @@ -1,21 +1,24 @@ +/*****************************************************Header Files*********************************************************************/ #include "mbed.h" #include "rtos.h" #include "func_head.h" #include "i2c.h" #include "SDCard.h" #include "HK_CDMS.h" + + #define HK_DATA 25 #define HK_ITER 5 Serial pc(USBTX,USBRX); -extern SPISlave pl_spi ; // mosi, miso, sclk, ssel --> using SPI1 - -InterruptIn pl_sc_data(PTC3); -InterruptIn cdms_rcv_tc(PTC12); -InterruptIn bae_tm_rcv(PTC11); -InterruptIn pl_tm_rcv(PTC10); +/**************************************************Declaring pins*********************************************************************/ +InterruptIn pl_sc_data(PTC3); //interrupt from payload to send science data +InterruptIn cdms_rcv_tc(PTC12); //interrupt from comm b4 sending tc +InterruptIn bae_tm_rcv(PTC11); //interrupt from bae b4 sending tm +InterruptIn pl_tm_rcv(PTC10); ////interrupt from bae b4 sending tm extern I2C master; extern DigitalOut irpt_2_slv; +extern SPISlave pl_spi ; // mosi, miso, sclk, ssel --> using SPI1 char i2c_data[25]; int hk_count=0; @@ -95,6 +98,7 @@ pc.printf("%d|",hk_data[i]); } // FCTN_CDMS_HK_MAIN(); + FCTN_POWER_MODE(80); //to check dummy power algo } pc.printf("\n\r hk exited\n"); }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/power.cpp Wed Jun 17 09:55:09 2015 +0000 @@ -0,0 +1,36 @@ +#include "pin_config.h" + +#define COMM_TX_EN_PIN PIN64 //COMM receiver enable +#define PYLD_EN_PIN PIN73 // Payload switch enable + +DigitalOut COMM_TX_EN(COMM_TX_EN_PIN); //assuming active high +DigitalOut PYLD_EN(PYLD_EN_PIN); //assuming active high + +void FCTN_POWER_MODE(int SOC) //flag corresponds to the power mode +{ + printf("Entered Power Management \n"); + printf("Battery Level %d \n",SOC); + // range of battery level is dummy. yet to be fixed + else if(SOC>=85) + { + COMM_TX_EN = 1; //high power mode : everything is on + PYLD_EN = 1; + } + else if(SOC<85 && SOC>=70) + { + COMM_TX_EN = 1; //COMM TX is on + PYLD_EN = 1; //payload switch enable + } + else if(SOC<55 && SOC>=70) + { + COMM_TX_EN = 1; //COMM TX is off + PYLD_EN = 0; //payload switch disable + } + else if(SOC<40 && SOC>=55) + { + COMM_TX_EN = 1; //COMM TX is off + PYLD_EN = 0; //payload switch disable + } + + +}