Firmware for the mbed in the BlueSync Sensor platform. Intended to communicate with a BlueGiga BLE112 Bluetooth LE module over UART.

Dependencies:   TimerCapture mbed

main.cpp

Committer:
dishbreak
Date:
2015-05-23
Revision:
0:2bc22bc992ac
Child:
1:cb941edd7bce

File content as of revision 0:2bc22bc992ac:

#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);
}