X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=decoders%2Fnrf24l01%2Fpd.py;h=4dd9451e345693c843a93d231c2ab1d57821df46;hb=2787cf2abc0187679e87d3735ca3e64c2a1a91c8;hp=b026f598f9aeafcc62f42cd5d061688785c823be;hpb=8a110ab1ea46d89d36a610e4249fe1eabed27757;p=libsigrokdecode.git diff --git a/decoders/nrf24l01/pd.py b/decoders/nrf24l01/pd.py index b026f59..4dd9451 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 @@ -53,15 +52,26 @@ regs = { 0x1d: ('FEATURE', 1), } +xn297_regs = { + 0x19: ('DEMOD_CAL', 5), + 0x1e: ('RF_CAL', 7), + 0x1f: ('BB_CAL', 5), +} + class Decoder(srd.Decoder): - api_version = 2 + api_version = 3 id = 'nrf24l01' name = 'nRF24L01(+)' - longname = 'Nordic Semiconductor nRF24L01/nRF24L01+' - desc = '2.4GHz transceiver chip.' + longname = 'Nordic Semiconductor nRF24L01(+)' + desc = '2.4GHz RF transceiver chip.' license = 'gplv2+' inputs = ['spi'] outputs = ['nrf24l01'] + tags = ['IC', 'Wireless/RF'] + options = ( + {'id': 'chip', 'desc': 'Chip type', + 'default': 'nrf24l01', 'values': ('nrf24l01', 'xn297')}, + ) annotations = ( # Sent from the host to the chip. ('cmd', 'Commands sent to the device'), @@ -84,13 +94,18 @@ 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['chip'] == 'xn297': + regs.update(xn297_regs) def warn(self, pos, msg): '''Put a warning message 'msg' at 'pos'.'''