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 m3pi_TUB by
Diff: m3pi_ng.cpp
- Revision:
- 10:f89d2a3a9ed2
- Parent:
- 9:deb9547909c3
- Child:
- 11:7bfb33432791
--- a/m3pi_ng.cpp Mon May 13 10:54:18 2013 +0000 +++ b/m3pi_ng.cpp Tue May 14 11:05:33 2013 +0000 @@ -38,37 +38,31 @@ } -char * m3pi::signature () { - char* sig = new char[6]; //must be initialised with new, else it is destroyed when the function exits +void m3pi::signature (char * sig) { _ser.putc(SEND_SIGNATURE); for (int i=0; i<6;i++){ sig[i]=_ser.getc(); } - return sig; } -int * m3pi::raw_sensor () { +void m3pi::raw_sensor (int * raw) { _ser.putc(SEND_RAW_SENSOR_VALUES); - int* raw = new int[5]; //must be initialised with new, else it is destroyed when the function exits for (int i=0; i<5; i++){ char lowbyte = _ser.getc(); char hibyte = _ser.getc(); int s = (lowbyte + (hibyte << 8)); raw[i] = s; } - return(raw); } -int * m3pi::calibrated_sensor () { +void m3pi::calibrated_sensor (int * cal) { _ser.putc(SEND_CALIBRATED_SENSOR_VALUES); - int* cal = new int[5]; //must be initialised with new, else it is destroyed when the function exits for (int i=0; i<5; i++){ char lowbyte = _ser.getc(); char hibyte = _ser.getc(); int s = (lowbyte + (hibyte << 8)); cal[i] = s; } - return(cal); } void m3pi::playtune (char* text, int length) {