@@ -170,7 +170,7 @@ def pwm_on(self, t2_prescale, full_period, on_period):
170170 """Turns on the PWM generator with the given settings.
171171
172172 :param t2_prescale: One of T2_PS_1_1, T2_PS_1_4, T2_PS_1_16
173- Scales down the 4MHz instruction clock by
173+ Scales down the 12MHz instruction clock by
174174 1, 4 or 16.
175175 :param full_period: 8-bit value - which is scaled up to 10-bits
176176 (<< 2) - to which timer 2 will count up to
@@ -180,7 +180,7 @@ def pwm_on(self, t2_prescale, full_period, on_period):
180180 full_period to control duty cycle. For
181181 example:
182182
183- # 4MHz / 16 with 50% duty cycle
183+ # 12MHz / 16 with 50% duty cycle
184184 codebug.pwm_on(T2_PS_1_16, 0xff, 0x200)
185185
186186 """
@@ -203,14 +203,13 @@ def pwm_freq(self, frequency):
203203
204204 """
205205 # calculate pwm settings
206- # 4 MHz / 16 = 250k ticks per second
207- full_period = int (250000 / frequency ) - 1
206+ # 12MHz / 16 = 750k ticks per second
207+ full_period = int (750000 / frequency ) - 1
208208 # for 50% duty cycle: shift up by 2 then /(2 i.e. 50% duty cycle)
209209 # on_period = (full_period << 2) / 2;
210210 # this is quicker
211211 on_period = full_period << 1
212212 self .pwm_on (T2_PS_1_16 , full_period , on_period )
213- pass
214213
215214 def pwm_off (self ):
216215 go_busy_off_mask = 0xff ^ (1 << 4 )
0 commit comments