-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Add support for I2C Slave Drivers #5224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
carlescufi
merged 6 commits into
zephyrproject-rtos:master
from
superna9999:for-pr/stm32_i2c_slave
Jul 4, 2018
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
64543b7
i2c: stm32: check messages before starting transmission
a6a695c
i2c: stm32_v2: restructure interrupt handling
043ab45
i2c: Add new I2C Slave syscalls
superna9999 2bea2a7
i2c: slave: Add EEPROM I2C Slave driver
superna9999 2aa4c4f
test: i2c: Add i2c_slave_api test
superna9999 12ee47a
i2c: stm32_v2: implement slave support
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,26 +34,40 @@ struct i2c_stm32_data { | |
unsigned int flags; | ||
#endif | ||
unsigned int is_write; | ||
unsigned int is_arlo; | ||
unsigned int is_nack; | ||
unsigned int is_err; | ||
struct i2c_msg *msg; | ||
unsigned int len; | ||
u8_t *buf; | ||
} current; | ||
#ifdef CONFIG_I2C_SLAVE | ||
bool master_active; | ||
struct i2c_slave_config *slave_cfg; | ||
bool slave_attached; | ||
#endif | ||
}; | ||
|
||
s32_t stm32_i2c_msg_write(struct device *dev, struct i2c_msg *msg, u8_t *flg, | ||
u16_t sadr); | ||
s32_t stm32_i2c_msg_read(struct device *dev, struct i2c_msg *msg, u8_t *flg, | ||
u16_t sadr); | ||
s32_t stm32_i2c_configure_timing(struct device *dev, u32_t clk); | ||
int i2c_stm32_runtime_configure(struct device *dev, u32_t config); | ||
|
||
void stm32_i2c_event_isr(void *arg); | ||
void stm32_i2c_error_isr(void *arg); | ||
#ifdef CONFIG_I2C_STM32_COMBINED_INTERRUPT | ||
void stm32_i2c_combined_isr(void *arg); | ||
#endif | ||
|
||
#ifdef CONFIG_I2C_SLAVE | ||
int i2c_stm32_slave_register(struct device *dev, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. int i2c_stm32_slave_register(struct device *dev,
struct i2c_slave_config *config);
int i2c_stm32_slave_unregister(struct device *dev,
struct i2c_slave_config *config); There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @dwagenk I just fixed these ... sorry |
||
struct i2c_slave_config *config); | ||
int i2c_stm32_slave_unregister(struct device *dev, | ||
struct i2c_slave_config *config); | ||
#endif | ||
|
||
#define DEV_DATA(dev) ((struct i2c_stm32_data * const)(dev)->driver_data) | ||
#define DEV_CFG(dev) \ | ||
((const struct i2c_stm32_config * const)(dev)->config->config_info) | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this could be in a helper shred by all i2c controllers instead, with some parameters like the max messgae length.