Skip to content

Commit c475311

Browse files
add PipetteMotorInterruptHandler
1 parent 083a816 commit c475311

File tree

2 files changed

+51
-1
lines changed

2 files changed

+51
-1
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#pragma once
2+
3+
#include "motor-control/core/stepper_motor/motor_interrupt_handler.hpp"
4+
#include "pipettes/core/sensor_tasks.hpp"
5+
6+
namespace pipettes {
7+
using namespace motor_messages;
8+
template <template <class> class QueueImpl, class StatusClient,
9+
typename MotorMoveMessage, typename MotorHardware, class SensorClient>
10+
requires MessageQueue<QueueImpl<MotorMoveMessage>, MotorMoveMessage> &&
11+
std::is_base_of_v<motor_hardware::MotorHardwareIface, MotorHardware>
12+
class PipetteMotorInterruptHandler
13+
: public motor_handler::MotorInterruptHandler<
14+
freertos_message_queue::FreeRTOSMessageQueue, StatusClient,
15+
MotorMoveMessage, MotorHardware> {
16+
public:
17+
using MoveQueue = QueueImpl<MotorMoveMessage>;
18+
using InterruptHandler = motor_handler::MotorInterruptHandler<
19+
freertos_message_queue::FreeRTOSMessageQueue, StatusClient,
20+
MotorMoveMessage, MotorHardware>;
21+
using UpdatePositionQueue =
22+
QueueImpl<can::messages::UpdateMotorPositionEstimationRequest>;
23+
PipetteMotorInterruptHandler() = delete;
24+
PipetteMotorInterruptHandler(
25+
MoveQueue& incoming_move_queue, StatusClient& outgoing_queue,
26+
MotorHardware& hardware_iface, stall_check::StallCheck& stall,
27+
UpdatePositionQueue& incoming_update_position_queue,
28+
SensorClient& sensor_queue_client)
29+
: sensor_client(sensor_queue_client),
30+
InterruptHandler(incoming_move_queue, outgoing_queue, hardware_iface,
31+
stall, incoming_update_position_queue) {}
32+
33+
~PipetteMotorInterruptHandler() = default;
34+
35+
auto operator=(PipetteMotorInterruptHandler&)
36+
-> PipetteMotorInterruptHandler& = delete;
37+
38+
auto operator=(PipetteMotorInterruptHandler&&)
39+
-> PipetteMotorInterruptHandler&& = delete;
40+
41+
PipetteMotorInterruptHandler(PipetteMotorInterruptHandler&) = delete;
42+
43+
PipetteMotorInterruptHandler(PipetteMotorInterruptHandler&&) = delete;
44+
45+
// might be able to overwrite functions in here
46+
47+
private:
48+
SensorClient& sensor_client;
49+
};
50+
} // namespace pipettes

include/pipettes/firmware/interfaces_g4.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ namespace interfaces {
3030
template <typename Client>
3131
using MotorInterruptHandlerType = motor_handler::MotorInterruptHandler<
3232
freertos_message_queue::FreeRTOSMessageQueue, Client, motor_messages::Move,
33-
motor_hardware::MotorHardware>;
33+
motor_hardware::MotorHardware>; // pass in sensor client here
3434
template <typename Client>
3535
using GearMotorInterruptHandlerType = motor_handler::MotorInterruptHandler<
3636
freertos_message_queue::FreeRTOSMessageQueue, Client,

0 commit comments

Comments
 (0)