ECE4760 - Laser Projector (ipb7, jcc384, pfc38)
1
Raster Laser Projection
|
#include "projector.h"
Go to the source code of this file.
Macros | |
#define | DAC_A (0b0 << 15) |
#define | DAC_B (0b1 << 15) |
#define | DAC_GAIN_VREF (0b1 << 13) |
#define | DAC_GAIN_2VREF (0b0 << 13) |
#define | DAC_ACTIVE (0b1 << 12) |
#define | DAC_INACTIVE (0b0 << 12) |
#define | PIXEL_DMA_CHN (0) |
#define | Y_MIRROR_SPI_CHN (1) |
#define | Y_MIRROR_SPI_CONFIG (DAC_A | DAC_GAIN_2VREF | DAC_ACTIVE) |
#define | PIXEL_ON_TIME (400) |
How many clock ticks the pixel is on. More... | |
Functions | |
void | projector_init () |
Initialize projector peripherals, variables etc. MUST be called before calling any other projector functions! More... | |
void | projector_set_pixel (struct color const color, unsigned int x, unsigned int y) |
Set the color of a pixel at the specified location. More... | |
void | __ISR (_DMA0_VECTOR, IPL5SOFT) |
void | __ISR (_CHANGE_NOTICE_VECTOR, IPL5SOFT) |
Variables | |
struct color | projector_framebuffer [IMAGE_HEIGHT][IMAGE_WIDTH+PHASE_SHIFT_PADDING] = {0} |
#define DAC_A (0b0 << 15) |
Definition at line 34 of file projector.c.
#define DAC_ACTIVE (0b1 << 12) |
Definition at line 38 of file projector.c.
#define DAC_B (0b1 << 15) |
Definition at line 35 of file projector.c.
#define DAC_GAIN_2VREF (0b0 << 13) |
Definition at line 37 of file projector.c.
#define DAC_GAIN_VREF (0b1 << 13) |
Definition at line 36 of file projector.c.
#define DAC_INACTIVE (0b0 << 12) |
Definition at line 39 of file projector.c.
#define PIXEL_DMA_CHN (0) |
Definition at line 41 of file projector.c.
#define PIXEL_ON_TIME (400) |
How many clock ticks the pixel is on.
Definition at line 48 of file projector.c.
#define Y_MIRROR_SPI_CHN (1) |
Definition at line 42 of file projector.c.
#define Y_MIRROR_SPI_CONFIG (DAC_A | DAC_GAIN_2VREF | DAC_ACTIVE) |
Definition at line 43 of file projector.c.
void __ISR | ( | _DMA0_VECTOR | , |
IPL5SOFT | |||
) |
This interrupt is called when all of the pixels from a row have been displayed. The mirror should be moved to the next line, the Timer Gate latch reset, timer reset, and DMA configured for the next row.
We also turn off the lasers clearing the last pixel. This could also be achieved by adding an always-black pixel to the end of the row and having DMA output it, an option that should be considered based on the performance of this solution.
Definition at line 229 of file projector.c.
void __ISR | ( | _CHANGE_NOTICE_VECTOR | , |
IPL5SOFT | |||
) |
Definition at line 252 of file projector.c.
void projector_init | ( | void | ) |
Initialize projector peripherals, variables etc. MUST be called before calling any other projector functions!
Definition at line 123 of file projector.c.
void projector_set_pixel | ( | struct color const | color, |
unsigned int | x, | ||
unsigned int | y | ||
) |
Set the color of a pixel at the specified location.
Once a pixels value is changed, the new value will be projected the next time the pixel is output (there is no v-sync).
color | Color to be displayed |
x | Number of pixels from left side |
y | Number of pixels from the top |
Definition at line 205 of file projector.c.
struct color projector_framebuffer[IMAGE_HEIGHT][IMAGE_WIDTH+PHASE_SHIFT_PADDING] = {0} |
Definition at line 114 of file projector.c.