Skip to content

drivers/i2c: optimized I2C periph driver interface#3929

Merged
PeterKietzmann merged 1 commit intoRIOT-OS:masterfrom
haukepetersen:opt_periph_i2c
Sep 30, 2015
Merged

drivers/i2c: optimized I2C periph driver interface#3929
PeterKietzmann merged 1 commit intoRIOT-OS:masterfrom
haukepetersen:opt_periph_i2c

Conversation

@haukepetersen
Copy link
Copy Markdown
Contributor

Found this when going through my branches...

Changed by this PR:

  • added SPI_DEV and SPI_UNDEF macros
  • made types and speed values overridable by CPU
  • moved old device enum to dev_enums.h
  • reformatted a little bit to comply to 80 char line length

- added SPI_DEV and SPI_UNDEF macros
- made types and speed values overritable by CPU
- moved old device enum to dev_enums.h
- reformatted a little bit to comply to 80 char line length
@haukepetersen haukepetersen added Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation Impact: minor The PR is small in size and might only require a quick look of a knowledgeable reviewer Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation labels Sep 22, 2015
@haukepetersen haukepetersen added this to the Release NEXT MAJOR milestone Sep 22, 2015
@jnohlgard
Copy link
Copy Markdown
Member

SPI_DEV, SPI_UNDEF?

@haukepetersen
Copy link
Copy Markdown
Contributor Author

Those macros are very handy when it comes to writing tests or similar: Say your CPU defines i2c_t to be a pointer, the CPU can than define the I2C_DEV macro in a way, that creates a mapping between an integer and this counter (e.g. as done in the GPIO driver for some CPUs). So instead of using I2C_0, I2C_1, etc, which you can not iterate, you can use I2C_DEV(0), I2C_DEV(1)`, and so on.

The undefined value is useful for situations, where you could have an optional i2c parameter in a function. You could for example write a device driver, that can use either I2C or SPI and the driver can chose on runtime by the given parameters which mode it will use...

@jnohlgard
Copy link
Copy Markdown
Member

sorry, I was just remarking on the use of the term SPI inside the message of the I2C commit. I agree with you that this is a useful improvement to the API.
We should finish the UART, SPI and I2C API improvements after the release 2015.09 is out.

@haukepetersen
Copy link
Copy Markdown
Contributor Author

sorry, I was just remarking on the use of the term SPI inside the message of the I2C commit

ups, now I got it :-) Thx!

Yepp, lets get the release out of the door and then get those updated periph APIs merged, next in line is than re-visiting the power management concepts :-)

@jnohlgard
Copy link
Copy Markdown
Member

@haukepetersen sounds like a good plan forward!

@PeterKietzmann
Copy link
Copy Markdown
Member

Seems reasonable to me. I will test it in the next week, just to be on the safe side. But we wanted to wait until the release is out anyway...

@PeterKietzmann PeterKietzmann added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Sep 29, 2015
@PeterKietzmann
Copy link
Copy Markdown
Member

Tested with samr21-xpro and srf02 ultrasonic sensor (i2c) and works. So ACK (after Travis is fine some day)

@PeterKietzmann
Copy link
Copy Markdown
Member

And go

PeterKietzmann added a commit that referenced this pull request Sep 30, 2015
drivers/i2c: optimized I2C periph driver interface
@PeterKietzmann PeterKietzmann merged commit d18063c into RIOT-OS:master Sep 30, 2015
@haukepetersen haukepetersen deleted the opt_periph_i2c branch March 8, 2017 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Impact: minor The PR is small in size and might only require a quick look of a knowledgeable reviewer Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants