Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
OneWire/onewire.h@0:55f2866e9c0c, 2014-05-27 (annotated)
- Committer:
- fblanc
- Date:
- Tue May 27 15:01:13 2014 +0000
- Revision:
- 0:55f2866e9c0c
ok
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
fblanc | 0:55f2866e9c0c | 1 | /** |
fblanc | 0:55f2866e9c0c | 2 | * @file onewire.h |
fblanc | 0:55f2866e9c0c | 3 | * @brief library 1-Wire(www.maxim-ic.com) |
fblanc | 0:55f2866e9c0c | 4 | * @author Maciej Rajtar (Published 10 May 2010 www.mbed.org) |
fblanc | 0:55f2866e9c0c | 5 | * @author Frederic BLANC (Published 01/03/2012 www.mbed.org) |
fblanc | 0:55f2866e9c0c | 6 | */ |
fblanc | 0:55f2866e9c0c | 7 | |
fblanc | 0:55f2866e9c0c | 8 | #ifndef _onewire_ |
fblanc | 0:55f2866e9c0c | 9 | #define _onewire_ |
fblanc | 0:55f2866e9c0c | 10 | #include "DS2450.h" |
fblanc | 0:55f2866e9c0c | 11 | #include "DS18X20.h" |
fblanc | 0:55f2866e9c0c | 12 | #include "MAX31850.h" |
fblanc | 0:55f2866e9c0c | 13 | #include "crc8.h" |
fblanc | 0:55f2866e9c0c | 14 | #include "crc16.h" |
fblanc | 0:55f2866e9c0c | 15 | //#define DEBUG 1 |
fblanc | 0:55f2866e9c0c | 16 | //#define DEBUG_L1 1 |
fblanc | 0:55f2866e9c0c | 17 | #define ONEWIRE_PIN p21 |
fblanc | 0:55f2866e9c0c | 18 | |
fblanc | 0:55f2866e9c0c | 19 | #define MAXSENSORS 8 |
fblanc | 0:55f2866e9c0c | 20 | #define MAXBUS 4 |
fblanc | 0:55f2866e9c0c | 21 | // rom-code size including CRC |
fblanc | 0:55f2866e9c0c | 22 | #define OW_ROMCODE_SIZE 8 |
fblanc | 0:55f2866e9c0c | 23 | |
fblanc | 0:55f2866e9c0c | 24 | #define OW_OK 0x00 |
fblanc | 0:55f2866e9c0c | 25 | #define OW_ERROR 0x01 |
fblanc | 0:55f2866e9c0c | 26 | #define OW_START_FAIL 0x02 |
fblanc | 0:55f2866e9c0c | 27 | #define OW_ERROR_CRC 0x03 |
fblanc | 0:55f2866e9c0c | 28 | #define OW_ERROR_BAD_ID 0x04 |
fblanc | 0:55f2866e9c0c | 29 | #define OW_BUSY 0x05 |
fblanc | 0:55f2866e9c0c | 30 | |
fblanc | 0:55f2866e9c0c | 31 | #define OW_MATCH_ROM 0x55 |
fblanc | 0:55f2866e9c0c | 32 | #define OW_SKIP_ROM 0xCC |
fblanc | 0:55f2866e9c0c | 33 | #define OW_SEARCH_ROM 0xF0 |
fblanc | 0:55f2866e9c0c | 34 | #define OW_READ_ROM 0x33 |
fblanc | 0:55f2866e9c0c | 35 | #define OW_CONDITIONAL_SEARCH 0xEC |
fblanc | 0:55f2866e9c0c | 36 | #define OW_OVERDRIVE_SKIP_ROM 0x3C |
fblanc | 0:55f2866e9c0c | 37 | #define OW_OVERDRIVE_MATCH_ROM 0x69 |
fblanc | 0:55f2866e9c0c | 38 | |
fblanc | 0:55f2866e9c0c | 39 | #define OW_SHORT_CIRCUIT 0xFF |
fblanc | 0:55f2866e9c0c | 40 | #define OW_SEARCH_FIRST 0xFF // start new search |
fblanc | 0:55f2866e9c0c | 41 | #define OW_PRESENCE_ERR 0x01 |
fblanc | 0:55f2866e9c0c | 42 | #define OW_DATA_ERR 0xFE |
fblanc | 0:55f2866e9c0c | 43 | #define OW_LAST_DEVICE 0x00 // last device found |
fblanc | 0:55f2866e9c0c | 44 | // 0x01 ... 0x40: continue searching |
fblanc | 0:55f2866e9c0c | 45 | |
fblanc | 0:55f2866e9c0c | 46 | |
fblanc | 0:55f2866e9c0c | 47 | |
fblanc | 0:55f2866e9c0c | 48 | char* ow_show_id( uint8_t id[],char *text); |
fblanc | 0:55f2866e9c0c | 49 | uint64_t uint64_id( uint8_t id[]); |
fblanc | 0:55f2866e9c0c | 50 | |
fblanc | 0:55f2866e9c0c | 51 | uint8_t search_sensors(uint8_t *nSensors,uint8_t id[][OW_ROMCODE_SIZE] ); |
fblanc | 0:55f2866e9c0c | 52 | uint8_t search_sensors(uint8_t n,uint8_t *nSensors,uint8_t gSensorIDs[][MAXSENSORS][OW_ROMCODE_SIZE] ); |
fblanc | 0:55f2866e9c0c | 53 | uint8_t ow_PullUp(void); |
fblanc | 0:55f2866e9c0c | 54 | uint8_t ow_PullUp(uint8_t n); |
fblanc | 0:55f2866e9c0c | 55 | |
fblanc | 0:55f2866e9c0c | 56 | |
fblanc | 0:55f2866e9c0c | 57 | uint8_t ow_test_pin (void); |
fblanc | 0:55f2866e9c0c | 58 | uint8_t ow_test_pin (uint8_t n); |
fblanc | 0:55f2866e9c0c | 59 | uint8_t ow_reset(void); |
fblanc | 0:55f2866e9c0c | 60 | uint8_t ow_reset(uint8_t n); |
fblanc | 0:55f2866e9c0c | 61 | uint8_t ow_rom_search( uint8_t diff, uint8_t id[] ); |
fblanc | 0:55f2866e9c0c | 62 | uint8_t ow_rom_search(uint8_t n, uint8_t diff, uint8_t id[] ); |
fblanc | 0:55f2866e9c0c | 63 | uint8_t ow_command( uint8_t command, uint8_t id[] ); |
fblanc | 0:55f2866e9c0c | 64 | uint8_t ow_command(uint8_t n, uint8_t command, uint8_t id[] ); |
fblanc | 0:55f2866e9c0c | 65 | uint8_t ow_find_sensor(uint8_t *diff, uint8_t id[]); |
fblanc | 0:55f2866e9c0c | 66 | uint8_t ow_find_sensor(uint8_t n,uint8_t *diff, uint8_t id[]); |
fblanc | 0:55f2866e9c0c | 67 | uint8_t ow_parasite_enable(void); |
fblanc | 0:55f2866e9c0c | 68 | uint8_t ow_parasite_enable(uint8_t n); |
fblanc | 0:55f2866e9c0c | 69 | uint8_t ow_parasite_disable(void); |
fblanc | 0:55f2866e9c0c | 70 | uint8_t ow_parasite_disable(uint8_t n); |
fblanc | 0:55f2866e9c0c | 71 | uint8_t ow_bit_io( uint8_t b ); |
fblanc | 0:55f2866e9c0c | 72 | uint8_t ow_bit_io(uint8_t n, uint8_t b); |
fblanc | 0:55f2866e9c0c | 73 | uint8_t ow_byte_wr( uint8_t b ); |
fblanc | 0:55f2866e9c0c | 74 | uint8_t ow_byte_wr(uint8_t n, uint8_t b ); |
fblanc | 0:55f2866e9c0c | 75 | uint8_t ow_byte_rd( void ); |
fblanc | 0:55f2866e9c0c | 76 | uint8_t ow_byte_rd( uint8_t n); |
fblanc | 0:55f2866e9c0c | 77 | |
fblanc | 0:55f2866e9c0c | 78 | |
fblanc | 0:55f2866e9c0c | 79 | #endif |