blob: bdb4398fd11a1b07f2c544d6fc755e53e38d8ab0 [file] [log] [blame]
#pragma once
#include <Arduino.h>
#include <SPI.h>
namespace gonk::pin_config {
// STM32 Port & pin // PCB NET Name
constexpr uint16_t ICE40ResetN = PC13; // ICE_RST_N
constexpr uint16_t ICE40Done = PC8; // ICE_CDONE
constexpr uint16_t FlashCS = PD2; // ICE_SPI_SS
constexpr uint16_t FlashHold = PC11; // FLASH_HOLD
constexpr uint16_t FlashWP = PC12; // FLASH_WP
constexpr uint16_t FlashMOSI = PB5; // ICE_SPI_MOSI
constexpr uint16_t FlashMISO = PB4; // ICE_SPI_MISO
constexpr uint16_t FlashCLK = PB3; // ICE_SPI_SCK
constexpr uint16_t StatusLed = PB13; // STATUS
constexpr uint16_t FpgaDspiCS = PB9; // was PB6;
constexpr uint16_t FpgaDspiMOSI = PC3; // was PC10;
constexpr uint16_t FpgaDspiMISO = PC2; // was PC9;
constexpr uint16_t FpgaDspiCLK = PB10; // was PB2;
constexpr uint16_t FpgaIoReset = PA0;
constexpr uint16_t FpgaIoMode = PB11;
constexpr uint16_t FpgaIoValid = PB6; // was PB10;
class PinConfig {
public:
PinConfig();
// Init common MCU pins such as the status LED.
void Init();
// Init FPGA specific pins.
void InitFpgaPins();
void InitSampleBus();
// Halt the FPGA with the SPI bus released so SPI flash is accessible from the
// MCU.
void FpgaHalt();
void FpgaSpiConfigMode();
void FpgaEnable();
void SPIEnable();
void SPIDisable();
SPIClass flash_spi;
SPIClass fpga_spi;
private:
};
} // namespace gonk::pin_config