1#![allow(clippy::identity_op)]
21#![allow(clippy::module_inception)]
22#![allow(clippy::derivable_impls)]
23#[allow(unused_imports)]
24use crate::common::sealed;
25#[allow(unused_imports)]
26use crate::common::*;
27#[doc = r"CHARGER registers"]
28unsafe impl ::core::marker::Send for super::Charger {}
29unsafe impl ::core::marker::Sync for super::Charger {}
30impl super::Charger {
31 #[allow(unused)]
32 #[inline(always)]
33 pub(crate) const fn _svd2pac_as_ptr(&self) -> *mut u8 {
34 self.ptr
35 }
36
37 #[doc = "Maximum CC-charge time limit register"]
38 #[inline(always)]
39 pub const fn charger_cc_charge_timer_reg(
40 &self,
41 ) -> &'static crate::common::Reg<self::ChargerCcChargeTimerReg_SPEC, crate::common::RW> {
42 unsafe {
43 crate::common::Reg::<self::ChargerCcChargeTimerReg_SPEC, crate::common::RW>::from_ptr(
44 self._svd2pac_as_ptr().add(28usize),
45 )
46 }
47 }
48
49 #[doc = "Charger main control register"]
50 #[inline(always)]
51 pub const fn charger_ctrl_reg(
52 &self,
53 ) -> &'static crate::common::Reg<self::ChargerCtrlReg_SPEC, crate::common::RW> {
54 unsafe {
55 crate::common::Reg::<self::ChargerCtrlReg_SPEC, crate::common::RW>::from_ptr(
56 self._svd2pac_as_ptr().add(0usize),
57 )
58 }
59 }
60
61 #[doc = "Charger current settings register"]
62 #[inline(always)]
63 pub const fn charger_current_param_reg(
64 &self,
65 ) -> &'static crate::common::Reg<self::ChargerCurrentParamReg_SPEC, crate::common::RW> {
66 unsafe {
67 crate::common::Reg::<self::ChargerCurrentParamReg_SPEC, crate::common::RW>::from_ptr(
68 self._svd2pac_as_ptr().add(16usize),
69 )
70 }
71 }
72
73 #[doc = "Maximum CV-charge time limit register"]
74 #[inline(always)]
75 pub const fn charger_cv_charge_timer_reg(
76 &self,
77 ) -> &'static crate::common::Reg<self::ChargerCvChargeTimerReg_SPEC, crate::common::RW> {
78 unsafe {
79 crate::common::Reg::<self::ChargerCvChargeTimerReg_SPEC, crate::common::RW>::from_ptr(
80 self._svd2pac_as_ptr().add(32usize),
81 )
82 }
83 }
84
85 #[doc = "Interrupt clear register of Charger Error IRQs"]
86 #[inline(always)]
87 pub const fn charger_error_irq_clr_reg(
88 &self,
89 ) -> &'static crate::common::Reg<self::ChargerErrorIrqClrReg_SPEC, crate::common::RW> {
90 unsafe {
91 crate::common::Reg::<self::ChargerErrorIrqClrReg_SPEC, crate::common::RW>::from_ptr(
92 self._svd2pac_as_ptr().add(108usize),
93 )
94 }
95 }
96
97 #[doc = "Mask register of Charger Error IRQs"]
98 #[inline(always)]
99 pub const fn charger_error_irq_mask_reg(
100 &self,
101 ) -> &'static crate::common::Reg<self::ChargerErrorIrqMaskReg_SPEC, crate::common::RW> {
102 unsafe {
103 crate::common::Reg::<self::ChargerErrorIrqMaskReg_SPEC, crate::common::RW>::from_ptr(
104 self._svd2pac_as_ptr().add(92usize),
105 )
106 }
107 }
108
109 #[doc = "Status register of Charger Error IRQs"]
110 #[inline(always)]
111 pub const fn charger_error_irq_status_reg(
112 &self,
113 ) -> &'static crate::common::Reg<self::ChargerErrorIrqStatusReg_SPEC, crate::common::RW> {
114 unsafe {
115 crate::common::Reg::<self::ChargerErrorIrqStatusReg_SPEC, crate::common::RW>::from_ptr(
116 self._svd2pac_as_ptr().add(100usize),
117 )
118 }
119 }
120
121 #[doc = "JEITA-compliant current settings register"]
122 #[inline(always)]
123 pub const fn charger_jeita_current_reg(
124 &self,
125 ) -> &'static crate::common::Reg<self::ChargerJeitaCurrentReg_SPEC, crate::common::RW> {
126 unsafe {
127 crate::common::Reg::<self::ChargerJeitaCurrentReg_SPEC, crate::common::RW>::from_ptr(
128 self._svd2pac_as_ptr().add(56usize),
129 )
130 }
131 }
132
133 #[doc = "JEITA-compliant Charge voltage settings register"]
134 #[inline(always)]
135 pub const fn charger_jeita_v_charge_reg(
136 &self,
137 ) -> &'static crate::common::Reg<self::ChargerJeitaVChargeReg_SPEC, crate::common::RW> {
138 unsafe {
139 crate::common::Reg::<self::ChargerJeitaVChargeReg_SPEC, crate::common::RW>::from_ptr(
140 self._svd2pac_as_ptr().add(40usize),
141 )
142 }
143 }
144
145 #[doc = "JEITA-compliant OVP settings register"]
146 #[inline(always)]
147 pub const fn charger_jeita_v_ovp_reg(
148 &self,
149 ) -> &'static crate::common::Reg<self::ChargerJeitaVOvpReg_SPEC, crate::common::RW> {
150 unsafe {
151 crate::common::Reg::<self::ChargerJeitaVOvpReg_SPEC, crate::common::RW>::from_ptr(
152 self._svd2pac_as_ptr().add(52usize),
153 )
154 }
155 }
156
157 #[doc = "JEITA-compliant Pre-Charge voltage settings register"]
158 #[inline(always)]
159 pub const fn charger_jeita_v_precharge_reg(
160 &self,
161 ) -> &'static crate::common::Reg<self::ChargerJeitaVPrechargeReg_SPEC, crate::common::RW> {
162 unsafe {
163 crate::common::Reg::<self::ChargerJeitaVPrechargeReg_SPEC, crate::common::RW>::from_ptr(
164 self._svd2pac_as_ptr().add(44usize),
165 )
166 }
167 }
168
169 #[doc = "JEITA-compliant Replenish settings register"]
170 #[inline(always)]
171 pub const fn charger_jeita_v_replenish_reg(
172 &self,
173 ) -> &'static crate::common::Reg<self::ChargerJeitaVReplenishReg_SPEC, crate::common::RW> {
174 unsafe {
175 crate::common::Reg::<self::ChargerJeitaVReplenishReg_SPEC, crate::common::RW>::from_ptr(
176 self._svd2pac_as_ptr().add(48usize),
177 )
178 }
179 }
180
181 #[doc = "Maximum pre-charge time limit register"]
182 #[inline(always)]
183 pub const fn charger_pre_charge_timer_reg(
184 &self,
185 ) -> &'static crate::common::Reg<self::ChargerPreChargeTimerReg_SPEC, crate::common::RW> {
186 unsafe {
187 crate::common::Reg::<self::ChargerPreChargeTimerReg_SPEC, crate::common::RW>::from_ptr(
188 self._svd2pac_as_ptr().add(24usize),
189 )
190 }
191 }
192
193 #[doc = "Charger power-up (settling) timer"]
194 #[inline(always)]
195 pub const fn charger_pwr_up_timer_reg(
196 &self,
197 ) -> &'static crate::common::Reg<self::ChargerPwrUpTimerReg_SPEC, crate::common::RW> {
198 unsafe {
199 crate::common::Reg::<self::ChargerPwrUpTimerReg_SPEC, crate::common::RW>::from_ptr(
200 self._svd2pac_as_ptr().add(84usize),
201 )
202 }
203 }
204
205 #[doc = "Interrupt clear register of Charger FSM IRQs"]
206 #[inline(always)]
207 pub const fn charger_state_irq_clr_reg(
208 &self,
209 ) -> &'static crate::common::Reg<self::ChargerStateIrqClrReg_SPEC, crate::common::RW> {
210 unsafe {
211 crate::common::Reg::<self::ChargerStateIrqClrReg_SPEC, crate::common::RW>::from_ptr(
212 self._svd2pac_as_ptr().add(104usize),
213 )
214 }
215 }
216
217 #[doc = "Mask register of Charger FSM IRQs"]
218 #[inline(always)]
219 pub const fn charger_state_irq_mask_reg(
220 &self,
221 ) -> &'static crate::common::Reg<self::ChargerStateIrqMaskReg_SPEC, crate::common::RW> {
222 unsafe {
223 crate::common::Reg::<self::ChargerStateIrqMaskReg_SPEC, crate::common::RW>::from_ptr(
224 self._svd2pac_as_ptr().add(88usize),
225 )
226 }
227 }
228
229 #[doc = "Status register of Charger FSM IRQs"]
230 #[inline(always)]
231 pub const fn charger_state_irq_status_reg(
232 &self,
233 ) -> &'static crate::common::Reg<self::ChargerStateIrqStatusReg_SPEC, crate::common::RW> {
234 unsafe {
235 crate::common::Reg::<self::ChargerStateIrqStatusReg_SPEC, crate::common::RW>::from_ptr(
236 self._svd2pac_as_ptr().add(96usize),
237 )
238 }
239 }
240
241 #[doc = "Charger main status register"]
242 #[inline(always)]
243 pub const fn charger_status_reg(
244 &self,
245 ) -> &'static crate::common::Reg<self::ChargerStatusReg_SPEC, crate::common::RW> {
246 unsafe {
247 crate::common::Reg::<self::ChargerStatusReg_SPEC, crate::common::RW>::from_ptr(
248 self._svd2pac_as_ptr().add(8usize),
249 )
250 }
251 }
252
253 #[doc = "Battery temperature (main) comparator timer"]
254 #[inline(always)]
255 pub const fn charger_tbat_comp_timer_reg(
256 &self,
257 ) -> &'static crate::common::Reg<self::ChargerTbatCompTimerReg_SPEC, crate::common::RW> {
258 unsafe {
259 crate::common::Reg::<self::ChargerTbatCompTimerReg_SPEC, crate::common::RW>::from_ptr(
260 self._svd2pac_as_ptr().add(76usize),
261 )
262 }
263 }
264
265 #[doc = "Battery temperature monitor interval timer"]
266 #[inline(always)]
267 pub const fn charger_tbat_mon_timer_reg(
268 &self,
269 ) -> &'static crate::common::Reg<self::ChargerTbatMonTimerReg_SPEC, crate::common::RW> {
270 unsafe {
271 crate::common::Reg::<self::ChargerTbatMonTimerReg_SPEC, crate::common::RW>::from_ptr(
272 self._svd2pac_as_ptr().add(72usize),
273 )
274 }
275 }
276
277 #[doc = "Die temperature comparator timer register"]
278 #[inline(always)]
279 pub const fn charger_tdie_comp_timer_reg(
280 &self,
281 ) -> &'static crate::common::Reg<self::ChargerTdieCompTimerReg_SPEC, crate::common::RW> {
282 unsafe {
283 crate::common::Reg::<self::ChargerTdieCompTimerReg_SPEC, crate::common::RW>::from_ptr(
284 self._svd2pac_as_ptr().add(68usize),
285 )
286 }
287 }
288
289 #[doc = "Charger battery temperature settings register"]
290 #[inline(always)]
291 pub const fn charger_tempset_param_reg(
292 &self,
293 ) -> &'static crate::common::Reg<self::ChargerTempsetParamReg_SPEC, crate::common::RW> {
294 unsafe {
295 crate::common::Reg::<self::ChargerTempsetParamReg_SPEC, crate::common::RW>::from_ptr(
296 self._svd2pac_as_ptr().add(20usize),
297 )
298 }
299 }
300
301 #[doc = "Battery temperature comparator timer for \"Hot\" zone"]
302 #[inline(always)]
303 pub const fn charger_thot_comp_timer_reg(
304 &self,
305 ) -> &'static crate::common::Reg<self::ChargerThotCompTimerReg_SPEC, crate::common::RW> {
306 unsafe {
307 crate::common::Reg::<self::ChargerThotCompTimerReg_SPEC, crate::common::RW>::from_ptr(
308 self._svd2pac_as_ptr().add(80usize),
309 )
310 }
311 }
312
313 #[doc = "Maximum total charge time limit register"]
314 #[inline(always)]
315 pub const fn charger_total_charge_timer_reg(
316 &self,
317 ) -> &'static crate::common::Reg<self::ChargerTotalChargeTimerReg_SPEC, crate::common::RW> {
318 unsafe {
319 crate::common::Reg::<self::ChargerTotalChargeTimerReg_SPEC, crate::common::RW>::from_ptr(
320 self._svd2pac_as_ptr().add(36usize),
321 )
322 }
323 }
324
325 #[doc = "Main Vbat comparator timer register"]
326 #[inline(always)]
327 pub const fn charger_vbat_comp_timer_reg(
328 &self,
329 ) -> &'static crate::common::Reg<self::ChargerVbatCompTimerReg_SPEC, crate::common::RW> {
330 unsafe {
331 crate::common::Reg::<self::ChargerVbatCompTimerReg_SPEC, crate::common::RW>::from_ptr(
332 self._svd2pac_as_ptr().add(60usize),
333 )
334 }
335 }
336
337 #[doc = "Charger voltage settings register"]
338 #[inline(always)]
339 pub const fn charger_voltage_param_reg(
340 &self,
341 ) -> &'static crate::common::Reg<self::ChargerVoltageParamReg_SPEC, crate::common::RW> {
342 unsafe {
343 crate::common::Reg::<self::ChargerVoltageParamReg_SPEC, crate::common::RW>::from_ptr(
344 self._svd2pac_as_ptr().add(12usize),
345 )
346 }
347 }
348
349 #[doc = "Vbat OVP comparator timer register"]
350 #[inline(always)]
351 pub const fn charger_vovp_comp_timer_reg(
352 &self,
353 ) -> &'static crate::common::Reg<self::ChargerVovpCompTimerReg_SPEC, crate::common::RW> {
354 unsafe {
355 crate::common::Reg::<self::ChargerVovpCompTimerReg_SPEC, crate::common::RW>::from_ptr(
356 self._svd2pac_as_ptr().add(64usize),
357 )
358 }
359 }
360}
361#[doc(hidden)]
362#[derive(Copy, Clone, Eq, PartialEq)]
363pub struct ChargerCcChargeTimerReg_SPEC;
364impl crate::sealed::RegSpec for ChargerCcChargeTimerReg_SPEC {
365 type DataType = u32;
366}
367
368#[doc = "Maximum CC-charge time limit register"]
369pub type ChargerCcChargeTimerReg = crate::RegValueT<ChargerCcChargeTimerReg_SPEC>;
370
371impl ChargerCcChargeTimerReg {
372 #[doc = "Returns the current value of the CC-Charge timeout counter, running at a 1Hz clock. The range of the specific timer is identical to the one of the Pre-Charge and the CV-Charge timers, so it may count up to 6 hours, ranging from 0 to MAX_CC_CHARGE_TIME. It is reset to 0 when the Charger\'s FSM is either in DISABLED or in END_OF_CHARGE state."]
373 #[inline(always)]
374 pub fn cc_charge_timer(
375 self,
376 ) -> crate::common::RegisterField<
377 16,
378 0x7fff,
379 1,
380 0,
381 u16,
382 u16,
383 ChargerCcChargeTimerReg_SPEC,
384 crate::common::R,
385 > {
386 crate::common::RegisterField::<
387 16,
388 0x7fff,
389 1,
390 0,
391 u16,
392 u16,
393 ChargerCcChargeTimerReg_SPEC,
394 crate::common::R,
395 >::from_register(self, 0)
396 }
397
398 #[doc = "This bit-field determines the maximum time (measured in ticks of the Charger\'s 1Hz clock) allowed for the CC (Constant Current) charging stage. If this is exceeded, a CC charge time-out error will be captured by the Charger\'s control unit and its FSM will move to the ERROR state. In order to exit this state and re-start charging, the CHARGER_RESUME bit-field of CHARGER_CTRL_REG must be set.\nNote: The specific bit-field should be always set to a non-zero value."]
399 #[inline(always)]
400 pub fn max_cc_charge_time(
401 self,
402 ) -> crate::common::RegisterField<
403 0,
404 0x7fff,
405 1,
406 0,
407 u16,
408 u16,
409 ChargerCcChargeTimerReg_SPEC,
410 crate::common::RW,
411 > {
412 crate::common::RegisterField::<
413 0,
414 0x7fff,
415 1,
416 0,
417 u16,
418 u16,
419 ChargerCcChargeTimerReg_SPEC,
420 crate::common::RW,
421 >::from_register(self, 0)
422 }
423}
424impl ::core::default::Default for ChargerCcChargeTimerReg {
425 #[inline(always)]
426 fn default() -> ChargerCcChargeTimerReg {
427 <crate::RegValueT<ChargerCcChargeTimerReg_SPEC> as RegisterValue<_>>::new(7200)
428 }
429}
430
431#[doc(hidden)]
432#[derive(Copy, Clone, Eq, PartialEq)]
433pub struct ChargerCtrlReg_SPEC;
434impl crate::sealed::RegSpec for ChargerCtrlReg_SPEC {
435 type DataType = u32;
436}
437
438#[doc = "Charger main control register"]
439pub type ChargerCtrlReg = crate::RegValueT<ChargerCtrlReg_SPEC>;
440
441impl ChargerCtrlReg {
442 #[doc = "The specific bit-field determines the current state of the timer used to periodically check the End-of-Charge signal, as soon as the Charger\'s FSM is either in CC_CHARGE or CV_CHARGE state. Thus, as soon as the Charger\'s FSM enters the CC_CHARGE state:\n - The timer starts increasing when a positive edge detection on End-of-Charge signal occurs.\n - It keeps increasing until reaching the programmed EOC_INTERVAL_CHECK_THRES value, if and only if there is no detection of a negative edge on End-of-Charge signal. If this happens, the timer resets and starts over with a new End-of-Charge positive edge.\n - The timer also resets after having reached its programmed threshold or when the Charger\'s FSM next state is END_OF_CHARGE. This happens only after having found End-of-Charge signal asserted for 4 consecutive checks and provided that the specific signal has not de-asserted during the timer\'s interval.\nNote: It must be noted that out of these two states, the specific timer is kept to zero. It is also noted that this timer runs at the 1Mhz clock of the Charger\'s block and its value always ranges from 0 to the EOC_INTERVAL_CHECK_THRES value set in the respective bit-field of CHARGER_CTRL_REG."]
443 #[inline(always)]
444 pub fn eoc_interval_check_timer(
445 self,
446 ) -> crate::common::RegisterField<22, 0x3f, 1, 0, u8, u8, ChargerCtrlReg_SPEC, crate::common::R>
447 {
448 crate::common::RegisterField::<22,0x3f,1,0,u8,u8,ChargerCtrlReg_SPEC,crate::common::R>::from_register(self,0)
449 }
450
451 #[doc = "This bit-field determines the periodic interval of checking the End-of-Charge signal, when the Charger\'s FSM is either in CC_CHARGE or in CV_CHARGE state. To implement this, a dedicated timer has been used, counting from zero up to the value programmed into this bit-field (see also EOC_INTERVAL_CHECK_TIMER field\'s description).\nAs soon as this timer reaches the programmed value, the End-of-Charge signal is sampled and depending on its status (high or low), another counter, keeping the number of consecutive End-of-Charge events, is increased or not. See also the description of the EOC_DEBOUNCE_CNT bit-field of CHARGER_STATUS_REG, for this counter.\nNote: The specific bit-field should always be programmed to a non-zero value."]
452 #[inline(always)]
453 pub fn eoc_interval_check_thres(
454 self,
455 ) -> crate::common::RegisterField<16, 0x3f, 1, 0, u8, u8, ChargerCtrlReg_SPEC, crate::common::RW>
456 {
457 crate::common::RegisterField::<16,0x3f,1,0,u8,u8,ChargerCtrlReg_SPEC,crate::common::RW>::from_register(self,0)
458 }
459
460 #[doc = "When this bit-field is set and the Charger\'s FSM is in the BYPASSED state (thus, in Bypass mode), the internal multiplexer inside the digital part of the charger selects the Replenish, instead of the Pre-charge setting to be driven to the main Vbat comparator of the Charger\'s analogue circuitry. By this way, SW can read the respective analogue comparator\'s output in CHARGER_STATUS_REG (bit-field MAIN_VBAT_COMP_OUT), after the battery\'s volrtage has reached the End-of-Charge level, and determine if the battery voltage has dropped below the Replenish level, re-starting the battery charging accordingly.\nNote: When the Charger\'s FSM is active and operational, this bit-field is don\'t care and the FSM determines which level (Pre-charge or Replenish) will be selected and driven to the analogue, depending on the current state. It is also noted that the supported Pre-charge and Replenish levels can be viewed in the respective bit-fields defined in CHARGER_VOLTAGE_PARAM_REG register."]
461 #[inline(always)]
462 pub fn replenish_mode(
463 self,
464 ) -> crate::common::RegisterFieldBool<15, 1, 0, ChargerCtrlReg_SPEC, crate::common::RW> {
465 crate::common::RegisterFieldBool::<15,1,0,ChargerCtrlReg_SPEC,crate::common::RW>::from_register(self,0)
466 }
467
468 #[doc = "When set, this bit-field enables a signal of the same name with the bit-field, driven from the Charger\'s digital part towards the analogue circuitry, in order to determine the current in Pre-Charge mode. If the Charger\'s FSM is active and operational, the specific bit-field is don\'t care. Hence, it is considered only when the Charger\'s FSM has reached the BYPASSED state (thus, in Bypass mode).\nWith the Charger\'s FSM being bypassed, SW should take over control and set the specific bit-field, in order to deliver the Pre-Charge instead of the normal Charge current to the Charger\'s analogue circuitry, during the Pre-Charge phase.\nNote: See also the description of CHARGER_CURRENT_PARAM_REG register for the Pre-Charge and normal Charge current levels supported."]
469 #[inline(always)]
470 pub fn pre_charge_mode(
471 self,
472 ) -> crate::common::RegisterFieldBool<14, 1, 0, ChargerCtrlReg_SPEC, crate::common::RW> {
473 crate::common::RegisterFieldBool::<14,1,0,ChargerCtrlReg_SPEC,crate::common::RW>::from_register(self,0)
474 }
475
476 #[doc = "When set, this bit-field disables charging, provided that the Charger\'s FSM has switched to the BYPASSED state. This is possible only by setting the CHARGER_BYPASS bit-field of this register.\nThus, as soon as the Charger\'s FSM is bypassed, the respective signal driven by the FSM is overruled by this bit-field, making the analogue part of the Charger controllable also in this mode. If the Charger\'s FSM is not bypassed, this bit-field is don\'t care."]
477 #[inline(always)]
478 pub fn charge_loop_hold(
479 self,
480 ) -> crate::common::RegisterFieldBool<13, 1, 0, ChargerCtrlReg_SPEC, crate::common::RW> {
481 crate::common::RegisterFieldBool::<13,1,0,ChargerCtrlReg_SPEC,crate::common::RW>::from_register(self,0)
482 }
483
484 #[doc = "0 = Charger\'s JEITA FSM monitoring the battery temperature checks also if battery temperature is in the Warm or Cool zones.\nIn that case, it updates accordingly all the Charger\'s voltage levels (Charge, Pre-Charge, Replenish and OVP) programmed in CHARGER_VOLTAGE_PARAM_REG, as well as the charge and pre-charge current settings of CHARGER_CURRENT_PARAM_REG, depending on the temperature zone determined by the analogue circuitry of the Charger (see also the JEITA registers of the Charger\'s register file for the Voltage/Current levels in Warm and Cool temperature zones).\n1 = Charger\'s JEITA FSM monitoring the battery temperature checks only if battery temperature is either in the Hot or Cold zones. In that case, it notifies the main Charger FSM to stop charging automatically, when in Hot zone. The same will happen also for the case of Cold, unless the NTC_LOW_DISABLE bit-field of CHARGER_CTRL_REG is set.\nNote : It is not recommended to have the specific bit-field kept to \'0\' (and thus the JEITA support enabled), if at the same time the bit-field TBAT_PROT_ENABLE of the same register is also \'0\'. Thus, JEITA support should be coupled with the Battery\'s temperature protection."]
485 #[inline(always)]
486 pub fn jeita_support_disabled(
487 self,
488 ) -> crate::common::RegisterFieldBool<12, 1, 0, ChargerCtrlReg_SPEC, crate::common::RW> {
489 crate::common::RegisterFieldBool::<12,1,0,ChargerCtrlReg_SPEC,crate::common::RW>::from_register(self,0)
490 }
491
492 #[doc = "Battery temperature pack monitoring modes, according to the following encoding:\n00 = Battery temperature state checked and updated once, as soon as the charger is powered-up and settled.\n01 = Battery temperature state checked periodically, depeding on TBAT_MON_TIMER_REG.TBAT_MON_INTERVAL and provided that Charger has been powered-up and charger\'s FSM is enabled.\n10 = Battery temperature state checked periodically depending on TBAT_MON_TIMER_REG.TBAT_MON_INTERVAL, provided that Charger is powered-up and regardless if the Charger\'s FSM is enabled or not. Hence, this mode can be effective regardless of the state of CHARGE_START bit-field of CHARGER_CTRL_REG.\n11 = When selected, it freezes the Battery temperature monitor FSM, as soon as the latter reaches the CHECK_IDLE state (see also CHARGER_STATUS_REG.CHARGER_JEITA_STATE bit-field\'s description for the states of this FSM). In this mode, the monitoring of Battery temperature is possible only by checking the status of TBAT_HOT_COMP_OUT and MAIN_TBAT_COMP_OUT bit-fields of CHARGER_STATUS_REG, thus by letting SW take over monitoring. This setting may be used in conjunction with Bypass mode (by setting CHARGER_BYPASS of CHARGER_CTRL_REG), so that both charging and battery temperature status monitoring are controlled by SW."]
493 #[inline(always)]
494 pub fn tbat_monitor_mode(
495 self,
496 ) -> crate::common::RegisterField<10, 0x3, 1, 0, u8, u8, ChargerCtrlReg_SPEC, crate::common::RW>
497 {
498 crate::common::RegisterField::<10,0x3,1,0,u8,u8,ChargerCtrlReg_SPEC,crate::common::RW>::from_register(self,0)
499 }
500
501 #[doc = "0 = Charge timeout timers continue running when charging is disabled because of a Die or of a Battery temperature error.\n1 = Charge timeout timers are halted in case of a Die or of a Battery temperature error.\nIn that case, the global charge timer is stopped as soon as the Charger\'s FSM moves to TDIE_PROT or TBAT_PROT state. Also, either the Pre-Charge, the CC_CHARGE or the CV_CHARGE timer is also stopped, depending on the charging state of the FSM when the Die/Battery temperature error has been detected."]
502 #[inline(always)]
503 pub fn charge_timers_halt_enable(
504 self,
505 ) -> crate::common::RegisterFieldBool<9, 1, 0, ChargerCtrlReg_SPEC, crate::common::RW> {
506 crate::common::RegisterFieldBool::<9,1,0,ChargerCtrlReg_SPEC,crate::common::RW>::from_register(self,0)
507 }
508
509 #[doc = "0 = Charging is disabled when the battery temperature is found to have reached the \"COLD\" region. Therefore, the Charger\'s FSM moves directly to \"TBAT_PROT\" error and generates an IRQ to notify the system accordingly, in case the respective IRQ mask bit of CHARGER_ERROR_IRQ_MASK_REG is set. Also, CHARGER_ERROR_IRQ_STATUS_REG. TBAT_ERROR_IRQ field is updated accordingly.\n1 = Charging is allowed to continue, even when the battery temperature pack reaches the \"COLD\" region. Consequently, the FSM continues charging and no battery temperature error event is generated."]
510 #[inline(always)]
511 pub fn ntc_low_disable(
512 self,
513 ) -> crate::common::RegisterFieldBool<7, 1, 0, ChargerCtrlReg_SPEC, crate::common::RW> {
514 crate::common::RegisterFieldBool::<7,1,0,ChargerCtrlReg_SPEC,crate::common::RW>::from_register(self,0)
515 }
516
517 #[doc = "0 = Battery temperature protection disabled\n1 = Battery temperature protection enabled.\nCharging will be stopped in case Battery temperature reaches \"Hot\" zone. It will also be disabled when reaching \"Cold\" zone, provided that CHARGER_CTRL_REG.NTC_LOW_DISABLE is not set. This is handled by the Charger\'s FSM, which moves directly to the respective error state (TBAT_PROT), also generating an Error IRQ if the respective IRQ mask bit is set (see also CHARGER_ERROR_IRQ_MASK_REG)."]
518 #[inline(always)]
519 pub fn tbat_prot_enable(
520 self,
521 ) -> crate::common::RegisterFieldBool<6, 1, 0, ChargerCtrlReg_SPEC, crate::common::RW> {
522 crate::common::RegisterFieldBool::<6,1,0,ChargerCtrlReg_SPEC,crate::common::RW>::from_register(self,0)
523 }
524
525 #[doc = "0 = FSM will not resume from a Die temperature error. Consequently, its state will be staying to \"TDIE_PROT\", for as long as this bit-field is kept low, regardless of the status of the die tempeture comparator. Also, disabling the specific bit-field will reset the Die temperature error debounce counter, when the Charger\'s FSM is in TDIE_PROT state (so when a Die temperature error has been already detected) and the specific counter will remain frozen to 0 until the TDIE_ERROR_RESUME bit-field is set (see also the TDIE_ERROR_DEBOUNCE_CNT bit-field of CHARGER_STATUS_REG).\n1 = FSM will resume from a Die temperature error, as soon as the respective analogue compator confirms that die temperature is again below the maximum allowed level.\nIt is noted that the maximum Die temperature level is programmable via the CHARGER_TEMPSET_PARAM_REG register\'s respective bit-field (T_DIE_MAX)."]
526 #[inline(always)]
527 pub fn tdie_error_resume(
528 self,
529 ) -> crate::common::RegisterFieldBool<5, 1, 0, ChargerCtrlReg_SPEC, crate::common::RW> {
530 crate::common::RegisterFieldBool::<5,1,0,ChargerCtrlReg_SPEC,crate::common::RW>::from_register(self,0)
531 }
532
533 #[doc = "0 = Die temperature protection is disabled, thus charging will not be disabled by the Charger\'s FSM in case of a Die temperature error.\n1 = Die temperature protection is enabled, thus the Charger\'s FSM will move to \"TDIE_PROT\" state, disabling charging at the same time.\nIt is noted that the Die temperature error event will be logged in the respective status bit of CHARGER_IRQ_ERROR_STATUS_REG and an IRQ will be generated, if and only if the corresponding mask bit of CHARGER_IRQ_MASK_REG is set."]
534 #[inline(always)]
535 pub fn tdie_prot_enable(
536 self,
537 ) -> crate::common::RegisterFieldBool<4, 1, 0, ChargerCtrlReg_SPEC, crate::common::RW> {
538 crate::common::RegisterFieldBool::<4,1,0,ChargerCtrlReg_SPEC,crate::common::RW>::from_register(self,0)
539 }
540
541 #[doc = "0 = Charger\'s FSM is not enable to resume from a charge timeout error or a Vbat OVP (Over-Voltage Protection) error. Consequently, FSM stays in \"ERROR\" state.\n1 = Charger\'s FSM will resume from a charge timeout or from an OVP error, thus its state will move from \"ERROR\" to \"DISABLED\" state, so that the charge cycle starts-over.\nIt is noted that in the case of a Vbat OVP error, the FSM will leave \"ERROR\" state, as soon as the Vbat comparator for the OVP level shows that Vbat is again OK (so lower than the OVP setting)."]
542 #[inline(always)]
543 pub fn charger_resume(
544 self,
545 ) -> crate::common::RegisterFieldBool<3, 1, 0, ChargerCtrlReg_SPEC, crate::common::RW> {
546 crate::common::RegisterFieldBool::<3,1,0,ChargerCtrlReg_SPEC,crate::common::RW>::from_register(self,0)
547 }
548
549 #[doc = "0 = Charger\'s FSM is active and running, notifying SW upon switching between its states\n1 = Charger\'s FSM is bypassed, so its state stays to \"BYPASS\", so SW should take over the monitoring of the battery voltage and control of the charger."]
550 #[inline(always)]
551 pub fn charger_bypass(
552 self,
553 ) -> crate::common::RegisterFieldBool<2, 1, 0, ChargerCtrlReg_SPEC, crate::common::RW> {
554 crate::common::RegisterFieldBool::<2,1,0,ChargerCtrlReg_SPEC,crate::common::RW>::from_register(self,0)
555 }
556
557 #[doc = "0 = Charger\'s FSM is disabled, FSM stays at \"DISABLED\" state\n1 = Charger\'s FSM is enabled, so FSM\'s state can move from DISABLED to the actual charge states, starting from \"PRE_CHARGE\"."]
558 #[inline(always)]
559 pub fn charge_start(
560 self,
561 ) -> crate::common::RegisterFieldBool<1, 1, 0, ChargerCtrlReg_SPEC, crate::common::RW> {
562 crate::common::RegisterFieldBool::<1,1,0,ChargerCtrlReg_SPEC,crate::common::RW>::from_register(self,0)
563 }
564
565 #[doc = "0 = Charger\'s analogue circuitry is powered-down\n1 = Charger\'s analogue circuitry is being powered-up and will be available after a certain settling time (in ms).\nAs soon as this bit-field is set, the Charger\'s FSM waits for this settling time, before proceeding into DISABLED state, where it checks the Vbat level, as well as the Die temperature and the Battery temperature states. This is mandatory, before the actual charging begins, so before the FSM moves to PRE_CHARGE state.\nIt is finally noted that the settling time is configurable via CHARGER_PWR_UP_TIMER_REG, counting with the 1Khz clock.\nNote: The Charger clocks must have been enabled first, by setting the CLK_SYS_REG\\[CLK_CHG_EN\\] bit-field to \'1\', in order to let the FSM proceed."]
566 #[inline(always)]
567 pub fn charger_enable(
568 self,
569 ) -> crate::common::RegisterFieldBool<0, 1, 0, ChargerCtrlReg_SPEC, crate::common::RW> {
570 crate::common::RegisterFieldBool::<0,1,0,ChargerCtrlReg_SPEC,crate::common::RW>::from_register(self,0)
571 }
572}
573impl ::core::default::Default for ChargerCtrlReg {
574 #[inline(always)]
575 fn default() -> ChargerCtrlReg {
576 <crate::RegValueT<ChargerCtrlReg_SPEC> as RegisterValue<_>>::new(4153976)
577 }
578}
579
580#[doc(hidden)]
581#[derive(Copy, Clone, Eq, PartialEq)]
582pub struct ChargerCurrentParamReg_SPEC;
583impl crate::sealed::RegSpec for ChargerCurrentParamReg_SPEC {
584 type DataType = u32;
585}
586
587#[doc = "Charger current settings register"]
588pub type ChargerCurrentParamReg = crate::RegValueT<ChargerCurrentParamReg_SPEC>;
589
590impl ChargerCurrentParamReg {
591 #[doc = "When set, the specific bit-field enables the doubling of the ( percent) range of End-of-Charge current setting. Consequently, the default lower and upper limits of 6 percent of I_CHARGE (value 0x0 of I_END_OF_CHARGE bit-field) and 20 percent (value 0x7 of the same bit-field) are increased to 12 percent and 40 percent respectively, as soon as the I_EOC_DOUBLE_RANGE field is set."]
592 #[inline(always)]
593 pub fn i_eoc_double_range(
594 self,
595 ) -> crate::common::RegisterFieldBool<15, 1, 0, ChargerCurrentParamReg_SPEC, crate::common::RW>
596 {
597 crate::common::RegisterFieldBool::<15,1,0,ChargerCurrentParamReg_SPEC,crate::common::RW>::from_register(self,0)
598 }
599
600 #[doc = "End-of-Charge current setting, ranging from 4 percent(\"000\") to 14.5 percent (\"111\") of the charge current set, with a step\nsize of 1.5 percent, as follows (when I_EOC_DOUBLE_RANGE = 0):\n000 : 4 percent\n001 : 5.5 percent\n010 : 7 percent\n011 : 8.5 percent\n100 : 10 percent\n101 : 11.5 percent\n110 : 13 percent\n111 : 14.5 percent\n\nWhen I_EOC_DOUBLE_RANGE = 1, The range is:\n000 : 8 percent\n001 : 11.5 percent\n010 : 15 percent\n011 : 18.5 percent\n100 : 22 percent\n101 : 25.5 percent\n110 : 29 percent\n111 : 32.5 percent"]
601 #[inline(always)]
602 pub fn i_end_of_charge(
603 self,
604 ) -> crate::common::RegisterField<
605 12,
606 0x7,
607 1,
608 0,
609 u8,
610 u8,
611 ChargerCurrentParamReg_SPEC,
612 crate::common::RW,
613 > {
614 crate::common::RegisterField::<
615 12,
616 0x7,
617 1,
618 0,
619 u8,
620 u8,
621 ChargerCurrentParamReg_SPEC,
622 crate::common::RW,
623 >::from_register(self, 0)
624 }
625
626 #[doc = "This bit-field determines the Pre-Charge current, in mA, ranging from 0.5 to 56mA, according to the following encoding:\n0 : 0.5 mA\n1 : 1 mA\n2 : 1.5mA\n3 : 2 mA\n4 : 2.5mA\n5 : 3 mA\n6 : 3.5mA\n7 : 4 mA\n8 : 4.5mA\n9 : 5 mA\n10 : 5.5mA\n11 : 6 mA\n12 : 6.5mA\n13 : 7 mA\n14 : 7.5mA\n15 : 8 mA\n16 : 9 mA\n17 : 10 mA\n18 : 11 mA\n19 : 12 mA\n20 : 13 mA\n21 : 14 mA\n22 : 15 mA\n23 : 16 mA\n24 : 17 mA\n25 : 18 mA\n26 : 19 mA\n27 : 20 mA\n28 : 21 mA\n29 : 22 mA\n30 : 23 mA\n31 : 24 mA\n32 : 26 mA\n33 : 28 mA\n34 : 30 mA\n35 : 32 mA\n36 : 34 mA\n37 : 36 mA\n38 : 38 mA\n39 : 40 mA\n40 : 42 mA\n41 : 44 mA\n42 : 46 mA\n43 : 48 mA\n44 : 50 mA\n45 : 52 mA\n46 : 54 mA\n47 : 56 mA\n48 : 56 mA\n49 : 56 mA\n50 : 56 mA\n51 : 56 mA\n52 : 56 mA\n53 : 56 mA\n54 : 56 mA\n55 : 56 mA\n56 : 56 mA\n57 : 56 mA\n58 : 56 mA\n59 : 56 mA\n60 : 56 mA\n61 : 56 mA\n62 : 56 mA\n63 : 56 mA"]
627 #[inline(always)]
628 pub fn i_precharge(
629 self,
630 ) -> crate::common::RegisterField<
631 6,
632 0x3f,
633 1,
634 0,
635 u8,
636 u8,
637 ChargerCurrentParamReg_SPEC,
638 crate::common::RW,
639 > {
640 crate::common::RegisterField::<
641 6,
642 0x3f,
643 1,
644 0,
645 u8,
646 u8,
647 ChargerCurrentParamReg_SPEC,
648 crate::common::RW,
649 >::from_register(self, 0)
650 }
651
652 #[doc = "This bit-field determines the charge current range, in mA. The range is from 5mA to 560mA, according to the following encoding:\n0 : 5 mA\n1 : 10 mA\n2 : 15 mA\n3 : 20 mA\n4 : 25 mA\n5 : 30 mA\n6 : 35 mA\n7 : 40 mA\n8 : 45 mA\n9 : 50 mA\n10 : 55 mA\n11 : 60 mA\n12 : 65 mA\n13 : 70 mA\n14 : 75 mA\n15 : 80 mA\n16 : 90 mA\n17 : 100 mA\n18 : 110 mA\n19 : 120 mA\n20 : 130 mA\n21 : 140 mA\n22 : 150 mA\n23 : 160 mA\n24 : 170 mA\n25 : 180 mA\n26 : 190 mA\n27 : 200 mA\n28 : 210 mA\n29 : 220 mA\n30 : 230 mA\n31 : 240 mA\n32 : 260 mA\n33 : 280 mA\n34 : 300 mA\n35 : 320 mA\n36 : 340 mA\n37 : 360 mA\n38 : 380 mA\n39 : 400 mA\n40 : 420 mA\n41 : 440 mA\n42 : 460 mA\n43 : 480 mA\n44 : 500 mA\n45 : 520 mA\n46 : 540 mA\n47 : 560 mA\n48 : 560 mA\n49 : 560 mA\n50 : 560 mA\n51 : 560 mA\n52 : 560 mA\n53 : 560 mA\n54 : 560 mA\n55 : 560 mA\n56 : 560 mA\n57 : 560 mA\n58 : 560 mA\n59 : 560 mA\n60 : 560 mA\n61 : 560 mA\n62 : 560 mA\n63 : 560 mA\nNote: It has to be noted that the specific values correspond to the normal battery temperature zone. However, the specific register field may be updated by the JEITA FSM (which checks the battery temperature either once or periodically), in order to adapt the Charge current to the new battery temperature zone (see also CHARGER_CTRL_REG.TBAT_MONITOR_MODE field as well). This is valid also for the Pre-Charge current field of this register and provided that JEITA support is enabled in CHARGER_CTRL_REG.\nConsequently, in that case the register return the Charge current settings that abide to the JEITA requirements for the battery (either COOL, WARM or NORMAL)."]
653 #[inline(always)]
654 pub fn i_charge(
655 self,
656 ) -> crate::common::RegisterField<
657 0,
658 0x3f,
659 1,
660 0,
661 u8,
662 u8,
663 ChargerCurrentParamReg_SPEC,
664 crate::common::RW,
665 > {
666 crate::common::RegisterField::<
667 0,
668 0x3f,
669 1,
670 0,
671 u8,
672 u8,
673 ChargerCurrentParamReg_SPEC,
674 crate::common::RW,
675 >::from_register(self, 0)
676 }
677}
678impl ::core::default::Default for ChargerCurrentParamReg {
679 #[inline(always)]
680 fn default() -> ChargerCurrentParamReg {
681 <crate::RegValueT<ChargerCurrentParamReg_SPEC> as RegisterValue<_>>::new(8390)
682 }
683}
684
685#[doc(hidden)]
686#[derive(Copy, Clone, Eq, PartialEq)]
687pub struct ChargerCvChargeTimerReg_SPEC;
688impl crate::sealed::RegSpec for ChargerCvChargeTimerReg_SPEC {
689 type DataType = u32;
690}
691
692#[doc = "Maximum CV-charge time limit register"]
693pub type ChargerCvChargeTimerReg = crate::RegValueT<ChargerCvChargeTimerReg_SPEC>;
694
695impl ChargerCvChargeTimerReg {
696 #[doc = "Returns the current value of the CV-Charge timeout counter, running at a 1Hz clock. The range of the specific timer is identical to the one of the Pre-Charge and the CC-Charge timers, so it may count up to 6 hours, ranging from 0 to MAX_CV_CHARGE_TIME. It is reset to 0 when the Charger\'s FSM is either in DISABLED or in END_OF_CHARGE state."]
697 #[inline(always)]
698 pub fn cv_charge_timer(
699 self,
700 ) -> crate::common::RegisterField<
701 16,
702 0x7fff,
703 1,
704 0,
705 u16,
706 u16,
707 ChargerCvChargeTimerReg_SPEC,
708 crate::common::R,
709 > {
710 crate::common::RegisterField::<
711 16,
712 0x7fff,
713 1,
714 0,
715 u16,
716 u16,
717 ChargerCvChargeTimerReg_SPEC,
718 crate::common::R,
719 >::from_register(self, 0)
720 }
721
722 #[doc = "This bit-field determines the maximum time (measured in ticks of the Charger\'s 1Hz clock) allowed for the CV (Constant Voltage) charging stage. If this is exceeded, a CV charge time-out error will be captured by the Charger\'s control unit and its FSM will move to the ERROR state. In order to exit this state and re-start charging, the CHARGER_RESUME bit-field of CHARGER_CTRL_REG must be set.\nNote: The specific bit-field should be always set to a non-zero value."]
723 #[inline(always)]
724 pub fn max_cv_charge_time(
725 self,
726 ) -> crate::common::RegisterField<
727 0,
728 0x7fff,
729 1,
730 0,
731 u16,
732 u16,
733 ChargerCvChargeTimerReg_SPEC,
734 crate::common::RW,
735 > {
736 crate::common::RegisterField::<
737 0,
738 0x7fff,
739 1,
740 0,
741 u16,
742 u16,
743 ChargerCvChargeTimerReg_SPEC,
744 crate::common::RW,
745 >::from_register(self, 0)
746 }
747}
748impl ::core::default::Default for ChargerCvChargeTimerReg {
749 #[inline(always)]
750 fn default() -> ChargerCvChargeTimerReg {
751 <crate::RegValueT<ChargerCvChargeTimerReg_SPEC> as RegisterValue<_>>::new(7200)
752 }
753}
754
755#[doc(hidden)]
756#[derive(Copy, Clone, Eq, PartialEq)]
757pub struct ChargerErrorIrqClrReg_SPEC;
758impl crate::sealed::RegSpec for ChargerErrorIrqClrReg_SPEC {
759 type DataType = u32;
760}
761
762#[doc = "Interrupt clear register of Charger Error IRQs"]
763pub type ChargerErrorIrqClrReg = crate::RegValueT<ChargerErrorIrqClrReg_SPEC>;
764
765impl ChargerErrorIrqClrReg {
766 #[doc = "Writing a 1 will reset the respective Charger\'s Error IRQ status bit ; writing a 0 will have no effect"]
767 #[inline(always)]
768 pub fn tbat_error_irq_clr(
769 self,
770 ) -> crate::common::RegisterFieldBool<6, 1, 0, ChargerErrorIrqClrReg_SPEC, crate::common::W>
771 {
772 crate::common::RegisterFieldBool::<6,1,0,ChargerErrorIrqClrReg_SPEC,crate::common::W>::from_register(self,0)
773 }
774
775 #[doc = "Writing a 1 will reset the respective Charger\'s Error IRQ status bit ; writing a 0 will have no effect"]
776 #[inline(always)]
777 pub fn tdie_error_irq_clr(
778 self,
779 ) -> crate::common::RegisterFieldBool<5, 1, 0, ChargerErrorIrqClrReg_SPEC, crate::common::W>
780 {
781 crate::common::RegisterFieldBool::<5,1,0,ChargerErrorIrqClrReg_SPEC,crate::common::W>::from_register(self,0)
782 }
783
784 #[doc = "Writing a 1 will reset the respective Charger\'s Error IRQ status bit ; writing a 0 will have no effect"]
785 #[inline(always)]
786 pub fn vbat_ovp_error_irq_clr(
787 self,
788 ) -> crate::common::RegisterFieldBool<4, 1, 0, ChargerErrorIrqClrReg_SPEC, crate::common::W>
789 {
790 crate::common::RegisterFieldBool::<4,1,0,ChargerErrorIrqClrReg_SPEC,crate::common::W>::from_register(self,0)
791 }
792
793 #[doc = "Writing a 1 will reset the respective Charger\'s Error IRQ status bit ; writing a 0 will have no effect"]
794 #[inline(always)]
795 pub fn total_charge_timeout_irq_clr(
796 self,
797 ) -> crate::common::RegisterFieldBool<3, 1, 0, ChargerErrorIrqClrReg_SPEC, crate::common::W>
798 {
799 crate::common::RegisterFieldBool::<3,1,0,ChargerErrorIrqClrReg_SPEC,crate::common::W>::from_register(self,0)
800 }
801
802 #[doc = "Writing a 1 will reset the respective Charger\'s Error IRQ status bit ; writing a 0 will have no effect"]
803 #[inline(always)]
804 pub fn cv_charge_timeout_irq_clr(
805 self,
806 ) -> crate::common::RegisterFieldBool<2, 1, 0, ChargerErrorIrqClrReg_SPEC, crate::common::W>
807 {
808 crate::common::RegisterFieldBool::<2,1,0,ChargerErrorIrqClrReg_SPEC,crate::common::W>::from_register(self,0)
809 }
810
811 #[doc = "Writing a 1 will reset the respective Charger\'s Error IRQ status bit ; writing a 0 will have no effect"]
812 #[inline(always)]
813 pub fn cc_charge_timeout_irq_clr(
814 self,
815 ) -> crate::common::RegisterFieldBool<1, 1, 0, ChargerErrorIrqClrReg_SPEC, crate::common::W>
816 {
817 crate::common::RegisterFieldBool::<1,1,0,ChargerErrorIrqClrReg_SPEC,crate::common::W>::from_register(self,0)
818 }
819
820 #[doc = "Writing a 1 will reset the respective Charger\'s Error IRQ status bit ; writing a 0 will have no effect"]
821 #[inline(always)]
822 pub fn precharge_timeout_irq_clr(
823 self,
824 ) -> crate::common::RegisterFieldBool<0, 1, 0, ChargerErrorIrqClrReg_SPEC, crate::common::W>
825 {
826 crate::common::RegisterFieldBool::<0,1,0,ChargerErrorIrqClrReg_SPEC,crate::common::W>::from_register(self,0)
827 }
828}
829impl ::core::default::Default for ChargerErrorIrqClrReg {
830 #[inline(always)]
831 fn default() -> ChargerErrorIrqClrReg {
832 <crate::RegValueT<ChargerErrorIrqClrReg_SPEC> as RegisterValue<_>>::new(0)
833 }
834}
835
836#[doc(hidden)]
837#[derive(Copy, Clone, Eq, PartialEq)]
838pub struct ChargerErrorIrqMaskReg_SPEC;
839impl crate::sealed::RegSpec for ChargerErrorIrqMaskReg_SPEC {
840 type DataType = u32;
841}
842
843#[doc = "Mask register of Charger Error IRQs"]
844pub type ChargerErrorIrqMaskReg = crate::RegValueT<ChargerErrorIrqMaskReg_SPEC>;
845
846impl ChargerErrorIrqMaskReg {
847 #[doc = "When set, it enables the generation of Battery temperature IRQs.The IRQ is generated as soon as the JEITA FSM detects that the battery temperature is either in the \"Hot\" or in the \"Cold\" temperature region, by sampling the respective comparators\' output."]
848 #[inline(always)]
849 pub fn tbat_error_irq_en(
850 self,
851 ) -> crate::common::RegisterFieldBool<6, 1, 0, ChargerErrorIrqMaskReg_SPEC, crate::common::RW>
852 {
853 crate::common::RegisterFieldBool::<6,1,0,ChargerErrorIrqMaskReg_SPEC,crate::common::RW>::from_register(self,0)
854 }
855
856 #[doc = "When set, it enables the generation of Die temperature error IRQs. The IRQ is generated as soon as a Die temperature error is captured, so as soon as the Charger\'s FSM moves to the TDIE_PROT state. For this to happen, the Die temperature comparator should indicate that Die temperature has exceeded the limit defined in CHARGER_TEMPSET_PARAM_REG.TDIE_MAX."]
857 #[inline(always)]
858 pub fn tdie_error_irq_en(
859 self,
860 ) -> crate::common::RegisterFieldBool<5, 1, 0, ChargerErrorIrqMaskReg_SPEC, crate::common::RW>
861 {
862 crate::common::RegisterFieldBool::<5,1,0,ChargerErrorIrqMaskReg_SPEC,crate::common::RW>::from_register(self,0)
863 }
864
865 #[doc = "When set, it enables the generation of VBAT_OVP IRQs. The IRQ is generated as soon as the dedicated Vbat comparator shows that Vbat has exceeded the OVP level and the Charger\'s FSM has switched to the respective error state (\"ERROR\")."]
866 #[inline(always)]
867 pub fn vbat_ovp_error_irq_en(
868 self,
869 ) -> crate::common::RegisterFieldBool<4, 1, 0, ChargerErrorIrqMaskReg_SPEC, crate::common::RW>
870 {
871 crate::common::RegisterFieldBool::<4,1,0,ChargerErrorIrqMaskReg_SPEC,crate::common::RW>::from_register(self,0)
872 }
873
874 #[doc = "When set, it enables the total charge timeout IRQs. The IRQ is generated as soon as the Charger\'s global charge timer expires, reaching 0."]
875 #[inline(always)]
876 pub fn total_charge_timeout_irq_en(
877 self,
878 ) -> crate::common::RegisterFieldBool<3, 1, 0, ChargerErrorIrqMaskReg_SPEC, crate::common::RW>
879 {
880 crate::common::RegisterFieldBool::<3,1,0,ChargerErrorIrqMaskReg_SPEC,crate::common::RW>::from_register(self,0)
881 }
882
883 #[doc = "When set, it enables the CV charge timeout IRQs. The IRQ is generated as soon as the Charger\'s state timer expires, reaching 0 when the FSM is in the CV_CHARGE state."]
884 #[inline(always)]
885 pub fn cv_charge_timeout_irq_en(
886 self,
887 ) -> crate::common::RegisterFieldBool<2, 1, 0, ChargerErrorIrqMaskReg_SPEC, crate::common::RW>
888 {
889 crate::common::RegisterFieldBool::<2,1,0,ChargerErrorIrqMaskReg_SPEC,crate::common::RW>::from_register(self,0)
890 }
891
892 #[doc = "When set, it enables the CC charge timeout IRQs. The IRQ is generated as soon as the Charger\'s state timer, expires, reaching 0."]
893 #[inline(always)]
894 pub fn cc_charge_timeout_irq_en(
895 self,
896 ) -> crate::common::RegisterFieldBool<1, 1, 0, ChargerErrorIrqMaskReg_SPEC, crate::common::RW>
897 {
898 crate::common::RegisterFieldBool::<1,1,0,ChargerErrorIrqMaskReg_SPEC,crate::common::RW>::from_register(self,0)
899 }
900
901 #[doc = "When set, it enables the Pre-Charge timeout IRQs. The IRQ is generated as soon as the Charger\'s state timer expires, reaching 0."]
902 #[inline(always)]
903 pub fn precharge_timeout_irq_en(
904 self,
905 ) -> crate::common::RegisterFieldBool<0, 1, 0, ChargerErrorIrqMaskReg_SPEC, crate::common::RW>
906 {
907 crate::common::RegisterFieldBool::<0,1,0,ChargerErrorIrqMaskReg_SPEC,crate::common::RW>::from_register(self,0)
908 }
909}
910impl ::core::default::Default for ChargerErrorIrqMaskReg {
911 #[inline(always)]
912 fn default() -> ChargerErrorIrqMaskReg {
913 <crate::RegValueT<ChargerErrorIrqMaskReg_SPEC> as RegisterValue<_>>::new(0)
914 }
915}
916
917#[doc(hidden)]
918#[derive(Copy, Clone, Eq, PartialEq)]
919pub struct ChargerErrorIrqStatusReg_SPEC;
920impl crate::sealed::RegSpec for ChargerErrorIrqStatusReg_SPEC {
921 type DataType = u32;
922}
923
924#[doc = "Status register of Charger Error IRQs"]
925pub type ChargerErrorIrqStatusReg = crate::RegValueT<ChargerErrorIrqStatusReg_SPEC>;
926
927impl ChargerErrorIrqStatusReg {
928 #[doc = "0 = No Battery temperature error IRQ event is captured, so charging may continue\n1 = A Battery temperature error IRQ event has been captured, declaring that the Charger\'s FSM has moved to the respective error state (TBAT_PROT).\nNote : The status bit is updated automatically when the Battery temperature is detected to be either in the HOT or in the COLD zone, regardless of the state of the respective IRQ mask bit."]
929 #[inline(always)]
930 pub fn tbat_error_irq(
931 self,
932 ) -> crate::common::RegisterFieldBool<6, 1, 0, ChargerErrorIrqStatusReg_SPEC, crate::common::R>
933 {
934 crate::common::RegisterFieldBool::<6,1,0,ChargerErrorIrqStatusReg_SPEC,crate::common::R>::from_register(self,0)
935 }
936
937 #[doc = "0 = No Die temperature error IRQ events have been captured, so charging may continue\n1 = A Die temperature error IRQ event is captured, declaring that the Charger\'s FSM has switched to the respective error state (TDIE_PROT) and charging will be automatically stopped.\nNote : The status bit is updated automatically when a Die temperature error is detected, thus when the die temperature is found to have exceeded the programmed level, regardless of the stae of the respective IRQ mask bit."]
938 #[inline(always)]
939 pub fn tdie_error_irq(
940 self,
941 ) -> crate::common::RegisterFieldBool<5, 1, 0, ChargerErrorIrqStatusReg_SPEC, crate::common::R>
942 {
943 crate::common::RegisterFieldBool::<5,1,0,ChargerErrorIrqStatusReg_SPEC,crate::common::R>::from_register(self,0)
944 }
945
946 #[doc = "0 = Vbat has not exceeded the Over-Voltage Protection (OVP) level, so charging may continue\n1 = Vbat has exceeded the Over-Voltage level, thus an OVP error event has been captured. The Charger\'s FSM switches to the respective error state (ERROR) as soon as the OVP event is captured by the digital part of the Charger and charging will be automatically stopped."]
947 #[inline(always)]
948 pub fn vbat_ovp_error_irq(
949 self,
950 ) -> crate::common::RegisterFieldBool<4, 1, 0, ChargerErrorIrqStatusReg_SPEC, crate::common::R>
951 {
952 crate::common::RegisterFieldBool::<4,1,0,ChargerErrorIrqStatusReg_SPEC,crate::common::R>::from_register(self,0)
953 }
954
955 #[doc = "0 = Total charge time counter has not yet reached the maximum charge time (set in CHARGER_TOTAL_CHARGE_TIME_REG)\n1 = Total charge time counter has reached the maximum charge time programmed. The Charger\'s FSM will move to the respective error state (ERROR) and charging will be automatically stopped, as soon as the specific event is captured."]
956 #[inline(always)]
957 pub fn total_charge_timeout_irq(
958 self,
959 ) -> crate::common::RegisterFieldBool<3, 1, 0, ChargerErrorIrqStatusReg_SPEC, crate::common::R>
960 {
961 crate::common::RegisterFieldBool::<3,1,0,ChargerErrorIrqStatusReg_SPEC,crate::common::R>::from_register(self,0)
962 }
963
964 #[doc = "0 = State charge time counter has not yet reached the maximum CV charge time (set in CHARGER_CV_CHARGE_TIME_REG)\n1 = Total charge time counter has reached the maximum CV charge time programmed. The Charger\'s FSM will move to the respective error state (ERROR) and charging will be automatically stopped, as soon as the specific event is captured."]
965 #[inline(always)]
966 pub fn cv_charge_timeout_irq(
967 self,
968 ) -> crate::common::RegisterFieldBool<2, 1, 0, ChargerErrorIrqStatusReg_SPEC, crate::common::R>
969 {
970 crate::common::RegisterFieldBool::<2,1,0,ChargerErrorIrqStatusReg_SPEC,crate::common::R>::from_register(self,0)
971 }
972
973 #[doc = "0 = State charge time counter has not yet reached the maximum CC charge time (set in CHARGER_CC_CHARGE_TIME_REG)\n1 = Total charge time counter has reached the maximum CC charge time programmed. The Charger\'s FSM will move to the respective error state (ERROR) and charging will be automatically stopped, as soon as the specific event is captured."]
974 #[inline(always)]
975 pub fn cc_charge_timeout_irq(
976 self,
977 ) -> crate::common::RegisterFieldBool<1, 1, 0, ChargerErrorIrqStatusReg_SPEC, crate::common::R>
978 {
979 crate::common::RegisterFieldBool::<1,1,0,ChargerErrorIrqStatusReg_SPEC,crate::common::R>::from_register(self,0)
980 }
981
982 #[doc = "0 = State charge time counter has not yet reached the maximum Pre-charge time (set in CHARGER_PRECHARGE_TIME_REG)\n1 = Total charge time counter has reached the maximum Pre-charge time programmed. The Charger\'s FSM will move to the respective error state (ERROR) and charging will be automatically stopped, as soon as the specific event is captured."]
983 #[inline(always)]
984 pub fn precharge_timeout_irq(
985 self,
986 ) -> crate::common::RegisterFieldBool<0, 1, 0, ChargerErrorIrqStatusReg_SPEC, crate::common::R>
987 {
988 crate::common::RegisterFieldBool::<0,1,0,ChargerErrorIrqStatusReg_SPEC,crate::common::R>::from_register(self,0)
989 }
990}
991impl ::core::default::Default for ChargerErrorIrqStatusReg {
992 #[inline(always)]
993 fn default() -> ChargerErrorIrqStatusReg {
994 <crate::RegValueT<ChargerErrorIrqStatusReg_SPEC> as RegisterValue<_>>::new(0)
995 }
996}
997
998#[doc(hidden)]
999#[derive(Copy, Clone, Eq, PartialEq)]
1000pub struct ChargerJeitaCurrentReg_SPEC;
1001impl crate::sealed::RegSpec for ChargerJeitaCurrentReg_SPEC {
1002 type DataType = u32;
1003}
1004
1005#[doc = "JEITA-compliant current settings register"]
1006pub type ChargerJeitaCurrentReg = crate::RegValueT<ChargerJeitaCurrentReg_SPEC>;
1007
1008impl ChargerJeitaCurrentReg {
1009 #[doc = "Pre-Charge current setting for the Warm battery temperature zone. Regarding the range of values of this bit-field, see also the description of I_PRECHARGE field of CHARGER_CURRENT_PARAM_REG register."]
1010 #[inline(always)]
1011 pub fn i_precharge_twarm(
1012 self,
1013 ) -> crate::common::RegisterField<
1014 18,
1015 0x3f,
1016 1,
1017 0,
1018 u8,
1019 u8,
1020 ChargerJeitaCurrentReg_SPEC,
1021 crate::common::RW,
1022 > {
1023 crate::common::RegisterField::<
1024 18,
1025 0x3f,
1026 1,
1027 0,
1028 u8,
1029 u8,
1030 ChargerJeitaCurrentReg_SPEC,
1031 crate::common::RW,
1032 >::from_register(self, 0)
1033 }
1034
1035 #[doc = "Pre-Charge current setting for the Cool battery temperature zone. Regarding the range of values of this bit-field, see also the description of I_PRECHARGE field of CHARGER_CURRENT_PARAM_REG register."]
1036 #[inline(always)]
1037 pub fn i_precharge_tcool(
1038 self,
1039 ) -> crate::common::RegisterField<
1040 12,
1041 0x3f,
1042 1,
1043 0,
1044 u8,
1045 u8,
1046 ChargerJeitaCurrentReg_SPEC,
1047 crate::common::RW,
1048 > {
1049 crate::common::RegisterField::<
1050 12,
1051 0x3f,
1052 1,
1053 0,
1054 u8,
1055 u8,
1056 ChargerJeitaCurrentReg_SPEC,
1057 crate::common::RW,
1058 >::from_register(self, 0)
1059 }
1060
1061 #[doc = "Charge current setting for the Warm battery temperature pack zone. Regarding the range of values of this bit-field, see also the description of I_CHARGE field of CHARGER_CURRENT_PARAM_REG register."]
1062 #[inline(always)]
1063 pub fn i_charge_twarm(
1064 self,
1065 ) -> crate::common::RegisterField<
1066 6,
1067 0x3f,
1068 1,
1069 0,
1070 u8,
1071 u8,
1072 ChargerJeitaCurrentReg_SPEC,
1073 crate::common::RW,
1074 > {
1075 crate::common::RegisterField::<
1076 6,
1077 0x3f,
1078 1,
1079 0,
1080 u8,
1081 u8,
1082 ChargerJeitaCurrentReg_SPEC,
1083 crate::common::RW,
1084 >::from_register(self, 0)
1085 }
1086
1087 #[doc = "Charge current setting for the \"COOL\" battery temperature level. Regarding the range of values of this bit-field, see also the description of I_CHARGE field of CHARGER_CURRENT_PARAM_REG register."]
1088 #[inline(always)]
1089 pub fn i_charge_tcool(
1090 self,
1091 ) -> crate::common::RegisterField<
1092 0,
1093 0x3f,
1094 1,
1095 0,
1096 u8,
1097 u8,
1098 ChargerJeitaCurrentReg_SPEC,
1099 crate::common::RW,
1100 > {
1101 crate::common::RegisterField::<
1102 0,
1103 0x3f,
1104 1,
1105 0,
1106 u8,
1107 u8,
1108 ChargerJeitaCurrentReg_SPEC,
1109 crate::common::RW,
1110 >::from_register(self, 0)
1111 }
1112}
1113impl ::core::default::Default for ChargerJeitaCurrentReg {
1114 #[inline(always)]
1115 fn default() -> ChargerJeitaCurrentReg {
1116 <crate::RegValueT<ChargerJeitaCurrentReg_SPEC> as RegisterValue<_>>::new(270597)
1117 }
1118}
1119
1120#[doc(hidden)]
1121#[derive(Copy, Clone, Eq, PartialEq)]
1122pub struct ChargerJeitaVChargeReg_SPEC;
1123impl crate::sealed::RegSpec for ChargerJeitaVChargeReg_SPEC {
1124 type DataType = u32;
1125}
1126
1127#[doc = "JEITA-compliant Charge voltage settings register"]
1128pub type ChargerJeitaVChargeReg = crate::RegValueT<ChargerJeitaVChargeReg_SPEC>;
1129
1130impl ChargerJeitaVChargeReg {
1131 #[doc = "Charge voltage setting for the Warm battery temperature zone. Regarding the range of values of this bit-field, see also the description of V_CHARGE field of CHARGER_VOLTAGE_PARAM_REG register."]
1132 #[inline(always)]
1133 pub fn v_charge_twarm(
1134 self,
1135 ) -> crate::common::RegisterField<
1136 6,
1137 0x3f,
1138 1,
1139 0,
1140 u8,
1141 u8,
1142 ChargerJeitaVChargeReg_SPEC,
1143 crate::common::RW,
1144 > {
1145 crate::common::RegisterField::<
1146 6,
1147 0x3f,
1148 1,
1149 0,
1150 u8,
1151 u8,
1152 ChargerJeitaVChargeReg_SPEC,
1153 crate::common::RW,
1154 >::from_register(self, 0)
1155 }
1156
1157 #[doc = "Charge voltage setting for the Cool battery temperature zone. Regarding the range of values of this bit-field, see also the description of V_CHARGE field of CHARGER_VOLTAGE_PARAM_REG register."]
1158 #[inline(always)]
1159 pub fn v_charge_tcool(
1160 self,
1161 ) -> crate::common::RegisterField<
1162 0,
1163 0x3f,
1164 1,
1165 0,
1166 u8,
1167 u8,
1168 ChargerJeitaVChargeReg_SPEC,
1169 crate::common::RW,
1170 > {
1171 crate::common::RegisterField::<
1172 0,
1173 0x3f,
1174 1,
1175 0,
1176 u8,
1177 u8,
1178 ChargerJeitaVChargeReg_SPEC,
1179 crate::common::RW,
1180 >::from_register(self, 0)
1181 }
1182}
1183impl ::core::default::Default for ChargerJeitaVChargeReg {
1184 #[inline(always)]
1185 fn default() -> ChargerJeitaVChargeReg {
1186 <crate::RegValueT<ChargerJeitaVChargeReg_SPEC> as RegisterValue<_>>::new(2664)
1187 }
1188}
1189
1190#[doc(hidden)]
1191#[derive(Copy, Clone, Eq, PartialEq)]
1192pub struct ChargerJeitaVOvpReg_SPEC;
1193impl crate::sealed::RegSpec for ChargerJeitaVOvpReg_SPEC {
1194 type DataType = u32;
1195}
1196
1197#[doc = "JEITA-compliant OVP settings register"]
1198pub type ChargerJeitaVOvpReg = crate::RegValueT<ChargerJeitaVOvpReg_SPEC>;
1199
1200impl ChargerJeitaVOvpReg {
1201 #[doc = "VBAT Over-voltage Protection (OVP) setting for the Warm battery temperature zone.Regarding the range of values of this bit-field, see also the description of V_CHARGE field of CHARGER_VOLTAGE_PARAM_REG."]
1202 #[inline(always)]
1203 pub fn v_ovp_twarm(
1204 self,
1205 ) -> crate::common::RegisterField<
1206 6,
1207 0x3f,
1208 1,
1209 0,
1210 u8,
1211 u8,
1212 ChargerJeitaVOvpReg_SPEC,
1213 crate::common::RW,
1214 > {
1215 crate::common::RegisterField::<
1216 6,
1217 0x3f,
1218 1,
1219 0,
1220 u8,
1221 u8,
1222 ChargerJeitaVOvpReg_SPEC,
1223 crate::common::RW,
1224 >::from_register(self, 0)
1225 }
1226
1227 #[doc = "VBAT Over-voltage Protection (OVP) setting for the Cool battery temperature zone.Regarding the range of values of this bit-field, see also the description of V_CHARGE field of CHARGER_VOLTAGE_PARAM_REG."]
1228 #[inline(always)]
1229 pub fn v_ovp_tcool(
1230 self,
1231 ) -> crate::common::RegisterField<
1232 0,
1233 0x3f,
1234 1,
1235 0,
1236 u8,
1237 u8,
1238 ChargerJeitaVOvpReg_SPEC,
1239 crate::common::RW,
1240 > {
1241 crate::common::RegisterField::<
1242 0,
1243 0x3f,
1244 1,
1245 0,
1246 u8,
1247 u8,
1248 ChargerJeitaVOvpReg_SPEC,
1249 crate::common::RW,
1250 >::from_register(self, 0)
1251 }
1252}
1253impl ::core::default::Default for ChargerJeitaVOvpReg {
1254 #[inline(always)]
1255 fn default() -> ChargerJeitaVOvpReg {
1256 <crate::RegValueT<ChargerJeitaVOvpReg_SPEC> as RegisterValue<_>>::new(3446)
1257 }
1258}
1259
1260#[doc(hidden)]
1261#[derive(Copy, Clone, Eq, PartialEq)]
1262pub struct ChargerJeitaVPrechargeReg_SPEC;
1263impl crate::sealed::RegSpec for ChargerJeitaVPrechargeReg_SPEC {
1264 type DataType = u32;
1265}
1266
1267#[doc = "JEITA-compliant Pre-Charge voltage settings register"]
1268pub type ChargerJeitaVPrechargeReg = crate::RegValueT<ChargerJeitaVPrechargeReg_SPEC>;
1269
1270impl ChargerJeitaVPrechargeReg {
1271 #[doc = "Pre-Charge voltage setting for the Warm battery temperature zone. Regarding the range of values of this bit-field, see also the description of V_CHARGE field of CHARGER_VOLTAGE_PARAM_REG register."]
1272 #[inline(always)]
1273 pub fn v_precharge_twarm(
1274 self,
1275 ) -> crate::common::RegisterField<
1276 6,
1277 0x3f,
1278 1,
1279 0,
1280 u8,
1281 u8,
1282 ChargerJeitaVPrechargeReg_SPEC,
1283 crate::common::RW,
1284 > {
1285 crate::common::RegisterField::<
1286 6,
1287 0x3f,
1288 1,
1289 0,
1290 u8,
1291 u8,
1292 ChargerJeitaVPrechargeReg_SPEC,
1293 crate::common::RW,
1294 >::from_register(self, 0)
1295 }
1296
1297 #[doc = "Pre-Charge current setting for the Cool battery temperature zone. Regarding the range of values of this bit-field, see also the description of V_CHARGE field of CHARGER_VOLTAGE_PARAM_REG register."]
1298 #[inline(always)]
1299 pub fn v_precharge_tcool(
1300 self,
1301 ) -> crate::common::RegisterField<
1302 0,
1303 0x3f,
1304 1,
1305 0,
1306 u8,
1307 u8,
1308 ChargerJeitaVPrechargeReg_SPEC,
1309 crate::common::RW,
1310 > {
1311 crate::common::RegisterField::<
1312 0,
1313 0x3f,
1314 1,
1315 0,
1316 u8,
1317 u8,
1318 ChargerJeitaVPrechargeReg_SPEC,
1319 crate::common::RW,
1320 >::from_register(self, 0)
1321 }
1322}
1323impl ::core::default::Default for ChargerJeitaVPrechargeReg {
1324 #[inline(always)]
1325 fn default() -> ChargerJeitaVPrechargeReg {
1326 <crate::RegValueT<ChargerJeitaVPrechargeReg_SPEC> as RegisterValue<_>>::new(391)
1327 }
1328}
1329
1330#[doc(hidden)]
1331#[derive(Copy, Clone, Eq, PartialEq)]
1332pub struct ChargerJeitaVReplenishReg_SPEC;
1333impl crate::sealed::RegSpec for ChargerJeitaVReplenishReg_SPEC {
1334 type DataType = u32;
1335}
1336
1337#[doc = "JEITA-compliant Replenish settings register"]
1338pub type ChargerJeitaVReplenishReg = crate::RegValueT<ChargerJeitaVReplenishReg_SPEC>;
1339
1340impl ChargerJeitaVReplenishReg {
1341 #[doc = "Replenish voltage setting for the Warm battery temperature zone. Regarding the range of values of this bit-field, see also the description of V_CHARGE field of CHARGER_VOLTAGE_PARAM_REG."]
1342 #[inline(always)]
1343 pub fn v_replenish_twarm(
1344 self,
1345 ) -> crate::common::RegisterField<
1346 6,
1347 0x3f,
1348 1,
1349 0,
1350 u8,
1351 u8,
1352 ChargerJeitaVReplenishReg_SPEC,
1353 crate::common::RW,
1354 > {
1355 crate::common::RegisterField::<
1356 6,
1357 0x3f,
1358 1,
1359 0,
1360 u8,
1361 u8,
1362 ChargerJeitaVReplenishReg_SPEC,
1363 crate::common::RW,
1364 >::from_register(self, 0)
1365 }
1366
1367 #[doc = "Replenish voltage setting for the Cool battery temperature zone. Regarding the range of values of this bit-field, see also the description of V_CHARGE field of CHARGER_VOLTAGE_PARAM_REG."]
1368 #[inline(always)]
1369 pub fn v_replenish_tcool(
1370 self,
1371 ) -> crate::common::RegisterField<
1372 0,
1373 0x3f,
1374 1,
1375 0,
1376 u8,
1377 u8,
1378 ChargerJeitaVReplenishReg_SPEC,
1379 crate::common::RW,
1380 > {
1381 crate::common::RegisterField::<
1382 0,
1383 0x3f,
1384 1,
1385 0,
1386 u8,
1387 u8,
1388 ChargerJeitaVReplenishReg_SPEC,
1389 crate::common::RW,
1390 >::from_register(self, 0)
1391 }
1392}
1393impl ::core::default::Default for ChargerJeitaVReplenishReg {
1394 #[inline(always)]
1395 fn default() -> ChargerJeitaVReplenishReg {
1396 <crate::RegValueT<ChargerJeitaVReplenishReg_SPEC> as RegisterValue<_>>::new(1951)
1397 }
1398}
1399
1400#[doc(hidden)]
1401#[derive(Copy, Clone, Eq, PartialEq)]
1402pub struct ChargerPreChargeTimerReg_SPEC;
1403impl crate::sealed::RegSpec for ChargerPreChargeTimerReg_SPEC {
1404 type DataType = u32;
1405}
1406
1407#[doc = "Maximum pre-charge time limit register"]
1408pub type ChargerPreChargeTimerReg = crate::RegValueT<ChargerPreChargeTimerReg_SPEC>;
1409
1410impl ChargerPreChargeTimerReg {
1411 #[doc = "Returns the current value of the Pre-Charge timeout counter, running at a 1Hz clock. The range of the specific timer is identical to the one of the CC-Charge and the CV-Charge timers, so it may count up to 6 hours, ranging from 0 to MAX_PRE_CHARGE_TIME. It is reset to 0 when the Charger\'s FSM is either in DISABLED or in END_OF_CHARGE state."]
1412 #[inline(always)]
1413 pub fn pre_charge_timer(
1414 self,
1415 ) -> crate::common::RegisterField<
1416 16,
1417 0x7fff,
1418 1,
1419 0,
1420 u16,
1421 u16,
1422 ChargerPreChargeTimerReg_SPEC,
1423 crate::common::R,
1424 > {
1425 crate::common::RegisterField::<
1426 16,
1427 0x7fff,
1428 1,
1429 0,
1430 u16,
1431 u16,
1432 ChargerPreChargeTimerReg_SPEC,
1433 crate::common::R,
1434 >::from_register(self, 0)
1435 }
1436
1437 #[doc = "This bit-field determines the maximum time (measured in ticks of the Charger\'s 1Hz clock) allowed for the Pre-Charge stage. If this is exceeded, a Pre-Charge time-out error will be captured by the Charger\'s control unit and its FSM will move to the respective state (ERROR). In order to exit this state and re-start charging, the CHARGER_RESUME bit-field of CHARGER_CTRL_REG must be set.\nNote: The specific bit-field should be always set to a non-zero value."]
1438 #[inline(always)]
1439 pub fn max_pre_charge_time(
1440 self,
1441 ) -> crate::common::RegisterField<
1442 0,
1443 0x7fff,
1444 1,
1445 0,
1446 u16,
1447 u16,
1448 ChargerPreChargeTimerReg_SPEC,
1449 crate::common::RW,
1450 > {
1451 crate::common::RegisterField::<
1452 0,
1453 0x7fff,
1454 1,
1455 0,
1456 u16,
1457 u16,
1458 ChargerPreChargeTimerReg_SPEC,
1459 crate::common::RW,
1460 >::from_register(self, 0)
1461 }
1462}
1463impl ::core::default::Default for ChargerPreChargeTimerReg {
1464 #[inline(always)]
1465 fn default() -> ChargerPreChargeTimerReg {
1466 <crate::RegValueT<ChargerPreChargeTimerReg_SPEC> as RegisterValue<_>>::new(1800)
1467 }
1468}
1469
1470#[doc(hidden)]
1471#[derive(Copy, Clone, Eq, PartialEq)]
1472pub struct ChargerPwrUpTimerReg_SPEC;
1473impl crate::sealed::RegSpec for ChargerPwrUpTimerReg_SPEC {
1474 type DataType = u32;
1475}
1476
1477#[doc = "Charger power-up (settling) timer"]
1478pub type ChargerPwrUpTimerReg = crate::RegValueT<ChargerPwrUpTimerReg_SPEC>;
1479
1480impl ChargerPwrUpTimerReg {
1481 #[doc = "Returns the current value of the charger\'s power-up timer, running with the 1Khz clock.\nNote: The specific timer is reset to the value programmed to CHARGER_PWR_UP_SETTLING bit-field, when the Charger\'s analogue circuitry has been enabled, after being disabled initially. By setting CHARGER_CTRL_REG\\[CHARGER_ENABLE\\] to \'0\', the analogue part is disabled and in order to be properly enable, SW has to wait for 1ms (one 1Khz clock period) time. The latter is is needed to ensure that the power-up timer\'s control signals in the Charger\'s digital part will be cleared when the analogue part is again enabled, so that a proper new start-up of the Charger\'s FSM is possible."]
1482 #[inline(always)]
1483 pub fn charger_pwr_up_timer(
1484 self,
1485 ) -> crate::common::RegisterField<
1486 16,
1487 0x3ff,
1488 1,
1489 0,
1490 u16,
1491 u16,
1492 ChargerPwrUpTimerReg_SPEC,
1493 crate::common::R,
1494 > {
1495 crate::common::RegisterField::<
1496 16,
1497 0x3ff,
1498 1,
1499 0,
1500 u16,
1501 u16,
1502 ChargerPwrUpTimerReg_SPEC,
1503 crate::common::R,
1504 >::from_register(self, 0)
1505 }
1506
1507 #[doc = "This bit-field determines the charger\'s power-up (settling) time, required for the analogue circuitry of the charger. As soon as the charger is powered-on by setting the CHARGER_ENABLE bit-field of CHARGER_CTRL_REG, the charger\'s FSM loads a dedicated timer with this value and waits for this timer to expire, before proceeding to the next states.\nNote: The specific bit-field should be always set to a non-zero value."]
1508 #[inline(always)]
1509 pub fn charger_pwr_up_settling(
1510 self,
1511 ) -> crate::common::RegisterField<
1512 0,
1513 0x3ff,
1514 1,
1515 0,
1516 u16,
1517 u16,
1518 ChargerPwrUpTimerReg_SPEC,
1519 crate::common::RW,
1520 > {
1521 crate::common::RegisterField::<
1522 0,
1523 0x3ff,
1524 1,
1525 0,
1526 u16,
1527 u16,
1528 ChargerPwrUpTimerReg_SPEC,
1529 crate::common::RW,
1530 >::from_register(self, 0)
1531 }
1532}
1533impl ::core::default::Default for ChargerPwrUpTimerReg {
1534 #[inline(always)]
1535 fn default() -> ChargerPwrUpTimerReg {
1536 <crate::RegValueT<ChargerPwrUpTimerReg_SPEC> as RegisterValue<_>>::new(99)
1537 }
1538}
1539
1540#[doc(hidden)]
1541#[derive(Copy, Clone, Eq, PartialEq)]
1542pub struct ChargerStateIrqClrReg_SPEC;
1543impl crate::sealed::RegSpec for ChargerStateIrqClrReg_SPEC {
1544 type DataType = u32;
1545}
1546
1547#[doc = "Interrupt clear register of Charger FSM IRQs"]
1548pub type ChargerStateIrqClrReg = crate::RegValueT<ChargerStateIrqClrReg_SPEC>;
1549
1550impl ChargerStateIrqClrReg {
1551 #[doc = "Writing a 1 will reset the respective Charger\'s State IRQ status bit ; writing a 0 will have no effect"]
1552 #[inline(always)]
1553 pub fn cv_to_precharge_irq_clr(
1554 self,
1555 ) -> crate::common::RegisterFieldBool<11, 1, 0, ChargerStateIrqClrReg_SPEC, crate::common::W>
1556 {
1557 crate::common::RegisterFieldBool::<11,1,0,ChargerStateIrqClrReg_SPEC,crate::common::W>::from_register(self,0)
1558 }
1559
1560 #[doc = "Writing a 1 will reset the respective Charger\'s State IRQ status bit ; writing a 0 will have no effect"]
1561 #[inline(always)]
1562 pub fn cc_to_precharge_irq_clr(
1563 self,
1564 ) -> crate::common::RegisterFieldBool<10, 1, 0, ChargerStateIrqClrReg_SPEC, crate::common::W>
1565 {
1566 crate::common::RegisterFieldBool::<10,1,0,ChargerStateIrqClrReg_SPEC,crate::common::W>::from_register(self,0)
1567 }
1568
1569 #[doc = "Writing a 1 will reset the respective Charger\'s State IRQ status bit ; writing a 0 will have no effect"]
1570 #[inline(always)]
1571 pub fn cv_to_cc_irq_clr(
1572 self,
1573 ) -> crate::common::RegisterFieldBool<9, 1, 0, ChargerStateIrqClrReg_SPEC, crate::common::W>
1574 {
1575 crate::common::RegisterFieldBool::<9,1,0,ChargerStateIrqClrReg_SPEC,crate::common::W>::from_register(self,0)
1576 }
1577
1578 #[doc = "Writing a 1 will reset the Battery temperature status update IRQ status bit ; writing a 0 will have no effect"]
1579 #[inline(always)]
1580 pub fn tbat_status_update_irq_clr(
1581 self,
1582 ) -> crate::common::RegisterFieldBool<8, 1, 0, ChargerStateIrqClrReg_SPEC, crate::common::W>
1583 {
1584 crate::common::RegisterFieldBool::<8,1,0,ChargerStateIrqClrReg_SPEC,crate::common::W>::from_register(self,0)
1585 }
1586
1587 #[doc = "Writing a 1 will reset the respective Charger\'s State IRQ status bit ; writing a 0 will have no effect"]
1588 #[inline(always)]
1589 pub fn tbat_prot_to_precharge_irq_clr(
1590 self,
1591 ) -> crate::common::RegisterFieldBool<7, 1, 0, ChargerStateIrqClrReg_SPEC, crate::common::W>
1592 {
1593 crate::common::RegisterFieldBool::<7,1,0,ChargerStateIrqClrReg_SPEC,crate::common::W>::from_register(self,0)
1594 }
1595
1596 #[doc = "Writing a 1 will reset the respective Charger\'s State IRQ status bit ; writing a 0 will have no effect"]
1597 #[inline(always)]
1598 pub fn tdie_prot_to_precharge_irq_clr(
1599 self,
1600 ) -> crate::common::RegisterFieldBool<6, 1, 0, ChargerStateIrqClrReg_SPEC, crate::common::W>
1601 {
1602 crate::common::RegisterFieldBool::<6,1,0,ChargerStateIrqClrReg_SPEC,crate::common::W>::from_register(self,0)
1603 }
1604
1605 #[doc = "Writing a 1 will reset the respective Charger\'s State IRQ status bit ; writing a 0 will have no effect"]
1606 #[inline(always)]
1607 pub fn eoc_to_precharge_irq_clr(
1608 self,
1609 ) -> crate::common::RegisterFieldBool<5, 1, 0, ChargerStateIrqClrReg_SPEC, crate::common::W>
1610 {
1611 crate::common::RegisterFieldBool::<5,1,0,ChargerStateIrqClrReg_SPEC,crate::common::W>::from_register(self,0)
1612 }
1613
1614 #[doc = "Writing a 1 will reset the respective Charger\'s State IRQ status bit ; writing a 0 will have no effect"]
1615 #[inline(always)]
1616 pub fn cv_to_eoc_irq_clr(
1617 self,
1618 ) -> crate::common::RegisterFieldBool<4, 1, 0, ChargerStateIrqClrReg_SPEC, crate::common::W>
1619 {
1620 crate::common::RegisterFieldBool::<4,1,0,ChargerStateIrqClrReg_SPEC,crate::common::W>::from_register(self,0)
1621 }
1622
1623 #[doc = "Writing a 1 will reset the respective Charger\'s State IRQ status bit ; writing a 0 will have no effect"]
1624 #[inline(always)]
1625 pub fn cc_to_eoc_irq_clr(
1626 self,
1627 ) -> crate::common::RegisterFieldBool<3, 1, 0, ChargerStateIrqClrReg_SPEC, crate::common::W>
1628 {
1629 crate::common::RegisterFieldBool::<3,1,0,ChargerStateIrqClrReg_SPEC,crate::common::W>::from_register(self,0)
1630 }
1631
1632 #[doc = "Writing a 1 will reset the respective Charger\'s State IRQ status bit ; writing a 0 will have no effect"]
1633 #[inline(always)]
1634 pub fn cc_to_cv_irq_clr(
1635 self,
1636 ) -> crate::common::RegisterFieldBool<2, 1, 0, ChargerStateIrqClrReg_SPEC, crate::common::W>
1637 {
1638 crate::common::RegisterFieldBool::<2,1,0,ChargerStateIrqClrReg_SPEC,crate::common::W>::from_register(self,0)
1639 }
1640
1641 #[doc = "Writing a 1 will reset the respective Charger\'s State IRQ status bit ; writing a 0 will have no effect"]
1642 #[inline(always)]
1643 pub fn precharge_to_cc_irq_clr(
1644 self,
1645 ) -> crate::common::RegisterFieldBool<1, 1, 0, ChargerStateIrqClrReg_SPEC, crate::common::W>
1646 {
1647 crate::common::RegisterFieldBool::<1,1,0,ChargerStateIrqClrReg_SPEC,crate::common::W>::from_register(self,0)
1648 }
1649
1650 #[doc = "Writing a 1 will reset the respective Charger\'s State IRQ status bit ; writing a 0 will have no effect"]
1651 #[inline(always)]
1652 pub fn disabled_to_precharge_irq_clr(
1653 self,
1654 ) -> crate::common::RegisterFieldBool<0, 1, 0, ChargerStateIrqClrReg_SPEC, crate::common::W>
1655 {
1656 crate::common::RegisterFieldBool::<0,1,0,ChargerStateIrqClrReg_SPEC,crate::common::W>::from_register(self,0)
1657 }
1658}
1659impl ::core::default::Default for ChargerStateIrqClrReg {
1660 #[inline(always)]
1661 fn default() -> ChargerStateIrqClrReg {
1662 <crate::RegValueT<ChargerStateIrqClrReg_SPEC> as RegisterValue<_>>::new(0)
1663 }
1664}
1665
1666#[doc(hidden)]
1667#[derive(Copy, Clone, Eq, PartialEq)]
1668pub struct ChargerStateIrqMaskReg_SPEC;
1669impl crate::sealed::RegSpec for ChargerStateIrqMaskReg_SPEC {
1670 type DataType = u32;
1671}
1672
1673#[doc = "Mask register of Charger FSM IRQs"]
1674pub type ChargerStateIrqMaskReg = crate::RegValueT<ChargerStateIrqMaskReg_SPEC>;
1675
1676impl ChargerStateIrqMaskReg {
1677 #[doc = "When set, this bit-field enables the IRQ generation as soon as the Charger\'s FSM switches from CV_CHARGE to PRE_CHARGE state."]
1678 #[inline(always)]
1679 pub fn cv_to_precharge_irq_en(
1680 self,
1681 ) -> crate::common::RegisterFieldBool<11, 1, 0, ChargerStateIrqMaskReg_SPEC, crate::common::RW>
1682 {
1683 crate::common::RegisterFieldBool::<11,1,0,ChargerStateIrqMaskReg_SPEC,crate::common::RW>::from_register(self,0)
1684 }
1685
1686 #[doc = "When set, this bit-field enables the IRQ generation as soon as the Charger\'s FSM switches from CC_CHARGE to PRE_CHARGE state."]
1687 #[inline(always)]
1688 pub fn cc_to_precharge_irq_en(
1689 self,
1690 ) -> crate::common::RegisterFieldBool<10, 1, 0, ChargerStateIrqMaskReg_SPEC, crate::common::RW>
1691 {
1692 crate::common::RegisterFieldBool::<10,1,0,ChargerStateIrqMaskReg_SPEC,crate::common::RW>::from_register(self,0)
1693 }
1694
1695 #[doc = "When set, this bit-field enables the IRQ generation as soon as the Charger\'s FSM switches from CV_CHARGE to CC_CHARGE state."]
1696 #[inline(always)]
1697 pub fn cv_to_cc_irq_en(
1698 self,
1699 ) -> crate::common::RegisterFieldBool<9, 1, 0, ChargerStateIrqMaskReg_SPEC, crate::common::RW>
1700 {
1701 crate::common::RegisterFieldBool::<9,1,0,ChargerStateIrqMaskReg_SPEC,crate::common::RW>::from_register(self,0)
1702 }
1703
1704 #[doc = "When set, this bit-field enables the generation of the Charger\'s state IRQ as soon as the battery temperature status is refreched by the Charger\'s Battery temperature monitor (JEITA) FSM. As soon as the specific FSM checks the current battery temperature level, it notifies the main Charger FSM that it has run and that the Battery temperature pack state is checked (and potentially refreshed with a new status)."]
1705 #[inline(always)]
1706 pub fn tbat_status_update_irq_en(
1707 self,
1708 ) -> crate::common::RegisterFieldBool<8, 1, 0, ChargerStateIrqMaskReg_SPEC, crate::common::RW>
1709 {
1710 crate::common::RegisterFieldBool::<8,1,0,ChargerStateIrqMaskReg_SPEC,crate::common::RW>::from_register(self,0)
1711 }
1712
1713 #[doc = "When set, this bit-field enables the Charger\'s state IRQ generation as soon as the Charger\'s FSM switches from the Battery temperature protection state (TBAT_PROT) to PRE_CHARGE, resuming charging."]
1714 #[inline(always)]
1715 pub fn tbat_prot_to_precharge_irq_en(
1716 self,
1717 ) -> crate::common::RegisterFieldBool<7, 1, 0, ChargerStateIrqMaskReg_SPEC, crate::common::RW>
1718 {
1719 crate::common::RegisterFieldBool::<7,1,0,ChargerStateIrqMaskReg_SPEC,crate::common::RW>::from_register(self,0)
1720 }
1721
1722 #[doc = "When set, this bit-field enables the Charger\'s state IRQ generation as soon as the Charger\'s FSM switches from the Die temperature protection state (TDIE_PROT) to PRE_CHARGE, resuming charging."]
1723 #[inline(always)]
1724 pub fn tdie_prot_to_precharge_irq_en(
1725 self,
1726 ) -> crate::common::RegisterFieldBool<6, 1, 0, ChargerStateIrqMaskReg_SPEC, crate::common::RW>
1727 {
1728 crate::common::RegisterFieldBool::<6,1,0,ChargerStateIrqMaskReg_SPEC,crate::common::RW>::from_register(self,0)
1729 }
1730
1731 #[doc = "When set, this bit-field enables the Charger\'s State IRQ generation as soon as the Charger\'s FSM switches from END_OF_CHARGE again to PRE_CHARGE state. This happens when the Vbat voltage level is detected to be below the Replenish level set."]
1732 #[inline(always)]
1733 pub fn eoc_to_precharge_irq_en(
1734 self,
1735 ) -> crate::common::RegisterFieldBool<5, 1, 0, ChargerStateIrqMaskReg_SPEC, crate::common::RW>
1736 {
1737 crate::common::RegisterFieldBool::<5,1,0,ChargerStateIrqMaskReg_SPEC,crate::common::RW>::from_register(self,0)
1738 }
1739
1740 #[doc = "When set, this bit-field enables the IRQ generation as soon as the Charger\'s FSM switches from CV_CHARGE to END_OF_CHARGE state."]
1741 #[inline(always)]
1742 pub fn cv_to_eoc_irq_en(
1743 self,
1744 ) -> crate::common::RegisterFieldBool<4, 1, 0, ChargerStateIrqMaskReg_SPEC, crate::common::RW>
1745 {
1746 crate::common::RegisterFieldBool::<4,1,0,ChargerStateIrqMaskReg_SPEC,crate::common::RW>::from_register(self,0)
1747 }
1748
1749 #[doc = "When set, this bit-field enables the IRQ generation as soon as the Charger\'s FSM switches from CC_CHARGE to END_OF_CHARGE state."]
1750 #[inline(always)]
1751 pub fn cc_to_eoc_irq_en(
1752 self,
1753 ) -> crate::common::RegisterFieldBool<3, 1, 0, ChargerStateIrqMaskReg_SPEC, crate::common::RW>
1754 {
1755 crate::common::RegisterFieldBool::<3,1,0,ChargerStateIrqMaskReg_SPEC,crate::common::RW>::from_register(self,0)
1756 }
1757
1758 #[doc = "When set, this bit-field enables the IRQ generation as soon as the Charger\'s FSM switches from CC_CHARGE to CV_CHARGE state."]
1759 #[inline(always)]
1760 pub fn cc_to_cv_irq_en(
1761 self,
1762 ) -> crate::common::RegisterFieldBool<2, 1, 0, ChargerStateIrqMaskReg_SPEC, crate::common::RW>
1763 {
1764 crate::common::RegisterFieldBool::<2,1,0,ChargerStateIrqMaskReg_SPEC,crate::common::RW>::from_register(self,0)
1765 }
1766
1767 #[doc = "When set, this bit-field enables the IRQ generation as soon as the Charger\'s FSM switches from PRE_CHARGE to CC_CHARGE state.."]
1768 #[inline(always)]
1769 pub fn precharge_to_cc_irq_en(
1770 self,
1771 ) -> crate::common::RegisterFieldBool<1, 1, 0, ChargerStateIrqMaskReg_SPEC, crate::common::RW>
1772 {
1773 crate::common::RegisterFieldBool::<1,1,0,ChargerStateIrqMaskReg_SPEC,crate::common::RW>::from_register(self,0)
1774 }
1775
1776 #[doc = "When set, this bit-field enables the IRQ generation as soon as the Charger\'s FSM switches from DISABLED to PRE_CHARGE state."]
1777 #[inline(always)]
1778 pub fn disabled_to_precharge_irq_en(
1779 self,
1780 ) -> crate::common::RegisterFieldBool<0, 1, 0, ChargerStateIrqMaskReg_SPEC, crate::common::RW>
1781 {
1782 crate::common::RegisterFieldBool::<0,1,0,ChargerStateIrqMaskReg_SPEC,crate::common::RW>::from_register(self,0)
1783 }
1784}
1785impl ::core::default::Default for ChargerStateIrqMaskReg {
1786 #[inline(always)]
1787 fn default() -> ChargerStateIrqMaskReg {
1788 <crate::RegValueT<ChargerStateIrqMaskReg_SPEC> as RegisterValue<_>>::new(0)
1789 }
1790}
1791
1792#[doc(hidden)]
1793#[derive(Copy, Clone, Eq, PartialEq)]
1794pub struct ChargerStateIrqStatusReg_SPEC;
1795impl crate::sealed::RegSpec for ChargerStateIrqStatusReg_SPEC {
1796 type DataType = u32;
1797}
1798
1799#[doc = "Status register of Charger FSM IRQs"]
1800pub type ChargerStateIrqStatusReg = crate::RegValueT<ChargerStateIrqStatusReg_SPEC>;
1801
1802impl ChargerStateIrqStatusReg {
1803 #[doc = "0 = No transition of the Charger\'s FSM from CV_CHARGE to PRE_CHARGE state has been captured\n1 = Charger\'s FSM has switched from CV_CHARGE to PRE_CHARGE state"]
1804 #[inline(always)]
1805 pub fn cv_to_precharge_irq(
1806 self,
1807 ) -> crate::common::RegisterFieldBool<11, 1, 0, ChargerStateIrqStatusReg_SPEC, crate::common::R>
1808 {
1809 crate::common::RegisterFieldBool::<11,1,0,ChargerStateIrqStatusReg_SPEC,crate::common::R>::from_register(self,0)
1810 }
1811
1812 #[doc = "0 = No transition of the Charger\'s FSM from CC_CHARGE to PRE_CHARGE state has been captured\n1 = Charger\'s FSM has switched from CC_CHARGE to PRE_CHARGE state"]
1813 #[inline(always)]
1814 pub fn cc_to_precharge_irq(
1815 self,
1816 ) -> crate::common::RegisterFieldBool<10, 1, 0, ChargerStateIrqStatusReg_SPEC, crate::common::R>
1817 {
1818 crate::common::RegisterFieldBool::<10,1,0,ChargerStateIrqStatusReg_SPEC,crate::common::R>::from_register(self,0)
1819 }
1820
1821 #[doc = "0 = No transition of the Charger\'s FSM from CV_CHARGE to CC_CHARGE state has been captured\n1 = Charger\'s FSM has switched from CV_CHARGE to CC_CHARGE state"]
1822 #[inline(always)]
1823 pub fn cv_to_cc_irq(
1824 self,
1825 ) -> crate::common::RegisterFieldBool<9, 1, 0, ChargerStateIrqStatusReg_SPEC, crate::common::R>
1826 {
1827 crate::common::RegisterFieldBool::<9,1,0,ChargerStateIrqStatusReg_SPEC,crate::common::R>::from_register(self,0)
1828 }
1829
1830 #[doc = "0 = No battery temperature status update event has been captured\n1 = Battery temperature pack\'s status has been checked and refreshed by the Charger\'s Battery temperature monitor FSM. Thus, the new status of the battery temperature should be checked by SW."]
1831 #[inline(always)]
1832 pub fn tbat_status_update_irq(
1833 self,
1834 ) -> crate::common::RegisterFieldBool<8, 1, 0, ChargerStateIrqStatusReg_SPEC, crate::common::R>
1835 {
1836 crate::common::RegisterFieldBool::<8,1,0,ChargerStateIrqStatusReg_SPEC,crate::common::R>::from_register(self,0)
1837 }
1838
1839 #[doc = "0 = No transition of the Charger\'s FSM from TBAT_PROT to PRE_CHARGE state has been captured\n1 = Charger\'s FSM has switched from TBAT_PROT to PRE_CHARGE state, resuming charging after having recovered from a battery temperature error."]
1840 #[inline(always)]
1841 pub fn tbat_prot_to_precharge_irq(
1842 self,
1843 ) -> crate::common::RegisterFieldBool<7, 1, 0, ChargerStateIrqStatusReg_SPEC, crate::common::R>
1844 {
1845 crate::common::RegisterFieldBool::<7,1,0,ChargerStateIrqStatusReg_SPEC,crate::common::R>::from_register(self,0)
1846 }
1847
1848 #[doc = "0 = No transition of the Charger\'s FSM from TDIE_PROT to PRE_CHARGE state has been captured\n1 = Charger\'s FSM has switched from TDIE_PROT to PRE_CHARGE state, resuming charging after having recovered from a Die temperature error."]
1849 #[inline(always)]
1850 pub fn tdie_prot_to_precharge_irq(
1851 self,
1852 ) -> crate::common::RegisterFieldBool<6, 1, 0, ChargerStateIrqStatusReg_SPEC, crate::common::R>
1853 {
1854 crate::common::RegisterFieldBool::<6,1,0,ChargerStateIrqStatusReg_SPEC,crate::common::R>::from_register(self,0)
1855 }
1856
1857 #[doc = "0 = No transition of the Charger\'s FSM from END_OF_CHARGE to PRE_CHARGE state has been captured\n1 = Charger\'s FSM has switched from END_OF_CHARGE to PRE_CHARGE state"]
1858 #[inline(always)]
1859 pub fn eoc_to_precharge_irq(
1860 self,
1861 ) -> crate::common::RegisterFieldBool<5, 1, 0, ChargerStateIrqStatusReg_SPEC, crate::common::R>
1862 {
1863 crate::common::RegisterFieldBool::<5,1,0,ChargerStateIrqStatusReg_SPEC,crate::common::R>::from_register(self,0)
1864 }
1865
1866 #[doc = "0 = No transition of the Charger\'s FSM from CV_CHARGE to END_OF_CHARGE state has been captured\n1 = Charger\'s FSM has switched from CV_CHARGE to END_OF_CHARGE state"]
1867 #[inline(always)]
1868 pub fn cv_to_eoc_irq(
1869 self,
1870 ) -> crate::common::RegisterFieldBool<4, 1, 0, ChargerStateIrqStatusReg_SPEC, crate::common::R>
1871 {
1872 crate::common::RegisterFieldBool::<4,1,0,ChargerStateIrqStatusReg_SPEC,crate::common::R>::from_register(self,0)
1873 }
1874
1875 #[doc = "0 = No transition of the Charger\'s FSM from CC_CHARGE to END_OF_CHARGE state has been captured\n1 = Charger\'s FSM has switched from CC_CHARGE to END_OF_CHARGE state"]
1876 #[inline(always)]
1877 pub fn cc_to_eoc_irq(
1878 self,
1879 ) -> crate::common::RegisterFieldBool<3, 1, 0, ChargerStateIrqStatusReg_SPEC, crate::common::R>
1880 {
1881 crate::common::RegisterFieldBool::<3,1,0,ChargerStateIrqStatusReg_SPEC,crate::common::R>::from_register(self,0)
1882 }
1883
1884 #[doc = "0 = No transition of the Charger\'s FSM from CC_CHARGE to CV_CHARGE state has been captured\n1 = Charger\'s FSM has switched from CC_CHARGE to CV_CHARGE state"]
1885 #[inline(always)]
1886 pub fn cc_to_cv_irq(
1887 self,
1888 ) -> crate::common::RegisterFieldBool<2, 1, 0, ChargerStateIrqStatusReg_SPEC, crate::common::R>
1889 {
1890 crate::common::RegisterFieldBool::<2,1,0,ChargerStateIrqStatusReg_SPEC,crate::common::R>::from_register(self,0)
1891 }
1892
1893 #[doc = "0 = No transition of the Charger\'s FSM from PRE_CHARGE to CC_CHARGE state has been captured\n1 = Charger\'s FSM has switched from PRE_CHARGE to CC_CHARGE state"]
1894 #[inline(always)]
1895 pub fn precharge_to_cc_irq(
1896 self,
1897 ) -> crate::common::RegisterFieldBool<1, 1, 0, ChargerStateIrqStatusReg_SPEC, crate::common::R>
1898 {
1899 crate::common::RegisterFieldBool::<1,1,0,ChargerStateIrqStatusReg_SPEC,crate::common::R>::from_register(self,0)
1900 }
1901
1902 #[doc = "0 = No transition of the Charger\'s FSM from DISABLED to PRE_CHARGE state has been captured\n1 = Charger\'s FSM has switched from DISABLED to PRE_CHARGE state"]
1903 #[inline(always)]
1904 pub fn disabled_to_precharge_irq(
1905 self,
1906 ) -> crate::common::RegisterFieldBool<0, 1, 0, ChargerStateIrqStatusReg_SPEC, crate::common::R>
1907 {
1908 crate::common::RegisterFieldBool::<0,1,0,ChargerStateIrqStatusReg_SPEC,crate::common::R>::from_register(self,0)
1909 }
1910}
1911impl ::core::default::Default for ChargerStateIrqStatusReg {
1912 #[inline(always)]
1913 fn default() -> ChargerStateIrqStatusReg {
1914 <crate::RegValueT<ChargerStateIrqStatusReg_SPEC> as RegisterValue<_>>::new(0)
1915 }
1916}
1917
1918#[doc(hidden)]
1919#[derive(Copy, Clone, Eq, PartialEq)]
1920pub struct ChargerStatusReg_SPEC;
1921impl crate::sealed::RegSpec for ChargerStatusReg_SPEC {
1922 type DataType = u32;
1923}
1924
1925#[doc = "Charger main status register"]
1926pub type ChargerStatusReg = crate::RegValueT<ChargerStatusReg_SPEC>;
1927
1928impl ChargerStatusReg {
1929 #[doc = "The specific bit-field returns the consecutive number of times Vbat has exceeded the programmed Over-Voltage Protection (OVP) level. It is used to determine when the Charger\'s FSM will exit any of the charging states (PRE/CC/CV_CHARGE) and will switch to the ERROR state due to an OVP error. This will happen as soon as the respective counter of OVP events reaches or exceeds a fixed number (4), similar to the approach adopted in the End-of-Charge and Die Temperature debouncing mechanisms.\nThe specific counter increases only while the Charger\'s FSM is in any of the three charging,states, the Vbat OVP interval check timer has reached the threshold set and when Vbat OVP comparator\'s output is asserted.\nNote 1 : By default, as soon as the counter reaches 4, the FSM will switch to the ERROR state and the counter will reset again. Thus, in that case the specific counter ranges from 0 to 4 and vice-versa. However, if the monitoring of Vbat OVP comparator\'s state is less frequent than 5 (4+1) times the CHARGER_OVP_COMP_TIMER_REG\\[OVP_INTERVAL_CHECK_THRES\\] and Vbat has exceeded the OVP voltage level based on the comparator\'s output signal, then this counter will exceed 4 and may overflow.\nThis will not harm, however, the detection of the OVP event, as it only increases the number of OVP event occurrences by the debounce timer, until the OVP comparator timer\'s settling time has expired. Thus, the Charger FSM will again switch to ERROR when the counter has reached or exceeded 4 (bit \\[2\\] of OVP_EVENTS_DEBOUNCE_CNT is set) and the OVP comparator\'s timer has expired.\nNote 2: See also the OVP_INTERVAL_CHECK_TIMER, OVP_INTERVAL_CHECK_THRES of CHARGER_OVP_COMP_TIMER_REG, for the debouncing mechanism of the Vbat OVP comparator\'s output."]
1930 #[inline(always)]
1931 pub fn ovp_events_debounce_cnt(
1932 self,
1933 ) -> crate::common::RegisterField<27, 0x7, 1, 0, u8, u8, ChargerStatusReg_SPEC, crate::common::R>
1934 {
1935 crate::common::RegisterField::<27,0x7,1,0,u8,u8,ChargerStatusReg_SPEC,crate::common::R>::from_register(self,0)
1936 }
1937
1938 #[doc = "The specific bit-field returns the number of times the End-of-Charge signal has been consecutively found to be high. It is used to determine when the Charger\'s FSM will switch from CV_CHARGE to END_OF_CHARGE state, implementing a debounce mechanism on End-of-Charge signal, coming from the analogue circuitry of the Charger towards the FSM.\nThe specific counter, running with the Charger\'s 1Mhz clock:\n - Increases after detecting that the End-of-Charge signal is high when the respective interval for the End-of-Charge check expires. This actually happens after having detected a positive edge on End-of-Charge signal, since only after that is it possible for the interval timer to start ticking.\n - Resets to zero when End-of-Charge is seen low when the interval timer has expired or when an End-of-Charge negative edge is seen before the timer\'s expiration, starting-over.\n - Does not count if End-of-Charge signal is seen high and either the CV_MODE signal (also driven by the analogue circutry) or the End-of-Charge signal of the previous clock cycle is seen low.\n - Is reset when the Charger\'s FSM is not in either the CC_CHARGE or the CV_CHARGE state or after having reached \"100\"(4). This is the threshold after which the End-of-Charge signal is considered stable by the Charger\'s FSM, to switch to the END_OF_CHARGE state. Thus, in practice, the specific counter (and bit-field) ranges between 0 and 4.\nNote: See also the EOC_INTERVAL_CHECK_TIMER/THRES bit-fields of CHARGER_CTRL_REG."]
1939 #[inline(always)]
1940 pub fn eoc_events_debounce_cnt(
1941 self,
1942 ) -> crate::common::RegisterField<24, 0x7, 1, 0, u8, u8, ChargerStatusReg_SPEC, crate::common::R>
1943 {
1944 crate::common::RegisterField::<24,0x7,1,0,u8,u8,ChargerStatusReg_SPEC,crate::common::R>::from_register(self,0)
1945 }
1946
1947 #[doc = "The specific bit-field returns the consecutive number of times the Die temperature is seen either above (for the case of an error) or below (for the case of recovering from an error) the set Die temperature level.This is performed by a counter, which is increased:\n- Each time the Die temperature comparator shows that Die temperature exceeds the set level, and while charging is active, provided that Die temperature protection is enabled. If, however, the CHARGER_CTRL_REG.TDIE_PROT_ENABLE bit-field is not set, the counter is reset and stays frozen to zero.\n- Each time the Die temperature comparator shows that Die temperature is again below the set level, and while the FSM is in the Die temperature protection error state (TDIE_PROT) and the TDIE_ERROR_RESUME bit-field of CHARGER_CTRL_REG is set. If the specific bit-field is not set, the debounce counter is reset to 0 and it is kept frozen until the FSM is again enabled to resume from Die temperature errors.\nIf the Die temperature comparator of the Charger\'s analogue circuitry shows that temperature has exceeded the programmed level for four consecutive times and charging is active, the Charger\'s FSM considers this as a Die temperature error and moves to the TDIE_PROT state, resetting the timer at the same time and of course halting charging.\nTo recover from this state and resume charging, the FSM needs to see that Die temperature is below the programmed level for four consecutive times, again, provided that the TDIE_ERROR_RESUME bit-field of CHARGER_CTRL_REG is set. As soon as this happens, the error counter is again reset and the Charger\'s FSM resumes, by moving to PRE_CHARGE state. Consequently, the counter\'s value always ranges from 0 to 4.\nNote: When the Charger\'s FSM is in BYPASSED state, then this bit-field is reset and kept frozen to zero. Consequently, the number of times Die temperature has exceeded the pre-programmed threshold should be determined by SW."]
1948 #[inline(always)]
1949 pub fn tdie_error_debounce_cnt(
1950 self,
1951 ) -> crate::common::RegisterField<21, 0x7, 1, 0, u8, u8, ChargerStatusReg_SPEC, crate::common::R>
1952 {
1953 crate::common::RegisterField::<21,0x7,1,0,u8,u8,ChargerStatusReg_SPEC,crate::common::R>::from_register(self,0)
1954 }
1955
1956 #[doc = "Returns the state of the Charger\'s JEITA FSM. This FSM is used to update the state of the battery temperature pack, depending on the value programmed in CHARGER_CTRL_REG.TBAT_MONITOR_MODE bit-field. The encoding of the states is as follows:\n0x0 = CHECK_IDLE\n0x1 = CHECK_THOT\n0x2 = CHECK_TCOLD\n0x3 = CHECK_TWARM\n0x4 = CHECK_TCOOL\n0x5 = CHECK_TNORMAL\n0x6 = UPDATE_TBAT\nThe FSM initially is in CHECK_IDLE state and starts checking the battery\'s temperature by visiting the states that check for the respective temperature area (Hot, Cold, Warm, Cool, Normal), in this order.\nIf the battery temperature is found to be in one of the aforementioned zones, it directly moves to UPDATE_TBAT state, to update the battery temperature\'s state and notify the main FSM of the Charger about the battery temperature status, before returning to the CHECK_IDLE state. A Charger State IRQ will also be generated upon refreshing the battery temperature status (see also the description of CHARGER_STATE_IRQ_MASK_REG register)."]
1957 #[inline(always)]
1958 pub fn charger_jeita_state(
1959 self,
1960 ) -> crate::common::RegisterField<18, 0x7, 1, 0, u8, u8, ChargerStatusReg_SPEC, crate::common::R>
1961 {
1962 crate::common::RegisterField::<18,0x7,1,0,u8,u8,ChargerStatusReg_SPEC,crate::common::R>::from_register(self,0)
1963 }
1964
1965 #[doc = "Indicating the state of the Charger\'s main FSM, based on the following encoding:\n0x0 = POWER_UP (Charger\'s power-up not yet set)\n0x1 = INIT (Charger is being power-up, FSM waiting for the analogue to settle)\n0x2 = DISABLED (Charger powered-up but charging not yet started)\n0x3 = PRE_CHARGE (Pre-Charge state)\n0x4 = CC_CHARGE (Constant Current state)\n0x5 = CV_CHARGE (Constant Voltage state)\n0x6 = END_OF_CHARGE (End-of-Charge state)\n0x7 = TDIE_PROT (Die temperature protection state, visited when Die temperature limit is exceeded)\n0x8 = TBAT_PROT (Battery temperature protection state, visited when Battery temperature is either COLD or HOT)\n0x9 = BYPASSED (Bypassed state, visited only when the FSM is bypassed and SW takes over control)\n0xA = ERROR (Error state, visited when a charge time-out occurs or in the case of Vbat exceeding over-voltage level)"]
1966 #[inline(always)]
1967 pub fn charger_state(
1968 self,
1969 ) -> crate::common::RegisterField<14, 0xf, 1, 0, u8, u8, ChargerStatusReg_SPEC, crate::common::R>
1970 {
1971 crate::common::RegisterField::<14,0xf,1,0,u8,u8,ChargerStatusReg_SPEC,crate::common::R>::from_register(self,0)
1972 }
1973
1974 #[doc = "Battery pack temperature status, according to the following (\"1-Hot\"-like) encoding:\n00001 : Battery temperature in COLD zone (default)\n00010 : Battery temperature in COOL zone\n00100 : Battery temperature in NORMAL zone (above COOL and below WARM zones)\n01000 : Battery temperature in WARM zone\n10000 : Battery temperature in HOT zone\nIt is noted that, according to the JEITA standard (supported if the JEITA_SUPPORT_ENABLED bit-field of CHARGER_CTRL_REG is not set) , if the battery pack temperature is in the \"HOT\" zone, charging will always be stopped. The same will happen also for the case of the COLD zone, unless the \"NTC_LOW_DISABLE\" bit-field of CHARGER_CTRL_REG is set. In that case, charging will continue.\nIt is finally noted that only the aforementioned values are available for this bit-field, since it is 1-Hot encoding based. Not more than 1 bit can be high at the same time, since this would mean that battery temperature is at two different temperature zones concurrently."]
1975 #[inline(always)]
1976 pub fn tbat_status(
1977 self,
1978 ) -> crate::common::RegisterField<9, 0x1f, 1, 0, u8, u8, ChargerStatusReg_SPEC, crate::common::R>
1979 {
1980 crate::common::RegisterField::<9,0x1f,1,0,u8,u8,ChargerStatusReg_SPEC,crate::common::R>::from_register(self,0)
1981 }
1982
1983 #[doc = "Returns the status of the main battery temperature comparator. This comparator by default checks if the battery temperature is in the Cold zone. However, if JEITA support is enabled and battery temperature is found to not be in either the Hot or the Cold zone, the same comparator is used to check for the Warm and Cool zones, as JEITA suggests.\nThe specific bit-field is suggested to be used in bypass mode and when the JEITA support is disabled (so when the battery temperature is checked agains the Hot and the Cold zones). In that case, the comparator checks the battery temperature agains the Cold level and its status can be as follows:\n0 = Battery temperature pack is found to be below the Cold level, so in the non-allowed Cold temperature zone. Thus, charging will be disabled, provided that the NTC_LOW_DISABLE bit-field of CHARGER_CTRL_REG is not set.\n1 = Battery temperature pack is found to be above the non-allowed Cold temperature zone. Thus, charging will be continued, provided that battery temperature will not be in the Hot zone as well.\nWhen the Charger\'s main FSM is active and JEITA is enabled, the Charger\'s digital block takes over and controls the respective comparator\'s output."]
1984 #[inline(always)]
1985 pub fn main_tbat_comp_out(
1986 self,
1987 ) -> crate::common::RegisterFieldBool<8, 1, 0, ChargerStatusReg_SPEC, crate::common::R> {
1988 crate::common::RegisterFieldBool::<8,1,0,ChargerStatusReg_SPEC,crate::common::R>::from_register(self,0)
1989 }
1990
1991 #[doc = "Returns the status of the battery temperature comparator dedicated to the Hot temperature zone.\n0 = Battery temperature pack is found to be below the Hot zone\n1 = Battery temperature pack is found to be in the non-allowed Hot temperature zone. Thus, charging will be disabled, provided that battery temperature protection is enabled."]
1992 #[inline(always)]
1993 pub fn tbat_hot_comp_out(
1994 self,
1995 ) -> crate::common::RegisterFieldBool<7, 1, 0, ChargerStatusReg_SPEC, crate::common::R> {
1996 crate::common::RegisterFieldBool::<7,1,0,ChargerStatusReg_SPEC,crate::common::R>::from_register(self,0)
1997 }
1998
1999 #[doc = "0 = Die temperature is found to be below the programmed level, set in CHARGER_TEMPSET_PARAM_REG.TDIE_SET level (normal operation)\n1 = Die temperature is found to be above the set level.\nCharging will be disabled if Die temperature protection is enabled and the Die temperature is found to be above the set level four consecutive times (see also TDIE_ERROR_DEBOUNCE_CNT bit-field). In that case, the Charger\'s FSM will also move the respective error state (TDIE_PROT) and an IRQ may be generated, if the respective mask bit of CHARGER_ERROR_IRQ_MASK_REG is set."]
2000 #[inline(always)]
2001 pub fn tdie_comp_out(
2002 self,
2003 ) -> crate::common::RegisterFieldBool<6, 1, 0, ChargerStatusReg_SPEC, crate::common::R> {
2004 crate::common::RegisterFieldBool::<6,1,0,ChargerStatusReg_SPEC,crate::common::R>::from_register(self,0)
2005 }
2006
2007 #[doc = "0 = Vbat has not exceeded the Over-Voltage Protection (OVP) voltage limit, according to the respective analogue comparator\'s output.\n1 = Vbat is found to have exceeded the OVP voltage setting, thus charging should be disabled.\nThe OVP voltage settings are defined in CHARGER_VOLTAGE_PARAM_REG.V_OVP (for the Normal battery temperature zone), as well as in CHARGER_JEITA_V_OVP_REG (for Cool and Warm temperature zones, to comply with JEITA)."]
2008 #[inline(always)]
2009 pub fn vbat_ovp_comp_out(
2010 self,
2011 ) -> crate::common::RegisterFieldBool<5, 1, 0, ChargerStatusReg_SPEC, crate::common::R> {
2012 crate::common::RegisterFieldBool::<5,1,0,ChargerStatusReg_SPEC,crate::common::R>::from_register(self,0)
2013 }
2014
2015 #[doc = "This bit-field reflects the status of the main Vbat comparator residing in the analogue circuitry of the Charger.\nThis comparator is used to check Vbat against either the Pre-Charge or the Replenish voltage level, depending on what is driven by the Charger\'s digital block.\nThus, when the FSM is active, the comparator gets as reference the Replenish setting as soon as the FSM has reached the END_OF_CHARGE state. Otherwise,the Pre-Charge voltage setting is driven, including the Bypass mode.\nAccording to the above, the encoding is as follows for the case the comparator compares Vbat against the Pre-Charge level:\n0 = Vbat has not exceeded the set Pre-Charge voltage level.\n1 = Vbat has reached or exceeded the set Pre-Charge voltage level.\nFor the case the comparator compares agains the Replenish level (when the FSM has reached the END_OF_CHARGE state, so when the charging has been completed), the encoding is as follows:\n0 = Vbat has dropped below the set Replenish level, so charging will re-start and the FSM will move to the PRE_CHARGE state.\n1 = Vbat is still greater or equal to the set Replenish level, thus charging remains in hold and the FSM in END_OF_CHARGE state."]
2016 #[inline(always)]
2017 pub fn main_vbat_comp_out(
2018 self,
2019 ) -> crate::common::RegisterFieldBool<4, 1, 0, ChargerStatusReg_SPEC, crate::common::R> {
2020 crate::common::RegisterFieldBool::<4,1,0,ChargerStatusReg_SPEC,crate::common::R>::from_register(self,0)
2021 }
2022
2023 #[doc = "0 = Actual charge current is above the current level programmed in I_END_OF_CHARGE field of CHARGER_CURRENT_PARAM_REG (or charger is off)\n1 = Actual charge current is below the current level programmed in I_END_OF_CHARGE bit-field of CHARGER_CURRENT_PARAM_REG."]
2024 #[inline(always)]
2025 pub fn end_of_charge(
2026 self,
2027 ) -> crate::common::RegisterFieldBool<3, 1, 0, ChargerStatusReg_SPEC, crate::common::R> {
2028 crate::common::RegisterFieldBool::<3,1,0,ChargerStatusReg_SPEC,crate::common::R>::from_register(self,0)
2029 }
2030
2031 #[doc = "0 = Charger\'s voltage loop not in regulation (or Charger is off)\n1 = Charger\'s Constant Voltage (CV) mode active, voltage loop in regulation"]
2032 #[inline(always)]
2033 pub fn charger_cv_mode(
2034 self,
2035 ) -> crate::common::RegisterFieldBool<2, 1, 0, ChargerStatusReg_SPEC, crate::common::R> {
2036 crate::common::RegisterFieldBool::<2,1,0,ChargerStatusReg_SPEC,crate::common::R>::from_register(self,0)
2037 }
2038
2039 #[doc = "0 = Charger\'s Current loop not in regulation (or Charger is off)\n1 = Charger\'s Constant Current (CC) mode active, current loop in regulation"]
2040 #[inline(always)]
2041 pub fn charger_cc_mode(
2042 self,
2043 ) -> crate::common::RegisterFieldBool<1, 1, 0, ChargerStatusReg_SPEC, crate::common::R> {
2044 crate::common::RegisterFieldBool::<1,1,0,ChargerStatusReg_SPEC,crate::common::R>::from_register(self,0)
2045 }
2046
2047 #[doc = "0 = Charger is either off or it is being powered-on but the analogue ciruitry is not yet settled. The charger\'s main FSM is either in POWER_UP or INIT states.\n1 = Charger is powered-up, so its analogue ciruitry should now be settled. The Charger\'s FSM has left both power-up states (POWER_UP, INIT), so charging can start."]
2048 #[inline(always)]
2049 pub fn charger_is_powered_up(
2050 self,
2051 ) -> crate::common::RegisterFieldBool<0, 1, 0, ChargerStatusReg_SPEC, crate::common::R> {
2052 crate::common::RegisterFieldBool::<0,1,0,ChargerStatusReg_SPEC,crate::common::R>::from_register(self,0)
2053 }
2054}
2055impl ::core::default::Default for ChargerStatusReg {
2056 #[inline(always)]
2057 fn default() -> ChargerStatusReg {
2058 <crate::RegValueT<ChargerStatusReg_SPEC> as RegisterValue<_>>::new(512)
2059 }
2060}
2061
2062#[doc(hidden)]
2063#[derive(Copy, Clone, Eq, PartialEq)]
2064pub struct ChargerTbatCompTimerReg_SPEC;
2065impl crate::sealed::RegSpec for ChargerTbatCompTimerReg_SPEC {
2066 type DataType = u32;
2067}
2068
2069#[doc = "Battery temperature (main) comparator timer"]
2070pub type ChargerTbatCompTimerReg = crate::RegValueT<ChargerTbatCompTimerReg_SPEC>;
2071
2072impl ChargerTbatCompTimerReg {
2073 #[doc = "Returns the main battery temperature comparator\'s timer, used for the latching of the comparator\'s output. The output of the comparator is used by the JEITA FSM, to determine the current battery temperature pack\'s status."]
2074 #[inline(always)]
2075 pub fn tbat_comp_timer(
2076 self,
2077 ) -> crate::common::RegisterField<
2078 16,
2079 0x3ff,
2080 1,
2081 0,
2082 u16,
2083 u16,
2084 ChargerTbatCompTimerReg_SPEC,
2085 crate::common::R,
2086 > {
2087 crate::common::RegisterField::<
2088 16,
2089 0x3ff,
2090 1,
2091 0,
2092 u16,
2093 u16,
2094 ChargerTbatCompTimerReg_SPEC,
2095 crate::common::R,
2096 >::from_register(self, 0)
2097 }
2098
2099 #[doc = "Settling time (specified in us) for the main battery temperature comparator, checking for the \"COOL\", \"COLD\" and \"WARM\" levels. The charger\'s digital block uses a dedicated timer to sample the specific comparator\'s output. The comparator\'s output is latched as soon as the timer expires, reaching 0. Then, the timer is reloaded with the settling time value and starts-over, down-counting to 0.\nNote: The specific bit-field should be always set to a non-zero value."]
2100 #[inline(always)]
2101 pub fn tbat_comp_settling(
2102 self,
2103 ) -> crate::common::RegisterField<
2104 0,
2105 0x3ff,
2106 1,
2107 0,
2108 u16,
2109 u16,
2110 ChargerTbatCompTimerReg_SPEC,
2111 crate::common::RW,
2112 > {
2113 crate::common::RegisterField::<
2114 0,
2115 0x3ff,
2116 1,
2117 0,
2118 u16,
2119 u16,
2120 ChargerTbatCompTimerReg_SPEC,
2121 crate::common::RW,
2122 >::from_register(self, 0)
2123 }
2124}
2125impl ::core::default::Default for ChargerTbatCompTimerReg {
2126 #[inline(always)]
2127 fn default() -> ChargerTbatCompTimerReg {
2128 <crate::RegValueT<ChargerTbatCompTimerReg_SPEC> as RegisterValue<_>>::new(99)
2129 }
2130}
2131
2132#[doc(hidden)]
2133#[derive(Copy, Clone, Eq, PartialEq)]
2134pub struct ChargerTbatMonTimerReg_SPEC;
2135impl crate::sealed::RegSpec for ChargerTbatMonTimerReg_SPEC {
2136 type DataType = u32;
2137}
2138
2139#[doc = "Battery temperature monitor interval timer"]
2140pub type ChargerTbatMonTimerReg = crate::RegValueT<ChargerTbatMonTimerReg_SPEC>;
2141
2142impl ChargerTbatMonTimerReg {
2143 #[doc = "This is the battery temperature monitoring timer, counting with the Charger\'s 1KHz clock. If the battery monitor mode is accordingly set in the TBAT_MONITOR_MODE bit-field of CHARGER_CTRL_REG (so either to 0x1 or 0x2), this timer is initially loaded with the value set in TBAT_MON_INTERVAL bit-field in the subsequent 1khz cycles starts down-counting to 0. As soon as the specific timer expires,the JEITA FSM starts-over again, to refresh the battery temperature status."]
2144 #[inline(always)]
2145 pub fn tbat_mon_timer(
2146 self,
2147 ) -> crate::common::RegisterField<
2148 16,
2149 0x3ff,
2150 1,
2151 0,
2152 u16,
2153 u16,
2154 ChargerTbatMonTimerReg_SPEC,
2155 crate::common::R,
2156 > {
2157 crate::common::RegisterField::<
2158 16,
2159 0x3ff,
2160 1,
2161 0,
2162 u16,
2163 u16,
2164 ChargerTbatMonTimerReg_SPEC,
2165 crate::common::R,
2166 >::from_register(self, 0)
2167 }
2168
2169 #[doc = "Timing interval (in ms) for the Battery temperature monitoring. This interval determines how often the JEITA FSM will be checking and potentially refreshing the Battery temperature status, by selecting accordingly the proper level (Hot, Cold, Warm, Cool or Normal), based on the feedback of the two battery temperature comparators being present in the Charger\'s analogue circuitry (one for the Hot level and one for Cold, Cool and Warm, to support JEITA).\nNote: The specific bit-field should be always set to a non-zero value."]
2170 #[inline(always)]
2171 pub fn tbat_mon_interval(
2172 self,
2173 ) -> crate::common::RegisterField<
2174 0,
2175 0x3ff,
2176 1,
2177 0,
2178 u16,
2179 u16,
2180 ChargerTbatMonTimerReg_SPEC,
2181 crate::common::RW,
2182 > {
2183 crate::common::RegisterField::<
2184 0,
2185 0x3ff,
2186 1,
2187 0,
2188 u16,
2189 u16,
2190 ChargerTbatMonTimerReg_SPEC,
2191 crate::common::RW,
2192 >::from_register(self, 0)
2193 }
2194}
2195impl ::core::default::Default for ChargerTbatMonTimerReg {
2196 #[inline(always)]
2197 fn default() -> ChargerTbatMonTimerReg {
2198 <crate::RegValueT<ChargerTbatMonTimerReg_SPEC> as RegisterValue<_>>::new(99)
2199 }
2200}
2201
2202#[doc(hidden)]
2203#[derive(Copy, Clone, Eq, PartialEq)]
2204pub struct ChargerTdieCompTimerReg_SPEC;
2205impl crate::sealed::RegSpec for ChargerTdieCompTimerReg_SPEC {
2206 type DataType = u32;
2207}
2208
2209#[doc = "Die temperature comparator timer register"]
2210pub type ChargerTdieCompTimerReg = crate::RegValueT<ChargerTdieCompTimerReg_SPEC>;
2211
2212impl ChargerTdieCompTimerReg {
2213 #[doc = "Returns the current value of the timer used to determine when the Die temperature comparator\'s output must be sampled by the digital. As soon as the timer expires (down-counting to 0, starting from TDIE_COMP_SETTLING) the comparator\'s output is latched by the Charger\'s digital block and used by the main FSM. After expiring, the timer starts-over again, down-counting, to enable the continuous monitoring of Die temperature by the digital.\nNote: When the Charger\'s FSM is in BYPASSED state, this timer is kept to zero and the SW takes over, sampling the status of the TDIE_PROT_COMP_OUT bit-field of CHARGER_STATUS_REG to determine if the Die temperature limit has been exceeded."]
2214 #[inline(always)]
2215 pub fn tdie_comp_timer(
2216 self,
2217 ) -> crate::common::RegisterField<
2218 16,
2219 0x3ff,
2220 1,
2221 0,
2222 u16,
2223 u16,
2224 ChargerTdieCompTimerReg_SPEC,
2225 crate::common::R,
2226 > {
2227 crate::common::RegisterField::<
2228 16,
2229 0x3ff,
2230 1,
2231 0,
2232 u16,
2233 u16,
2234 ChargerTdieCompTimerReg_SPEC,
2235 crate::common::R,
2236 >::from_register(self, 0)
2237 }
2238
2239 #[doc = "Settling time threshold (in us) for the Die temperature comparator."]
2240 #[inline(always)]
2241 pub fn tdie_comp_settling(
2242 self,
2243 ) -> crate::common::RegisterField<
2244 0,
2245 0x3ff,
2246 1,
2247 0,
2248 u16,
2249 u16,
2250 ChargerTdieCompTimerReg_SPEC,
2251 crate::common::RW,
2252 > {
2253 crate::common::RegisterField::<
2254 0,
2255 0x3ff,
2256 1,
2257 0,
2258 u16,
2259 u16,
2260 ChargerTdieCompTimerReg_SPEC,
2261 crate::common::RW,
2262 >::from_register(self, 0)
2263 }
2264}
2265impl ::core::default::Default for ChargerTdieCompTimerReg {
2266 #[inline(always)]
2267 fn default() -> ChargerTdieCompTimerReg {
2268 <crate::RegValueT<ChargerTdieCompTimerReg_SPEC> as RegisterValue<_>>::new(99)
2269 }
2270}
2271
2272#[doc(hidden)]
2273#[derive(Copy, Clone, Eq, PartialEq)]
2274pub struct ChargerTempsetParamReg_SPEC;
2275impl crate::sealed::RegSpec for ChargerTempsetParamReg_SPEC {
2276 type DataType = u32;
2277}
2278
2279#[doc = "Charger battery temperature settings register"]
2280pub type ChargerTempsetParamReg = crate::RegValueT<ChargerTempsetParamReg_SPEC>;
2281
2282impl ChargerTempsetParamReg {
2283 #[doc = "This bit-field determines the maximum Die temperature level limit, ranging from 0C to 130C, according to the following encoding:\n000: 0 C (mainly for test purposes)\n001: 50 C\n010: 80 C\n011: 90 C\n100: 100 C\n101: 110 C\n110: 120 C\n111: 130 C"]
2284 #[inline(always)]
2285 pub fn tdie_max(
2286 self,
2287 ) -> crate::common::RegisterField<
2288 24,
2289 0x7,
2290 1,
2291 0,
2292 u8,
2293 u8,
2294 ChargerTempsetParamReg_SPEC,
2295 crate::common::RW,
2296 > {
2297 crate::common::RegisterField::<
2298 24,
2299 0x7,
2300 1,
2301 0,
2302 u8,
2303 u8,
2304 ChargerTempsetParamReg_SPEC,
2305 crate::common::RW,
2306 >::from_register(self, 0)
2307 }
2308
2309 #[doc = "This bit-field determines the battery temperature above which the charge current is zero, defining the \"Hot\" battery temperature zone. It ranges from minus 10C to 53C. The range is the same with the one defined in detail in TBAT_COLD bit-field."]
2310 #[inline(always)]
2311 pub fn tbat_hot(
2312 self,
2313 ) -> crate::common::RegisterField<
2314 18,
2315 0x3f,
2316 1,
2317 0,
2318 u8,
2319 u8,
2320 ChargerTempsetParamReg_SPEC,
2321 crate::common::RW,
2322 > {
2323 crate::common::RegisterField::<
2324 18,
2325 0x3f,
2326 1,
2327 0,
2328 u8,
2329 u8,
2330 ChargerTempsetParamReg_SPEC,
2331 crate::common::RW,
2332 >::from_register(self, 0)
2333 }
2334
2335 #[doc = "This bit-field determines the battery temperature above which the charge current is reduced, defining the \"Warm\" temperature zone. It ranges from minus 10C to 53C. The range is the same with the one defined in detail in TBAT_COLD bit-field."]
2336 #[inline(always)]
2337 pub fn tbat_warm(
2338 self,
2339 ) -> crate::common::RegisterField<
2340 12,
2341 0x3f,
2342 1,
2343 0,
2344 u8,
2345 u8,
2346 ChargerTempsetParamReg_SPEC,
2347 crate::common::RW,
2348 > {
2349 crate::common::RegisterField::<
2350 12,
2351 0x3f,
2352 1,
2353 0,
2354 u8,
2355 u8,
2356 ChargerTempsetParamReg_SPEC,
2357 crate::common::RW,
2358 >::from_register(self, 0)
2359 }
2360
2361 #[doc = "This bit-field determines the battery temperature below which the charge current is reduced, defining the \"Cool\" temperature zone. It ranges from minus 10C to 53C and the range is the same with the one defined in TBAT_COLD bit-field."]
2362 #[inline(always)]
2363 pub fn tbat_cool(
2364 self,
2365 ) -> crate::common::RegisterField<
2366 6,
2367 0x3f,
2368 1,
2369 0,
2370 u8,
2371 u8,
2372 ChargerTempsetParamReg_SPEC,
2373 crate::common::RW,
2374 > {
2375 crate::common::RegisterField::<
2376 6,
2377 0x3f,
2378 1,
2379 0,
2380 u8,
2381 u8,
2382 ChargerTempsetParamReg_SPEC,
2383 crate::common::RW,
2384 >::from_register(self, 0)
2385 }
2386
2387 #[doc = "This bit-field determines the battery temperature below which the charge current is zero, defining the \"Cold\" temperature zone. It ranges from minus 10C to 53C, according to the following encoding:\n0 : -10 C\n1 : -9 C\n2 : -8 C\n3 : -7 C\n4 : -6 C\n5 : -5 C\n6 : -4 C\n7 : -3 C\n8 : -2 C\n9 : -1 C\n10 : 0 C\n11 : 1 C\n12 : 2 C\n13 : 3 C\n14 : 4 C\n15 : 5 C\n16 : 6 C\n17 : 7 C\n18 : 8 C\n19 : 9 C\n20 : 10 C\n21 : 11 C\n22 : 12 C\n23 : 13 C\n24 : 14 C\n25 : 15 C\n26 : 16 C\n27 : 17 C\n28 : 18 C\n29 : 19 C\n30 : 20 C\n31 : 21 C\n32 : 22 C\n33 : 23 C\n34 : 24 C\n35 : 25 C\n36 : 26 C\n37 : 27 C\n38 : 28 C\n39 : 29 C\n40 : 30 C\n41 : 31 C\n42 : 32 C\n43 : 33 C\n44 : 34 C\n45 : 35 C\n46 : 36 C\n47 : 37 C\n48 : 38 C\n49 : 39 C\n50 : 40 C\n51 : 41 C\n52 : 42 C\n53 : 43 C\n54 : 44 C\n55 : 45 C\n56 : 46 C\n57 : 47 C\n58 : 48 C\n59 : 49 C\n60 : 50 C\n61 : 51 C\n62 : 52 C\n63 : 53 C"]
2388 #[inline(always)]
2389 pub fn tbat_cold(
2390 self,
2391 ) -> crate::common::RegisterField<
2392 0,
2393 0x3f,
2394 1,
2395 0,
2396 u8,
2397 u8,
2398 ChargerTempsetParamReg_SPEC,
2399 crate::common::RW,
2400 > {
2401 crate::common::RegisterField::<
2402 0,
2403 0x3f,
2404 1,
2405 0,
2406 u8,
2407 u8,
2408 ChargerTempsetParamReg_SPEC,
2409 crate::common::RW,
2410 >::from_register(self, 0)
2411 }
2412}
2413impl ::core::default::Default for ChargerTempsetParamReg {
2414 #[inline(always)]
2415 fn default() -> ChargerTempsetParamReg {
2416 <crate::RegValueT<ChargerTempsetParamReg_SPEC> as RegisterValue<_>>::new(64935178)
2417 }
2418}
2419
2420#[doc(hidden)]
2421#[derive(Copy, Clone, Eq, PartialEq)]
2422pub struct ChargerThotCompTimerReg_SPEC;
2423impl crate::sealed::RegSpec for ChargerThotCompTimerReg_SPEC {
2424 type DataType = u32;
2425}
2426
2427#[doc = "Battery temperature comparator timer for \"Hot\" zone"]
2428pub type ChargerThotCompTimerReg = crate::RegValueT<ChargerThotCompTimerReg_SPEC>;
2429
2430impl ChargerThotCompTimerReg {
2431 #[doc = "Returns the battery temperature comparator\'s timer dedicated for the \"Hot\" level."]
2432 #[inline(always)]
2433 pub fn thot_comp_timer(
2434 self,
2435 ) -> crate::common::RegisterField<
2436 16,
2437 0x3ff,
2438 1,
2439 0,
2440 u16,
2441 u16,
2442 ChargerThotCompTimerReg_SPEC,
2443 crate::common::R,
2444 > {
2445 crate::common::RegisterField::<
2446 16,
2447 0x3ff,
2448 1,
2449 0,
2450 u16,
2451 u16,
2452 ChargerThotCompTimerReg_SPEC,
2453 crate::common::R,
2454 >::from_register(self, 0)
2455 }
2456
2457 #[doc = "Charger\'s battery temperature comparator settling time (specified in us), specifically for the Hot temperature zone. The charger\'s digital block uses a dedicated timer to sample the specific comparator\'s output. The comparator\'s output is latched as soon as the timer expires, reaching 0. Then, the timer is reloaded with the settling time value and starts-over again\nNote: The specific bit-field should be always set to a non-zero value."]
2458 #[inline(always)]
2459 pub fn thot_comp_settling(
2460 self,
2461 ) -> crate::common::RegisterField<
2462 0,
2463 0x3ff,
2464 1,
2465 0,
2466 u16,
2467 u16,
2468 ChargerThotCompTimerReg_SPEC,
2469 crate::common::RW,
2470 > {
2471 crate::common::RegisterField::<
2472 0,
2473 0x3ff,
2474 1,
2475 0,
2476 u16,
2477 u16,
2478 ChargerThotCompTimerReg_SPEC,
2479 crate::common::RW,
2480 >::from_register(self, 0)
2481 }
2482}
2483impl ::core::default::Default for ChargerThotCompTimerReg {
2484 #[inline(always)]
2485 fn default() -> ChargerThotCompTimerReg {
2486 <crate::RegValueT<ChargerThotCompTimerReg_SPEC> as RegisterValue<_>>::new(99)
2487 }
2488}
2489
2490#[doc(hidden)]
2491#[derive(Copy, Clone, Eq, PartialEq)]
2492pub struct ChargerTotalChargeTimerReg_SPEC;
2493impl crate::sealed::RegSpec for ChargerTotalChargeTimerReg_SPEC {
2494 type DataType = u32;
2495}
2496
2497#[doc = "Maximum total charge time limit register"]
2498pub type ChargerTotalChargeTimerReg = crate::RegValueT<ChargerTotalChargeTimerReg_SPEC>;
2499
2500impl ChargerTotalChargeTimerReg {
2501 #[doc = "Returns the current value of the overall charge timeout counter, running at a 1Hz clock. This timer has been set to 16 bits, so that it can count up to 10.5 hours, and ranges from 0 to MAX_TOTAL_CHARGE_TIME. It is reset to 0 when the Charger\'s FSM is either in DISABLED or in END_OF_CHARGE state."]
2502 #[inline(always)]
2503 pub fn total_charge_timer(
2504 self,
2505 ) -> crate::common::RegisterField<
2506 16,
2507 0xffff,
2508 1,
2509 0,
2510 u16,
2511 u16,
2512 ChargerTotalChargeTimerReg_SPEC,
2513 crate::common::R,
2514 > {
2515 crate::common::RegisterField::<
2516 16,
2517 0xffff,
2518 1,
2519 0,
2520 u16,
2521 u16,
2522 ChargerTotalChargeTimerReg_SPEC,
2523 crate::common::R,
2524 >::from_register(self, 0)
2525 }
2526
2527 #[doc = "This bit-field determines the maximum overall charging time allowed (measured in ticks of the 1Hz clock). If this is exceeded, a total charge time-out error will be captured by the Charger\'s controller and its FSM will move to the ERROR state. An IRQ will be also generated if the respective IRQ mask bit of CHARGER_ERROR_IRQ_MASK_REG is already set. In order to to exit this state, the \"CHARGER_RESUME\" bit-field of CHARGER_CTRL_REG must be set, to enable the Charger\'s FSM switch from ERROR to DISABLED state and start-over.\nNote: The specific bit-field should be always set to a non-zero value."]
2528 #[inline(always)]
2529 pub fn max_total_charge_time(
2530 self,
2531 ) -> crate::common::RegisterField<
2532 0,
2533 0xffff,
2534 1,
2535 0,
2536 u16,
2537 u16,
2538 ChargerTotalChargeTimerReg_SPEC,
2539 crate::common::RW,
2540 > {
2541 crate::common::RegisterField::<
2542 0,
2543 0xffff,
2544 1,
2545 0,
2546 u16,
2547 u16,
2548 ChargerTotalChargeTimerReg_SPEC,
2549 crate::common::RW,
2550 >::from_register(self, 0)
2551 }
2552}
2553impl ::core::default::Default for ChargerTotalChargeTimerReg {
2554 #[inline(always)]
2555 fn default() -> ChargerTotalChargeTimerReg {
2556 <crate::RegValueT<ChargerTotalChargeTimerReg_SPEC> as RegisterValue<_>>::new(16200)
2557 }
2558}
2559
2560#[doc(hidden)]
2561#[derive(Copy, Clone, Eq, PartialEq)]
2562pub struct ChargerVbatCompTimerReg_SPEC;
2563impl crate::sealed::RegSpec for ChargerVbatCompTimerReg_SPEC {
2564 type DataType = u32;
2565}
2566
2567#[doc = "Main Vbat comparator timer register"]
2568pub type ChargerVbatCompTimerReg = crate::RegValueT<ChargerVbatCompTimerReg_SPEC>;
2569
2570impl ChargerVbatCompTimerReg {
2571 #[doc = "Returns the current value of the timer used to determine when the output of the Vbat comparator (checking Vbat vs Pre_Charge and Replenish levels) must be sampled by the digital. As soon as the timer expires (down-counting to 0, starting from the value set in VBAT_COMP_SETTLING), the comparator\'s output is latched by the Charger\'s digital block and used by the FSM.\nNote: When the Charger\'s FSM is in BYPASSED state, this timer is kept to zero and the SW takes over. In this mode, the specific comparator checks the level of Vbat against the Pre-Charge level. Hence, SW can periodically sample the status of this comparator by reading the MAIN_VBAT_COMP_OUT bit-field of CHARGER_STATUS_REG, to determine if Vbat has exceeded the Pre-Charge level or not."]
2572 #[inline(always)]
2573 pub fn vbat_comp_timer(
2574 self,
2575 ) -> crate::common::RegisterField<
2576 16,
2577 0x3ff,
2578 1,
2579 0,
2580 u16,
2581 u16,
2582 ChargerVbatCompTimerReg_SPEC,
2583 crate::common::R,
2584 > {
2585 crate::common::RegisterField::<
2586 16,
2587 0x3ff,
2588 1,
2589 0,
2590 u16,
2591 u16,
2592 ChargerVbatCompTimerReg_SPEC,
2593 crate::common::R,
2594 >::from_register(self, 0)
2595 }
2596
2597 #[doc = "Settling time threshold (in us) for the Vbat comparator checking Vbat vs the programmed Pre-Charge and Replenish levels. The settings (voltage levels) of the comparator are controlled by the digital block of the Charger and they are driven based on the state of the main FSM (PRE_CHARGE, END_OF_CHARGE)."]
2598 #[inline(always)]
2599 pub fn vbat_comp_settling(
2600 self,
2601 ) -> crate::common::RegisterField<
2602 0,
2603 0x3ff,
2604 1,
2605 0,
2606 u16,
2607 u16,
2608 ChargerVbatCompTimerReg_SPEC,
2609 crate::common::RW,
2610 > {
2611 crate::common::RegisterField::<
2612 0,
2613 0x3ff,
2614 1,
2615 0,
2616 u16,
2617 u16,
2618 ChargerVbatCompTimerReg_SPEC,
2619 crate::common::RW,
2620 >::from_register(self, 0)
2621 }
2622}
2623impl ::core::default::Default for ChargerVbatCompTimerReg {
2624 #[inline(always)]
2625 fn default() -> ChargerVbatCompTimerReg {
2626 <crate::RegValueT<ChargerVbatCompTimerReg_SPEC> as RegisterValue<_>>::new(99)
2627 }
2628}
2629
2630#[doc(hidden)]
2631#[derive(Copy, Clone, Eq, PartialEq)]
2632pub struct ChargerVoltageParamReg_SPEC;
2633impl crate::sealed::RegSpec for ChargerVoltageParamReg_SPEC {
2634 type DataType = u32;
2635}
2636
2637#[doc = "Charger voltage settings register"]
2638pub type ChargerVoltageParamReg = crate::RegValueT<ChargerVoltageParamReg_SPEC>;
2639
2640impl ChargerVoltageParamReg {
2641 #[doc = "This bit-field determines the VBAT Over-voltage protection limit. This Over-voltage protection level is used by the Charger\'s analogue circuitry and specifically by a dedicated comparator, the output of which is sampled by the digital block of the Charger. As soon as VBAT is detected to have reached or exceeded this level, the Charger\'s FSM moves to ERROR state, interrupting charging. If the respective Error IRQ mask bit is set, an Error IRQ pulse will be also generated.\nRegarding the actual range of supported values for this bit-field, see the the description of V_CHARGE bit-field of this register."]
2642 #[inline(always)]
2643 pub fn v_ovp(
2644 self,
2645 ) -> crate::common::RegisterField<
2646 18,
2647 0x3f,
2648 1,
2649 0,
2650 u8,
2651 u8,
2652 ChargerVoltageParamReg_SPEC,
2653 crate::common::RW,
2654 > {
2655 crate::common::RegisterField::<
2656 18,
2657 0x3f,
2658 1,
2659 0,
2660 u8,
2661 u8,
2662 ChargerVoltageParamReg_SPEC,
2663 crate::common::RW,
2664 >::from_register(self, 0)
2665 }
2666
2667 #[doc = "This bit-field determines the absolute value (in V) of the Replenish voltage threshold. As soon as charging has been completed and the Charger\'s FSM has reached the END_OF_CHARGE state, the respective analogue comparator of the Charger compares VBAT with the Replenish level. If VBAT is found to have dropped below this level, charging should start-over again and in that case, the FSM moves again to the PRE_CHARGE state.\nRegarding the supported Replenish voltage levels, see the description of V_CHARGE bit-field."]
2668 #[inline(always)]
2669 pub fn v_replenish(
2670 self,
2671 ) -> crate::common::RegisterField<
2672 12,
2673 0x3f,
2674 1,
2675 0,
2676 u8,
2677 u8,
2678 ChargerVoltageParamReg_SPEC,
2679 crate::common::RW,
2680 > {
2681 crate::common::RegisterField::<
2682 12,
2683 0x3f,
2684 1,
2685 0,
2686 u8,
2687 u8,
2688 ChargerVoltageParamReg_SPEC,
2689 crate::common::RW,
2690 >::from_register(self, 0)
2691 }
2692
2693 #[doc = "This bit-field determines the voltage level at which the battery is considered as Pre-charged and therefore the Charger\'s FSM should move to the CC_CHARGE state, entering the Constant Current charging phase.\nRegarding the supported Pre-Charge voltage levels, see also the description of V_CHARGE bit-field of this register."]
2694 #[inline(always)]
2695 pub fn v_precharge(
2696 self,
2697 ) -> crate::common::RegisterField<
2698 6,
2699 0x3f,
2700 1,
2701 0,
2702 u8,
2703 u8,
2704 ChargerVoltageParamReg_SPEC,
2705 crate::common::RW,
2706 > {
2707 crate::common::RegisterField::<
2708 6,
2709 0x3f,
2710 1,
2711 0,
2712 u8,
2713 u8,
2714 ChargerVoltageParamReg_SPEC,
2715 crate::common::RW,
2716 >::from_register(self, 0)
2717 }
2718
2719 #[doc = "This bit-field determines the charge voltage levels supported. The supported levels are determined according to the following encoding:\n0 : 2.80V\n1 : 2.85V\n2 : 2.90V\n3 : 2.95V\n4 : 3.00V\n5 : 3.05V\n6 : 3.10V\n7 : 3.15V\n8 : 3.20V\n9 : 3.25V\n10 : 3.30V\n11 : 3.35V\n12 : 3.40V\n13 : 3.45V\n14 : 3.50V\n15 : 3.55V\n16 : 3.60V\n17 : 3.65V\n18 : 3.70V\n19 : 3.75V\n20 : 3.80V\n21 : 3.82V\n22 : 3.84V\n23 : 3.86V\n24 : 3.88V\n25 : 3.90V\n26 : 3.92V\n27 : 3.94V\n28 : 3.96V\n29 : 3.98V\n30 : 4.00V\n31 : 4.02V\n32 : 4.04V\n33 : 4.06V\n34 : 4.08V\n35 : 4.10V\n36 : 4.12V\n37 : 4.14V\n38 : 4.16V\n39 : 4.18V\n40 : 4.20V\n41 : 4.22V\n42 : 4.24V\n43 : 4.26V\n44 : 4.28V\n45 : 4.30V\n46 : 4.32V\n47 : 4.34V\n48 : 4.36V\n49 : 4.38V\n50 : 4.40V\n51 : 4.42V\n52 : 4.44V\n53 : 4.46V\n54 : 4.48V\n55 : 4.50V\n56 : 4.52V\n57 : 4.54V\n58 : 4.56V\n59 : 4.58V\n60 : 4.60V\n61 : 4.70V\n62 : 4.80V\n63 : 4.90V*\nIt has to be noted that the specific values correspond to the normal battery temperature zone. However, the specific register field may be updated by the JEITA FSM (which checks the battery temperature either once or periodically), in order to adapt the charge voltage to the battery temperature zone (see also CHARGER_CTRL_REG.TBAT_MONITOR_MODE field as well). This is valid also for the other three fields of the current register. Consequently, in that case the register returns the Charge voltage settings that abide to the JEITA requirements for the battery (either COOL, WARM or NORMAL).\nNote: Option \"63\" (4.90V) is not supported for V_CHARGE, V_PRECHARGE and V_REPLENISH bit-fields (and respective levels). It should be used only in the V_OVP bit-field, as the (maximum) Over-voltage protection level."]
2720 #[inline(always)]
2721 pub fn v_charge(
2722 self,
2723 ) -> crate::common::RegisterField<
2724 0,
2725 0x3f,
2726 1,
2727 0,
2728 u8,
2729 u8,
2730 ChargerVoltageParamReg_SPEC,
2731 crate::common::RW,
2732 > {
2733 crate::common::RegisterField::<
2734 0,
2735 0x3f,
2736 1,
2737 0,
2738 u8,
2739 u8,
2740 ChargerVoltageParamReg_SPEC,
2741 crate::common::RW,
2742 >::from_register(self, 0)
2743 }
2744}
2745impl ::core::default::Default for ChargerVoltageParamReg {
2746 #[inline(always)]
2747 fn default() -> ChargerVoltageParamReg {
2748 <crate::RegValueT<ChargerVoltageParamReg_SPEC> as RegisterValue<_>>::new(13242923)
2749 }
2750}
2751
2752#[doc(hidden)]
2753#[derive(Copy, Clone, Eq, PartialEq)]
2754pub struct ChargerVovpCompTimerReg_SPEC;
2755impl crate::sealed::RegSpec for ChargerVovpCompTimerReg_SPEC {
2756 type DataType = u32;
2757}
2758
2759#[doc = "Vbat OVP comparator timer register"]
2760pub type ChargerVovpCompTimerReg = crate::RegValueT<ChargerVovpCompTimerReg_SPEC>;
2761
2762impl ChargerVovpCompTimerReg {
2763 #[doc = "The specific bit-field determines the current state of the timer used to periodically check the output of the Over-Voltage Protection comparator\'s output signal, as soon as the Charger\'s FSM reaches any of the charging states (PRE/CC/CV_CHARGE).\nWhen this happens, the timer starts ticking with the 1Mhz clock, ranging from 0 up to the programmed interval threshold (see also OVP_INTERVAL_CHECK_THRES field). As soon as this timer reaches the programmed threshold value, the Vbat OVP comparator\'s output is evaluated, increasing or not the counter keeping the consecutive OVP events. It is noted that out of the charging states, the specific timer is kept frozen to zero, not counting.\nNote : See also the OVP_OCCURRENCES_CNT bit-field of CHARGER_STATUS_REG for the consecutive OVP events counter."]
2764 #[inline(always)]
2765 pub fn ovp_interval_check_timer(
2766 self,
2767 ) -> crate::common::RegisterField<
2768 26,
2769 0x3f,
2770 1,
2771 0,
2772 u8,
2773 u8,
2774 ChargerVovpCompTimerReg_SPEC,
2775 crate::common::R,
2776 > {
2777 crate::common::RegisterField::<
2778 26,
2779 0x3f,
2780 1,
2781 0,
2782 u8,
2783 u8,
2784 ChargerVovpCompTimerReg_SPEC,
2785 crate::common::R,
2786 >::from_register(self, 0)
2787 }
2788
2789 #[doc = "Returns the current value of the timer used to determine when the Vbat Over-Voltage protection (OVP) comparator\'s output must be sampled by the digital. As soon as the timer expires (down-counting to 0, starting from VBAT_OVP_COMP_SETTLING), the comparator\'s output is latched by the Charger\'s digital block and used by the main FSM.\nNote: When the Charger\'s FSM is in BYPASSED state, this timer is kept to zero and the SW takes over, sampling the status of the VBAT_OVP_COMP_OUT bit-field of CHARGER_STATUS_REG to determine if the Vbat has exceeded the OVP limit."]
2790 #[inline(always)]
2791 pub fn vbat_ovp_comp_timer(
2792 self,
2793 ) -> crate::common::RegisterField<
2794 16,
2795 0x3ff,
2796 1,
2797 0,
2798 u16,
2799 u16,
2800 ChargerVovpCompTimerReg_SPEC,
2801 crate::common::R,
2802 > {
2803 crate::common::RegisterField::<
2804 16,
2805 0x3ff,
2806 1,
2807 0,
2808 u16,
2809 u16,
2810 ChargerVovpCompTimerReg_SPEC,
2811 crate::common::R,
2812 >::from_register(self, 0)
2813 }
2814
2815 #[doc = "This bit-field determines the periodic interval of checking the dedicated Vbat OVP comparator\'s output, when the Charger\'s FSM is in any of the charging states (PRE/CC/CV_CHARGE). The implementation is based on a dedicated timer, counting from zero up to the value programmed into this bit-field (see also OVP_INTERVAL_CHECK_TIMER field\'s description) and only when the FSM is in any of the three charging states. Out of these states, the timer is kept frozen to zero.\nAs soon as this timer reaches the programmed threshold, the Vbat OVP comparator\'s output is sampled and depending on its level, (high or low), another counter, keeping the number of consecutive OVP events, is increased or not. The programmed threshold value should always be non-zero.\nNote: See also the OVP_DEBOUNCE_CNT bit-field of CHARGER_STATUS_REG, for the consecutive OVP events counter."]
2816 #[inline(always)]
2817 pub fn ovp_interval_check_thres(
2818 self,
2819 ) -> crate::common::RegisterField<
2820 10,
2821 0x3f,
2822 1,
2823 0,
2824 u8,
2825 u8,
2826 ChargerVovpCompTimerReg_SPEC,
2827 crate::common::RW,
2828 > {
2829 crate::common::RegisterField::<
2830 10,
2831 0x3f,
2832 1,
2833 0,
2834 u8,
2835 u8,
2836 ChargerVovpCompTimerReg_SPEC,
2837 crate::common::RW,
2838 >::from_register(self, 0)
2839 }
2840
2841 #[doc = "Settling time threshold (in us) for the Vbat comparator checking Vbat vs the programmed Over-Voltage level."]
2842 #[inline(always)]
2843 pub fn vbat_ovp_comp_settling(
2844 self,
2845 ) -> crate::common::RegisterField<
2846 0,
2847 0x3ff,
2848 1,
2849 0,
2850 u16,
2851 u16,
2852 ChargerVovpCompTimerReg_SPEC,
2853 crate::common::RW,
2854 > {
2855 crate::common::RegisterField::<
2856 0,
2857 0x3ff,
2858 1,
2859 0,
2860 u16,
2861 u16,
2862 ChargerVovpCompTimerReg_SPEC,
2863 crate::common::RW,
2864 >::from_register(self, 0)
2865 }
2866}
2867impl ::core::default::Default for ChargerVovpCompTimerReg {
2868 #[inline(always)]
2869 fn default() -> ChargerVovpCompTimerReg {
2870 <crate::RegValueT<ChargerVovpCompTimerReg_SPEC> as RegisterValue<_>>::new(64611)
2871 }
2872}