MAX77654 Ultra-Low Power PMIC Mbed Driver

Files at this revision

API Documentation at this revision

Comitter:
Okan Sahin
Date:
Fri Aug 26 14:57:06 2022 +0300
Parent:
3:1e7cafcfdae7
Commit message:
fix interrupt_handler_list

use number of interrupts as a size of array.
initialize with NULL.

Changed in this revision

MAX77654.cpp Show annotated file Show diff for this revision Revisions of this file
MAX77654.h Show annotated file Show diff for this revision Revisions of this file
--- a/MAX77654.cpp	Fri Aug 26 14:54:45 2022 +0300
+++ b/MAX77654.cpp	Fri Aug 26 14:57:06 2022 +0300
@@ -46,6 +46,8 @@
 
     i2c_handler = i2c;
 
+    interrupt_handler_list = new handler[INT_CHG_END]{};
+    
     if (IRQPin != NC) {
         IRQDisableAll();
         post_intr_work_thread = new Thread();
@@ -68,6 +70,10 @@
     if (irq_pin) {
         delete irq_pin;
     }
+
+    if (interrupt_handler_list) {
+        delete [] interrupt_handler_list;
+    }
 }
 
 int MAX77654::read_register(uint8_t reg, uint8_t *value)
--- a/MAX77654.h	Fri Aug 26 14:54:45 2022 +0300
+++ b/MAX77654.h	Fri Aug 26 14:57:06 2022 +0300
@@ -132,7 +132,7 @@
         void *cb;
     };
 
-    handler interrupt_handler_list[8];
+    handler *interrupt_handler_list;
 
 public:
 	/**