You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2019/01/08 12:35:43 UTC

[GitHub] mkiiskila commented on a change in pull request #1590: Adding Flash Write Functionality

mkiiskila commented on a change in pull request #1590: Adding Flash Write Functionality
URL: https://github.com/apache/mynewt-core/pull/1590#discussion_r245977277
 
 

 ##########
 File path: hw/drivers/bq27z561/src/bq27z561.c
 ##########
 @@ -587,6 +587,104 @@ bq27x561_rd_flash(struct bq27z561 *dev, uint16_t addr, uint8_t *buf, int buflen)
     return ret;
 }
 
+bq27z561_err_t
+bq27z561_wr_flash(struct bq27z561 *dev, uint16_t addr, uint8_t *buf, int buflen)
+{
+    uint8_t tmpbuf[BQ27Z561_MAX_FLASH_RW_LEN + 2];
+    uint8_t chksum;
+    bq27z561_err_t ret;
+    int rc;
+#if MYNEWT_VAL(BUS_DRIVER_PRESENT)
+    struct os_dev *odev = &dev->dev.dev;
+#else
+    struct hal_i2c_master_data i2c;
+#endif
+
+    if ((buflen == 0) || (!buf) || (buflen > BQ27Z561_MAX_FLASH_RW_LEN)) {
+        return BQ27Z561_ERR_INV_PARAMS;
+    }
+
+    if ((addr < BQ27Z561_FLASH_BEG_ADDR) || (addr > BQ27Z561_FLASH_END_ADDR)) {
 
 Review comment:
   if ((addr < BQ27Z561_FLASH_BEG_ADDR) || (addr + buflen > BQ27Z561_FLASH_END_ADDR)) {

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


With regards,
Apache Git Services