/***************************************************************************//**
 * TMR_current_value()
 * See "core_timer.h" for details of how to use this function.
 */
uint32_t
TMR_current_value
(
    timer_instance_t * this_timer
)
{
	uint32_t value = 0;
	HAL_ASSERT( this_timer != NULL_timer_instance )
    
    value = HAL_get_32bit_reg( this_timer->base_address, TimerValue );
    
	return value;
}
Ejemplo n.º 2
0
(
    pwm_instance_t * pwm_inst,
    pwm_id_t pwm_id,
    uint32_t duty_cycle
)
{

    /* Assertion will ensure correct PWM output has been selected. */
    HAL_ASSERT( pwm_id >= PWM_1 )
    HAL_ASSERT( pwm_id <= PWM_16 )

    /* Assertion will ensure duty cycle is less than or equal to period value. */
#ifndef NDEBUG
  {
    uint32_t period ;
    period = HAL_get_32bit_reg( pwm_inst->address, PERIOD );
    HAL_ASSERT( duty_cycle <= period );
  }
#endif

    if ( (pwm_id >= PWM_1) && (pwm_id <= PWM_16 ))
    {
        if ( duty_cycle == 0u )
        {
            PWM_disable( pwm_inst, pwm_id );
        }
        else
        {
            HW_set_32bit_reg
               (
                    pwm_inst->address + g_pwm_posedge_offset_lut[pwm_id],