MAX31850, DS18B20, DS2450, thermocouple

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers onewire.h Source File

onewire.h

Go to the documentation of this file.
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 (Published 01/03/2012 www.mbed.org)
00006 */
00007 
00008 #ifndef _onewire_
00009 #define _onewire_
00010 #include "DS2450.h"
00011 #include "DS18X20.h"
00012 #include "MAX31850.h"
00013 #include "crc8.h"
00014 #include "crc16.h"
00015 //#define DEBUG 1
00016 //#define DEBUG_L1 1
00017 #define ONEWIRE_PIN  p21
00018 
00019 #define MAXSENSORS 8
00020 #define MAXBUS 4
00021 // rom-code size including CRC
00022 #define OW_ROMCODE_SIZE 8
00023 
00024 #define OW_OK          0x00
00025 #define OW_ERROR       0x01
00026 #define OW_START_FAIL  0x02
00027 #define OW_ERROR_CRC   0x03
00028 #define OW_ERROR_BAD_ID 0x04
00029 #define OW_BUSY          0x05
00030 
00031 #define OW_MATCH_ROM    0x55
00032 #define OW_SKIP_ROM     0xCC
00033 #define OW_SEARCH_ROM   0xF0
00034 #define OW_READ_ROM     0x33
00035 #define OW_CONDITIONAL_SEARCH     0xEC
00036 #define OW_OVERDRIVE_SKIP_ROM     0x3C
00037 #define OW_OVERDRIVE_MATCH_ROM    0x69
00038 
00039 #define OW_SHORT_CIRCUIT   0xFF
00040 #define OW_SEARCH_FIRST    0xFF        // start new search
00041 #define OW_PRESENCE_ERR    0x01
00042 #define OW_DATA_ERR        0xFE
00043 #define OW_LAST_DEVICE     0x00        // last device found
00044 //            0x01 ... 0x40: continue searching
00045 
00046 
00047 
00048 char* ow_show_id( uint8_t id[],char *text); 
00049 uint64_t uint64_id( uint8_t id[]);
00050 
00051 uint8_t search_sensors(uint8_t *nSensors,uint8_t id[][OW_ROMCODE_SIZE] );
00052 uint8_t search_sensors(uint8_t n,uint8_t *nSensors,uint8_t gSensorIDs[][MAXSENSORS][OW_ROMCODE_SIZE] );
00053 uint8_t ow_PullUp(void);
00054 uint8_t ow_PullUp(uint8_t n);
00055 
00056 
00057 uint8_t ow_test_pin (void);
00058 uint8_t ow_test_pin (uint8_t n);
00059 uint8_t ow_reset(void);
00060 uint8_t ow_reset(uint8_t n);
00061 uint8_t ow_rom_search( uint8_t diff, uint8_t id[] );
00062 uint8_t ow_rom_search(uint8_t n, uint8_t diff, uint8_t id[] );
00063 uint8_t ow_command( uint8_t command, uint8_t id[] );
00064 uint8_t ow_command(uint8_t n, uint8_t command, uint8_t id[] );
00065 uint8_t ow_find_sensor(uint8_t *diff, uint8_t id[]);
00066 uint8_t ow_find_sensor(uint8_t n,uint8_t *diff, uint8_t id[]);
00067 uint8_t ow_parasite_enable(void);
00068 uint8_t ow_parasite_enable(uint8_t n);
00069 uint8_t ow_parasite_disable(void);
00070 uint8_t ow_parasite_disable(uint8_t n);
00071 uint8_t ow_bit_io( uint8_t b );
00072 uint8_t ow_bit_io(uint8_t n, uint8_t b);
00073 uint8_t ow_byte_wr( uint8_t b );
00074 uint8_t ow_byte_wr(uint8_t n, uint8_t b );
00075 uint8_t ow_byte_rd( void );
00076 uint8_t ow_byte_rd( uint8_t n);
00077 
00078 
00079 #endif