sta5635.h
Go to the documentation of this file.
1 /**************************************************************************/ /**
2  * @brief Command/control support for an attached STA5635 RF front-end.
3  * @file
4  ******************************************************************************/
5 
6 #pragma once
7 
10 
11 namespace point_one {
12 namespace fusion_engine {
13 namespace messages {
14 
15 // Enforce 4-byte alignment and packing of all data structures and values.
16 // Floating point values are aligned on platforms that require it. This is done
17 // with a combination of setting struct attributes, and manual alignment
18 // within the definitions. See the "Message Packing" section of the README.
19 #pragma pack(push, 1)
20 
21 /**************************************************************************/ /**
22  * @defgroup sta5635 STA5635 Command/Control Messages
23  * @brief Messages for interacting with an attached STA5635 RF front-end device.
24  * @ingroup device_control
25  *
26  * These messages are intended to be used only for devices with an
27  * STMicroelectronics STA5635 RF front-end where direct user control of the
28  * front-end is needed. This is not common and should not be used on most
29  * platforms.
30  *
31  * For platforms using an STA5635, the device will output @ref LBandFrameMessage
32  * containing I/Q samples from the RF front-end. The format and use of the I/Q
33  * samples is platform-specific.
34  *
35  * See also @ref messages.
36  ******************************************************************************/
37 
38 /**
39  * @brief A command to be sent to an attached STA5635 RF front-end. (@ref
40  * MessageType::STA5635_COMMAND, version 1.0).
41  * @ingroup sta5635
42  *
43  * See the STA5635 data sheet for the allowed command, address, and data values.
44  */
46  static constexpr MessageType MESSAGE_TYPE = MessageType::STA5635_COMMAND;
47  static constexpr uint8_t MESSAGE_VERSION = 0;
48 
49  /** The STA5635 command code to be issued. */
50  uint8_t command = 0;
51  /** The address of the STA5635 register to be accessed. */
52  uint8_t address = 0;
53  /**
54  * The value to be sent to the device, where `data[0]` contains the MSB.
55  */
56  uint8_t data[2] = {0};
57 };
58 
59 /**
60  * @brief Result from an STA5635 sent in response to an @ref STA5635Command.
61  * (@ref MessageType::STA5635_COMMAND_RESPONSE, version 1.0).
62  * @ingroup sta5635
63  */
65  static constexpr MessageType MESSAGE_TYPE =
67  static constexpr uint8_t MESSAGE_VERSION = 0;
68 
69  /**
70  * The system time when the response was received (in nanoseconds). Note that
71  * this is not synchronized to P1 or GNSS time.
72  */
73  int64_t system_time_ns = 0;
74  /**
75  * The sequence number contained in the @ref STA5635Command to which this
76  * response belongs.
77  */
78  uint32_t command_sequence_number = 0;
79  /**
80  * The response from the device, where `data[0]` contains the first byte in
81  * the response.
82  */
83  uint8_t data[4] = {0};
84 };
85 
86 /**
87  * @brief IQ sample data from an STA5635
88  * (@ref MessageType::STA5635_IQ_DATA, version 1.0).
89  * @ingroup sta5635
90  * @note
91  * The rest of this message contains the wrapped payload data. The size of
92  * the data is found by subtracting the size of the other fields in this
93  * message from the header `payload_size_bytes` (i.e. `size_t content_size =
94  * header->payload_size_bytes - sizeof(STA5635IQData)`).
95  */
97  static constexpr MessageType MESSAGE_TYPE = MessageType::STA5635_IQ_DATA;
98  static constexpr uint8_t MESSAGE_VERSION = 0;
99 
100  uint8_t reserved[4] = {0};
101 };
102 
103 #pragma pack(pop)
104 
105 } // namespace messages
106 } // namespace fusion_engine
107 } // namespace point_one
@ STA5635_COMMAND
STA5635Command
MessageType
Identifiers for the defined output message types.
Definition: defs.h:34
Library portability helper definitions.
#define P1_ALIGNAS(N)
Definition: portability.h:57
@ STA5635_IQ_DATA
STA5635IQData
Result from an STA5635 sent in response to an STA5635Command.
Definition: sta5635.h:64
The base class for all message payloads.
Definition: defs.h:687
@ STA5635_COMMAND_RESPONSE
STA5635CommandResponse
GNSS signal and frequency type definitions.
Definition: logging.h:38
A command to be sent to an attached STA5635 RF front-end.
Definition: sta5635.h:45
IQ sample data from an STA5635 (MessageType::STA5635_IQ_DATA, version 1.0).
Definition: sta5635.h:96
Point One FusionEngine output message common definitions.