aboutsummaryrefslogtreecommitdiff
path: root/lib/pbdrv/drv
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-06-16 13:28:00 +0200
committerLoek Le Blansch <loek@pipeframe.xyz>2024-06-16 13:28:00 +0200
commita3fba8221cb26ce43958f42dd1f58cc049c3bba6 (patch)
tree2afca47358d1e7d4f425c3944285d36231f8711d /lib/pbdrv/drv
parent30171b5c84dd90ee9de9f3efc395766497a86c85 (diff)
WIP fixing memory handling
Diffstat (limited to 'lib/pbdrv/drv')
-rw-r--r--lib/pbdrv/drv/arduino/mod.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/pbdrv/drv/arduino/mod.cpp b/lib/pbdrv/drv/arduino/mod.cpp
index 8766444..9130334 100644
--- a/lib/pbdrv/drv/arduino/mod.cpp
+++ b/lib/pbdrv/drv/arduino/mod.cpp
@@ -10,23 +10,22 @@
#include <timers.h>
#include <task.h>
-#include <stdlib.h>
-#include <stdint.h>
-
#include "../../pb.h"
#include "../../pb-mod.h"
+#include "../../pb-types.h"
#include "../../pb-buf.h"
+#include "../../pb-mem.h"
static void async_pb_i2c_recv(void * _msg, uint32_t _) {
pb_buf_t * msg = (pb_buf_t *) _msg;
pb_i2c_recv((uint8_t *) msg->data, msg->size);
pb_buf_free(msg);
- free(msg);
+ pb_free(msg);
}
static void recv_event(int bytes) {
- pb_buf_t * msg = (pb_buf_t *) malloc(sizeof(pb_buf_t));
- msg->data = (char *) malloc(bytes);
+ pb_buf_t * msg = (pb_buf_t *) pb_malloc(sizeof(pb_buf_t));
+ msg->data = (char *) pb_malloc(bytes);
msg->size = 0;
while (Wire.available())
msg->data[msg->size++] = Wire.read();