5 spi object method: readbyte(), 6 spi object method: send(string, ), 7 spi object method: read(len, ) – Rainbow Electronics GM862-GPS User Manual
Page 55

Easy Script
in Python
80000ST10020a Rev.8 - 01/10/08
Reproduction forbidden without Telit Communications S.p.A. written authorization - All Rights Reserved
page 55 of 100
b=bus4.sendbyte(111,1)
sends byte 111 to the SPI bus activating the Slave Select line of the SS1 device (in our example
GPIO10)
2.9.5 SPI object method: readbyte(
NOTE: We advice to use the new readwrite (2.9.3) method to send bytes or strings.
Receives a byte from the SPI bus device at Slave Select number SS_number. Input optional
parameter SS_number is a Python byte representing the Slave number to be activated; if not present
no slave line is activated.
Return value is a byte (integer) received from the SPI bus device if no data is received the return value
will be zero.
Example:
a = bus3.readbyte()
receives a byte from the SPI bus , assigning return result value to a.
b=bus4.readbyte(1)
receives a byte from the SPI bus device on SS1 line, assigning return result value to b.
2.9.6 SPI object method: send(string,
NOTE: We advice to use the new readwrite (2.9.3) method to send bytes or strings.
Sends a string to the SPI bus previously created. Input parameter string is a Python string which is the
string to send to the SPI bus. Optional parameter SS_number is a Python byte representing the Slave
number to be activated; if not present no slave line is activated.
Return value is a Python integer which is -1 if an error occurred otherwise is 1 if all bytes of the string
have been sent.
Example:
a = bus3.send('test')
sends string 'test' to the SPI bus , assigning return result value to a.
2.9.7 SPI object method: read(len,
NOTE: We advice to use the new readwrite (2.9.3) method to send bytes or strings.