[bootlin/training-materials updates] master: kernel: i2c-comm: Try to explain the nunchuk first read situation better (4324e522)

Miquel Raynal miquel.raynal at bootlin.com
Mon Jul 12 20:13:15 CEST 2021


Repository : https://github.com/bootlin/training-materials
On branch  : master
Link       : https://github.com/bootlin/training-materials/commit/4324e5223c8bbefe06101b59157e784bc4914f8e

>---------------------------------------------------------------

commit 4324e5223c8bbefe06101b59157e784bc4914f8e
Author: Miquel Raynal <miquel.raynal at bootlin.com>
Date:   Mon Jul 12 20:13:15 2021 +0200

    kernel: i2c-comm: Try to explain the nunchuk first read situation better
    
    Signed-off-by: Miquel Raynal <miquel.raynal at bootlin.com>


>---------------------------------------------------------------

4324e5223c8bbefe06101b59157e784bc4914f8e
 labs/kernel-i2c-communication/kernel-i2c-communication.tex | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/labs/kernel-i2c-communication/kernel-i2c-communication.tex b/labs/kernel-i2c-communication/kernel-i2c-communication.tex
index 4d5ee0e9..8e097ad1 100644
--- a/labs/kernel-i2c-communication/kernel-i2c-communication.tex
+++ b/labs/kernel-i2c-communication/kernel-i2c-communication.tex
@@ -267,10 +267,14 @@ errors.
 
 \section{Read nunchuk registers}
 
-The nunchuk exhibits a rather weird behavior: it seems that it updates
-the state of its internal registers only when they have been read.
-
-As a consequence, we will need to read the registers twice!
+As the nunchuk does not feature any type of external signaling nor any
+internal bit to advertize a possible end-of-conversion status, the user
+is required to regularly poll the registers, each read triggering the
+next conversion. This leads to a specific situation: the first read
+triggers the first conversion but returns some data which can be
+considered garbage and safely discarded.
+
+As a consequence, we will need to read the registers twice the first time!
 
 To keep the code simple and readable, let's create a
 \code{nunchuk_read_registers()} function to read the registers once.




More information about the training-materials-updates mailing list