Python LT8900 via SPI

Check-in [b3c15d5abe]
Login

Check-in [b3c15d5abe]

Overview
Comment:Power setting improvements
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: b3c15d5abe6b89763d2db7c0c6e519eec4a900b3645ea43c43c7c24997296c53
User & Date: rkeene on 2020-08-27 17:07:16
Other Links: manifest | tags
Context
2021-01-26
22:14
Increase delay and log initialization error check-in: 772747db6a user: rkeene tags: trunk
2020-08-27
17:07
Power setting improvements check-in: b3c15d5abe user: rkeene tags: trunk
2020-05-17
21:15
lt8900_spi v2.5 check-in: 42edc1a846 user: rkeene tags: 2.5, trunk
Changes

Modified lt8900_spi/__init__.py from [f2420cc3ba] to [d0dcbf6c9f].

33
34
35
36
37
38
39
40

41
42
43
44

45





46
47
48
49
50
51
52
53
54
55
56
57
58
59
60

61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80

81
82
83
84
85
86
87
33
34
35
36
37
38
39

40
41
42
43
44
45

46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64

65
66
67
68
69
70
71
72
73









74
75

76
77
78
79
80
81
82
83







-
+




+
-
+
+
+
+
+














-
+








-
-
-
-
-
-
-
-
-


-
+







class Radio:
	_default_register_values = {
		'format_config': {
			'crc_enabled': 1,
			'scramble_enabled': 0,
			'packet_length_encoded': 1,
			'auto_term_tx': 1,
			'auto_ack': 0,
			'auto_ack': 1,
			'pkt_fifo_polarity': 0,
			'crc_initial_data': 0
		},
		'radio_state': {'tx_enabled': 0, 'rx_enabled': 0, 'channel': 76},
		'undocumented_power': {'value': 0x6c90},
		'power': {'current': 4, 'gain': 0},
		'power': {
			'current': 8,
			'reserved_1': 1,
			'gain': 0
		},
		'rssi_power': {'mode': 0},
		'crystal': {'trim_adjust': 0},
		'packet_config': {
			'preamble_len': 2,
			'syncword_len': 1,
			'trailer_len': 0,
			'packet_type': 0,
			'fec_type': 0,
			'br_clock_sel': 0
		},
		'chip_power': {
			'power_down': 0,
			'sleep_mode': 0,
			'br_clock_on_sleep': 0,
			'rexmit_times': 3,
			'rexmit_times': 10,
			'miso_tri_opt': 0,
			'scramble_value': 0
		},
		'thresholds': {
			'fifo_empty_threshold': 8,
			'fifo_full_threshold': 16,
			'syncword_error_bits': 2
		},
		'format_config': {
			'crc_enabled': 1,
			'scramble_enabled': 0,
			'packet_length_encoded': 1,
			'auto_term_tx': 1,
			'auto_ack': 0,
			'pkt_fifo_polarity': 0,
			'crc_initial_data': 0
		},
		'scan_rssi': {'channel': 63, 'ack_time': 176},
		'gain_block': {'enabled': 1},
		'vco_calibrate': {'enabled': 1},
		'vco_calibrate': {'enabled': 0},
		'scan_rssi_state': {'enabled': 0, 'channel_offset': 0, 'wait_time': 15}
	}
	_register_map = [
		{'name': "Unknown"}, # 0
		{'name': "Unknown"}, # 1
		{'name': "Unknown"}, # 2
		{                    # 3
100
101
102
103
104
105
106

107



108
109
110
111
112
113
114
96
97
98
99
100
101
102
103

104
105
106
107
108
109
110
111
112
113







+
-
+
+
+







		{                    # 7
			'name': "radio_state",
			'reserved_1': [9, 15],
			'tx_enabled': [8, 8],
			'rx_enabled': [7, 7],
			'channel': [0, 6]
		},
		{                   # 8
		{'name': "Unknown"}, # 8
			'name': "undocumented_power",
			'value': [0, 15]
		},
		{                    # 9
			'name': "power",
			'current': [12, 15],
			'reserved_1': [11, 11],
			'gain': [7, 10],
			'reserved_2': [0, 6]
		},
672
673
674
675
676
677
678
679
680

681
682
683
684
685
686
687
671
672
673
674
675
676
677


678
679
680
681
682
683
684
685







-
-
+








	def multi_transmit(self, message, channels, retries = 3, delay = 0.1, syncword = None, submit_queue = '__DEFAULT__', format_config = None):
		if len(channels) == 0 or retries == 0:
			self._error("Asked to send the message {} a total of zero times ({} channels, {} retries)".format(message, channels, retries))

		# Wait at-least 350 microseconds between frames
		min_delay = 350.0 / 1000000.0
		retry_delay = delay / retries
		post_delay = max(min_delay, retry_delay)
		post_delay = min_delay
		final_delay = delay

		for channel_idx in range(len(channels)):
			if channel_idx == (len(channels) - 1):
				retries -= 1
			channel = channels[channel_idx]
			for i in range(retries):