Used with KL25Z Freescale board to access the Avnet Wi-Go Battery charger

Dependents:   KL25Z_Batt_Test

Files at this revision

API Documentation at this revision

Comitter:
monpjc
Date:
Fri May 17 15:32:44 2013 +0000
Parent:
0:d52ea6d270c0
Child:
2:f52adda183d2
Commit message:
Batt init now has selectable charge rate

Changed in this revision

WiGo_BattCharger.cpp Show annotated file Show diff for this revision Revisions of this file
WiGo_BattCharger.h Show annotated file Show diff for this revision Revisions of this file
--- a/WiGo_BattCharger.cpp	Fri May 17 10:39:52 2013 +0000
+++ b/WiGo_BattCharger.cpp	Fri May 17 15:32:44 2013 +0000
@@ -11,11 +11,31 @@
     _snsen = 1;             //Off
 }
 
-void WiGo_BattCharger::init( void )
+void WiGo_BattCharger::init( int n )
 {
-    //100mA Charge
-    _en1 = 0;
-    _en2 = 0;
+    switch(n)
+    {
+        default:
+        case 0: //100mA Charge
+            _en1 = 0;
+            _en2 = 0;
+            break;
+            
+        case 1: //500mA
+            _en1 = 0;
+            _en2 = 1;
+            break;
+            
+        case 2: //724mA
+            _en1 = 1;
+            _en2 = 0;
+            break;
+            
+        case 3: //Suspend
+            _en1 = 1;
+            _en2 = 1;
+            break;
+    }
 }
 
 void WiGo_BattCharger::sense_en( int n)
@@ -44,7 +64,6 @@
 void WiGo_BattCharger::LEDupdate( void )
 {
     float batt_level;
-    init();
     sense_en(1);
     batt_level = read();
     if( batt_level <= BATT_0 ) {
--- a/WiGo_BattCharger.h	Fri May 17 10:39:52 2013 +0000
+++ b/WiGo_BattCharger.h	Fri May 17 15:32:44 2013 +0000
@@ -23,12 +23,12 @@
 class WiGo_BattCharger
 {
 public:
-    
+
     WiGo_BattCharger( PinName battlow, PinName battmed, PinName battfull,
                       PinName en1, PinName en2, PinName snsen, PinName sense,
                       PinName supplystate, PinName chargestate );
 
-    void init( void );
+    void init( int n );
 
     void sense_en( int n);