Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
card10
firmware
Commits
6fc3674e
Commit
6fc3674e
authored
May 03, 2019
by
schneider
Browse files
feat(BHI): Add I2C support
parent
ccd2773c
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/bosch/BHy1_driver_and_MCU_solution/driver/src/bhy_support.c
View file @
6fc3674e
...
...
@@ -59,6 +59,7 @@
#include
"i2c.h"
#include
"tmr_utils.h"
#include
<stdio.h>
#include
<string.h>
/********************************************************************************/
/* STATIC VARIABLES */
...
...
@@ -66,17 +67,22 @@
static
struct
bhy_t
bhy
;
static
char
*
version
=
BHY_MCU_REFERENCE_VERSION
;
#define I2C_DEVICE MXC_I2C0_BUS0
/********************************************************************************/
/* EXTERN FUNCTION DECLARATIONS */
/********************************************************************************/
static
int8_t
sensor_i2c_write
(
uint8_t
addr
,
uint8_t
reg
,
uint8_t
*
p_buf
,
uint16_t
size
)
{
return
0
;
uint8_t
buf
[
size
+
1
];
buf
[
0
]
=
reg
;
memcpy
(
buf
+
1
,
p_buf
,
size
);
return
I2C_MasterWrite
(
I2C_DEVICE
,
addr
<<
1
,
buf
,
size
+
1
,
0
);
}
static
int8_t
sensor_i2c_read
(
uint8_t
addr
,
uint8_t
reg
,
uint8_t
*
p_buf
,
uint16_t
size
)
{
return
0
;
I2C_MasterWrite
(
I2C_DEVICE
,
addr
<<
1
,
&
reg
,
1
,
1
);
return
I2C_MasterRead
(
I2C_DEVICE
,
addr
<<
1
,
p_buf
,
size
,
0
);
}
/********************************************************************************/
...
...
Write
Preview
Supports
Markdown
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