Skip to content

Commit 7f1fcc7

Browse files
committed
ports/rp2: Add RP2350 slices to machine_pwm.
Signed-off-by: Phil Howard <phil@gadgetoid.com>
1 parent e62382b commit 7f1fcc7

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

ports/rp2/machine_pwm.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,20 @@ static machine_pwm_obj_t machine_pwm_obj[] = {
6767
{{&machine_pwm_type}, 6, PWM_CHAN_B, 0, DUTY_NOT_SET, 0 },
6868
{{&machine_pwm_type}, 7, PWM_CHAN_A, 0, DUTY_NOT_SET, 0 },
6969
{{&machine_pwm_type}, 7, PWM_CHAN_B, 0, DUTY_NOT_SET, 0 },
70+
#if NUM_PWM_SLICES == 12
71+
{{&machine_pwm_type}, 8, PWM_CHAN_A, 0, DUTY_NOT_SET, 0 },
72+
{{&machine_pwm_type}, 8, PWM_CHAN_B, 0, DUTY_NOT_SET, 0 },
73+
{{&machine_pwm_type}, 9, PWM_CHAN_A, 0, DUTY_NOT_SET, 0 },
74+
{{&machine_pwm_type}, 9, PWM_CHAN_B, 0, DUTY_NOT_SET, 0 },
75+
{{&machine_pwm_type}, 10, PWM_CHAN_A, 0, DUTY_NOT_SET, 0 },
76+
{{&machine_pwm_type}, 10, PWM_CHAN_B, 0, DUTY_NOT_SET, 0 },
77+
{{&machine_pwm_type}, 11, PWM_CHAN_A, 0, DUTY_NOT_SET, 0 },
78+
{{&machine_pwm_type}, 11, PWM_CHAN_B, 0, DUTY_NOT_SET, 0 },
79+
#endif
7080
};
7181

7282
static bool defer_start;
73-
static bool slice_freq_set[8];
83+
static bool slice_freq_set[NUM_PWM_SLICES];
7484

7585
static void mp_machine_pwm_freq_set(machine_pwm_obj_t *self, mp_int_t freq);
7686
static void mp_machine_pwm_duty_set_u16(machine_pwm_obj_t *self, mp_int_t duty_u16);
@@ -155,7 +165,7 @@ static mp_obj_t mp_machine_pwm_make_new(const mp_obj_type_t *type, size_t n_args
155165

156166
// Stop all active slices.
157167
void machine_pwm_deinit_all(void) {
158-
for (int i = 0; i < 8; i++) {
168+
for (int i = 0; i < NUM_PWM_SLICES; i++) {
159169
slice_freq_set[i] = false;
160170
pwm_set_enabled(machine_pwm_obj[i].slice, false);
161171
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy