## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
-## along with this program; if not, write to the Free Software
-## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+## along with this program; if not, see <http://www.gnu.org/licenses/>.
##
import sigrokdecode as srd
pass
class Decoder(srd.Decoder):
- api_version = 2
+ api_version = 3
id = 'ir_rc5'
name = 'IR RC-5'
longname = 'IR RC-5'
self.edges, self.bits, self.ss_es_bits = [], [], []
self.state = 'IDLE'
- def decode(self, ss, es, data):
+ def decode(self):
if not self.samplerate:
raise SamplerateError('Cannot decode without samplerate.')
- for (self.samplenum, pins) in data:
+ while True:
- self.ir = pins[0]
+ (self.ir,) = self.wait()
# Wait for any edge (rising or falling).
if self.old_ir == self.ir:
# State machine.
if self.state == 'IDLE':
+ bit = 1
self.edges.append(self.samplenum)
- self.bits.append([self.samplenum, 1])
+ self.bits.append([self.samplenum, bit])
self.state = 'MID1'
self.old_ir = self.ir
continue