Method: RCSimCinterface.rcsim_set_signal_value

Defined in:
ext/hruby_sim/hruby_rcsim_build.c

.rcsim_set_signal_value(signalV, exprV) ⇒ Object

Sets the value for a C signal. NOTE: for initialization only (the simulator events are not updated), otherwise, please use rcsim_transmit_to_signal or rc_sim_transmit_to_signal_seq.



1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
# File 'ext/hruby_sim/hruby_rcsim_build.c', line 1587

VALUE rcsim_set_signal_value(VALUE mod, VALUE signalV, VALUE exprV) {
    /* Get the C signal from the Ruby value. */
    SignalI signal;
    value_to_rcsim(SignalIS,signalV,signal);
    // printf("rc_sim_set_signal_value for signal=%s\n",signal->name);
    /* Get the C expression from the Ruby value. */
    Expression expr;
    value_to_rcsim(ExpressionS,exprV,expr);
    /* Compute the value from it. */
    Value value = get_value();
    value = calc_expression(expr,value);
    /* Copies the value. */
    signal->f_value = copy_value(value,signal->f_value);
    signal->c_value = copy_value(value,signal->c_value);
    free_value();
    return signalV;
}