beautypg.com

Software driver – Digi NS9750 User Manual

Page 579

background image

w w w . d i g i e m b e d d e d . c o m

5 5 5

I 2 C M a s t e r / S l a v e I n t e r f a c e

Software driver

The I

2

C master software driver uses three commands only:

M_READ

to start a read sequence

M_WRITE

to start a write sequence

M_STOP

to give up the I

2

C bus

If, during a read or write sequence, another

M_READ

or

M_WRITE

is requested by the

ARM CPU, a restart is performed on the I

2

C bus. This opens the opportunity to provide

a new slave device address in the MAster Address register before the command
request.

The I

2

C slave high level driver identifies one command:

S_STOP

, to discontinue a

transaction. After this command, the slave remains inactive until the next start
condition on the I

2

C bus. If a slave is accessed by a master, it generates

S_RX_DATA

and

S_TX_DATA

interrupts (see "Master/slave interrupt codes" on page 553). To

distinguish the transactions from each other, special

S_RX_DATA_1ST

and

S_TX_DATA_1ST

interrupts are generated for the transmitted byte.