Functions
void user_int_timer_1ms (void)
- timer interrupt every 1 millisecond
- This function call is already defined in user_code.c.
void user_defined_int_timer (void)
- timer interrupt on a user defined interval
- This function call is already defined in user_code.c.
void os_pwm_duty_cycle (uint8_t i, uint16_t pwm_promille, uint16_t pwm_frequency, uint16_t pwm_dither_promille, uint16_t pwm_dither_frequency)
- set the output of a PWM capable I/O pin
- Parameters
i
, select the HSD output pin.
pwm_promille
, set the PWM ducty cycle in thousands, 0-1000 for 0-100 percent
pwm_frequency
, set the output frequency in hertz
pwm_dither_promille
, set the dither amplitude in thousands, set to "0" if not needed
pwm_dither_frequency
, set the dither frequency. Must be lower than pwm_promille. Set to "0" if not needed
void os_time_past(uint32_t time_val, uint8_t time, OS_1ms)
- check if
time
in milliseconds has elapsed since ```time_val``
void os_timestamp(*uint32_t time_val, OS_1ms)
- stamp the current time in ms to
time_val
Example Code
- Set
OUT_HSD0
with a PWM of 200hz and 45% duty cycle. No dither.
os_pwm_duty_cycle(OUT_HSD0, 450, 200, 0, 0);
- Check if 500ms have passed since last timestamp
if( os_time_past(time_val, 500, OS_1ms) )
{
os_timestamp(&time_val, OS_1ms);
}