Firmware for the mbed in the BlueSync Sensor platform. Intended to communicate with a BlueGiga BLE112 Bluetooth LE module over UART.
Dependencies: TimerCapture mbed
Diff: main.cpp
- Revision:
- 0:2bc22bc992ac
- Child:
- 1:cb941edd7bce
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat May 23 22:02:10 2015 +0000 @@ -0,0 +1,32 @@ +#include "mbed.h" +#include "TimerCapture.h" + +Serial ble112(p9, p10); +TimerCapture * capPin; +DigitalOut myled(LED1); + +void on_serial_rcv() { + ble112.getc(); + uint8_t hw_addr[6]; + for (int i = 5; i >=0; i--) { + hw_addr[i] = ble112.getc(); + } + + printf("***************\r\n"); + printf("HW Addr: %02x:%02x:%02x:%02x:%02x:%02x ", + hw_addr[0], + hw_addr[1], + hw_addr[2], + hw_addr[3], + hw_addr[4], + hw_addr[5]); + printf("Obs At: %d\r\n", capPin->getTime()); +} + +int main() { + TimerCapture::startTimer(); + capPin = new TimerCapture(p30); + ble112.baud(115200); + ble112.set_flow_control(SerialBase::RTSCTS, p7, p8); + ble112.attach(&on_serial_rcv); +}