Python LT8900 via SPI

Diff
Login

Diff

Differences From Artifact [f2420cc3ba]:

To Artifact [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):