Python LT8900 via SPI

Check-in [59690c8273]
Login

Check-in [59690c8273]

Overview
Comment:Also reset radio if there is 0-sized packets
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 59690c827356225f1319fb3c99a2ef37487704b3e0a244cf024e3d88b51fe974
User & Date: rkeene on 2020-04-29 22:53:57
Other Links: manifest | tags
Context
2020-04-30
03:29
lt8900_spi v2.2 check-in: ef0aed0308 user: rkeene tags: 2.2, trunk
2020-04-29
22:53
Also reset radio if there is 0-sized packets check-in: 59690c8273 user: rkeene tags: trunk
00:52
lt8900_spi v2.1 check-in: abda0e48a2 user: rkeene tags: 2.1, trunk
Changes

Modified lt8900_spi/__init__.py from [df06239930] to [640dc549d5].

540
541
542
543
544
545
546

547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563




564
565
566
567
568
569
570

			self.start_listening(channel)

		message = []

		while True:
			radio_status = self.get_register_bits('status')

			if radio_status['packet_flag'] == 0:
				if wait:
					time.sleep(wait_time)
					continue
				else:
					return None

			if radio_status['crc_error'] == 1:
				# Handle invalid packet ?
				self.start_listening(channel)
				continue

			# Data is available, read it from the FIFO register
			# The first result will include the length
			# XXX *IF* length encoding is enabled ?
			fifo_data = self.get_register('fifo')
			message_length = fifo_data >> 8





			# Keep track of the total message length to truncate it
			final_message_length = message_length

			message += [fifo_data & 0xff]
			message_length -= 1








>

















>
>
>
>







540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575

			self.start_listening(channel)

		message = []

		while True:
			radio_status = self.get_register_bits('status')
			self._debug("radio_status={}".format(radio_status))
			if radio_status['packet_flag'] == 0:
				if wait:
					time.sleep(wait_time)
					continue
				else:
					return None

			if radio_status['crc_error'] == 1:
				# Handle invalid packet ?
				self.start_listening(channel)
				continue

			# Data is available, read it from the FIFO register
			# The first result will include the length
			# XXX *IF* length encoding is enabled ?
			fifo_data = self.get_register('fifo')
			message_length = fifo_data >> 8

			if message_length == 0:
				self.start_listening(channel)
				continue

			# Keep track of the total message length to truncate it
			final_message_length = message_length

			message += [fifo_data & 0xff]
			message_length -= 1