magellan-spacemouse icon indicating copy to clipboard operation
magellan-spacemouse copied to clipboard

Internal workings

Open MohrJonas opened this issue 1 year ago • 5 comments

I'm trying to adapt this software to a DIY spacemouse and was wondering if you could elaborate on the internal workings a bit more. Looking at the source code, descriptors.c seems pretty clear to me. As far as I understand it, it defines the USB manufacturer, model and some other stuff.
My understanding of magellan.c is the following:

  • It sets up UART, USB and GPIO pins
  • What does this do? 🤔 https://github.com/jfedor2/magellan-spacemouse/blob/acfac3b99c4dd8fba192c1e298550e49746ed5b5/src/magellan.c#L43-L44
  • In the infinite loop, it calls tinyusb's tud_task() function to do some USB-related stuff
  • It then checks in https://github.com/jfedor2/magellan-spacemouse/blob/acfac3b99c4dd8fba192c1e298550e49746ed5b5/src/magellan.c#L51 https://github.com/jfedor2/magellan-spacemouse/blob/acfac3b99c4dd8fba192c1e298550e49746ed5b5/src/magellan.c#L55 https://github.com/jfedor2/magellan-spacemouse/blob/acfac3b99c4dd8fba192c1e298550e49746ed5b5/src/magellan.c#L59 if a translation, rotation or button press has occured that has to be reported via USB
  • After that, it reads a char from UART and that's basically where my understanding stops. Could you therefore please elaborate what this does? https://github.com/jfedor2/magellan-spacemouse/blob/acfac3b99c4dd8fba192c1e298550e49746ed5b5/src/magellan.c#L66-L131 Thank you in advance 😀

MohrJonas avatar Jun 24 '23 12:06 MohrJonas