mirror of https://github.com/Desuuuu/klipper.git
serialqueue: Add serialqueue_send_one() helper function
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
c53e8c7d4a
commit
b6d8cf27d2
|
@ -781,6 +781,17 @@ serialqueue_send_batch(struct serialqueue *sq, struct command_queue *cq
|
||||||
kick_bg_thread(sq);
|
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
|
// Schedule the transmission of a message on the serial port at a
|
||||||
// given time and priority.
|
// given time and priority.
|
||||||
void __visible
|
void __visible
|
||||||
|
@ -792,11 +803,7 @@ serialqueue_send(struct serialqueue *sq, struct command_queue *cq, uint8_t *msg
|
||||||
qm->min_clock = min_clock;
|
qm->min_clock = min_clock;
|
||||||
qm->req_clock = req_clock;
|
qm->req_clock = req_clock;
|
||||||
qm->notify_id = notify_id;
|
qm->notify_id = notify_id;
|
||||||
|
serialqueue_send_one(sq, cq, qm);
|
||||||
struct list_head msgs;
|
|
||||||
list_init(&msgs);
|
|
||||||
list_add_tail(&qm->node, &msgs);
|
|
||||||
serialqueue_send_batch(sq, cq, &msgs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return a message read from the serial port (or wait for one if none
|
// Return a message read from the serial port (or wait for one if none
|
||||||
|
|
|
@ -36,6 +36,8 @@ void serialqueue_add_fastreader(struct serialqueue *sq, struct fastreader *fr);
|
||||||
void serialqueue_rm_fastreader(struct serialqueue *sq, struct fastreader *fr);
|
void serialqueue_rm_fastreader(struct serialqueue *sq, struct fastreader *fr);
|
||||||
void serialqueue_send_batch(struct serialqueue *sq, struct command_queue *cq
|
void serialqueue_send_batch(struct serialqueue *sq, struct command_queue *cq
|
||||||
, struct list_head *msgs);
|
, struct list_head *msgs);
|
||||||
|
void serialqueue_send_one(struct serialqueue *sq, struct command_queue *cq
|
||||||
|
, struct queue_message *qm);
|
||||||
void serialqueue_send(struct serialqueue *sq, struct command_queue *cq
|
void serialqueue_send(struct serialqueue *sq, struct command_queue *cq
|
||||||
, uint8_t *msg, int len, uint64_t min_clock
|
, uint8_t *msg, int len, uint64_t min_clock
|
||||||
, uint64_t req_clock, uint64_t notify_id);
|
, uint64_t req_clock, uint64_t notify_id);
|
||||||
|
|
Loading…
Reference in New Issue