Skip to content

pulseio.PWMOuts share duty cycle values when many of them are created #1106

@deshipu

Description

@deshipu

I tested it with the following code on my custom board:

=== ROWS = (
===     pulseio.PWMOut(board.R8, frequency=200000),
===     pulseio.PWMOut(board.R7, frequency=200000),
===     pulseio.PWMOut(board.R6, frequency=200000),
===     pulseio.PWMOut(board.R5, frequency=200000),
===     pulseio.PWMOut(board.R4, frequency=200000),
===     pulseio.PWMOut(board.R3, frequency=200000),
===     pulseio.PWMOut(board.R2, frequency=200000),
===     pulseio.PWMOut(board.R1, frequency=200000),
=== )
=== 
>>> ROWS[4].duty_cycle
0
>>> ROWS[6].duty_cycle
0
>>> ROWS[6].duty_cycle = 500
>>> ROWS[6].duty_cycle
274
>>> ROWS[4].duty_cycle
274

Where the pins are:

    { MP_ROM_QSTR(MP_QSTR_R1),  MP_ROM_PTR(&pin_PA14) },
    { MP_ROM_QSTR(MP_QSTR_R2),  MP_ROM_PTR(&pin_PA19) },
    { MP_ROM_QSTR(MP_QSTR_R3),  MP_ROM_PTR(&pin_PA05) },
    { MP_ROM_QSTR(MP_QSTR_R4),  MP_ROM_PTR(&pin_PA17) },
    { MP_ROM_QSTR(MP_QSTR_R5),  MP_ROM_PTR(&pin_PA11) },
    { MP_ROM_QSTR(MP_QSTR_R6),  MP_ROM_PTR(&pin_PA04) },
    { MP_ROM_QSTR(MP_QSTR_R7),  MP_ROM_PTR(&pin_PA10) },
    { MP_ROM_QSTR(MP_QSTR_R8),  MP_ROM_PTR(&pin_PA00) },

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions