-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added documentation for Ethernet #27
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -11,20 +11,30 @@ Usage | |||||
|
||||||
Additional Considerations | ||||||
|
||||||
Ethernet | ||||||
Ethernet | ||||||
======== | ||||||
|
||||||
Purpose | ||||||
|
||||||
The Ethernet drivers are sending GPS, CAN, and IMU data to the data acquisition team | ||||||
The Ethernet drivers are sending GPS, CAN, and IMU data to the data acquisition team. | ||||||
The sunlight is the client while data acquisition is the server | ||||||
|
||||||
Usage | ||||||
|
||||||
|
||||||
``Ethernet_Init()`` must be called first as a way to create the Ethernet Queue and create a socket when a connection has been established. | ||||||
Within the function, ``Ethernet_Init()`` calls the blocking function ``Ethernet_ConnectToServer()`` which is responsible for setting the ``servsocket`` variable to the corresponding socket value. | ||||||
After ``Ethernet_Init()`` has finished completing, ``Ethernet_SendMessage()`` is called repeatedly. ``Ethernet_SendMessage()`` is a blocking function which waits until there is data in the queue to send that data across ethernet. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This isn't a blocking function. Also, although you say that it sends the messages that are in the queue, you don't say how to put messages in the queue. |
||||||
The data that is sent across Ethernet is in a struct called EthernetMSG_t which contains specific information of either IMU, GPS, or CAN type. | ||||||
The struct consists of an id enum, length, and a union of data regardless of the type of data. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would get rid of the last line, the zero padding is indeterminate based on the compiler used. Also anyone should be able to read the header file and figure it out. |
||||||
Since the data is in a union, there will be zero padding at the MSB. | ||||||
|
||||||
Additional Considerations | ||||||
|
||||||
Sunlight could have been implemented as a server instead of a client. This implementation would make more sense if Ethernet had the option of sending | ||||||
messages to multiple clients. The way that it is implemented, Sunlight is trying to connect to Data acquisition so that it can send information. | ||||||
As sunlight as the server, data acquisition would try and connect to sunlight in order to send information. In order to implement these changes, both | ||||||
``Ethernet_ConnectToServer()`` and ``Ethernet_Init()`` would need to be changed so that it waits for a client to connect and send messages to that specific client. | ||||||
|
||||||
|
||||||
|
||||||
Inertial Measurement Unit (IMU) | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't really say what the servsocket variable is so you should either add what it is used for or just remove that part of the sentence. This prevents documentation from being unnecessarily wordy.