drivers: counter: add API to query counter frequency
Add API to get the base counter frequency. Signed-off-by: Peter A. Bigot <pab@pabigot.com>
This commit is contained in:
parent
e03c3d8f79
commit
8f28e6043d
1 changed files with 15 additions and 0 deletions
|
@ -157,6 +157,21 @@ static inline u8_t counter_get_num_of_channels(const struct device *dev)
|
|||
return config->channels;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Function to get counter frequency.
|
||||
*
|
||||
* @param[in] dev Pointer to the device structure for the driver instance.
|
||||
*
|
||||
* @return Frequency of the counter in Hz, or zero if the counter does
|
||||
* not have a fixed frequency.
|
||||
*/
|
||||
static inline u32_t counter_get_frequency(const struct device *dev)
|
||||
{
|
||||
const struct counter_config_info *config = dev->config->config_info;
|
||||
|
||||
return config->freq;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Function to convert microseconds to ticks.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue