Skip to content

New queue-based I2C driver - #41

Open
dpkoch wants to merge 33 commits into
masterfrom
I2C2_dan
Open

New queue-based I2C driver#41
dpkoch wants to merge 33 commits into
masterfrom
I2C2_dan

Conversation

@dpkoch

@dpkoch dpkoch commented Jul 9, 2019

Copy link
Copy Markdown
Contributor

This implements the new queue-based I2C driver that allows for greater flexibility handling non-standard I2C peripherals.

We outlined the major blocks of logic that need to be implemented on the whiteboard; I've included pictures of that at the end. We identified the following blocks:

  • beginJob()
  • addTask()
  • finalizeJob()
  • handleTask()
  • advanceTask()
  • handleEvent()
  • handleError()
  • unstick()
  • Update sensor drivers to use new I2C driver API

IMG_20190628_141821
IMG_20190628_141817

@dpkoch

dpkoch commented Jul 9, 2019

Copy link
Copy Markdown
Contributor Author

Tested the I2C sniff example with 5 sensors (baro, MB1242, GPS, TFmini, and airspeed) and it seems to work. Also seemed to handle hot-plugging/unplugging of any of those sensors pretty well (never crashed, just reported however many were plugged in).

I was (un)plugging them pretty slowly though, so we may want to do a more robust test. We'll need to get the unstick() function finalized though before that'll work probably.

@dpkoch

dpkoch commented Jul 9, 2019

Copy link
Copy Markdown
Contributor Author

Also we need to update all the sensor drivers to use the new API

@dpkoch
dpkoch requested a review from superjax July 9, 2019 22:32
@superjax

Copy link
Copy Markdown
Contributor

What's the status on this?

@superjax superjax left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to merge this in as-is, or do we want to finish up unstick?

Comment thread include/i2c_old.h
@@ -0,0 +1,133 @@
/*

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we want to keep this file around

Comment thread src/i2c_old.cpp
@@ -0,0 +1,564 @@
/*

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need this file still?

Comment thread src/i2c.cpp
static const int cyc = 200;

// clock out some bits
for (int i = 0; i < 18; ++i)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not something we want to be doing while flying.

What is left on unstick?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants