Skip to content

Commit 59e4abc

Browse files
authored
Merge pull request #181 from Pan-Chenliang/mag
Fix mag list_device error
2 parents 85bb7c5 + d1f5e97 commit 59e4abc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/hal/mag/mag.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ rt_err_t hal_mag_register(mag_dev_t mag, const char* name, rt_uint32_t flag, voi
8888

8989
device = &(mag->parent);
9090

91-
device->type = (mag->bus_type == MAG_SPI_BUS_TYPE) ? RT_Device_Class_SPIDevice : RT_Device_Class_I2CBUS;
91+
/* register as SPI device when on SPI bus, otherwise as I2C device */
92+
device->type = (mag->bus_type == MAG_SPI_BUS_TYPE) ? RT_Device_Class_SPIDevice : RT_Device_Class_I2CDevice;
9293
device->ref_count = 0;
9394
device->rx_indicate = RT_NULL;
9495
device->tx_complete = RT_NULL;

0 commit comments

Comments
 (0)