2022-12-28 22:01:13 -05:00
|
|
|
/*
|
2023-01-10 02:13:19 -05:00
|
|
|
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
2022-12-28 22:01:13 -05:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "esp_private/systimer.h"
|
|
|
|
|
|
|
|
/**
|
2023-01-10 02:13:19 -05:00
|
|
|
* @brief When systimer's clock source is XTAL (32MHz), it has a fixed fractional divider (2).
|
|
|
|
* So the resolution of the systimer is 32MHz/2 = 16MHz.
|
2022-12-28 22:01:13 -05:00
|
|
|
*/
|
|
|
|
uint64_t systimer_ticks_to_us(uint64_t ticks)
|
|
|
|
{
|
|
|
|
return ticks / 16;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint64_t systimer_us_to_ticks(uint64_t us)
|
|
|
|
{
|
|
|
|
return us * 16;
|
|
|
|
}
|