diff --git a/zephyr/modules/owntech_hrtim_driver/zephyr/public_api/hrtim.h b/zephyr/modules/owntech_hrtim_driver/zephyr/public_api/hrtim.h index da2872674bb2669ee835c15737bf8adabf88658a..0fc178180fa3fa36418fc9379f1a5556d0d129dc 100644 --- a/zephyr/modules/owntech_hrtim_driver/zephyr/public_api/hrtim.h +++ b/zephyr/modules/owntech_hrtim_driver/zephyr/public_api/hrtim.h @@ -92,7 +92,45 @@ void hrtim_init_voltage_leg1_boost_leg2_buck(hrtim_tu_t leg1_tu, hrtim_tu_t leg2 void hrtim_init_voltage_leg1_boost_leg2_buck_center_aligned(hrtim_tu_t leg1_tu, hrtim_tu_t leg2_tu); void hrtim_update_adc_trig_interleaved(uint16_t new_trig, hrtim_tu_t leg1_tu, hrtim_tu_t leg2_tu); +/** + * @brief Enable interrupt on repetition counter for the chosen timing unit + * @param tu_src timing unit which will be the source for the ISR : + * @arg @ref MSTR + * @arg @ref TIMA + * @arg @ref TIMB + * @arg @ref TIMC + * @arg @ref TIMD + * @arg @ref TIME + * @arg @ref TIMF +*/ +void hrtim_PeriodicEvent_en(hrtim_tu_t tu_src); + +/** + * @brief Disable interrupt on repetition counter for the chosen timing unit + * @param tu_src timing unit which will be the source for the ISR : + * @arg @ref MSTR + * @arg @ref TIMA + * @arg @ref TIMB + * @arg @ref TIMC + * @arg @ref TIMD + * @arg @ref TIME + * @arg @ref TIMF + */ +void hrtim_PeriodicEvent_dis(hrtim_tu_t tu_src); +/** + * @brief Change the repetition counter value to control the ISR interrupt + * @param repetion value between 0 and 255 for the repetition counter + * @param tu_src timing unit which will be the source for the ISR : + * @arg @ref MSTR + * @arg @ref TIMA + * @arg @ref TIMB + * @arg @ref TIMC + * @arg @ref TIMD + * @arg @ref TIME + * @arg @ref TIMF + */ +void hrtim_PeriodicEvent_SetRep(uint32_t repetition, hrtim_tu_t tu_src); #ifdef __cplusplus } diff --git a/zephyr/modules/owntech_hrtim_driver/zephyr/src/hrtim_common.c b/zephyr/modules/owntech_hrtim_driver/zephyr/src/hrtim_common.c index f3b1d1729f15a8100f1b162ccd845b76059ca251..ca9d88f2eeed4dab6088d024e9dab81d1db1289c 100644 --- a/zephyr/modules/owntech_hrtim_driver/zephyr/src/hrtim_common.c +++ b/zephyr/modules/owntech_hrtim_driver/zephyr/src/hrtim_common.c @@ -77,6 +77,23 @@ void hrtim_update_adc_trig_interleaved(uint16_t new_trig, hrtim_tu_t leg1_tu, hr } } +void hrtim_PeriodicEvent_en(hrtim_tu_t tu_src) +{ + LL_HRTIM_TIM_SetRepetition(HRTIM1, tu_src , 9); /* We initialize the ISR interrupt frequency + to 1/10 of the switching frequency first */ + + LL_HRTIM_EnableIT_REP(HRTIM1, tu_src); /* Enabling the interrupt on repetition counter event*/ +} + +void hrtim_PeriodicEvent_dis(hrtim_tu_t tu_src) +{ + LL_HRTIM_DisableIT_REP(HRTIM1, tu_src); /* Disabling the interrupt on repetition counter event*/ +} + +void hrtim_PeriodicEvent_SetRep(uint32_t repetition, hrtim_tu_t tu_src) +{ + LL_HRTIM_TIM_SetRepetition(HRTIM1, tu_src , repetition); +} void hrtim_init_current() {