Splitting library into own file. Adding onewire.
The mqtt.c file was getting pretty big, so the example code is now in main.c. Also, we need a onewire library, so I've started to write on in onewire.c. We will need to make some changes to the Makefile as well, but I will need to consult a couple of resources for that. Signed-off-by: A.M. Rowsell <amrowsell@frozenelectronics.ca>
This commit is contained in:
parent
c8bff5cace
commit
70cf55efdf
6 changed files with 185 additions and 111 deletions
33
onewire.h
Normal file
33
onewire.h
Normal file
|
@ -0,0 +1,33 @@
|
|||
#include <stdint.h>
|
||||
#include "hw_timer.c"
|
||||
|
||||
/**
|
||||
* @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[20];
|
||||
} 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
|
||||
*/
|
||||
enum ds18b20_cmds {
|
||||
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
|
||||
};
|
||||
|
||||
|
||||
LOCAL void timerISR(void);
|
||||
LOCAL void ICACHE_FLASH_ATTR reset(oneWire_t *owDev);
|
||||
LOCAL void ICACHE_FLASH_ATTR transact(oneWire_t *owDev, ds18b20_cmds cmd);
|
Loading…
Add table
Add a link
Reference in a new issue