![Telit Wireless Solutions GM862GPS Series Скачать руководство пользователя страница 44](http://html1.mh-extra.com/html/telit-wireless-solutions/gm862gps-series/gm862gps-series_technical-manual_1083661044.webp)
TECHNICAL MANUAL
Telit GM862-GPS
Quad Band GPS Data Terminal Module
Pag.44 of 79
Rev. 0
Return value is a Python string which is containing data received.
Example:
a = bus1.read(114,122, 10)
receives a string of 10 bytes from IIC bus device at address 114, starting from address 122
assigning it to a.
3.13.6.8
IIC object method: dev_gen_write(addr, start, string)
Sends a string to the IIC bus device whose address is addr, starting from address start.
Return value is a Python string which is 1 if data is acknowledged correctly, -1 otherwise.
Example:
a = bus1.dev_write(114,, 112, '123456789')
sends the string '123456789' to the IIC bus device at address 114, starting from address
start, assigning the result to a.
3.13.7 SPI built-in module
SPI built-in module is an implementation on the Python core of the SPI bus Master using
the "bit-banging" technique.
You need to use SPI built-in module if you want to create one or more SPI bus on the
available GPIO pins. This SPI bus handling module is mapped on creation on three or
more GPIO pins that will become the Serial Data In/Out and Serial Clock pins of the bus,
plus a number of optional chip select pins up to 8. It can be multi-instantiated (you can
create more than one SPI bus over different pins) and the pins used must not be used for
other purposes.
Note that Python core does not verify if the pins are already used for other purposes (IIC
module or GPIO module) by other functions, it's the applicator responsibility to ensure that
no conflict over pins occurs.
If you want to use SPI built-in module you need to import it first:
import SPI
then you can create the new bus over the GPIO pins (for example over the pins GPIO3,
GPIO4, GPIO5 ) and then use SPI built-in module methods like in the following example:
SPIbus = SPI.new(3,4,5)
SPIbus.init(0,0)
res = SPIbus.send('test')
c = SPIbus.sendbyte(0x0d)
d = SPIbus.readbyte()
which sends 'test' followed by CR and receives data waiting for one second.
More details about SPI built-in module object methods are in the following paragraphs.
3.13.7.1 SPI.new(SCLK_pin,
MOSI_pin, MISO_pin, <SS0>, <SS1>,…<SS7>)
Creates a new SPI bus object on the GPIO pins number corresponding.
Input parameter SCLK_pin, MOSI_pin and MISO_pin are Python bytes which are the
GPIO pin number where the SCLK (Serial CLocK), MOSI (Master Output Slave Input),
MISO (Master Input Slave Output) lines are mapped. The same is for the SS0 .. SS9
which are OPTIONAL Python bytes which are the GPIO pin number where the