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> |
| 38 #include <assert.h> |
39 | 39 |
40 #define LOCAL_TRACE 0 | 40 #define LOCAL_TRACE 0 |
41 | 41 |
42 #define CMD_DISPLAY_NULL 0x00 | 42 #define CMD_DISPLAY_NULL 0x00 |
43 #define CMD_DISPLAY_SET_PARAM 0x01 | 43 #define CMD_DISPLAY_SET_PARAM 0x01 |
44 #define CMD_DISPLAY_OFF 0x02 | 44 #define CMD_DISPLAY_OFF 0x02 |
45 #define CMD_DISPLAY_ON 0x03 | 45 #define CMD_DISPLAY_ON 0x03 |
46 #define CMD_DISPLAY_DRAW_SCENE 0x04 | 46 #define CMD_DISPLAY_DRAW_SCENE 0x04 |
47 #define CMD_DISPLAY_FRAME_BEGIN 0x05 | 47 #define CMD_DISPLAY_FRAME_BEGIN 0x05 |
48 | 48 |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 } | 195 } |
196 | 196 |
197 for (int j = 0; j < M4DISPLAY_WIDTH; j++) { | 197 for (int j = 0; j < M4DISPLAY_WIDTH; j++) { |
198 SPI_I2S_SendData(SPI6, scramble_buf[j]); | 198 SPI_I2S_SendData(SPI6, scramble_buf[j]); |
199 } | 199 } |
200 } | 200 } |
201 | 201 |
202 chip_select(true); | 202 chip_select(true); |
203 } | 203 } |
204 | 204 |
| 205 status_t display_get_framebuffer(struct display_framebuffer *fb) |
| 206 { |
| 207 DEBUG_ASSERT(fb); |
| 208 LTRACEF("display_get_framebuffer %p\n", fb); |
| 209 |
| 210 fb->image.pixels = (void *)framebuffer; |
| 211 fb->image.format = IMAGE_FORMAT_RGB_2220; |
| 212 fb->image.width = M4DISPLAY_WIDTH; |
| 213 fb->image.height = M4DISPLAY_HEIGHT; |
| 214 fb->image.stride = M4DISPLAY_WIDTH; |
| 215 fb->image.rowbytes = M4DISPLAY_WIDTH; |
| 216 fb->flush = s4lcd_flush; |
| 217 fb->format = DISPLAY_FORMAT_UNKNOWN; //TODO |
| 218 |
| 219 return NO_ERROR; |
| 220 } |
| 221 |
205 status_t display_get_info(struct display_info *info) | 222 status_t display_get_info(struct display_info *info) |
206 { | 223 { |
| 224 DEBUG_ASSERT(info); |
207 LTRACEF("display_info %p\n", info); | 225 LTRACEF("display_info %p\n", info); |
208 | 226 |
209 info->framebuffer = (void *)framebuffer; | 227 info->format = DISPLAY_FORMAT_UNKNOWN; //TODO |
210 info->format = GFX_FORMAT_RGB_2220; | |
211 info->width = M4DISPLAY_WIDTH; | 228 info->width = M4DISPLAY_WIDTH; |
212 info->height = M4DISPLAY_HEIGHT; | 229 info->height = M4DISPLAY_HEIGHT; |
213 info->stride = M4DISPLAY_WIDTH; | |
214 info->flush = s4lcd_flush; | |
215 | 230 |
216 return NO_ERROR; | 231 return NO_ERROR; |
217 } | 232 } |
OLD | NEW |