component out_to_iov2 "converts a signal driven by an out pin to a change sensitive io signal";
pin_ptr in u32 in_u32 = 0;
pin_ptr in s32 in_s32 = 0;
pin_ptr in float in_float = 0.0;
pin_ptr in bit in_bit = false;
pin_ptr io u32 out_u32;
pin_ptr io s32 out_s32;
pin_ptr io float out_float;
pin_ptr io bit out_bit;

variable hal_u32_t last_u32 = 1;
variable hal_u32_t last_s32 = 1;
variable hal_u32_t last_float = 1;
variable hal_u32_t last_bit = 1;

function _;
license "GPL";
author "Alexander Roessler";
;;
FUNCTION(_)
{
    if (last_u32 != gu(in_u32)) {
        su(out_u32, gu(in_u32));
        last_u32 = gu(in_u32);
    }
    if (last_s32 != gs(in_s32)) {
        ss(out_s32, gs(in_s32));
        last_s32 = gs(in_s32);
    }
    if (last_float != gf(in_float)) {
        sf(out_float, gf(in_float));
        last_float = gf(in_float);
    }
    if (last_bit != gb(in_bit)) {
        sb(out_bit, gb(in_bit));
        last_bit = gb(in_bit);
    }
    return 0;
}
