Had to make many changes to get it to compile across many files, including removing the LOCAL specifier from almost all functions. Edited the Makefile to compile all three files and link them. Haven't tested on hardware yet, that's the next step. Lots of small changes to avoid warnings, now that I have turned -Wall on. This makes the code a bit "better". Signed-off-by: A.M. Rowsell <amrowsell@frozenelectronics.ca>
32 lines
837 B
C
32 lines
837 B
C
#include <stdint.h>
|
|
#include "os_type.h"
|
|
#include "gpio.h"
|
|
|
|
/**
|
|
* @struct oneWire_t
|
|
* Structure that holds all the information about onewire connections, including the 64-bit ROM address for each device and some buffer memory to read out the scratchpad
|
|
*/
|
|
typedef struct {
|
|
uint8_t address[8];
|
|
uint8_t scratchpad[9];
|
|
} oneWire_t;
|
|
|
|
/**
|
|
* @enum ds18b20_cmds
|
|
* This enum simply gives easy to read names to all the various one-wire commands that the DS18B20 can accept
|
|
*/
|
|
typedef enum {
|
|
READ_ROM = 0x33,
|
|
MATCH_ROM = 0x55,
|
|
SEARCH_ROM = 0xF0,
|
|
ALARM_SEARCH = 0xEC,
|
|
SKIP_ROM = 0xCC,
|
|
CONVERT_T = 0x44,
|
|
SCRATCH_READ = 0xBE,
|
|
SCRATCH_WRITE = 0x4E,
|
|
SCRATCH_COPY = 0x48,
|
|
E2_RECALL = 0xB8
|
|
} ds18b20_cmds;
|
|
|
|
sint8 ICACHE_FLASH_ATTR init(oneWire_t *owDev);
|
|
void ICACHE_FLASH_ATTR transact(oneWire_t *owDev, ds18b20_cmds cmd);
|