1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
Commit Graph

34 Commits

Author SHA1 Message Date
Gunar Schorcht
3d93b2bcf0 drivers/periph/i2c: i2c_acquire() returns void
Since all implementations simply return 0 and most drivers do not check the return value, it is better to return void and use an assert to ensure that the given device identifier and given device parameters are correct.
2021-11-29 06:35:25 +01:00
Benjamin Valentin
1768e93710 drivers/periph: use uint_fast8_t as default type
The default driver type is just an index into a device array defined
by the board.

If a platform wants to encode additional information in the device type,
it can define a custom type.

This means we can just set the default type to whatever fits the target
CPU best.

On ARM this will still be a 32 bit word, but on AVR it will by a 8 bit byte.
2021-11-18 10:29:50 +01:00
Jan Romann
4384795cb9
treewide: Remove excessive newlines 2021-08-13 19:50:38 +02:00
MrKevinWeiss
7893158b5a drivers/dev_enums: Remove unused dev_enums.h 2020-09-24 09:27:39 +02:00
Benjamin Valentin
21958ff531 drivers/periph/i2c: add periph_i2c_reconfigure feature
It is often desireable to re-configure the pins of a bus back to GPIO mode,
either to save power when an external peripheral is turned off and current
would leak, or because a device may need a non-standard in-band signal to
be generated on the bus lines.

To serve those use cases, this patch introduces four new functions to the
I2C API:

 - `i2c_init_pins()`    equivalent to spi_init_pins(), restores I2C pin configuration

 - `i2c_deinit_pins()`  to switch the configuration of the I2C pins back to GPIO
                        mode and block access to the bus.

 - `i2c_pin_sda()`      to get the data pin for a given bus

 - `i2c_pin_scl()`      to get the clock pin for a given bus

Since it's unreasonable to expect having implementations for all platforms
already, those functions are only availiable when the periph_i2c_reconfigure
feature is availiable.

Applications should use FEATURES_REQUIRED += periph_i2c_reconfigure or
FEATURES_OPTIONAL if they want to make use of those functions.
2020-05-05 16:12:19 +02:00
Marian Buschsieweke
5bba339a7c
drivers/periph/i2c: Fixed i2c_release() signature
i2c_release() should not have a return value, as:

- There is no reasonable error handling possible by the caller, so there is no
  value in indicating success/failure via the return value to the caller
- There is no legitimate reason to fail *unless* an invalid I2C bus was released
  or an I2C bus that was not previously acquired was released
    --> This would indicate a bug in the code and should be tackled by an
        assert()
2019-08-22 12:02:01 +02:00
Federico Pellegrin
1779abafb5 periph/i2c: make sure i2c registers is big-endian on all archs 2019-05-29 05:15:23 +02:00
MrKevinWeiss
0ad94e1b4b drivers/include/i2c: Fix API documentation
The write_reg/s states a repeated start write is used but that is not how the i2c is implemeneted.
Most devices also only use a continuous write so the API should be changed to match implementation and the majority of sensors.
2018-12-10 09:56:40 +01:00
Joakim Nohlgård
a867aeaba2 periph/i2c: Add precondition on i2c_acquire for i2c bus access 2018-11-28 08:43:01 +01:00
smlng
2db2ce2dc7 doc: rename sections in i2c.h 2018-07-25 12:01:40 +02:00
dylad
ef8ed2620c periph_common/i2c: introduce new ret codes scheme 2018-07-25 12:01:34 +02:00
Joakim Nohlgård
872251d011 periph/i2c: Add 10 bit addressing magic number definition 2018-07-25 12:01:34 +02:00
Joakim Nohlgård
f2a2427fcd periph/i2c: Editorial changes to i2c.h 2018-07-25 12:01:34 +02:00
01509b294f drivers/periph_i2c: i2c_init should return void 2018-07-25 12:01:34 +02:00
Joakim Nohlgård
1dfc5f8f52 periph/i2c: Editorial doc changes 2018-07-25 12:01:34 +02:00
6f25886d77 drivers/periph/i2c: fixes issues in API
- non matching doxygen input parameter to i2c_write_reg
- non/matching missing function parameter
- invalid return type to i2c_release
2018-07-25 12:01:34 +02:00
dylad
e11a37df03 drivers/i2c: modify I2C API
Signed-off-by: dylad <dylan.laduranty@mesotic.com>
2018-07-25 12:01:34 +02:00
Hauke Petersen
45ab3ea89d drivers/periph: introduced new I2C interface 2018-07-25 12:01:34 +02:00
Bas Stottelaar
31c7e9e4c2 periph: i2c: include note on address alignment. 2017-10-31 20:50:42 +01:00
94c753c07a drivers: doxygen cleanup 2017-09-01 15:12:20 +02:00
smlng
f5cd3a4496 doc: reorganize and enhance docu on common I2C periph interface 2017-06-06 16:05:47 +02:00
0fcc7d3834 cleanup: apply headerguard script output 2017-05-24 17:54:02 +02:00
Kees Bakker
bac5cda1e3 periph/i2c: convert char to uint8_t where applicapable
In general, data transferred through I2C are bytes and thus should have
type uint8_t, not char.

Also convert uint8_t ptrs to void ptrs
2016-10-04 20:26:39 +02:00
Hauke Petersen
9a4df61005 drivers/periph: fixed UNDEF values to UINT_MAX 2016-04-01 10:57:26 +02:00
Hauke Petersen
77b790375f drivers/periph: some doxygen fixes
- added todos to periph module description
- repaired group names (e.g. s/driver_xx/drivers_xx/)
2015-11-19 15:57:36 +01:00
Hauke Petersen
9591d2049b drivers/i2c: removed init_slave for now 2015-10-20 16:57:39 +02:00
Hauke Petersen
a4183454e8 drivers/i2c: optimized I2C periph driver interface
- 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
2015-09-22 14:43:47 +02:00
Alexandru Caciulescu
451bf78549 drivers/include/periph: Repair header file include guards 2015-03-24 17:55:42 +02:00
Thomas Eichinger
fe643f7077 periph/i2c: added means to make I2C thread-safe
As discussed in #2289 this changes provide means to
use the i2c interface safely within multible threads.
2015-01-19 12:18:03 +01:00
Hauke Petersen
f3de73fe54 driver/i2c: additional docu for pull resistors 2014-12-16 15:17:42 +01:00
PeterKietzmann
aab94e50f9 doc: extend i2c description for pull-up 2014-12-16 10:54:31 +01:00
Ludwig Ortmann
da43a5e7a4 doc: periph: various fixes and cleanup
- unify file/module @brief
- distinct @file section more visibly in source
- provide missing @brief's
- move module details/notes from file to module sections
- provide missing macro definition for building
2014-12-04 10:28:45 +01:00
Ludwig Ortmann
5523ec67f3 doc: make peripheral interfaces modules
also remove `@file` parameters
2014-10-25 15:37:04 +02:00
Hauke Petersen
45b466d786 drivers: added low-level I2C driver interface 2014-10-15 14:50:08 +02:00