|
| 1 | +/** |
| 2 | + * @file IO_Config_Override.h |
| 3 | + * @brief Alternative IO for KL27Z based Hardware Interface Circuit |
| 4 | + * |
| 5 | + * DAPLink Interface Firmware |
| 6 | + * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved |
| 7 | + * SPDX-License-Identifier: Apache-2.0 |
| 8 | + * |
| 9 | + * Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 10 | + * not use this file except in compliance with the License. |
| 11 | + * You may obtain a copy of the License at |
| 12 | + * |
| 13 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 14 | + * |
| 15 | + * Unless required by applicable law or agreed to in writing, software |
| 16 | + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 17 | + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 18 | + * See the License for the specific language governing permissions and |
| 19 | + * limitations under the License. |
| 20 | + */ |
| 21 | + |
| 22 | +#ifndef __IO_CONFIG_H__ |
| 23 | +#define __IO_CONFIG_H__ |
| 24 | + |
| 25 | +#include "MKL27Z4.h" |
| 26 | +#include "compiler.h" |
| 27 | +#include "daplink.h" |
| 28 | + |
| 29 | +// This GPIO configuration is only valid for the KL27 HIC |
| 30 | +COMPILER_ASSERT(DAPLINK_HIC_ID == DAPLINK_HIC_ID_KL27Z); |
| 31 | + |
| 32 | + |
| 33 | +// Debug Port I/O Pins |
| 34 | + |
| 35 | +// SWCLK Pin PTC6 |
| 36 | +#define PIN_SWCLK_PORT PORTC |
| 37 | +#define PIN_SWCLK_GPIO FGPIOC |
| 38 | +#define PIN_SWCLK_BIT (6) |
| 39 | +#define PIN_SWCLK (1<<PIN_SWCLK_BIT) |
| 40 | + |
| 41 | +// SWDIO Pin PTC5 |
| 42 | +#define PIN_SWDIO_PORT PORTC |
| 43 | +#define PIN_SWDIO_GPIO FGPIOC |
| 44 | +#define PIN_SWDIO_BIT (5) |
| 45 | +#define PIN_SWDIO (1<<PIN_SWDIO_BIT) |
| 46 | + |
| 47 | +// nRESET Pin PTA20 |
| 48 | +#define PIN_nRESET_PORT PORTA |
| 49 | +#define PIN_nRESET_GPIO PTA |
| 50 | +#define PIN_nRESET_BIT (20) |
| 51 | +#define PIN_nRESET (1<<PIN_nRESET_BIT) |
| 52 | + |
| 53 | +// Debug Unit LEDs |
| 54 | + |
| 55 | +// HID_LED PTB0 |
| 56 | +#define PIN_HID_LED_PORT PORTB |
| 57 | +#define PIN_HID_LED_GPIO PTB |
| 58 | +#define PIN_HID_LED_BIT (0) |
| 59 | +#define PIN_HID_LED (1<<PIN_HID_LED_BIT) |
| 60 | +#define PIN_HID_LED_MUX_ALT (0) |
| 61 | + |
| 62 | +// MSC_LED PTB0 |
| 63 | +#define PIN_MSC_LED_PORT PORTB |
| 64 | +#define PIN_MSC_LED_GPIO PTB |
| 65 | +#define PIN_MSC_LED_BIT (0) |
| 66 | +#define PIN_MSC_LED (1<<PIN_MSC_LED_BIT) |
| 67 | +#define PIN_MSC_LED_MUX_ALT (0) |
| 68 | + |
| 69 | +// CDC_LED PTB0 |
| 70 | +#define PIN_CDC_LED_PORT PORTB |
| 71 | +#define PIN_CDC_LED_GPIO PTB |
| 72 | +#define PIN_CDC_LED_BIT (0) |
| 73 | +#define PIN_CDC_LED (1<<PIN_CDC_LED_BIT) |
| 74 | +#define PIN_CDC_LED_MUX_ALT (0) |
| 75 | + |
| 76 | +// Volatge monitor pins |
| 77 | + |
| 78 | +// Battery Voltage monitor PTB1 |
| 79 | +#define PIN_VMON_BAT_PORT PORTB |
| 80 | +#define PIN_VMON_BAT_GPIO PTB |
| 81 | +#define PIN_VMON_BAT_BIT (1) |
| 82 | +#define PIN_VMON_BAT (1<<PIN_VMON_BAT_BIT) |
| 83 | +#define PIN_VMON_BAT_ALT_MODE (kPORT_PinDisabledOrAnalog) |
| 84 | +#define PIN_VMON_BAT_ADC_CH (9) |
| 85 | +#define PIN_VMON_BAT_ADC_MUX (0) |
| 86 | + |
| 87 | +// Enable Battery Voltage monitor PTC3 |
| 88 | +#define PIN_RUN_VBAT_SENSE_PORT PORTC |
| 89 | +#define PIN_RUN_VBAT_SENSE_GPIO PTC |
| 90 | +#define PIN_RUN_VBAT_SENSE_BIT (3) |
| 91 | +#define PIN_RUN_VBAT_SENSE (1<<PIN_RUN_VBAT_SENSE_BIT) |
| 92 | + |
| 93 | +// Reset pins |
| 94 | + |
| 95 | +// SW RESET BUTTON PTD4 |
| 96 | +#define PIN_SW_RESET_PORT PORTD |
| 97 | +#define PIN_SW_RESET_GPIO PTD |
| 98 | +#define PIN_SW_RESET_BIT (4) |
| 99 | +#define PIN_SW_RESET (1<<PIN_SW_RESET_BIT) |
| 100 | +#define SW_RESET_PRESSED (0) |
| 101 | +#define SW_RESET_NOT_PRESSED (1) |
| 102 | +#define PIN_SW_RESET_LLWU_PIN (14) |
| 103 | +#define PIN_SW_RESET_LLWU_WAKEUP_TYPE kLLWU_ExternalPinFallingEdge |
| 104 | +#define PIN_SW_RESET_PORT_WAKEUP_TYPE kPORT_InterruptFallingEdge |
| 105 | + |
| 106 | +// WAKE_ON_EDGE PTC4 |
| 107 | +#define PIN_WAKE_ON_EDGE_PORT PORTC |
| 108 | +#define PIN_WAKE_ON_EDGE_GPIO PTC |
| 109 | +#define PIN_WAKE_ON_EDGE_BIT (4) |
| 110 | +#define PIN_WAKE_ON_EDGE (1<<PIN_WAKE_ON_EDGE_BIT) |
| 111 | +#define PIN_WAKE_ON_EDGE_LLWU_PIN (8) |
| 112 | +#define PIN_WAKE_ON_EDGE_LLWU_WAKEUP_TYPE kLLWU_ExternalPinFallingEdge |
| 113 | +#define PIN_WAKE_ON_EDGE_PORT_WAKEUP_TYPE kPORT_InterruptEitherEdge |
| 114 | + |
| 115 | +// Power LEDs |
| 116 | + |
| 117 | +// Yellow LED PTB0, configured as HID/MSC/CDC LEDs |
| 118 | + |
| 119 | +// Red Spare LED PTD7 |
| 120 | +#define PIN_RED_LED_PORT PORTD |
| 121 | +#define PIN_RED_LED_GPIO PTD |
| 122 | +#define PIN_RED_LED_BIT (7) |
| 123 | +#define PIN_RED_LED (1<<PIN_RED_LED_BIT) |
| 124 | + |
| 125 | + |
| 126 | +// define the reset button presses |
| 127 | +#define RESET_SHORT_PRESS 10 // x 30ms debounce time = 300ms |
| 128 | +#define RESET_MID_PRESS 80 // x 30ms debounce time = 2400ms |
| 129 | +#define RESET_LONG_PRESS 120 // x 30ms debounce time = 3600ms |
| 130 | +#define RESET_MAX_LENGTH_PRESS RESET_LONG_PRESS |
| 131 | + |
| 132 | +// BOARD REV ID |
| 133 | +#define PIN_BOARD_REV_ID_PORT PORTD |
| 134 | +#define PIN_BOARD_REV_ID_GPIO PTD |
| 135 | +#define PIN_BOARD_REV_ID_BIT (6) |
| 136 | +#define PIN_BOARD_REV_ID (1<<PIN_BOARD_REV_ID_BIT) |
| 137 | +#define PIN_BOARD_REV_ID_ADC_CH (7) |
| 138 | +#define PIN_BOARD_REV_ID_ADC_MUX (1) |
| 139 | + |
| 140 | +// COMBINED_SENSOR_INT PTA1 |
| 141 | +#define COMBINED_SENSOR_INT_PORT PORTA |
| 142 | +#define COMBINED_SENSOR_INT_GPIO GPIOA |
| 143 | +#define COMBINED_SENSOR_INT_PIN (1) |
| 144 | + |
| 145 | +// Connected LED Not available |
| 146 | + |
| 147 | +// Target Running LED Not available |
| 148 | + |
| 149 | +// UART |
| 150 | +#define UART_PORT PORTA |
| 151 | +#define UART_NUM (1) |
| 152 | +// RX PTA18 |
| 153 | +#define PIN_UART_RX_GPIO PTA |
| 154 | +#define PIN_UART_RX_BIT (18) |
| 155 | +#define PIN_UART_RX (1<<PIN_UART_RX_BIT) |
| 156 | +#define PIN_UART_RX_MUX_ALT (3) |
| 157 | +// TX PTA19 |
| 158 | +#define PIN_UART_TX_GPIO PTA |
| 159 | +#define PIN_UART_TX_BIT (19) |
| 160 | +#define PIN_UART_TX (1<<PIN_UART_TX_BIT) |
| 161 | +#define PIN_UART_TX_MUX_ALT (3) |
| 162 | + |
| 163 | +#define UART LPUART1 |
| 164 | +#define UART_RX_TX_IRQn LPUART1_IRQn |
| 165 | +#define UART_RX_TX_IRQHandler LPUART1_IRQHandler |
| 166 | + |
| 167 | +#endif |
0 commit comments