LP Transmitter Wakeup
Dependencies: max32630fthr USBDevice
Revision 4:2e3db197b7e2, committed 2020-09-04
- Comitter:
- tlyp
- Date:
- Fri Sep 04 20:41:34 2020 +0000
- Parent:
- 3:b0579a51fd46
- Child:
- 5:b6036b8856f9
- Commit message:
- Cleaned up header
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Fri Sep 04 17:52:25 2020 +0000 +++ b/main.cpp Fri Sep 04 20:41:34 2020 +0000 @@ -67,30 +67,30 @@ #include "MAX30208.h" #include "ForwardErrCorr.h" -MAX32630FTHR pegasus(MAX32630FTHR::VIO_3V3); - -I2C i2c(P3_4, P3_5); //sda,scl - -RawSerial uart(P3_1,P3_0);//tx,rx -MAX30208 TempSensor(i2c, 0x50); //Constructor takes 7-bit slave adrs - +/*User Defined Paramaters*/ #define SymmetricKey "RfIsCoOl" //Set Private Key here -- Make sure it is identical to receiver -char TransTable[] = {0x1F,0x18,0x06,0x01}; //Used to translate data for FEC -- Make sure it is identical to receiver -Translator transTx(SymmetricKey, TransTable); //Initialize Encoder - -//RTC ALARM #define SendDelay 5 //Number of seconds between sending data +#define TransmissionLength 1000 //How long to continuosuly send the message (ms) char DEVICETYPE = 'T'; //'T' for Temperature Sensor char DEVICEID = 0x01; //Set the Device ID -USBSerial microUSB; //microUSB connection that can be used for printing +/*End of User Defined Variables */ + + +MAX32630FTHR pegasus(MAX32630FTHR::VIO_3V3); +I2C i2c(P3_4, P3_5); //sda,scl +RawSerial uart(P3_1,P3_0);//tx,rx +MAX30208 TempSensor(i2c, 0x50); //Constructor takes 7-bit slave adrs + +char TransTable[] = {0x1F,0x18,0x06,0x01}; //Used to translate data for FEC -- Make sure it is identical to receiver +Translator transTx(SymmetricKey, TransTable); //Initialize Encoder DigitalOut rLED(LED1); DigitalOut gLED(LED2); DigitalOut bLED(LED3); -DigitalIn sw1(SW1); //Used on start-up to stay in active mode for re-programming +DigitalIn sw2(SW1); //Used on start-up to stay in active mode for re-programming DigitalOut TXEnable(P5_1); //Used to Enable Transmitter // ***************************************************************************** @@ -117,12 +117,12 @@ */ uint16_t ReadData(MAX30208 TempSensor, uint16_t &value){ if (TempSensor.takeDataMeasurment() != 0){ - microUSB.printf("Error Taking data Meaurment\r\n"); + printf("Error Taking data Meaurment\r\n"); return(1); } wait_ms(50); //max temp read is 50ms if (TempSensor.readData(value) !=0){ - microUSB.printf("Error reading temperature Data\r\n"); + printf("Error reading temperature Data\r\n"); return(1); } return(0); @@ -182,7 +182,7 @@ while(1) { //hold down switch 1 to prevent the microcontroller from going into LP0 - while(sw1 == 0); + while(sw2 == 0); uint16_t tempData; if(ReadData(TempSensor,tempData) !=0){ @@ -194,14 +194,14 @@ transTx.Encrypt(tempData,EncryptedData); TXEnable = 1; //Turn on Transmitter - wait_us(450); //Wake-up time for transmitter + wait_us(450); //Minimum Wake-up time for transmitter per data sheet -- Do not lower //Start a timer for sending data Timer timer; timer.start(); //Send the data for 1 sec - while(timer.read_ms() < 1000) { + while(timer.read_ms() < TransmissionLength) { //Send Data continuously comInit();