diff options
| author | hathach <[email protected]> | 2019-05-21 13:31:02 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2019-05-21 13:31:02 +0700 |
| commit | ce6976f40055db185b7260c7619d02cf6ffd4cf6 (patch) | |
| tree | 569d8c123efa4b00f27a31993d11f54101bbb319 /examples/device | |
| parent | 73c7db38f7517bbd5c6710874962774bdc2df65d (diff) | |
better fix for #72 millis overthrow
Diffstat (limited to 'examples/device')
| -rw-r--r-- | examples/device/cdc_msc_hid/src/main.c | 4 | ||||
| -rw-r--r-- | examples/device/hid_generic_inout/src/main.c | 2 | ||||
| -rw-r--r-- | examples/device/msc_dual_lun/src/main.c | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/examples/device/cdc_msc_hid/src/main.c b/examples/device/cdc_msc_hid/src/main.c index ce81767cf..7c0fd39d5 100644 --- a/examples/device/cdc_msc_hid/src/main.c +++ b/examples/device/cdc_msc_hid/src/main.c @@ -177,7 +177,7 @@ void hid_task(void) const uint32_t interval_ms = 10; static uint32_t start_ms = 0; - if ( board_millis() < start_ms + interval_ms) return; // not enough time + if ( board_millis() - start_ms < interval_ms) return; // not enough time start_ms += interval_ms; uint32_t const btn = board_button_read(); @@ -264,7 +264,7 @@ void led_blinking_task(void) static bool led_state = false; // Blink every 1000 ms - if ( board_millis() < start_ms + blink_interval_ms) return; // not enough time + if ( board_millis() - start_ms < blink_interval_ms) return; // not enough time start_ms += blink_interval_ms; board_led_write(led_state); diff --git a/examples/device/hid_generic_inout/src/main.c b/examples/device/hid_generic_inout/src/main.c index d64598675..b08ca5aee 100644 --- a/examples/device/hid_generic_inout/src/main.c +++ b/examples/device/hid_generic_inout/src/main.c @@ -146,7 +146,7 @@ void led_blinking_task(void) static bool led_state = false; // Blink every 1000 ms - if ( board_millis() < start_ms + blink_interval_ms) return; // not enough time + if ( board_millis() - start_ms < blink_interval_ms) return; // not enough time start_ms += blink_interval_ms; board_led_write(led_state); diff --git a/examples/device/msc_dual_lun/src/main.c b/examples/device/msc_dual_lun/src/main.c index 54cd3d5bf..60500df93 100644 --- a/examples/device/msc_dual_lun/src/main.c +++ b/examples/device/msc_dual_lun/src/main.c @@ -107,7 +107,7 @@ void led_blinking_task(void) static bool led_state = false; // Blink every 1000 ms - if ( board_millis() < start_ms + blink_interval_ms) return; // not enough time + if ( board_millis() - start_ms < blink_interval_ms) return; // not enough time start_ms += blink_interval_ms; board_led_write(led_state); |
