update firmware generation to FileOutputStream
authora0220410 <peter-li@ti.com>
Sat, 18 Jun 2016 01:32:22 +0000 (09:32 +0800)
committera0220410 <peter-li@ti.com>
Sat, 18 Jun 2016 01:32:22 +0000 (09:32 +0800)
TAS2555-FTC/app/src/main/java/com/ti/tas2555/tas2555_ftc/FTCListViewAdapter.java [new file with mode: 0755]
TAS2555-FTC/app/src/main/java/com/ti/tas2555/tas2555_ftc/MainActivity.java
TAS2555-FTC/app/src/main/res/layout/content_main.xml
TAS2555-FTC/app/src/main/res/layout/list_item.xml [new file with mode: 0755]
TAS2555-FTC/app/src/main/res/values/colors.xml
TAS2555-FTC/app/src/main/res/values/dimens.xml
TAS2555-FTC/ftcc/libs/armeabi/libTAS2555ftc.so
TAS2555-FTC/ftcc/src/main/java/com/ti/tas2555/ftcc/TFTCConfiguration.java
TAS2555-FTC/screen_shot.png [new file with mode: 0755]

diff --git a/TAS2555-FTC/app/src/main/java/com/ti/tas2555/tas2555_ftc/FTCListViewAdapter.java b/TAS2555-FTC/app/src/main/java/com/ti/tas2555/tas2555_ftc/FTCListViewAdapter.java
new file mode 100755 (executable)
index 0000000..b9e9122
--- /dev/null
@@ -0,0 +1,117 @@
+package com.ti.tas2555.tas2555_ftc;\r
+\r
+import android.content.Context;\r
+import android.database.DataSetObserver;\r
+import android.graphics.Color;\r
+import android.view.LayoutInflater;\r
+import android.view.View;\r
+import android.view.ViewGroup;\r
+import android.widget.Adapter;\r
+import android.widget.BaseAdapter;\r
+import android.widget.ListAdapter;\r
+import android.widget.TextView;\r
+\r
+import com.ti.tas2555.ftcc.TFTCConfiguration;\r
+\r
+/**\r
+ * Created by a0220410 on 6/17/2016.\r
+ */\r
+public class FTCListViewAdapter extends BaseAdapter {\r
+    private TFTCConfiguration mTFTConfig;\r
+    private LayoutInflater mInflater;\r
+\r
+    public FTCListViewAdapter(Context context,TFTCConfiguration configuration){\r
+        mTFTConfig = configuration;\r
+        mInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);\r
+    }\r
+\r
+    @Override\r
+    public int getCount() {\r
+        return 4;\r
+    }\r
+\r
+    @Override\r
+    public Object getItem(int position) {\r
+        return null;\r
+    }\r
+\r
+    @Override\r
+    public long getItemId(int position) {\r
+        return 0;\r
+    }\r
+\r
+    @Override\r
+    public View getView(int position, View convertView, ViewGroup parent) {\r
+        if (convertView == null) {\r
+            convertView = mInflater.inflate(R.layout.list_item, null);\r
+        }\r
+        TextView tvTitle = (TextView) convertView.findViewById(R.id.tv_list_item_title);\r
+        TextView tvHigh = (TextView) convertView.findViewById(R.id.tv_list_item_high);\r
+        TextView tvLow = (TextView) convertView.findViewById(R.id.tv_list_item_low);\r
+        TextView tvVal = (TextView) convertView.findViewById(R.id.tv_list_item_val);\r
+        TextView tvPass = (TextView) convertView.findViewById(R.id.tv_list_item_result);\r
+        if(position == 0) {\r
+            tvTitle.setText(mTFTConfig.Re);\r
+            tvHigh.setText("Hi:" + String.format("%1.2f", mTFTConfig.nReHi));\r
+            tvLow.setText("Lo:" + String.format("%1.2f", mTFTConfig.nReLo));\r
+            tvVal.setText("Act:" + String.format("%1.2f", mTFTConfig.nRe));\r
+            if((mTFTConfig.nResult & mTFTConfig.RE_FAIL_HI) != 0){\r
+                tvPass.setText("Hi");\r
+                tvPass.setBackgroundColor(Color.RED);\r
+            }else if((mTFTConfig.nResult & mTFTConfig.RE_FAIL_LO) != 0){\r
+                tvPass.setText("Lo");\r
+                tvPass.setBackgroundColor(Color.RED);\r
+            }else{\r
+                tvPass.setText("Pass");\r
+                tvPass.setBackgroundColor(Color.GREEN);\r
+            }\r
+        }else if(position == 1){\r
+            tvTitle.setText(mTFTConfig.F0);\r
+            tvHigh.setText("Hi:" + String.format("%3.0f", mTFTConfig.nF0Hi));\r
+            tvLow.setText("Lo:" + String.format("%3.0f", mTFTConfig.nF0Lo));\r
+            tvVal.setText("Act:" + String.format("%3.0f", mTFTConfig.nF0));\r
+            if((mTFTConfig.nResult & mTFTConfig.F0_FAIL_HI) != 0){\r
+                tvPass.setText("Hi");\r
+                tvPass.setBackgroundColor(Color.RED);\r
+            }else if((mTFTConfig.nResult & mTFTConfig.F0_FAIL_LO) != 0){\r
+                tvPass.setText("Lo");\r
+                tvPass.setBackgroundColor(Color.RED);\r
+            }else{\r
+                tvPass.setText("Pass");\r
+                tvPass.setBackgroundColor(Color.GREEN);\r
+            }\r
+        }else if(position == 2){\r
+            tvTitle.setText(mTFTConfig.Q);\r
+            tvHigh.setText("Hi:" + String.format("%1.3f", mTFTConfig.nQHi));\r
+            tvLow.setText("Lo:" + String.format("%1.3f",mTFTConfig.nQLo));\r
+            tvVal.setText("Act:" + String.format("%1.3f",mTFTConfig.nQ));\r
+            if((mTFTConfig.nResult & mTFTConfig.Q_FAIL_HI) != 0){\r
+                tvPass.setText("Hi");\r
+                tvPass.setBackgroundColor(Color.RED);\r
+            }else if((mTFTConfig.nResult & mTFTConfig.Q_FAIL_LO) != 0){\r
+                tvPass.setText("Lo");\r
+                tvPass.setBackgroundColor(Color.RED);\r
+            }else{\r
+                tvPass.setText("Pass");\r
+                tvPass.setBackgroundColor(Color.GREEN);\r
+            }\r
+        }else if(position == 3){\r
+            tvTitle.setText(mTFTConfig.Delta_tv);\r
+            tvHigh.setText("Hi:" + String.format("%2.2f",mTFTConfig.nTHi));\r
+            tvLow.setText("Lo:" + String.format("%2.2f",mTFTConfig.nTLo));\r
+            tvVal.setText("Act:" + String.format("%2.2f",mTFTConfig.nT));\r
+            if((mTFTConfig.nResult & mTFTConfig.T_FAIL_HI) != 0){\r
+                tvPass.setText("Hi");\r
+                tvPass.setBackgroundColor(Color.RED);\r
+            }else if((mTFTConfig.nResult & mTFTConfig.T_FAIL_LO) != 0){\r
+                tvPass.setText("Lo");\r
+                tvPass.setBackgroundColor(Color.RED);\r
+            }else{\r
+                tvPass.setText("Pass");\r
+                tvPass.setBackgroundColor(Color.GREEN);\r
+            }\r
+        }\r
+\r
+        return convertView;\r
+    }\r
+}\r
index 927ce60c397dfdf871efca355d543d473b6002f8..f920405a2c58d8748576232939ed07eac80adb67 100755 (executable)
@@ -1,8 +1,10 @@
 package com.ti.tas2555.tas2555_ftc;\r
 \r
 import android.content.ContentResolver;\r
+import android.content.Context;\r
 import android.content.pm.ProviderInfo;\r
 import android.database.Cursor;\r
+import android.graphics.Color;\r
 import android.media.AudioManager;\r
 import android.media.MediaPlayer;\r
 import android.net.Uri;\r
@@ -16,6 +18,8 @@ import android.view.View;
 import android.view.Menu;\r
 import android.view.MenuItem;\r
 import android.widget.Button;\r
+import android.widget.EditText;\r
+import android.widget.ListView;\r
 \r
 import com.ti.tas2555.ftcc.TAS2555Node;\r
 import com.ti.tas2555.ftcc.TFTCConfiguration;\r
@@ -32,6 +36,9 @@ public class MainActivity extends AppCompatActivity implements MediaPlayer.OnPre
     private MediaPlayer mMediaPlayer;\r
     private Timer mTimer;\r
     private Cal_State mCalState = Cal_State.IDLE;\r
+    private ListView mFTCItem;\r
+    private FTCListViewAdapter mAdapter;\r
+    private EditText mInfo;\r
 \r
     private  enum Cal_State{\r
         IDLE,\r
@@ -55,10 +62,12 @@ public class MainActivity extends AppCompatActivity implements MediaPlayer.OnPre
             }\r
         });\r
 \r
+        mFTCItem = (ListView)findViewById(R.id.lvFTCItem);\r
         mTimer = new Timer("PlaybackTimer");\r
-        mMediaPlayer = new MediaPlayer();\r
         mDevNode = new TAS2555Node();\r
         mFTCConfiguration = new TFTCConfiguration();\r
+        mAdapter = new FTCListViewAdapter(getApplicationContext(), mFTCConfiguration);\r
+        mFTCItem.setAdapter(mAdapter);\r
         mStartButton = (Button) findViewById(R.id.bnStart);\r
         mStartButton.setOnClickListener(new View.OnClickListener() {\r
             @Override\r
@@ -66,8 +75,43 @@ public class MainActivity extends AppCompatActivity implements MediaPlayer.OnPre
                 FTCStart();\r
             }\r
         });\r
+        mInfo = (EditText)findViewById(R.id.dtInfo);\r
+\r
+        mInfo.setText("please put TAS2555_cal_m28dB.wav, TAS2555_verify_m06.wav, speaker.ftcfg to /data before run FTC\n");\r
+        mInfo.setSelection(mInfo.getText().length());\r
+    }\r
+\r
+    private boolean checkfileExist(){\r
+        File file1=new File("/data/TAS2555_cal_m28dB.wav");\r
+        if(file1.exists())\r
+            mInfo.append(file1.getAbsolutePath() + " found\n");\r
+        else\r
+            mInfo.append(file1.getAbsolutePath() + " not found\n");\r
+\r
+        mInfo.setSelection(mInfo.getText().length());\r
+\r
+        File file2=new File("/data/TAS2555_verify_m06.wav");\r
+        if(file2.exists())\r
+            mInfo.append(file2.getAbsolutePath() + " found\n");\r
+        else\r
+            mInfo.append(file2.getAbsolutePath() + " not found\n");\r
+\r
+        mInfo.setSelection(mInfo.getText().length());\r
+\r
+        File file3=new File("/data/speaker.ftcfg");\r
+        if(file3.exists())\r
+            mInfo.append(file3.getAbsolutePath() + " found\n");\r
+        else\r
+            mInfo.append(file3.getAbsolutePath() + " not found\n");\r
+\r
+        mInfo.setSelection(mInfo.getText().length());\r
+        if(file1.exists() && file2.exists() && file3.exists())\r
+            return true;\r
+        else\r
+            return false;\r
     }\r
 \r
+\r
     @Override\r
     public boolean onCreateOptionsMenu(Menu menu) {\r
         // Inflate the menu; this adds items to the action bar if it is present.\r
@@ -91,19 +135,42 @@ public class MainActivity extends AppCompatActivity implements MediaPlayer.OnPre
     }\r
 \r
     private void FTCStart(){\r
+        if(!checkfileExist())\r
+            return;\r
+\r
         try {\r
             mFTCConfiguration.LoadFTCC("/data/speaker.ftcfg");\r
+            mInfo.append("/data/speaker.ftcfg loaded\n");\r
+            mInfo.setSelection(mInfo.getText().length());\r
+            mInfo.append("calibration configuration :" + mFTCConfiguration.nConfigurationCalibration + "\n");\r
+            mInfo.setSelection(mInfo.getText().length());\r
+            mInfo.append("calibration time :" + mFTCConfiguration.nCalibrationTime + "\n");\r
+            mInfo.setSelection(mInfo.getText().length());\r
+            mInfo.append("verify time :" + mFTCConfiguration.nVerificationTime+ "\n");\r
+            mInfo.setSelection(mInfo.getText().length());\r
+            mAdapter.notifyDataSetChanged();\r
             mDevNode.OpenNode("/dev/tiload_node");\r
+            mInfo.append("/dev/tiload_node opened \n");\r
+            mInfo.setSelection(mInfo.getText().length());\r
             mFTCConfiguration.nTCal = 25;\r
-            mFTCConfiguration.bLoadCalibration = true;\r
+            mInfo.append("ambient temperature :" + mFTCConfiguration.nTCal + "\n");\r
+            mInfo.setSelection(mInfo.getText().length());\r
+            mFTCConfiguration.bLoadCalibration = false;\r
+            mInfo.append("reload calibration :" + mFTCConfiguration.bLoadCalibration + "\n");\r
+            mInfo.setSelection(mInfo.getText().length());\r
             // STEP 1: Load TAS2555 calibration configuration\r
+            mInfo.append("STEP1: change configuration to " + mFTCConfiguration.nConfigurationCalibration + "\n");\r
+            mInfo.setSelection(mInfo.getText().length());\r
             mDevNode.set_Configuration(mFTCConfiguration.nConfigurationCalibration);\r
             File file=new File("/data/TAS2555_cal_m28dB.wav");\r
             if(file.exists()){\r
+                mMediaPlayer = new MediaPlayer();\r
                 mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);\r
                 mMediaPlayer.setDataSource(file.getAbsolutePath());\r
                 mCalState = Cal_State.CALIBRATE;\r
                 mMediaPlayer.setOnPreparedListener(this);\r
+                mInfo.append("preparing " + file.getAbsolutePath() + "\n");\r
+                mInfo.setSelection(mInfo.getText().length());\r
                 mMediaPlayer.prepareAsync();\r
             }\r
         }catch (Exception ex){\r
@@ -114,6 +181,8 @@ public class MainActivity extends AppCompatActivity implements MediaPlayer.OnPre
     public void onPrepared(MediaPlayer mp) {\r
         if(mCalState == Cal_State.CALIBRATE) {\r
             // STEP 2: Play calibration signal\r
+            mInfo.append("STEP2: start play /data/TAS2555_cal_m28dB.wav \n");\r
+            mInfo.setSelection(mInfo.getText().length());\r
             mMediaPlayer.start();\r
             try {\r
                 Thread.sleep(500);\r
@@ -122,6 +191,8 @@ public class MainActivity extends AppCompatActivity implements MediaPlayer.OnPre
             }\r
 \r
             // STEP 3: Re-program Re for worst case\r
+            mInfo.append("STEP3: Re-program Re for worst case \n");\r
+            mInfo.setSelection(mInfo.getText().length());\r
             double re = mFTCConfiguration.nPPC3_Re0;\r
             re = mFTCConfiguration.nPPC3_Re0 * (1 - 2 * mFTCConfiguration.nSpkReTolPer / 100.0);\r
             mDevNode.set_Re(mFTCConfiguration.nPPC3_Re0, re, mFTCConfiguration.nSpkReAlpha);\r
@@ -129,6 +200,8 @@ public class MainActivity extends AppCompatActivity implements MediaPlayer.OnPre
             mDevNode.set_SCTH(mFTCConfiguration.nSCTH);\r
 \r
             // STEP 4: Wait for algorithm to converge\r
+            mInfo.append("STEP4: Wait " + mFTCConfiguration.nCalibrationTime +"ms for algorithm to converge \n");\r
+            mInfo.setSelection(mInfo.getText().length());\r
             mTimer.schedule(new TimerTask() {\r
                 @Override\r
                 public void run() {\r
@@ -136,6 +209,8 @@ public class MainActivity extends AppCompatActivity implements MediaPlayer.OnPre
                 }\r
             }, mFTCConfiguration.nCalibrationTime);\r
         }else if(mCalState == Cal_State.VARIFY){\r
+            mInfo.append("start play /data/TAS2555_verify_m06.wav \n");\r
+            mInfo.setSelection(mInfo.getText().length());\r
             mMediaPlayer.start();\r
             try {\r
                 Thread.sleep(500);\r
@@ -143,6 +218,8 @@ public class MainActivity extends AppCompatActivity implements MediaPlayer.OnPre
                 Log.e(TAG, ex.toString());\r
             }\r
 \r
+            mInfo.append("Wait " + mFTCConfiguration.nVerificationTime +" ms for verify \n");\r
+            mInfo.setSelection(mInfo.getText().length());\r
             mTimer.schedule(new TimerTask() {\r
                 @Override\r
                 public void run() {\r
@@ -153,10 +230,18 @@ public class MainActivity extends AppCompatActivity implements MediaPlayer.OnPre
     }\r
 \r
     private void CalTimeReached(){\r
+        // STEP 5: Get actual Re, f0 and Q from TAS2555\r
         mFTCConfiguration.nRe = mDevNode.get_Re(mFTCConfiguration.nPPC3_Re0);\r
         mFTCConfiguration.nF0 = mDevNode.get_f0(mFTCConfiguration.nFSRate);\r
         mFTCConfiguration.nQ = mDevNode.get_Q(mFTCConfiguration.nFSRate);\r
-        //   t_cal = sys_get_ambient_temp(); // Set t_cal to ambient temperature //use command line parameter instead\r
+        runOnUiThread(new Runnable() {\r
+            @Override\r
+            public void run() {\r
+                mAdapter.notifyDataSetChanged();\r
+                mInfo.append("STEP5: Get actual Re, f0 and Q from TAS2555 \n");\r
+                mInfo.setSelection(mInfo.getText().length());\r
+            }\r
+        });\r
 \r
         // STEP 6: Verify Speaker at gpFTCC->nTestDeltaT\r
         int prm_pow = mDevNode.Calc_Prm_Pow(mFTCConfiguration.nRe,\r
@@ -165,7 +250,8 @@ public class MainActivity extends AppCompatActivity implements MediaPlayer.OnPre
                 mFTCConfiguration.nPPC3_RTM,\r
                 mFTCConfiguration.nPPC3_RTVA,\r
                 mFTCConfiguration.nPPC3_SysGain);\r
-        int prm_tlimit = mDevNode.calc_Prm_Tlimit(mFTCConfiguration.nTestDeltaT,\r
+        int prm_tlimit = mDevNode.calc_Prm_Tlimit(\r
+                mFTCConfiguration.nTestDeltaT,\r
                 mFTCConfiguration.nSpkReAlpha,\r
                 mFTCConfiguration.nPPC3_DevNonlinPer,\r
                 mFTCConfiguration.nPPC3_RTV,\r
@@ -178,17 +264,35 @@ public class MainActivity extends AppCompatActivity implements MediaPlayer.OnPre
         mDevNode.set_TempCal(prm_pow, prm_tlimit);\r
 \r
         mMediaPlayer.stop();\r
+        mMediaPlayer.release();\r
 \r
         StartVerify();\r
     }\r
 \r
     private void StartVerify(){\r
+        runOnUiThread(new Runnable() {\r
+            @Override\r
+            public void run() {\r
+                mInfo.append("STEP6: Verify Speaker at gpFTCC->nTestDeltaT \n");\r
+                mInfo.setSelection(mInfo.getText().length());\r
+            }\r
+        });\r
+\r
         try {\r
             File file=new File("/data/TAS2555_verify_m06.wav");\r
             if(file.exists()){\r
+                mMediaPlayer = new MediaPlayer();\r
                 mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);\r
                 mMediaPlayer.setDataSource(file.getAbsolutePath());\r
                 mCalState = Cal_State.VARIFY;\r
+                mMediaPlayer.setOnPreparedListener(this);\r
+                runOnUiThread(new Runnable() {\r
+                    @Override\r
+                    public void run() {\r
+                        mInfo.append("preparing TAS2555_verify_m06.wav \n");\r
+                        mInfo.setSelection(mInfo.getText().length());\r
+                    }\r
+                });\r
                 mMediaPlayer.prepareAsync();\r
             }\r
         }catch (Exception ex){\r
@@ -205,6 +309,16 @@ public class MainActivity extends AppCompatActivity implements MediaPlayer.OnPre
                 mFTCConfiguration.nF0,\r
                 mFTCConfiguration.nQ,\r
                 mFTCConfiguration.ntest_delta_tv);\r
+        runOnUiThread(new Runnable() {\r
+            @Override\r
+            public void run() {\r
+                mAdapter.notifyDataSetChanged();\r
+                mInfo.append("verify time reached \n");\r
+                mInfo.setSelection(mInfo.getText().length());\r
+                mInfo.append("STEP7: Set temperature limit to target TMAX \n");\r
+                mInfo.setSelection(mInfo.getText().length());\r
+            }\r
+        });\r
 \r
         // STEP 7: Set temperature limit to target TMAX\r
         mFTCConfiguration.nprm_pow = mDevNode.Calc_Prm_Pow(\r
@@ -233,28 +347,57 @@ public class MainActivity extends AppCompatActivity implements MediaPlayer.OnPre
                 mFTCConfiguration.nprm_tlimit);\r
 \r
         mMediaPlayer.stop();\r
+        mMediaPlayer.release();\r
 \r
         PostCalibration();\r
     }\r
 \r
     private void PostCalibration(){\r
         try {\r
+            runOnUiThread(new Runnable() {\r
+                @Override\r
+                public void run() {\r
+                    mInfo.append("STEP8: Save Re, f0, Q and Cal Temp into " + getApplicationContext().getFilesDir().getAbsolutePath() +  "/tas2555_cal.txt \n");\r
+                    mInfo.setSelection(mInfo.getText().length());\r
+                }\r
+            });\r
             // STEP 8: Save Re, f0, Q and Cal Temp into a file\r
-            mFTCConfiguration.saveCalResult("/data/tas2555_cal.txt");\r
+            Context context = getApplicationContext();\r
+            File file = context.getFilesDir();\r
+            mFTCConfiguration.saveCalResult(file.getAbsolutePath() +  "/tas2555_cal.txt");\r
 \r
             // STEP 9: Save .bin file for TAS2555 driver\r
+            runOnUiThread(new Runnable() {\r
+                @Override\r
+                public void run() {\r
+                    mInfo.append("mFTCConfiguration.nResult = " + String.format("0x%x", mFTCConfiguration.nResult) + "\n");\r
+                    mInfo.setSelection(mInfo.getText().length());\r
+                }\r
+            });\r
+\r
             if (mFTCConfiguration.nResult == mFTCConfiguration.RESULT_PASS)\r
             {\r
                 byte[] fwContent = mDevNode.getFwContent();\r
-                mFTCConfiguration.saveCalFirmware("/data/tas2555_cal.bin", fwContent);\r
-\r
-                if(mFTCConfiguration.bLoadCalibration)\r
+                mFTCConfiguration.saveCalFirmware(file.getAbsolutePath() + "/tas2555_cal.bin", fwContent);\r
+\r
+                runOnUiThread(new Runnable() {\r
+                    @Override\r
+                    public void run() {\r
+                        mInfo.append(getApplicationContext().getFilesDir().getAbsolutePath() + "/tas2555_cal.bin saved \n");\r
+                        mInfo.setSelection(mInfo.getText().length());\r
+                        if(mFTCConfiguration.bLoadCalibration) {\r
+                            mInfo.append("Load Calibration \n");\r
+                            mInfo.setSelection(mInfo.getText().length());\r
+                        }\r
+                    }\r
+                });\r
+\r
+                if(mFTCConfiguration.bLoadCalibration) {\r
                     mDevNode.set_Calibration(0xff);\r
+                }\r
             }\r
         }catch (Exception ex){\r
             Log.e(TAG, ex.toString());\r
         }\r
-\r
-        mMediaPlayer.release();\r
     }\r
 }\r
index 7c90c596967e6f6937c5fafdf982ed482057bae4..61e64e04f4864ec8be7234d249726dbc8d011ee2 100755 (executable)
     tools:showIn="@layout/activity_main">\r
 \r
     <Button\r
-        android:layout_width="wrap_content"\r
+        android:layout_width="match_parent"\r
         android:layout_height="wrap_content"\r
-        android:text="New Button"\r
+        android:text="FTC Start"\r
         android:id="@+id/bnStart"\r
         android:layout_centerHorizontal="true"\r
-        android:layout_marginTop="114dp" />\r
+        android:layout_marginTop="5dp" />\r
+\r
+    <ListView\r
+        android:layout_width="match_parent"\r
+        android:layout_height="215dp"\r
+        android:id="@+id/lvFTCItem"\r
+        android:layout_below="@+id/bnStart"\r
+        android:layout_centerHorizontal="true" />\r
+\r
+    <EditText\r
+        android:layout_below="@id/lvFTCItem"\r
+        android:layout_width="match_parent"\r
+        android:layout_height="wrap_content"\r
+        android:inputType="textMultiLine|textNoSuggestions"\r
+        android:ems="10"\r
+        android:textSize="15sp"\r
+        android:id="@+id/dtInfo"\r
+        android:textAlignment="viewStart"\r
+        android:text="hello"\r
+        android:ellipsize="end"\r
+        android:layout_alignParentBottom="false"\r
+        android:clickable="false"\r
+        android:contextClickable="false"\r
+        android:scrollbarAlwaysDrawVerticalTrack="true"\r
+        android:scrollbars="vertical"\r
+        android:scrollbarStyle="outsideOverlay"\r
+        android:overScrollMode="always"\r
+        android:editable="false"\r
+        android:focusable="false"\r
+        android:focusableInTouchMode="false"\r
+        android:linksClickable="false" />\r
+\r
+\r
 </RelativeLayout>\r
diff --git a/TAS2555-FTC/app/src/main/res/layout/list_item.xml b/TAS2555-FTC/app/src/main/res/layout/list_item.xml
new file mode 100755 (executable)
index 0000000..7b0434c
--- /dev/null
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="utf-8"?>\r
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"\r
+    xmlns:app="http://schemas.android.com/apk/res-auto"\r
+    xmlns:tools="http://schemas.android.com/tools"\r
+    android:layout_width="match_parent"\r
+    android:layout_height="wrap_content"\r
+    android:paddingBottom="@dimen/activity_vertical_margin"\r
+    android:paddingLeft="@dimen/activity_horizontal_margin"\r
+    android:paddingRight="@dimen/activity_horizontal_margin"\r
+    android:paddingTop="@dimen/activity_vertical_margin">\r
+\r
+    <TextView\r
+        android:layout_width="@dimen/list_item_title_width"\r
+        android:id="@+id/tv_list_item_title"\r
+        android:text="title"\r
+        android:textColor="@color/colorPrimaryDark"\r
+        android:textAlignment="center"\r
+        android:layout_height="wrap_content" />\r
+\r
+    <TextView\r
+        android:layout_toRightOf="@id/tv_list_item_title"\r
+        android:layout_width="@dimen/list_item_width"\r
+        android:id="@+id/tv_list_item_high"\r
+        android:text="high"\r
+        android:textColor="@color/colorPrimaryDark"\r
+        android:layout_height="wrap_content" />\r
+\r
+    <TextView\r
+        android:layout_toRightOf="@id/tv_list_item_high"\r
+        android:layout_width="@dimen/list_item_width"\r
+        android:id="@+id/tv_list_item_low"\r
+        android:text="low"\r
+        android:textColor="@color/colorPrimaryDark"\r
+        android:layout_height="wrap_content" />\r
+\r
+    <TextView\r
+        android:layout_toRightOf="@id/tv_list_item_low"\r
+        android:layout_width="@dimen/list_item_width"\r
+        android:id="@+id/tv_list_item_val"\r
+        android:text="val"\r
+        android:textColor="@color/colorPrimaryDark"\r
+        android:layout_height="wrap_content" />\r
+\r
+    <TextView\r
+        android:layout_toRightOf="@id/tv_list_item_val"\r
+        android:layout_width="@dimen/list_item_item_pass"\r
+        android:id="@+id/tv_list_item_result"\r
+        android:text="pass"\r
+        android:textColor="@color/colorPrimaryDark"\r
+        android:textAlignment="center"\r
+        android:background="@color/colorGreen"\r
+        android:layout_height="wrap_content" />\r
+\r
+</RelativeLayout>\r
index 2a12c47ca5b704fc155678effcf9368761129aaa..5326f12280a4e73c811cb534cd05693a20abae9f 100755 (executable)
@@ -3,4 +3,5 @@
     <color name="colorPrimary">#3F51B5</color>\r
     <color name="colorPrimaryDark">#303F9F</color>\r
     <color name="colorAccent">#FF4081</color>\r
+    <color name="colorGreen">#00d000</color>\r
 </resources>\r
index f31eb2472cc15187115cb6d9f57e13b59e3eed87..a0c51b39e334b1d673c9044d47f2dc5d2256269e 100755 (executable)
@@ -1,6 +1,9 @@
 <resources>\r
     <!-- Default screen margins, per the Android Design guidelines. -->\r
-    <dimen name="activity_horizontal_margin">16dp</dimen>\r
+    <dimen name="activity_horizontal_margin">10dp</dimen>\r
     <dimen name="activity_vertical_margin">16dp</dimen>\r
     <dimen name="fab_margin">16dp</dimen>\r
+    <dimen name="list_item_title_width">60dp</dimen>\r
+    <dimen name="list_item_width">70dp</dimen>\r
+    <dimen name="list_item_item_pass">40dp</dimen>\r
 </resources>\r
index a10ced55662ddaebcd1476f7a75c44e9f7dc6fc1..0aa3f9f642e189ad0db3bbca7270c2e095aaed4e 100755 (executable)
Binary files a/TAS2555-FTC/ftcc/libs/armeabi/libTAS2555ftc.so and b/TAS2555-FTC/ftcc/libs/armeabi/libTAS2555ftc.so differ
index fd5afbb49440b760e4db1007228e4428535bb2c0..2127595fc1a70a706a4176161c8b36d9d964eab6 100755 (executable)
@@ -1,11 +1,13 @@
 package com.ti.tas2555.ftcc;\r
 \r
+import android.content.Context;\r
 import android.util.Log;\r
 \r
 import java.io.BufferedReader;\r
 import java.io.BufferedWriter;\r
 import java.io.File;\r
 import java.io.FileNotFoundException;\r
+import java.io.FileOutputStream;\r
 import java.io.FileReader;\r
 import java.io.FileWriter;\r
 import java.util.Arrays;\r
@@ -42,6 +44,11 @@ public class TFTCConfiguration {
     private static final String T_LO = "T_LO";\r
     private static final String NFS = "NFS";\r
     private static final String SCTH = "SCTH";\r
+    public static final String Re = "Re";\r
+    public static final String F0 = "f0";\r
+    public static final String Q = "Q";\r
+    public static final String Delta_tv = "delta_tv";\r
+\r
     public static final int RESULT_PASS = 0x00000000;\r
     public static final int RE_FAIL_HI = 0x00000001;\r
     public static final int RE_FAIL_LO = 0x00000010;\r
@@ -99,7 +106,7 @@ public class TFTCConfiguration {
     public int nprm_tlimit;\r
 \r
     private int MAX_BIN_SIZE = 2048;\r
-    private char[] gpBin = new char[MAX_BIN_SIZE];\r
+    private byte[] gpBin = new byte[MAX_BIN_SIZE];\r
     private int gnBinIndex = 0;\r
     private int gnBinBlockIndex = 0;\r
 \r
@@ -252,23 +259,19 @@ public class TFTCConfiguration {
     }\r
 \r
     public void saveCalFirmware(String file, byte[] fwData) throws java.io.IOException{\r
-        FileWriter fileWriter = new FileWriter(file);\r
-        BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);\r
+        FileOutputStream fileOutputStream = new FileOutputStream(file, false);\r
 \r
         PrepareCalFWHeader();\r
 \r
-        Log.i(TAG, "FW Index =" + gnBinIndex);\r
         for(int i=0; i < fwData.length; i++){\r
-            gpBin[gnBinIndex++] = (char) fwData[i];\r
+            gpBin[gnBinIndex++] = fwData[i];\r
         }\r
 \r
         PrepareClosure();\r
 \r
-        bufferedWriter.write(gpBin, 0, gnBinIndex);\r
-\r
-        bufferedWriter.flush();\r
-        bufferedWriter.close();\r
-        fileWriter.close();\r
+        fileOutputStream.write(gpBin, 0, gnBinIndex);\r
+        fileOutputStream.flush();\r
+        fileOutputStream.close();\r
     }\r
 \r
     private void PrepareCalFWHeader(){\r
@@ -280,11 +283,11 @@ public class TFTCConfiguration {
         gpBin[0] = '5';\r
 \r
         for(int i=0; i < datafile.length(); i++){\r
-            gpBin[24+i] = datafile.charAt(i);\r
+            gpBin[24+i] = (byte) datafile.charAt(i);\r
         }\r
 \r
         for(int i=0; i < description.length(); i++){\r
-            gpBin[24 + 64 + i] = description.charAt(i);\r
+            gpBin[24 + 64 + i] = (byte)description.charAt(i);\r
         }\r
 \r
 \r
@@ -302,42 +305,39 @@ public class TFTCConfiguration {
 \r
         gpBin[gnBinIndex++] = 0x00;\r
         gpBin[gnBinIndex++] = 0x01; // one calibration data block\r
-        Log.i(TAG, "binIndex for calibration data block =" + gnBinIndex);\r
 \r
         String CalibrationData = "Calibration Data";\r
         for(int i=0; i < CalibrationData.length(); i++){\r
-            gpBin[gnBinIndex+ i] = CalibrationData.charAt(i);\r
+            gpBin[gnBinIndex+ i] = (byte)CalibrationData.charAt(i);\r
         }\r
         gnBinIndex += 64;\r
 \r
         String CalibrationData2555 = "Calibration Data for TAS2555";\r
         for(int i=0; i < CalibrationData2555.length(); i++){\r
-            gpBin[gnBinIndex+ i] = CalibrationData2555.charAt(i);\r
+            gpBin[gnBinIndex+ i] = (byte)CalibrationData2555.charAt(i);\r
         }\r
         gnBinIndex += CalibrationData2555.length() + 1;\r
 \r
-        Log.i(TAG, "binIndex for smart amp =" + gnBinIndex);\r
         gpBin[gnBinIndex++] = 0x00; // compatible program = smart amp (index 0)\r
-        gpBin[gnBinIndex++] = (char)nConfiguration; // compatible configuration\r
+        gpBin[gnBinIndex++] = (byte)nConfiguration; // compatible configuration\r
 \r
         gpBin[gnBinIndex++] = 0x00;\r
         gpBin[gnBinIndex++] = 0x00;\r
         gpBin[gnBinIndex++] = 0x00;\r
         gpBin[gnBinIndex++] = 0x0A; // block type = 0x0A (calibration)\r
         gnBinBlockIndex = gnBinIndex;\r
-        Log.i(TAG, "gnBinBlockIndex =" + gnBinIndex);\r
+\r
         gnBinIndex += 4; // number of commands index\r
     }\r
 \r
     private void PrepareClosure(){\r
         int nCommands;\r
-        char pCommit[] = {\r
-            0x00, 0x04, 0x85, 0x00,\r
-            0x8C, 0x19, 0x7C, 0x00,\r
+        byte pCommit[] = {\r
+            0x00, 0x04, (byte) 0x85, 0x00,\r
+            (byte) 0x8C, 0x19, 0x7C, 0x00,\r
             0x00, 0x00, 0x01, 0x00\r
         };\r
 \r
-         Log.i(TAG, "commit sequence index=" + gnBinIndex);\r
         // write the commit sequence\r
         for(int i=0; i < pCommit.length; i++){\r
             gpBin[gnBinIndex++] = pCommit[i];\r
@@ -345,17 +345,16 @@ public class TFTCConfiguration {
 \r
         nCommands = ((gnBinIndex - gnBinBlockIndex) / 4) - 1;\r
 \r
-        Log.i(TAG, "index=" + gnBinBlockIndex + "number of commands for calibration block =" + nCommands);\r
         // write number of commands for calibration block\r
-        gpBin[gnBinBlockIndex++] = (char)((nCommands & 0xFF000000) >> 24);\r
-        gpBin[gnBinBlockIndex++] = (char)((nCommands & 0x00FF0000) >> 16);\r
-        gpBin[gnBinBlockIndex++] = (char)((nCommands & 0x0000FF00) >> 8);\r
-        gpBin[gnBinBlockIndex++] = (char)(nCommands & 0x000000FF);\r
+        gpBin[gnBinBlockIndex++] = (byte) ((nCommands & 0xFF000000) >> 24);\r
+        gpBin[gnBinBlockIndex++] = (byte)((nCommands & 0x00FF0000) >> 16);\r
+        gpBin[gnBinBlockIndex++] = (byte)((nCommands & 0x0000FF00) >> 8);\r
+        gpBin[gnBinBlockIndex++] = (byte)(nCommands & 0x000000FF);\r
 \r
         // write bin file size\r
-        gpBin[4] = (char)((gnBinIndex & 0xFF000000) >> 24);\r
-        gpBin[5] = (char)((gnBinIndex & 0x00FF0000) >> 16);\r
-        gpBin[6] = (char)((gnBinIndex & 0x0000FF00) >> 8);\r
-        gpBin[7] = (char)((gnBinIndex & 0x000000FF));\r
+        gpBin[4] = (byte)((gnBinIndex & 0xFF000000) >> 24);\r
+        gpBin[5] = (byte)((gnBinIndex & 0x00FF0000) >> 16);\r
+        gpBin[6] = (byte)((gnBinIndex & 0x0000FF00) >> 8);\r
+        gpBin[7] = (byte)((gnBinIndex & 0x000000FF));\r
     }\r
 }\r
diff --git a/TAS2555-FTC/screen_shot.png b/TAS2555-FTC/screen_shot.png
new file mode 100755 (executable)
index 0000000..727f638
Binary files /dev/null and b/TAS2555-FTC/screen_shot.png differ