System Management code

Dependencies:   mbed CANBuffer Watchdog MODSERIAL mbed-rtos xbeeRelay IAP

Fork of SystemManagement by Martin Deng

Files at this revision

API Documentation at this revision

Comitter:
martydd3
Date:
Sat Oct 25 15:54:19 2014 +0000
Parent:
17:c9ce210f6654
Child:
19:3a817d2cef11
Commit message:
Martin's Testing branch

Changed in this revision

CoulombCounter/CoulombCounter.h Show annotated file Show diff for this revision Revisions of this file
FanPump/FanPump.cpp Show annotated file Show diff for this revision Revisions of this file
FanPump/FanPump.h Show annotated file Show diff for this revision Revisions of this file
SysMngmt.cpp Show annotated file Show diff for this revision Revisions of this file
TemperatureRead/TemperatureRead.cpp Show diff for this revision Revisions of this file
TemperatureRead/TemperatureRead.h Show diff for this revision Revisions of this file
--- a/CoulombCounter/CoulombCounter.h	Sat Oct 25 03:28:55 2014 +0000
+++ b/CoulombCounter/CoulombCounter.h	Sat Oct 25 15:54:19 2014 +0000
@@ -5,8 +5,6 @@
 #include "CANBuffer.h"
 #include "RTCStore.h"
 
-RTCStore store;
-
 class CoulombCounter {
 public:
 
@@ -31,6 +29,7 @@
 private:
     Ticker sampler;         // Used to capture next sample and coulomb count
     void sample();
+    RTCStore store;
     
     volatile int mSec;
     volatile float currentSample;
--- a/FanPump/FanPump.cpp	Sat Oct 25 03:28:55 2014 +0000
+++ b/FanPump/FanPump.cpp	Sat Oct 25 15:54:19 2014 +0000
@@ -2,6 +2,7 @@
 
 static FanPump* instance[6] = { NULL };         // Access pwm object by channel#
 const int PCLK = 24e6;          // 24Mhz clock
+uint32_t FanPump::period_us = 0.0;
 
 // Interrupt handler, must be called from static context, calls all the slew functions
 void pwmIRQ() {
--- a/FanPump/FanPump.h	Sat Oct 25 03:28:55 2014 +0000
+++ b/FanPump/FanPump.h	Sat Oct 25 15:54:19 2014 +0000
@@ -20,4 +20,5 @@
     volatile uint32_t setPoint_us;
     volatile uint32_t maxChange_us;     // Max pulsewidth change allowed to achieve the slew rate
 };
+
 #endif
\ No newline at end of file
--- a/SysMngmt.cpp	Sat Oct 25 03:28:55 2014 +0000
+++ b/SysMngmt.cpp	Sat Oct 25 15:54:19 2014 +0000
@@ -54,6 +54,7 @@
     wdt.kick(10.0);
     pc1.baud(115200);
 
+/*
     FanPump fanPump(&rxBuffer);
     DC dc_dc(&fanPump, &rxBuffer);
     PollSwitch pollSwitch(&rxBuffer);
@@ -110,6 +111,8 @@
         
         wdt.kick();
     } // main while loop
+    
+*/
 }
 
 /*
--- a/TemperatureRead/TemperatureRead.cpp	Sat Oct 25 03:28:55 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-#include "TemperatureRead.h"
-
-TemperatureRead::TemperatureRead(PinName pin, struct TempTable _table) : ana(pin) {
-    usingAna = true;
-    table = _table;
-    temperature = 0;
-}
-TemperatureRead::TemperatureRead(struct TempTable _table)  {
-    usingAna = false;   
-    table = _table;
-    temperature = 0;
-}
-
-float TemperatureRead::convert(float in) {
-    if (in < table.input[0]) { temperature = -INFINITY; return temperature; }                    // Out of range of the table
-    if (in > table.input[table.numEntries-1]) { temperaure = -INFINITY; return temperature; }    // Out of range of the table
-    int lowerIndex = 0;
-    int upperIndex = table.numEntries-1;
-    for (int i = 0; i < table.numEntries; i++) {                  // Converge on the entries that surround the input
-        if (in >= table.input[lowerIndex]) { lowerIndex = i; }
-        if (in <= table.input[upperIndex]) { upperIndex = table.numEntries-1 - i; }
-    }
-    // Interpolate and return
-    temperature = table.output[lowerIndex] + (table.output[upperIndex] - table.output[lowerIndex]) * ((in - table.input[lowerIndex]) / (table.input[upperIndex] - table.input[lowerIndex]));
-    return temperature;
-}
-float TemperatureRead::read() {
-    if (!usingAna) { temperature = 0; return temperature;
-    else return convert(ana.read());
-}
\ No newline at end of file
--- a/TemperatureRead/TemperatureRead.h	Sat Oct 25 03:28:55 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-#ifndef _TEMPERATURE_READ_H
-#define _TEMPERATURE_READ_H
-
-// Look up table for temperatures from the GLV Battery Charge Regulator MOSFET internal to the rear accy. box
-const struct TempTable NXFT15XH103_Table {
-    float input[] = {0.951781202,0.937262775,0.919578592,0.898354357,0.873281379,0.844154225,0.810924767,0.77373518,0.732941648,0.689103062,0.642984648,0.595469256,0.547490837,0.5,0.453820525,0.409646378,0.368048534,0.329354168,0.293785311,0.261393013,0.232186732,0.205908044,0.182539034,0.161706765,0.143322197,0.127018769,0.112688554,0.100071994,0.088921283,0.079189687,0.07054559,0.06305631,0.056425741,0.050512723};
-    float ouput[] = {-40,-35,-30,-25,-20,-15,-10,-5,0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,105,110,115,120,125};
-    int numEntries = sizeof(input)/sizeof(input[0]);
-};
-
-class TemperatureRead {
-public:
-    TemperatureRead(PinName pin, const struct TempTable _table);
-    TemperatureRead(struct TempTable _table)
-    float convert(float in);
-    float temperature;
-    
-private:
-    AnalogIn ana;
-    bool usingAna;
-    struct TempTable table;
-};
-
-#endif /*_TEMPERATURE_READ_*/   
\ No newline at end of file