better status handling for multiple SSI devices

This commit is contained in:
andreas 2024-03-03 16:36:49 +01:00
parent 71f0bfa6f3
commit c7c5f6c9b9
2 changed files with 20 additions and 6 deletions

View File

@ -21,9 +21,11 @@
checkDef("missing config for " #BUS,GW ## BUS ## _CLK ,GW ## BUS ## _MISO); checkDef("missing config for " #BUS,GW ## BUS ## _CLK ,GW ## BUS ## _MISO);
#define ADD22B(PRFX,BUS) \ #define ADD22B(PRFX,BUS) \
{\
CHECK_BUS(BUS); \ CHECK_BUS(BUS); \
GWDMS22B *dms=new GWDMS22B(api,#PRFX,GW ## BUS ## _HOST);\ GWDMS22B *dms=new GWDMS22B(api,#PRFX,GW ## BUS ## _HOST);\
sensors.add(api,dms); sensors.add(api,dms); \
}
#ifdef GWDMS22B11 #ifdef GWDMS22B11
#define ADD22B11 ADD22B(DMS22B11,SPI0) #define ADD22B11 ADD22B(DMS22B11,SPI0)
@ -38,7 +40,10 @@
#ifdef GWDMS22B12 #ifdef GWDMS22B12
#define ADD22B12 ADD22B(DMS22B12,SPI0) #define ADD22B12 ADD22B(DMS22B12,SPI0)
#ifndef GWDMS22B12_CS #ifndef GWDMS22B12_CS
#define GWDMS22B12_CS -1 #error "you need to define GWDMS22B12_CS"
#endif
#if GWDMS22B11_CS == -1
#error "multiple devices on one SPI bus need chip select defines - GWDMS22B11_CS is unset"
#endif #endif
#else #else
#define GWDMS22B12_CS -1 #define GWDMS22B12_CS -1
@ -48,7 +53,10 @@
#ifdef GWDMS22B13 #ifdef GWDMS22B13
#define ADD22B13 ADD22B(DMS22B13,SPI0) #define ADD22B13 ADD22B(DMS22B13,SPI0)
#ifndef GWDMS22B13_CS #ifndef GWDMS22B13_CS
#define GWDMS22B13_CS -1 #error "you need to define GWDMS22B13_CS"
#endif
#if GWDMS22B11_CS == -1
#error "multiple devices on one SPI bus need chip select defines - GWDMS22B11_CS is unset"
#endif #endif
#else #else
#define GWDMS22B13_CS -1 #define GWDMS22B13_CS -1
@ -68,7 +76,10 @@
#ifdef GWDMS22B22 #ifdef GWDMS22B22
#define ADD22B22 ADD22B(DMS22B22,SPI1) #define ADD22B22 ADD22B(DMS22B22,SPI1)
#ifndef GWDMS22B22_CS #ifndef GWDMS22B22_CS
#define GWDMS22B22_CS -1 #error "you need to define GWDMS22B22_CS"
#endif
#if GWDMS22B21_CS == -1
#error "multiple devices on one SPI bus need chip select defines - GWDMS22B21_CS is unset"
#endif #endif
#else #else
#define GWDMS22B22_CS -1 #define GWDMS22B22_CS -1
@ -78,7 +89,10 @@
#ifdef GWDMS22B23 #ifdef GWDMS22B23
#define ADD22B23 ADD22B(DMS22B23,SPI1) #define ADD22B23 ADD22B(DMS22B23,SPI1)
#ifndef GWDMS22B23_CS #ifndef GWDMS22B23_CS
#define GWDMS22B23_CS -1 #error "you need to define GWDMS22B23_CS"
#endif
#if GWDMS22B21_CS == -1
#error "multiple devices on one SPI bus need chip select defines - GWDMS22B11_CS is unset"
#endif #endif
#else #else
#define GWDMS22B23_CS -1 #define GWDMS22B23_CS -1

View File

@ -21,7 +21,7 @@
{ {
"b": "2", "b": "2",
"i": "21", "i": "21",
"n": "21" "n": "1"
}, },
{ {
"b": "2", "b": "2",