スマートコンセント(富士通 FX-5204PS)をIEEE1888 StorageにWRITEするサンプルプログラムです。

Dependencies:   EthernetInterface FiapV2 HTTPClientForSOAP NTPClient TextLCD mbed-rtos mbed spxml

Fork of BlueUSB_f by Yasushi TAUCHI

スマートコンセント(富士通 FX-5204PS)をIEEE1888 StorageにWRITEするサンプルプログラムです。
USB HUBを使用して2台利用した例です。
表示のみは http://mbed.org/users/yueee_yt/code/BlueUSB_f/で公開しています。

BlueUSBより派生していますが、BluetoothとMass Storage Classは利用できません。

2台まで確認していますが、プログラム的には10台まで接続できるようにしています。
(RTOSとの整合により難しいかもしれません)

Revision:
1:3f2890d103fb
Parent:
0:606b230e5b4a
Child:
2:32a2d06f4fe2
--- a/main.cpp	Sat Apr 10 00:30:24 2010 +0000
+++ b/main.cpp	Wed Sep 26 06:29:47 2012 +0000
@@ -34,34 +34,28 @@
     int _device;
     u32 _blockSize;
     u32 _blockCount;
-    
+
 public:
-    USBFileSystem() : FATFileSystem("usb"),_device(0),_blockSize(0),_blockCount(0)
-    {
+    USBFileSystem() : FATFileSystem("usb"),_device(0),_blockSize(0),_blockCount(0) {
     }
-    
-    void SetDevice(int device)
-    {
+
+    void SetDevice(int device) {
         _device = device;
     }
-    
-    virtual int disk_initialize()
-    {
+
+    virtual int disk_initialize() {
         return MassStorage_ReadCapacity(_device,&_blockCount,&_blockSize);
     }
-    
-    virtual int disk_write(const char *buffer, int block_number)
-    {
+
+    virtual int disk_write(const char *buffer, int block_number) {
         return MassStorage_Write(_device,block_number,1,(u8*)buffer,_blockSize);
     }
-    
-    virtual int disk_read(char *buffer, int block_number)
-    {
+
+    virtual int disk_read(char *buffer, int block_number) {
         return MassStorage_Read(_device,block_number,1,(u8*)buffer,_blockSize);
     }
-        
-    virtual int disk_sectors()
-    {
+
+    virtual int disk_sectors() {
         return _blockCount;
     }
 };
@@ -69,16 +63,14 @@
 void DumpFS(int depth, int count)
 {
     DIR *d = opendir("/usb");
-    if (!d)
-    {
+    if (!d) {
         printf("USB file system borked\n");
         return;
     }
 
     printf("\nDumping root dir\n");
     struct dirent *p;
-    for(;;)
-    {
+    for(;;) {
         p = readdir(d);
         if (!p)
             break;
@@ -112,10 +104,24 @@
 }
 
 void TestShell();
-
+void InitUSPS();
+void USPS_Refresh();
+DigitalOut led1(LED1);
+Timer t;
 int main()
 {
     pc.baud(460800);
     printf("BlueUSB\nNow get a bunch of usb or bluetooth things and plug them in\n");
-    TestShell();
+    InitUSPS();
+    //TestShell();
+     USBInit();
+     t.start();
+     while(1){
+     USBLoop();
+ if(t>1 ){
+ t.start();
+ led1=!led1;
+USPS_Refresh();
+ }    
+     }
 }