Simple cpp wrapper of a ds18b20, onewire 'c' library. Supports multiple sensors.
Dependents: LPC11U68_DS18B20Sensor
Fork of DS18B20Sensor by
onewire.h
00001 /** 00002 * @file onewire.h 00003 * @brief library 1-Wire(www.maxim-ic.com) 00004 * @author Maciej Rajtar (Published 10 May 2010 www.mbed.org) 00005 * @author Frederic BLANC 00006 */ 00007 00008 #ifndef _onewire_ 00009 #define _onewire_ 00010 00011 //#define DEBUG 1 00012 //#define DEBUG_L1 1 00013 //#define ONEWIRE_PIN p30 00014 #define ONEWIRE_PIN P1_25 // for LPC11U68 Xpresso v2 Board 00015 00016 #define MAXSENSORS 16 00017 00018 // rom-code size including CRC 00019 #define OW_ROMCODE_SIZE 8 00020 00021 #define OW_OK 0x00 00022 #define OW_ERROR 0x01 00023 #define OW_START_FAIL 0x02 00024 #define OW_ERROR_CRC 0x03 00025 #define OW_ERROR_BAD_ID 0x04 00026 #define OW_BUSY 0x05 00027 00028 #define OW_MATCH_ROM 0x55 00029 #define OW_SKIP_ROM 0xCC 00030 #define OW_SEARCH_ROM 0xF0 00031 #define OW_READ_ROM 0x33 00032 #define OW_CONDITIONAL_SEARCH 0xEC 00033 #define OW_OVERDRIVE_SKIP_ROM 0x3C 00034 #define OW_OVERDRIVE_MATCH_ROM 0x69 00035 00036 #define OW_SHORT_CIRCUIT 0xFF 00037 #define OW_SEARCH_FIRST 0xFF // start new search 00038 #define OW_PRESENCE_ERR 0x01 00039 #define OW_DATA_ERR 0xFE 00040 #define OW_LAST_DEVICE 0x00 // last device found 00041 // 0x01 ... 0x40: continue searching 00042 uint8_t search_sensors(uint8_t *nSensors,uint8_t *gSensorIDs ); 00043 uint8_t ow_PullUp(void); 00044 uint8_t ow_show_id( uint8_t id[], size_t n ,char *text); 00045 uint8_t ow_test_pin (void); 00046 uint8_t ow_reset(void); 00047 uint8_t ow_rom_search( uint8_t diff, uint8_t id[] ); 00048 uint8_t ow_command( uint8_t command, uint8_t id[] ); 00049 uint8_t ow_find_sensor(uint8_t *diff, uint8_t id[]); 00050 uint8_t ow_parasite_enable(void); 00051 uint8_t ow_parasite_disable(void); 00052 uint8_t ow_bit_io( uint8_t b ); 00053 uint8_t ow_byte_wr( uint8_t b ); 00054 uint8_t ow_byte_rd( void ); 00055 00056 00057 #endif
Generated on Wed Jul 13 2022 23:17:04 by 1.7.2