libs/epaper/src/epaper.c
/**
 *  @brief: Push an image buffer to the frame memory.
 *          this won't update the display.
 *
 */
@brief: Push an image buffer to the frame memory.
this won't update the display.
@brief : Push an image buffer to the frame memory . this won ' t update the display .
void mgos_epd_pushFrameBuffer(const uint8_t* framebuffer, const int start_x, const int start_y, const int image_width, const int image_height)
{
	int x_end, y_end;
	int adj_image_width = image_width & 0xF8;
	int adj_x = start_x & 0xF8;
	int bufferlen;
	if ( (framebuffer == NULL) || (adj_x < 0) || (image_width < 0) || (start_y < 0) || (image_height < 0) ) {
		return;
	}
	if (adj_x + adj_image_width >= _width) {
		x_end = _width - 1;
	} else {
		x_end = adj_x + adj_image_width - 1;
	}
	if (start_y + image_height >= _height) {
		y_end = _height - 1;
	} else {
		y_end = start_y + image_height - 1;
	}
	mgos_epd_set_memory_area(adj_x, start_y, x_end, y_end);
	mgos_epd_set_memory_pointer(adj_x, start_y);
	mgos_epd_send_command(WRITE_RAM);
	bufferlen = (y_end - start_y + 1) * ((x_end - adj_x + 1) / 8);
	mgos_epd_send_data_n(framebuffer , bufferlen);
}
void mgos_epd_pushFrameBuffer ( const uint8_t * framebuffer , const int start_x , const int start_y , const int image_width , const int image_height ) { int x_end , y_end ; int adj_image_width = image_width & 0xF8 ; int adj_x = start_x & 0xF8 ; int bufferlen ; if ( ( framebuffer == NULL ) || ( adj_x < 0 ) || ( image_width < 0 ) || ( start_y < 0 ) || ( image_height < 0 ) ) { return ; } if ( adj_x + adj_image_width >= _width ) { x_end = _width - 1 ; } else { x_end = adj_x + adj_image_width - 1 ; } if ( start_y + image_height >= _height ) { y_end = _height - 1 ; } else { y_end = start_y + image_height - 1 ; } mgos_epd_set_memory_area ( adj_x , start_y , x_end , y_end ) ; mgos_epd_set_memory_pointer ( adj_x , start_y ) ; mgos_epd_send_command ( WRITE_RAM ) ; bufferlen = ( y_end - start_y + 1 ) * ( ( x_end - adj_x + 1 ) / 8 ) ; mgos_epd_send_data_n ( framebuffer , bufferlen ) ; }
@brief: Push an image buffer to the frame memory.
@brief : Push an image buffer to the frame memory .
/* x point must be the multiple of 8 or the last 3 bits will be ignored */ /* send the image data */