Skip to content

Commit 5358330

Browse files
authored
Merge pull request #2 from ken-nakamura/main
Change HAL ID
2 parents eaae139 + f7ddf28 commit 5358330

File tree

6 files changed

+28
-28
lines changed

6 files changed

+28
-28
lines changed

examples/BALA2/BALA2.ino

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -80,25 +80,25 @@ void setup() {
8080
Blynk.begin(auth);
8181

8282
HALId halid1, halid2, halid3, halid4;
83-
halid1.deviceKindId = 1;
84-
halid1.vendorId = 9;
85-
halid1.productId = 1;
86-
halid1.instanceId = 1;
87-
88-
halid2.deviceKindId = 1;
89-
halid2.vendorId = 9;
90-
halid2.productId = 1;
91-
halid2.instanceId = 2;
92-
93-
halid3.deviceKindId = 2;
94-
halid3.vendorId = 9;
95-
halid3.productId = 2;
96-
halid3.instanceId = 1;
97-
98-
halid4.deviceKindId = 2;
99-
halid4.vendorId = 9;
100-
halid4.productId = 3;
101-
halid4.instanceId = 1;
83+
halid1.deviceKindId = 0x1;
84+
halid1.vendorId = 0xA;
85+
halid1.productId = 0x1;
86+
halid1.instanceId = 0x1;
87+
88+
halid2.deviceKindId = 0x1;
89+
halid2.vendorId = 0xA;
90+
halid2.productId = 0x1;
91+
halid2.instanceId = 0x2;
92+
93+
halid3.deviceKindId = 0x2;
94+
halid3.vendorId = 0xA;
95+
halid3.productId = 0x1;
96+
halid3.instanceId = 0x1;
97+
98+
halid4.deviceKindId = 0xD;
99+
halid4.vendorId = 0xA;
100+
halid4.productId = 0x1;
101+
halid4.instanceId = 0x1;
102102

103103
motor_l = new Actuator(halid1);
104104
motor_r = new Actuator(halid2);

src/Actuator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
Actuator::Actuator(HALId halId)
3737
{
3838
hALId = halId;
39-
hALComponent = HalCreate(hALId.vendorId, hALId.productId, hALId.instanceId);
39+
hALComponent = HalCreate(hALId.deviceKindId, hALId.vendorId, hALId.productId, hALId.instanceId);
4040
}
4141

4242
Actuator::~Actuator()

src/Sensor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
Sensor::Sensor(HALId halId)
3737
{
3838
hALId = halId;
39-
hALComponent = HalCreate(hALId.vendorId, hALId.productId, hALId.instanceId);
39+
hALComponent = HalCreate(hALId.deviceKindId, hALId.vendorId, hALId.productId, hALId.instanceId);
4040
}
4141

4242
Sensor::~Sensor()

src/openEL.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
HAL_HANDLER_T HalHandlerTbl[HAL_SZ_HANDLER_TBL];
44
static int32_t HalIdxHandlerTbl;
55

6-
HALComponent* HalCreate(int32_t vendorID, int32_t productID, int32_t instanceID)
6+
HALComponent* HalCreate(int32_t deviceKindID, int32_t vendorID, int32_t productID, int32_t instanceID)
77
{
88
int32_t i;
99
int32_t idx = -1;
@@ -26,7 +26,7 @@ HALComponent* HalCreate(int32_t vendorID, int32_t productID, int32_t instanceID)
2626
idx = -1;
2727
for (i = 0; i < hal_szRegTbl; i++)
2828
{
29-
if ((vendorID == HalRegTbl[i].vendorID) && (productID == HalRegTbl[i].productID))
29+
if ((deviceKindID == HalRegTbl[i].deviceKindID && vendorID == HalRegTbl[i].vendorID) && (productID == HalRegTbl[i].productID))
3030
{
3131
idx = i;
3232
break;
@@ -37,7 +37,7 @@ HALComponent* HalCreate(int32_t vendorID, int32_t productID, int32_t instanceID)
3737

3838
pHalComponent = new HALComponent;
3939
pHalComponent->handle = HalIdxHandlerTbl;
40-
pHalComponent->hALId.deviceKindId = pReg->deviceKindID;
40+
pHalComponent->hALId.deviceKindId = deviceKindID;
4141
pHalComponent->hALId.vendorId = vendorID;
4242
pHalComponent->hALId.productId = productID;
4343
pHalComponent->hALId.instanceId = instanceID;

src/openEL.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ typedef struct HalFncTbl_st
8787
/* 0x1F */ ReturnCode (*pFncDeviceVendor1F)(HALComponent*, HAL_ARGUMENT_T*,HAL_ARGUMENT_DEVICE_T *); /**< Device Vendor Function */
8888
} HAL_FNCTBL_T;
8989

90-
HALComponent* HalCreate(int32_t vendorID, int32_t productID, int32_t instanceID);
90+
HALComponent* HalCreate(int32_t deviceKindId, int32_t vendorID, int32_t productID, int32_t instanceID);
9191
void HalDestroy(HALComponent *halComponent);
9292

9393
ReturnCode HalInit(HALComponent *halComponent);

src/openEL_registryConfig.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@
3838
#include "openEL_SensorM5StackGrayBMM150.hpp"
3939

4040
const HAL_REG_T HalRegTbl[] = {
41-
{0x0001, 0x00000009, 0x00000001, &HalActuatorM5StackGrayBMM150Tbl, sizeof(Actuator) },
42-
{0x0002, 0x00000009, 0x00000002, &HalSensorM5StackGrayMPU6886Tbl, sizeof(Sensor) },
43-
{0x0002, 0x00000009, 0x00000003, &HalSensorM5StackGrayBMM150Tbl, sizeof(Sensor) },
41+
{0x0001, 0x0000000A, 0x00000001, &HalActuatorM5StackGrayBMM150Tbl, sizeof(Actuator) },
42+
{0x0002, 0x0000000A, 0x00000001, &HalSensorM5StackGrayMPU6886Tbl, sizeof(Sensor) },
43+
{0x000D, 0x0000000A, 0x00000001, &HalSensorM5StackGrayBMM150Tbl, sizeof(Sensor) },
4444
};
4545

4646
const int32_t hal_szRegTbl = sizeof(HalRegTbl)/sizeof(HAL_REG_T);

0 commit comments

Comments
 (0)