Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <rflpc17xx/rflpc17xx.h>
- #include <nhd_spi_lcd.h>
- uint8_t buffer[128*4];
- #define WIDTH 128
- #define HEIGHT 32
- #define COORD_TO_BYTE(x,y) ((((y)>>3) * WIDTH) + (x))
- #define COORD_TO_BIT(x,y) (((y) & 7))
- void pixel_set(uint8_t x, uint8_t y) {
- int byte_idx = COORD_TO_BYTE(x,y);
- buffer[byte_idx] |= (1 << COORD_TO_BIT(x,y));
- }
- void clr_pixel(uint8_t x, uint8_t y) {
- int byte_idx = COORD_TO_BYTE(x,y);
- buffer[byte_idx] &= (1 << COORD_TO_BIT(x,y));
- }
- void lcd_clear() {
- int i, j;
- for (i = 0; i < WIDTH; i++)
- for (j = 0; j < HEIGHT; j++)
- clr_pixel(i,j);
- }
- void draw_ball(uint8_t x, uint8_t y) {
- }
- int main() {
- nhd_spi_lcd_init(NHD_MAKE_SIZE(128,32),MBED_DIP6,MBED_DIP8,MBED_DIP11,RFLPC_SPI1);
- int i;
- for (i = 3; i < 19; i++) {
- pixel_set(0,i);
- pixel_set(1,i);
- }
- nhd_spi_lcd_display_buffer(buffer);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement