diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/apalis-tk1-k20-api.h | 7 | ||||
-rw-r--r-- | source/com_task.c | 2 | ||||
-rw-r--r-- | source/gpio_ext.h | 10 | ||||
-rw-r--r-- | source/main.c | 8 |
4 files changed, 22 insertions, 5 deletions
diff --git a/source/apalis-tk1-k20-api.h b/source/apalis-tk1-k20-api.h index 85bbf9f..35fc88d 100644 --- a/source/apalis-tk1-k20-api.h +++ b/source/apalis-tk1-k20-api.h @@ -48,7 +48,7 @@ #define APALIS_TK1_K20_CAN_DEV_OFFSET(x) (x ? APALIS_TK1_K20_CAN_OFFSET : 0) /* 0x30-0x3F Reserved */ -/* 0x40-0x62 CAN1 registers same layout as CAN0*/ +/* 0x40-0x62 CAN1 registers same layout as CAN0 */ /* 0x63-0x6F Reserved */ /* ADC Registers */ @@ -104,7 +104,11 @@ #define APALIS_TK1_K20_TSC_IRQ 4 #define APALIS_TK1_K20_GPIO_IRQ 5 +#ifndef TESTER_BUILD #define APALIS_TK1_K20_FW_VER 0x10 +#else +#define APALIS_TK1_K20_FW_VER 0xFE +#endif #define FW_MINOR (APALIS_TK1_K20_FW_VER & 0x0F) #define FW_MAJOR ((APALIS_TK1_K20_FW_VER & 0xF0) >> 4) @@ -112,7 +116,6 @@ #define TK1_K20_SENTINEL 0x55 #define TK1_K20_INVAL 0xAA -#define APALIS_TK1_K20_NUMREGS 0x3f #define APALIS_TK1_K20_IRQ_REG_CNT 1 #define APALIS_TK1_K20_IRQ_PER_REG 8 diff --git a/source/com_task.c b/source/com_task.c index 4b73209..cd5af10 100644 --- a/source/com_task.c +++ b/source/com_task.c @@ -202,6 +202,7 @@ void spi_task(void *pvParameters) { if (slaveRxData[0] != APALIS_TK1_K20_READ_INST) { if (slaveRxData[1] <= 0x05) { ret = general_registers(&slaveXfer); +#ifndef TESTER_BUILD } else if ((slaveRxData[1] >= APALIS_TK1_K20_CANREG + APALIS_TK1_K20_CAN_DEV_OFFSET(0)) && (slaveRxData[1] <= APALIS_TK1_K20_CAN_OUT_BUF_END + APALIS_TK1_K20_CAN_DEV_OFFSET(0))) { ret = canx_registers(&slaveXfer, 0); @@ -211,6 +212,7 @@ void spi_task(void *pvParameters) { && (slaveRxData[1] <= APALIS_TK1_K20_CAN_OUT_BUF_END + APALIS_TK1_K20_CAN_DEV_OFFSET(1))) { ret = canx_registers(&slaveXfer, 1); can_read = 1; +#endif #ifdef BOARD_USES_ADC } else if ((slaveRxData[1] >= APALIS_TK1_K20_ADCREG) && (slaveRxData[1] <= APALIS_TK1_K20_ADC_CH3H)) { ret = adc_registers(&slaveXfer); diff --git a/source/gpio_ext.h b/source/gpio_ext.h index df9f323..39a9183 100644 --- a/source/gpio_ext.h +++ b/source/gpio_ext.h @@ -20,6 +20,10 @@ struct gpio_id{ struct gpio_id gpio_list [] = { {PORTA, GPIOA, 3}, {PORTA, GPIOA, 5}, +#ifdef TESTER_BUILD + {PORTA, GPIOA, 12}, + {PORTA, GPIOA, 13}, +#endif {PORTA, GPIOA, 17}, #ifndef BOARD_USES_ADC {PORTB, GPIOB, 0}, @@ -40,6 +44,10 @@ struct gpio_id gpio_list [] = { {PORTC, GPIOC, 4}, {PORTC, GPIOC, 6}, {PORTC, GPIOC, 7}, +#ifdef TESTER_BUILD + {PORTC, GPIOC, 16}, + {PORTC, GPIOC, 17}, +#endif {PORTD, GPIOD, 0}, {PORTD, GPIOD, 1}, {PORTD, GPIOD, 2}, @@ -55,7 +63,7 @@ struct gpio_id gpio_list [] = { {PORTD, GPIOD, 13}, {PORTD, GPIOD, 14}, {PORTD, GPIOD, 15}, -#ifndef SDK_DEBUGCONSOLE +#if !defined(SDK_DEBUGCONSOLE) || defined(TESTER_BUILD) {PORTE, GPIOE, 0}, {PORTE, GPIOE, 1}, #endif diff --git a/source/main.c b/source/main.c index c076e43..a6aa5eb 100644 --- a/source/main.c +++ b/source/main.c @@ -60,9 +60,11 @@ TaskHandle_t adc_task_handle; TaskHandle_t tsc_task_handle; #endif +#ifndef TESTER_BUILD TaskHandle_t can0_task_handle; TaskHandle_t can1_task_handle; TaskHandle_t can_tx_notify_task_handle; +#endif TaskHandle_t spi_task_handle; @@ -74,7 +76,9 @@ int main(void) { /* Init board hardware. */ BOARD_InitPins(); BOARD_BootClockRUN(); +#ifndef TESTER_BUILD BOARD_InitDebugConsole(); +#endif PRINTF("Apalis K20 Firmware Version %d.%d\r\n", FW_MAJOR, FW_MINOR); /* Create RTOS task */ @@ -82,7 +86,7 @@ int main(void) { { PRINTF("create SPI task error\r\n"); } - +#ifndef TESTER_BUILD if(xTaskCreate(can0_task, "CAN0_task", 1000L / sizeof(portSTACK_TYPE), NULL, 2, &can0_task_handle) != pdPASS) { PRINTF("create CAN0 task error\r\n"); @@ -97,7 +101,7 @@ int main(void) { { PRINTF("create CAN TX notify task error\r\n"); } - +#endif #ifdef BOARD_USES_ADC if(xTaskCreate(adc_task, "ADC_task", 1000L / sizeof(portSTACK_TYPE), NULL, 2, &adc_task_handle) != pdPASS) { |