For your spindle controls in your hal file M3 will trigger the signal "spindle-cw" (to start the spindle in the normal forward or clockwise direction), and M4 will trigger the signal "spindle-ccw" (for reverse). M5 will change both those signals to false (as well as the spindle-enable).
To connect one of those singals to the halpin hm2_5i25.0.gpio.029.out by adding a line like this to your hal file.
Code:
net spindle-cw => hm2_5i25.0.gpio.029.out
For connecting to the coolant mist/flood (M7/M8) your hal file has signals called "coolant-mist" and "coolant-flood" and like above you could add this to your hal file.
Code:
net coolant-mist => hm2_5i25.0.gpio.024.out
net coolant-flood => hm2_5i25.0.gpio.017.out
This would turn on the pin "hm2_5i25.0.gpio.024.out" with the M7 g-code, and turn on "hm2_5i25.0.gpio.017.out" with the M8 g-code and turn them both off with an M9.
There is no way to separate the action of the M7/M8 commands they will always both be shut off by M9.
For this reason for the vacuum table and dust collection controls on the routers I've configured. I choose to use a custom M-codes (M1xx) to control them.
linuxcnc.org/docs/html/gcode/m-code.html#mcode:m100-m199
Here is what the file I use for turning on my vacuum looks like (using your output pin).
M111 (vacuum on)
Code:
M111
#!/bin/bash
# file to turn on hm2_5i25.0.gpio.024.out to turn on Vacuum
halcmd setp hm2_5i25.0.gpio.024.out 1
exit 0
M112 (vacuum off)
Code:
M112
#!/bin/bash
# file to turn off hm2_5i25.0.gpio.024.out to turn off Vacuum
halcmd setp hm2_5i25.0.gpio.024.out 0
exit 0