## 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/>.
##
## This script generates test cases for the nrf24l01 protocol decoder.
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])
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')
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()