aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/chelper/serialqueue.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2021-02-17 19:58:47 -0500
committerKevin O'Connor <kevin@koconnor.net>2021-06-09 18:58:35 -0400
commitb6d8cf27d25faecfa47404924a757dc09e7a84a3 (patch)
tree8f97c2b0d37e97b451de642c3733a09816feee27 /klippy/chelper/serialqueue.c
parentc53e8c7d4a945fee54f6ad575381cebec2a87c6f (diff)
downloadkutter-b6d8cf27d25faecfa47404924a757dc09e7a84a3.tar.gz
kutter-b6d8cf27d25faecfa47404924a757dc09e7a84a3.tar.xz
kutter-b6d8cf27d25faecfa47404924a757dc09e7a84a3.zip
serialqueue: Add serialqueue_send_one() helper function
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/chelper/serialqueue.c')
-rw-r--r--klippy/chelper/serialqueue.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/klippy/chelper/serialqueue.c b/klippy/chelper/serialqueue.c
index bee39837..b74605ff 100644
--- a/klippy/chelper/serialqueue.c
+++ b/klippy/chelper/serialqueue.c
@@ -781,6 +781,17 @@ serialqueue_send_batch(struct serialqueue *sq, struct command_queue *cq
kick_bg_thread(sq);
}
+// Helper to send a single message
+void
+serialqueue_send_one(struct serialqueue *sq, struct command_queue *cq
+ , struct queue_message *qm)
+{
+ struct list_head msgs;
+ list_init(&msgs);
+ list_add_tail(&qm->node, &msgs);
+ serialqueue_send_batch(sq, cq, &msgs);
+}
+
// Schedule the transmission of a message on the serial port at a
// given time and priority.
void __visible
@@ -792,11 +803,7 @@ serialqueue_send(struct serialqueue *sq, struct command_queue *cq, uint8_t *msg
qm->min_clock = min_clock;
qm->req_clock = req_clock;
qm->notify_id = notify_id;
-
- struct list_head msgs;
- list_init(&msgs);
- list_add_tail(&qm->node, &msgs);
- serialqueue_send_batch(sq, cq, &msgs);
+ serialqueue_send_one(sq, cq, qm);
}
// Return a message read from the serial port (or wait for one if none