Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
DIOT Monitoring Module
Manage
Activity
Members
Labels
Plan
Issues
6
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Projects
DIOT Monitoring Module
Commits
2f248bbf
Commit
2f248bbf
authored
3 years ago
by
Christos Gentsos
Browse files
Options
Downloads
Patches
Plain Diff
I2C: Fix bug with command 0x00 always returning zero
parent
a79fbf97
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
common/src/i2c_slave.c
+2
-3
2 additions, 3 deletions
common/src/i2c_slave.c
with
2 additions
and
3 deletions
common/src/i2c_slave.c
+
2
−
3
View file @
2f248bbf
...
...
@@ -17,7 +17,7 @@ static struct io_descriptor *io;
static
uint16_t
dev_addr
__xMR
;
static
uint16_t
rx_state
__xMR
=
CMD
;
static
uint8_t
tmp_std_cmd_addr
;
static
uint16_t
std_cmd_addr
__xMR
;
static
uint16_t
std_cmd_addr
__xMR
=
0xFF
;
static
int16_t
cmd_index
__xMR
;
static
int16_t
cmd_len
__xMR
;
static
uint8_t
tmp_ext_cmd_addr
;
...
...
@@ -72,7 +72,6 @@ static void __xMR I2C_rx_complete(const struct i2c_s_async_descriptor *const des
if
(
use_pec
)
pec_checksum
=
crc8_byte
(
pec_checksum
^
std_cmd_addr
);
if
(
std_cmd_addr
==
0xFF
)
{
std_cmd_addr
=
0
;
rx_state
=
EXT_CMD
;
send_ack
(
descr
);
set_cmd
(
descr
,
3
);
...
...
@@ -223,7 +222,7 @@ static void __xMR I2C_tx_pending(const struct i2c_s_async_descriptor *const desc
added_tx_pec
=
1
;
sent_checksum
=
0
;
}
if
(
std_cmd_addr
)
{
if
(
std_cmd_addr
!=
0xFF
)
{
if
((
*
cmds
->
cmds
[
cmd_index
].
data_len
<
0
)
&&
(
!
blk_wrote_len_byte
))
{
cmd_len
=
0
;
tx_tmp
=
-*
cmds
->
cmds
[
cmd_index
].
data_len
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment