How to Share Data Between Interrupt Handler and The While Loop #13440
-
|
I tried to have a fixed sampling rate of a accelerometer sensor (LSM9DS1) using a timer interrupt callback. There is no issue if read the accelerometer data in the while loop : Is the below error because of a heap-related memory allocation issue or anything else? Here attached below is the code of main.py and lsm9ds1.py main.pylsm9ds1.py |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Yep creating the memoryview requires an allocation. You can move this to init though as |
Beta Was this translation helpful? Give feedback.
Yep creating the memoryview requires an allocation. You can move this to init though as
self.mv = self.memoryview(scratch_int)and then just useself.mvin the interrupt handler.