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: mbed
Fork of PS3conOut by
Diff: AutoEvents.cpp
- Revision:
- 2:c7ef143a19e5
- Parent:
- 1:7b9e3032bb7b
diff -r 7b9e3032bb7b -r c7ef143a19e5 AutoEvents.cpp
--- a/AutoEvents.cpp Mon May 18 03:50:39 2015 +0000
+++ b/AutoEvents.cpp Mon May 18 05:30:25 2015 +0000
@@ -28,6 +28,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <mbed.h>
#include "USBHost.h"
#include "Utils.h"
@@ -250,6 +251,30 @@
// Implemented in main.cpp
int OnDiskInsert(int device);
+void convert(u8 *mac){
+ LocalFileSystem local("local");
+ FILE *fp;
+ fp = fopen("/local/data.p3b", "r");
+ if(fp==NULL){
+ fp = fopen("/local/data.p3b", "w");
+ fprintf(fp,"00:02:72:D0:82:F7");
+ fclose(fp);
+ fp = fopen("/local/data.p3b", "r");
+ }
+ char a[20];
+ fgets(a,sizeof(a),fp);
+ char b[6][5];
+ char *end;
+ for(int i=0;i<6;i++){
+ b[i][0]='0';
+ b[i][1]='x';
+ b[i][2]=a[i*3];
+ b[i][3]=a[1+i*3];
+ b[i][4]='\n';
+ mac[i]=(u8)strtol(b[i],&end,0);
+ }
+ fclose(fp);
+}
// Implemented in TestShell.cpp
int OnBluetoothInsert(int device);
@@ -258,7 +283,9 @@
{
printf("LoadDevice %d %02X:%02X:%02X\r\n",device,interfaceDesc->bInterfaceClass,interfaceDesc->bInterfaceSubClass,interfaceDesc->bInterfaceProtocol);
char s[128];
- u8 my_mac[6] = {0x00, 0x1B, 0xDC, 0x09, 0xEB, 0xF2}; // mac address of my Bluetooth device
+ //u8 my_mac[6] = {0x00, 0x02, 0x72, 0xD0, 0x82, 0xF7}; // mac address of my Bluetooth device
+ u8 my_mac[6];
+ convert(my_mac);
u8 buf2[6];
