Method: FtdiC::Context#read_data
- Defined in:
- ext/ftdic.c
#read_data(v_size) ⇒ Object
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'ext/ftdic.c', line 111
static VALUE ftdi_context_read_data(VALUE self, VALUE v_size)
{
struct ftdi_context * ctx;
int size = NUM2INT(v_size);
VALUE v_buf = rb_str_buf_new(size);
char * buf = StringValuePtr(v_buf);
int result;
Data_Get_Struct(self, struct ftdi_context, ctx);
result = ftdi_read_data(ctx, (unsigned char *)buf, size);
check_ftdi_result(ctx, result);
RSTRING(v_buf)->len = result;
return Qnil;
}
|