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.
Dependents: 2019_SwitchNode_AR ArmNode 2919_LineSensor 2019_MD ... more
Diff: Mycan.cpp
- Revision:
- 12:5669dfdbe539
- Parent:
- 7:cac42b73a4f6
--- a/Mycan.cpp Mon Sep 02 05:09:45 2019 +0000 +++ b/Mycan.cpp Sat Sep 21 11:59:57 2019 +0000 @@ -40,8 +40,13 @@ bool Mycan::send() { - if (!write_type) return can.write(CANMessage(td_id, (char*)&td_integer, 8)); - else if (write_type) return can.write(CANMessage(td_id, (char*)&td_decimal, 8)); + bool return_val; + if(!write_type) + return_val = can.write(CANMessage(td_id, (char*)&td_integer, 8)); + else if(write_type) + return_val = can.write(CANMessage(td_id, (char*)&td_decimal, 8)); + + return return_val; } void Mycan::readI() @@ -72,9 +77,13 @@ float Mycan::get(uint32_t _id, int _num) { + float return_val; rd_id = _id; rd_num = _num; - if (!read_type) return integer_values_storage[rd_id].value[rd_num]; - else if (read_type) return decimal_values_storage[rd_id].value[rd_num]; -} - + if(!read_type) + return_val = integer_values_storage[rd_id].value[rd_num]; + else if(read_type) + return_val = decimal_values_storage[rd_id].value[rd_num]; + + return return_val; +} \ No newline at end of file