Mercurial > ~darius > hgwebdir.cgi > tempctrl
comparison ds1307.c @ 61:0910ab6f0095
Add attribution for IIC routines.
author | darius@Inchoate |
---|---|
date | Thu, 30 Oct 2008 20:05:36 +1030 |
parents | 50fca9562310 |
children | 1ef17cd8af7a |
comparison
equal
deleted
inserted
replaced
60:50fca9562310 | 61:0910ab6f0095 |
---|---|
70 * IIC_STFAIL Could generate START condition (broken bus or busy). | 70 * IIC_STFAIL Could generate START condition (broken bus or busy). |
71 * IIC_FAILARB Failed bus arbitration. | 71 * IIC_FAILARB Failed bus arbitration. |
72 * IIC_SLNAK Slave NAK'd. | 72 * IIC_SLNAK Slave NAK'd. |
73 * IIC_NOREPLY No reply (no such slave?) | 73 * IIC_NOREPLY No reply (no such slave?) |
74 * IIC_UNKNOWN Unexpected return from TWI reg. | 74 * IIC_UNKNOWN Unexpected return from TWI reg. |
75 * | |
76 * Heaviy cribbed from twitest.c by Joerg Wunsch | |
75 */ | 77 */ |
76 int | 78 int |
77 iic_read(uint8_t *data, uint8_t len, uint8_t adr, uint8_t sla) { | 79 iic_read(uint8_t *data, uint8_t len, uint8_t adr, uint8_t sla) { |
78 uint8_t twst, twcr, cnt; | 80 uint8_t twst, twcr, cnt; |
79 | 81 |
251 * IIC_STFAIL Could generate START condition (broken bus or busy). | 253 * IIC_STFAIL Could generate START condition (broken bus or busy). |
252 * IIC_FAILARB Failed bus arbitration. | 254 * IIC_FAILARB Failed bus arbitration. |
253 * IIC_SLNAK Slave NAK'd. | 255 * IIC_SLNAK Slave NAK'd. |
254 * IIC_NOREPLY No reply (no such slave?) | 256 * IIC_NOREPLY No reply (no such slave?) |
255 * IIC_UNKNOWN Unexpected return from TWI reg. | 257 * IIC_UNKNOWN Unexpected return from TWI reg. |
258 * | |
259 * Heaviy cribbed from twitest.c by Joerg Wunsch | |
256 */ | 260 */ |
257 int | 261 int |
258 iic_write(uint8_t *data, uint8_t len, uint8_t adr, uint8_t sla) { | 262 iic_write(uint8_t *data, uint8_t len, uint8_t adr, uint8_t sla) { |
259 uint8_t twst, cnt; | 263 uint8_t twst, cnt; |
260 | 264 |