diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/global.h | 2 | ||||
-rw-r--r-- | firmware/main.c | 8 | ||||
-rw-r--r-- | firmware/serial.h | 2 |
3 files changed, 7 insertions, 5 deletions
diff --git a/firmware/global.h b/firmware/global.h index 3e585f6..0098d38 100644 --- a/firmware/global.h +++ b/firmware/global.h @@ -21,7 +21,7 @@ * in main.c. */ #define NBITS 14 -#define NCHANNELS 32 +#define NCHANNELS 8 #define CHANNEL_SPEC 'H' #define COLOR_SPEC COLOR_SPEC_RGBW #define DEVICE_TYPE OLSNDOT_V1 diff --git a/firmware/main.c b/firmware/main.c index ec56767..c6a4ac9 100644 --- a/firmware/main.c +++ b/firmware/main.c @@ -253,7 +253,7 @@ void do_transpose(void) { for (uint32_t i=0; i<NBITS; i++) { uint32_t mask = 1<<i<<(MAX_BITS-NBITS); /* Bit mask for this bit value. */ uint32_t bv = 0; /* accumulator thing */ - for (uint32_t j=0; j<32; j++) + for (uint32_t j=0; j<NCHANNELS; j++) if (rx_buf.set_fb_rq.framebuf[j] & mask) bv |= 1<<j; brightness_by_bit[i] = bv; @@ -287,10 +287,12 @@ void TIM1_BRK_UP_TRG_COM_IRQHandler(void) { * capture/compare channel 3 complementary outputs. The dead-time generator is used to sequence the clear and * strobe edges one after another. Since there may be small variations in IRQ service latency it is critical to * allow for some leeway between the end of this data transmission and strobe and clear. */ - SPI1->DR = (val&0xffff); - while (SPI1->SR & SPI_SR_BSY); +#if NCHANNELS > 16 SPI1->DR = (val>>16); while (SPI1->SR & SPI_SR_BSY); +#endif + SPI1->DR = (val&0xffff); + while (SPI1->SR & SPI_SR_BSY); /* Increment the bit index for the next cycle */ idx++; diff --git a/firmware/serial.h b/firmware/serial.h index 94cfd57..96d0e70 100644 --- a/firmware/serial.h +++ b/firmware/serial.h @@ -64,7 +64,7 @@ union rx_buf_union { * |<----------------NBITS---------------->| |<>|--ignored * | (MSB) brightness data (LSB) | |<>|--ignored */ - struct __attribute__((packed)) { uint16_t framebuf[32]; uint8_t end[0]; } set_fb_rq; + struct __attribute__((packed)) { uint16_t framebuf[NCHANNELS]; uint8_t end[0]; } set_fb_rq; uint8_t byte_data[0]; uint32_t mac_data; }; |