fix: conversion errors
This commit is contained in:
parent
c1d0166c44
commit
0a5bcc9e02
2
Makefile
2
Makefile
@ -8,7 +8,7 @@ SOURCES = main.c src/*.c
|
||||
|
||||
# 编译选项
|
||||
CFLAGS ?= -W -Wall -Wextra -Werror -Wundef -Wshadow -Wdouble-promotion \
|
||||
-Wformat-truncation -fno-common -Wconversion \
|
||||
-Wformat-truncation -fno-common \
|
||||
-g3 -Og -ffunction-sections -fdata-sections \
|
||||
-Iinclude -mcpu=cortex-m0plus -mthumb -lm $(EXTRA_CFLAGS)
|
||||
LDFLAGS ?= -T $(DEPS_DIR)/link.ld -nostartfiles -nostdlib --specs nano.specs \
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "inttypes.h"
|
||||
#include <inttypes.h>
|
||||
|
||||
#define q15_t int16_t
|
||||
#define q31_t int32_t
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "inttypes.h"
|
||||
#include <inttypes.h>
|
||||
|
||||
#define float32_t float
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
#include "fft/fft.h"
|
||||
#include "fft/table.h"
|
||||
#include "inttypes.h"
|
||||
#include "math.h"
|
||||
#include "stdlib.h"
|
||||
#include <inttypes.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define N 1024
|
||||
#define Re(x) 2 * x
|
||||
|
14
src/sstv.c
14
src/sstv.c
@ -3,7 +3,8 @@
|
||||
#include "fft/table.h"
|
||||
#include "math.h"
|
||||
#include "sstv.h"
|
||||
#include "stdio.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static q15_t data[N];
|
||||
static q15_t buffer[MN];
|
||||
@ -26,7 +27,8 @@ static void read_data(q15_t* pSrc, uint16_t len) {
|
||||
}
|
||||
|
||||
static uint16_t find_peak(uint16_t L, uint16_t R) {
|
||||
uint16_t index = 0, peak = 0;
|
||||
q15_t peak = 0;
|
||||
uint16_t index = 0;
|
||||
for (uint16_t i = L; i <= R; i++)
|
||||
if (data[i] > peak) {
|
||||
index = i;
|
||||
@ -38,9 +40,9 @@ static uint16_t find_peak(uint16_t L, uint16_t R) {
|
||||
static void hanning(uint16_t len) {
|
||||
for (uint16_t i = len; i < N; i++) data[i] = 0;
|
||||
if (len == 160)
|
||||
for (uint16_t i = 0; i < len; i++) data[i] = ((q31_t)data[i] * hanning_160[i]) >> 15;
|
||||
for (uint16_t i = 0; i < len; i++) data[i] = (q15_t)(((q31_t)data[i] * hanning_160[i]) >> 15);
|
||||
else
|
||||
for (uint16_t i = 0; i < len; i++) data[i] = ((q31_t)data[i] * hanning_17[i]) >> 15;
|
||||
for (uint16_t i = 0; i < len; i++) data[i] = (q15_t)(((q31_t)data[i] * hanning_17[i]) >> 15);
|
||||
}
|
||||
|
||||
static uint32_t cSample = 0;
|
||||
@ -109,7 +111,7 @@ static uint8_t read_mode() {
|
||||
if (abs(fre - FREQ_BIT1) < 80) cBit1++;
|
||||
else if (abs(fre - FREQ_BIT0) > 80) {
|
||||
printf("Error VIS BIT: %d\r\n", fre);
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (i % 3 == 2) {
|
||||
@ -126,7 +128,7 @@ static uint8_t read_mode() {
|
||||
|
||||
if (!cParity) {
|
||||
printf("Error Parity Check: %d\r\n", mode);
|
||||
return -2;
|
||||
return 0;
|
||||
}
|
||||
read_data(pData, len * 3);
|
||||
return mode;
|
||||
|
Loading…
Reference in New Issue
Block a user