Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2015 Gurjant Kalsi <me@gurjantkalsi.com> | 2 * Copyright (c) 2015 Gurjant Kalsi <me@gurjantkalsi.com> |
| 3 * | 3 * |
| 4 * Permission is hereby granted, free of charge, to any person obtaining | 4 * Permission is hereby granted, free of charge, to any person obtaining |
| 5 * a copy of this software and associated documentation files | 5 * a copy of this software and associated documentation files |
| 6 * (the "Software"), to deal in the Software without restriction, | 6 * (the "Software"), to deal in the Software without restriction, |
| 7 * including without limitation the rights to use, copy, modify, merge, | 7 * including without limitation the rights to use, copy, modify, merge, |
| 8 * publish, distribute, sublicense, and/or sell copies of the Software, | 8 * publish, distribute, sublicense, and/or sell copies of the Software, |
| 9 * and to permit persons to whom the Software is furnished to do so, | 9 * and to permit persons to whom the Software is furnished to do so, |
| 10 * subject to the following conditions: | 10 * subject to the following conditions: |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 27 #include <trace.h> | 27 #include <trace.h> |
| 28 #include <err.h> | 28 #include <err.h> |
| 29 | 29 |
| 30 #include <stm32f4xx.h> | 30 #include <stm32f4xx.h> |
| 31 #include <stm32f4xx_spi.h> | 31 #include <stm32f4xx_spi.h> |
| 32 #include <stm32f4xx_gpio.h> | 32 #include <stm32f4xx_gpio.h> |
| 33 #include <stm32f4xx_rcc.h> | 33 #include <stm32f4xx_rcc.h> |
| 34 | 34 |
| 35 #include <dev/display.h> | 35 #include <dev/display.h> |
| 36 #include <dev/gpio.h> | 36 #include <dev/gpio.h> |
| 37 #include <lib/gfx.h> | |
| 38 #include <platform/gpio.h> | 37 #include <platform/gpio.h> |
| 39 | 38 |
| 40 #define LOCAL_TRACE 0 | 39 #define LOCAL_TRACE 0 |
| 41 | 40 |
| 42 #define CMD_DISPLAY_NULL 0x00 | 41 #define CMD_DISPLAY_NULL 0x00 |
| 43 #define CMD_DISPLAY_SET_PARAM 0x01 | 42 #define CMD_DISPLAY_SET_PARAM 0x01 |
| 44 #define CMD_DISPLAY_OFF 0x02 | 43 #define CMD_DISPLAY_OFF 0x02 |
| 45 #define CMD_DISPLAY_ON 0x03 | 44 #define CMD_DISPLAY_ON 0x03 |
| 46 #define CMD_DISPLAY_DRAW_SCENE 0x04 | 45 #define CMD_DISPLAY_DRAW_SCENE 0x04 |
| 47 #define CMD_DISPLAY_FRAME_BEGIN 0x05 | 46 #define CMD_DISPLAY_FRAME_BEGIN 0x05 |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 195 } | 194 } |
| 196 | 195 |
| 197 for (int j = 0; j < M4DISPLAY_WIDTH; j++) { | 196 for (int j = 0; j < M4DISPLAY_WIDTH; j++) { |
| 198 SPI_I2S_SendData(SPI6, scramble_buf[j]); | 197 SPI_I2S_SendData(SPI6, scramble_buf[j]); |
| 199 } | 198 } |
| 200 } | 199 } |
| 201 | 200 |
| 202 chip_select(true); | 201 chip_select(true); |
| 203 } | 202 } |
| 204 | 203 |
| 204 status_t display_get_framebuffer(struct display_framebuffer *fb) | |
|
gkalsi
2016/03/09 21:13:37
DEBUG_ASSERT(fb);
cdotstout
2016/03/09 22:48:00
Done.
| |
| 205 { | |
| 206 LTRACEF("display_get_framebuffer %p\n", fb); | |
| 207 | |
| 208 fb->image.pixels = (void *)framebuffer; | |
| 209 fb->image.format = IMAGE_FORMAT_RGB_2220; | |
| 210 fb->image.width = M4DISPLAY_WIDTH; | |
| 211 fb->image.height = M4DISPLAY_HEIGHT; | |
| 212 fb->image.rowbytes = M4DISPLAY_WIDTH; | |
| 213 fb->flush = s4lcd_flush; | |
| 214 fb->format = DISPLAY_FORMAT_UNKNOWN; //TODO | |
| 215 | |
| 216 return NO_ERROR; | |
| 217 } | |
| 218 | |
| 205 status_t display_get_info(struct display_info *info) | 219 status_t display_get_info(struct display_info *info) |
| 206 { | 220 { |
| 207 LTRACEF("display_info %p\n", info); | 221 LTRACEF("display_info %p\n", info); |
| 208 | 222 |
| 209 info->framebuffer = (void *)framebuffer; | 223 info->format = DISPLAY_FORMAT_UNKNOWN; //TODO |
| 210 info->format = GFX_FORMAT_RGB_2220; | |
| 211 info->width = M4DISPLAY_WIDTH; | 224 info->width = M4DISPLAY_WIDTH; |
| 212 info->height = M4DISPLAY_HEIGHT; | 225 info->height = M4DISPLAY_HEIGHT; |
| 213 info->stride = M4DISPLAY_WIDTH; | |
| 214 info->flush = s4lcd_flush; | |
| 215 | 226 |
| 216 return NO_ERROR; | 227 return NO_ERROR; |
| 217 } | 228 } |
| OLD | NEW |