- # Before populating array, zero pointer, set notional carrier state (off).
- def transmit(self, addr, data, toggle=0): # NEC: toggle is unused
- self.aptr = 0 # Inital conditions for tx: index into array
- self.carrier = False
- self.tx(addr, data, toggle)
- self.append(STOP)
- self.aptr = 0 # Reset pointer
- self.cb(self._tim) # Initiate physical transmission.
-
- # Turn IR LED off (pyboard and ESP32 variants)
- def pb_off(self):
- self._ch.pulse_width_percent(_SPACE)
-
- def esp_off(self):
- self._pwm.duty(_SPACE)
-
- # Turn IR LED on or off and re-initialise timer (pyboard and ESP32 variants)
- @micropython.native
- def pb_onoff(self, p, v):
- self._ch.pulse_width_percent(_SPACE if p & 1 else self._duty)
- self._tim.init(prescaler=84, period=v, callback=self._tcb)
-
- @micropython.native
- def esp_onoff(self, p, v):
- self._pwm.duty(_SPACE if p & 1 else self._duty)
- self._tim.init(mode=Timer.ONE_SHOT, freq=v, callback=self.cb)
-
- def cb(self, t): # T5 callback, generate a carrier mark or space