kasjer commented on a change in pull request #1701: change multi byte 
instruction read write to single
URL: https://github.com/apache/mynewt-core/pull/1701#discussion_r267034251
 
 

 ##########
 File path: hw/drivers/led/lp5523/src/lp5523.c
 ##########
 @@ -635,20 +634,32 @@ lp5523_get_engine_mapping(struct led_itf *itf, uint8_t 
engine,
 static int
 lp5523_set_pr_instruction(struct led_itf *itf, uint8_t addr, uint16_t *ins)
 {
-    uint8_t mem[2] = { ((*ins) >> 8) & 0x00ff, (*ins) & 0x00ff };
+    int rc;
+
+    uint8_t byte1[1] = { ((*ins) >> 8) & 0x00ff };
+    uint8_t byte2[1] = { (*ins) & 0x00ff };
+
+    addr = addr << 1;
 
-    return lp5523_set_n_regs(itf, LP5523_PROGRAM_MEMORY + (addr << 1), mem, 2);
+    rc = lp5523_set_n_regs(itf, LP5523_PROGRAM_MEMORY + (addr), byte1, 1);
+    rc |= lp5523_set_n_regs(itf, LP5523_PROGRAM_MEMORY + (addr + 1), byte2, 1);
+
+    return rc;
 }
 
 static int
 lp5523_get_pr_instruction(struct led_itf *itf, uint8_t addr, uint16_t *ins)
 {
     int rc;
-    uint8_t mem[2];
+    uint8_t byte1[1];
+    uint8_t byte2[1];
+
+    addr = addr << 1;
 
-    rc = lp5523_get_n_regs(itf, LP5523_PROGRAM_MEMORY + (addr << 1), mem, 2);
+    rc = lp5523_get_n_regs(itf, LP5523_PROGRAM_MEMORY + (addr), byte1, 1);
 
 Review comment:
   without shift operator () are not needed any more

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to