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.
Diff: LambdaController.cpp
- Revision:
- 5:57c6d5db3d52
- Parent:
- 4:c35227d14896
- Child:
- 6:c4e901c6001a
--- a/LambdaController.cpp Wed Aug 24 01:35:09 2016 +0000 +++ b/LambdaController.cpp Mon Aug 29 08:19:17 2016 +0000 @@ -2,7 +2,7 @@ LambdaController::LambdaController(PinName tx, PinName rx) : twe_lite(tx, rx) -{ +{ is_axis_initialized = false; buffer_head = -1; @@ -11,8 +11,8 @@ error_count = 0; error_id = NoDataError; - error_detection_timer.attach(this, &LambdaController::error_detection_isr, - timeout_time); + + error_timer.start(); } void LambdaController::data_receive_isr() @@ -48,6 +48,7 @@ error_count = 0; error_id = NoError; + error_timer.reset(); } else { buffer_head = -1; error_id = InvalidDataError; @@ -61,15 +62,6 @@ } } -void LambdaController::error_detection_isr() -{ - if (error_count < error_threshold) { - error_count++; - } else { - error_id = TimeoutError; - } -} - uint8_t LambdaController::get_all_switch() { return received_data[1]; @@ -149,17 +141,6 @@ LambdaController::ErrorFactor LambdaController::get_error() { + if (error_timer >= timeout_time) error_id = TimeoutError; return error_id; -} - -void LambdaController::debug(const char *format, ...) -{ - /* - va_list arg; - - va_start(arg, format); - twe_lite.vprintf(format, arg); - va_end(arg); - */ -} - +} \ No newline at end of file