PSDR 2.5 prototypes are assembled. This commit includes notes for things I want to change or improve (in the notes section of the schematic) as well as preliminary code changes to make it work on this hardware. Display comes on, lots of the parts are working, but no frequency synth yet, so it's hard to know how well the design is working.
This commit is contained in:
parent
d227015917
commit
1890b25a4f
15 changed files with 8865 additions and 9918 deletions
Binary file not shown.
Binary file not shown.
BIN
Hardware/PSDR2.5_BOM.ods
Normal file
BIN
Hardware/PSDR2.5_BOM.ods
Normal file
Binary file not shown.
BIN
Hardware/PSDR2.5_BOM.xls
Normal file
BIN
Hardware/PSDR2.5_BOM.xls
Normal file
Binary file not shown.
|
@ -59,7 +59,6 @@
|
|||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.usepreprocessor.1630883481" name="Use preprocessor" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.usepreprocessor" value="true" valueType="boolean"/>
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.include.paths.1649056935" name="Include paths (-I)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.include.paths" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""../include""/>
|
||||
<listOptionValue builtIn="false" value=""D:\stm32-discovery-projects\CMSIS-SP-00300-r3p1-00rel0\Device\ARM\ARMCM4\Include""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/DSP_Lib}""/>
|
||||
<listOptionValue builtIn="false" value=""../system/include""/>
|
||||
<listOptionValue builtIn="false" value=""../system/include/cmsis""/>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="805042304116791388" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings Cross ARM" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="1682456878355093301" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings Cross ARM" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||
</provider>
|
||||
|
@ -16,7 +16,7 @@
|
|||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="776963627361157363" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings Cross ARM" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="1654378201599459276" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings Cross ARM" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||
</provider>
|
||||
|
|
17351
Source/Debug/PSDR.hex
17351
Source/Debug/PSDR.hex
File diff suppressed because it is too large
Load diff
|
@ -27,8 +27,8 @@
|
|||
// STM32F4DISCOVERY definitions (the GREEN led, D12, active high)
|
||||
// (SEGGER J-Link device name: STM32F407VG).
|
||||
|
||||
#define BLINK_PORT_NUMBER (0)
|
||||
#define BLINK_PIN_NUMBER (8)
|
||||
#define BLINK_PORT_NUMBER (4)
|
||||
#define BLINK_PIN_NUMBER (7)
|
||||
#define BLINK_ACTIVE_LOW (0)
|
||||
|
||||
#endif
|
||||
|
|
|
@ -24,7 +24,7 @@ uint16_t sampleIndex;
|
|||
volatile uint8_t sampleRun;
|
||||
|
||||
/* Definition for ADCx clock resources */
|
||||
#define ADC_RX_Q ADC3
|
||||
#define ADC_RX_Q ADC3
|
||||
#define ADC_RX_I ADC2
|
||||
#define ADC_MIC ADC1
|
||||
#define ADCx_CLK_ENABLE() __ADC1_CLK_ENABLE()
|
||||
|
@ -38,8 +38,8 @@ volatile uint8_t sampleRun;
|
|||
//#define ADCx_CHANNEL_GPIO_PORT GPIOA
|
||||
|
||||
/* Definition for ADCx's Channel */
|
||||
#define ADC_RX_Q_CHANNEL ADC_CHANNEL_3
|
||||
#define ADC_RX_I_CHANNEL ADC_CHANNEL_6
|
||||
#define ADC_RX_Q_CHANNEL ADC_CHANNEL_2
|
||||
#define ADC_RX_I_CHANNEL ADC_CHANNEL_3
|
||||
#define ADC_MIC_CHANNEL ADC_CHANNEL_9
|
||||
|
||||
#define ADC_LIPO_VOLTAGE ADC_CHANNEL_15
|
||||
|
|
|
@ -2,65 +2,60 @@
|
|||
*/
|
||||
|
||||
#ifndef HAL_H_
|
||||
#define HAL_H_
|
||||
#define HAL_H_
|
||||
|
||||
#include <main.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
//#include <stm32f10x.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
//#include <stm32f10x.h>
|
||||
//#include <stm32f415xx.h>
|
||||
#ifdef PSDR2
|
||||
#include "stm32f429xx.h"
|
||||
#include "stm32f429xx.h"
|
||||
#endif
|
||||
#include <stm32f4xx_hal_gpio.h>
|
||||
// #include <stm32f10x_gpio.h>
|
||||
#include <uart.h>
|
||||
#include <uart.h>
|
||||
#include "stm32f4xx_hal_dma.h"
|
||||
#include "stm32f4xx_hal_usart.h"
|
||||
|
||||
typedef struct _Gpio_Pin
|
||||
{
|
||||
GPIO_TypeDef* port;
|
||||
uint16_t pin;
|
||||
} Gpio_Pin;
|
||||
|
||||
// a timer with which channel of the timer specified
|
||||
typedef struct _Timer_Channel
|
||||
{
|
||||
uint8_t channel;
|
||||
TIM_TypeDef* timer;
|
||||
} Timer_Channel;
|
||||
|
||||
typedef struct _Gpio_Pin
|
||||
{
|
||||
GPIO_TypeDef* port;
|
||||
uint16_t pin;
|
||||
} Gpio_Pin;
|
||||
// a Timer_Pin is a gpio pin that is connected to an internal timer
|
||||
typedef struct _Timer_Pin
|
||||
{
|
||||
Gpio_Pin gpioPin;
|
||||
Timer_Channel timer;
|
||||
} Timer_Pin;
|
||||
|
||||
// a timer with which channel of the timer specified
|
||||
typedef struct _Timer_Channel
|
||||
{
|
||||
uint8_t channel;
|
||||
TIM_TypeDef* timer;
|
||||
} Timer_Channel;
|
||||
typedef void
|
||||
(*hal_sysTickCallback) (void);
|
||||
|
||||
// a Timer_Pin is a gpio pin that is connected to an internal timer
|
||||
typedef struct _Timer_Pin
|
||||
{
|
||||
Gpio_Pin gpioPin;
|
||||
Timer_Channel timer;
|
||||
} Timer_Pin;
|
||||
|
||||
typedef void (*hal_sysTickCallback)(void);
|
||||
|
||||
|
||||
|
||||
// hal wrappers for GPIO
|
||||
// gpioPin must be a Gpio_Pin struct
|
||||
// val must be either a 0 or a 1
|
||||
#define hal_writeGpio(gpioPin, val) (GPIO_WriteBit((gpioPin).port, (gpioPin).pin, (val))) // returns void
|
||||
#define hal_readGpio(gpioPin) (GPIO_ReadInputDataBit((gpioPin).port, (gpioPin).pin)) // returns uint8_t
|
||||
// hal wrappers for GPIO
|
||||
// gpioPin must be a Gpio_Pin struct
|
||||
// val must be either a 0 or a 1
|
||||
#define hal_writeGpio(gpioPin, val) (GPIO_WriteBit((gpioPin).port, (gpioPin).pin, (val))) // returns void
|
||||
#define hal_readGpio(gpioPin) (GPIO_ReadInputDataBit((gpioPin).port, (gpioPin).pin)) // returns uint8_t
|
||||
|
||||
// // power macros
|
||||
// #define hal_isPlugged(powerState) (!((powerState) & hal_externalPower))
|
||||
|
||||
|
||||
|
||||
__IO uint32_t timingDelay;
|
||||
__IO uint32_t timingDelay;
|
||||
|
||||
#define MEDIATEK_MODULE
|
||||
#define hal_gpsUart USART1
|
||||
|
||||
// gpio pins
|
||||
// gpio pins
|
||||
// extern const Gpio_Pin RX_TO_GSM;
|
||||
// extern const Gpio_Pin TX_FROM_GSM;
|
||||
// extern const Gpio_Pin FINGER_PRINT_POWER;
|
||||
|
@ -70,83 +65,85 @@
|
|||
// extern const Gpio_Pin BUZZER;
|
||||
// extern const Gpio_Pin RFID_INT;
|
||||
// extern const Gpio_Pin FINGER_PRINT_BUTTON;
|
||||
extern const Gpio_Pin LCD_NSS;
|
||||
extern const Gpio_Pin LCD_NSS;
|
||||
// extern const Gpio_Pin LOW_BAT;
|
||||
extern const Gpio_Pin RX_TO_GPS;
|
||||
extern const Gpio_Pin TX_FROM_GPS;
|
||||
extern const Gpio_Pin GPS_RESET;
|
||||
extern const Gpio_Pin GPS_FIX_LED;
|
||||
extern const Gpio_Pin GPS_PPS;
|
||||
extern const Gpio_Pin GPS_POWER;
|
||||
extern const Gpio_Pin SPI1_SCK;
|
||||
extern const Gpio_Pin SPI1_MISO;
|
||||
extern const Gpio_Pin SPI1_MOSI;
|
||||
extern const Gpio_Pin SPI2_SCK;
|
||||
extern const Gpio_Pin SPI2_MISO;
|
||||
extern const Gpio_Pin SPI2_MOSI;
|
||||
extern const Gpio_Pin LCD_RESET;
|
||||
extern const Gpio_Pin LCD_DC;
|
||||
extern const Gpio_Pin ADC_1;
|
||||
extern const Gpio_Pin ADC_2;
|
||||
extern const Gpio_Pin RX_TO_GPS;
|
||||
extern const Gpio_Pin TX_FROM_GPS;
|
||||
extern const Gpio_Pin GPS_RESET;
|
||||
extern const Gpio_Pin GPS_FIX_LED;
|
||||
extern const Gpio_Pin GPS_PPS;
|
||||
extern const Gpio_Pin GPS_POWER;
|
||||
extern const Gpio_Pin LCD_SCK;
|
||||
extern const Gpio_Pin LCD_MISO;
|
||||
extern const Gpio_Pin LCD_MOSI;
|
||||
extern const Gpio_Pin SPI2_SCK;
|
||||
extern const Gpio_Pin SPI2_MISO;
|
||||
extern const Gpio_Pin SPI2_MOSI;
|
||||
extern const Gpio_Pin LCD_RESET;
|
||||
extern const Gpio_Pin LCD_DC;
|
||||
extern const Gpio_Pin RX_Q;
|
||||
extern const Gpio_Pin RX_I;
|
||||
// extern const Gpio_Pin OLED_RESET;
|
||||
// extern const Gpio_Pin OLED_DC;
|
||||
// extern const Gpio_Pin OLED_NSS;
|
||||
|
||||
//CORRECT FOR PSDR1
|
||||
extern const Gpio_Pin ddsReset;
|
||||
extern const Gpio_Pin ddsSleep;
|
||||
extern const Gpio_Pin dds1Mosi;
|
||||
extern const Gpio_Pin dds1Nss;
|
||||
extern const Gpio_Pin dds1Sck;
|
||||
extern const Gpio_Pin dds2Mosi;
|
||||
extern const Gpio_Pin dds2Nss;
|
||||
extern const Gpio_Pin dds2Sck;
|
||||
extern const Gpio_Pin encoderA;
|
||||
extern const Gpio_Pin encoderB;
|
||||
extern const Gpio_Pin encoderP;
|
||||
extern const Gpio_Pin dac1;
|
||||
extern const Gpio_Pin dac2;
|
||||
//CORRECT FOR PSDR1
|
||||
//extern const Gpio_Pin ddsReset;
|
||||
//extern const Gpio_Pin ddsSleep;
|
||||
//extern const Gpio_Pin dds1Mosi;
|
||||
//extern const Gpio_Pin dds1Nss;
|
||||
//extern const Gpio_Pin dds1Sck;
|
||||
//extern const Gpio_Pin dds2Mosi;
|
||||
//extern const Gpio_Pin dds2Nss;
|
||||
//extern const Gpio_Pin dds2Sck;
|
||||
extern const Gpio_Pin encoderBee;
|
||||
extern const Gpio_Pin encoderB;
|
||||
extern const Gpio_Pin encoderP;
|
||||
extern const Gpio_Pin dac1;
|
||||
extern const Gpio_Pin dac2;
|
||||
|
||||
extern const Gpio_Pin REF_CLOCK_ENABLE;
|
||||
extern const Gpio_Pin DDS_FSEL;
|
||||
extern const Gpio_Pin DDS_PSEL;
|
||||
extern const Gpio_Pin RX_MUX;
|
||||
extern const Gpio_Pin TX_MUX;
|
||||
extern const Gpio_Pin AMP_SWITCH_A;
|
||||
extern const Gpio_Pin AMP_SWITCH_B;
|
||||
extern const Gpio_Pin IMP_BRIDGE_SWITCH_A;
|
||||
extern const Gpio_Pin IMP_BRIDGE_SWITCH_B;
|
||||
extern const Gpio_Pin MIXER_SWITCH_A;
|
||||
extern const Gpio_Pin MIXER_SWITCH_B;
|
||||
extern const Gpio_Pin TX_RF_SWITCH_A;
|
||||
extern const Gpio_Pin TX_RF_SWITCH_B;
|
||||
//extern const Gpio_Pin REF_CLOCK_ENABLE;
|
||||
//extern const Gpio_Pin DDS_FSEL;
|
||||
//extern const Gpio_Pin DDS_PSEL;
|
||||
//extern const Gpio_Pin RX_MUX;
|
||||
//extern const Gpio_Pin TX_MUX;
|
||||
extern const Gpio_Pin AMP_SWITCH_A;
|
||||
extern const Gpio_Pin AMP_SWITCH_B;
|
||||
extern const Gpio_Pin IMP_BRIDGE_SWITCH_A;
|
||||
extern const Gpio_Pin IMP_BRIDGE_SWITCH_B;
|
||||
//extern const Gpio_Pin MIXER_SWITCH_A;
|
||||
//extern const Gpio_Pin MIXER_SWITCH_B;
|
||||
extern const Gpio_Pin TX_RF_SWITCH_A;
|
||||
extern const Gpio_Pin TX_RF_SWITCH_B;
|
||||
|
||||
extern const Gpio_Pin AMP_POWER;
|
||||
extern const Gpio_Pin MIXER_POWER;
|
||||
extern const Gpio_Pin AMP_POWER;
|
||||
//extern const Gpio_Pin MIXER_POWER;
|
||||
|
||||
extern const Gpio_Pin GAIN_POT_SCLK;
|
||||
extern const Gpio_Pin GAIN_POT_MOSI;
|
||||
extern const Gpio_Pin GAIN_POT_NSS;
|
||||
extern const Gpio_Pin FILTER_GAIN_POT_SCLK;
|
||||
extern const Gpio_Pin FILTER_GAIN_POT_MOSI;
|
||||
extern const Gpio_Pin GAIN_POT_NSS;
|
||||
|
||||
extern const Gpio_Pin IN_AMP_ENABLE;
|
||||
extern const Gpio_Pin DAC_MUX;
|
||||
extern const Gpio_Pin IN_AMP_ENABLE;
|
||||
extern const Gpio_Pin DAC_MUX;
|
||||
|
||||
extern const Gpio_Pin AUDIO_AMP_NSHTDWN;
|
||||
extern const Gpio_Pin EARPHONE_NOT_INSERTED;
|
||||
extern const Gpio_Pin SIDETONE; //Should be a timer pin.
|
||||
extern const Gpio_Pin AUDIO_AMP_NSHTDWN;
|
||||
extern const Gpio_Pin EARPHONE_NOT_INSERTED;
|
||||
extern const Gpio_Pin SIDETONE; //Should be a timer pin.
|
||||
|
||||
extern const Gpio_Pin MIC_IN;
|
||||
extern const Gpio_Pin MIC_SWITCH;
|
||||
extern const Gpio_Pin PREAMP_POWER;
|
||||
extern const Gpio_Pin MIC_BUTTON;
|
||||
|
||||
extern const Gpio_Pin TOUCH1;
|
||||
extern const Gpio_Pin TOUCH2;
|
||||
extern const Gpio_Pin KEY1;
|
||||
extern const Gpio_Pin KEY2;
|
||||
extern const Gpio_Pin MIC_IN;
|
||||
extern const Gpio_Pin MIC_SWITCH;
|
||||
extern const Gpio_Pin PREAMP_POWER;
|
||||
extern const Gpio_Pin MIC_BUTTON;
|
||||
|
||||
extern const Gpio_Pin PADDLE_THUMB_NO;
|
||||
extern const Gpio_Pin PADDLE_INDEX_NO;
|
||||
extern const Gpio_Pin PADDLE_THUMB_NC;
|
||||
extern const Gpio_Pin PADDLE_INDEX_NC;
|
||||
|
||||
extern const Gpio_Pin FILTER_S0;
|
||||
extern const Gpio_Pin FILTER_S1;
|
||||
|
||||
extern const Gpio_Pin TRX_SWITCH;
|
||||
|
||||
// extern const Gpio_Pin NC_1;
|
||||
// extern const Gpio_Pin DAC_SWITCHES;
|
||||
|
@ -159,70 +156,84 @@
|
|||
// extern const Gpio_Pin POWER_SWITCH;
|
||||
// extern const Gpio_Pin ACCEL_NSS;
|
||||
|
||||
// timer pins
|
||||
// timer pins
|
||||
// extern const Timer_Pin LED_G;
|
||||
// extern const Timer_Pin LED_R;
|
||||
// extern const Timer_Pin LED_B;
|
||||
// extern const Timer_Pin SERVO1;
|
||||
// extern const Timer_Pin SERVO2;
|
||||
|
||||
extern inline bool
|
||||
hal_checkTimeout (uint32_t startTime_ms, uint32_t interval_ms);
|
||||
// returns true if the interval has timed out
|
||||
|
||||
int
|
||||
hal_acquireSemaphore (uint8_t sem);
|
||||
|
||||
extern inline bool hal_checkTimeout(uint32_t startTime_ms, uint32_t interval_ms);
|
||||
// returns true if the interval has timed out
|
||||
void
|
||||
hal_releaseSemaphore (uint8_t sem);
|
||||
|
||||
int hal_acquireSemaphore(uint8_t sem);
|
||||
void
|
||||
hal_getBatteryVoltage (float* battVoltage);
|
||||
// reads power voltage level
|
||||
|
||||
void hal_releaseSemaphore(uint8_t sem);
|
||||
void
|
||||
hal_delay_ms (uint32_t ms);
|
||||
// busy wait for ms milliseconds
|
||||
|
||||
void hal_getBatteryVoltage(float* battVoltage);
|
||||
// reads power voltage level
|
||||
void
|
||||
hal_setupPins (void);
|
||||
// Setup gpio pins and timer pins.
|
||||
|
||||
void hal_delay_ms(uint32_t ms);
|
||||
// busy wait for ms milliseconds
|
||||
void
|
||||
hal_timerSetCompare (const Timer_Channel* timer, uint16_t value);
|
||||
// set the timer compare register for timer
|
||||
|
||||
void hal_setupPins(void);
|
||||
// Setup gpio pins and timer pins.
|
||||
void
|
||||
hal_setupTimers (void);
|
||||
// Setup TIM3 and TIM4 for controlling the LEDs and Servos
|
||||
|
||||
void hal_timerSetCompare(const Timer_Channel* timer, uint16_t value);
|
||||
// set the timer compare register for timer
|
||||
uint32_t
|
||||
hal_getCurrentTime_ms (void);
|
||||
// get the current system millisecond count
|
||||
|
||||
void hal_setupTimers(void);
|
||||
// Setup TIM3 and TIM4 for controlling the LEDs and Servos
|
||||
void
|
||||
hal_setupUart1 (void);
|
||||
// setup usart 1 and its pins
|
||||
|
||||
uint32_t hal_getCurrentTime_ms(void);
|
||||
// get the current system millisecond count
|
||||
void
|
||||
hal_setupUart2 (void);
|
||||
// setup usart 2 and its pins
|
||||
|
||||
void hal_setupUart1(void);
|
||||
// setup usart 1 and its pins
|
||||
void
|
||||
hal_setupUart3 (unsigned int baudRate);
|
||||
// setup usart 3 and its pins
|
||||
|
||||
void hal_setupUart2(void);
|
||||
// setup usart 2 and its pins
|
||||
void
|
||||
hal_resetUart1 (void);
|
||||
// resets usart 1 and its pins
|
||||
|
||||
void hal_setupUart3(unsigned int baudRate);
|
||||
// setup usart 3 and its pins
|
||||
void
|
||||
hal_resetUart2 (void);
|
||||
// resets usart 2 and its pins
|
||||
|
||||
void hal_resetUart1(void);
|
||||
// resets usart 1 and its pins
|
||||
void
|
||||
hal_resetUart3 (void);
|
||||
// resets usart 3 and its pins
|
||||
|
||||
void hal_resetUart2(void);
|
||||
// resets usart 2 and its pins
|
||||
void
|
||||
hal_adcConfigure (void);
|
||||
// configure and enable used ADC(s)
|
||||
|
||||
void hal_resetUart3(void);
|
||||
// resets usart 3 and its pins
|
||||
|
||||
void hal_adcConfigure(void);
|
||||
// configure and enable used ADC(s)
|
||||
|
||||
uint16_t hal_readAdc1(uint8_t channel);
|
||||
// read a value on a channel of ADC1
|
||||
// returns value read
|
||||
|
||||
void hal_setSysTickCallback(hal_sysTickCallback callback);
|
||||
|
||||
//void hal_blinkLed(uint8_t led, uint8_t blinkCount, uint16_t onTime, uint16_t offTime);
|
||||
// blink the given LED blinkCount times
|
||||
uint16_t
|
||||
hal_readAdc1 (uint8_t channel);
|
||||
// read a value on a channel of ADC1
|
||||
// returns value read
|
||||
|
||||
void
|
||||
hal_setSysTickCallback (hal_sysTickCallback callback);
|
||||
|
||||
//void hal_blinkLed(uint8_t led, uint8_t blinkCount, uint16_t onTime, uint16_t offTime);
|
||||
// blink the given LED blinkCount times
|
||||
|
||||
#endif /* HAL_H_ */
|
||||
|
|
|
@ -88,18 +88,18 @@ void Adafruit_ILI9340_spiwrite(uint8_t c) {
|
|||
if(c & bit) {
|
||||
//digitalWrite(_mosi, HIGH);
|
||||
//SET_BIT(mosiport, mosipinmask);
|
||||
HAL_GPIO_WritePin(SPI1_MOSI.port, SPI1_MOSI.pin, 1);
|
||||
HAL_GPIO_WritePin(LCD_MOSI.port, LCD_MOSI.pin, 1);
|
||||
} else {
|
||||
//digitalWrite(_mosi, LOW);
|
||||
//CLEAR_BIT(mosiport, mosipinmask);
|
||||
HAL_GPIO_WritePin(SPI1_MOSI.port, SPI1_MOSI.pin, 0);
|
||||
HAL_GPIO_WritePin(LCD_MOSI.port, LCD_MOSI.pin, 0);
|
||||
}
|
||||
//digitalWrite(_sclk, HIGH);
|
||||
//SET_BIT(clkport, clkpinmask);
|
||||
HAL_GPIO_WritePin(SPI1_SCK.port, SPI1_SCK.pin, 1);
|
||||
HAL_GPIO_WritePin(LCD_SCK.port, LCD_SCK.pin, 1);
|
||||
//digitalWrite(_sclk, LOW);
|
||||
//CLEAR_BIT(clkport, clkpinmask);
|
||||
HAL_GPIO_WritePin(SPI1_SCK.port, SPI1_SCK.pin, 0);
|
||||
HAL_GPIO_WritePin(LCD_SCK.port, LCD_SCK.pin, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ void Adafruit_ILI9340_writecommand(uint16_t c) {
|
|||
HAL_GPIO_WritePin(LCD_DC.port, LCD_DC.pin, 0);
|
||||
//digitalWrite(_dc, LOW);
|
||||
//CLEAR_BIT(clkport, clkpinmask);
|
||||
HAL_GPIO_WritePin(SPI1_SCK.port, SPI1_SCK.pin, 0);
|
||||
HAL_GPIO_WritePin(LCD_SCK.port, LCD_SCK.pin, 0);
|
||||
//digitalWrite(_sclk, LOW);
|
||||
//CLEAR_BIT(csport, cspinmask);
|
||||
HAL_GPIO_WritePin(LCD_NSS.port, LCD_NSS.pin, 0);
|
||||
|
@ -134,7 +134,7 @@ void Adafruit_ILI9340_writedata(uint16_t c) {
|
|||
HAL_GPIO_WritePin(LCD_DC.port, LCD_DC.pin, 1);
|
||||
//digitalWrite(_dc, HIGH);
|
||||
//CLEAR_BIT(clkport, clkpinmask);
|
||||
HAL_GPIO_WritePin(SPI1_SCK.port, SPI1_SCK.pin, 0);
|
||||
HAL_GPIO_WritePin(LCD_SCK.port, LCD_SCK.pin, 0);
|
||||
//digitalWrite(_sclk, LOW);
|
||||
//CLEAR_BIT(csport, cspinmask);
|
||||
HAL_GPIO_WritePin(LCD_NSS.port, LCD_NSS.pin, 0);
|
||||
|
|
|
@ -3,35 +3,35 @@
|
|||
|
||||
void ddsPrefix()
|
||||
{
|
||||
HAL_GPIO_WritePin(dds1Sck.port, dds1Sck.pin, 1);
|
||||
HAL_GPIO_WritePin(dds2Sck.port, dds2Sck.pin, 1);
|
||||
//delay
|
||||
HAL_GPIO_WritePin(dds1Nss.port, dds1Nss.pin, 0);
|
||||
HAL_GPIO_WritePin(dds2Nss.port, dds2Nss.pin, 0);
|
||||
//Delay
|
||||
// HAL_GPIO_WritePin(dds1Sck.port, dds1Sck.pin, 1);
|
||||
// HAL_GPIO_WritePin(dds2Sck.port, dds2Sck.pin, 1);
|
||||
// //delay
|
||||
// HAL_GPIO_WritePin(dds1Nss.port, dds1Nss.pin, 0);
|
||||
// HAL_GPIO_WritePin(dds2Nss.port, dds2Nss.pin, 0);
|
||||
// //Delay
|
||||
}
|
||||
|
||||
void sendToDds(uint16_t data1, uint16_t data2)
|
||||
{
|
||||
int i;
|
||||
for(i = 0; i < 16; i++)
|
||||
{
|
||||
HAL_GPIO_WritePin(dds1Mosi.port, dds1Mosi.pin, (data1 >> (15-i)) & 1);
|
||||
HAL_GPIO_WritePin(dds2Mosi.port, dds2Mosi.pin, (data2 >> (15-i)) & 1);
|
||||
//delay
|
||||
HAL_GPIO_WritePin(dds1Sck.port, dds1Sck.pin, 0);
|
||||
HAL_GPIO_WritePin(dds2Sck.port, dds2Sck.pin, 0);
|
||||
//delay
|
||||
HAL_GPIO_WritePin(dds1Sck.port, dds1Sck.pin, 1); //The 16th shift of this line is when execution occurs
|
||||
HAL_GPIO_WritePin(dds2Sck.port, dds2Sck.pin, 1); //NOT on the release of NSS!!!! GAH!
|
||||
}
|
||||
// int i;
|
||||
// for(i = 0; i < 16; i++)
|
||||
// {
|
||||
// HAL_GPIO_WritePin(dds1Mosi.port, dds1Mosi.pin, (data1 >> (15-i)) & 1);
|
||||
// HAL_GPIO_WritePin(dds2Mosi.port, dds2Mosi.pin, (data2 >> (15-i)) & 1);
|
||||
// //delay
|
||||
// HAL_GPIO_WritePin(dds1Sck.port, dds1Sck.pin, 0);
|
||||
// HAL_GPIO_WritePin(dds2Sck.port, dds2Sck.pin, 0);
|
||||
// //delay
|
||||
// HAL_GPIO_WritePin(dds1Sck.port, dds1Sck.pin, 1); //The 16th shift of this line is when execution occurs
|
||||
// HAL_GPIO_WritePin(dds2Sck.port, dds2Sck.pin, 1); //NOT on the release of NSS!!!! GAH!
|
||||
// }
|
||||
}
|
||||
|
||||
void ddsSuffix()
|
||||
{
|
||||
HAL_GPIO_WritePin(dds1Nss.port, dds1Nss.pin, 1);
|
||||
HAL_GPIO_WritePin(dds2Nss.port, dds2Nss.pin, 1);
|
||||
//HAL_GPio
|
||||
// HAL_GPIO_WritePin(dds1Nss.port, dds1Nss.pin, 1);
|
||||
// HAL_GPIO_WritePin(dds2Nss.port, dds2Nss.pin, 1);
|
||||
// //HAL_GPio
|
||||
}
|
||||
|
||||
long long freqToReg(long long frequency)
|
||||
|
@ -49,7 +49,7 @@ void setFreq(long frequency)
|
|||
long long freg = freqToReg(frequency);
|
||||
|
||||
|
||||
HAL_GPIO_WritePin(ddsReset.port, ddsReset.pin, 1);
|
||||
//HAL_GPIO_WritePin(ddsReset.port, ddsReset.pin, 1);
|
||||
ddsPrefix();
|
||||
//sendToDds(0x2100, 0x2100);
|
||||
//sendToDds(0x0010001100000000 , 0x0010001100000000);
|
||||
|
@ -57,7 +57,7 @@ void setFreq(long frequency)
|
|||
ddsSuffix();
|
||||
|
||||
//HAL_GPIO_WritePin(ddsReset.port, ddsReset.pin, 0);
|
||||
HAL_GPIO_WritePin(ddsReset.port, ddsReset.pin, 1);
|
||||
//HAL_GPIO_WritePin(ddsReset.port, ddsReset.pin, 1);
|
||||
//sendToDds(0x50c7);
|
||||
//sendToDds(0x4000);
|
||||
ddsPrefix();
|
||||
|
@ -82,5 +82,5 @@ void setFreq(long frequency)
|
|||
// sendToDds(0x2000, 0x2000);
|
||||
// ddsSuffix();
|
||||
|
||||
HAL_GPIO_WritePin(ddsReset.port, ddsReset.pin, 0);
|
||||
// HAL_GPIO_WritePin(ddsReset.port, ddsReset.pin, 0);
|
||||
}
|
||||
|
|
1008
Source/src/hal.c
1008
Source/src/hal.c
File diff suppressed because it is too large
Load diff
|
@ -375,7 +375,7 @@ int isFwd;
|
|||
{
|
||||
if(!displayUpdating)
|
||||
{
|
||||
Position2 = (HAL_GPIO_ReadPin(encoderB.port, encoderB.pin) * 2) + HAL_GPIO_ReadPin(encoderA.port, encoderA.pin);;
|
||||
Position2 = (HAL_GPIO_ReadPin(encoderB.port, encoderB.pin) * 2) + HAL_GPIO_ReadPin(encoderBee.port, encoderBee.pin);;
|
||||
if (Position2 != Position)
|
||||
{
|
||||
isFwd = ((Position == 0) && (Position2 == 1)) || ((Position == 1) && (Position2 == 3)) ||
|
||||
|
@ -668,16 +668,16 @@ void setGainPot(uint8_t a, uint8_t b)
|
|||
HAL_GPIO_WritePin(GAIN_POT_NSS.port, GAIN_POT_NSS.pin, 0);
|
||||
|
||||
//choose first register
|
||||
HAL_GPIO_WritePin(GAIN_POT_MOSI.port, GAIN_POT_MOSI.pin, 0);
|
||||
HAL_GPIO_WritePin(GAIN_POT_SCLK.port, GAIN_POT_SCLK.pin, 0);
|
||||
HAL_GPIO_WritePin(GAIN_POT_SCLK.port, GAIN_POT_SCLK.pin, 1);
|
||||
HAL_GPIO_WritePin(FILTER_GAIN_POT_MOSI.port, FILTER_GAIN_POT_MOSI.pin, 0);
|
||||
HAL_GPIO_WritePin(FILTER_GAIN_POT_SCLK.port, FILTER_GAIN_POT_SCLK.pin, 0);
|
||||
HAL_GPIO_WritePin(FILTER_GAIN_POT_SCLK.port, FILTER_GAIN_POT_SCLK.pin, 1);
|
||||
|
||||
|
||||
for(i = 0; i < 8; i++)
|
||||
{
|
||||
HAL_GPIO_WritePin(GAIN_POT_MOSI.port, GAIN_POT_MOSI.pin, (a >> (7-i)) & 1);
|
||||
HAL_GPIO_WritePin(GAIN_POT_SCLK.port, GAIN_POT_SCLK.pin, 0);
|
||||
HAL_GPIO_WritePin(GAIN_POT_SCLK.port, GAIN_POT_SCLK.pin, 1);
|
||||
HAL_GPIO_WritePin(FILTER_GAIN_POT_MOSI.port, FILTER_GAIN_POT_MOSI.pin, (a >> (7-i)) & 1);
|
||||
HAL_GPIO_WritePin(FILTER_GAIN_POT_SCLK.port, FILTER_GAIN_POT_SCLK.pin, 0);
|
||||
HAL_GPIO_WritePin(FILTER_GAIN_POT_SCLK.port, FILTER_GAIN_POT_SCLK.pin, 1);
|
||||
}
|
||||
|
||||
HAL_GPIO_WritePin(GAIN_POT_NSS.port, GAIN_POT_NSS.pin, 1);
|
||||
|
@ -685,16 +685,16 @@ void setGainPot(uint8_t a, uint8_t b)
|
|||
HAL_GPIO_WritePin(GAIN_POT_NSS.port, GAIN_POT_NSS.pin, 0);
|
||||
|
||||
//choose second register
|
||||
HAL_GPIO_WritePin(GAIN_POT_MOSI.port, GAIN_POT_MOSI.pin, 1);
|
||||
HAL_GPIO_WritePin(GAIN_POT_SCLK.port, GAIN_POT_SCLK.pin, 0);
|
||||
HAL_GPIO_WritePin(GAIN_POT_SCLK.port, GAIN_POT_SCLK.pin, 1);
|
||||
HAL_GPIO_WritePin(FILTER_GAIN_POT_MOSI.port, FILTER_GAIN_POT_MOSI.pin, 1);
|
||||
HAL_GPIO_WritePin(FILTER_GAIN_POT_SCLK.port, FILTER_GAIN_POT_SCLK.pin, 0);
|
||||
HAL_GPIO_WritePin(FILTER_GAIN_POT_SCLK.port, FILTER_GAIN_POT_SCLK.pin, 1);
|
||||
|
||||
|
||||
for(i = 0; i < 8; i++)
|
||||
{
|
||||
HAL_GPIO_WritePin(GAIN_POT_MOSI.port, GAIN_POT_MOSI.pin, (b >> (7-i)) & 1);
|
||||
HAL_GPIO_WritePin(GAIN_POT_SCLK.port, GAIN_POT_SCLK.pin, 0);
|
||||
HAL_GPIO_WritePin(GAIN_POT_SCLK.port, GAIN_POT_SCLK.pin, 1);
|
||||
HAL_GPIO_WritePin(FILTER_GAIN_POT_MOSI.port, FILTER_GAIN_POT_MOSI.pin, (b >> (7-i)) & 1);
|
||||
HAL_GPIO_WritePin(FILTER_GAIN_POT_SCLK.port, FILTER_GAIN_POT_SCLK.pin, 0);
|
||||
HAL_GPIO_WritePin(FILTER_GAIN_POT_SCLK.port, FILTER_GAIN_POT_SCLK.pin, 1);
|
||||
}
|
||||
|
||||
HAL_GPIO_WritePin(GAIN_POT_NSS.port, GAIN_POT_NSS.pin, 1);
|
||||
|
@ -868,18 +868,18 @@ main(int argc, char* argv[])
|
|||
drawWaterfall();
|
||||
drawSMeter();
|
||||
|
||||
Adafruit_GFX_fillRect(310, 0, 3, 3, !HAL_GPIO_ReadPin(KEY1.port, KEY1.pin) ? ILI9340_RED : ILI9340_BLUE);
|
||||
Adafruit_GFX_fillRect(310, 4, 3, 3, !HAL_GPIO_ReadPin(KEY2.port, KEY2.pin) ? ILI9340_RED : ILI9340_BLUE);
|
||||
Adafruit_GFX_fillRect(310, 8, 3, 3, HAL_GPIO_ReadPin(TOUCH1.port, TOUCH1.pin) ? ILI9340_RED : ILI9340_BLUE);
|
||||
Adafruit_GFX_fillRect(310, 12, 3, 3, HAL_GPIO_ReadPin(TOUCH2.port, TOUCH2.pin) ? ILI9340_RED : ILI9340_BLUE);
|
||||
Adafruit_GFX_fillRect(310, 0, 3, 3, HAL_GPIO_ReadPin(PADDLE_THUMB_NC.port, PADDLE_THUMB_NC.pin) ? ILI9340_RED : ILI9340_BLUE);
|
||||
Adafruit_GFX_fillRect(310, 4, 3, 3, HAL_GPIO_ReadPin(PADDLE_INDEX_NC.port, PADDLE_INDEX_NC.pin) ? ILI9340_RED : ILI9340_BLUE);
|
||||
Adafruit_GFX_fillRect(310, 8, 3, 3, HAL_GPIO_ReadPin(PADDLE_THUMB_NO.port, PADDLE_THUMB_NO.pin) ? ILI9340_RED : ILI9340_BLUE);
|
||||
Adafruit_GFX_fillRect(310, 12, 3, 3, HAL_GPIO_ReadPin(PADDLE_INDEX_NO.port, PADDLE_INDEX_NO.pin) ? ILI9340_RED : ILI9340_BLUE);
|
||||
|
||||
if(HAL_GPIO_ReadPin(TOUCH1.port, TOUCH1.pin))
|
||||
if(!HAL_GPIO_ReadPin(PADDLE_THUMB_NO.port, PADDLE_THUMB_NO.pin))
|
||||
//if(1) //I am locking it in transmit for some testing.
|
||||
{
|
||||
transmitting = 1;
|
||||
HAL_GPIO_WritePin(DAC_MUX.port, DAC_MUX.pin, 1); //0 = speaker/earphone. 1=TX Drivers
|
||||
HAL_GPIO_WritePin(RX_MUX.port, RX_MUX.pin, 1); //Active Low
|
||||
HAL_GPIO_WritePin(TX_MUX.port, TX_MUX.pin, 0); //Active Low
|
||||
// HAL_GPIO_WritePin(RX_MUX.port, RX_MUX.pin, 1); //Active Low
|
||||
// HAL_GPIO_WritePin(TX_MUX.port, TX_MUX.pin, 0); //Active Low
|
||||
HAL_GPIO_WritePin(AMP_SWITCH_A.port, AMP_SWITCH_A.pin, 1); //Route through amp.
|
||||
HAL_GPIO_WritePin(AMP_SWITCH_B.port, AMP_SWITCH_B.pin, 0); //always reverse of above.
|
||||
HAL_GPIO_WritePin(AMP_POWER.port, AMP_POWER.pin, 0); //0 is on.
|
||||
|
@ -887,8 +887,8 @@ main(int argc, char* argv[])
|
|||
} else {
|
||||
transmitting = 0;
|
||||
HAL_GPIO_WritePin(DAC_MUX.port, DAC_MUX.pin, 0); //0 = speaker/earphone. 1=TX Drivers
|
||||
HAL_GPIO_WritePin(RX_MUX.port, RX_MUX.pin, 0); //Active Low
|
||||
HAL_GPIO_WritePin(TX_MUX.port, TX_MUX.pin, 1); //Active Low
|
||||
// HAL_GPIO_WritePin(RX_MUX.port, RX_MUX.pin, 0); //Active Low
|
||||
// HAL_GPIO_WritePin(TX_MUX.port, TX_MUX.pin, 1); //Active Low
|
||||
HAL_GPIO_WritePin(AMP_SWITCH_A.port, AMP_SWITCH_A.pin, 0); //Bypass amp.
|
||||
HAL_GPIO_WritePin(AMP_SWITCH_B.port, AMP_SWITCH_B.pin, 1); //always reverse of above.
|
||||
HAL_GPIO_WritePin(AMP_POWER.port, AMP_POWER.pin, 1); //1 is off.
|
||||
|
|
|
@ -22,28 +22,28 @@ void spi_init(void)
|
|||
__SPI1_CLK_ENABLE();
|
||||
|
||||
// SPI2 SCK and MOSI
|
||||
gpioInitStructure.Pin = SPI1_SCK.pin;
|
||||
gpioInitStructure.Pin = LCD_SCK.pin;
|
||||
gpioInitStructure.Speed = GPIO_SPEED_FAST;
|
||||
gpioInitStructure.Mode = GPIO_MODE_AF_PP;
|
||||
gpioInitStructure.Alternate = GPIO_AF5_SPI1;
|
||||
gpioInitStructure.Pull = GPIO_NOPULL;
|
||||
//gpioInitStructure.Alternate = 1;
|
||||
HAL_GPIO_Init(SPI1_SCK.port, &gpioInitStructure);
|
||||
HAL_GPIO_Init(LCD_SCK.port, &gpioInitStructure);
|
||||
|
||||
gpioInitStructure.Pin = SPI1_MOSI.pin;
|
||||
gpioInitStructure.Pin = LCD_MOSI.pin;
|
||||
gpioInitStructure.Speed = GPIO_SPEED_FAST;
|
||||
gpioInitStructure.Mode = GPIO_MODE_AF_PP;
|
||||
gpioInitStructure.Pull = GPIO_NOPULL;
|
||||
gpioInitStructure.Alternate = GPIO_AF5_SPI1;
|
||||
HAL_GPIO_Init(SPI1_MOSI.port, &gpioInitStructure);
|
||||
HAL_GPIO_Init(LCD_MOSI.port, &gpioInitStructure);
|
||||
|
||||
// SPI2 MISO
|
||||
gpioInitStructure.Pin = SPI1_MISO.pin;
|
||||
gpioInitStructure.Pin = LCD_MISO.pin;
|
||||
gpioInitStructure.Speed = GPIO_SPEED_FAST;
|
||||
gpioInitStructure.Mode = GPIO_MODE_INPUT;
|
||||
gpioInitStructure.Pull = GPIO_PULLUP;
|
||||
gpioInitStructure.Alternate = GPIO_AF5_SPI1;
|
||||
HAL_GPIO_Init(SPI1_MISO.port, &gpioInitStructure);
|
||||
HAL_GPIO_Init(LCD_MISO.port, &gpioInitStructure);
|
||||
|
||||
// RFID NSS
|
||||
gpioInitStructure.Pin = LCD_NSS.pin;
|
||||
|
|
Loading…
Reference in a new issue