Battery hex

Dependencies:   mbed PowerControl SDFileSystem

Fork of HeptaBattery_hex by 智也 大野

Files at this revision

API Documentation at this revision

Comitter:
MEXT1
Date:
Tue Dec 13 10:50:09 2016 +0000
Parent:
1:4e0d741b4ae2
Commit message:
Battery hex

Changed in this revision

hepta_sat/HeptaBattery.cpp Show annotated file Show diff for this revision Revisions of this file
hepta_sat/HeptaBattery.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/hepta_sat/HeptaBattery.cpp	Tue Dec 13 06:55:26 2016 +0000
+++ b/hepta_sat/HeptaBattery.cpp	Tue Dec 13 10:50:09 2016 +0000
@@ -11,7 +11,7 @@
 {
     *bt = (_bat.read()*1.431*3.3);
 }
-void HeptaBattery::vol_u16(char* bt_u16, int *dsize)
+void HeptaBattery::vol_u16(char* bt_u16)
 {
     unsigned short bt_datas;
     char bt1[8]={0x00},bt2[8]={0x00};
@@ -20,7 +20,6 @@
     sprintf( bt2, "%02X", (bt_datas) & 0xFF);
     bt_u16[0]=bt1[0]; bt_u16[1]=bt1[1];
     bt_u16[2]=bt2[0]; bt_u16[3]=bt2[1];
-    *dsize = 4;
 }
 void HeptaBattery::chargecontrol(int state, int *save_flag)
 {
--- a/hepta_sat/HeptaBattery.h	Tue Dec 13 06:55:26 2016 +0000
+++ b/hepta_sat/HeptaBattery.h	Tue Dec 13 10:50:09 2016 +0000
@@ -12,7 +12,7 @@
             PinName reg_st
     );
     void vol(float* bt);
-    void vol_u16(char* bt_u16, int *dsize);
+    void vol_u16(char* bt_u16);
     void chargecontrol(int state, int *save_flag);
     
 private:  
--- a/main.cpp	Tue Dec 13 06:55:26 2016 +0000
+++ b/main.cpp	Tue Dec 13 10:50:09 2016 +0000
@@ -6,12 +6,11 @@
 
 int main(){
       pc.baud(9600);
-      int dsize;
       float bt_dec;
       char bt_hex[4];
       for(int i=0;i<10;i++){
               battery.vol(&bt_dec);
-              battery.vol_u16(bt_hex,&dsize);
+              battery.vol_u16(bt_hex);
               pc.printf("Vol=%f\r\n",bt_dec);
               pc.printf("Vol_hex=%c%c%c%c\r\n",bt_hex[0],bt_hex[1],bt_hex[2],bt_hex[3]);
               wait(1.0);