All pastes #1029918 Raw Edit

Mine

public text v1 · immutable
#1029918 ·published 2008-05-26 13:30 UTC
rendered paste body
#include "hal.h"

int comp_id;

struct example_data { hal_float_t *pin; };

void func(void *data, long period) {
    struct example_data *d = (struct example_data*) data;
    *d->pin = *(d->pin) + 1;
}

void rtapi_app_main() {
    comp_id = hal_init("example");    
    struct example_data *d = hal_malloc(sizeof(struct example_data));
    hal_pin_float_new("example.pin", HAL_IO, &(d->pin), comp_id);
    hal_export_funct("example", func, d, 1, 0, comp_id);
    hal_ready(comp_id);
}

void rtapi_app_exit() { 
    hal_exit(comp_id);
}