// Copyright (c) 2020, Andrew Kay
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

#pragma once

#include "stm32l4xx_ll_gpio.h"

#define COAX_RESET_Pin GPIO_PIN_3
#define COAX_RESET_GPIO_Port GPIOA
#define COAX_IRQ_Pin GPIO_PIN_0
#define COAX_IRQ_GPIO_Port GPIOB
#define COAX_IRQ_EXTI_IRQn EXTI0_IRQn

#define ICE40_CS_Pin GPIO_PIN_4
#define ICE40_CS_GPIO_Port GPIOA
#define ICE40_SCK_Pin GPIO_PIN_5
#define ICE40_SCK_GPIO_Port GPIOA
#define ICE40_SDO_Pin GPIO_PIN_6
#define ICE40_SDO_GPIO_Port GPIOA
#define ICE40_SDI_Pin GPIO_PIN_7
#define ICE40_SDI_GPIO_Port GPIOA
#define ICE40_CRESET_Pin GPIO_PIN_1
#define ICE40_CRESET_GPIO_Port GPIOB
#define ICE40_CDONE_Pin GPIO_PIN_2
#define ICE40_CDONE_GPIO_Port GPIOB

#define GPIO0_Pin GPIO_PIN_10
#define GPIO0_GPIO_Port GPIOB
#define GPIO1_Pin GPIO_PIN_11
#define GPIO1_GPIO_Port GPIOB

#define LED_STATUS_Pin GPIO_PIN_12
#define LED_STATUS_GPIO_Port GPIOB
#define LED_TX_Pin GPIO_PIN_13
#define LED_TX_GPIO_Port GPIOB
#define LED_RX_Pin GPIO_PIN_14
#define LED_RX_GPIO_Port GPIOB
#define LED_ERROR_Pin GPIO_PIN_15
#define LED_ERROR_GPIO_Port GPIOB

#define USB_D__Pin GPIO_PIN_11
#define USB_D__GPIO_Port GPIOA
#define USB_D_A12_Pin GPIO_PIN_12
#define USB_D_A12_GPIO_Port GPIOA
