OneWire DS18B20,DS2450,MAX31850
Dependents: MAX31850_HelloWorld
onewire.h
- Committer:
- fblanc
- Date:
- 2015-02-12
- Revision:
- 0:9acbbb021a43
File content as of revision 0:9acbbb021a43:
/** * @file onewire.h * @brief library 1-Wire(www.maxim-ic.com) * @author Maciej Rajtar (Published 10 May 2010 www.mbed.org) * @author Frederic BLANC (Published 01/03/2012 www.mbed.org) */ #ifndef _onewire_ #define _onewire_ #include "DS2450.h" #include "DS18X20.h" #include "MAX31850.h" #include "crc8.h" #include "crc16.h" //#define DEBUG 1 //#define DEBUG_L1 1 #define ONEWIRE_PIN p21 #define MAXSENSORS 8 #define MAXBUS 4 // rom-code size including CRC #define OW_ROMCODE_SIZE 8 #define OW_OK 0x00 #define OW_ERROR 0x01 #define OW_START_FAIL 0x02 #define OW_ERROR_CRC 0x03 #define OW_ERROR_BAD_ID 0x04 #define OW_BUSY 0x05 #define OW_MATCH_ROM 0x55 #define OW_SKIP_ROM 0xCC #define OW_SEARCH_ROM 0xF0 #define OW_READ_ROM 0x33 #define OW_CONDITIONAL_SEARCH 0xEC #define OW_OVERDRIVE_SKIP_ROM 0x3C #define OW_OVERDRIVE_MATCH_ROM 0x69 #define OW_SHORT_CIRCUIT 0xFF #define OW_SEARCH_FIRST 0xFF // start new search #define OW_PRESENCE_ERR 0x01 #define OW_DATA_ERR 0xFE #define OW_LAST_DEVICE 0x00 // last device found // 0x01 ... 0x40: continue searching char* ow_show_id( uint8_t id[],char *text); uint64_t uint64_id( uint8_t id[]); uint8_t search_sensors(uint8_t *nSensors,uint8_t id[][OW_ROMCODE_SIZE] ); uint8_t search_sensors(uint8_t n,uint8_t *nSensors,uint8_t gSensorIDs[][MAXSENSORS][OW_ROMCODE_SIZE] ); uint8_t ow_PullUp(void); uint8_t ow_PullUp(uint8_t n); uint8_t ow_test_pin (void); uint8_t ow_test_pin (uint8_t n); uint8_t ow_reset(void); uint8_t ow_reset(uint8_t n); uint8_t ow_rom_search( uint8_t diff, uint8_t id[] ); uint8_t ow_rom_search(uint8_t n, uint8_t diff, uint8_t id[] ); uint8_t ow_command( uint8_t command, uint8_t id[] ); uint8_t ow_command(uint8_t n, uint8_t command, uint8_t id[] ); uint8_t ow_find_sensor(uint8_t *diff, uint8_t id[]); uint8_t ow_find_sensor(uint8_t n,uint8_t *diff, uint8_t id[]); uint8_t ow_parasite_enable(void); uint8_t ow_parasite_enable(uint8_t n); uint8_t ow_parasite_disable(void); uint8_t ow_parasite_disable(uint8_t n); uint8_t ow_bit_io( uint8_t b ); uint8_t ow_bit_io(uint8_t n, uint8_t b); uint8_t ow_byte_wr( uint8_t b ); uint8_t ow_byte_wr(uint8_t n, uint8_t b ); uint8_t ow_byte_rd( void ); uint8_t ow_byte_rd( uint8_t n); #endif