コード例 #1
0
ファイル: parser.c プロジェクト: jsr38/psu-firmware
/**
 * Initialize SCPI context structure
 * @param context
 * @param command_list
 * @param buffer
 * @param interface
 */
void SCPI_Init(scpi_t * context, 
        const scpi_command_t * commands,
        scpi_interface_t * interface,
        const scpi_unit_def_t * units,
        const char * idn1, const char * idn2, const char * idn3, const char * idn4,
        char * input_buffer, size_t input_buffer_length, 
        int16_t * error_queue_data, int16_t error_queue_size) {
    memset(context, 0, sizeof(*context));
    context->cmdlist = commands;
    context->interface = interface;
    context->units = units;
    context->idn[0] = idn1;
    context->idn[1] = idn2;
    context->idn[2] = idn3;
    context->idn[3] = idn4;
    context->buffer.data = input_buffer;
    context->buffer.length = input_buffer_length;
    context->buffer.position = 0;
    SCPI_ErrorInit(context, error_queue_data, error_queue_size);

#if USE_64K_PROGMEM_FOR_CMD_LIST || USE_FULL_PROGMEM_FOR_CMD_LIST 
    context->param_list.cmd_s.pattern = context->param_list.cmd_pattern_s;
    context->param_list.cmd = &context->param_list.cmd_s;
#endif
}
コード例 #2
0
ファイル: parser.c プロジェクト: RedPitaya/scpi-parser
/**
 * Initialize SCPI context structure
 * @param context
 * @param command_list
 * @param buffer
 * @param interface
 */
void SCPI_Init(scpi_t * context) {
    if (context->idn[0] == NULL) {
        context->idn[0] = SCPI_DEFAULT_1_MANUFACTURE;
    }
    if (context->idn[1] == NULL) {
        context->idn[1] = SCPI_DEFAULT_2_MODEL;
    }
    if (context->idn[2] == NULL) {
        context->idn[2] = SCPI_DEFAULT_3;
    }
    if (context->idn[3] == NULL) {
        context->idn[3] = SCPI_DEFAULT_4_REVISION;
    }

    context->buffer.position = 0;
    SCPI_ErrorInit(context);
}
コード例 #3
0
ファイル: scpiparser.cpp プロジェクト: Zaher220/scpi-parser
/**
 * Initialize SCPI context structure
 * @param context
 * @param command_list
 * @param buffer
 * @param interface
 */
void SCPIParser::SCPI_Init() {
    if (context.idn[0] == NULL) {
        context.idn[0] = SCPI_DEFAULT_1_MANUFACTURE;
    }
    if (context.idn[1] == NULL) {
        context.idn[1] = SCPI_DEFAULT_2_MODEL;
    }
    if (context.idn[2] == NULL) {
        context.idn[2] = SCPI_DEFAULT_3;
    }
    if (context.idn[3] == NULL) {
        context.idn[3] = SCPI_DEFAULT_4_REVISION;
    }

    context.buffer.position = 0;
    SCPI_ErrorInit();
}
コード例 #4
0
ファイル: parser.c プロジェクト: Toussaic/main
/**
 * Initialize SCPI context structure
 * @param context
 * @param command_list
 * @param buffer
 * @param interface
 */
void SCPI_Init(scpi_t * context) {
    context->buffer.position = 0;
    SCPI_ErrorInit(context);
}