static int check_bit_changed(hal_bit_t *halpin, hal_bit_t *oldpin) {
hal_bit_t bit;
bit = *(halpin);
if (bit != *(oldpin)) {
if (bit != 0) //if transition to 1
*(oldpin) = bit;
return 1;
}
return 0;
}
// this function looks if any of the hal pins has changed
// and sends appropiate messages if so
static void check_hal_changes()
{
hal_s32_t counts;
int select_changed, joint;
hal_bit_t bit;
//check if machine_on pin has changed (the rest work exactly the same)
if (check_bit_changed(*(halui_data->machine_on), &(old_halui_data.machine_on)) != 0)
sendMachineOn(); //send MachineOn NML command