- Atomic functions catalog >
- cube.io.rc
cube.io.rc¶
Inputs¶
Function has no inputs
Outputs¶
Name |
Type |
Title |
Description |
---|---|---|---|
rc_channel1 |
core.type.f64 |
rc_channel1 |
None |
rc_channel2 |
core.type.f64 |
rc_channel2 |
None |
rc_channel3 |
core.type.f64 |
rc_channel3 |
None |
rc_channel4 |
core.type.f64 |
rc_channel4 |
None |
rc_channel5 |
core.type.f64 |
rc_channel5 |
None |
rc_channel6 |
core.type.f64 |
rc_channel6 |
None |
rc_channel7 |
core.type.f64 |
rc_channel7 |
None |
rc_channel8 |
core.type.f64 |
rc_channel8 |
None |
rc_channel9 |
core.type.f64 |
rc_channel9 |
None |
rc_channel10 |
core.type.f64 |
rc_channel10 |
None |
rc_channel11 |
core.type.f64 |
rc_channel11 |
None |
rc_channel12 |
core.type.f64 |
rc_channel12 |
None |
rc_channel13 |
core.type.f64 |
rc_channel13 |
None |
rc_channel14 |
core.type.f64 |
rc_channel14 |
None |
rc_channel15 |
core.type.f64 |
rc_channel15 |
None |
rc_channel16 |
core.type.f64 |
rc_channel16 |
None |
Parameters¶
Function has no parameters
State variables¶
Function has no state variables
Usage XML code snippet¶
cube_io_rc snippet for FLOW configuration file¶
<f name="rc" by_spec="cube.io.rc">
</f>
Function’s artifacts¶
- Declaration for cube_io_rc
- Implementation for cube_io_rc
- Header of cube_io_rc
- Specification of cube_io_rc
- Interface of cube_io_rc
declaration.py¶
from fspeclib import *
Function(
name='cube.io.rc',
title=LocalizedString(
en='io'
),
has_pre_exec_init_call=True,
parameters=[],
inputs=[],
outputs=[
Output(
name='rc_channel1',
title='rc_channel1',
value_type='core.type.f64'
),
Output(
name='rc_channel2',
title='rc_channel2',
value_type='core.type.f64'
),
Output(
name='rc_channel3',
title='rc_channel3',
value_type='core.type.f64'
),
Output(
name='rc_channel4',
title='rc_channel4',
value_type='core.type.f64'
),
Output(
name='rc_channel5',
title='rc_channel5',
value_type='core.type.f64'
),
Output(
name='rc_channel6',
title='rc_channel6',
value_type='core.type.f64'
),
Output(
name='rc_channel7',
title='rc_channel7',
value_type='core.type.f64'
),
Output(
name='rc_channel8',
title='rc_channel8',
value_type='core.type.f64'
),
Output(
name='rc_channel9',
title='rc_channel9',
value_type='core.type.f64'
),
Output(
name='rc_channel10',
title='rc_channel10',
value_type='core.type.f64'
),
Output(
name='rc_channel11',
title='rc_channel11',
value_type='core.type.f64'
),
Output(
name='rc_channel12',
title='rc_channel12',
value_type='core.type.f64'
),
Output(
name='rc_channel13',
title='rc_channel13',
value_type='core.type.f64'
),
Output(
name='rc_channel14',
title='rc_channel14',
value_type='core.type.f64'
),
Output(
name='rc_channel15',
title='rc_channel15',
value_type='core.type.f64'
),
Output(
name='rc_channel16',
title='rc_channel16',
value_type='core.type.f64'
),
],
state=[],
parameter_constraints=[],
)
cube_io_rc_exec.c¶
#include "cube_io_rc.h"
#include "board.h"
fspec_rv_t cube_io_rc_pre_exec_init() {
cubeio_set_range(cubeio, CUBEIO_RC, 0, CUBEIO_CHANNEL_BIPOLAR, 982, 2006);
cubeio_set_range(cubeio, CUBEIO_RC, 1, CUBEIO_CHANNEL_BIPOLAR, 982, 2006);
cubeio_set_range(cubeio, CUBEIO_RC, 2, CUBEIO_CHANNEL_UNIPOLAR, 982, 2006);
cubeio_set_range(cubeio, CUBEIO_RC, 3, CUBEIO_CHANNEL_BIPOLAR, 982, 2006);
cubeio_set_range(cubeio, CUBEIO_RC, 4, CUBEIO_CHANNEL_UNIPOLAR, 982, 2006);
cubeio_set_range(cubeio, CUBEIO_RC, 5, CUBEIO_CHANNEL_UNIPOLAR, 982, 2006);
cubeio_set_range(cubeio, CUBEIO_RC, 6, CUBEIO_CHANNEL_UNIPOLAR, 982, 2006);
cubeio_set_range(cubeio, CUBEIO_RC, 7, CUBEIO_CHANNEL_UNIPOLAR, 982, 2006);
cubeio_set_range(cubeio, CUBEIO_RC, 8, CUBEIO_CHANNEL_UNIPOLAR, 982, 2006);
cubeio_set_range(cubeio, CUBEIO_RC, 9, CUBEIO_CHANNEL_UNIPOLAR, 982, 2006);
cubeio_set_range(cubeio, CUBEIO_RC, 9, CUBEIO_CHANNEL_UNIPOLAR, 982, 2006);
cubeio_set_range(cubeio, CUBEIO_RC, 10, CUBEIO_CHANNEL_UNIPOLAR, 982, 2006);
cubeio_set_range(cubeio, CUBEIO_RC, 11, CUBEIO_CHANNEL_UNIPOLAR, 982, 2006);
cubeio_set_range(cubeio, CUBEIO_RC, 12, CUBEIO_CHANNEL_UNIPOLAR, 982, 2006);
cubeio_set_range(cubeio, CUBEIO_RC, 13, CUBEIO_CHANNEL_UNIPOLAR, 982, 2006);
cubeio_set_range(cubeio, CUBEIO_RC, 14, CUBEIO_CHANNEL_UNIPOLAR, 982, 2006);
cubeio_set_range(cubeio, CUBEIO_RC, 15, CUBEIO_CHANNEL_UNIPOLAR, 982, 2006);
return fspec_rv_ok;
}
void cube_io_rc_exec(cube_io_rc_outputs_t *o)
{
double rc[16];
gpio_set(&gpio_fmu_pwm[2]);
cubeio_get_rc(cubeio, rc);
o->rc_channel1 = rc[0];
o->rc_channel2 = rc[1];
o->rc_channel3 = rc[2];
o->rc_channel4 = rc[3];
o->rc_channel5 = rc[4];
o->rc_channel6 = rc[5];
o->rc_channel7 = rc[6];
o->rc_channel8 = rc[7];
o->rc_channel9 = rc[8];
o->rc_channel10 = rc[9];
o->rc_channel11 = rc[10];
o->rc_channel12 = rc[11];
o->rc_channel13 = rc[12];
o->rc_channel14 = rc[13];
o->rc_channel15 = rc[14];
o->rc_channel16 = rc[15];
// For debug reset pin in CubeIO thread
// gpio_reset(&gpio_fmu_pwm[2]);
}
cube_io_rc.h¶
/**
* Automatically-generated file. Do not edit!
*/
#ifndef FSPEC_CUBE_IO_RC_H
#define FSPEC_CUBE_IO_RC_H
#include <stdint.h>
#include <eswb/types.h>
#include "function.h"
/* Include declaration of dependency types */
#include "core_type_f64.h"
/**
* @brief Outputs of `cube.io.rc` function
*/
typedef struct cube_io_rc_outputs_ {
core_type_f64_t rc_channel1; /// rc_channel1
core_type_f64_t rc_channel2; /// rc_channel2
core_type_f64_t rc_channel3; /// rc_channel3
core_type_f64_t rc_channel4; /// rc_channel4
core_type_f64_t rc_channel5; /// rc_channel5
core_type_f64_t rc_channel6; /// rc_channel6
core_type_f64_t rc_channel7; /// rc_channel7
core_type_f64_t rc_channel8; /// rc_channel8
core_type_f64_t rc_channel9; /// rc_channel9
core_type_f64_t rc_channel10; /// rc_channel10
core_type_f64_t rc_channel11; /// rc_channel11
core_type_f64_t rc_channel12; /// rc_channel12
core_type_f64_t rc_channel13; /// rc_channel13
core_type_f64_t rc_channel14; /// rc_channel14
core_type_f64_t rc_channel15; /// rc_channel15
core_type_f64_t rc_channel16; /// rc_channel16
} cube_io_rc_outputs_t;
typedef struct cube_io_rc_eswb_descriptors_ {
eswb_topic_descr_t out_all;
} cube_io_rc_eswb_descriptors_t;
typedef struct cube_io_rc_interface_ {
cube_io_rc_outputs_t o;
cube_io_rc_eswb_descriptors_t eswb_descriptors;
} cube_io_rc_interface_t;
fspec_rv_t cube_io_rc_pre_exec_init();
void cube_io_rc_exec(cube_io_rc_outputs_t *o);
#endif // FSPEC_CUBE_IO_RC_H
cube_io_rc_spec.c¶
/**
* Automatically-generated file. Do not edit!
*/
#include "cube_io_rc.h"
#include <eswb/types.h>
static const param_spec_t *params[1] = {
NULL
};
static const input_spec_t *inputs[1] = {
NULL
};
static const output_spec_t o_rc_channel1 = {
.name = "rc_channel1",
.annotation = "rc_channel1",
.flags = 0
};
static const output_spec_t o_rc_channel2 = {
.name = "rc_channel2",
.annotation = "rc_channel2",
.flags = 0
};
static const output_spec_t o_rc_channel3 = {
.name = "rc_channel3",
.annotation = "rc_channel3",
.flags = 0
};
static const output_spec_t o_rc_channel4 = {
.name = "rc_channel4",
.annotation = "rc_channel4",
.flags = 0
};
static const output_spec_t o_rc_channel5 = {
.name = "rc_channel5",
.annotation = "rc_channel5",
.flags = 0
};
static const output_spec_t o_rc_channel6 = {
.name = "rc_channel6",
.annotation = "rc_channel6",
.flags = 0
};
static const output_spec_t o_rc_channel7 = {
.name = "rc_channel7",
.annotation = "rc_channel7",
.flags = 0
};
static const output_spec_t o_rc_channel8 = {
.name = "rc_channel8",
.annotation = "rc_channel8",
.flags = 0
};
static const output_spec_t o_rc_channel9 = {
.name = "rc_channel9",
.annotation = "rc_channel9",
.flags = 0
};
static const output_spec_t o_rc_channel10 = {
.name = "rc_channel10",
.annotation = "rc_channel10",
.flags = 0
};
static const output_spec_t o_rc_channel11 = {
.name = "rc_channel11",
.annotation = "rc_channel11",
.flags = 0
};
static const output_spec_t o_rc_channel12 = {
.name = "rc_channel12",
.annotation = "rc_channel12",
.flags = 0
};
static const output_spec_t o_rc_channel13 = {
.name = "rc_channel13",
.annotation = "rc_channel13",
.flags = 0
};
static const output_spec_t o_rc_channel14 = {
.name = "rc_channel14",
.annotation = "rc_channel14",
.flags = 0
};
static const output_spec_t o_rc_channel15 = {
.name = "rc_channel15",
.annotation = "rc_channel15",
.flags = 0
};
static const output_spec_t o_rc_channel16 = {
.name = "rc_channel16",
.annotation = "rc_channel16",
.flags = 0
};
static const output_spec_t *outputs[17] = {
&o_rc_channel1,
&o_rc_channel2,
&o_rc_channel3,
&o_rc_channel4,
&o_rc_channel5,
&o_rc_channel6,
&o_rc_channel7,
&o_rc_channel8,
&o_rc_channel9,
&o_rc_channel10,
&o_rc_channel11,
&o_rc_channel12,
&o_rc_channel13,
&o_rc_channel14,
&o_rc_channel15,
&o_rc_channel16,
NULL
};
fspec_rv_t cube_io_rc_call_init_outputs(
void *dh,
const func_conn_spec_t *conn_spec,
eswb_topic_descr_t mounting_td,
const char *func_name
);
fspec_rv_t cube_io_rc_call_pre_exec_init(void *dh);
void cube_io_rc_call_exec(void *dh);
const function_spec_t atomic_cube_io_rc_spec = {
.name = "cube.io.rc",
.annotation = "io",
.inputs = inputs,
.outputs = outputs,
.params = params
};
const function_calls_t atomic_cube_io_rc_calls = {
.interface_handle_size = sizeof(cube_io_rc_interface_t),
.init = NULL,
.init_inputs = NULL,
.init_outputs = cube_io_rc_call_init_outputs,
.pre_exec_init = cube_io_rc_call_pre_exec_init,
.exec = cube_io_rc_call_exec,
.set_params = NULL
};
const function_handler_t atomic_cube_io_rc_handler = {
.spec = &atomic_cube_io_rc_spec,
.calls = &atomic_cube_io_rc_calls,
.extension_handler = NULL
};
cube_io_rc_interface.c¶
/**
* Automatically-generated file. Do not edit!
*/
#include "cube_io_rc.h"
#include "error.h"
#include <eswb/api.h>
#include <eswb/topic_proclaiming_tree.h>
#include <eswb/errors.h>
fspec_rv_t cube_io_rc_interface_outputs_init(
cube_io_rc_interface_t *interface,
const func_conn_spec_t *conn_spec,
eswb_topic_descr_t mounting_td,
const char *func_name
)
{
TOPIC_TREE_CONTEXT_LOCAL_DEFINE(cntx, 17);
cube_io_rc_outputs_t out;
eswb_rv_t rv;
topic_proclaiming_tree_t *rt = usr_topic_set_struct(cntx, out, func_name);
usr_topic_add_struct_child(cntx, rt, cube_io_rc_outputs_t, rc_channel1, "rc_channel1", tt_double);
usr_topic_add_struct_child(cntx, rt, cube_io_rc_outputs_t, rc_channel2, "rc_channel2", tt_double);
usr_topic_add_struct_child(cntx, rt, cube_io_rc_outputs_t, rc_channel3, "rc_channel3", tt_double);
usr_topic_add_struct_child(cntx, rt, cube_io_rc_outputs_t, rc_channel4, "rc_channel4", tt_double);
usr_topic_add_struct_child(cntx, rt, cube_io_rc_outputs_t, rc_channel5, "rc_channel5", tt_double);
usr_topic_add_struct_child(cntx, rt, cube_io_rc_outputs_t, rc_channel6, "rc_channel6", tt_double);
usr_topic_add_struct_child(cntx, rt, cube_io_rc_outputs_t, rc_channel7, "rc_channel7", tt_double);
usr_topic_add_struct_child(cntx, rt, cube_io_rc_outputs_t, rc_channel8, "rc_channel8", tt_double);
usr_topic_add_struct_child(cntx, rt, cube_io_rc_outputs_t, rc_channel9, "rc_channel9", tt_double);
usr_topic_add_struct_child(cntx, rt, cube_io_rc_outputs_t, rc_channel10, "rc_channel10", tt_double);
usr_topic_add_struct_child(cntx, rt, cube_io_rc_outputs_t, rc_channel11, "rc_channel11", tt_double);
usr_topic_add_struct_child(cntx, rt, cube_io_rc_outputs_t, rc_channel12, "rc_channel12", tt_double);
usr_topic_add_struct_child(cntx, rt, cube_io_rc_outputs_t, rc_channel13, "rc_channel13", tt_double);
usr_topic_add_struct_child(cntx, rt, cube_io_rc_outputs_t, rc_channel14, "rc_channel14", tt_double);
usr_topic_add_struct_child(cntx, rt, cube_io_rc_outputs_t, rc_channel15, "rc_channel15", tt_double);
usr_topic_add_struct_child(cntx, rt, cube_io_rc_outputs_t, rc_channel16, "rc_channel16", tt_double);
rv = eswb_proclaim_tree(mounting_td, rt, cntx->t_num, &interface->eswb_descriptors.out_all);
if (rv != eswb_e_ok) {
return fspec_rv_publish_err;
}
return fspec_rv_ok;
}
fspec_rv_t cube_io_rc_interface_outputs_update(cube_io_rc_interface_t *interface)
{
eswb_rv_t rv;
rv = eswb_update_topic(interface->eswb_descriptors.out_all, &interface->o);
if (rv != eswb_e_ok) {
return 1;
}
return 0;
}
fspec_rv_t cube_io_rc_interface_pre_exec_init(cube_io_rc_interface_t *interface)
{
return cube_io_rc_pre_exec_init();
}
void cube_io_rc_interface_update(cube_io_rc_interface_t *interface)
{
cube_io_rc_exec(&interface->o);
cube_io_rc_interface_outputs_update(interface);
}
fspec_rv_t cube_io_rc_call_init_outputs(
void *dh,
const func_conn_spec_t *conn_spec,
eswb_topic_descr_t mounting_td,
const char *func_name
)
{
cube_io_rc_interface_t *interface = (cube_io_rc_interface_t*) dh;
return cube_io_rc_interface_outputs_init(interface, conn_spec, mounting_td, func_name);
}
fspec_rv_t cube_io_rc_call_pre_exec_init(void *dh)
{
cube_io_rc_interface_t *interface = (cube_io_rc_interface_t*) dh;
return cube_io_rc_interface_pre_exec_init(interface);
}
void cube_io_rc_call_exec(void *dh)
{
cube_io_rc_interface_t *interface = (cube_io_rc_interface_t*) dh;
cube_io_rc_interface_update(interface);
}