Library set up as dummy module on mbed to mimic Nordic.

Dependencies:   mbed-rtos mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers comms.cpp Source File

comms.cpp

00001 #include "mbed.h"
00002 #include "comms.h"
00003 
00004 #define SERIAL1_TX PA_9
00005 #define SERIAL1_RX PA_10
00006 
00007 I2C i2c( D4 , D5 );
00008 Serial pc( USBTX , USBRX ); 
00009 Serial bus( SERIAL1_TX  , SERIAL1_RX );
00010 
00011 
00012 void initComms() {    
00013     pc.baud( 115200 );
00014     i2c.frequency( 400000 );
00015     bus.baud( 115200 );
00016 }
00017 
00018 void debugLog( char* fmt, ...) {
00019     char buf[100];     // this should really be sized appropriately
00020                        // possibly in response to a call to vsnprintf()
00021     va_list vl;
00022     va_start(vl, fmt);
00023 
00024     vsnprintf( buf, sizeof( buf), fmt, vl);
00025 
00026     va_end( vl);
00027 
00028     pc.printf(buf);
00029 }