ban4jp -
/
BTstack_test
https://mbed.org/forum/ja/topic/4890/
Fork of BTstack by
Revision 3:316daabf0d24, committed 2014-05-09
- Comitter:
- ban4jp
- Date:
- Fri May 09 15:54:35 2014 +0000
- Parent:
- 2:871b41f4789e
- Commit message:
- ??????????????????????
Changed in this revision
diff -r 871b41f4789e -r 316daabf0d24 USBHost.lib --- a/USBHost.lib Fri Mar 22 22:35:57 2013 +0000 +++ b/USBHost.lib Fri May 09 15:54:35 2014 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/USBHost/#0c11cf1cc218 +http://mbed.org/users/mbed_official/code/USBHost/#759ec18ee1a7
diff -r 871b41f4789e -r 316daabf0d24 mbed.bld --- a/mbed.bld Fri Mar 22 22:35:57 2013 +0000 +++ b/mbed.bld Fri May 09 15:54:35 2014 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/5e5da4a5990b \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/8a40adfe8776 \ No newline at end of file
diff -r 871b41f4789e -r 316daabf0d24 mouse_demo.cpp --- a/mouse_demo.cpp Fri Mar 22 22:35:57 2013 +0000 +++ b/mouse_demo.cpp Fri May 09 15:54:35 2014 +0000 @@ -1,4 +1,4 @@ -#if 1 +#if 0 /* mouse_demo.cpp */ #include "mbed.h" #include <btstack/run_loop.h>
diff -r 871b41f4789e -r 316daabf0d24 spp_demo.cpp --- a/spp_demo.cpp Fri Mar 22 22:35:57 2013 +0000 +++ b/spp_demo.cpp Fri May 09 15:54:35 2014 +0000 @@ -1,4 +1,4 @@ -#if 0 +#if 1 /* * spp_demo */ @@ -19,7 +19,7 @@ #include "bd_addr.h" // class bd_addr Serial pc(USBTX, USBRX); -DigitalOut led1(LED1), led2(LED2), led3(LED3); +DigitalOut led1(LED1), led2(LED2), led3(LED3), led4(LED4); #define HEARTBEAT_PERIOD_MS 500 @@ -27,6 +27,8 @@ static uint16_t rfcomm_channel_id = 0; static uint8_t spp_service_buffer[128]; +static void data_recv(uint8_t *packet, uint16_t size); + // Bluetooth logic static void packet_handler (void * connection, uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ bd_addr_t event_addr; @@ -107,17 +109,43 @@ log_info("rfcomm_send_internal -> error %d", err); } } - led3 = !led3; + + data_recv(packet, size); + +// led3 = !led3; break; default: break; } } +static void data_recv(uint8_t *packet, uint16_t size){ + int i; + log_info("packet(size:%d) = ", size); + for (i = 0; i < size; i++){ + log_info("%c", packet[i]); + switch (packet[i]) { + case 'a': + led1 = !led1; + break; + case 'b': + led2 = !led2; + break; + case 'c': + led3 = !led3; + break; + case 'd': + led4 = !led4; + break; + } + } + log_info("\n\r"); +} + static void heartbeat_handler(struct timer *ts){ run_loop_set_timer(ts, HEARTBEAT_PERIOD_MS); run_loop_add_timer(ts); - led2 = !led2; +// led2 = !led2; } // main @@ -127,7 +155,7 @@ log_info("%s\n", __FILE__); // init LEDs - led1 = led2 = led3 = 1; + led1 = led2 = led3 = led4 = 0; /// GET STARTED with BTstack /// btstack_memory_init();