First version that compiles with new file layout.

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>
This commit is contained in:
A.M. Rowsell 2019-01-20 21:13:04 -05:00
commit 48702bf328
Signed by: amr
GPG key ID: 0B6E2D8375CF79A9
7 changed files with 124 additions and 72 deletions

View file

@ -1,5 +1,6 @@
#include <stdint.h>
#include "hw_timer.c"
#include "os_type.h"
#include "gpio.h"
/**
* @struct oneWire_t
@ -7,14 +8,14 @@
*/
typedef struct {
uint8_t address[8];
uint8_t scratchpad[20];
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
*/
enum ds18b20_cmds {
typedef enum {
READ_ROM = 0x33,
MATCH_ROM = 0x55,
SEARCH_ROM = 0xF0,
@ -25,9 +26,7 @@ enum ds18b20_cmds {
SCRATCH_WRITE = 0x4E,
SCRATCH_COPY = 0x48,
E2_RECALL = 0xB8
};
} ds18b20_cmds;
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);
sint8 ICACHE_FLASH_ATTR init(oneWire_t *owDev);
void ICACHE_FLASH_ATTR transact(oneWire_t *owDev, ds18b20_cmds cmd);