Skip to content

Migrate to busDevice infrastructure. Phase 1#2275

Merged
digitalentity merged 3 commits intodevelopmentfrom
de_busdev_phase1
Oct 7, 2017
Merged

Migrate to busDevice infrastructure. Phase 1#2275
digitalentity merged 3 commits intodevelopmentfrom
de_busdev_phase1

Conversation

@digitalentity
Copy link
Copy Markdown
Member

Idea behind this PR is better driver abstraction from hardware. Descriptors for devices are stored in flash and ultimately will be defined in the target files, not in device driver files. Device driver itself should be unaware of underlying bus (SPI or I2C) and device definition.

Bus init code will also ensure that hardware state is consistent. For SPI devices this mean that all CS# lines are pulled high before initializing the devices.

Fixes: #2074

…S# pins are pulled high before device initialization
@digitalentity digitalentity added this to the 1.8 milestone Oct 7, 2017
@digitalentity
Copy link
Copy Markdown
Member Author

Further changes will gradually move to bus-independent device drivers.

Comment thread src/main/drivers/bus.h
} i2c;
} busDevice_t;

#ifdef __APPLE__
Copy link
Copy Markdown
Member

@fiam fiam Oct 7, 2017

Choose a reason for hiding this comment

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

Why is this needed? __APPLE__ should only be defined when compiling for macOS and iOS and I guess we're not supporting any of those targets anytime soon :-)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

True, but it's better to keep the source compilable 😄

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No problem with that being left in the PR. It just grabbed my attention cause I wasn't really expecting a test for Apple's platform on code running on MCUs!

Now that I think about it, ßF added support for running on a simulator and we eventually should do that too. Not sure how that simulator works but it might need that special handling on macOS.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Actually, I was mostly concerned with chip-select lines left floating for not (yet) initialized SPI devices. Might be the cause of #2074.

@digitalentity digitalentity merged commit 34b550b into development Oct 7, 2017
@digitalentity digitalentity deleted the de_busdev_phase1 branch October 7, 2017 13:26
This was referenced Nov 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants