Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: EthernetInterface FiapV2 HTTPClientForSOAP NTPClient TextLCD mbed-rtos mbed spxml
Fork of BlueUSB_f by
Diff: main.cpp
- Revision:
- 1:3f2890d103fb
- Parent:
- 0:606b230e5b4a
- Child:
- 2:32a2d06f4fe2
diff -r 606b230e5b4a -r 3f2890d103fb main.cpp
--- 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();
+ }
+ }
}
