Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
micropython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
micropython
Commits
2c3fa4ad
Commit
2c3fa4ad
authored
Apr 08, 2019
by
Damien George
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stm32/i2cslave: Add support for H7 MCUs.
parent
643d2a0e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
3 deletions
+9
-3
ports/stm32/i2cslave.c
ports/stm32/i2cslave.c
+1
-1
ports/stm32/i2cslave.h
ports/stm32/i2cslave.h
+8
-2
No files found.
ports/stm32/i2cslave.c
View file @
2c3fa4ad
...
...
@@ -60,7 +60,7 @@ void i2c_slave_ev_irq_handler(i2c_slave_t *i2c) {
}
}
#elif defined(STM32F7)
#elif defined(STM32F7)
|| defined(STM32H7)
void
i2c_slave_init_helper
(
i2c_slave_t
*
i2c
,
int
addr
)
{
i2c
->
CR1
=
I2C_CR1_STOPIE
|
I2C_CR1_ADDRIE
|
I2C_CR1_RXIE
|
I2C_CR1_TXIE
;
...
...
ports/stm32/i2cslave.h
View file @
2c3fa4ad
...
...
@@ -33,10 +33,16 @@ typedef I2C_TypeDef i2c_slave_t;
void
i2c_slave_init_helper
(
i2c_slave_t
*
i2c
,
int
addr
);
static
inline
void
i2c_slave_init
(
i2c_slave_t
*
i2c
,
int
irqn
,
int
irq_pri
,
int
addr
)
{
int
en_bit
=
RCC_APB1ENR_I2C1EN_Pos
+
((
uintptr_t
)
i2c
-
I2C1_BASE
)
/
(
I2C2_BASE
-
I2C1_BASE
);
RCC
->
APB1ENR
|=
1
<<
en_bit
;
int
i2c_idx
=
((
uintptr_t
)
i2c
-
I2C1_BASE
)
/
(
I2C2_BASE
-
I2C1_BASE
);
#if defined(STM32F4) || defined(STM32F7)
RCC
->
APB1ENR
|=
1
<<
(
RCC_APB1ENR_I2C1EN_Pos
+
i2c_idx
);
volatile
uint32_t
tmp
=
RCC
->
APB1ENR
;
// Delay after enabling clock
(
void
)
tmp
;
#elif defined(STM32H7)
RCC
->
APB1LENR
|=
1
<<
(
RCC_APB1LENR_I2C1EN_Pos
+
i2c_idx
);
volatile
uint32_t
tmp
=
RCC
->
APB1LENR
;
// Delay after enabling clock
(
void
)
tmp
;
#endif
i2c_slave_init_helper
(
i2c
,
addr
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment