From: Michael Wiebusch Date: Tue, 17 Dec 2013 10:14:00 +0000 (+0100) Subject: switches and LEDs now controllable from FPGA X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=c3288673d3b8bf7509cb7db77ec8bd42496ac706;p=mvd_firmware.git switches and LEDs now controllable from FPGA --- diff --git a/firmware/src/main.c b/firmware/src/main.c index 4fc5aa7..d95708b 100644 --- a/firmware/src/main.c +++ b/firmware/src/main.c @@ -465,8 +465,8 @@ void USART1_IRQHandler(void) void decode_uC_reg(uint8_t addr) { switch (addr){ - case 0: - uC_regs[uC_regs[addr]]++; + case 0x0: + uC_regs[uC_regs[addr]]++; // just for debug reasons USART_SendData(USART1, addr); while (USART_GetFlagStatus(USART1, USART_FLAG_TXE) == RESET); USART_SendData(USART1, (uint8_t) (uC_regs[addr]>>8)); // upper nibble @@ -475,7 +475,7 @@ void decode_uC_reg(uint8_t addr) { while (USART_GetFlagStatus(USART1, USART_FLAG_TXE) == RESET); break; - case 1: + case 0x1: CB_GPIO_Out(ENAA0,uC_regs[addr] & 1<<5); CB_GPIO_Out(DISA0,uC_regs[addr] & 1<<4); CB_GPIO_Out(ENAD0,uC_regs[addr] & 1<<3); @@ -483,6 +483,31 @@ void decode_uC_reg(uint8_t addr) { CB_GPIO_Out(SENSOREN0,uC_regs[addr] & 1<<1); CB_GPIO_Out(JTAGEN0,uC_regs[addr] & 1<<0); break; + case 0x2: + CB_GPIO_Out(ENAA1,uC_regs[addr] & 1<<5); + CB_GPIO_Out(DISA1,uC_regs[addr] & 1<<4); + CB_GPIO_Out(ENAD1,uC_regs[addr] & 1<<3); + CB_GPIO_Out(DISD1,uC_regs[addr] & 1<<2); + CB_GPIO_Out(SENSOREN1,uC_regs[addr] & 1<<1); + CB_GPIO_Out(JTAGEN1,uC_regs[addr] & 1<<0); + break; + + case 0x10: + if(uC_regs[addr] & 1<<7) { + CB_GPIO_Out(LED4,uC_regs[addr] & 1<<3); + } + if(uC_regs[addr] & 1<<6) { + CB_GPIO_Out(LED3,uC_regs[addr] & 1<<2); + } + if(uC_regs[addr] & 1<<5) { + CB_GPIO_Out(LED2,uC_regs[addr] & 1<<1); + } + if(uC_regs[addr] & 1<<4) { + CB_GPIO_Out(LED1,uC_regs[addr] & 1<<0); + } + + break; + }