From 641ed2a092df959f478390c52f90837b30a5332c Mon Sep 17 00:00:00 2001 From: jaseg Date: Fri, 27 Apr 2018 13:58:42 +0200 Subject: Make channel count configurable --- firmware/global.h | 2 +- firmware/main.c | 8 +++++--- 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; iDR = (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; }; -- cgit