X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=decoders%2Fnrf24l01%2Fpd.py;h=221b968ea2ac0db672e2a5a30761120b16f86f3b;hb=3a67b032235e719dc4e74f735d1c95ef2d481a33;hp=f7299619b67a78850b030020ad8d141324e7289b;hpb=b03e2209d5e83e3c1b9737097b13109c7e4658c3;p=libsigrokdecode.git diff --git a/decoders/nrf24l01/pd.py b/decoders/nrf24l01/pd.py index f729961..221b968 100644 --- a/decoders/nrf24l01/pd.py +++ b/decoders/nrf24l01/pd.py @@ -14,8 +14,7 @@ ## 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 . ## import sigrokdecode as srd @@ -52,6 +51,7 @@ regs = { 0x1c: ('DYNPD', 1), 0x1d: ('FEATURE', 1), } + xn297_regs = { 0x19: ('DEMOD_CAL', 5), 0x1e: ('RF_CAL', 7), @@ -59,7 +59,7 @@ xn297_regs = { } class Decoder(srd.Decoder): - api_version = 2 + api_version = 3 id = 'nrf24l01' name = 'nRF24L01(+)' longname = 'Nordic Semiconductor nRF24L01/nRF24L01+' @@ -68,8 +68,8 @@ class Decoder(srd.Decoder): inputs = ['spi'] outputs = ['nrf24l01'] options = ( - {'id': 'xn297_extensions', 'desc': 'XN297 extensions', - 'default': 'disable', 'values': ('enable', 'disable')}, + {'id': 'chip', 'desc': 'Chip type', + 'default': 'nrf24l01', 'values': ('nrf24l01', 'xn297')}, ) annotations = ( # Sent from the host to the chip. @@ -93,14 +93,17 @@ class Decoder(srd.Decoder): ('warnings', 'Warnings', (ann_warn,)), ) - def __init__(self, **kwargs): + def __init__(self): + self.reset() + + def reset(self): self.next() self.requirements_met = True self.cs_was_released = False def start(self): self.out_ann = self.register(srd.OUTPUT_ANN) - if self.options['xn297_extensions'] == 'enable': + if self.options['chip'] == 'xn297': regs.update(xn297_regs) def warn(self, pos, msg):