STC15W408AS library 0.9.0
Macros
timer_to_ms_common.h File Reference
#include <stdint.h>
#include <frequency.h>
#include <timer_structs.h>
Include dependency graph for timer_to_ms_common.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define timer_uint16_ticks_to_freq100(ticks, timer_clock_divider, frequency_divider_scale)   ((100 * get_master_clock_frequency() / (timer_clock_divider * (1 + (uint32_t)ticks))) >> frequency_divider_scale)
 Convert ticks to timer frequency multiplied by 100. More...
 
#define timer_frequency_to_ticks_unsafe(frequency, timer_clock_divider, frequency_divider_scale)   (((get_master_clock_frequency() >> 1) / (frequency * timer_clock_divider)) >> frequency_divider_scale)
 Convert timer frequency to ticks (unsafe operation) More...
 
#define timer_ticks_to_ms_usafe(ticks, timer_divider, frequency_divider_scale)   (((1UL + (uint32_t)ticks) / ((get_master_clock_frequency_high_part() / timer_divider) >> frequency_divider_scale)))
 Convert ticks count to ms. More...
 
#define timer_ms_to_ticks_usafe(ms, timer_clock_divider)   (ms * ((get_master_clock_frequency_high_part() + 26) >> get_frequency_divider_scale()) / timer_clock_divider)
 Convert milliseconds to timer ticks. More...