X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=spi%2Fnrf24l01%2Fgen-testfiles.py;h=906c025ab3ad11279841eff583da6622af32fef5;hb=8c015267432b669d304c32d418cd79534fb36a35;hp=5b14e438a6b7a5fd5533b57d5f9a4f4934f7deff;hpb=aeada8ac42252c76cca250008a980bf4bab7b48f;p=sigrok-dumps.git diff --git a/spi/nrf24l01/gen-testfiles.py b/spi/nrf24l01/gen-testfiles.py index 5b14e43..906c025 100755 --- a/spi/nrf24l01/gen-testfiles.py +++ b/spi/nrf24l01/gen-testfiles.py @@ -15,8 +15,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 . ## ## This script generates test cases for the nrf24l01 protocol decoder. @@ -40,8 +39,8 @@ class SPI: def add(self, mosi, miso): for _ in range(8): - mo = mosi & 0x80 - mi = miso & 0x80 + mo = (mosi & 0x80) >> 7 + mi = (miso & 0x80) >> 7 mosi <<= 1 miso <<= 1 self._data.append([0, 0, mo, mi]) @@ -57,7 +56,7 @@ class SPI: w.writerows(self._data) fn = '{}.sr'.format(self._filename) - I = 'csv:header=true:samplerate=1k' + I = 'csv:header=true:samplerate=1000' subprocess.check_call(['sigrok-cli', '-I', I, '-i', tf.name, '-o', fn]) spi = SPI('nrf24l01-test-activate') @@ -187,3 +186,12 @@ for i in range(5): spi.add(i, 0x00) spi.CShigh() spi.write() + +spi = SPI('nrf24l01-test-incomplete-cmd') +spi.add(0xff, 0xff) # some bytes from a command +spi.add(0xff, 0xff) # that was captured incompletely +spi.CShigh() +spi.CSlow() +spi.add(0xe1, 0x00) # FLUSH_TX +spi.CShigh() +spi.write()