Merge branch 'master' of github.com:jankae/VNA2
This commit is contained in:
commit
3becd19c0c
83
.github/workflows/Build.yml
vendored
83
.github/workflows/Build.yml
vendored
@ -18,24 +18,40 @@ jobs:
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libusb-1.0-0-dev qt5-default qt5-qmake qtbase5-dev
|
||||
|
||||
|
||||
- name: Get build timestamp
|
||||
id: id_date
|
||||
run: echo "::set-output name=timestamp::$(date +%Y-%m-%d-%H-%M-%S)"
|
||||
|
||||
- name: Get app version
|
||||
id: id_version
|
||||
run: |
|
||||
cd Software/PC_Application
|
||||
fw_major=`grep -oP '(?<=FW_MAJOR=)[0-9]+' LibreVNA-GUI.pro`
|
||||
fw_minor=`grep -oP '(?<=FW_MINOR=)[0-9]+' LibreVNA-GUI.pro`
|
||||
fw_patch=`grep -oP '(?<=FW_PATCH=)[0-9]+' LibreVNA-GUI.pro`
|
||||
echo "::set-output name=app_version::v$fw_major.$fw_minor.$fw_patch-${{steps.id_date.outputs.timestamp}}"
|
||||
|
||||
- name: Build application
|
||||
run: |
|
||||
cd Software/PC_Application
|
||||
qmake LibreVNA-GUI.pro
|
||||
make -j9
|
||||
shell: bash
|
||||
|
||||
|
||||
- name: Upload artifact
|
||||
env:
|
||||
LIBREVNA_VERSION: "${{steps.id_version.outputs.app_version}}"
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: GUI_Ubuntu
|
||||
name: LibreVNA-GUI-Ubuntu-${{env.LIBREVNA_VERSION}}
|
||||
path: Software/PC_Application/LibreVNA-GUI
|
||||
|
||||
PC_Application_Windows:
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- uses: msys2/setup-msys2@v2
|
||||
|
||||
- name: Install Qt
|
||||
uses: jurplel/install-qt-action@v2
|
||||
@ -51,6 +67,21 @@ jobs:
|
||||
Xcopy /E /I /Y libusb\MinGW64\static Software\PC_Application
|
||||
shell: cmd
|
||||
|
||||
- name: Get build timestamp
|
||||
shell: msys2 {0}
|
||||
id: id_date
|
||||
run: echo "::set-output name=timestamp::$(date +%Y-%m-%d-%H-%M-%S)"
|
||||
|
||||
- name: Get app version
|
||||
id: id_version
|
||||
shell: msys2 {0}
|
||||
run: |
|
||||
cd Software/PC_Application
|
||||
fw_major=`grep -oP '(?<=FW_MAJOR=)[0-9]+' LibreVNA-GUI.pro`
|
||||
fw_minor=`grep -oP '(?<=FW_MINOR=)[0-9]+' LibreVNA-GUI.pro`
|
||||
fw_patch=`grep -oP '(?<=FW_PATCH=)[0-9]+' LibreVNA-GUI.pro`
|
||||
echo "::set-output name=app_version::v$fw_major.$fw_minor.$fw_patch-${{steps.id_date.outputs.timestamp}}"
|
||||
|
||||
- name: Build application
|
||||
run: |
|
||||
cd Software/PC_Application
|
||||
@ -71,8 +102,10 @@ jobs:
|
||||
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v2
|
||||
env:
|
||||
LIBREVNA_VERSION: "${{steps.id_version.outputs.app_version}}"
|
||||
with:
|
||||
name: GUI_Windows
|
||||
name: GUI_Windows-${{env.LIBREVNA_VERSION}}
|
||||
path: Software/PC_Application/release
|
||||
|
||||
PC_Application_OSX:
|
||||
@ -88,6 +121,19 @@ jobs:
|
||||
run: |
|
||||
echo "/usr/local/opt/qt@5/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Get build timestamp
|
||||
id: id_date
|
||||
run: echo "::set-output name=timestamp::$(date +%Y-%m-%d-%H-%M-%S)"
|
||||
|
||||
- name: Get app version
|
||||
id: id_version
|
||||
run: |
|
||||
cd Software/PC_Application
|
||||
fw_major=`pcregrep -o '(?<=FW_MAJOR=)[0-9]+' LibreVNA-GUI.pro`
|
||||
fw_minor=`pcregrep -o '(?<=FW_MINOR=)[0-9]+' LibreVNA-GUI.pro`
|
||||
fw_patch=`pcregrep -o '(?<=FW_PATCH=)[0-9]+' LibreVNA-GUI.pro`
|
||||
echo "::set-output name=app_version::v$fw_major.$fw_minor.$fw_patch-${{steps.id_date.outputs.timestamp}}"
|
||||
|
||||
- name: Build application
|
||||
run: |
|
||||
cd Software/PC_Application
|
||||
@ -98,9 +144,11 @@ jobs:
|
||||
shell: bash
|
||||
|
||||
- name: Upload artifact
|
||||
env:
|
||||
LIBREVNA_VERSION: "${{steps.id_version.outputs.app_version}}"
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: GUI_OSX
|
||||
name: LibreVNA-GUI-OSX-${{env.LIBREVNA_VERSION}}
|
||||
path: Software/PC_Application/LibreVNA-GUI.zip
|
||||
|
||||
Embedded_Firmware:
|
||||
@ -111,7 +159,21 @@ jobs:
|
||||
- name: Install toolchain
|
||||
run: |
|
||||
sudo apt-get install -y gcc-arm-none-eabi binutils-arm-none-eabi
|
||||
|
||||
|
||||
- name: Get build timestamp
|
||||
id: id_date
|
||||
run: echo "::set-output name=timestamp::$(date +%Y-%m-%d-%H-%M-%S)"
|
||||
|
||||
- name: Get app version
|
||||
id: id_version
|
||||
run: |
|
||||
cd Software/VNA_embedded
|
||||
fw_major=`grep -oP '(?<=FW_MAJOR=)[0-9]+' Makefile`
|
||||
fw_minor=`grep -oP '(?<=FW_MINOR=)[0-9]+' Makefile`
|
||||
fw_patch=`grep -oP '(?<=FW_PATCH=)[0-9]+' Makefile`
|
||||
hw_revision=`grep "DHW_REVISION=" Makefile | sed "s/-DHW_REVISION=\"'//" | sed "sr'\" [\]rr"`
|
||||
echo "::set-output name=app_version::hw-rev-$hw_revision-v$fw_major.$fw_minor.$fw_patch-${{steps.id_date.outputs.timestamp}}"
|
||||
|
||||
- name: Build application
|
||||
run: |
|
||||
cd Software/VNA_embedded
|
||||
@ -123,12 +185,13 @@ jobs:
|
||||
run: |
|
||||
python3 AssembleFirmware.py
|
||||
shell: bash
|
||||
|
||||
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v2
|
||||
env:
|
||||
LIBREVNA_VERSION: "${{steps.id_version.outputs.app_version}}"
|
||||
with:
|
||||
name: EmbeddedFirmware
|
||||
name: EmbeddedFirmware-${{env.LIBREVNA_VERSION}}
|
||||
path: |
|
||||
VNA_embedded.elf
|
||||
combined.vnafw
|
||||
|
||||
combined.vnafw
|
222
.github/workflows/Release_tag_stable.yml
vendored
Normal file
222
.github/workflows/Release_tag_stable.yml
vendored
Normal file
@ -0,0 +1,222 @@
|
||||
name: Upload release for tag stable
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v[0-9]+.[0-9]+.[0-9]+'
|
||||
|
||||
jobs:
|
||||
|
||||
PC_Application_Ubuntu:
|
||||
runs-on: ubuntu-18.04
|
||||
outputs:
|
||||
upload_url: ${{ steps.bump_release.outputs.upload_url }}
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libusb-1.0-0-dev qt5-default qt5-qmake qtbase5-dev zip
|
||||
|
||||
- name: Get app version
|
||||
id: id_version
|
||||
run: |
|
||||
cd Software/PC_Application
|
||||
fw_major=`grep -oP '(?<=FW_MAJOR=)[0-9]+' LibreVNA-GUI.pro`
|
||||
fw_minor=`grep -oP '(?<=FW_MINOR=)[0-9]+' LibreVNA-GUI.pro`
|
||||
fw_patch=`grep -oP '(?<=FW_PATCH=)[0-9]+' LibreVNA-GUI.pro`
|
||||
echo "::set-output name=app_version::v$fw_major.$fw_minor.$fw_patch"
|
||||
|
||||
- name: Build application
|
||||
run: |
|
||||
cd Software/PC_Application
|
||||
qmake LibreVNA-GUI.pro
|
||||
make -j9
|
||||
zip LibreVNA-GUI.zip LibreVNA-GUI
|
||||
shell: bash
|
||||
|
||||
- name: Bump release page
|
||||
id: bump_release
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
LIBREVNA_VERSION: "${{steps.id_version.outputs.app_version}}"
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{env.LIBREVNA_VERSION}}
|
||||
release_name: ${{env.LIBREVNA_VERSION}}
|
||||
body: |
|
||||
See [CHANGELOG](https://github.com/${{github.repository}}/blob/${{env.LIBREVNA_VERSION}}/CHANGELOG.md) for more information.
|
||||
draft: false
|
||||
prerelease: false
|
||||
|
||||
- name: 'Upload release asset'
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
LIBREVNA_VERSION: "${{steps.id_version.outputs.app_version}}"
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.bump_release.outputs.upload_url }}
|
||||
asset_path: ./Software/PC_Application/LibreVNA-GUI.zip
|
||||
asset_name: LibreVNA-GUI-Ubuntu-${{env.LIBREVNA_VERSION}}.zip
|
||||
asset_content_type: application/tar+gzip
|
||||
|
||||
PC_Application_Windows:
|
||||
needs: PC_Application_Ubuntu
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- uses: msys2/setup-msys2@v2
|
||||
|
||||
- name: Install Qt
|
||||
uses: jurplel/install-qt-action@v2
|
||||
with:
|
||||
version: '5.15.1'
|
||||
arch: 'win64_mingw81'
|
||||
|
||||
- name: Download libusb
|
||||
run: |
|
||||
curl -o libusb.7z -L https://github.com/libusb/libusb/releases/download/v1.0.23/libusb-1.0.23.7z
|
||||
7z x libusb.7z -r -olibusb
|
||||
Xcopy /E /I /Y libusb\include ..\Qt\5.15.1\mingw81_64\include
|
||||
Xcopy /E /I /Y libusb\MinGW64\static Software\PC_Application
|
||||
shell: cmd
|
||||
|
||||
- name: Get app version
|
||||
id: id_version
|
||||
shell: msys2 {0}
|
||||
run: |
|
||||
cd Software/PC_Application
|
||||
fw_major=`grep -oP '(?<=FW_MAJOR=)[0-9]+' LibreVNA-GUI.pro`
|
||||
fw_minor=`grep -oP '(?<=FW_MINOR=)[0-9]+' LibreVNA-GUI.pro`
|
||||
fw_patch=`grep -oP '(?<=FW_PATCH=)[0-9]+' LibreVNA-GUI.pro`
|
||||
echo "::set-output name=app_version::v$fw_major.$fw_minor.$fw_patch"
|
||||
|
||||
- name: Build application
|
||||
run: |
|
||||
cd Software/PC_Application
|
||||
qmake LibreVNA-GUI.pro
|
||||
make -j9
|
||||
shell: cmd
|
||||
|
||||
- name: Deploy application
|
||||
run: |
|
||||
cd Software/PC_Application/release
|
||||
del *.o *.cpp
|
||||
windeployqt.exe .
|
||||
copy ..\..\..\..\Qt\5.15.1\mingw81_64\bin\libwinpthread-1.dll .
|
||||
copy ..\..\..\..\Qt\5.15.1\mingw81_64\bin\libgcc_s_seh-1.dll .
|
||||
copy "..\..\..\..\Qt\5.15.1\mingw81_64\bin\libstdc++-6.dll" .
|
||||
copy ..\..\..\..\Qt\5.15.1\mingw81_64\bin\Qt5OpenGL.dll .
|
||||
shell: cmd
|
||||
|
||||
- name: Zip app
|
||||
shell: cmd
|
||||
env:
|
||||
LIBREVNA_VERSION: "${{steps.id_version.outputs.app_version}}"
|
||||
run: |
|
||||
7z a LibreVNA-GUI_Windows-${{env.LIBREVNA_VERSION}}.zip ./Software/PC_Application/release
|
||||
|
||||
- name: 'Upload release asset'
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
LIBREVNA_VERSION: "${{steps.id_version.outputs.app_version}}"
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ needs.PC_Application_Ubuntu.outputs.upload_url }}
|
||||
asset_path: ./LibreVNA-GUI_Windows-${{env.LIBREVNA_VERSION}}.zip
|
||||
asset_name: LibreVNA-GUI_Windows-${{env.LIBREVNA_VERSION}}.zip
|
||||
asset_content_type: application/tar+gzip
|
||||
|
||||
PC_Application_OSX:
|
||||
needs: PC_Application_Ubuntu
|
||||
runs-on: macos-10.15
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
brew install qt@5 libusb
|
||||
|
||||
- name: Set Environment
|
||||
run: |
|
||||
echo "/usr/local/opt/qt@5/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Get app version
|
||||
id: id_version
|
||||
run: |
|
||||
cd Software/PC_Application
|
||||
fw_major=`pcregrep -o '(?<=FW_MAJOR=)[0-9]+' LibreVNA-GUI.pro`
|
||||
fw_minor=`pcregrep -o '(?<=FW_MINOR=)[0-9]+' LibreVNA-GUI.pro`
|
||||
fw_patch=`pcregrep -o '(?<=FW_PATCH=)[0-9]+' LibreVNA-GUI.pro`
|
||||
echo "::set-output name=app_version::v$fw_major.$fw_minor.$fw_patch"
|
||||
|
||||
- name: Build application
|
||||
run: |
|
||||
cd Software/PC_Application
|
||||
qmake LibreVNA-GUI.pro
|
||||
make -j9
|
||||
macdeployqt LibreVNA-GUI.app
|
||||
zip -ry LibreVNA-GUI.zip LibreVNA-GUI.app
|
||||
shell: bash
|
||||
|
||||
- name: 'Upload release asset'
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
LIBREVNA_VERSION: "${{steps.id_version.outputs.app_version}}"
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ needs.PC_Application_Ubuntu.outputs.upload_url }}
|
||||
asset_path: ./Software/PC_Application/LibreVNA-GUI.zip
|
||||
asset_name: LibreVNA-GUI-OSX-${{env.LIBREVNA_VERSION}}.zip
|
||||
asset_content_type: application/tar+gzip
|
||||
|
||||
Embedded_Firmware:
|
||||
needs: PC_Application_Ubuntu
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
|
||||
- name: Install toolchain
|
||||
run: |
|
||||
sudo apt-get install -y gcc-arm-none-eabi binutils-arm-none-eabi
|
||||
|
||||
- name: Get app version
|
||||
id: id_version
|
||||
run: |
|
||||
cd Software/VNA_embedded
|
||||
fw_major=`grep -oP '(?<=FW_MAJOR=)[0-9]+' Makefile`
|
||||
fw_minor=`grep -oP '(?<=FW_MINOR=)[0-9]+' Makefile`
|
||||
fw_patch=`grep -oP '(?<=FW_PATCH=)[0-9]+' Makefile`
|
||||
hw_revision=`grep "DHW_REVISION=" Makefile | sed "s/-DHW_REVISION=\"'//" | sed "sr'\" [\]rr"`
|
||||
echo "::set-output name=app_version::hw-rev-$hw_revision-v$fw_major.$fw_minor.$fw_patch"
|
||||
|
||||
- name: Build application
|
||||
run: |
|
||||
cd Software/VNA_embedded
|
||||
make -j9
|
||||
cp build/VNA_embedded.elf ../../
|
||||
shell: bash
|
||||
|
||||
- name: Combine with FPGA bitstream
|
||||
run: |
|
||||
python3 AssembleFirmware.py
|
||||
shell: bash
|
||||
|
||||
- name: Zip firmware
|
||||
env:
|
||||
LIBREVNA_VERSION: "${{steps.id_version.outputs.app_version}}"
|
||||
run: |
|
||||
zip EmbeddedFirmware-${{env.LIBREVNA_VERSION}}.zip VNA_embedded.elf combined.vnafw
|
||||
shell: bash
|
||||
|
||||
- name: 'Upload release asset'
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
LIBREVNA_VERSION: "${{steps.id_version.outputs.app_version}}"
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ needs.PC_Application_Ubuntu.outputs.upload_url }}
|
||||
asset_path: ./EmbeddedFirmware-${{env.LIBREVNA_VERSION}}.zip
|
||||
asset_name: EmbeddedFirmware-${{env.LIBREVNA_VERSION}}.zip
|
||||
asset_content_type: application/tar+gzip
|
8
CHANGELOG.md
Normal file
8
CHANGELOG.md
Normal file
@ -0,0 +1,8 @@
|
||||
# Changelog
|
||||
|
||||
## v1.1.2
|
||||
|
||||
- Software:
|
||||
- Fix parsing of calibration kit settings
|
||||
|
||||
No changes have been made to the embedded software, updating the firmware on the LibreVNA is not required.
|
@ -27,6 +27,7 @@
|
||||
static Protocol::PacketInfo recv_packet;
|
||||
static Protocol::PacketInfo last_measure_packet; // contains the command that started the last measured (replay in case of timeout)
|
||||
static TaskHandle_t handle;
|
||||
static bool sweepActive;
|
||||
|
||||
#if HW_REVISION >= 'B'
|
||||
// has MCU controllable flash chip, firmware update supported
|
||||
@ -45,7 +46,7 @@ static void USBPacketReceived(const Protocol::PacketInfo &p) {
|
||||
portYIELD_FROM_ISR(woken);
|
||||
}
|
||||
|
||||
void App_Start() {
|
||||
inline void App_Init() {
|
||||
STM::Init();
|
||||
HAL_ADCEx_Calibration_Start(&hadc1, ADC_SINGLE_ENDED);
|
||||
handle = xTaskGetCurrentTaskHandle();
|
||||
@ -98,10 +99,13 @@ void App_Start() {
|
||||
USB_EN_GPIO_Port->BSRR = USB_EN_Pin;
|
||||
#endif
|
||||
|
||||
bool sweepActive = false;
|
||||
|
||||
LED::Off();
|
||||
while (1) {
|
||||
|
||||
sweepActive = false;
|
||||
}
|
||||
|
||||
inline void App_Process() {
|
||||
while(1) {
|
||||
uint32_t notification;
|
||||
if(xTaskNotifyWait(0x00, UINT32_MAX, ¬ification, 100) == pdPASS) {
|
||||
// something happened
|
||||
@ -153,7 +157,7 @@ void App_Start() {
|
||||
sweepActive = false;
|
||||
Communication::SendWithoutPayload(Protocol::PacketType::Ack);
|
||||
break;
|
||||
#ifdef HAS_FLASH
|
||||
#ifdef HAS_FLASH
|
||||
case Protocol::PacketType::ClearFlash:
|
||||
HW::SetMode(HW::Mode::Idle);
|
||||
sweepActive = false;
|
||||
@ -188,7 +192,7 @@ void App_Start() {
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
case Protocol::PacketType::RequestSourceCal:
|
||||
Communication::SendWithoutPayload(Protocol::PacketType::Ack);
|
||||
Cal::SendSource();
|
||||
@ -232,3 +236,8 @@ void App_Start() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void App_Start() {
|
||||
App_Init();
|
||||
App_Process();
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ bool Flash::isPresent() {
|
||||
HAL_SPI_TransmitReceive(spi, send, recv, 4, 100);
|
||||
CS(true);
|
||||
// Check against valid manufacturer IDs
|
||||
constexpr uint8_t valid_ids[] = {0xEF, 0x68};
|
||||
constexpr uint8_t valid_ids[] = {0xEF, 0x68, 0x9D};
|
||||
bool valid = false;
|
||||
for (uint8_t i = 0; i < sizeof(valid_ids); i++) {
|
||||
if (recv[1] == valid_ids[i]) {
|
||||
|
@ -75,7 +75,7 @@ void HW::Work() {
|
||||
}
|
||||
|
||||
bool HW::Init() {
|
||||
#ifdef USE_DEBUG_PINS
|
||||
#if USE_DEBUG_PINS
|
||||
// initialize debug pins
|
||||
GPIO_InitTypeDef gpio;
|
||||
gpio.Pin = DEBUG1_PIN;
|
||||
|
@ -7,9 +7,9 @@
|
||||
#include "max2871.hpp"
|
||||
#include "Si5351C.hpp"
|
||||
|
||||
#define USE_DEBUG_PINS
|
||||
#define USE_DEBUG_PINS 0
|
||||
|
||||
#ifdef USE_DEBUG_PINS
|
||||
#if USE_DEBUG_PINS
|
||||
#define DEBUG1_GPIO GPIOA
|
||||
#define DEBUG1_PIN GPIO_PIN_13
|
||||
#define DEBUG2_GPIO GPIOA
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#if HW_REVISION == 'B'
|
||||
|
||||
#define LED_TASK_STACK 128
|
||||
#define LED_STATUS_TASK_STACK_SIZE_WORDS 128
|
||||
|
||||
extern TIM_HandleTypeDef htim2;
|
||||
|
||||
@ -21,9 +21,11 @@ enum class Mode {
|
||||
static Mode mode;
|
||||
static uint8_t led_statecnt;
|
||||
static int8_t led_ncnt;
|
||||
static xTaskHandle task;
|
||||
static StaticTask_t xTask;
|
||||
static StackType_t xStack[LED_TASK_STACK];
|
||||
|
||||
static StackType_t LedStatusStack[LED_STATUS_TASK_STACK_SIZE_WORDS];
|
||||
static StaticTask_t LedStatusCB;
|
||||
static xTaskHandle LedStatusHandle = NULL;
|
||||
|
||||
static uint8_t err_cnt;
|
||||
|
||||
static void led_set_percentage(uint8_t val) {
|
||||
@ -31,8 +33,8 @@ static void led_set_percentage(uint8_t val) {
|
||||
TIM2->CCR1 = compare;
|
||||
}
|
||||
|
||||
static void led_task(void* unused) {
|
||||
UNUSED(unused);
|
||||
static void LedStatus(void * const argument) {
|
||||
UNUSED(argument);
|
||||
while (1) {
|
||||
if (led_statecnt < 199) {
|
||||
led_statecnt++;
|
||||
@ -88,9 +90,10 @@ void LED::Init() {
|
||||
HAL_TIM_Base_Start(&htim2);
|
||||
HAL_TIM_PWM_Start(&htim2, TIM_CHANNEL_1);
|
||||
|
||||
task = xTaskCreateStatic(led_task, "LED",
|
||||
LED_TASK_STACK, NULL, 6, xStack, &xTask);
|
||||
vTaskSuspend(task);
|
||||
LedStatusHandle = xTaskCreateStatic(LedStatus, "LedStatusTask", LED_STATUS_TASK_STACK_SIZE_WORDS,
|
||||
NULL, 6, LedStatusStack, &LedStatusCB);
|
||||
|
||||
vTaskSuspend(LedStatusHandle);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -99,9 +102,9 @@ void LED::Pulsating() {
|
||||
if(led_ncnt) {
|
||||
return;
|
||||
}
|
||||
vTaskSuspend(task);
|
||||
vTaskSuspend(LedStatusHandle);
|
||||
mode = Mode::Pulsating;
|
||||
vTaskResume(task);
|
||||
vTaskResume(LedStatusHandle);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -110,9 +113,9 @@ void LED::Off() {
|
||||
if(led_ncnt) {
|
||||
return;
|
||||
}
|
||||
vTaskSuspend(task);
|
||||
vTaskSuspend(LedStatusHandle);
|
||||
mode = Mode::Off;
|
||||
vTaskResume(task);
|
||||
vTaskResume(LedStatusHandle);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -121,11 +124,11 @@ void LED::Error(uint8_t code) {
|
||||
if(led_ncnt) {
|
||||
return;
|
||||
}
|
||||
vTaskSuspend(task);
|
||||
vTaskSuspend(LedStatusHandle);
|
||||
mode = Mode::Error;
|
||||
led_statecnt = 0;
|
||||
err_cnt = 0;
|
||||
led_ncnt = code;
|
||||
vTaskResume(task);
|
||||
vTaskResume(LedStatusHandle);
|
||||
#endif
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user