-
Notifications
You must be signed in to change notification settings - Fork 36
add pd Vendor messages and badge detection #248
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
base: main
Are you sure you want to change the base?
Conversation
|
This is EXTREMELY COOL |
|
I've changed this to draft as I've started doing the docs and want to improve the mp api, it's a bit verbose and could do with being split into host and device classes and improving the connection status getters. |
|
updated the api to the following, using separate classes as host may be extended with prime messages, which a device deosn't send: |
|
going to make further improvements to the api |
thinkl33t
left a comment
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.
Seems sensible enough though my C++ skills have definitely atrophied a bit 🙃
Couple of queries, may be nothings.
|
|
||
| state->tx_buffer[0] = TX_FIFO_ADDRESS; | ||
| state->tx_buffer[1] = TX_SOP1; | ||
| state->tx_buffer[2] = TX_SOP3; |
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.
This is set to TX_SOP3 and all the rest of tx_buffer[2] are set to TX_SOP1 - i assume this is intentional?
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.
Yes, this is the symbol sequence to say if it's a message for the device or one of the cable plugs.
| 0x00, | ||
| 0x00, | ||
| 0x00, | ||
| 0xFF, | ||
| 0x54, | ||
| 0x69, | ||
| 0x6C, | ||
| 0x64, | ||
| 0x61, | ||
| 0x67, | ||
| 0x6F, | ||
| 0x6E, | ||
| 0x42, | ||
| 0x65, | ||
| 0x73, | ||
| 0x74, | ||
| 0x61, | ||
| 0x67, | ||
| 0x6F, | ||
| 0x6E, |
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.
This looks at first glance like a lot of magic numbers - is it just a unique ID or would we be better with each byte getting assembled from constants to make it more obvious whats going on?
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.
it's just a unique id.
Description
Cleaned up the stack and added host and device vendor messages to pd. This allows users to send and receive vendor messages on both ports once USB attach is complete for that port.
If a device is attached to a host port a vendor message is sent. If message is received by the badge on the usb in, it detects the other badge and connects as a device, it responds with the same message to let the other badge know it is connected as a host.
includes a helper to construct a vendor header and events to signal a badge has been connected and messages received.
It also contains code for prime and double prime messages, but there is an issue with the packet creation and the end of packet symbol is being inserted by the fusb302 before it stuffs the CRC in the packet. hopefully this will be enabled in a future PR.