Skip to content

Commit afb04f8

Browse files
committed
Fix to i2c code
1 parent 02728f1 commit afb04f8

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

shared-module/is31fl3741/IS31FL3741.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,8 @@ void common_hal_is31fl3741_set_current(is31fl3741_IS31FL3741_obj_t *self, uint8_
128128
uint8_t common_hal_is31fl3741_get_current(is31fl3741_IS31FL3741_obj_t *self) {
129129
common_hal_is31fl3741_set_page(self, 4);
130130
uint8_t gcur = 0x01; // global current command
131-
common_hal_busio_i2c_write(self->i2c, self->device_address, &gcur, 1, true);
132-
133-
uint8_t data = 0;
134-
common_hal_busio_i2c_read(self->i2c, self->device_address, &data, 1);
135-
return data;
131+
common_hal_busio_i2c_write_read(self->i2c, self->device_address, &gcur, 1, &gcur, 1);
132+
return gcur;
136133
}
137134

138135
void common_hal_is31fl3741_set_led(is31fl3741_IS31FL3741_obj_t *self, uint16_t led, uint8_t level, uint8_t page) {

0 commit comments

Comments
 (0)