1 /*
2 * Copyright (c) 2021-2024, Texas Instruments Incorporated
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * * Neither the name of Texas Instruments Incorporated nor the names of
17 * its contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32 /** ============================================================================
33 * @file PowerCC23X0.h
34 *
35 * @brief Power manager interface for CC23X0 devices
36 *
37 * The Power header file should be included in an application by including the
38 * top level header file as follows:
39 * @code
40 * #include <ti/drivers/Power.h>
41 * @endcode
42 *
43 * Refer to @ref Power.h for a complete description of APIs.
44 *
45 * ## Implementation ##
46 * This header file defines the power resources, constraints, events, sleep
47 * states and transition latencies for CC23X0.
48 *
49 * @anchor ti_drivers_PowerCC23X0_HFXT_Amplitude_Compensation
50 * ## HFXT Amplitude Compensation ##
51 * The CC23X0 Power driver will configure the HFXT amplitude to the highest
52 * possible value at boot (in #Power_init()). Each time the device
53 * enters standby the HFXT amplitude will be updated to ensure the optimal
54 * amplitude is used. It will take up to 5 iterations (5 standby entries)
55 * after boot until the optimal amplitude has been found. This process will
56 * ensure that the amplitude is kept in an optimal range if the operating
57 * conditions change, as long as the device regularly enters standby.
58 *
59 * ### Applications that rarely enters standby ###
60 * The amplitude adjustments done at standby entry is sufficient for
61 * applications that regularly enters standby, but if the application does not
62 * regularly enter standby, then #PowerLPF3_getHfxtAmpAdjustment() and
63 * #PowerLPF3_adjustHfxtAmp() can be used to check if an adjustment is needed,
64 * and perform the adjustment if needed.
65 *
66 * @anchor ti_drivers_PowerCC23X0_Initial_HFXT_Amplitude_Compensation
67 * ### Initial HFXT Amplitude Compensation ###
68 * If the application requires that the HFXT amplitude is already in the
69 * optimal range after boot, then Initial HFXT Amplitude Compensation can be
70 * enabled with #PowerCC23X0_Config.startInitialHfxtAmpCompFxn.
71 * If initial HFXT amplitude compensation is enabled, the optimal amplitude
72 * will be found at/after boot, meaning it will take longer before HFXT is
73 * ready after boot, but when it is ready the amplitude will already be in the
74 * optimal range. This process is done asynchronously, so the application can
75 * do other stuff while waiting for HFXT to be ready.
76 *
77 * Enabling initial HFXT amplitude compensation will result in more flash usage
78 * and longer time from boot to the first RF operation.
79 *
80 *
81 * ============================================================================
82 */
83
84 #ifndef ti_drivers_power_PowerCC23X0_
85 #define ti_drivers_power_PowerCC23X0_
86
87 #include <ti/drivers/dpl/HwiP.h>
88 #include <ti/drivers/dpl/ClockP.h>
89 #include <ti/drivers/Power.h>
90
91 #include <ti/devices/DeviceFamily.h>
92 #include DeviceFamily_constructPath(inc/hw_pmctl.h)
93 #include DeviceFamily_constructPath(inc/hw_clkctl.h)
94 #include DeviceFamily_constructPath(inc/hw_lrfddbell.h)
95 #include DeviceFamily_constructPath(inc/hw_memmap.h)
96 #include DeviceFamily_constructPath(inc/hw_types.h)
97 #include DeviceFamily_constructPath(driverlib/pmctl.h)
98
99 #ifdef __cplusplus
100 extern "C" {
101 #endif
102
103 /*! The latency to reserve for resume from STANDBY (usec). */
104 #define PowerCC23X0_RESUMETIMESTANDBY 400
105
106 /*! The total latency to reserve for entry to and exit from STANDBY (usec). */
107 #define PowerCC23X0_TOTALTIMESTANDBY 500
108
109 /*! The initial delay when waking from STANDBY (usec). */
110 #define PowerCC23X0_WAKEDELAYSTANDBY 185
111
112 /* Default lower threshold for when HFXT compensation is enabled */
113 #define PowerCC23X0_HFXT_THRESHOLD_TEMP_DEFAULT (-40)
114
115 /* \cond */
116 /* The control of the peripherals are split between multiple groups.
117 * These defines are used to differentiate between the groups.
118 * The bits in the PowerCC23X0_PERIPH_GROUP_M mask is used to store the group id,
119 * and the bits in the PowerCC23X0_PERIPH_BIT_INDEX_M mask is used to store the
120 * bit index shift value in the register for the given group.
121 */
122 #define PowerCC23X0_PERIPH_GROUP_M 0xFF00
123 #define PowerCC23X0_PERIPH_GROUP_CLKCTL0 0x0000
124 #define PowerCC23X0_PERIPH_GROUP_LRFD 0x0100
125 #define PowerCC23X0_PERIPH_BIT_INDEX_M 0x00FF
126
127 /* \endcond */
128
129 /* \cond */
130 typedef uint16_t PowerLPF3_Resource; /* Power resource identifier */
131 /* \endcond */
132
133 /* Resource IDs */
134
135 /*! Resource ID: General Purpose I/O */
136 #define PowerLPF3_PERIPH_GPIO (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_GPIO_S)
137
138 /*! Resource ID: UART 0 */
139 #define PowerLPF3_PERIPH_UART0 (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_UART0_S)
140
141 /*! Resource ID: I2C 0 */
142 #define PowerLPF3_PERIPH_I2C0 (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_I2C0_S)
143
144 /*! Resource ID: SPI 0 */
145 #define PowerLPF3_PERIPH_SPI0 (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_SPI0_S)
146
147 /*! Resource ID: ADC */
148 #define PowerLPF3_PERIPH_ADC0 (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_ADC0_S)
149
150 /*! Resource ID: AES Security Module */
151 #define PowerLPF3_PERIPH_AES (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_LAES_S)
152
153 /*! Resource ID: uDMA Controller */
154 #define PowerLPF3_PERIPH_DMA (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_DMA_S)
155
156 /*! Resource ID: General Purpose Timer 0 */
157 #define PowerLPF3_PERIPH_LGPT0 (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_LGPT0_S)
158
159 /*! Resource ID: General Purpose Timer 1 */
160 #define PowerLPF3_PERIPH_LGPT1 (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_LGPT1_S)
161
162 /* The peripherals below are not available on CC23X0R2 devices */
163 #if !defined(DeviceFamily_CC23X0R2)
164 /*! Resource ID: General Purpose Timer 2 */
165 #define PowerLPF3_PERIPH_LGPT2 (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_LGPT2_S)
166
167 /*! Resource ID: General Purpose Timer 3 */
168 #define PowerLPF3_PERIPH_LGPT3 (PowerCC23X0_PERIPH_GROUP_CLKCTL0 | CLKCTL_DESCEX0_LGPT3_S)
169 #endif
170
171 /*! Resource ID: LRFD Tracer */
172 #define PowerLPF3_PERIPH_LFRD_TRC (PowerCC23X0_PERIPH_GROUP_LRFD | LRFDDBELL_CLKCTL_TRC_S)
173
174 /*! Resource ID: LRFD S2R RAM */
175 #define PowerLPF3_PERIPH_LFRD_S2RRAM (PowerCC23X0_PERIPH_GROUP_LRFD | LRFDDBELL_CLKCTL_S2RRAM_S)
176
177 /* \cond */
178 /* Number of resources in the different resource groups. This is possibly larger
179 * than the peripheral instance count on various device variants. This is
180 * because some indexes might not be used for a given variant, resulting in a
181 * sparse table.
182 */
183 #if defined(DeviceFamily_CC23X0R2)
184 #define PowerCC23X0_NUMRESOURCES_CLKCTL0 29
185 #elif (defined(DeviceFamily_CC23X0R5) || defined(DeviceFamily_CC23X0R22))
186 #define PowerCC23X0_NUMRESOURCES_CLKCTL0 31
187 #else
188 #error "Unsupported DeviceFamily specified!"
189 #endif
190 #define PowerCC23X0_NUMRESOURCES_LRFD 12
191 /* \endcond */
192
193 #define PowerLPF3_STANDBY 0x1 /*!< The STANDBY sleep state */
194 /* \cond */
195 /* Internal flags for enabling/disabling resources */
196 #define PowerLPF3_ENABLE 1
197 #define PowerLPF3_DISABLE 0
198 /* \endcond */
199
200 /* Constraints
201 *
202 * Constraints restrict a specific system behavior from occurring or guarantee
203 * a specified effect until released.
204 */
205
206 /*! Constraint: Disallow a transition to the SHUTDOWN state */
207 #define PowerLPF3_DISALLOW_SHUTDOWN 0
208
209 /*! Constraint: Disallow a transition to the STANDBY sleep state */
210 #define PowerLPF3_DISALLOW_STANDBY 1
211
212 /*! Constraint: Disallow a transition to the IDLE sleep state */
213 #define PowerLPF3_DISALLOW_IDLE 2
214
215 /*! Constraint: Flash memory needs to enabled during IDLE */
216 #define PowerLPF3_NEED_FLASH_IN_IDLE 3
217
218 /* \cond */
219 #define PowerCC23X0_NUMCONSTRAINTS 4 /* Number of constraints supported */
220 /* \endcond */
221
222 /*
223 * Events
224 *
225 * Each event must be a power of two and must be sequential
226 * without any gaps.
227 */
228
229 /*! Power event: The device is entering the STANDBY sleep state */
230 #define PowerLPF3_ENTERING_STANDBY (1 << 0)
231
232 /*! Power event: The device is entering the SHUTDOWN state */
233 #define PowerLPF3_ENTERING_SHUTDOWN (1 << 1)
234
235 /*! Power event: The device is waking up from the STANDBY sleep state */
236 #define PowerLPF3_AWAKE_STANDBY (1 << 2)
237
238 /*! Power event: The high frequency (HF) crystal oscillator is now available
239 * for use (HFXT) by the digital domain
240 */
241 #define PowerLPF3_HFXT_AVAILABLE (1 << 3)
242
243 /*! Power event: The system has switched to the low frequency clock source
244 * configured in CCFG
245 */
246 #define PowerLPF3_LFCLK_SWITCHED (1 << 4)
247
248 /* \cond */
249 #define PowerCC23X0_NUMEVENTS 5 /* Number of events supported */
250 /* \endcond */
251
252 /*!
253 * @brief Function pointer to #PowerLPF3_startInitialHfxtAmpComp() or NULL.
254 *
255 * This type is only allowed to have the value NULL or be a
256 * pointer to #PowerLPF3_startInitialHfxtAmpComp().
257 */
258 typedef void (*PowerLPF3_StartInitialHfxtAmpCompFxn)(void);
259
260 /*! @brief Global configuration structure */
261 typedef struct
262 {
263 /*!
264 * @brief The Power Policy's initialization function
265 *
266 * If the policy does not have an initialization function, 'NULL'
267 * should be specified.
268 */
269 Power_PolicyInitFxn policyInitFxn;
270 /*!
271 * @brief The Power Policy function
272 *
273 * When enabled, this function is invoked in the idle loop, to
274 * opportunistically select and activate sleep states.
275 *
276 * Two reference policies are provided:
277 *
278 * PowerCC23X0_doWFI() - a simple policy that invokes CPU wait for
279 * interrupt (WFI)
280 *
281 * PowerCC23X0_standbyPolicy() - an agressive policy that considers
282 * constraints, time until next scheduled work, and sleep state
283 * latencies, and optionally puts the device into the STANDBY state,
284 * the IDLE state, or as a minimum, WFI.
285 *
286 * Custom policies can be written, and specified via this function pointer.
287 *
288 * In addition to this static selection, the Power Policy can be
289 * dynamically changed at runtime, via the Power_setPolicy() API.
290 *
291 * If not NULL, the policy function will be invoked once for each pass
292 * of the idle loop.
293 *
294 * The power policy can be dynamically
295 * enabled and disabled at runtime, via the Power_enablePolicy() and
296 * Power_disablePolicy() functions, respectively.
297 */
298 Power_PolicyFxn policyFxn;
299
300 /*!
301 * @brief Pointer to the function to start the initial HFXT amplitude
302 compensation.
303 *
304 * This is used to enable/disable the initial HFXT amplitude compensation
305 * feature.
306 *
307 * The allowed values for this field is:
308 * - NULL: Initial HFXT amplitude compensation is disabled.
309 * - Pointer to #PowerLPF3_startInitialHfxtAmpComp(): Initial HFXT
310 * amplitude compensation is disabled.
311 *
312 * @sa @ref ti_drivers_PowerCC23X0_Initial_HFXT_Amplitude_Compensation "Initial HFXT Amplitude Compensation"
313 */
314 PowerLPF3_StartInitialHfxtAmpCompFxn startInitialHfxtAmpCompFxn;
315 } PowerCC23X0_Config;
316
317 /*!
318 * @brief Reasons the device has booted or rebooted.
319 */
320 typedef enum
321 {
322 /*! Device woke up from shutdown due to an IO event */
323 PowerLPF3_RESET_SHUTDOWN_IO = PMCTL_RESET_SHUTDOWN_IO,
324 /*! Device woke up from shutdown due to an SWD event */
325 PowerLPF3_RESET_SHUTDOWN_SWD = PMCTL_RESET_SHUTDOWN_SWD,
326 /*! Device reset because of a watchdog timeout. */
327 PowerLPF3_RESET_WATCHDOG = PMCTL_RESET_WATCHDOG,
328 /*! Device reset triggered by software writing to RSTCTL.SYSRST */
329 PowerLPF3_RESET_SYSTEM = PMCTL_RESET_SYSTEM,
330 /*! Device reset triggered by CPU reset event */
331 PowerLPF3_RESET_CPU = PMCTL_RESET_CPU,
332 /*! Device reset triggered by CPU lockup event */
333 PowerLPF3_RESET_LOCKUP = PMCTL_RESET_LOCKUP,
334 /*! Device woke up from thermal shutdown after temperature drop */
335 PowerLPF3_RESET_TSD = PMCTL_RESET_TSD,
336 /*! Device woke up due to Serial Wire Debug event */
337 PowerLPF3_RESET_SWD = PMCTL_RESET_SWD,
338 /*! Device reset due to LFXT clock loss */
339 PowerLPF3_RESET_LFXT = PMCTL_RESET_LFXT,
340 /*! Device reset due to VDDR brownout event */
341 PowerLPF3_RESET_VDDR = PMCTL_RESET_VDDR,
342 /*! Device reset due to VDDS brownout event */
343 PowerLPF3_RESET_VDDS = PMCTL_RESET_VDDS,
344 /*! Device reset due to pin reset */
345 PowerLPF3_RESET_PIN = PMCTL_RESET_PIN,
346 /*! Device booted due to power on reset */
347 PowerLPF3_RESET_POR = PMCTL_RESET_POR,
348 } PowerLPF3_ResetReason;
349
350 /*!
351 * @brief The wait for interrupt (WFI) policy
352 *
353 * This is a lightweight Power Policy which simply invokes CPU wait for
354 * interrupt.
355 *
356 * This policy can be selected statically via the policyFxn pointer in the
357 * PowerCC23X0_Config structure, or dynamically at runtime, via
358 * Power_setPolicy().
359 */
360 void PowerCC23X0_doWFI(void);
361
362 /*!
363 * @brief Returns the reason for the most recent reset or wakeup
364 *
365 * @return #PowerLPF3_ResetReason
366 * @pre Power_shutdown()
367 * @post PowerLPF3_releaseLatches()
368 */
PowerLPF3_getResetReason(void)369 static inline PowerLPF3_ResetReason PowerLPF3_getResetReason(void)
370 {
371 return (PowerLPF3_ResetReason)PMCTLGetResetReason();
372 }
373
374 /*!
375 * @brief Unlatch all IOs
376 *
377 * This function releases the latches on all frozen IOs. This function should be
378 * called after waking up from shutdown and reconfiguring the IO state so as not
379 * to cause glitches.
380 *
381 * @note Calling this function will clear the reset reason register if it was
382 * #PowerLPF3_RESET_SHUTDOWN_IO and PowerLPF3_RESET_SHUTDOWN_SWD and
383 * cause PowerLPF3_getResetReason() not to return the true reset reason.
384 *
385 * @pre Power_shutdown()
386 * @pre PowerLPF3_getResetReason()
387 */
PowerLPF3_releaseLatches(void)388 static inline void PowerLPF3_releaseLatches(void)
389 {
390 HWREG(PMCTL_BASE + PMCTL_O_SLPCTL) = PMCTL_SLPCTL_SLPN_DIS;
391 }
392
393 /*!
394 * @brief The STANDBY Power Policy
395 *
396 * This is an agressive Power Policy, which considers active constraints,
397 * sleep state transition latencies, and time until the next scheduled
398 * work, and automatically transitions the device into the deepest sleep state
399 * possible.
400 *
401 * The first goal is to enter STANDBY; if that is not appropriate
402 * given current conditions (e.g., the sleep transition latency is greater
403 * greater than the time until the next scheduled Clock event), then
404 * the secondary goal is the IDLE state; if that is disallowed (e.g., if
405 * the PowerLPF3_DISALLOW_IDLE constraint is declared), then the policy
406 * will fallback and simply invoke WFI, to clock gate the CPU until the next
407 * interrupt.
408 *
409 * In order for this policy to run, it must be selected as the Power
410 * Policy (either by being specified as the 'policyFxn' in the
411 * PowerCC23X0_Config structure, or specified at runtime with
412 * Power_setPolicy()), and the Power Policy must be enabled (either via
413 * 'enablePolicy' in the PowerCC23X0_Config structure, or via a call to
414 * Power_enablePolicy() at runtime).
415 */
416 void PowerCC23X0_standbyPolicy(void);
417
418 /*!
419 * @brief Select LFOSC as LFCLK source
420 *
421 * Turn on the LFOSC and choose it as LFCLK source. Once LFCLK has switched, the
422 * #PowerLPF3_LFCLK_SWITCHED notification will be issued and all subscribers to
423 * this event will be notified.
424 *
425 * @warning Dynamic switching between LF clocks is not supported. Once one of
426 * PowerLPF3_selectLFOSC(), PowerLPF3_selectLFXT() or PowerLPF3_selectEXTLF()
427 * is called in an application, the other two may not be invoked thereafter.
428 *
429 * @pre Power_init()
430 * @sa PowerLPF3_selectLFXT()
431 * @sa PowerLPF3_selectEXTLF()
432 */
433 void PowerLPF3_selectLFOSC(void);
434
435 /*!
436 * @brief Select LFXT as LFCLK source
437 *
438 * Turn on the LFXT and choose it as LFCLK source. Once LFCLK has switched,
439 * the #PowerLPF3_LFCLK_SWITCHED notification will be issued and all
440 * subscribers to this event will be notified.
441 *
442 * @warning Dynamic switching between LF clocks is not supported. Once one of
443 * PowerLPF3_selectLFOSC(), PowerLPF3_selectLFXT() or PowerLPF3_selectEXTLF()
444 * is called in an application, the other two may not be invoked thereafter.
445 *
446 * @pre Power_init()
447 * @sa PowerLPF3_selectLFOSC()
448 * @sa PowerLPF3_selectEXTLF()
449 */
450 void PowerLPF3_selectLFXT(void);
451
452 /*!
453 * @brief Select EXTLF as LFCLK source
454 *
455 * Choose an external 31.25 kHz square wave as the LFCLK source as input.
456 * Once LFCLK has switched, the #PowerLPF3_LFCLK_SWITCHED notification
457 * will be issued and all subscribers to this event will be notified.
458 *
459 * This function requires the following symbols to be defined.
460 * - \c PowerLPF3_extlfPin (uint8_t): The DIO number of the pin to be used as the EXTLF pin.
461 * - \c PowerLPf3_extlfPinMux (uint8_t): Mux value used to mux the EXTLF signal to \c PowerLPF3_extlfPin.
462 * If using SysConfig, the symbols will be defined in ti_drivers_config.c.
463 *
464 * @warning Dynamic switching between LF clocks is not supported. Once one of
465 * PowerLPF3_selectLFOSC(), PowerLPF3_selectLFXT() or PowerLPF3_selectEXTLF()
466 * is called in an application, the other two may not be invoked thereafter.
467 *
468 * @pre Power_init()
469 * @sa PowerLPF3_selectLFOSC()
470 * @sa PowerLPF3_selectLFXT()
471 */
472 void PowerLPF3_selectEXTLF(void);
473
474 /*!
475 * @brief Initialise HFXT temperature compensation coefficients
476 *
477 * Initialise the parameters used for HFXT temperature coefficients. They approximate
478 * the ppm offset of the HFXT frequency with the following polynomial as a function of
479 * temperature (degC), where P_3 = P3 / 2^shift, P_2 = P2 / 2^shift, etc..
480 * ppm(T) = P_3*T^3 + P_2*T^2 + P_1*T + P_0
481 *
482 * @param[in] P0 0th-order coefficient, multiplied by 2^shift
483 * @param[in] P1 1st-order coefficient, multiplied by 2^shift
484 * @param[in] P2 2nd-order coefficient, multiplied by 2^shift
485 * @param[in] P3 3rd-order coefficient, multiplied by 2^shift
486 * @param[in] shift Shift-value for scaling fixed-point coefficients
487 * @param[in] fcfgInsertion Boolean used to indicate presence of HFXT FCFG data.
488 *
489 * @pre Power_init()
490 */
491
492 void PowerLPF3_initHFXTCompensation(int32_t P0, int32_t P1, int32_t P2, int32_t P3, uint8_t shift, bool fcfgInsertion);
493
494 /*!
495 * @brief Enable HFXT temperature compensation
496 *
497 * Enable automatic compensation for temperature-based frequency-drift of HFXT
498 *
499 * This function should only be called once, but can be invoked again if
500 * PowerLPF3_enableHFXTCompensation has been called
501 *
502 * @param[in] tempThreshold Threshold above which temperature compensation will
503 * be performed. This can be useful to save power consumption if HFXT
504 * performance is acceptable at low temperatures, and only required at
505 * high temperatures. If the threshold is set to for example 80 degrees, then
506 * the first compensation will occur once the temperature reaches 81 degrees.
507 * Units in degrees Celsius.
508 * @param[in] tempDelta Delta describing how much the temperature can drift
509 * before compensation is applied. If compensation is performed at 81 degrees,
510 * and the delta is set to 5, then a re-compensation is performed at either
511 * 76 degrees or 86 degrees, depending on which temperature state occurs first.
512 * Units in degrees Celsius.
513 *
514 * @pre PowerLPF3_initHFXTCompensation()
515 */
516 void PowerLPF3_enableHFXTCompensation(int16_t tempThreshold, int16_t tempDelta);
517
518 /*!
519 * @brief Disable HFXT temperature compensation
520 *
521 * Disable automatic compensation for temperature-based frequency-drift of HFXT
522 *
523 * @note Calling this function will also undo any previous temperature compensation that has been
524 * performed in the past, and HFXT will become uncompensated
525 *
526 * @pre PowerLPF3_enableHFXTCompensation()
527 */
528 void PowerLPF3_disableHFXTCompensation(void);
529
530 /*!
531 * @brief Start initial compensation of the HFXT amplitude
532 *
533 * @warning This function must not be called by the application. It is only
534 * intended to be specified for #PowerCC23X0_Config.startInitialHfxtAmpCompFxn
535 */
536 void PowerLPF3_startInitialHfxtAmpComp(void);
537
538 /*!
539 * @brief Check if HFXT amplitude needs to be adjusted
540 *
541 * The HFXT amplitude needs to regularly be checked and if needed adjusted.
542 * The Power driver will check the amplitude and adjust it when the device
543 * enters standby. However if the device does not enter standby often enough,
544 * then additional checks and adjustments are needed.
545 *
546 * This function can be used to check if adjustment of the amplitude is needed,
547 * and #PowerLPF3_adjustHfxtAmp() can be used to adjust the amplitude if needed.
548 *
549 * @return
550 * - +1: The amplitude needs to be increased
551 * - 0: No adjustments are needed
552 * - -1: The amplitude needs to be decreased
553 *
554 * @sa #PowerLPF3_adjustHfxtAmp()
555 */
556 int_fast8_t PowerLPF3_getHfxtAmpAdjustment(void);
557
558 /*!
559 * @brief Adjust the HFXT amplitude
560 *
561 * This function is to be used to adjust the HFXT amplitude if an adjustment is
562 * needed according to #PowerLPF3_getHfxtAmpAdjustment(). Please refer to the
563 * documentation of #PowerLPF3_getHfxtAmpAdjustment() for more details.
564 *
565 * @note The radio must be disabled when adjusting the HFXT amplitude, and while
566 * the amplitude is settling.
567 * After this function returns, the caller must wait until the HFXT amplitude
568 * has settled.
569 *
570 * @param adjustment the value returned by #PowerLPF3_getHfxtAmpAdjustment().
571 * No other value is allowed.
572 *
573 * @pre #PowerLPF3_getHfxtAmpAdjustment() must be called, and it must return
574 * a non-zero value (indicating that adjustment is needed)
575 * @sa #PowerLPF3_getHfxtAmpAdjustment()
576 */
577 void PowerLPF3_adjustHfxtAmp(int_fast8_t adjustment);
578
579 void PowerCC23X0_schedulerDisable(void);
580 void PowerCC23X0_schedulerRestore(void);
581
582 #ifdef __cplusplus
583 }
584 #endif
585
586 #endif /* POWER_CC23X0_ */
587