Page 1 of 1

Clearing a register from the main program

Posted: Wed May 22, 2019 11:03 pm
by Thomas1
I need to stop an ULP program from running from the main program. According to the documentation:

"To disable the timer (effectively preventing the ULP program from running again), clear the RTC_CNTL_ULP_CP_SLP_TIMER_EN bit in the RTC_CNTL_STATE0_REG register. This can be done both from ULP code and from the main program."

I know how to do it in the ULP program itself

Code: Select all

WRITE_RTC_FIELD(RTC_CNTL_STATE0_REG, RTC_CNTL_ULP_CP_SLP_TIMER_EN, 0)
However, as I said I need to disable it from the main sketch. How do I do it?

Thanks.

Re: Clearing a register from the main program

Posted: Thu May 23, 2019 12:06 pm
by Thomas1
Well, I figured it out myself. You can just use the macro

Code: Select all

REG_CLR_BIT(RTC_CNTL_STATE0_REG, RTC_CNTL_ULP_CP_SLP_TIMER_EN);