2009-02-21 23:02:39 +00:00
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
< html > < head >
< / head >
< h3 > < a name = "over" > < / a > spi< / h3 >
< span style = "font-weight: bold;" > < / span > < br >
< big > < span style = "font-family: Helvetica,Arial,sans-serif;" > < / span > < font style = "font-family: Helvetica,Arial,sans-serif;" size = "2" > < big > < a name = "setup" > < / a > Actual_clock = spi.setup( id,
spi.MASTER | spi.SLAVE, clock, cpol, cpha,< / big > < / font > < span style = "font-family: Helvetica,Arial,sans-serif;" >
< / span > < br style = "font-family: Helvetica,Arial,sans-serif;" >
< span style = "font-family: Helvetica,Arial,sans-serif;" >
2009-09-26 17:00:44 +00:00
< / span > < font style = "font-family: Helvetica,Arial,sans-serif;" size = "2" > < big > databits):
configura a interface SPI com os parâmetros fornecidos, retorna o clock< / big > < / font > < span style = "font-family: Helvetica,Arial,sans-serif;" >
2009-02-21 23:02:39 +00:00
< / span > < br style = "font-family: Helvetica,Arial,sans-serif;" >
< span style = "font-family: Helvetica,Arial,sans-serif;" >
2009-09-26 17:00:44 +00:00
< / span > < font style = "font-family: Helvetica,Arial,sans-serif;" size = "2" > < big > que
2009-06-29 16:43:45 +00:00
foi configurado para a interface.< / big > < / font > < span style = "font-family: Helvetica,Arial,sans-serif;" >
2009-02-21 23:02:39 +00:00
< / span > < br style = "font-family: Helvetica,Arial,sans-serif;" >
< span style = "font-family: Helvetica,Arial,sans-serif;" >
2009-09-26 17:00:44 +00:00
2009-02-21 23:02:39 +00:00
< / span > < br style = "font-family: Helvetica,Arial,sans-serif;" >
< font style = "font-family: Helvetica,Arial,sans-serif;" size = "2" > < big > < a name = "select" > < / a > spi.select(
< / big > < / font > < font style = "font-family: Helvetica,Arial,sans-serif;" size = "2" > < big > id< / big > < / font > < font style = "font-family: Helvetica,Arial,sans-serif;" size = "2" > < big >
2009-09-26 17:00:44 +00:00
): configura a SPI selecionada como ativa (configura a linha SS da interface em questão).< / big > < / font > < span style = "font-family: Helvetica,Arial,sans-serif;" >
2009-02-21 23:02:39 +00:00
< / span > < br style = "font-family: Helvetica,Arial,sans-serif;" >
2009-09-26 17:00:44 +00:00
< font style = "font-family: Helvetica,Arial,sans-serif;" size = "2" > < big > < / big > < / font > < span style = "font-family: Helvetica,Arial,sans-serif;" >
2009-02-21 23:02:39 +00:00
< / span > < br style = "font-family: Helvetica,Arial,sans-serif;" >
< font style = "font-family: Helvetica,Arial,sans-serif;" size = "2" > < big > < a name = "unselect" > < / a > spi.unselect(
2009-09-26 17:00:44 +00:00
id ): inicializa a linha SS da interface em questão.< / big > < / font > < span style = "font-family: Helvetica,Arial,sans-serif;" >
2009-02-21 23:02:39 +00:00
< / span > < br style = "font-family: Helvetica,Arial,sans-serif;" >
2009-09-26 17:00:44 +00:00
< font style = "font-family: Helvetica,Arial,sans-serif;" size = "2" > < big > < / big > < / font > < span style = "font-family: Helvetica,Arial,sans-serif;" >
2009-02-21 23:02:39 +00:00
< / span > < br style = "font-family: Helvetica,Arial,sans-serif;" >
< font style = "font-family: Helvetica,Arial,sans-serif;" size = "2" > < big > < a name = "send" > < / a > spi.send(
2009-06-29 16:43:45 +00:00
id, Data1, Data2, ... ): envia todos os dados para a interface SPI especificada.< / big > < / font > < span style = "font-family: Helvetica,Arial,sans-serif;" >
2009-02-21 23:02:39 +00:00
< / span > < br style = "font-family: Helvetica,Arial,sans-serif;" >
< span style = "font-family: Helvetica,Arial,sans-serif;" >
2009-09-26 17:00:44 +00:00
< / span > < font style = "font-family: Helvetica,Arial,sans-serif;" size = "2" > < / font > < span style = "font-family: Helvetica,Arial,sans-serif;" >
2009-02-21 23:02:39 +00:00
< / span > < br style = "font-family: Helvetica,Arial,sans-serif;" >
< span style = "font-family: Helvetica,Arial,sans-serif;" >
2009-09-26 17:00:44 +00:00
2009-02-21 23:02:39 +00:00
< / span > < br style = "font-family: Helvetica,Arial,sans-serif;" >
< font style = "font-family: Helvetica,Arial,sans-serif;" size = "2" > < big > < a name = "sendrecv" > < / a > [< / big > < / font > < font style = "font-family: Helvetica,Arial,sans-serif;" size = "2" > < big > spi.sendrecv(< / big > < / font > < font style = "font-family: Helvetica,Arial,sans-serif;" size = "2" > < big > id,
2009-09-26 17:00:44 +00:00
Out1, Out2, ...< / big > < / font > < font style = "font-family: Helvetica,Arial,sans-serif;" size = "2" > < big > )]
2009-02-21 23:02:39 +00:00
< / big > < / font > < font style = "font-family: Helvetica,Arial,sans-serif;" size = "2" > < big > In1,
2009-06-29 16:43:45 +00:00
In2, ... = spi.send_recv( id, Out1, Out2, ... ): envia todos os "out"
bytes< / big > < / font > < span style = "font-family: Helvetica,Arial,sans-serif;" > < / span > < font style = "font-family: Helvetica,Arial,sans-serif;" size = "2" > < big > para
a interface SPI especificada e retorna o dado lido a cada byte enviado.< / big > < / font > < span style = "font-family: Helvetica,Arial,sans-serif;" >
2009-02-21 23:02:39 +00:00
< / span > < br style = "font-family: Helvetica,Arial,sans-serif;" >
< br style = "font-family: Helvetica,Arial,sans-serif;" >
2009-06-29 16:43:45 +00:00
< font style = "font-family: Helvetica,Arial,sans-serif;" size = "2" > < big > Retornando
2009-09-26 17:00:44 +00:00
diversos valôres dessa forma, facilitaria algumas futuras implementações ? (ok, isso poderia ser uma outra função :)< / big > < / font > < span style = "font-family: Helvetica,Arial,sans-serif;" >
2009-02-21 23:02:39 +00:00
< / span > < br style = "font-family: Helvetica,Arial,sans-serif;" >
< br style = "font-family: Helvetica,Arial,sans-serif;" >
2009-09-26 17:00:44 +00:00
< font style = "font-family: Helvetica,Arial,sans-serif;" size = "2" > < big > Enviando múltiplos data/chars em uma única
chamada e não usando
uma tabela como argumento, evita que os dados sejam montados em tempo de execução
2009-06-29 16:43:45 +00:00
(claro que sem menhum string de mensagem :)< / big > < / font > < br >
2009-02-21 23:02:39 +00:00
< br >
< br >
< br >
< br >
< br >
< br >
< br >
< br >
< br >
< br >
< br >
< br >
< br >
< br >
< br >
< br >
< br >
< br >
< br >
< br >
< br >
< br >
< br >
< br >
< br >
< br >
< br >
< br >
< br >
< br style = "font-family: Helvetica,Arial,sans-serif;" >
< br style = "font-family: Helvetica,Arial,sans-serif;" >
< br style = "font-family: Helvetica,Arial,sans-serif;" >
< span style = "font-family: Helvetica,Arial,sans-serif;" >
2009-09-26 17:00:44 +00:00
2009-02-21 23:02:39 +00:00
< / span > < / big > < br >
< br style = "font-family: Verdana;" >
2009-06-29 16:43:45 +00:00
< / body > < / html >