nakagawa kit emurator (add CR) BaudRate 115200,p20
Dependencies: mbed NetServicesMin
main.cpp
- Committer:
- recotana
- Date:
- 2012-04-17
- Revision:
- 3:51e64f5e42b8
- Parent:
- 2:c3f3d783560d
- Child:
- 4:9daa308155d6
File content as of revision 3:51e64f5e42b8:
#include "mbed.h" #include "data_models.h" Serial pc(USBTX, USBRX); DigitalIn din(p20); void serialInit(void){ pc.baud(115200); pc.format(8, Serial::None, 1); } void sendPayload(Payload *data){ uint8_t *d=(uint8_t *)&data->ftype; for(uint8_t i=0 ; i<67 ; i++){ if(d[i]==0x0A) pc.putc(0x0D); //add CR LF pc.putc(d[i]); } } int main() { din.mode(PullUp); serialInit(); Payload payload; initTestPayloadData(&payload); payloadToNetwork(&payload); while(1) { // if(!din){ sendPayload(&payload); wait(0.2); // } } }