mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-29 21:56:35 +00:00
commit
bda2d38304
@ -26,7 +26,9 @@
|
|||||||
#define SPS30_ADDR 0x69
|
#define SPS30_ADDR 0x69
|
||||||
|
|
||||||
#include <Wire.h>
|
#include <Wire.h>
|
||||||
|
#ifdef ESP8266
|
||||||
#include <twi.h>
|
#include <twi.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
uint8_t sps30_ready = 0;
|
uint8_t sps30_ready = 0;
|
||||||
uint8_t sps30_running;
|
uint8_t sps30_running;
|
||||||
@ -74,7 +76,9 @@ uint8_t sps30_calc_CRC(uint8_t *data) {
|
|||||||
|
|
||||||
void CmdClean(void);
|
void CmdClean(void);
|
||||||
|
|
||||||
|
#ifdef ESP8266
|
||||||
unsigned char twi_readFrom(unsigned char address, unsigned char* buf, unsigned int len, unsigned char sendStop);
|
unsigned char twi_readFrom(unsigned char address, unsigned char* buf, unsigned int len, unsigned char sendStop);
|
||||||
|
#endif
|
||||||
|
|
||||||
void sps30_get_data(uint16_t cmd, uint8_t *data, uint8_t dlen) {
|
void sps30_get_data(uint16_t cmd, uint8_t *data, uint8_t dlen) {
|
||||||
unsigned char cmdb[2];
|
unsigned char cmdb[2];
|
||||||
@ -93,7 +97,11 @@ uint8_t twi_buff[64];
|
|||||||
dlen/=2;
|
dlen/=2;
|
||||||
dlen*=3;
|
dlen*=3;
|
||||||
|
|
||||||
|
#ifdef ESP8266
|
||||||
twi_readFrom(SPS30_ADDR,twi_buff,dlen,1);
|
twi_readFrom(SPS30_ADDR,twi_buff,dlen,1);
|
||||||
|
#else
|
||||||
|
Wire.readTransmission(SPS30_ADDR,twi_buff,dlen,1, NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
uint8_t bind=0;
|
uint8_t bind=0;
|
||||||
while (bind<dlen) {
|
while (bind<dlen) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user