Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of HelloWorld by
Hardware.cpp
- Committer:
- oopakhooo
- Date:
- 2016-11-16
- Revision:
- 5:afabac4fce1b
- Parent:
- 4:f0a11480f39f
File content as of revision 5:afabac4fce1b:
#include "Hardware.h" #include "mbed.h" DigitalOut output_pin_A(LED3); DigitalOut output_pin_V(LED2); /* void send_egram_data(Serial &pc,PaceHeart &Pacer){ int *amp = Pacer.get_egram_amp; int *wid = Pacer.get_egram_wid; int size = Pacer.get_egram_size; for(int i = 0; i<size;i++){ pc.printf ("%c%c",(char)((int)(amp[i])/128),(char)((int)(amp[i])%128)); pc.printf ("%c%c",(char)((int)(10.0*wid[i])/128),(char)((int)(10.0*wid[i])%128)); } pc.printf("\n"); pc.printf("%c\n",(char)size); datachk } */ void send_data(Serial &pc,PaceHeart &Pacer){ pc.printf ("%c",(char)Pacer.get_p_pacingState()); pc.printf ("%c",(char)Pacer.get_p_pacingMode()); pc.printf ("%c",(char)Pacer.get_p_hysteresis()); pc.printf ("%c%c",(char)((int)(Pacer.get_p_hysteresisInterval()/128)),(char)(Pacer.get_p_hysteresisInterval()%128)); pc.printf ("%c%c",(char)((int)(Pacer.get_lowrateInterval()/128)),(char)(Pacer.get_lowrateInterval()%128)); pc.printf ("%c%c",(char)((int)(Pacer.get_p_vPaceAmp())/128),(char)((int)(Pacer.get_p_vPaceAmp())%128)); pc.printf ("%c%c",(char)((int)(10.0*Pacer.get_p_vPaceWidth())/128),(char)((int)(10.0*Pacer.get_p_vPaceWidth())%128));//10*pace width pc.printf ("%c%c\n",(char)((int)(Pacer.get_p_VRP()/128)),(char)(Pacer.get_p_VRP()%128)); return; } void request_data(Serial &pc,PaceHeart &Pacer){ //implement limit later char d[14]; int e = 0; pc.scanf("%s",&d); pc.printf("%c",'e');//end e = (int)d[0]; Pacer.set_p_pacingState(e); e = (int)d[1]; Pacer.set_p_pacingMode(e); e = (int)d[2]; Pacer.set_p_hysteresis(e); e = (int)d[3]*128+(int)d[4]; Pacer.set_p_hysteresisInterval(e); e = (int)d[5]*128+(int)d[6]; Pacer.set_lowrateInterval(e); e = (int)d[7]*128+(int)d[8]; Pacer.set_p_vPaceAmp((double)e); e = (int)d[9]*128+(int)d[10]; Pacer.set_p_vPaceWidth((double)e/10.0); e = (int)d[11]*128+(int)d[12]; Pacer.set_p_VRP(e); } void Check_serial(Serial &pc,PaceHeart &Pacer){ char c = pc.getc(); if(c=='r'){//send params send_data(pc,Pacer); } else if(c=='s') {//set params request_data(pc,Pacer); } }