Skip to content

Commit 572a7ff

Browse files
authored
Merge pull request #170 from adafruit/protobuf-update-7bb8007cb0b5aa2c0ce46cbf2856ac0fe776756b
BREAKING .proto file wrappers updated
2 parents 25d9407 + 97fd95e commit 572a7ff

File tree

11 files changed

+143
-143
lines changed

11 files changed

+143
-143
lines changed

src/Wippersnapper.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -534,24 +534,24 @@ bool cbDecodeSignalRequestI2C(pb_istream_t *stream, const pb_field_t *field,
534534
wippersnapper_signal_v1_I2CResponse_init_zero;
535535
if (field->tag == wippersnapper_signal_v1_I2CRequest_req_i2c_init_tag) {
536536
WS_DEBUG_PRINTLN("I2C Init Request Found!");
537-
// Decode I2CInitRequest
538-
wippersnapper_i2c_v1_I2CInitRequest msgI2cInitRequest =
539-
wippersnapper_i2c_v1_I2CInitRequest_init_zero;
540-
if (!pb_decode(stream, wippersnapper_i2c_v1_I2CInitRequest_fields,
541-
&msgI2cInitRequest)) {
537+
// Decode I2CBusInitRequest
538+
wippersnapper_i2c_v1_I2CBusInitRequest msgI2CBusInitRequest =
539+
wippersnapper_i2c_v1_I2CBusInitRequest_init_zero;
540+
if (!pb_decode(stream, wippersnapper_i2c_v1_I2CBusInitRequest_fields,
541+
&msgI2CBusInitRequest)) {
542542
WS_DEBUG_PRINTLN(
543-
"ERROR: Could not decode wippersnapper_i2c_v1_I2CInitRequest");
543+
"ERROR: Could not decode wippersnapper_i2c_v1_I2CBusInitRequest");
544544
return false; // fail out
545545
}
546546

547547
// Create a new I2C Component
548-
if (msgI2cInitRequest.i2c_port_number == 0) {
549-
WS._i2cPort0 = new WipperSnapper_Component_I2C(&msgI2cInitRequest);
548+
if (msgI2CBusInitRequest.i2c_port_number == 0) {
549+
WS._i2cPort0 = new WipperSnapper_Component_I2C(&msgI2CBusInitRequest);
550550
WS.i2cComponents.push_back(WS._i2cPort0);
551551
// did we init. the port successfully?
552552
is_success = WS._i2cPort0->isInitialized();
553-
} else if (msgI2cInitRequest.i2c_port_number == 1) {
554-
WS._i2cPort1 = new WipperSnapper_Component_I2C(&msgI2cInitRequest);
553+
} else if (msgI2CBusInitRequest.i2c_port_number == 1) {
554+
WS._i2cPort1 = new WipperSnapper_Component_I2C(&msgI2CBusInitRequest);
555555
// did we init. the port successfully?
556556
is_success = WS._i2cPort1->isInitialized();
557557
WS.i2cComponents.push_back(WS._i2cPort1);
@@ -573,13 +573,13 @@ bool cbDecodeSignalRequestI2C(pb_istream_t *stream, const pb_field_t *field,
573573
wippersnapper_signal_v1_I2CRequest_req_i2c_scan_tag) {
574574
WS_DEBUG_PRINTLN("I2C Scan Request");
575575

576-
// Decode I2CScanRequest
577-
wippersnapper_i2c_v1_I2CScanRequest msgScanReq =
578-
wippersnapper_i2c_v1_I2CScanRequest_init_zero;
579-
if (!pb_decode(stream, wippersnapper_i2c_v1_I2CScanRequest_fields,
576+
// Decode I2CBusScanRequest
577+
wippersnapper_i2c_v1_I2CBusScanRequest msgScanReq =
578+
wippersnapper_i2c_v1_I2CBusScanRequest_init_zero;
579+
if (!pb_decode(stream, wippersnapper_i2c_v1_I2CBusScanRequest_fields,
580580
&msgScanReq)) {
581581
WS_DEBUG_PRINTLN(
582-
"ERROR: Could not decode wippersnapper_i2c_v1_I2CScanRequest");
582+
"ERROR: Could not decode wippersnapper_i2c_v1_I2CBusScanRequest");
583583
return false; // fail out if we can't decode the request
584584
}
585585

@@ -591,8 +591,8 @@ bool cbDecodeSignalRequestI2C(pb_istream_t *stream, const pb_field_t *field,
591591
}
592592

593593
// Perform I2C scan
594-
wippersnapper_i2c_v1_I2CScanResponse scanResp =
595-
wippersnapper_i2c_v1_I2CScanResponse_init_zero;
594+
wippersnapper_i2c_v1_I2CBusScanResponse scanResp =
595+
wippersnapper_i2c_v1_I2CBusScanResponse_init_zero;
596596
if (msgScanReq.i2c_port_number == 0) {
597597
scanResp = WS._i2cPort0->scanAddresses();
598598
} else {

src/components/i2c/WipperSnapper_I2C.cpp

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
*/
2525
/***************************************************************************************************************/
2626
WipperSnapper_Component_I2C::WipperSnapper_Component_I2C(
27-
wippersnapper_i2c_v1_I2CInitRequest *msgInitRequest) {
27+
wippersnapper_i2c_v1_I2CBusInitRequest *msgInitRequest) {
2828
WS_DEBUG_PRINTLN("EXEC: New I2C Port ");
2929
WS_DEBUG_PRINT("\tPort #: ");
3030
WS_DEBUG_PRINTLN(msgInitRequest->i2c_port_number);
@@ -84,16 +84,16 @@ bool WipperSnapper_Component_I2C::isInitialized() { return _isInit; }
8484
/*!
8585
@brief Scans all I2C addresses on the bus between 0x08 and 0x7F
8686
inclusive and returns an array of the devices found.
87-
@returns wippersnapper_i2c_v1_I2CScanResponse
87+
@returns wippersnapper_i2c_v1_I2CBusScanResponse
8888
*/
8989
/************************************************************************/
90-
wippersnapper_i2c_v1_I2CScanResponse
90+
wippersnapper_i2c_v1_I2CBusScanResponse
9191
WipperSnapper_Component_I2C::scanAddresses() {
9292
WS_DEBUG_PRINT("EXEC: I2C Scan");
9393

9494
// Create response
95-
wippersnapper_i2c_v1_I2CScanResponse scanResp =
96-
wippersnapper_i2c_v1_I2CScanResponse_init_zero;
95+
wippersnapper_i2c_v1_I2CBusScanResponse scanResp =
96+
wippersnapper_i2c_v1_I2CBusScanResponse_init_zero;
9797

9898
// Scan all I2C addresses between 0x08 and 0x7F inclusive and return a list of
9999
// those that respond.
@@ -127,31 +127,31 @@ bool WipperSnapper_Component_I2C::attachI2CDevice(
127127
// AHTX0 Sensor
128128
if (msgDeviceInitReq->has_aht_init) {
129129
// TODO: Implement handling in future release
130-
/* uint16_t addr = (uint16_t)msgDeviceInitReq->aht_init.address;
131-
WS_DEBUG_PRINTLN("Requesting to initialize AHTx sensor");
132-
WS_DEBUG_PRINT("\tSensor Addr: ");
133-
WS_DEBUG_PRINTLN(addr, HEX);
134-
WS_DEBUG_PRINT("\tTemperature sensor enabled? ");
135-
WS_DEBUG_PRINTLN(msgDeviceInitReq->aht_init.enable_temperature);
136-
WS_DEBUG_PRINT("\tHumidity sensor enabled? ");
137-
WS_DEBUG_PRINTLN(msgDeviceInitReq->aht_init.enable_humidity);
130+
/* uint16_t addr = (uint16_t)msgDeviceInitReq->aht_init.address;
131+
WS_DEBUG_PRINTLN("Requesting to initialize AHTx sensor");
132+
WS_DEBUG_PRINT("\tSensor Addr: ");
133+
WS_DEBUG_PRINTLN(addr, HEX);
134+
WS_DEBUG_PRINT("\tTemperature sensor enabled? ");
135+
WS_DEBUG_PRINTLN(msgDeviceInitReq->aht_init.enable_temperature);
136+
WS_DEBUG_PRINT("\tHumidity sensor enabled? ");
137+
WS_DEBUG_PRINTLN(msgDeviceInitReq->aht_init.enable_humidity);
138138
139-
// TODO: Create I2C Driver using the an AHT driver sub-class!
140-
I2C_Driver *aht = new I2C_Driver(addr, this->_i2c);
141-
// Attempt to initialize the sensor driver
142-
if (!aht->initAHTX0()) {
143-
attachSuccess = false;
144-
return attachSuccess;
145-
}
146-
// Initialize device-specific sensors
147-
if (msgDeviceInitReq->aht_init.enable_temperature == true) {
148-
aht->enableAHTX0Temperature();
149-
}
150-
if (msgDeviceInitReq->aht_init.enable_humidity == true) {
151-
aht->enableAHTX0Humidity();
152-
}
153-
// Push to vector for sensor drivers
154-
activeDrivers.push_back(aht); */
139+
// TODO: Create I2C Driver using the an AHT driver sub-class!
140+
I2C_Driver *aht = new I2C_Driver(addr, this->_i2c);
141+
// Attempt to initialize the sensor driver
142+
if (!aht->initAHTX0()) {
143+
attachSuccess = false;
144+
return attachSuccess;
145+
}
146+
// Initialize device-specific sensors
147+
if (msgDeviceInitReq->aht_init.enable_temperature == true) {
148+
aht->enableAHTX0Temperature();
149+
}
150+
if (msgDeviceInitReq->aht_init.enable_humidity == true) {
151+
aht->enableAHTX0Humidity();
152+
}
153+
// Push to vector for sensor drivers
154+
activeDrivers.push_back(aht); */
155155
attachSuccess = true;
156156
} else {
157157
WS_DEBUG_PRINTLN("ERROR: Sensor not found")

src/components/i2c/WipperSnapper_I2C.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ class I2C_Driver;
3333
class WipperSnapper_Component_I2C {
3434
public:
3535
WipperSnapper_Component_I2C(
36-
wippersnapper_i2c_v1_I2CInitRequest *msgInitRequest);
36+
wippersnapper_i2c_v1_I2CBusInitRequest *msgInitRequest);
3737
~WipperSnapper_Component_I2C();
38-
wippersnapper_i2c_v1_I2CScanResponse scanAddresses();
38+
wippersnapper_i2c_v1_I2CBusScanResponse scanAddresses();
3939
bool
4040
attachI2CDevice(wippersnapper_i2c_v1_I2CDeviceInitRequest *msgDeviceInitReq);
4141
bool isInitialized();

src/wippersnapper/description/v1/description.pb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* Automatically generated nanopb constant definitions */
2-
/* Generated by nanopb-0.4.5-dev at Fri Oct 15 20:29:56 2021. */
2+
/* Generated by nanopb-0.4.5-dev at Fri Oct 15 20:43:36 2021. */
33

44
#include "wippersnapper/description/v1/description.pb.h"
55
#if PB_PROTO_HEADER_VERSION != 40

src/wippersnapper/description/v1/description.pb.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* Automatically generated nanopb header */
2-
/* Generated by nanopb-0.4.5-dev at Fri Oct 15 20:29:56 2021. */
2+
/* Generated by nanopb-0.4.5-dev at Fri Oct 15 20:43:36 2021. */
33

44
#ifndef PB_WIPPERSNAPPER_DESCRIPTION_V1_WIPPERSNAPPER_DESCRIPTION_V1_DESCRIPTION_PB_H_INCLUDED
55
#define PB_WIPPERSNAPPER_DESCRIPTION_V1_WIPPERSNAPPER_DESCRIPTION_V1_DESCRIPTION_PB_H_INCLUDED

src/wippersnapper/i2c/v1/i2c.pb.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
/* Automatically generated nanopb constant definitions */
2-
/* Generated by nanopb-0.4.5-dev at Fri Oct 15 20:29:56 2021. */
2+
/* Generated by nanopb-0.4.5-dev at Fri Oct 15 20:43:36 2021. */
33

44
#include "wippersnapper/i2c/v1/i2c.pb.h"
55
#if PB_PROTO_HEADER_VERSION != 40
66
#error Regenerate this file with the current version of nanopb generator.
77
#endif
88

9-
PB_BIND(wippersnapper_i2c_v1_I2CInitRequest, wippersnapper_i2c_v1_I2CInitRequest, AUTO)
9+
PB_BIND(wippersnapper_i2c_v1_I2CBusInitRequest, wippersnapper_i2c_v1_I2CBusInitRequest, AUTO)
1010

1111

12-
PB_BIND(wippersnapper_i2c_v1_I2CInitResponse, wippersnapper_i2c_v1_I2CInitResponse, AUTO)
12+
PB_BIND(wippersnapper_i2c_v1_I2CBusInitResponse, wippersnapper_i2c_v1_I2CBusInitResponse, AUTO)
1313

1414

15-
PB_BIND(wippersnapper_i2c_v1_I2CSetFrequency, wippersnapper_i2c_v1_I2CSetFrequency, AUTO)
15+
PB_BIND(wippersnapper_i2c_v1_I2CBusSetFrequency, wippersnapper_i2c_v1_I2CBusSetFrequency, AUTO)
1616

1717

18-
PB_BIND(wippersnapper_i2c_v1_I2CScanRequest, wippersnapper_i2c_v1_I2CScanRequest, AUTO)
18+
PB_BIND(wippersnapper_i2c_v1_I2CBusScanRequest, wippersnapper_i2c_v1_I2CBusScanRequest, AUTO)
1919

2020

21-
PB_BIND(wippersnapper_i2c_v1_I2CScanResponse, wippersnapper_i2c_v1_I2CScanResponse, 2)
21+
PB_BIND(wippersnapper_i2c_v1_I2CBusScanResponse, wippersnapper_i2c_v1_I2CBusScanResponse, 2)
2222

2323

2424
PB_BIND(wippersnapper_i2c_v1_I2CDeviceInitRequest, wippersnapper_i2c_v1_I2CDeviceInitRequest, AUTO)

0 commit comments

Comments
 (0)