add ui, change project struct
This commit is contained in:
parent
5f59f9412a
commit
df4db6d8c4
10
.gitignore
vendored
10
.gitignore
vendored
@ -1,7 +1,7 @@
|
|||||||
build
|
build
|
||||||
__pycache__
|
__pycache__
|
||||||
tools/img/*.png
|
tools/**/*.png
|
||||||
tools/img/*.psd
|
tools/**/*.psd
|
||||||
tools/img/*.jpg
|
tools/**/*.jpg
|
||||||
tools/img/*.c
|
tools/**/*.c
|
||||||
tools/img/*.h
|
tools/**/*.h
|
||||||
|
40
.vscode/tasks.json
vendored
40
.vscode/tasks.json
vendored
@ -2,32 +2,32 @@
|
|||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"tasks": [
|
"tasks": [
|
||||||
{
|
{
|
||||||
"type": "cppbuild",
|
"type": "shell",
|
||||||
"label": "C/C++: arm-none-eabi-gcc 生成活动文件",
|
"label": "GNUMake Build",
|
||||||
"command": "/usr/bin/arm-none-eabi-gcc",
|
"detail": "编译项目",
|
||||||
"args": [
|
"command": "make",
|
||||||
"-fdiagnostics-color=always",
|
"args": [],
|
||||||
"-g",
|
|
||||||
"${file}",
|
|
||||||
"-o",
|
|
||||||
"${fileDirname}/${fileBasenameNoExtension}",
|
|
||||||
"-ICore/Inc \\",
|
|
||||||
"-IDrivers/STM32G0xx_HAL_Driver/Inc \\",
|
|
||||||
"-IDrivers/STM32G0xx_HAL_Driver/Inc/Legacy \\",
|
|
||||||
"-IDrivers/CMSIS/Device/ST/STM32G0xx/Include \\",
|
|
||||||
"-IDrivers/CMSIS/Include"
|
|
||||||
],
|
|
||||||
"options": {
|
"options": {
|
||||||
"cwd": "${fileDirname}"
|
"cwd": "${workspaceFolder}"
|
||||||
},
|
},
|
||||||
"problemMatcher": [
|
|
||||||
"$gcc"
|
|
||||||
],
|
|
||||||
"group": {
|
"group": {
|
||||||
"kind": "build",
|
"kind": "build",
|
||||||
"isDefault": true
|
"isDefault": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "shell",
|
||||||
|
"label": "GNUMake Build Flash Run",
|
||||||
|
"detail": "编译烧录并运行项目",
|
||||||
|
"command": "make && make flash",
|
||||||
|
"args": [],
|
||||||
|
"options": {
|
||||||
|
"cwd": "${workspaceFolder}"
|
||||||
},
|
},
|
||||||
"detail": "编译器: /usr/bin/arm-none-eabi-gcc"
|
"group": {
|
||||||
|
"kind": "test",
|
||||||
|
"isDefault": true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
388
Core/APP/app.c
388
Core/APP/app.c
@ -1,388 +0,0 @@
|
|||||||
#include <app.h>
|
|
||||||
#include <main.h>
|
|
||||||
#include <st7735.h>
|
|
||||||
#include <RotaryCoder.h>
|
|
||||||
#include <KT0915.h>
|
|
||||||
|
|
||||||
/*Arduino APP 未移植 不可用*/
|
|
||||||
uint8_t app_setup(void){
|
|
||||||
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
Shows the static content on display
|
|
||||||
*/
|
|
||||||
void showTemplate()
|
|
||||||
{
|
|
||||||
|
|
||||||
int maxX1 = tft.width() - 2;
|
|
||||||
int maxY1 = tft.height() - 5;
|
|
||||||
|
|
||||||
tft.fillScreen(COLOR_BLACK);
|
|
||||||
|
|
||||||
tft.drawRect(2, 2, maxX1, maxY1, COLOR_YELLOW);
|
|
||||||
tft.drawLine(2, 40, maxX1, 40, COLOR_YELLOW);
|
|
||||||
tft.drawLine(2, 60, maxX1, 60, COLOR_YELLOW);
|
|
||||||
}
|
|
||||||
|
|
||||||
void clearStatus()
|
|
||||||
{
|
|
||||||
|
|
||||||
char *unit;
|
|
||||||
char *bandMode;
|
|
||||||
|
|
||||||
int maxX1 = tft.width() - 6;
|
|
||||||
int maxY1 = tft.height() - 6;
|
|
||||||
|
|
||||||
tft.fillRect(3, 3, maxX1, 35, COLOR_BLACK);
|
|
||||||
// tft.fillRect(3,61,maxX1, maxY1 - 61, COLOR_BLACK);
|
|
||||||
|
|
||||||
if (band[bandIdx].mode == MODE_FM)
|
|
||||||
{
|
|
||||||
unit = (char *)"MHz";
|
|
||||||
bandMode = (char *)"FM";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
unit = (char *)"KHz";
|
|
||||||
bandMode = (char *)"AM";
|
|
||||||
}
|
|
||||||
tft.setFont(&Serif_plain_7);
|
|
||||||
printValue(135, 15, oldMode, bandMode, 7, COLOR_YELLOW);
|
|
||||||
printValue(135, 36, oldUnit, unit, 7, COLOR_YELLOW);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
Prevents blinking during the frequency display.
|
|
||||||
Erases the old digits if it has changed and print the new digit values.
|
|
||||||
*/
|
|
||||||
void printValue(int col, int line, char *oldValue, char *newValue, uint8_t space, uint16_t color)
|
|
||||||
{
|
|
||||||
int c = col;
|
|
||||||
char *pOld;
|
|
||||||
char *pNew;
|
|
||||||
|
|
||||||
pOld = oldValue;
|
|
||||||
pNew = newValue;
|
|
||||||
|
|
||||||
// prints just changed digits
|
|
||||||
while (*pOld && *pNew)
|
|
||||||
{
|
|
||||||
if (*pOld != *pNew)
|
|
||||||
{
|
|
||||||
// Erases olde value
|
|
||||||
tft.setTextColor(COLOR_BLACK);
|
|
||||||
tft.setCursor(c, line);
|
|
||||||
tft.print(*pOld);
|
|
||||||
// Writes new value
|
|
||||||
tft.setTextColor(color);
|
|
||||||
tft.setCursor(c, line);
|
|
||||||
tft.print(*pNew);
|
|
||||||
}
|
|
||||||
pOld++;
|
|
||||||
pNew++;
|
|
||||||
c += space;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Is there anything else to erase?
|
|
||||||
tft.setTextColor(COLOR_BLACK);
|
|
||||||
while (*pOld)
|
|
||||||
{
|
|
||||||
tft.setCursor(c, line);
|
|
||||||
tft.print(*pOld);
|
|
||||||
pOld++;
|
|
||||||
c += space;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Is there anything else to print?
|
|
||||||
tft.setTextColor(color);
|
|
||||||
while (*pNew)
|
|
||||||
{
|
|
||||||
tft.setCursor(c, line);
|
|
||||||
tft.print(*pNew);
|
|
||||||
pNew++;
|
|
||||||
c += space;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Save the current content to be tested next time
|
|
||||||
strcpy(oldValue, newValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
Shows frequency information on Display
|
|
||||||
*/
|
|
||||||
void showFrequency()
|
|
||||||
{
|
|
||||||
char freq[15];
|
|
||||||
char aux[15];
|
|
||||||
|
|
||||||
currentFrequency = rx.getFrequency();
|
|
||||||
|
|
||||||
// Serial.println(currentFrequency);
|
|
||||||
|
|
||||||
tft.setFont(&DSEG7_Classic_Mini_Regular_30);
|
|
||||||
tft.setTextSize(1);
|
|
||||||
|
|
||||||
if (band[bandIdx].mode == MODE_FM) // FM
|
|
||||||
{
|
|
||||||
sprintf(aux, "%6.6lu", currentFrequency);
|
|
||||||
freq[0] = aux[0];
|
|
||||||
freq[1] = aux[1];
|
|
||||||
freq[2] = aux[2];
|
|
||||||
freq[3] = '\0';
|
|
||||||
freq[4] = aux[3];
|
|
||||||
freq[5] = aux[4];
|
|
||||||
freq[6] = '\0';
|
|
||||||
|
|
||||||
printValue(2, 36, &oldFreq[0], &freq[0], 23, COLOR_RED);
|
|
||||||
printValue(82, 36, &oldFreq[4], &freq[4], 23, COLOR_RED);
|
|
||||||
tft.setCursor(80, 35);
|
|
||||||
tft.print('.');
|
|
||||||
}
|
|
||||||
else // AM
|
|
||||||
{
|
|
||||||
sprintf(aux, "%5lu", currentFrequency);
|
|
||||||
freq[0] = aux[0];
|
|
||||||
freq[1] = aux[1];
|
|
||||||
freq[2] = aux[2];
|
|
||||||
freq[3] = aux[3];
|
|
||||||
freq[4] = aux[4];
|
|
||||||
freq[5] = '\0';
|
|
||||||
printValue(2, 36, &oldFreq[0], &freq[0], 23, COLOR_RED);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
Show some basic information on display
|
|
||||||
*/
|
|
||||||
void showStatus()
|
|
||||||
{
|
|
||||||
resetBuffer();
|
|
||||||
clearStatus();
|
|
||||||
showFrequency();
|
|
||||||
showVolume();
|
|
||||||
showBandwidth();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* *******************************
|
|
||||||
Shows RSSI status
|
|
||||||
*/
|
|
||||||
void showRSSI()
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
char rssi[15];
|
|
||||||
|
|
||||||
// Check AM or FM
|
|
||||||
sprintf(rssi, "%3.3udBuV", (band[bandIdx].mode == MODE_FM)? rx.getFmRssi():rx.getAmRssi());
|
|
||||||
tft.setFont(&Serif_plain_14);
|
|
||||||
tft.setTextSize(1);
|
|
||||||
printValue(5, 55, oldRssi, rssi, 11, COLOR_WHITE);
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
void showBandwidth()
|
|
||||||
{
|
|
||||||
char sBw[15];
|
|
||||||
|
|
||||||
if (band[bandIdx].mode != MODE_AM)
|
|
||||||
return;
|
|
||||||
|
|
||||||
sprintf(sBw, "%cKHz", am_bw[bwIdx]);
|
|
||||||
|
|
||||||
tft.setFont(&Serif_plain_14);
|
|
||||||
tft.setTextSize(1);
|
|
||||||
printValue(5, 80, oldBW, sBw, 11, COLOR_WHITE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void showStereo()
|
|
||||||
{
|
|
||||||
// char stereo[10];
|
|
||||||
// sprintf(stereo, "%s", (rx.isFmStereo()) ? "St" : "Mo");
|
|
||||||
// tft.setFont(&Serif_plain_14);
|
|
||||||
// tft.setTextSize(1);
|
|
||||||
// printValue(125, 55, oldStereo, stereo, 15, COLOR_WHITE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
Shows the volume level on LCD
|
|
||||||
*/
|
|
||||||
void showVolume()
|
|
||||||
{
|
|
||||||
// char sVolume[15];
|
|
||||||
// sprintf(sVolume, "Vol: %2.2u", rx.getVolume());
|
|
||||||
// printValue(80, 56, oldVolume, sVolume, 6, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*********************************************************
|
|
||||||
|
|
||||||
*********************************************************/
|
|
||||||
|
|
||||||
void showSplash()
|
|
||||||
{
|
|
||||||
// Splash
|
|
||||||
tft.setFont(&Serif_plain_14);
|
|
||||||
tft.setTextSize(1);
|
|
||||||
tft.setTextColor(COLOR_YELLOW);
|
|
||||||
tft.setCursor(45, 23);
|
|
||||||
tft.print("KT0915");
|
|
||||||
tft.setCursor(15, 50);
|
|
||||||
tft.print("Arduino Library");
|
|
||||||
tft.setCursor(25, 80);
|
|
||||||
tft.print("By PU2CLR");
|
|
||||||
tft.setFont(&Serif_plain_14);
|
|
||||||
tft.setTextSize(0);
|
|
||||||
tft.setCursor(12, 110);
|
|
||||||
tft.print("Ricardo L. Caratti");
|
|
||||||
delay(4000);
|
|
||||||
}
|
|
||||||
|
|
||||||
void bandUp()
|
|
||||||
{
|
|
||||||
// save the current frequency for the band
|
|
||||||
band[bandIdx].default_frequency = currentFrequency;
|
|
||||||
|
|
||||||
if (bandIdx < lastBand)
|
|
||||||
{
|
|
||||||
bandIdx++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
bandIdx = 0;
|
|
||||||
}
|
|
||||||
useBand();
|
|
||||||
}
|
|
||||||
|
|
||||||
void bandDown()
|
|
||||||
{
|
|
||||||
// save the current frequency for the band
|
|
||||||
band[bandIdx].default_frequency = currentFrequency;
|
|
||||||
|
|
||||||
if (bandIdx > 0)
|
|
||||||
{
|
|
||||||
bandIdx--;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
bandIdx = lastBand;
|
|
||||||
}
|
|
||||||
useBand();
|
|
||||||
}
|
|
||||||
|
|
||||||
void useBand()
|
|
||||||
{
|
|
||||||
|
|
||||||
if (band[bandIdx].mode == MODE_FM)
|
|
||||||
{
|
|
||||||
rx.setFM(band[bandIdx].minimum_frequency, band[bandIdx].maximum_frequency, band[bandIdx].default_frequency, band[bandIdx].step);
|
|
||||||
rx.setDeEmphasis(DE_EMPHASIS_75);
|
|
||||||
// rx.setSoftMute(TURN_OFF);
|
|
||||||
rx.setFmAfc(TURN_ON);
|
|
||||||
rx.setMono(TURN_OFF); // Force stereo
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
rx.setAM(band[bandIdx].minimum_frequency, band[bandIdx].maximum_frequency, band[bandIdx].default_frequency, band[bandIdx].step);
|
|
||||||
rx.setAmAfc(TURN_ON);
|
|
||||||
rx.setSoftMute(TURN_OFF);
|
|
||||||
rx.setAmSpace(0); // Sets Am space channel to 1Khz.
|
|
||||||
}
|
|
||||||
delay(100);
|
|
||||||
currentFrequency = band[bandIdx].default_frequency;
|
|
||||||
rx.setFrequency(currentFrequency);
|
|
||||||
showStatus();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used to test the receiver functions implemented by the library
|
|
||||||
*/
|
|
||||||
void doBandwidth()
|
|
||||||
{
|
|
||||||
if (bwIdx == 3)
|
|
||||||
bwIdx = 0;
|
|
||||||
bwIdx++;
|
|
||||||
rx.setAmBandwidth(bwIdx);
|
|
||||||
showBandwidth();
|
|
||||||
showFrequency();
|
|
||||||
delay(300);
|
|
||||||
}
|
|
||||||
|
|
||||||
void doStereo()
|
|
||||||
{
|
|
||||||
rx.setMono((bSt = !bSt));
|
|
||||||
bShow = true;
|
|
||||||
showStereo();
|
|
||||||
delay(100);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Process seek command.
|
|
||||||
The seek direction is based on the last encoder direction rotation.
|
|
||||||
*/
|
|
||||||
void doSeek()
|
|
||||||
{
|
|
||||||
delay(200);
|
|
||||||
bShow = true;
|
|
||||||
showFrequency();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
Button - Volume control
|
|
||||||
*/
|
|
||||||
void volumeButton(byte d)
|
|
||||||
{
|
|
||||||
|
|
||||||
if (d == 1)
|
|
||||||
rx.setVolumeUp();
|
|
||||||
else
|
|
||||||
rx.setVolumeDown();
|
|
||||||
|
|
||||||
showVolume();
|
|
||||||
delay(MIN_ELAPSED_TIME); // waits a little more for releasing the button.
|
|
||||||
}
|
|
||||||
|
|
||||||
void doFilter()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void APP_loop()
|
|
||||||
{
|
|
||||||
|
|
||||||
// Check if the encoder has moved.
|
|
||||||
if (encoderCount != 0)
|
|
||||||
{
|
|
||||||
if (encoderCount == 1)
|
|
||||||
{
|
|
||||||
rx.setFrequencyUp();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
rx.setFrequencyDown();
|
|
||||||
}
|
|
||||||
showFrequency();
|
|
||||||
bShow = true;
|
|
||||||
encoderCount = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check button commands
|
|
||||||
if ((millis() - elapsedButton) > MIN_ELAPSED_TIME)
|
|
||||||
{
|
|
||||||
// check if some button is pressed
|
|
||||||
if (digitalRead(BAND_MODE_SWITCH_UP) == LOW)
|
|
||||||
bandUp();
|
|
||||||
else if (digitalRead(BAND_MODE_SWITCH_DOWN) == LOW)
|
|
||||||
bandDown();
|
|
||||||
else if (digitalRead(VOL_UP) == LOW)
|
|
||||||
volumeButton(1);
|
|
||||||
else if (digitalRead(VOL_DOWN) == LOW)
|
|
||||||
volumeButton(-1);
|
|
||||||
else if (digitalRead(SWITCH_BW) == LOW)
|
|
||||||
doBandwidth();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((millis() - pollin_elapsed) > POLLING_TIME)
|
|
||||||
{
|
|
||||||
showRSSI();
|
|
||||||
pollin_elapsed = millis();
|
|
||||||
}
|
|
||||||
|
|
||||||
delay(100);
|
|
||||||
}
|
|
116
Core/App/Graphic/ui.c
Normal file
116
Core/App/Graphic/ui.c
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
#include <stdint.h>
|
||||||
|
#include "global.h"
|
||||||
|
#include "st7735.h"
|
||||||
|
#include "Images/digi18x32.h"
|
||||||
|
#include "monoimg.h"
|
||||||
|
#include "bmfont.h"
|
||||||
|
#include "asciifont.h"
|
||||||
|
|
||||||
|
void ui_text_number18x32(uint32_t num, uint16_t x, uint16_t y, uint16_t color) {
|
||||||
|
uint32_t tmp = num;
|
||||||
|
uint32_t div = 1;
|
||||||
|
uint8_t num_count = 0;
|
||||||
|
while (tmp > 0) {
|
||||||
|
tmp = tmp / 10;
|
||||||
|
num_count ++;
|
||||||
|
div = div * 10;
|
||||||
|
}
|
||||||
|
div = div / 10;
|
||||||
|
if (div == 0) {
|
||||||
|
mimg_Area area = mimg_get_tile_area(IMG_DIGI_18_32, 10, 1, 0);
|
||||||
|
mimg_draw(ST7735_DrawPixel, x, y, color, IMG_DIGI_18_32, area);
|
||||||
|
} else {
|
||||||
|
while (div > 0) {
|
||||||
|
tmp = (num / div) % 10;
|
||||||
|
mimg_Area area = mimg_get_tile_area(IMG_DIGI_18_32, 10, 1, tmp);
|
||||||
|
mimg_draw(ST7735_DrawPixel, x, y, color, IMG_DIGI_18_32, area);
|
||||||
|
x = x + 18;
|
||||||
|
div = div / 10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: 绘制界面的函数
|
||||||
|
/* UI元素 */
|
||||||
|
void ui_com_main_border() {
|
||||||
|
// border
|
||||||
|
ST7735_FillRectangle(0, 0, ST7735_WIDTH, 1, ST7735_YELLOW);
|
||||||
|
ST7735_FillRectangle(0, 17, ST7735_WIDTH, 1, ST7735_YELLOW);
|
||||||
|
ST7735_FillRectangle(0, ST7735_HEIGHT - 34, ST7735_WIDTH, 1, ST7735_YELLOW);
|
||||||
|
ST7735_FillRectangle(0, ST7735_HEIGHT - 1, ST7735_WIDTH, 1, ST7735_YELLOW);
|
||||||
|
ST7735_FillRectangle(0, 0, 1, ST7735_HEIGHT, ST7735_YELLOW);
|
||||||
|
ST7735_FillRectangle(ST7735_WIDTH - 1, 0, 1, ST7735_HEIGHT, ST7735_YELLOW);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ui_com_freq_digital(uint8_t clear) {
|
||||||
|
// 5位数字, 即高32,宽90
|
||||||
|
uint16_t off_x = (ST7735_WIDTH - 90) / 2;
|
||||||
|
uint16_t off_y = (ST7735_HEIGHT - 32 - 34 - 18) / 2 + 17;
|
||||||
|
if (clear) {
|
||||||
|
ST7735_FillRectangle(off_x, off_y, 32, 90, ST7735_BLACK);
|
||||||
|
}
|
||||||
|
uint16_t scale = 10000;
|
||||||
|
uint32_t tmp = 0;
|
||||||
|
while (scale > 0) {
|
||||||
|
tmp = (global_data.freq / scale) % 10;
|
||||||
|
ui_text_number18x32(tmp, off_x, off_y, ST7735_COLOR565(0xFF, 0x7F, 0));
|
||||||
|
off_x += 18;
|
||||||
|
scale /= 10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ui_com_progress_bar(uint8_t clear, uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t border_color, uint16_t fill_color, uint32_t current, uint32_t total) {
|
||||||
|
if (clear) {
|
||||||
|
ST7735_FillRectangle(x, y, w, h, ST7735_BLACK);
|
||||||
|
}
|
||||||
|
// border
|
||||||
|
ST7735_FillRectangle(x, y, w, 1, border_color);
|
||||||
|
ST7735_FillRectangle(x, y + h - 1, w, 1, border_color);
|
||||||
|
ST7735_FillRectangle(x, y, 1, h, border_color);
|
||||||
|
ST7735_FillRectangle(x + w - 1, y, 1, h, border_color);
|
||||||
|
// bar
|
||||||
|
x += 1;
|
||||||
|
y += 1;
|
||||||
|
w -= 2;
|
||||||
|
h -= 2;
|
||||||
|
uint16_t bar_width = w * current / total;
|
||||||
|
ST7735_FillRectangle(x, y, bar_width, h, fill_color);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ui_com_vol_bar(uint8_t clear) {
|
||||||
|
uint16_t off_x = 1;
|
||||||
|
uint16_t off_y = ST7735_HEIGHT - 33;
|
||||||
|
if (clear) {
|
||||||
|
ST7735_FillRectangle(off_x, off_y, ST7735_WIDTH - 2, 16, ST7735_BLACK);
|
||||||
|
}
|
||||||
|
uint16_t color_skyblue = ST7735_COLOR565(0, 0x7F, 0xFF);
|
||||||
|
// text, 32x16
|
||||||
|
off_x = off_x + (32 - bmf_get_text_width(font_unifont_16x16, u8str("VOL"), 3)) / 2;
|
||||||
|
bmf_draw_text(font_unifont_16x16, u8str("VOL"), 3, off_x, off_y, 32, 16, color_skyblue);
|
||||||
|
// bar
|
||||||
|
off_x = 1 + 32;
|
||||||
|
ui_com_progress_bar(clear, 33, off_y + 2, ST7735_WIDTH - 34 - 3, 13, ST7735_WHITE, color_skyblue, global_data.volumn, 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ui_com_sig_bar(uint8_t clear) {
|
||||||
|
uint16_t off_x = 1;
|
||||||
|
uint16_t off_y = ST7735_HEIGHT - 17;
|
||||||
|
if (clear) {
|
||||||
|
ST7735_FillRectangle(off_x, off_y, ST7735_WIDTH - 2, 16, ST7735_BLACK);
|
||||||
|
}
|
||||||
|
// text, 32x16
|
||||||
|
off_x = off_x + (32 - bmf_get_text_width(font_unifont_16x16, u8str("SIG"), 3)) / 2;
|
||||||
|
bmf_draw_text(font_unifont_16x16, u8str("SIG"), 3, off_x, off_y, 32, 16, ST7735_GREEN);
|
||||||
|
// bar
|
||||||
|
off_x = 1 + 32;
|
||||||
|
ui_com_progress_bar(clear, 33, off_y + 1, ST7735_WIDTH - 34 - 3, 13, ST7735_WHITE, ST7735_GREEN, global_data.signal, 255);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 供外部调用的方法 */
|
||||||
|
void ui_screen_main() {
|
||||||
|
ST7735_FillScreen(ST7735_BLACK);
|
||||||
|
ui_com_main_border();
|
||||||
|
ui_com_freq_digital(0);
|
||||||
|
ui_com_vol_bar(0);
|
||||||
|
ui_com_sig_bar(0);
|
||||||
|
}
|
@ -2,3 +2,6 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
void ui_text_number18x32(uint32_t num, uint16_t x, uint16_t y, uint16_t color);
|
void ui_text_number18x32(uint32_t num, uint16_t x, uint16_t y, uint16_t color);
|
||||||
|
|
||||||
|
/* 绘制主界面 */
|
||||||
|
void ui_screen_main();
|
11
Core/App/app.c
Normal file
11
Core/App/app.c
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#include "gpio.h"
|
||||||
|
#include "ui.h"
|
||||||
|
|
||||||
|
void app_init() {
|
||||||
|
ui_screen_main();
|
||||||
|
}
|
||||||
|
|
||||||
|
void app_main_loop() {
|
||||||
|
HAL_GPIO_TogglePin(LED_STATUS_GPIO_Port,LED_STATUS_Pin);
|
||||||
|
HAL_Delay(300);
|
||||||
|
}
|
4
Core/App/app.h
Normal file
4
Core/App/app.h
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
void app_init();
|
||||||
|
void app_main_loop();
|
9
Core/App/global.c
Normal file
9
Core/App/global.c
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#include <stdint.h>
|
||||||
|
#include "global.h"
|
||||||
|
|
||||||
|
GlobalData global_data = {
|
||||||
|
901, // freq
|
||||||
|
0, // freq_float
|
||||||
|
16, // volumn
|
||||||
|
97 //signal
|
||||||
|
};
|
12
Core/App/global.h
Normal file
12
Core/App/global.h
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
/** Global Data Define */
|
||||||
|
#pragma once
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
typedef struct GlobalData {
|
||||||
|
uint32_t freq;
|
||||||
|
uint8_t freq_float;
|
||||||
|
uint8_t volumn;
|
||||||
|
uint8_t signal;
|
||||||
|
} GlobalData;
|
||||||
|
|
||||||
|
extern GlobalData global_data;
|
@ -1,5 +1,5 @@
|
|||||||
// Rotary encoder library for Arduino.
|
// Rotary encoder library for Arduino.
|
||||||
#include "main.h"
|
#include "hardware.h"
|
||||||
#include "tim.h"
|
#include "tim.h"
|
||||||
|
|
||||||
#ifndef rotary_h
|
#ifndef rotary_h
|
@ -1,4 +1,7 @@
|
|||||||
/* vim: set ai et ts=4 sw=4: */
|
/* vim: set ai et ts=4 sw=4: */
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "gpio.h"
|
||||||
|
#include "spi.h"
|
||||||
#include "st7735.h"
|
#include "st7735.h"
|
||||||
|
|
||||||
#define DELAY 0x80
|
#define DELAY 0x80
|
||||||
@ -148,9 +151,6 @@ static void ST7735_SetAddressWindow(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t
|
|||||||
data[1] = y0 + ST7735_YSTART;
|
data[1] = y0 + ST7735_YSTART;
|
||||||
data[3] = y1 + ST7735_YSTART;
|
data[3] = y1 + ST7735_YSTART;
|
||||||
ST7735_WriteData(data, sizeof(data));
|
ST7735_WriteData(data, sizeof(data));
|
||||||
|
|
||||||
// write to RAM
|
|
||||||
ST7735_WriteCommand(ST7735_RAMWR);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ST7735_Init()
|
void ST7735_Init()
|
||||||
@ -171,6 +171,7 @@ void ST7735_DrawPixel(uint16_t x, uint16_t y, uint16_t color) //画点
|
|||||||
ST7735_Select();
|
ST7735_Select();
|
||||||
|
|
||||||
ST7735_SetAddressWindow(x, y, x + 1, y + 1);
|
ST7735_SetAddressWindow(x, y, x + 1, y + 1);
|
||||||
|
ST7735_WriteCommand(ST7735_RAMWR);
|
||||||
uint8_t data[] = {color >> 8, color & 0xFF};
|
uint8_t data[] = {color >> 8, color & 0xFF};
|
||||||
ST7735_WriteData(data, sizeof(data));
|
ST7735_WriteData(data, sizeof(data));
|
||||||
|
|
||||||
@ -240,6 +241,7 @@ void ST7735_FillRectangle(uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16
|
|||||||
|
|
||||||
ST7735_Select();
|
ST7735_Select();
|
||||||
ST7735_SetAddressWindow(x, y, x + w - 1, y + h - 1);
|
ST7735_SetAddressWindow(x, y, x + w - 1, y + h - 1);
|
||||||
|
ST7735_WriteCommand(ST7735_RAMWR);
|
||||||
|
|
||||||
uint8_t data[] = {color >> 8, color & 0xFF};
|
uint8_t data[] = {color >> 8, color & 0xFF};
|
||||||
HAL_GPIO_WritePin(ST7735_DC_GPIO_Port, ST7735_DC_Pin, GPIO_PIN_SET);
|
HAL_GPIO_WritePin(ST7735_DC_GPIO_Port, ST7735_DC_Pin, GPIO_PIN_SET);
|
||||||
@ -271,6 +273,7 @@ void ST7735_DrawImage(uint16_t x, uint16_t y, uint16_t w, uint16_t h, const uint
|
|||||||
|
|
||||||
ST7735_Select();
|
ST7735_Select();
|
||||||
ST7735_SetAddressWindow(x, y, x + w - 1, y + h - 1);
|
ST7735_SetAddressWindow(x, y, x + w - 1, y + h - 1);
|
||||||
|
ST7735_WriteCommand(ST7735_RAMWR);
|
||||||
ST7735_WriteData((uint8_t *)data, sizeof(uint16_t) * w * h);
|
ST7735_WriteData((uint8_t *)data, sizeof(uint16_t) * w * h);
|
||||||
ST7735_Unselect();
|
ST7735_Unselect();
|
||||||
}
|
}
|
@ -3,8 +3,10 @@
|
|||||||
#define __ST7735_H__
|
#define __ST7735_H__
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "main.h"
|
#include "hardware.h"
|
||||||
|
#include "spi.h"
|
||||||
|
|
||||||
#define ST7735_MADCTL_MY 0x80
|
#define ST7735_MADCTL_MY 0x80
|
||||||
#define ST7735_MADCTL_MX 0x40
|
#define ST7735_MADCTL_MX 0x40
|
@ -2,7 +2,7 @@
|
|||||||
#define __I2C_SW_H
|
#define __I2C_SW_H
|
||||||
|
|
||||||
/* includes */
|
/* includes */
|
||||||
#include "main.h"
|
#include "hardware.h"
|
||||||
#include "stdio.h"
|
#include "stdio.h"
|
||||||
|
|
||||||
/* defines */
|
/* defines */
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
/* #include <Arduino.h>
|
/* #include <Arduino.h>
|
||||||
#include <Wire.h> */
|
#include <Wire.h> */
|
||||||
#include "main.h"
|
#include "hardware.h"
|
||||||
#include "i2c_sw.h"
|
#include "i2c_sw.h"
|
||||||
|
|
||||||
#define KT0915_I2C_ADDRESS 0x6A //arduino:0x35 It is needed to check it when the KT0915 device arrives.
|
#define KT0915_I2C_ADDRESS 0x6A //arduino:0x35 It is needed to check it when the KT0915 device arrives.
|
40
Core/Inc/hardware.h
Normal file
40
Core/Inc/hardware.h
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
#include "stm32g0xx_hal.h"
|
||||||
|
|
||||||
|
#define ENCODER_KEY_Pin GPIO_PIN_13
|
||||||
|
#define ENCODER_KEY_GPIO_Port GPIOC
|
||||||
|
#define KEY_1_Pin GPIO_PIN_0
|
||||||
|
#define KEY_1_GPIO_Port GPIOA
|
||||||
|
#define KEY_2_Pin GPIO_PIN_1
|
||||||
|
#define KEY_2_GPIO_Port GPIOA
|
||||||
|
#define KEY_3_Pin GPIO_PIN_2
|
||||||
|
#define KEY_3_GPIO_Port GPIOA
|
||||||
|
#define KEY_4_Pin GPIO_PIN_3
|
||||||
|
#define KEY_4_GPIO_Port GPIOA
|
||||||
|
#define KEY_5_Pin GPIO_PIN_4
|
||||||
|
#define KEY_5_GPIO_Port GPIOA
|
||||||
|
#define LCD_BK_Pin GPIO_PIN_6
|
||||||
|
#define LCD_BK_GPIO_Port GPIOA
|
||||||
|
#define LED_2_Pin GPIO_PIN_8
|
||||||
|
#define LED_2_GPIO_Port GPIOA
|
||||||
|
#define ENCODER_A_Pin GPIO_PIN_6
|
||||||
|
#define ENCODER_A_GPIO_Port GPIOC
|
||||||
|
#define ENCODER_B_Pin GPIO_PIN_7
|
||||||
|
#define ENCODER_B_GPIO_Port GPIOC
|
||||||
|
#define LED_3_Pin GPIO_PIN_11
|
||||||
|
#define LED_3_GPIO_Port GPIOA
|
||||||
|
#define LED_4_Pin GPIO_PIN_12
|
||||||
|
#define LED_4_GPIO_Port GPIOA
|
||||||
|
#define LED_STATUS_Pin GPIO_PIN_15
|
||||||
|
#define LED_STATUS_GPIO_Port GPIOA
|
||||||
|
#define LCD_RST_Pin GPIO_PIN_0
|
||||||
|
#define LCD_RST_GPIO_Port GPIOD
|
||||||
|
#define KEY_6_Pin GPIO_PIN_1
|
||||||
|
#define KEY_6_GPIO_Port GPIOD
|
||||||
|
#define LCD_DC_Pin GPIO_PIN_2
|
||||||
|
#define LCD_DC_GPIO_Port GPIOD
|
||||||
|
#define LED_1_Pin GPIO_PIN_3
|
||||||
|
#define LED_1_GPIO_Port GPIOD
|
||||||
|
#define SWI2C_SCL_Pin GPIO_PIN_3
|
||||||
|
#define SWI2C_SCL_GPIO_Port GPIOB
|
||||||
|
#define SWI2C_SDA_Pin GPIO_PIN_4
|
||||||
|
#define SWI2C_SDA_GPIO_Port GPIOB
|
@ -31,6 +31,7 @@ extern "C" {
|
|||||||
|
|
||||||
/* Private includes ----------------------------------------------------------*/
|
/* Private includes ----------------------------------------------------------*/
|
||||||
/* USER CODE BEGIN Includes */
|
/* USER CODE BEGIN Includes */
|
||||||
|
#include "hardware.h"
|
||||||
|
|
||||||
/* USER CODE END Includes */
|
/* USER CODE END Includes */
|
||||||
|
|
||||||
@ -57,44 +58,6 @@ void Error_Handler(void);
|
|||||||
/* USER CODE END EFP */
|
/* USER CODE END EFP */
|
||||||
|
|
||||||
/* Private defines -----------------------------------------------------------*/
|
/* Private defines -----------------------------------------------------------*/
|
||||||
#define ENCODER_KEY_Pin GPIO_PIN_13
|
|
||||||
#define ENCODER_KEY_GPIO_Port GPIOC
|
|
||||||
#define KEY_1_Pin GPIO_PIN_0
|
|
||||||
#define KEY_1_GPIO_Port GPIOA
|
|
||||||
#define KEY_2_Pin GPIO_PIN_1
|
|
||||||
#define KEY_2_GPIO_Port GPIOA
|
|
||||||
#define KEY_3_Pin GPIO_PIN_2
|
|
||||||
#define KEY_3_GPIO_Port GPIOA
|
|
||||||
#define KEY_4_Pin GPIO_PIN_3
|
|
||||||
#define KEY_4_GPIO_Port GPIOA
|
|
||||||
#define KEY_5_Pin GPIO_PIN_4
|
|
||||||
#define KEY_5_GPIO_Port GPIOA
|
|
||||||
#define LCD_BK_Pin GPIO_PIN_6
|
|
||||||
#define LCD_BK_GPIO_Port GPIOA
|
|
||||||
#define LED_2_Pin GPIO_PIN_8
|
|
||||||
#define LED_2_GPIO_Port GPIOA
|
|
||||||
#define ENCODER_A_Pin GPIO_PIN_6
|
|
||||||
#define ENCODER_A_GPIO_Port GPIOC
|
|
||||||
#define ENCODER_B_Pin GPIO_PIN_7
|
|
||||||
#define ENCODER_B_GPIO_Port GPIOC
|
|
||||||
#define LED_3_Pin GPIO_PIN_11
|
|
||||||
#define LED_3_GPIO_Port GPIOA
|
|
||||||
#define LED_4_Pin GPIO_PIN_12
|
|
||||||
#define LED_4_GPIO_Port GPIOA
|
|
||||||
#define LED_STATUS_Pin GPIO_PIN_15
|
|
||||||
#define LED_STATUS_GPIO_Port GPIOA
|
|
||||||
#define LCD_RST_Pin GPIO_PIN_0
|
|
||||||
#define LCD_RST_GPIO_Port GPIOD
|
|
||||||
#define KEY_6_Pin GPIO_PIN_1
|
|
||||||
#define KEY_6_GPIO_Port GPIOD
|
|
||||||
#define LCD_DC_Pin GPIO_PIN_2
|
|
||||||
#define LCD_DC_GPIO_Port GPIOD
|
|
||||||
#define LED_1_Pin GPIO_PIN_3
|
|
||||||
#define LED_1_GPIO_Port GPIOD
|
|
||||||
#define SWI2C_SCL_Pin GPIO_PIN_3
|
|
||||||
#define SWI2C_SCL_GPIO_Port GPIOB
|
|
||||||
#define SWI2C_SDA_Pin GPIO_PIN_4
|
|
||||||
#define SWI2C_SDA_GPIO_Port GPIOB
|
|
||||||
|
|
||||||
/* USER CODE BEGIN Private defines */
|
/* USER CODE BEGIN Private defines */
|
||||||
|
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
#include <stdint.h>
|
|
||||||
#include "Images/digi18x32.h"
|
|
||||||
#include "monoimg.h"
|
|
||||||
#include "st7735.h"
|
|
||||||
|
|
||||||
void ui_text_number18x32(uint32_t num, uint16_t x, uint16_t y, uint16_t color) {
|
|
||||||
uint32_t tmp = num;
|
|
||||||
uint32_t div = 1;
|
|
||||||
uint8_t num_count = 0;
|
|
||||||
while (tmp > 0) {
|
|
||||||
tmp = tmp / 10;
|
|
||||||
num_count ++;
|
|
||||||
div = div * 10;
|
|
||||||
}
|
|
||||||
div = div / 10;
|
|
||||||
while (div > 0) {
|
|
||||||
tmp = (num / div) % 10;
|
|
||||||
mimg_Area area = mimg_get_tile_area(IMG_DIGI_18_32, 10, 1, tmp);
|
|
||||||
mimg_draw(ST7735_DrawPixel, x, y, color, IMG_DIGI_18_32, area);
|
|
||||||
x = x + 18;
|
|
||||||
div = div / 10;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: 绘制文字的方法
|
|
@ -26,11 +26,8 @@
|
|||||||
/* Private includes ----------------------------------------------------------*/
|
/* Private includes ----------------------------------------------------------*/
|
||||||
/* USER CODE BEGIN Includes */
|
/* USER CODE BEGIN Includes */
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "RotaryCoder.h"
|
|
||||||
#include "st7735.h"
|
#include "st7735.h"
|
||||||
#include "ui.h"
|
#include "app.h"
|
||||||
#include "bmfont.h"
|
|
||||||
#include "asciifont.h"
|
|
||||||
/* USER CODE END Includes */
|
/* USER CODE END Includes */
|
||||||
|
|
||||||
/* Private typedef -----------------------------------------------------------*/
|
/* Private typedef -----------------------------------------------------------*/
|
||||||
@ -71,8 +68,6 @@ void LCD_init()
|
|||||||
{
|
{
|
||||||
ST7735_Init(); // 屏幕初始化
|
ST7735_Init(); // 屏幕初始化
|
||||||
HAL_GPIO_WritePin(LCD_BK_GPIO_Port, LCD_BK_Pin, GPIO_PIN_SET);
|
HAL_GPIO_WritePin(LCD_BK_GPIO_Port, LCD_BK_Pin, GPIO_PIN_SET);
|
||||||
//const char ready[] = "Init Ready!\r\n";
|
|
||||||
//HAL_UART_Transmit(&huart1, (uint8_t *)ready, sizeof(ready) - 1, HAL_MAX_DELAY);
|
|
||||||
}
|
}
|
||||||
/* USER CODE END 0 */
|
/* USER CODE END 0 */
|
||||||
|
|
||||||
@ -108,16 +103,8 @@ int main(void)
|
|||||||
MX_SPI1_Init();
|
MX_SPI1_Init();
|
||||||
MX_TIM3_Init();
|
MX_TIM3_Init();
|
||||||
/* USER CODE BEGIN 2 */
|
/* USER CODE BEGIN 2 */
|
||||||
/*EC11_init();
|
|
||||||
uint16_t Count;
|
|
||||||
uint16_t Diretion;*/
|
|
||||||
printf("program start\n");
|
|
||||||
LCD_init();
|
LCD_init();
|
||||||
ST7735_FillScreen(ST7735_WHITE);
|
app_init();
|
||||||
printf("Begin draw number\n");
|
|
||||||
ui_text_number18x32(10086, 0, 0, ST7735_BLUE);
|
|
||||||
bmf_draw_text(font_unifont_16x16, u8str("Test Ascii\nHello Dragon Ok~~~~"), 29, 0, 40, 160, 64, ST7735_BLACK);
|
|
||||||
printf("End draw number\n");
|
|
||||||
/* USER CODE END 2 */
|
/* USER CODE END 2 */
|
||||||
|
|
||||||
/* Infinite loop */
|
/* Infinite loop */
|
||||||
@ -126,16 +113,7 @@ int main(void)
|
|||||||
{
|
{
|
||||||
/* USER CODE END WHILE */
|
/* USER CODE END WHILE */
|
||||||
/* USER CODE BEGIN 3 */
|
/* USER CODE BEGIN 3 */
|
||||||
HAL_GPIO_TogglePin(LED_STATUS_GPIO_Port,LED_STATUS_Pin);
|
app_main_loop();
|
||||||
HAL_Delay(300);
|
|
||||||
|
|
||||||
/*
|
|
||||||
Count = EC11_COUNT();
|
|
||||||
Diretion = EC11_DIR();
|
|
||||||
printf("DIRE:%d COUNT:%d \r\n",Diretion,Count);
|
|
||||||
HAL_Delay(500);
|
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
}
|
||||||
/* USER CODE END 3 */
|
/* USER CODE END 3 */
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,8 @@ void MX_SPI1_Init(void)
|
|||||||
/* USER CODE END SPI1_Init 1 */
|
/* USER CODE END SPI1_Init 1 */
|
||||||
hspi1.Instance = SPI1;
|
hspi1.Instance = SPI1;
|
||||||
hspi1.Init.Mode = SPI_MODE_MASTER;
|
hspi1.Init.Mode = SPI_MODE_MASTER;
|
||||||
hspi1.Init.Direction = SPI_DIRECTION_2LINES;
|
// hspi1.Init.Direction = SPI_DIRECTION_2LINES;
|
||||||
|
hspi1.Init.Direction = SPI_DIRECTION_1LINE;
|
||||||
hspi1.Init.DataSize = SPI_DATASIZE_8BIT;
|
hspi1.Init.DataSize = SPI_DATASIZE_8BIT;
|
||||||
hspi1.Init.CLKPolarity = SPI_POLARITY_LOW;
|
hspi1.Init.CLKPolarity = SPI_POLARITY_LOW;
|
||||||
hspi1.Init.CLKPhase = SPI_PHASE_1EDGE;
|
hspi1.Init.CLKPhase = SPI_PHASE_1EDGE;
|
||||||
|
41
Makefile
41
Makefile
@ -13,7 +13,7 @@
|
|||||||
######################################
|
######################################
|
||||||
# target
|
# target
|
||||||
######################################
|
######################################
|
||||||
TARGET = radio-gnumake_test
|
TARGET = radio-gnumake
|
||||||
|
|
||||||
|
|
||||||
######################################
|
######################################
|
||||||
@ -64,15 +64,16 @@ Core/Src/gpio.c \
|
|||||||
Core/Src/usart.c \
|
Core/Src/usart.c \
|
||||||
Core/Src/spi.c \
|
Core/Src/spi.c \
|
||||||
Core/Src/system_stm32g0xx.c \
|
Core/Src/system_stm32g0xx.c \
|
||||||
Core/RotaryCoder/RotaryCoder.c \
|
Core/App/app.c \
|
||||||
Core/ST7735/st7735.c \
|
Core/App/global.c \
|
||||||
Core/ST7735/UI/monoimg.c \
|
Core/Hardware/RotaryCoder/RotaryCoder.c \
|
||||||
Core/ST7735/UI/ui.c \
|
Core/Hardware/ST7735/st7735.c \
|
||||||
Core/ST7735/UI/bmfont.c \
|
Core/App/Graphic/monoimg.c \
|
||||||
Core/ST7735/UI/asciifont.c \
|
Core/App/Graphic/ui.c \
|
||||||
#Core/kt0915/KT0915.C \
|
Core/App/Graphic/bmfont.c \
|
||||||
#Core/SWI2C/i2c_sw.c \
|
Core/App/Graphic/asciifont.c \
|
||||||
#Core/APP/app.c
|
#Core/Hardware/kt0915/KT0915.C \
|
||||||
|
#Core/Hardware/SWI2C/i2c_sw.c \
|
||||||
|
|
||||||
|
|
||||||
# ASM sources
|
# ASM sources
|
||||||
@ -135,15 +136,13 @@ C_INCLUDES = \
|
|||||||
-IDrivers/STM32G0xx_HAL_Driver/Inc/Legacy \
|
-IDrivers/STM32G0xx_HAL_Driver/Inc/Legacy \
|
||||||
-IDrivers/CMSIS/Device/ST/STM32G0xx/Include \
|
-IDrivers/CMSIS/Device/ST/STM32G0xx/Include \
|
||||||
-IDrivers/CMSIS/Include \
|
-IDrivers/CMSIS/Include \
|
||||||
-ICore/RotaryCoder \
|
|
||||||
-IDrivers/CMSIS/Include \
|
-IDrivers/CMSIS/Include \
|
||||||
-ICore/ST7735 \
|
-ICore/App \
|
||||||
-ICore/ST7735/UI \
|
-ICore/Hardware/RotaryCoder \
|
||||||
# -ICore/ST7735/Images \
|
-ICore/Hardware/ST7735 \
|
||||||
#-ICore/kt0915 \
|
-ICore/App/Graphic \
|
||||||
#-ICore/SWI2C \
|
#-ICore/Hardware/kt0915 \
|
||||||
#-ICore/APP
|
#-ICore/Hardware/SWI2C \
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# compile gcc flags
|
# compile gcc flags
|
||||||
@ -211,6 +210,12 @@ $(BUILD_DIR):
|
|||||||
clean:
|
clean:
|
||||||
-rm -fR $(BUILD_DIR)
|
-rm -fR $(BUILD_DIR)
|
||||||
|
|
||||||
|
#######################################
|
||||||
|
# flash
|
||||||
|
#######################################
|
||||||
|
flash:
|
||||||
|
-JLinkExe cmd.jexe
|
||||||
|
|
||||||
#######################################
|
#######################################
|
||||||
# dependencies
|
# dependencies
|
||||||
#######################################
|
#######################################
|
||||||
|
209
Makefile.bak
209
Makefile.bak
@ -1,209 +0,0 @@
|
|||||||
##########################################################################################################################
|
|
||||||
# File automatically-generated by tool: [projectgenerator] version: [3.18.0-B7] date: [Sun Jan 15 03:57:37 CST 2023]
|
|
||||||
##########################################################################################################################
|
|
||||||
|
|
||||||
# ------------------------------------------------
|
|
||||||
# Generic Makefile (based on gcc)
|
|
||||||
#
|
|
||||||
# ChangeLog :
|
|
||||||
# 2017-02-10 - Several enhancements + project update mode
|
|
||||||
# 2015-07-22 - first version
|
|
||||||
# ------------------------------------------------
|
|
||||||
|
|
||||||
######################################
|
|
||||||
# target
|
|
||||||
######################################
|
|
||||||
TARGET = radio-gnumake_test
|
|
||||||
|
|
||||||
|
|
||||||
######################################
|
|
||||||
# building variables
|
|
||||||
######################################
|
|
||||||
# debug build?
|
|
||||||
DEBUG = 1
|
|
||||||
# optimization
|
|
||||||
OPT = -Og
|
|
||||||
|
|
||||||
|
|
||||||
#######################################
|
|
||||||
# paths
|
|
||||||
#######################################
|
|
||||||
# Build path
|
|
||||||
BUILD_DIR = build
|
|
||||||
|
|
||||||
######################################
|
|
||||||
# source
|
|
||||||
######################################
|
|
||||||
# C sources
|
|
||||||
C_SOURCES = \
|
|
||||||
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_hal_tim.c \
|
|
||||||
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_hal_tim_ex.c \
|
|
||||||
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_hal_rcc.c \
|
|
||||||
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_hal_rcc_ex.c \
|
|
||||||
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_ll_rcc.c \
|
|
||||||
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_hal_flash.c \
|
|
||||||
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_hal_flash_ex.c \
|
|
||||||
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_hal_gpio.c \
|
|
||||||
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_hal_dma.c \
|
|
||||||
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_hal_dma_ex.c \
|
|
||||||
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_ll_dma.c \
|
|
||||||
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_hal_pwr.c \
|
|
||||||
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_hal_pwr_ex.c \
|
|
||||||
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_hal_cortex.c \
|
|
||||||
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_hal.c \
|
|
||||||
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_hal_exti.c \
|
|
||||||
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_hal_uart.c \
|
|
||||||
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_hal_uart_ex.c \
|
|
||||||
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_hal_spi.c \
|
|
||||||
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_hal_spi_ex.c \
|
|
||||||
Core/Src/tim.c \
|
|
||||||
Core/Src/main.c \
|
|
||||||
Core/Src/stm32g0xx_it.c \
|
|
||||||
Core/Src/stm32g0xx_hal_msp.c \
|
|
||||||
Core/Src/gpio.c \
|
|
||||||
Core/Src/usart.c \
|
|
||||||
Core/Src/spi.c \
|
|
||||||
Core/Src/system_stm32g0xx.c \
|
|
||||||
Core/RotaryCoder/RotaryCoder.c
|
|
||||||
#Core/kt0915/KT0915.C \
|
|
||||||
#Core/kt0915/KT0915.C \
|
|
||||||
#Core/ST7735/fonts.c \
|
|
||||||
#Core/SWI2C/i2c_sw.c \
|
|
||||||
|
|
||||||
|
|
||||||
# ASM sources
|
|
||||||
ASM_SOURCES = \
|
|
||||||
startup_stm32g030xx.s
|
|
||||||
|
|
||||||
|
|
||||||
#######################################
|
|
||||||
# binaries
|
|
||||||
#######################################
|
|
||||||
PREFIX = arm-none-eabi-
|
|
||||||
# The gcc compiler bin path can be either defined in make command via GCC_PATH variable (> make GCC_PATH=xxx)
|
|
||||||
# either it can be added to the PATH environment variable.
|
|
||||||
ifdef GCC_PATH
|
|
||||||
CC = $(GCC_PATH)/$(PREFIX)gcc
|
|
||||||
AS = $(GCC_PATH)/$(PREFIX)gcc -x assembler-with-cpp
|
|
||||||
CP = $(GCC_PATH)/$(PREFIX)objcopy
|
|
||||||
SZ = $(GCC_PATH)/$(PREFIX)size
|
|
||||||
else
|
|
||||||
CC = $(PREFIX)gcc
|
|
||||||
AS = $(PREFIX)gcc -x assembler-with-cpp
|
|
||||||
CP = $(PREFIX)objcopy
|
|
||||||
SZ = $(PREFIX)size
|
|
||||||
endif
|
|
||||||
HEX = $(CP) -O ihex
|
|
||||||
BIN = $(CP) -O binary -S
|
|
||||||
|
|
||||||
#######################################
|
|
||||||
# CFLAGS
|
|
||||||
#######################################
|
|
||||||
# cpu
|
|
||||||
CPU = -mcpu=cortex-m0plus
|
|
||||||
|
|
||||||
# fpu
|
|
||||||
# NONE for Cortex-M0/M0+/M3
|
|
||||||
|
|
||||||
# float-abi
|
|
||||||
|
|
||||||
|
|
||||||
# mcu
|
|
||||||
MCU = $(CPU) -mthumb $(FPU) $(FLOAT-ABI)
|
|
||||||
|
|
||||||
# macros for gcc
|
|
||||||
# AS defines
|
|
||||||
AS_DEFS =
|
|
||||||
|
|
||||||
# C defines
|
|
||||||
C_DEFS = \
|
|
||||||
-DUSE_HAL_DRIVER \
|
|
||||||
-DSTM32G030xx
|
|
||||||
|
|
||||||
|
|
||||||
# AS includes
|
|
||||||
AS_INCLUDES =
|
|
||||||
|
|
||||||
# C includes
|
|
||||||
C_INCLUDES = \
|
|
||||||
-ICore/Inc \
|
|
||||||
-IDrivers/STM32G0xx_HAL_Driver/Inc \
|
|
||||||
-IDrivers/STM32G0xx_HAL_Driver/Inc/Legacy \
|
|
||||||
-IDrivers/CMSIS/Device/ST/STM32G0xx/Include \
|
|
||||||
-IDrivers/CMSIS/Include \
|
|
||||||
-ICore/RotaryCoder
|
|
||||||
#-ICore/kt0915 \
|
|
||||||
#-ICore/SWI2C \
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# compile gcc flags
|
|
||||||
ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
|
|
||||||
|
|
||||||
CFLAGS += $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
|
|
||||||
|
|
||||||
ifeq ($(DEBUG), 1)
|
|
||||||
CFLAGS += -g -gdwarf-2
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
# Generate dependency information
|
|
||||||
CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)"
|
|
||||||
|
|
||||||
|
|
||||||
#######################################
|
|
||||||
# LDFLAGS
|
|
||||||
#######################################
|
|
||||||
# link script
|
|
||||||
LDSCRIPT = STM32G030C8Tx_FLASH.ld
|
|
||||||
|
|
||||||
# libraries
|
|
||||||
LIBS = -lc -lm -lnosys
|
|
||||||
LIBDIR =
|
|
||||||
LDFLAGS = $(MCU) -specs=nano.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections
|
|
||||||
|
|
||||||
# default action: build all
|
|
||||||
all: $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin
|
|
||||||
|
|
||||||
|
|
||||||
#######################################
|
|
||||||
# build the application
|
|
||||||
#######################################
|
|
||||||
# list of objects
|
|
||||||
OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o)))
|
|
||||||
vpath %.c $(sort $(dir $(C_SOURCES)))
|
|
||||||
# list of ASM program objects
|
|
||||||
OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES:.s=.o)))
|
|
||||||
vpath %.s $(sort $(dir $(ASM_SOURCES)))
|
|
||||||
|
|
||||||
$(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR)
|
|
||||||
$(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@
|
|
||||||
|
|
||||||
$(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR)
|
|
||||||
$(AS) -c $(CFLAGS) $< -o $@
|
|
||||||
|
|
||||||
$(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) Makefile
|
|
||||||
$(CC) $(OBJECTS) $(LDFLAGS) -o $@
|
|
||||||
$(SZ) $@
|
|
||||||
|
|
||||||
$(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
|
|
||||||
$(HEX) $< $@
|
|
||||||
|
|
||||||
$(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
|
|
||||||
$(BIN) $< $@
|
|
||||||
|
|
||||||
$(BUILD_DIR):
|
|
||||||
mkdir $@
|
|
||||||
|
|
||||||
#######################################
|
|
||||||
# clean up
|
|
||||||
#######################################
|
|
||||||
clean:
|
|
||||||
-rm -fR $(BUILD_DIR)
|
|
||||||
|
|
||||||
#######################################
|
|
||||||
# dependencies
|
|
||||||
#######################################
|
|
||||||
-include $(wildcard $(BUILD_DIR)/*.d)
|
|
||||||
|
|
||||||
# *** EOF ***
|
|
4
cmd.jexe
4
cmd.jexe
@ -2,8 +2,8 @@ Device STM32G030C8
|
|||||||
SelectInterface SWD
|
SelectInterface SWD
|
||||||
Speed auto
|
Speed auto
|
||||||
Connect
|
Connect
|
||||||
LoadFile build/radio-gnumake_test.bin 0x8000000
|
LoadFile build/radio-gnumake.bin 0x8000000
|
||||||
VerifyBin build/radio-gnumake_test.bin 0x8000000
|
VerifyBin build/radio-gnumake.bin 0x8000000
|
||||||
Reset
|
Reset
|
||||||
Go
|
Go
|
||||||
EXit
|
EXit
|
||||||
|
@ -183,8 +183,8 @@ ProjectManager.MainLocation=Core/Src
|
|||||||
ProjectManager.NoMain=false
|
ProjectManager.NoMain=false
|
||||||
ProjectManager.PreviousToolchain=
|
ProjectManager.PreviousToolchain=
|
||||||
ProjectManager.ProjectBuild=false
|
ProjectManager.ProjectBuild=false
|
||||||
ProjectManager.ProjectFileName=radio-gnumake_test.ioc
|
ProjectManager.ProjectFileName=radio-gnumake.ioc
|
||||||
ProjectManager.ProjectName=radio-gnumake_test
|
ProjectManager.ProjectName=radio-gnumake
|
||||||
ProjectManager.RegisterCallBack=
|
ProjectManager.RegisterCallBack=
|
||||||
ProjectManager.StackSize=0x400
|
ProjectManager.StackSize=0x400
|
||||||
ProjectManager.TargetToolchain=Makefile
|
ProjectManager.TargetToolchain=Makefile
|
BIN
tools/archivers/digi8_16x28.pbm
Normal file
BIN
tools/archivers/digi8_16x28.pbm
Normal file
Binary file not shown.
26
tools/archivers/pix16x16.py
Normal file
26
tools/archivers/pix16x16.py
Normal file
File diff suppressed because one or more lines are too long
26
tools/archivers/pix8x8.py
Normal file
26
tools/archivers/pix8x8.py
Normal file
File diff suppressed because one or more lines are too long
BIN
tools/char16x16/100.pbm
Normal file
BIN
tools/char16x16/100.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/101.pbm
Normal file
BIN
tools/char16x16/101.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/102.pbm
Normal file
BIN
tools/char16x16/102.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/103.pbm
Normal file
BIN
tools/char16x16/103.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/104.pbm
Normal file
BIN
tools/char16x16/104.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/105.pbm
Normal file
BIN
tools/char16x16/105.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/106.pbm
Normal file
BIN
tools/char16x16/106.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/107.pbm
Normal file
BIN
tools/char16x16/107.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/108.pbm
Normal file
BIN
tools/char16x16/108.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/109.pbm
Normal file
BIN
tools/char16x16/109.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/110.pbm
Normal file
BIN
tools/char16x16/110.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/111.pbm
Normal file
BIN
tools/char16x16/111.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/112.pbm
Normal file
BIN
tools/char16x16/112.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/113.pbm
Normal file
BIN
tools/char16x16/113.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/114.pbm
Normal file
BIN
tools/char16x16/114.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/115.pbm
Normal file
BIN
tools/char16x16/115.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/116.pbm
Normal file
BIN
tools/char16x16/116.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/117.pbm
Normal file
BIN
tools/char16x16/117.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/118.pbm
Normal file
BIN
tools/char16x16/118.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/119.pbm
Normal file
BIN
tools/char16x16/119.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/120.pbm
Normal file
BIN
tools/char16x16/120.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/121.pbm
Normal file
BIN
tools/char16x16/121.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/122.pbm
Normal file
BIN
tools/char16x16/122.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/123.pbm
Normal file
BIN
tools/char16x16/123.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/124.pbm
Normal file
BIN
tools/char16x16/124.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/125.pbm
Normal file
BIN
tools/char16x16/125.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/126.pbm
Normal file
BIN
tools/char16x16/126.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/33.pbm
Normal file
BIN
tools/char16x16/33.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/34.pbm
Normal file
BIN
tools/char16x16/34.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/35.pbm
Normal file
BIN
tools/char16x16/35.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/36.pbm
Normal file
BIN
tools/char16x16/36.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/37.pbm
Normal file
BIN
tools/char16x16/37.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/38.pbm
Normal file
BIN
tools/char16x16/38.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/39.pbm
Normal file
BIN
tools/char16x16/39.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/40.pbm
Normal file
BIN
tools/char16x16/40.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/41.pbm
Normal file
BIN
tools/char16x16/41.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/42.pbm
Normal file
BIN
tools/char16x16/42.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/43.pbm
Normal file
BIN
tools/char16x16/43.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/44.pbm
Normal file
BIN
tools/char16x16/44.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/45.pbm
Normal file
BIN
tools/char16x16/45.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/46.pbm
Normal file
BIN
tools/char16x16/46.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/47.pbm
Normal file
BIN
tools/char16x16/47.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/48.pbm
Normal file
BIN
tools/char16x16/48.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/49.pbm
Normal file
BIN
tools/char16x16/49.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/50.pbm
Normal file
BIN
tools/char16x16/50.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/51.pbm
Normal file
BIN
tools/char16x16/51.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/52.pbm
Normal file
BIN
tools/char16x16/52.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/53.pbm
Normal file
BIN
tools/char16x16/53.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/54.pbm
Normal file
BIN
tools/char16x16/54.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/55.pbm
Normal file
BIN
tools/char16x16/55.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/56.pbm
Normal file
BIN
tools/char16x16/56.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/57.pbm
Normal file
BIN
tools/char16x16/57.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/58.pbm
Normal file
BIN
tools/char16x16/58.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/59.pbm
Normal file
BIN
tools/char16x16/59.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/60.pbm
Normal file
BIN
tools/char16x16/60.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/61.pbm
Normal file
BIN
tools/char16x16/61.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/62.pbm
Normal file
BIN
tools/char16x16/62.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/63.pbm
Normal file
BIN
tools/char16x16/63.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/64.pbm
Normal file
BIN
tools/char16x16/64.pbm
Normal file
Binary file not shown.
BIN
tools/char16x16/65.pbm
Normal file
BIN
tools/char16x16/65.pbm
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user