aboutsummaryrefslogtreecommitdiff
path: root/driver_fw
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2023-11-04 18:09:55 +0100
committerjaseg <git@jaseg.de>2023-11-04 18:09:55 +0100
commit77549cbb2f155d465eb68297d75259a854989c7f (patch)
tree01f8bd52e64eb0ced34dd01b4519a1f4bb19a4c2 /driver_fw
parent8e42ca09787ab7698a068df71e37f388ca1b2e9f (diff)
download8seg-77549cbb2f155d465eb68297d75259a854989c7f.tar.gz
8seg-77549cbb2f155d465eb68297d75259a854989c7f.tar.bz2
8seg-77549cbb2f155d465eb68297d75259a854989c7f.zip
WIP towards board order
Diffstat (limited to 'driver_fw')
-rw-r--r--driver_fw/src/main.c42
1 files changed, 31 insertions, 11 deletions
diff --git a/driver_fw/src/main.c b/driver_fw/src/main.c
index b338a98..d5b0e83 100644
--- a/driver_fw/src/main.c
+++ b/driver_fw/src/main.c
@@ -177,25 +177,39 @@ int main(void) {
dma_tx_constant(COUNT_OF(waveform_zero_one), 0x00);
xfr_8b10b_encode_reset(&encoder_state_8b10b);
- memset(tx_buf_write, 0, sizeof(*tx_buf_write));
- for (size_t i=0; i<COUNT_OF(tx_buf_write->packet.channels); i++) {
- tx_buf_write->packet.channels[i] = 0x33;
- }
- for (size_t i=0; i<COUNT_OF(tx_buf_write->packet.brightness); i++) {
- tx_buf_write->packet.brightness[i] = 0xff;
- }
- update_tx_buf();
-
int i = 0;
int j = 0;
+ int k = 0;
+ int n = 0;
while (23) {
i++;
j++;
i %= 6;
j %= 4;
- delay_us(100000);
+ delay_us(30000);
set_rj45_leds(1 << j);
set_status_leds(1 << i);
+ if (i == 0) {
+ k++;
+ if (k == 16) {
+ k = 0;
+ n++;
+ if (n == 16) {
+ n = 0;
+ }
+ }
+
+ uint8_t b = (k < 8) ? (1<<k) : ~(1<<(k-8));
+
+ memset(tx_buf_write, 0, sizeof(*tx_buf_write));
+ for (size_t i=0; i<COUNT_OF(tx_buf_write->packet.channels); i++) {
+ tx_buf_write->packet.channels[i] = 0xff;
+ }
+ for (size_t i=0; i<COUNT_OF(tx_buf_write->packet.brightness); i++) {
+ tx_buf_write->packet.brightness[i] = 0xff; //(n<<4) | n;
+ }
+ update_tx_buf();
+ }
}
}
@@ -229,6 +243,7 @@ size_t cnd_pos = 0;
void DMA1_Channel1_IRQHandler() {
static int transfer_errors = 0;
static int current_symbol = 0;
+ static int idle_symbol = 0;
if (DMA1->ISR & DMA_ISR_TEIF1) {
transfer_errors ++;
@@ -257,7 +272,12 @@ void DMA1_Channel1_IRQHandler() {
sym_arr[sym_pos] = -255;
- if (tx_sympos == sizeof(struct data_packet)) {
+ idle_symbol++;
+ if (idle_symbol == 3) {
+ current_symbol = xfr_8b10b_encode(&encoder_state_8b10b, -K23_7);
+ idle_symbol = 0;
+
+ } else if (tx_sympos == sizeof(struct data_packet)) {
if (time_to_sync > 0) {
current_symbol = xfr_8b10b_encode(&encoder_state_8b10b, -K27_7);
sym_arr[sym_pos] = current_symbol;