BTstack for EA LPC4088 QSB example program

Dependencies:   LPC4088-USBHost mbed

Fork of KL46Z-BTstack_example by Norimasa Okamoto

The usage is the same as KL46Z-BTstack_example.
使い方はKL46Z-BTstack_exampleと同じです。
/media/uploads/va009039/lpc4088-btstack-480x360.jpg

usbbt/bd_addr.cpp

Committer:
va009039
Date:
2014-04-25
Revision:
6:d946cb517371
Parent:
0:1ed23ab1345f

File content as of revision 6:d946cb517371:

#include "mbed.h"
#include "bd_addr.h"
bd_addr::bd_addr()
{

}

bd_addr::bd_addr(char* s)
{
    for(int i = 0; i <= 5; i++) {
        ad[i] = strtol(s+i*3, NULL, 16);
    }
}

uint8_t* bd_addr::data(uint8_t* addr)
{
    if (addr != NULL) {
        ad[5] = addr[0];
        ad[4] = addr[1];
        ad[3] = addr[2];
        ad[2] = addr[3];
        ad[1] = addr[4];
        ad[0] = addr[5];
    }
    return ad;
}

char* bd_addr::to_str()
{
    snprintf(ad_str, sizeof(ad_str), "%02X:%02X:%02X:%02X:%02X:%02X", 
        ad[0], ad[1], ad[2], ad[3], ad[4], ad[5]);
    return ad_str;
}