Skip to content

Commit

Permalink
update STM32F4XX_Platform submodule; remove unneeded EXTERNAL_OSC def…
Browse files Browse the repository at this point in the history
…ines (this can handily be done in Makefiles if necessary so we'll default the hardcode to 12mhz); correct some minor file formatting;
  • Loading branch information
gatekeep committed Jan 7, 2024
1 parent 4393f07 commit 7641376
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 16 deletions.
7 changes: 0 additions & 7 deletions Defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,16 +129,9 @@ typedef unsigned long long ulong64_t;
// Frequencies such as 12.0 Mhz (48000 * 250) and 14.4 Mhz (48000 * 300) are suitable.
// Frequencies such as 10.0 Mhz (48000 * 208.333) or 20 Mhz (48000 * 416.666) are not suitable.
//
// For 12 MHz
#ifndef EXTERNAL_OSC
#define EXTERNAL_OSC 12000000
#endif
// For 12.288 MHz
// #define EXTERNAL_OSC 12288000
// For 14.4 MHz
// #define EXTERNAL_OSC 14400000
// For 19.2 MHz
// #define EXTERNAL_OSC 19200000

// Sanity check to make sure EXTERNAL_OSC is a valid integer multiple of 48kHz
#if (EXTERNAL_OSC % 48000 != 0)
Expand Down
18 changes: 12 additions & 6 deletions IO.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,19 +102,25 @@ class DSP_FW_API IO {
void selfTest();

#if SPI_ENABLED
void SPI_Write(uint8_t* bytes, uint8_t length);
/// <summary></summary>
void SPI_Write(uint8_t* bytes, uint8_t length);

uint16_t SPI_Read();
/// <summary></summary>
uint16_t SPI_Read();
#endif

#if DIGIPOT_ENABLED
void SetDigipot(uint8_t value);
/// <summary></summary>
void SetDigipot(uint8_t value);

void SetTxDigipot(uint8_t value);
/// <summary></summary>
void SetTxDigipot(uint8_t value);

void SetRxDigipot(uint8_t value);
/// <summary></summary>
void SetRxDigipot(uint8_t value);

void SetRsDigipot(uint8_t value);
/// <summary></summary>
void SetRsDigipot(uint8_t value);
#endif

private:
Expand Down
16 changes: 14 additions & 2 deletions IOSTM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,10 @@ void IO::SetDigipot(uint8_t value)
SPI_Write(bytes, 2);
}

/// <summary>
///
/// </summary>
/// <param name="value"></param>
void IO::SetTxDigipot(uint8_t value)
{
// Set CS for TX pot to low
Expand All @@ -496,6 +500,10 @@ void IO::SetTxDigipot(uint8_t value)
GPIO_WriteBit(PORT_CS_TXPOT, PIN_CS_TXPOT, Bit_SET);
}

/// <summary>
///
/// </summary>
/// <param name="value"></param>
void IO::SetRxDigipot(uint8_t value)
{
// Set CS for RX pot to low
Expand All @@ -504,6 +512,10 @@ void IO::SetRxDigipot(uint8_t value)
GPIO_WriteBit(PORT_CS_RXPOT, PIN_CS_RXPOT, Bit_SET);
}

/// <summary>
///
/// </summary>
/// <param name="value"></param>
void IO::SetRsDigipot(uint8_t value)
{
// Set CS for TX pot to low
Expand Down Expand Up @@ -763,7 +775,7 @@ void IO::startInt()
nvicStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&nvicStructure);

#if defined(SPI_ENABLED)
#if defined(SPI_ENABLED)
SPI_InitTypeDef SPI_Initstruct;
SPI_Initstruct.SPI_Direction = SPI_Direction_2Lines_FullDuplex;
SPI_Initstruct.SPI_Mode = SPI_Mode_Master;
Expand All @@ -776,7 +788,7 @@ void IO::startInt()
SPI_Initstruct.SPI_FirstBit = SPI_FirstBit_MSB;
SPI_Init(SPI_PERIPH, &SPI_Initstruct);
SPI_Cmd(SPI_PERIPH, ENABLE);
#endif
#endif

GPIO_ResetBits(PORT_COSLED, PIN_COSLED);
GPIO_SetBits(PORT_LED, PIN_LED);
Expand Down

0 comments on commit 7641376

Please sign in to comment.