X-Git-Url: https://vault307.fbx.one/gitweb/micorpython_ir.git/blobdiff_plain/12683170548778e5d933f2f2052164547cc15113..7156dff5bcd19a1debf7db1ffd4add94e010c66f:/TRANSMITTER.md diff --git a/TRANSMITTER.md b/TRANSMITTER.md index 7a70cca..c76995b 100644 --- a/TRANSMITTER.md +++ b/TRANSMITTER.md @@ -16,7 +16,16 @@ are arbitrary: X3 and X4 are used. The driver uses timers 2 and 5. On ESP32 the demo uses pin 23 for IR output and pins 18 and 19 for pushbuttons. These pins may be changed. The only device resource used is `RMT(0)`. -## 1.1 Pyboard Wiring +On Raspberry Pi Pico the demo uses pin 17 for IR output and pins 18 and 19 for +pushbuttons. These pins may be changed. The driver uses the PIO to emulate a +device similar to the ESP32 RMT. The device driver is +[documented here](./RP2_RMT.md); this is for experimenters and those wanting to +use the library in conjunction with their own PIO assembler code. + +## 1.1 Wiring + +All microcontrollers require an external circuit to drive the LED. The notes +below on specific microcontrollers assume that such a circuit is used. I use the following circuit which delivers just under 40mA to the diode. R2 may be reduced for higher current. @@ -41,13 +50,19 @@ updated to use it. The same circuits as above may be used to connect to pin 23 available on the ESP32 `RMT` object, so any alternative circuit must illuminate the LED if the pin state is high. +## 1.3 RP2 Wiring + +There is no `active_high` option so the circuit must illuminate the LED if the +pin state is high, as per the above drivers. Test programs use pin 17, but this +can be reassigned. + # 2. Dependencies and installation ## 2.1 Dependencies The device driver has no dependencies. -On ESP32 a firmware version >= V1.14 is required. The Loboris port is not +On ESP32 a firmware version >= V1.17 is required. The Loboris port is not supported owing to the need for the RMT device and other issues. The demo program uses `uasyncio` primitives from @@ -80,7 +95,8 @@ Instructions will be displayed at the REPL. # 3. The driver -This is specific to Pyboard D, Pyboard 1.x (not Lite) and ESP32. +This is specific to Pyboard D, Pyboard 1.x (not Lite), ESP32 and Raspberry Pi +Pico (RP2 architecture chip). It implements a class for each supported protocol, namely `NEC`, `SONY_12`, `SONY_15`, `SONY_20`, `RC5` and `RC6_M0`. Each class is subclassed from a @@ -101,6 +117,13 @@ from ir_tx.nec import NEC nec = NEC(Pin(23, Pin.OUT, value = 0)) nec.transmit(1, 2) # address == 1, data == 2 ``` +Basic usage on Pico: +```python +from machine import Pin +from ir_tx.nec import NEC +nec = NEC(Pin(17, Pin.OUT, value = 0)) +nec.transmit(1, 2) # address == 1, data == 2 +``` #### Common to all classes @@ -149,7 +172,7 @@ skipping validation. | RC6_M0 | 6.0ms | 2.0ms | | MCE | 6.7ms | 2.0ms | -#### NEC class +#### NEC class (also Samsung) Class `NEC`. Example invocation: ```python @@ -167,6 +190,16 @@ the complement for values < 256. A value passed in `toggle` is ignored. +For Samsung protocol set the `samsung` class variable `True`: +```python +from ir_tx.nec import NEC +NEC.samsung=True +``` +Samsung remotes do not seem to use repeat codes: the sample I have simply +repeats the original code. + +Thanks are due to J.E.Tannenbaum for information about the Samsung protocol. + #### Sony classes Classes `SONY_12`, `SONY_15` and `SONY_20`. Example invocation: