Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:23:43

0001 #ifndef I2C_DS_1621_DRIVER_H
0002 #define I2C_DS_1621_DRIVER_H
0003 
0004 /* Trivial i2c driver for the maxim DS1621 temperature sensor;
0005  * just implements reading constant conversions with 8-bit
0006  * resolution.
0007  * Demonstrates the implementation of a i2c high-level driver.
0008  */
0009 
0010 /*
0011  * Authorship
0012  * ----------
0013  * This software was created by
0014  *     Till Straumann <strauman@slac.stanford.edu>, 2005,
0015  *     Stanford Linear Accelerator Center, Stanford University.
0016  *
0017  * Acknowledgement of sponsorship
0018  * ------------------------------
0019  * This software was produced by
0020  *     the Stanford Linear Accelerator Center, Stanford University,
0021  *     under Contract DE-AC03-76SFO0515 with the Department of Energy.
0022  *
0023  * Government disclaimer of liability
0024  * ----------------------------------
0025  * Neither the United States nor the United States Department of Energy,
0026  * nor any of their employees, makes any warranty, express or implied, or
0027  * assumes any legal liability or responsibility for the accuracy,
0028  * completeness, or usefulness of any data, apparatus, product, or process
0029  * disclosed, or represents that its use would not infringe privately owned
0030  * rights.
0031  *
0032  * Stanford disclaimer of liability
0033  * --------------------------------
0034  * Stanford University makes no representations or warranties, express or
0035  * implied, nor assumes any liability for the use of this software.
0036  *
0037  * Stanford disclaimer of copyright
0038  * --------------------------------
0039  * Stanford University, owner of the copyright, hereby disclaims its
0040  * copyright and all other rights in this software.  Hence, anyone may
0041  * freely use it for any purpose without restriction.
0042  *
0043  * Maintenance of notices
0044  * ----------------------
0045  * In the interest of clarity regarding the origin and status of this
0046  * SLAC software, this and all the preceding Stanford University notices
0047  * are to remain affixed to any copy or derivative of this software made
0048  * or distributed by the recipient and are to be affixed to any copy of
0049  * software made or distributed by the recipient that contains a copy or
0050  * derivative of this software.
0051  *
0052  * ------------------ SLAC Software Notices, Set 4 OTT.002a, 2004 FEB 03
0053  */
0054 
0055 #define DS1621_CMD_READ_TEMP    0xaa
0056 #define DS1621_CMD_CSR_ACCESS   0xac
0057 #define DS1621_CMD_START_CONV   0xee
0058 
0059 /* CSR bits */
0060 #define DS1621_CSR_DONE         (1<<7)
0061 #define DS1621_CSR_TEMP_HI      (1<<6)  /* T >= hi register */
0062 #define DS1621_CSR_TEMP_LO      (1<<5)  /* T <= lo register */
0063 #define DS1621_CSR_NVMEM_BSY    (1<<4)  /* non-volatile memory busy */
0064 #define DS1621_CSR_OUT_POL      (1<<1)  /* Thermostat output active polarity */
0065 #define DS1621_CSR_1SHOT        (1<<0)  /* Oneshot mode     */
0066 
0067 #include <rtems.h>
0068 #include <rtems/libi2c.h>
0069 
0070 #ifdef __cplusplus
0071 extern "C" {
0072 #endif
0073 
0074 /* for registration with libi2c */
0075 extern rtems_libi2c_drv_t *i2c_ds1621_driver_descriptor;
0076 
0077 #ifdef __cplusplus
0078 }
0079 #endif
0080 
0081 #endif