Skip to content

Commit 93d4422

Browse files
jeromecoutant0xc0170
authored andcommitted
tests-mbed_hal-common_tickers_freq : use unsigned long
1 parent 61ec91c commit 93d4422

File tree

1 file changed

+7
-7
lines changed
  • TESTS/mbed_hal/common_tickers_freq

1 file changed

+7
-7
lines changed

TESTS/mbed_hal/common_tickers_freq/main.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ const ticker_interface_t* intf;
4141

4242
static volatile unsigned int overflowCounter;
4343

44-
unsigned int ticks_to_us(unsigned int ticks, unsigned int freq)
44+
uint32_t ticks_to_us(uint32_t ticks, uint32_t freq)
4545
{
46-
return (unsigned int)((unsigned long long)ticks * US_PER_S / freq);
46+
return (uint32_t)((uint64_t)ticks * US_PER_S / freq);
4747
}
4848

4949
void ticker_event_handler_stub(const ticker_data_t * const ticker)
@@ -65,9 +65,9 @@ void ticker_frequency_test()
6565
char _key[11] = { };
6666
char _value[128] = { };
6767
int expected_key = 1;
68-
const unsigned int ticker_freq = intf->get_info()->frequency;
69-
const unsigned int ticker_bits = intf->get_info()->bits;
70-
const unsigned int ticker_max = (1 << ticker_bits) - 1;
68+
const uint32_t ticker_freq = intf->get_info()->frequency;
69+
const uint32_t ticker_bits = intf->get_info()->bits;
70+
const uint32_t ticker_max = (1 << ticker_bits) - 1;
7171

7272
overflowCounter = 0;
7373

@@ -84,15 +84,15 @@ void ticker_frequency_test()
8484
expected_key = strcmp(_key, "base_time");
8585
} while (expected_key);
8686

87-
const unsigned int begin_ticks = intf->read();
87+
const uint32_t begin_ticks = intf->read();
8888

8989
/* Assume that there was no overflow at this point - we are just after init. */
9090
greentea_send_kv(_key, ticks_to_us(begin_ticks, ticker_freq));
9191

9292
/* Wait for 2nd signal from host. */
9393
greentea_parse_kv(_key, _value, sizeof(_key), sizeof(_value));
9494

95-
const unsigned int end_ticks = intf->read();
95+
const uint32_t end_ticks = intf->read();
9696

9797
greentea_send_kv(_key, ticks_to_us(end_ticks + overflowCounter * ticker_max, ticker_freq));
9898

0 commit comments

Comments
 (0)