]>
git.ipfire.org Git - people/ms/u-boot.git/blob - drivers/ds1722.c
8 static void ds1722_select(int dev
)
10 ssi_set_interface(4096, 0, 0, 0);
18 u8
ds1722_read(int dev
, int addr
)
32 void ds1722_write(int dev
, int addr
, u8 data
)
36 ssi_tx_byte(0x80|addr
);
43 u16
ds1722_temp(int dev
, int resolution
)
45 static int useconds
[] = {
46 75000, 150000, 300000, 600000, 1200000
52 /* set up the desired resulotion ... */
53 ds1722_write(dev
, 0, 0xe0 | (resolution
<< 1));
55 /* wait while the chip measures the tremperature */
56 udelay(useconds
[resolution
]);
58 res
= (temp
= ds1722_read(dev
, 2)) << 8;
61 temp
= (16 - (ds1722_read(dev
, 1) >> 4)) & 0x0f;
63 temp
= (ds1722_read(dev
, 1) >> 4);
135 int ds1722_probe(int dev
)
137 u16 temp
= ds1722_temp(dev
, DS1722_RESOLUTION_12BIT
);
138 printf("%d.%d deg C\n\n", (char)(temp
>> 8), temp
& 0xff);