Commit 39f8ea7
committed
I2C Slave : rework slave receive data sequence
This work includes some rework of the Slave RX path, which is based on
below principle:
- we don't know in advance how many bytes will be sent by the I2C master
so we'll be listening to bytes 1 by 1
- in order to get them one by one, we're programing the I2C with
HAL_I2C_Slave_Sequential_Receive_IT and 1 byte at a time and we're using
the HAL_I2C_SlaveRxCpltCallback to store the byte then programing again
for next byte.
- this sequence is ended when the HAL_I2C_ListenCpltCallback is called,
which happens when the master ends the ongoing sequence. We can then
prepare for the next one.
In order to implement this mecanism, we're introduced a local counter
slaveRxNbData where we store the number of received bytes, as well as a
new slave mode SLAVE_MODE_LISTEN which allows for extra checks.
i2c_s structure members that can be modified from main context or under
interrupt context have been marked as volatile.1 parent f45e704 commit 39f8ea7
2 files changed
+57
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| 78 | + | |
| 79 | + | |
78 | 80 | | |
79 | 81 | | |
80 | 82 | | |
| |||
283 | 285 | | |
284 | 286 | | |
285 | 287 | | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
286 | 291 | | |
287 | 292 | | |
288 | 293 | | |
| |||
395 | 400 | | |
396 | 401 | | |
397 | 402 | | |
398 | | - | |
399 | 403 | | |
400 | 404 | | |
| 405 | + | |
| 406 | + | |
401 | 407 | | |
402 | 408 | | |
403 | 409 | | |
| |||
509 | 515 | | |
510 | 516 | | |
511 | 517 | | |
512 | | - | |
513 | | - | |
514 | 518 | | |
515 | 519 | | |
516 | 520 | | |
| |||
519 | 523 | | |
520 | 524 | | |
521 | 525 | | |
| 526 | + | |
522 | 527 | | |
523 | | - | |
524 | | - | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
525 | 532 | | |
526 | 533 | | |
527 | 534 | | |
| |||
534 | 541 | | |
535 | 542 | | |
536 | 543 | | |
537 | | - | |
538 | 544 | | |
539 | 545 | | |
| 546 | + | |
| 547 | + | |
540 | 548 | | |
541 | 549 | | |
542 | | - | |
543 | | - | |
544 | | - | |
| 550 | + | |
| 551 | + | |
545 | 552 | | |
546 | 553 | | |
| 554 | + | |
| 555 | + | |
547 | 556 | | |
548 | 557 | | |
549 | 558 | | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
550 | 594 | | |
551 | 595 | | |
552 | 596 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
94 | | - | |
| 94 | + | |
95 | 95 | | |
| 96 | + | |
96 | 97 | | |
97 | 98 | | |
98 | | - | |
99 | | - | |
| 99 | + | |
| 100 | + | |
100 | 101 | | |
101 | 102 | | |
102 | 103 | | |
| |||
0 commit comments