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: FatFileSystemCpp mbed-rtos mbed
Fork of BlueUSB by
Revision 1:12422708d6c8, committed 2014-11-18
- Comitter:
- acorness
- Date:
- Tue Nov 18 00:11:42 2014 +0000
- Parent:
- 0:606b230e5b4a
- Commit message:
- Now with RTOS!
Changed in this revision
--- a/AutoEvents.cpp Sat Apr 10 00:30:24 2010 +0000
+++ b/AutoEvents.cpp Tue Nov 18 00:11:42 2014 +0000
@@ -139,11 +139,12 @@
char s[128];
for (int i = 1; i < 3; i++)
{
+ break;
if (GetString(device,i,s,sizeof(s)) < 0)
break;
printf("%d: %s\n",i,s);
}
-
+
switch (interfaceDesc->bInterfaceClass)
{
case CLASS_MASS_STORAGE:
--- a/FATFileSystem.lib Sat Apr 10 00:30:24 2010 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://mbed.org/users/mbed_unsupported/code/fatfilesystem/ \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/FatFileSystemCpp.lib Tue Nov 18 00:11:42 2014 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/igorsk/code/FatFileSystemCpp/#88f22c32a456
--- a/TestShell.cpp Sat Apr 10 00:30:24 2010 +0000
+++ b/TestShell.cpp Tue Nov 18 00:11:42 2014 +0000
@@ -25,10 +25,33 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <math.h>
#include "Utils.h"
#include "USBHost.h"
#include "hci.h"
+#include "mbed.h"
+#include "rtos.h"
+
+DigitalOut led1(LED1);
+DigitalOut led2(LED2);
+DigitalOut led3(LED3);
+DigitalOut led4(LED4);
+
+typedef enum { //MAKE STATE VALUES
+Left,
+Right,
+Up,
+Down,
+Nothing
+} Wiistate;
+
+Wiistate wiistate = Nothing;
+
+float vol = 0; //VOLUME FLOAT
+
+Mutex key;
+
void printf(const BD_ADDR* addr)
{
@@ -131,7 +154,58 @@
int x = (d[2] & 0x60) >> 5 | d[4] << 2;
int y = (d[3] & 0x20) >> 4 | d[5] << 2;
int z = (d[3] & 0x40) >> 5 | d[6] << 2;
- printf("WII %04X %d %d %d\n",pad,x,y,z);
+ //printf("WII2 %04X %d %d %d\n",pad,x,y,z);
+ int resolution= 24; //SENSITIVITY OF STATES
+
+ key.lock(); //LOCK GLOBAL VAR CHANGES
+
+ if(pad==0x0800){ //CHECK FOR BUTTON A
+ vol= (x-420)-(x-420)%21;
+ vol= vol/210;
+ if(vol<0) vol=0;
+ printf("Volume= %f\n",vol);
+ }
+ else if(pad==0x0400){ //OTHERWISE CHECK B
+
+ if(x<416+resolution){ //LEFT
+ wiistate=Left;
+ led1=1;
+ led2=0;
+ led3=0;
+ led4=0;
+ }
+ else if(x>630-resolution){ //RIGHT
+ wiistate=Right;
+ led1=0;
+ led2=1;
+ led3=0;
+ led4=0;
+ }
+ else if(y<420+resolution){ //UP
+ wiistate=Up;
+ led1=0;
+ led2=0;
+ led3=1;
+ led4=0;
+ }
+ else if(z>630-resolution){ //DOWN
+ wiistate=Down;
+ led1=0;
+ led2=0;
+ led3=0;
+ led4=1;
+ }
+ else{ //NOTHING
+ wiistate=Nothing;
+ led1=0;
+ led2=0;
+ led3=0;
+ led4=0;
+ }
+ }
+
+ key.unlock(); //UNLOCK GLOBAL VAR CHANGES
+
}
break;
default:
--- a/main.cpp Sat Apr 10 00:30:24 2010 +0000
+++ b/main.cpp Tue Nov 18 00:11:42 2014 +0000
@@ -115,7 +115,7 @@
int main()
{
- pc.baud(460800);
- printf("BlueUSB\nNow get a bunch of usb or bluetooth things and plug them in\n");
+ pc.baud(230400);
+ printf("BlueUSBv1\nNow get a bunch of usb or bluetooth things and plug them in\n");
TestShell();
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-rtos.lib Tue Nov 18 00:11:42 2014 +0000 @@ -0,0 +1,1 @@ +https://mbed.org/users/mbed_official/code/mbed-rtos/#631c0f1008c3
--- a/mbed.bld Sat Apr 10 00:30:24 2010 +0000 +++ b/mbed.bld Tue Nov 18 00:11:42 2014 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/49a220cc26e0 +http://mbed.org/users/mbed_official/code/mbed/builds/031413cf7a89 \ No newline at end of file
