BlackOneとAndroidの連携デモプログラム AndroidAccessoryを改造してBlackOneとAndroidが連携できるようにしました。 サポートしているのは、デモアプリの ”Buttons” B1-SW1, B2-SW2, B3-SW3 ”LED2” RGB-LED のみです。 LCDに表示するイメージをマイクロSDカードに入れてLCDのソケットに挿入しておく必要があります。 イメージは、320X240ドットで”\Image”という名前のフォルダの直下に”10.jpg”という名前で入れてください。

Dependencies:   TextLCD mbed

Committer:
techand
Date:
Fri Dec 23 04:33:33 2011 +0000
Revision:
0:7b556109fd46

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
techand 0:7b556109fd46 1
techand 0:7b556109fd46 2
techand 0:7b556109fd46 3 #include "mbed.h"
techand 0:7b556109fd46 4 #include "Utils.h"
techand 0:7b556109fd46 5
techand 0:7b556109fd46 6 void printfBytes(const char* s, const u8* data, int len)
techand 0:7b556109fd46 7 {
techand 0:7b556109fd46 8 printf("%s %d:",s,len);
techand 0:7b556109fd46 9 if (len > 256)
techand 0:7b556109fd46 10 len = 256;
techand 0:7b556109fd46 11 while (len-- > 0)
techand 0:7b556109fd46 12 printf(" %02X",*data++);
techand 0:7b556109fd46 13 printf("\r\n");
techand 0:7b556109fd46 14 }
techand 0:7b556109fd46 15
techand 0:7b556109fd46 16 void printHexLine(const u8* d, int addr, int len)
techand 0:7b556109fd46 17 {
techand 0:7b556109fd46 18 printf("%04X ",addr);
techand 0:7b556109fd46 19 int i;
techand 0:7b556109fd46 20 for (i = 0; i < len; i++)
techand 0:7b556109fd46 21 printf("%02X ",d[i]);
techand 0:7b556109fd46 22 for (;i < 16; i++)
techand 0:7b556109fd46 23 printf(" ");
techand 0:7b556109fd46 24 char s[16+1];
techand 0:7b556109fd46 25 memset(s,0,sizeof(s));
techand 0:7b556109fd46 26 for (i = 0; i < len; i++)
techand 0:7b556109fd46 27 {
techand 0:7b556109fd46 28 int c = d[i];
techand 0:7b556109fd46 29 if (c < 0x20 || c > 0x7E)
techand 0:7b556109fd46 30 c = '.';
techand 0:7b556109fd46 31 s[i] = c;
techand 0:7b556109fd46 32 }
techand 0:7b556109fd46 33 printf("%s\r\n",s);
techand 0:7b556109fd46 34 }
techand 0:7b556109fd46 35
techand 0:7b556109fd46 36 void printHex(const u8* d, int len)
techand 0:7b556109fd46 37 {
techand 0:7b556109fd46 38 int addr = 0;
techand 0:7b556109fd46 39 while (len)
techand 0:7b556109fd46 40 {
techand 0:7b556109fd46 41 int count = len;
techand 0:7b556109fd46 42 if (count > 16)
techand 0:7b556109fd46 43 count = 16;
techand 0:7b556109fd46 44 printHexLine(d+addr,addr,count);
techand 0:7b556109fd46 45 addr += 16;
techand 0:7b556109fd46 46 len -= count;
techand 0:7b556109fd46 47 }
techand 0:7b556109fd46 48 }