Skip to content

Commit 4d5d1dc

Browse files
authored
Merge pull request #283 from brilliantlabsAR/robert/spi-clock-refactor-0
Robert/spi clock refactor 0
2 parents c49f4bb + 5ab8b22 commit 4d5d1dc

File tree

111 files changed

+32801
-28283
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+32801
-28283
lines changed
137 KB
Loading

docs/fpga-architecture.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,21 @@ Each function is accessed through a register. Registers are always addressed by
1919
| 0x11 | `GRAPHICS_ASSIGN_COLOR` | Assigns a color to one of the 16 color palette slots. Color should be provided in YCbCr format.<br>**Write: `palette_index[7:0]`**<br>**Write: `y[7:0]`**<br>**Write: `cb[7:0]`**<br>**Write: `cr[7:0]`**
2020
| 0x12 | `GRAPHICS_DRAW_SPRITE` | Draws a sprite on the screen. The first two arguments specify an absolute x and y position to print the sprite. The sprite will be printed from its top left corner. The third argument determines the width of the sprite in pixels. The fourth argument determines the number of colors contained in the sprite. This value may be 2, 4, or 16. The final argument specifies the color palette offset for assigning the color values held in the sprite against the stored colors in the palette. Following bytes will then be printed on the background frame buffer.<br>**Write: `x_position[15:0]`**<br>**Write: `y_position[15:0]`**<br>**Write: `width[15:0]`**<br>**Write: `total_colors[7:0]`**<br>**Write: `palette_offset[7:0]`**<br>**Write: `pixel_data[7:0]`**<br>**...**<br>**Write: `pixel_data[7:0]`**<br>
2121
| 0x13 | `GRAPHICS_DRAW_VECTOR` | Draws a cubic Bézier curve from the start position to the end position. Control points 1 and 2 are relative to the start and end positions respectively, and are used to determine the shape of the curve. The final argument determines the color used from the current palette, and can be between 0 and 15.<br>**Write: `x_start_position[15:0]`**<br>**Write: `y_start_position[15:0]`**<br>**Write: `x_end_position[15:0]`**<br>**Write: `y_end_position[15:0]`**<br>**Write: `ctrl_1_x_position[15:0]`**<br>**Write: `ctrl_1_y_position[15:0]`**<br>**Write: `ctrl_2_x_position[15:0]`**<br>**Write: `ctrl_2_y_position[15:0]`**<br>**Write: `color[7:0]`**
22-
| 0x14 | `GRAPHICS_BUFFER_SHOW` | The foreground and background buffers are switched. The new foreground buffer is continuously rendered to the display, and the background buffer can be used to load new draw commands.
22+
| 0x14 | `GRAPHICS_BUFFER_SHOW` | The foreground and background buffers are switched. The new foreground buffer is continuously rendered to the display, and the background buffer can be used to load new draw commands.<br><br>**Note**: It is recommended to verify that the value of bit [1] of `GRAPHICS_BUFFER_STATUS` (`0x18`) is zero, in order to ensure that the previous `GRAPHICS_BUFFER_SHOW` command has been accepted before issuing a new `GRAPHICS_BUFFER_SHOW` command.
23+
| 0x18 | `GRAPHICS_BUFFER_STATUS`| Status of graphics buffer.<br>**Read: `buffer_status[1:0]`**<br>`buffer_status[0]`: Current buffer<br>`buffer_status[1]`: Switch buffer pending
2324
| 0x20 | `CAMERA_CAPTURE` | Starts a new image capture.
25+
| 0x30 | `CAMERA_IMAGE_READY` | Flag indicating that the JPEG compression has been completed. It is recommended to read a 1 twice before reading the image data.<br>**Read: `image_complete[0]`**
2426
| 0x21 | `CAMERA_BYTES_AVAILABLE`| Returns how many bytes are available to read within the capture memory.<br>**Read: `bytes_available[23:0]`**
27+
| 0x31 | `CAMERA_BYTES_TOTAL` | Returns the size of the entropy coded segment of the JPEG data.<br>**Read: `compressed_bytes[15:0]`**
2528
| 0x22 | `CAMERA_READ_BYTES` | Reads a number of bytes from the capture memory.<br>**Read: `data[7:0]`**<br>**...**<br>**Read: `data[7:0]`**
26-
| 0x23 | `CAMERA_ZOOM` | Sets the zoom factor. A setting of `1` captures a 720x720 image, `2` captures 360x360, `3` captures 240x240, and `4` captures 180x180.<br>**Write: `zoom_factor[7:0]`**
27-
| 0x24 | `CAMERA_PAN` | Pans the capture window up or down in discrete steps. A setting of `10` captures the top-most part of the image, `0` is the middle, and `-10` is the bottom-most<br>**Write: `pan_position[7:0]`**
29+
| 0x23 | `CAMERA_RESOLUTION` | Sets the resolution of the image capture in pixels. Captured images are always square, so only one value is required.<br>**Write: `resolution[10:0]`**
2830
| 0x25 | `CAMERA_READ_METERING` | Returns the current brightness levels for the red, green and blue channels of the camera. Two sets of values are returned representing spot and average metering.<br>**Read: `center_red_level[7:0]`**<br>**Read: `center_green_level[7:0]`**<br>**Read: `center_blue_level[7:0]`**<br>**Read: `average_red_level[7:0]`**<br>**Read: `average_green_level[7:0]`**<br>**Read: `average_blue_level[7:0]`**
29-
| 0x26 | `CAMERA_QUALITY_FACTOR` | Sets the jpeg quality factor of the saved image. High values are higher quality but bigger size.<br>**Write: `quality_factor[1:0]`**.<br>- **0b01** = 100%<br>- **0b00** = 50%<br>- **0b11** = 25%<br>- **0b10** = 10%
30-
| 0xDB | `GET_CHIP_ID` | Returns the chip ID value.<br>**Read: `0x81`**
31+
| 0x26 | `CAMERA_QUALITY_FACTOR` | Sets the Quality Factor (QF) of the saved JPEG image. High values are higher quality but bigger size.<br>**Write: `quality_factor[2:0]`**<br>`0x0` = Lowest quality<br>`0x1`<br>`0x2`<br>`0x3`<br>`0x4`<br>`0x5`<br>`0x6`<br>`0x7` = Highest quality<br>
32+
| 0x28 | `CAMERA_DPHY_POWER_DOWN`| Enables or disables the MIPI D-PHY for power saving when the camera is not needed.<br>**Write: `dphy_power_down[0]`**<br>`0x0` = Normal operation (default)<br>`0x1` = Power down
33+
| 0x32 | `CAMERA_GAMMA_BYPASS` | Bypasses the gamma correction block when enabled. This is needed for factory camera focusing and calibration.<br>**Write: `gamma_bypass[0]`**<br>`0x0` = Normal operation (default)<br>`0x1` = Gamma correction bypassed
34+
| 0x40 | `PLL_CONTROL` | PLL Control Register. Controls PLL power and clock mux of image buffer.<br>**Write: `pll_powerdown_n[0]`**<br>`0x00` = Power down PLL<br>`0x01` = Power on PLL (default)<br>**Write: `image_buffer_clock_sel[1]`**<br>`0x00` = Image buffer clocked from PLL generated clock (default)<br>`0x01` = Image buffer clocked from SPI clock<br>
35+
| 0x41 | `PLL_STATUS` | Status of PLL clock outputs.<br>**Read: `pll_status[0]`**<br>`0x00` = PLL powered down or not stable yet<br>`0x01` = PLL powered on and stable
36+
| 0xDB | `GET_CHIP_ID` | Returns the chip ID value.<br>**Read: `id_value[7:0]`**<br>`0x81` = FPGA running correctly (default)
3137

3238
## Graphics
3339

source/application/camera_configuration.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,18 +83,18 @@ static const camera_config_t camera_config[] = {
8383
{0x3805, 0x0b}, // Horizontal end address [7:0]
8484
{0x3806, 0x02}, // Vertical end address [15:8]
8585
{0x3807, 0xdb}, // Vertical end address [7:0]
86-
{0x3808, 0x05}, // Horizontal output size [15:8]
87-
{0x3809, 0x02}, // Horizontal output size [7:0]
86+
{0x3808, 0x02}, // Horizontal output size [15:8]
87+
{0x3809, 0xd4}, // Horizontal output size [7:0]
8888
{0x380a, 0x02}, // Vertical output size [15:8]
8989
{0x380b, 0xd2}, // Vertical output size [7:0]
9090
{0x380c, 0x05}, // Pixels per line [15:8]
9191
{0x380d, 0xc6}, // Pixels per line [7:0]
9292
{0x380e, 0x03}, // Lines per frame [15:8]
9393
{0x380f, 0x2a}, // Lines per frame [7:0]
94-
{0x3810, 0x00}, // ISP horizontal window offset [15:8]
95-
{0x3811, 0x00}, // ISP horizontal window offset [7:0]
94+
{0x3810, 0x01}, // ISP horizontal window offset [15:8]
95+
{0x3811, 0x84}, // ISP horizontal window offset [7:0]
9696
{0x3812, 0x00}, // ISP vertical window offset [15:8]
97-
{0x3813, 0x00}, // ISP vertical window offset [7:0]
97+
{0x3813, 0x02}, // ISP vertical window offset [7:0]
9898
{0x3816, 0x00}, // VSYNC start row [15:8]
9999
{0x3817, 0x00}, // VSYNC start row [7:0]
100100
{0x3818, 0x00}, // VSYNC end row [15:8]

source/application/jpeg_header/Makefile

Lines changed: 0 additions & 20 deletions
This file was deleted.

source/application/jpeg_header/footer.bin

Lines changed: 0 additions & 1 deletion
This file was deleted.

source/application/jpeg_header/jhdr.c

Lines changed: 0 additions & 44 deletions
This file was deleted.

source/application/jpeg_header/jhdr.h

Lines changed: 0 additions & 13 deletions
This file was deleted.

source/application/jpeg_header/main.c

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)