Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
D
dev_lis2dw12
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
aohui.li
dev_lis2dw12
Commits
1d88e1f1
Commit
1d88e1f1
authored
Jul 10, 2025
by
aohui.li
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复iic总线无法连接问题
parent
d022f330
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
1 deletion
+13
-1
lis2dw12.c
main/lis2dw12.c
+13
-1
No files found.
main/lis2dw12.c
View file @
1d88e1f1
...
...
@@ -91,17 +91,29 @@ void lis2dw12_init()
{
static
uint8_t
whoamI
,
rst
;
uint8_t
tx_buffer
[
1000
];
esp_err_t
ret
;
ESP_LOGI
(
TAG
,
"LIS2DW12 Init"
);
gpio_set_direction
(
I2C_MASTER_SCL_IO
,
GPIO_MODE_INPUT_OUTPUT_OD
);
gpio_set_direction
(
I2C_MASTER_SDA_IO
,
GPIO_MODE_INPUT_OUTPUT_OD
);
gpio_set_pull_mode
(
I2C_MASTER_SCL_IO
,
GPIO_PULLUP_ONLY
);
gpio_set_pull_mode
(
I2C_MASTER_SDA_IO
,
GPIO_PULLUP_ONLY
);
vTaskDelay
(
pdMS_TO_TICKS
(
5
0
));
vTaskDelay
(
pdMS_TO_TICKS
(
10
0
));
i2c_master_init
(
&
s_bus_handle
,
&
s_dev_handle
);
ESP_LOGI
(
TAG
,
"LIS2DW12 Init 2"
);
vTaskDelay
(
pdMS_TO_TICKS
(
50
));
while
(
1
)
{
ret
=
i2c_master_probe
(
s_bus_handle
,
SLAVE_ADDR
,
1000
);
if
(
ret
==
ESP_OK
){
ESP_LOGI
(
TAG
,
"IIC OK"
);
break
;
}
vTaskDelay
(
pdMS_TO_TICKS
(
10
));
}
dev_ctx
.
handle
=
&
s_dev_handle
;
dev_ctx
.
read_reg
=
lis2dw12_register_read
;
dev_ctx
.
write_reg
=
lis2dw12_register_write_byte
;
...
...
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