/** * \brief Put a byte to the display controller RAM * * If the LCD controller is accessed by the SPI interface we will also put the * data to the local framebuffer. * * \param[in] page Page address * \param[in] column Page offset (x coordinate) * \param[in] data Data to be written * * This example will put the value 0xFF to the first byte in the display memory * setting a 8 pixel high column of pixels in the upper left corner of the * display. * \code gfx_mono_st7565r_put_byte(0, 0, 0xFF); \endcode */ void gfx_mono_st7565r_put_byte(gfx_coord_t page, gfx_coord_t column, uint8_t data) { #ifdef CONFIG_ST7565R_FRAMEBUFFER gfx_mono_framebuffer_put_byte(page, column, data); #endif st7565r_set_page_address(page); st7565r_set_column_address(column); st7565r_write_data(data); }
/** * \brief Put a byte to the display controller RAM * * If the LCD controller is accessed by the SPI interface we will also put the * data to the local framebuffer. * * \param page Page address * \param column Page offset (x coordinate) * \param data Data to be written * * This example will put the value 0xFF to the first byte in the display memory * setting a 8 pixel high column of pixels in the upper left corner of the * display. * \code * gfx_mono_ssd1306_put_byte(0, 0, 0xFF, false); * \endcode */ void gfx_mono_ssd1306_put_byte(gfx_coord_t page, gfx_coord_t column, uint8_t data, bool force) { #ifdef CONFIG_SSD1306_FRAMEBUFFER if (!force && data == gfx_mono_framebuffer_get_byte(page, column)) { return; } gfx_mono_framebuffer_put_byte(page, column, data); #endif ssd1306_set_page_address(page); ssd1306_set_column_address(column); ssd1306_write_data(data); }
/** * \brief Draw pixel to framebuffer * * \param x X coordinate of the pixel * \param y Y coordinate of the pixel * \param color Pixel operation * */ void gfx_mono_framebuffer_draw_pixel(gfx_coord_t x, gfx_coord_t y, gfx_mono_color_t color) { uint8_t page; uint8_t pixel_mask; uint8_t pixel_value; /* Discard pixels drawn outside the screen */ if ((x > GFX_MONO_LCD_WIDTH - 1) || (y > GFX_MONO_LCD_HEIGHT - 1)) { return; } page = y / GFX_MONO_LCD_PIXELS_PER_BYTE; pixel_mask = (1 << (y - (page * 8))); /* * Read the page containing the pixel in interest, then perform the * requested action on this pixel before writing the page back to the * display. */ pixel_value = gfx_mono_framebuffer_get_byte(page, x); switch (color) { case GFX_PIXEL_SET: pixel_value |= pixel_mask; break; case GFX_PIXEL_CLR: pixel_value &= ~pixel_mask; break; case GFX_PIXEL_XOR: pixel_value ^= pixel_mask; break; default: break; } gfx_mono_framebuffer_put_byte(page, x, pixel_value); }