@@ -141,7 +141,7 @@ void test_sleep_auto()
141
141
const ticker_info_t *lp_ticker_info = get_lp_ticker_data ()->interface ->get_info ();
142
142
const unsigned lp_ticker_mask = ((1 << lp_ticker_info->bits ) - 1 );
143
143
const ticker_irq_handler_type lp_ticker_irq_handler_org = set_lp_ticker_irq_handler (lp_ticker_isr);
144
- us_timestamp_t us_ts1, us_ts2, lp_ts1, lp_ts2, us_diff1, us_diff2, lp_diff1, lp_diff2;
144
+ uint32_t us_ts1, us_ts2, lp_ts1, lp_ts2, us_diff1, us_diff2, lp_diff1, lp_diff2;
145
145
146
146
/* Let's avoid the Lp ticker wrap-around case */
147
147
wraparound_lp_protect ();
@@ -155,14 +155,16 @@ void test_sleep_auto()
155
155
156
156
sleep_manager_lock_deep_sleep ();
157
157
158
- us_ts1 = ticks_to_us ( us_ticker_read (), us_ticker_info-> frequency );
159
- lp_ts1 = ticks_to_us ( lp_ticker_read (), lp_ticker_info-> frequency );
158
+ us_ts1 = us_ticker_read ();
159
+ lp_ts1 = lp_ticker_read ();
160
160
161
161
sleep_manager_sleep_auto ();
162
- us_ts2 = ticks_to_us (us_ticker_read (), us_ticker_info->frequency );
163
- us_diff1 = (us_ts1 <= us_ts2) ? (us_ts2 - us_ts1) : (us_ticker_mask - us_ts1 + us_ts2 + 1 );
164
- lp_ts2 = ticks_to_us (lp_ticker_read (), lp_ticker_info->frequency );
165
- lp_diff1 = (lp_ts1 <= lp_ts2) ? (lp_ts2 - lp_ts1) : (lp_ticker_mask - lp_ts1 + lp_ts2 + 1 );
162
+
163
+ us_ts2 = us_ticker_read ();
164
+ lp_ts2 = lp_ticker_read ();
165
+
166
+ us_diff1 = ticks_to_us ((us_ts1 <= us_ts2) ? (us_ts2 - us_ts1) : (us_ticker_mask - us_ts1 + us_ts2 + 1 ), us_ticker_info->frequency );
167
+ lp_diff1 = ticks_to_us ((lp_ts1 <= lp_ts2) ? (lp_ts2 - lp_ts1) : (lp_ticker_mask - lp_ts1 + lp_ts2 + 1 ), lp_ticker_info->frequency );
166
168
167
169
// Deep sleep locked -- ordinary sleep mode used:
168
170
// * us_ticker powered ON,
@@ -190,15 +192,16 @@ void test_sleep_auto()
190
192
* set and forbid deep_sleep during that period. Let this period pass */
191
193
TEST_ASSERT_TRUE (sleep_manager_can_deep_sleep_test_check ());
192
194
193
- us_ts1 = ticks_to_us ( us_ticker_read (), us_ticker_info-> frequency );
194
- lp_ts1 = ticks_to_us ( lp_ticker_read (), lp_ticker_info-> frequency );
195
+ us_ts1 = us_ticker_read ();
196
+ lp_ts1 = lp_ticker_read ();
195
197
196
198
sleep_manager_sleep_auto ();
197
199
198
- us_ts2 = ticks_to_us (us_ticker_read (), us_ticker_info->frequency );
199
- us_diff2 = (us_ts1 <= us_ts2) ? (us_ts2 - us_ts1) : (us_ticker_mask - us_ts1 + us_ts2 + 1 );
200
- lp_ts2 = ticks_to_us (lp_ticker_read (), lp_ticker_info->frequency );
201
- lp_diff2 = (lp_ts1 <= lp_ts2) ? (lp_ts2 - lp_ts1) : (lp_ticker_mask - lp_ts1 + lp_ts2 + 1 );
200
+ us_ts2 = us_ticker_read ();
201
+ lp_ts2 = lp_ticker_read ();
202
+
203
+ us_diff2 = ticks_to_us ((us_ts1 <= us_ts2) ? (us_ts2 - us_ts1) : (us_ticker_mask - us_ts1 + us_ts2 + 1 ), us_ticker_info->frequency );
204
+ lp_diff2 = ticks_to_us ((lp_ts1 <= lp_ts2) ? (lp_ts2 - lp_ts1) : (lp_ticker_mask - lp_ts1 + lp_ts2 + 1 ), lp_ticker_info->frequency );
202
205
203
206
// Deep sleep unlocked -- deep sleep mode used:
204
207
// * us_ticker powered OFF,
0 commit comments