Replies: 2 comments 10 replies
-
I'll suggest we break down the I2C example a bit and see if this answers your question. If not please reply back for more help. To start with, we have two effective functions when dealing with hardware:
Some hardware communication is more complicated. For example, it might us an I2C bus. This is how our IMU works. It sends out a message using I2C to communicate with the I2C IMU chip. We break the same functionality into two pieces as stated above.
We might do the same thing with your GPIO example above, creating an LED manager and a Pin driver. The reason we do this is to separate out the functionality. One controls what it manages, and the other controls the underlying hardware. The I2C driver may be reused for any other I2C sensor without needing to remove IMU specific items. This brings us to the Application / Manager / Driver pattern. Applications component perform the top-level application of your software: blink an LED, detect tilt of a board, etc. These application components delegate functionality to managers to handle the specific hardware portions: e.g. "turn on LED", "turn off LED", "read IMU" etc. These managers delegate messaging and bus instructions to the driver: "send read message", "toggle pin", etc. As an application grows beyond a simple loop (above) it is much easier to design and validate functionality when it is broken up. Imagine reading an I2C, detecting a tilt, sending the "he we tilted" to ground, each with its management, messages, etc in a single program loop. It would work but is so hard to debug, verify, etc because it would be all co-located. |
Beta Was this translation helpful? Give feedback.
-
Hi @LeStarch I'm having trouble finding where in the data sheet it says that the data is in big-endian format. Page 50 of https://invensense.tdk.com/wp-content/uploads/2017/11/RM-MPU-9250A-00-v1.6.pdf seem to suggest the data is stored in little-endian format. |
Beta Was this translation helpful? Give feedback.
-
Hello,
As I learn F Prime, I am finding it hard to grasp what is going on in the auto-generated .cpp and .hpp files after we
fprime-util generate
andfprime-util impl
. More specifically, as I read through the SystemReference deployment as an example vs the auto-generated template files, I do not understand what these auto-generated functions are doing.For example (in Arduino), I know that
void setup() { pinMode(LED, OUTPUT); }
Is the setup function that defines the LED pin to output, and that
void loop() { digitalWrite(LED_BUILTIN, HIGH); delay(1000); digitalWrite(LED_BUILTIN, LOW); delay(1000); }
Is a function that infinitely loops a power command with a delay within it.
Is there anywhere I can reference that goes into this level of depth for me to grasp? Any help would be appreciated.
Beta Was this translation helpful? Give feedback.
All reactions