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
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);
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;
+
}