/* * call-seq: * marshal_load(string) -> self * * loads a string into an Vector2. */ VALUE _marshal_load(VALUE self,VALUE load) { VALUE result = rb_funcall(load,rb_intern("unpack"),1,rb_str_new2("dd")); _set_y(self,rb_ary_pop(result)); _set_x(self,rb_ary_pop(result)); return self; }
void pcd8544_clear(pcd8544_t *dev) { _set_x(dev, 0); _set_y(dev, 0); for (int i = 0; i < PCD8544_RES_X * PCD8544_ROWS; i++) { _write(dev, MODE_DTA, 0x00); } }
void pcd8544_write_img(pcd8544_t *dev, const char img[]) { /* set initial position */ _set_x(dev, 0); _set_y(dev, 0); /* write image data to display */ for (int i = 0; i < (PCD8544_RES_X * PCD8544_RES_Y / 8); i++) { _write(dev, MODE_DTA, img[i]); } }
void pcd8544_write_c(pcd8544_t *dev, uint8_t x, uint8_t y, char c) { /* check position */ if (x >= PCD8544_COLS || y >= PCD8544_ROWS) { return ; } /* set position */ _set_x(dev, x * CHAR_WIDTH); _set_y(dev, y); /* write char */ for (int i = 0; i < CHAR_WIDTH - 1; i++) { _write(dev, MODE_DTA, _ascii[c - ASCII_MIN][i]); } _write(dev, MODE_DTA, 0x00); }