10000 Note behavior in documentation · tannewt/circuitpython@6782948 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6782948

Browse files
committed
Note behavior in documentation
1 parent 4b742f8 commit 6782948

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

shared-bindings/pulseio/PWMOut.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,11 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pulseio_pwmout___exit___obj, 4, 4, pu
162162
//| 16 bit value that dictates how much of one cycle is high (1) versus low
163163
//| (0). 0xffff will always be high, 0 will always be low and 0x7fff will
164164
//| be half high and then half low.
165+
//|
166+
//| Depending on how PWM is implemented on a specific board, the internal
167+
//| representation for duty cycle might have less than 16 bits of resolution.
168+
//| Reading this property will return the value from the internal representation,
169+
//| so it may differ from the value set.
165170
STATIC mp_obj_t pulseio_pwmout_obj_get_duty_cycle(mp_obj_t self_in) {
166171
pulseio_pwmout_obj_t *self = MP_OBJ_TO_PTR(self_in);
167172
check_for_deinit(self);
@@ -193,6 +198,12 @@ const mp_obj_property_t pulseio_pwmout_duty_cycle_obj = {
193198
//| 32 bit value that dictates the PWM frequency in Hertz (cycles per
194199
//| second). Only writeable when constructed with ``variable_frequency=True``.
195200
//|
201+
//| Depending on how PWM is implemented on a specific board, the internal value
202+
//| for the PWM's duty cycle may need to be recalculated when the frequency
203+
//| changes. In these cases, the duty cycle is automatically recalculated
204+
//| from the original duty cycle value. This should happen without any need
205+
//| to manually re-set the duty cycle.
206+
//|
196207
STATIC mp_obj_t pulseio_pwmout_obj_get_frequency(mp_obj_t self_in) {
197208
pulseio_pwmout_obj_t *self = MP_OBJ_TO_PTR(self_in);
198209
check_for_deinit(self);

0 commit comments

Comments
 (0)
0