Merge branch 'main' of https://git.dh2lm.de/DH2LM/Businesscard-V2
Added Game
This commit is contained in:
commit
3682a3da18
Binary file not shown.
5
Software/Class-Port-Ported/.gitignore
vendored
Normal file
5
Software/Class-Port-Ported/.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
.pio
|
||||||
|
.vscode/.browse.c_cpp.db*
|
||||||
|
.vscode/c_cpp_properties.json
|
||||||
|
.vscode/launch.json
|
||||||
|
.vscode/ipch
|
||||||
10
Software/Class-Port-Ported/.vscode/extensions.json
vendored
Normal file
10
Software/Class-Port-Ported/.vscode/extensions.json
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
// See http://go.microsoft.com/fwlink/?LinkId=827846
|
||||||
|
// for the documentation about the extensions.json format
|
||||||
|
"recommendations": [
|
||||||
|
"platformio.platformio-ide"
|
||||||
|
],
|
||||||
|
"unwantedRecommendations": [
|
||||||
|
"ms-vscode.cpptools-extension-pack"
|
||||||
|
]
|
||||||
|
}
|
||||||
BIN
Software/Class-Port-Ported/bmp/spaceinv.bmp
Normal file
BIN
Software/Class-Port-Ported/bmp/spaceinv.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 714 B |
39
Software/Class-Port-Ported/include/README
Normal file
39
Software/Class-Port-Ported/include/README
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
|
||||||
|
This directory is intended for project header files.
|
||||||
|
|
||||||
|
A header file is a file containing C declarations and macro definitions
|
||||||
|
to be shared between several project source files. You request the use of a
|
||||||
|
header file in your project source file (C, C++, etc) located in `src` folder
|
||||||
|
by including it, with the C preprocessing directive `#include'.
|
||||||
|
|
||||||
|
```src/main.c
|
||||||
|
|
||||||
|
#include "header.h"
|
||||||
|
|
||||||
|
int main (void)
|
||||||
|
{
|
||||||
|
...
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Including a header file produces the same results as copying the header file
|
||||||
|
into each source file that needs it. Such copying would be time-consuming
|
||||||
|
and error-prone. With a header file, the related declarations appear
|
||||||
|
in only one place. If they need to be changed, they can be changed in one
|
||||||
|
place, and programs that include the header file will automatically use the
|
||||||
|
new version when next recompiled. The header file eliminates the labor of
|
||||||
|
finding and changing all the copies as well as the risk that a failure to
|
||||||
|
find one copy will result in inconsistencies within a program.
|
||||||
|
|
||||||
|
In C, the usual convention is to give header files names that end with `.h'.
|
||||||
|
It is most portable to use only letters, digits, dashes, and underscores in
|
||||||
|
header file names, and at most one dot.
|
||||||
|
|
||||||
|
Read more about using header files in official GCC documentation:
|
||||||
|
|
||||||
|
* Include Syntax
|
||||||
|
* Include Operation
|
||||||
|
* Once-Only Headers
|
||||||
|
* Computed Includes
|
||||||
|
|
||||||
|
https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html
|
||||||
46
Software/Class-Port-Ported/lib/README
Normal file
46
Software/Class-Port-Ported/lib/README
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
|
||||||
|
This directory is intended for project specific (private) libraries.
|
||||||
|
PlatformIO will compile them to static libraries and link into executable file.
|
||||||
|
|
||||||
|
The source code of each library should be placed in an own separate directory
|
||||||
|
("lib/your_library_name/[here are source files]").
|
||||||
|
|
||||||
|
For example, see a structure of the following two libraries `Foo` and `Bar`:
|
||||||
|
|
||||||
|
|--lib
|
||||||
|
| |
|
||||||
|
| |--Bar
|
||||||
|
| | |--docs
|
||||||
|
| | |--examples
|
||||||
|
| | |--src
|
||||||
|
| | |- Bar.c
|
||||||
|
| | |- Bar.h
|
||||||
|
| | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html
|
||||||
|
| |
|
||||||
|
| |--Foo
|
||||||
|
| | |- Foo.c
|
||||||
|
| | |- Foo.h
|
||||||
|
| |
|
||||||
|
| |- README --> THIS FILE
|
||||||
|
|
|
||||||
|
|- platformio.ini
|
||||||
|
|--src
|
||||||
|
|- main.c
|
||||||
|
|
||||||
|
and a contents of `src/main.c`:
|
||||||
|
```
|
||||||
|
#include <Foo.h>
|
||||||
|
#include <Bar.h>
|
||||||
|
|
||||||
|
int main (void)
|
||||||
|
{
|
||||||
|
...
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
PlatformIO Library Dependency Finder will find automatically dependent
|
||||||
|
libraries scanning project source files.
|
||||||
|
|
||||||
|
More information about PlatformIO Library Dependency Finder
|
||||||
|
- https://docs.platformio.org/page/librarymanager/ldf.html
|
||||||
27
Software/Class-Port-Ported/platformio.ini
Normal file
27
Software/Class-Port-Ported/platformio.ini
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
; PlatformIO Project Configuration File
|
||||||
|
;
|
||||||
|
; Build options: build flags, source filter
|
||||||
|
; Upload options: custom upload port, speed and extra flags
|
||||||
|
; Library options: dependencies, extra library storages
|
||||||
|
; Advanced options: extra scripting
|
||||||
|
;
|
||||||
|
; Please visit documentation for the other options and examples
|
||||||
|
; https://docs.platformio.org/page/projectconf.html
|
||||||
|
|
||||||
|
[env:ch32v203c8t6_evt_r0]
|
||||||
|
platform = https://github.com/Community-PIO-CH32V/platform-ch32v.git
|
||||||
|
board = ch32v203c8t6_evt_r0
|
||||||
|
framework = noneos-sdk
|
||||||
|
monitor_speed = 115200
|
||||||
|
|
||||||
|
|
||||||
|
; [env:ATmega32u4]
|
||||||
|
; platform = atmelavr
|
||||||
|
; board = micro
|
||||||
|
; board_build.mcu = atmega32u4
|
||||||
|
; board_build.f_cpu = 16000000L
|
||||||
|
; framework = arduino
|
||||||
|
; build_flags=-DATMEGA32U4
|
||||||
|
; upload_protocol = usbtiny
|
||||||
|
; upload_flags = -e
|
||||||
|
; ;
|
||||||
187
Software/Class-Port-Ported/src/CDisplay.cpp
Normal file
187
Software/Class-Port-Ported/src/CDisplay.cpp
Normal file
@ -0,0 +1,187 @@
|
|||||||
|
#include "CDisplay.h"
|
||||||
|
|
||||||
|
#define HIGH BitAction::Bit_SET
|
||||||
|
#define LOW BitAction::Bit_RESET
|
||||||
|
|
||||||
|
CDisplay::CDisplay()
|
||||||
|
{
|
||||||
|
initDisplay();
|
||||||
|
}
|
||||||
|
|
||||||
|
CDisplay::~CDisplay() {}
|
||||||
|
|
||||||
|
void CDisplay::initPin(GPIO_TypeDef* port, uint16_t pin, GPIOMode_TypeDef mode)
|
||||||
|
{
|
||||||
|
GPIO_InitTypeDef GPIO_InitStructure = {0};
|
||||||
|
GPIO_InitStructure.GPIO_Pin = pin;
|
||||||
|
GPIO_InitStructure.GPIO_Mode = mode;
|
||||||
|
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
|
||||||
|
GPIO_Init(port, &GPIO_InitStructure);
|
||||||
|
}
|
||||||
|
|
||||||
|
BitAction CDisplay::getBitActionFromValue(uint8_t val)
|
||||||
|
{
|
||||||
|
if(val>0)
|
||||||
|
return Bit_SET;
|
||||||
|
else
|
||||||
|
return Bit_RESET;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDisplay::initDisplay()
|
||||||
|
{
|
||||||
|
for(int i=0; i<12; i++) display[i] = 0x0;
|
||||||
|
// display[0] = 0xFFFF;
|
||||||
|
// display[11] = 0xFFFF;
|
||||||
|
|
||||||
|
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
|
||||||
|
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
|
||||||
|
|
||||||
|
//Output-Pins setzen
|
||||||
|
// pinMode(BD_OE, OUTPUT);
|
||||||
|
// pinMode(BD_B0, OUTPUT);
|
||||||
|
// pinMode(BD_B1, OUTPUT);
|
||||||
|
// pinMode(BD_B2, OUTPUT);
|
||||||
|
// pinMode(BD_B3, OUTPUT);
|
||||||
|
initPin(PORT_BD, BD_OE, GPIO_Mode_Out_PP);
|
||||||
|
initPin(PORT_BD, BD_B0, GPIO_Mode_Out_PP);
|
||||||
|
initPin(PORT_BD, BD_B1, GPIO_Mode_Out_PP);
|
||||||
|
initPin(PORT_BD, BD_B2, GPIO_Mode_Out_PP);
|
||||||
|
initPin(PORT_BD, BD_B3, GPIO_Mode_Out_PP);
|
||||||
|
|
||||||
|
// pinMode(SR_SER, OUTPUT);
|
||||||
|
// pinMode(SR_RCK, OUTPUT);
|
||||||
|
// pinMode(SR_BSS, OUTPUT);
|
||||||
|
initPin(PORT_SR, SR_SER, GPIO_Mode_Out_PP);
|
||||||
|
initPin(PORT_SR, SR_RCK, GPIO_Mode_Out_PP);
|
||||||
|
initPin(PORT_SR, SR_BSS, GPIO_Mode_Out_PP);
|
||||||
|
|
||||||
|
|
||||||
|
initPin(PORT_BUZ, BUZ_PIN, GPIO_Mode_Out_PP);
|
||||||
|
|
||||||
|
|
||||||
|
// pinMode(BUT_A, INPUT);
|
||||||
|
// pinMode(BUT_B, INPUT);
|
||||||
|
initPin(PORT_AB_BUTTONS, BUT_A, GPIO_Mode_IPU);
|
||||||
|
initPin(PORT_AB_BUTTONS, BUT_B, GPIO_Mode_IPU);
|
||||||
|
|
||||||
|
GPIO_WriteBit(PORT_BD, BD_B0, LOW);
|
||||||
|
GPIO_WriteBit(PORT_BD, BD_B1, LOW);
|
||||||
|
GPIO_WriteBit(PORT_BD, BD_B2, LOW);
|
||||||
|
GPIO_WriteBit(PORT_BD, BD_B3, LOW);
|
||||||
|
GPIO_WriteBit(PORT_BD, BD_OE, LOW);
|
||||||
|
|
||||||
|
for(int i=0; i<12; i++) display[i] = 0x0000;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDisplay::shiftBit(bool bit)
|
||||||
|
{
|
||||||
|
// PORTB &= ~(1<<SR_BSS);
|
||||||
|
GPIO_WriteBit(PORT_SR, SR_BSS, LOW);
|
||||||
|
|
||||||
|
// PORTC &= ~(1<<SR_SER);
|
||||||
|
GPIO_WriteBit(PORT_SR, SR_SER, LOW);
|
||||||
|
|
||||||
|
// PORTC |= ((bit&0b1)<<SR_SER);
|
||||||
|
GPIO_WriteBit(PORT_SR, SR_SER, getBitActionFromValue(bit&0b1));
|
||||||
|
|
||||||
|
// PORTC |= (1<<SR_RCK);
|
||||||
|
GPIO_WriteBit(PORT_SR, SR_RCK, HIGH);
|
||||||
|
|
||||||
|
// PORTC &= ~(1<<SR_RCK);
|
||||||
|
GPIO_WriteBit(PORT_SR, SR_RCK, LOW);
|
||||||
|
|
||||||
|
// PORTB |= (1<<SR_BSS);
|
||||||
|
GPIO_WriteBit(PORT_SR, SR_BSS, HIGH);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDisplay::shift16BITValue(uint16_t val)
|
||||||
|
{
|
||||||
|
uint8_t i;
|
||||||
|
|
||||||
|
for(i=0; i<17; i++)
|
||||||
|
{
|
||||||
|
uint8_t bit = 0;
|
||||||
|
bit = (val >> i) & 0b1;
|
||||||
|
shiftBit(bit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDisplay::displayRow(uint8_t row)
|
||||||
|
{
|
||||||
|
// uint8_t push_val;
|
||||||
|
// row = row % 12;
|
||||||
|
// // uint16_t rval = display[row];
|
||||||
|
// // uint16_t rval = 0xFFFF - (row << 8);
|
||||||
|
// //Deactivate OE Line
|
||||||
|
// digitalWrite(BD_OE, LOW);
|
||||||
|
// PORTD &= ~(1<<BD_B0);
|
||||||
|
GPIO_WriteBit(PORT_BD, BD_B0, LOW);
|
||||||
|
// PORTD &= ~(1<<BD_B1);
|
||||||
|
GPIO_WriteBit(PORT_BD, BD_B1, LOW);
|
||||||
|
// PORTD &= ~(1<<BD_B2);
|
||||||
|
GPIO_WriteBit(PORT_BD, BD_B2, LOW);
|
||||||
|
// PORTB &= ~(1<<BD_B3);
|
||||||
|
GPIO_WriteBit(PORT_BD, BD_B3, LOW);
|
||||||
|
|
||||||
|
// //Clear shift registers
|
||||||
|
shift16BITValue(0xFFFF);
|
||||||
|
shift16BITValue(0x0000);
|
||||||
|
|
||||||
|
//Set shift reg
|
||||||
|
shift16BITValue(display[row]);
|
||||||
|
|
||||||
|
// val++;
|
||||||
|
// shift8BITValue((uint8_t)((bitmap[row]>>7) & 0xFF));
|
||||||
|
// //Now activate the corresponding row by some nice bit arithmetics ;)
|
||||||
|
GPIO_WriteBit(PORT_BD, BD_B0, getBitActionFromValue(row&0b1));
|
||||||
|
GPIO_WriteBit(PORT_BD, BD_B1, getBitActionFromValue((row>>1)&0b1));
|
||||||
|
GPIO_WriteBit(PORT_BD, BD_B2, getBitActionFromValue((row>>2)&0b1));
|
||||||
|
GPIO_WriteBit(PORT_BD, BD_B3, getBitActionFromValue((row>>3)&0b1));
|
||||||
|
GPIO_WriteBit(PORT_BD, BD_OE, LOW);
|
||||||
|
// PORTD |= ((row&0b1)<<BD_B0);
|
||||||
|
// PORTD |= (((row>>1)&0b1)<<BD_B1);
|
||||||
|
// PORTD |= (((row>>2)&0b1)<<BD_B2);
|
||||||
|
// PORTB |= (((row>>3)&0b1)<<BD_B3);
|
||||||
|
// PORTB &= ~(1<<BD_OE);
|
||||||
|
Delay_Us(400);
|
||||||
|
// PORTB |= (1<<BD_OE);
|
||||||
|
GPIO_WriteBit(PORT_BD, BD_OE, HIGH);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDisplay::drawScreen(int rdelay)
|
||||||
|
{
|
||||||
|
for(int i=0; i<12; i++)
|
||||||
|
{
|
||||||
|
displayRow(i);
|
||||||
|
Delay_Ms(rdelay);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDisplay::setRow(uint8_t row, uint16_t val)
|
||||||
|
{
|
||||||
|
display[row] = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDisplay::beep(uint16_t time_ms, uint8_t pitch)
|
||||||
|
{
|
||||||
|
// pitch = pitch & 3;
|
||||||
|
for(uint16_t i=0; i<(time_ms + (time_ms%12)); i++)
|
||||||
|
{
|
||||||
|
#ifndef BEQUIET
|
||||||
|
GPIO_WriteBit(PORT_BUZ, BUZ_PIN, HIGH);
|
||||||
|
#endif
|
||||||
|
displayRow(i%12);
|
||||||
|
Delay_Us(100 * pitch);
|
||||||
|
#ifndef BEQUIET
|
||||||
|
GPIO_WriteBit(PORT_BUZ, BUZ_PIN, LOW);
|
||||||
|
#endif
|
||||||
|
displayRow(i%12);
|
||||||
|
Delay_Us(100 * pitch);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDisplay::setPixelAt(int col, int row, bool val)
|
||||||
|
{
|
||||||
|
if(val) display[row] |= 1<<col;
|
||||||
|
else display[row] &= ~(1<<col);
|
||||||
|
}
|
||||||
31
Software/Class-Port-Ported/src/CDisplay.h
Normal file
31
Software/Class-Port-Ported/src/CDisplay.h
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
#ifndef _CDISPLAY_H_
|
||||||
|
#define _CDISPLAY_H_
|
||||||
|
#include "pins.h"
|
||||||
|
#include <ch32v20x.h>
|
||||||
|
#include <ch32v20x_adc.h>
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
|
class CDisplay
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CDisplay();
|
||||||
|
~CDisplay();
|
||||||
|
void initDisplay();
|
||||||
|
void setRow(uint8_t row, uint16_t val);
|
||||||
|
void setPixelAt(int col, int row, bool val);
|
||||||
|
void drawScreen(int rdelay=1);
|
||||||
|
void displayRow(uint8_t row);
|
||||||
|
void beep(uint16_t time_ms, uint8_t pitch);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
uint16_t display[13];
|
||||||
|
void shiftBit(bool bit);
|
||||||
|
void shift16BITValue(uint16_t val);
|
||||||
|
void initPin(GPIO_TypeDef* port, uint16_t pin, GPIOMode_TypeDef mode);
|
||||||
|
BitAction getBitActionFromValue(uint8_t val);
|
||||||
|
// enum lv {
|
||||||
|
// LOW = BitAction::Bit_RESET,
|
||||||
|
// HIGH = BitAction::Bit_SET
|
||||||
|
// };
|
||||||
|
};
|
||||||
|
#endif
|
||||||
35
Software/Class-Port-Ported/src/bitmap.h
Normal file
35
Software/Class-Port-Ported/src/bitmap.h
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
#ifndef _BITMAPS_H_
|
||||||
|
#define _BITMAPS_H_
|
||||||
|
|
||||||
|
const uint16_t bitmap[12] = {
|
||||||
|
0b1111111111111111,
|
||||||
|
0b1000000000000001,
|
||||||
|
0b1000000000000001,
|
||||||
|
0b1000000000000001,
|
||||||
|
0b1000100100010001,
|
||||||
|
0b1000100110110001,
|
||||||
|
0b1000100101010001,
|
||||||
|
0b1000100100010001,
|
||||||
|
0b1000111100010001,
|
||||||
|
0b1000000000000001,
|
||||||
|
0b1000000000000001,
|
||||||
|
0b1111111111111111
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const uint16_t buttons[12] = {
|
||||||
|
0b1111111111111111,
|
||||||
|
0b1000000000000001,
|
||||||
|
0b1000111000000001,
|
||||||
|
0b1000101000000001,
|
||||||
|
0b1011101110011101,
|
||||||
|
0b1010000010010101,
|
||||||
|
0b1011101110011101,
|
||||||
|
0b1000101011100001,
|
||||||
|
0b1000111010100001,
|
||||||
|
0b1000000011100001,
|
||||||
|
0b1000000000000001,
|
||||||
|
0b1111111111111111
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
255
Software/Class-Port-Ported/src/dpad.cpp
Normal file
255
Software/Class-Port-Ported/src/dpad.cpp
Normal file
@ -0,0 +1,255 @@
|
|||||||
|
#include <ch32v20x.h>
|
||||||
|
#include <ch32v20x_adc.h>
|
||||||
|
#include <debug.h>
|
||||||
|
#include "pins.h"
|
||||||
|
#include "bitmap.h"
|
||||||
|
#include "CDisplay.h"
|
||||||
|
// #define BEQUIET
|
||||||
|
|
||||||
|
|
||||||
|
uint16_t ud_adc = 0;
|
||||||
|
uint16_t lr_adc = 0;
|
||||||
|
bool ba = false;
|
||||||
|
bool bb = false;
|
||||||
|
|
||||||
|
CDisplay disp;
|
||||||
|
|
||||||
|
s16 Calibrattion_Val = 0;
|
||||||
|
|
||||||
|
void adc_init(uint8_t ch)
|
||||||
|
{
|
||||||
|
ADC_InitTypeDef ADC_InitStructure = {0};
|
||||||
|
GPIO_InitTypeDef GPIO_InitStructure = {0};
|
||||||
|
|
||||||
|
switch (ch) {
|
||||||
|
case 0: // PA2
|
||||||
|
case 1: // PA1
|
||||||
|
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
|
||||||
|
break;
|
||||||
|
case 2: // PC4
|
||||||
|
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC, ENABLE);
|
||||||
|
break;
|
||||||
|
case 3: // PD2
|
||||||
|
case 4: // PD3
|
||||||
|
case 5: // PD5
|
||||||
|
case 6: // PD6
|
||||||
|
case 7: // PD4
|
||||||
|
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOD, ENABLE);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void initPin(GPIO_TypeDef* port, uint16_t pin, GPIOMode_TypeDef mode)
|
||||||
|
{
|
||||||
|
GPIO_InitTypeDef GPIO_InitStructure = {0};
|
||||||
|
GPIO_InitStructure.GPIO_Pin = pin;
|
||||||
|
GPIO_InitStructure.GPIO_Mode = mode;
|
||||||
|
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
|
||||||
|
GPIO_Init(port, &GPIO_InitStructure);
|
||||||
|
}
|
||||||
|
|
||||||
|
void initADC()
|
||||||
|
{
|
||||||
|
ADC_InitTypeDef ADC_InitStructure = {0};
|
||||||
|
|
||||||
|
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
|
||||||
|
RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1, ENABLE);
|
||||||
|
|
||||||
|
RCC_ADCCLKConfig(RCC_PCLK2_Div8);
|
||||||
|
|
||||||
|
initPin(PORT_ADC, ADC_LR, GPIO_Mode_AIN);
|
||||||
|
initPin(PORT_ADC, ADC_UD, GPIO_Mode_AIN);
|
||||||
|
|
||||||
|
ADC_DeInit(ADC1);
|
||||||
|
ADC_InitStructure.ADC_Mode = ADC_Mode_Independent;
|
||||||
|
ADC_InitStructure.ADC_ScanConvMode = DISABLE;
|
||||||
|
ADC_InitStructure.ADC_ContinuousConvMode = DISABLE;
|
||||||
|
ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_None;
|
||||||
|
ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right;
|
||||||
|
ADC_InitStructure.ADC_NbrOfChannel = 1;
|
||||||
|
ADC_Init(ADC1, &ADC_InitStructure);
|
||||||
|
|
||||||
|
ADC_Cmd(ADC1, ENABLE);
|
||||||
|
|
||||||
|
ADC_ResetCalibration(ADC1);
|
||||||
|
while (ADC_GetResetCalibrationStatus(ADC1));
|
||||||
|
ADC_StartCalibration(ADC1);
|
||||||
|
while (ADC_GetCalibrationStatus(ADC1));
|
||||||
|
Calibrattion_Val = Get_CalibrationValue(ADC1);
|
||||||
|
|
||||||
|
ADC_TempSensorVrefintCmd(ENABLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
u16 Get_ADC_Val(u8 ch)
|
||||||
|
{
|
||||||
|
u16 val;
|
||||||
|
|
||||||
|
#if defined(CH32L10X)
|
||||||
|
ADC_RegularChannelConfig(ADC1, ch, 1, ADC_SampleTime_CyclesMode7);
|
||||||
|
#else
|
||||||
|
ADC_RegularChannelConfig(ADC1, ch, 1, ADC_SampleTime_239Cycles5);
|
||||||
|
#endif
|
||||||
|
ADC_SoftwareStartConvCmd(ADC1, ENABLE);
|
||||||
|
|
||||||
|
while (!ADC_GetFlagStatus(ADC1, ADC_FLAG_EOC))
|
||||||
|
;
|
||||||
|
|
||||||
|
val = ADC_GetConversionValue(ADC1);
|
||||||
|
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
void USSR()
|
||||||
|
{
|
||||||
|
disp.beep(100, 15);
|
||||||
|
disp.beep(300, 10);
|
||||||
|
disp.beep(100, 15);
|
||||||
|
disp.beep(100, 13);
|
||||||
|
disp.beep(300, 11);
|
||||||
|
disp.beep(70, 19);
|
||||||
|
Delay_Ms(10);
|
||||||
|
disp.beep(70, 19);
|
||||||
|
disp.beep(200,13);
|
||||||
|
disp.beep(100, 15);
|
||||||
|
disp.beep(100, 18);
|
||||||
|
disp.beep(200, 15);
|
||||||
|
disp.beep(70, 25);
|
||||||
|
Delay_Ms(10);
|
||||||
|
disp.beep(70, 25);
|
||||||
|
disp.beep(185,23);
|
||||||
|
Delay_Ms(10);
|
||||||
|
disp.beep(70,23);
|
||||||
|
disp.beep(70,20);
|
||||||
|
disp.beep(185,18);
|
||||||
|
Delay_Ms(10);
|
||||||
|
disp.beep(70,18);
|
||||||
|
disp.beep(100, 15);
|
||||||
|
disp.beep(200, 13);
|
||||||
|
disp.beep(140, 11);
|
||||||
|
disp.beep(125, 10);
|
||||||
|
disp.beep(300, 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
void displayButtonPresses()
|
||||||
|
{
|
||||||
|
// switch(row)
|
||||||
|
// {
|
||||||
|
// case 2:
|
||||||
|
// // display[row] |= ud_adc;
|
||||||
|
// break;
|
||||||
|
// case 3:
|
||||||
|
// if(ud_adc > 2200) display[row] |= 1<<10;
|
||||||
|
// break;
|
||||||
|
// case 4:
|
||||||
|
// if(ud_adc > 2200) display[row] |= 1<<10;
|
||||||
|
// break;
|
||||||
|
// case 5:
|
||||||
|
// if(ba) display[row] |= 1<<3;
|
||||||
|
// //Links
|
||||||
|
// if(lr_adc > 2200) display[row] |= 0b11 << 11;
|
||||||
|
// //Rechts
|
||||||
|
// if(lr_adc < 2000) display[row] |= 0b11 << 8;
|
||||||
|
// break;
|
||||||
|
// case 6:
|
||||||
|
// if(ud_adc < 2000) display[row] |= 1<<10;
|
||||||
|
// break;
|
||||||
|
|
||||||
|
// case 7:
|
||||||
|
// if(ud_adc < 2000) display[row] |= 1<<10;
|
||||||
|
// break;
|
||||||
|
|
||||||
|
// case 8:
|
||||||
|
// if(bb) display[row] |= 1<<6;
|
||||||
|
// break;
|
||||||
|
|
||||||
|
// case 10:
|
||||||
|
// // display[row] |= lr_adc;
|
||||||
|
// break;
|
||||||
|
// default:
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
if(ud_adc > 2200)
|
||||||
|
{
|
||||||
|
disp.setPixelAt(10, 3, true);
|
||||||
|
disp.setPixelAt(10, 4, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ud_adc < 2000)
|
||||||
|
{
|
||||||
|
disp.setPixelAt(10, 6, true);
|
||||||
|
disp.setPixelAt(10, 7, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(lr_adc > 2200)
|
||||||
|
{
|
||||||
|
disp.setPixelAt(11, 5, true);
|
||||||
|
disp.setPixelAt(12, 5, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(lr_adc < 2000)
|
||||||
|
{
|
||||||
|
disp.setPixelAt(8, 5, true);
|
||||||
|
disp.setPixelAt(9, 5, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(bb) disp.setPixelAt(6, 8, true);
|
||||||
|
if(ba) disp.setPixelAt(3, 5, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
// USSR();
|
||||||
|
// 2 bits for pre-emption priority and 2 bits for subpriority.
|
||||||
|
// NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
|
||||||
|
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
|
||||||
|
|
||||||
|
// Update system core clock update
|
||||||
|
SystemCoreClockUpdate();
|
||||||
|
|
||||||
|
Delay_Init();
|
||||||
|
|
||||||
|
disp.initDisplay();
|
||||||
|
for(int i=0; i<12; i++) disp.setRow(i, bitmap[i]);
|
||||||
|
|
||||||
|
// pinMode(BUT_A, INPUT);
|
||||||
|
// pinMode(BUT_B, INPUT);
|
||||||
|
initPin(PORT_AB_BUTTONS, BUT_A, GPIO_Mode_IPU);
|
||||||
|
initPin(PORT_AB_BUTTONS, BUT_B, GPIO_Mode_IPU);
|
||||||
|
|
||||||
|
// initPin(PORT_ADC, ADC_LR, GPIO_Mode_AIN);
|
||||||
|
// initPin(PORT_ADC, ADC_UD, GPIO_Mode_AIN);
|
||||||
|
|
||||||
|
initADC();
|
||||||
|
|
||||||
|
disp.beep(100, 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
// // put your main code here, to run repeatedly
|
||||||
|
// ba = digitalRead(BUT_A);
|
||||||
|
// bb = digitalRead(BUT_B);
|
||||||
|
ba = ( GPIO_ReadInputDataBit(PORT_AB_BUTTONS, BUT_A) > 0);
|
||||||
|
bb = ( GPIO_ReadInputDataBit(PORT_AB_BUTTONS, BUT_B) > 0);
|
||||||
|
|
||||||
|
// ud_adc = analogRead(ADC_UD);
|
||||||
|
// lr_adc = analogRead(ADC_LR);
|
||||||
|
ud_adc = Get_ADC_Val(ADC_Channel_9);
|
||||||
|
lr_adc = Get_ADC_Val(ADC_Channel_8);
|
||||||
|
|
||||||
|
for(int i=0; i<12; i++) disp.setRow(i, buttons[i]);
|
||||||
|
displayButtonPresses();
|
||||||
|
disp.drawScreen(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
setup();
|
||||||
|
// USSR();
|
||||||
|
|
||||||
|
while(1)
|
||||||
|
{
|
||||||
|
loop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
288
Software/Class-Port-Ported/src/font5x7.h
Normal file
288
Software/Class-Port-Ported/src/font5x7.h
Normal file
@ -0,0 +1,288 @@
|
|||||||
|
#ifndef _FONT5X7_H_
|
||||||
|
#define _FONT5X7_H_
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Take 'A' as example.
|
||||||
|
* 'A' use 5 byte to denote:
|
||||||
|
* 0x7C, 0x12, 0x11, 0x12, 0x7C
|
||||||
|
*
|
||||||
|
* and we represent it in base 2:
|
||||||
|
* 0x7C: 01111100
|
||||||
|
* 0x12: 00010010
|
||||||
|
* 0x11: 00010001
|
||||||
|
* 0x12: 00010010
|
||||||
|
* 0x7C: 01111100
|
||||||
|
* where 1 is font color, and 0 is background color
|
||||||
|
*
|
||||||
|
* So it's 'A' if we look it in counter-clockwise for 90 degree.
|
||||||
|
* In general case, we also add a background line to seperate from other character:
|
||||||
|
* 0x7C: 01111100
|
||||||
|
* 0x12: 00010010
|
||||||
|
* 0x11: 00010001
|
||||||
|
* 0x12: 00010010
|
||||||
|
* 0x7C: 01111100
|
||||||
|
* 0x00: 00000000
|
||||||
|
*
|
||||||
|
**/
|
||||||
|
|
||||||
|
// standard ascii 5x7 font
|
||||||
|
const static unsigned char font5x7[] PROGMEM = {
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, // 0x00 (nul)
|
||||||
|
0x3E, 0x5B, 0x4F, 0x5B, 0x3E, // 0x01 (soh)
|
||||||
|
0x3E, 0x6B, 0x4F, 0x6B, 0x3E, // 0x02 (stx)
|
||||||
|
0x1C, 0x3E, 0x7C, 0x3E, 0x1C, // 0x03 (etx)
|
||||||
|
0x18, 0x3C, 0x7E, 0x3C, 0x18, // 0x04 (eot)
|
||||||
|
0x1C, 0x57, 0x7D, 0x57, 0x1C, // 0x05 (enq)
|
||||||
|
0x1C, 0x5E, 0x7F, 0x5E, 0x1C, // 0x06 (ack)
|
||||||
|
0x00, 0x18, 0x3C, 0x18, 0x00, // 0x07 (bel)
|
||||||
|
0xFF, 0xE7, 0xC3, 0xE7, 0xFF, // 0x08 (bs)
|
||||||
|
0x00, 0x18, 0x24, 0x18, 0x00, // 0x09 (tab)
|
||||||
|
0xFF, 0xE7, 0xDB, 0xE7, 0xFF, // 0x0A (lf)
|
||||||
|
0x30, 0x48, 0x3A, 0x06, 0x0E, // 0x0B (vt)
|
||||||
|
0x26, 0x29, 0x79, 0x29, 0x26, // 0x0C (np)
|
||||||
|
0x40, 0x7F, 0x05, 0x05, 0x07, // 0x0D (cr)
|
||||||
|
0x40, 0x7F, 0x05, 0x25, 0x3F, // 0x0E (so)
|
||||||
|
0x5A, 0x3C, 0xE7, 0x3C, 0x5A, // 0x0F (si)
|
||||||
|
0x7F, 0x3E, 0x1C, 0x1C, 0x08, // 0x10 (dle)
|
||||||
|
0x08, 0x1C, 0x1C, 0x3E, 0x7F, // 0x11 (dc1)
|
||||||
|
0x14, 0x22, 0x7F, 0x22, 0x14, // 0x12 (dc2)
|
||||||
|
0x5F, 0x5F, 0x00, 0x5F, 0x5F, // 0x13 (dc3)
|
||||||
|
0x06, 0x09, 0x7F, 0x01, 0x7F, // 0x14 (dc4)
|
||||||
|
0x00, 0x66, 0x89, 0x95, 0x6A, // 0x15 (nak)
|
||||||
|
0x60, 0x60, 0x60, 0x60, 0x60, // 0x16 (syn)
|
||||||
|
0x94, 0xA2, 0xFF, 0xA2, 0x94, // 0x17 (etb)
|
||||||
|
0x08, 0x04, 0x7E, 0x04, 0x08, // 0x18 (can)
|
||||||
|
0x10, 0x20, 0x7E, 0x20, 0x10, // 0x19 (em)
|
||||||
|
0x08, 0x08, 0x2A, 0x1C, 0x08, // 0x1A (eof)
|
||||||
|
0x08, 0x1C, 0x2A, 0x08, 0x08, // 0x1B (esc)
|
||||||
|
0x1E, 0x10, 0x10, 0x10, 0x10, // 0x1C (fs)
|
||||||
|
0x0C, 0x1E, 0x0C, 0x1E, 0x0C, // 0x1D (gs)
|
||||||
|
0x30, 0x38, 0x3E, 0x38, 0x30, // 0x1E (rs)
|
||||||
|
0x06, 0x0E, 0x3E, 0x0E, 0x06, // 0x1F (us)
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, // 0x20
|
||||||
|
0x00, 0x00, 0x5F, 0x00, 0x00, // 0x21 !
|
||||||
|
0x00, 0x07, 0x00, 0x07, 0x00, // 0x22 "
|
||||||
|
0x14, 0x7F, 0x14, 0x7F, 0x14, // 0x23 #
|
||||||
|
0x24, 0x2A, 0x7F, 0x2A, 0x12, // 0x24 $
|
||||||
|
0x23, 0x13, 0x08, 0x64, 0x62, // 0x25 %
|
||||||
|
0x36, 0x49, 0x56, 0x20, 0x50, // 0x26 &
|
||||||
|
0x00, 0x08, 0x07, 0x03, 0x00, // 0x27 '
|
||||||
|
0x00, 0x1C, 0x22, 0x41, 0x00, // 0x28 (
|
||||||
|
0x00, 0x41, 0x22, 0x1C, 0x00, // 0x29 )
|
||||||
|
0x2A, 0x1C, 0x7F, 0x1C, 0x2A, // 0x2A *
|
||||||
|
0x08, 0x08, 0x3E, 0x08, 0x08, // 0x2B +
|
||||||
|
0x00, 0x80, 0x70, 0x30, 0x00, // 0x2C ,
|
||||||
|
0x08, 0x08, 0x08, 0x08, 0x08, // 0x2D -
|
||||||
|
0x00, 0x00, 0x60, 0x60, 0x00, // 0x2E .
|
||||||
|
0x20, 0x10, 0x08, 0x04, 0x02, // 0x2F /
|
||||||
|
0x3E, 0x51, 0x49, 0x45, 0x3E, // 0x30 0
|
||||||
|
0x00, 0x42, 0x7F, 0x40, 0x00, // 0x31 1
|
||||||
|
0x72, 0x49, 0x49, 0x49, 0x46, // 0x32 2
|
||||||
|
0x21, 0x41, 0x49, 0x4D, 0x33, // 0x33 3
|
||||||
|
0x18, 0x14, 0x12, 0x7F, 0x10, // 0x34 4
|
||||||
|
0x27, 0x45, 0x45, 0x45, 0x39, // 0x35 5
|
||||||
|
0x3C, 0x4A, 0x49, 0x49, 0x31, // 0x36 6
|
||||||
|
0x41, 0x21, 0x11, 0x09, 0x07, // 0x37 7
|
||||||
|
0x36, 0x49, 0x49, 0x49, 0x36, // 0x38 8
|
||||||
|
0x46, 0x49, 0x49, 0x29, 0x1E, // 0x39 9
|
||||||
|
0x00, 0x00, 0x14, 0x00, 0x00, // 0x3A :
|
||||||
|
0x00, 0x40, 0x34, 0x00, 0x00, // 0x3B ;
|
||||||
|
0x00, 0x08, 0x14, 0x22, 0x41, // 0x3C <
|
||||||
|
0x14, 0x14, 0x14, 0x14, 0x14, // 0x3D =
|
||||||
|
0x00, 0x41, 0x22, 0x14, 0x08, // 0x3E >
|
||||||
|
0x02, 0x01, 0x59, 0x09, 0x06, // 0x3F ?
|
||||||
|
0x3E, 0x41, 0x5D, 0x59, 0x4E, // 0x40 @
|
||||||
|
0x7C, 0x12, 0x11, 0x12, 0x7C, // 0x41 A
|
||||||
|
0x7F, 0x49, 0x49, 0x49, 0x36, // 0x42 B
|
||||||
|
0x3E, 0x41, 0x41, 0x41, 0x22, // 0x43 C
|
||||||
|
0x7F, 0x41, 0x41, 0x41, 0x3E, // 0x44 D
|
||||||
|
0x7F, 0x49, 0x49, 0x49, 0x41, // 0x45 E
|
||||||
|
0x7F, 0x09, 0x09, 0x09, 0x01, // 0x46 F
|
||||||
|
0x3E, 0x41, 0x41, 0x51, 0x73, // 0x47 G
|
||||||
|
0x7F, 0x08, 0x08, 0x08, 0x7F, // 0x48 H
|
||||||
|
0x00, 0x41, 0x7F, 0x41, 0x00, // 0x49 I
|
||||||
|
0x20, 0x40, 0x41, 0x3F, 0x01, // 0x4A J
|
||||||
|
0x7F, 0x08, 0x14, 0x22, 0x41, // 0x4B K
|
||||||
|
0x7F, 0x40, 0x40, 0x40, 0x40, // 0x4C L
|
||||||
|
0x7F, 0x02, 0x1C, 0x02, 0x7F, // 0x4D M
|
||||||
|
0x7F, 0x04, 0x08, 0x10, 0x7F, // 0x4E N
|
||||||
|
0x3E, 0x41, 0x41, 0x41, 0x3E, // 0x4F O
|
||||||
|
0x7F, 0x09, 0x09, 0x09, 0x06, // 0x50 P
|
||||||
|
0x3E, 0x41, 0x51, 0x21, 0x5E, // 0x51 Q
|
||||||
|
0x7F, 0x09, 0x19, 0x29, 0x46, // 0x52 R
|
||||||
|
0x26, 0x49, 0x49, 0x49, 0x32, // 0x53 S
|
||||||
|
0x03, 0x01, 0x7F, 0x01, 0x03, // 0x54 T
|
||||||
|
0x3F, 0x40, 0x40, 0x40, 0x3F, // 0x55 U
|
||||||
|
0x1F, 0x20, 0x40, 0x20, 0x1F, // 0x56 V
|
||||||
|
0x3F, 0x40, 0x38, 0x40, 0x3F, // 0x57 W
|
||||||
|
0x63, 0x14, 0x08, 0x14, 0x63, // 0x58 X
|
||||||
|
0x03, 0x04, 0x78, 0x04, 0x03, // 0x59 Y
|
||||||
|
0x61, 0x59, 0x49, 0x4D, 0x43, // 0x5A Z
|
||||||
|
0x00, 0x7F, 0x41, 0x41, 0x41, // 0x5B [
|
||||||
|
0x02, 0x04, 0x08, 0x10, 0x20, // 0x5C backslash
|
||||||
|
0x00, 0x41, 0x41, 0x41, 0x7F, // 0x5D ]
|
||||||
|
0x04, 0x02, 0x01, 0x02, 0x04, // 0x5E ^
|
||||||
|
0x40, 0x40, 0x40, 0x40, 0x40, // 0x5F _
|
||||||
|
0x00, 0x03, 0x07, 0x08, 0x00, // 0x60 `
|
||||||
|
0x20, 0x54, 0x54, 0x78, 0x40, // 0x61 a
|
||||||
|
0x7F, 0x28, 0x44, 0x44, 0x38, // 0x62 b
|
||||||
|
0x38, 0x44, 0x44, 0x44, 0x28, // 0x63 c
|
||||||
|
0x38, 0x44, 0x44, 0x28, 0x7F, // 0x64 d
|
||||||
|
0x38, 0x54, 0x54, 0x54, 0x18, // 0x65 e
|
||||||
|
0x00, 0x08, 0x7E, 0x09, 0x02, // 0x66 f
|
||||||
|
0x18, 0xA4, 0xA4, 0x9C, 0x78, // 0x67 g
|
||||||
|
0x7F, 0x08, 0x04, 0x04, 0x78, // 0x68 h
|
||||||
|
0x00, 0x44, 0x7D, 0x40, 0x00, // 0x69 i
|
||||||
|
0x20, 0x40, 0x40, 0x3D, 0x00, // 0x6A j
|
||||||
|
0x7F, 0x10, 0x28, 0x44, 0x00, // 0x6B k
|
||||||
|
0x00, 0x41, 0x7F, 0x40, 0x00, // 0x6C l
|
||||||
|
0x7C, 0x04, 0x78, 0x04, 0x78, // 0x6D m
|
||||||
|
0x7C, 0x08, 0x04, 0x04, 0x78, // 0x6E n
|
||||||
|
0x38, 0x44, 0x44, 0x44, 0x38, // 0x6F o
|
||||||
|
0xFC, 0x18, 0x24, 0x24, 0x18, // 0x70 p
|
||||||
|
0x18, 0x24, 0x24, 0x18, 0xFC, // 0x71 q
|
||||||
|
0x7C, 0x08, 0x04, 0x04, 0x08, // 0x72 r
|
||||||
|
0x48, 0x54, 0x54, 0x54, 0x24, // 0x73 s
|
||||||
|
0x04, 0x04, 0x3F, 0x44, 0x24, // 0x74 t
|
||||||
|
0x3C, 0x40, 0x40, 0x20, 0x7C, // 0x75 u
|
||||||
|
0x1C, 0x20, 0x40, 0x20, 0x1C, // 0x76 v
|
||||||
|
0x3C, 0x40, 0x30, 0x40, 0x3C, // 0x77 w
|
||||||
|
0x44, 0x28, 0x10, 0x28, 0x44, // 0x78 x
|
||||||
|
0x4C, 0x90, 0x90, 0x90, 0x7C, // 0x79 y
|
||||||
|
0x44, 0x64, 0x54, 0x4C, 0x44, // 0x7A z
|
||||||
|
0x00, 0x08, 0x36, 0x41, 0x00, // 0x7B {
|
||||||
|
0x00, 0x00, 0x77, 0x00, 0x00, // 0x7C |
|
||||||
|
0x00, 0x41, 0x36, 0x08, 0x00, // 0x7D }
|
||||||
|
0x02, 0x01, 0x02, 0x04, 0x02, // 0x7E ~
|
||||||
|
0x3C, 0x26, 0x23, 0x26, 0x3C, // 0x7F
|
||||||
|
0x1E, 0xA1, 0xA1, 0x61, 0x12, // 0x80
|
||||||
|
0x3A, 0x40, 0x40, 0x20, 0x7A, // 0x81
|
||||||
|
0x38, 0x54, 0x54, 0x55, 0x59, // 0x82
|
||||||
|
0x21, 0x55, 0x55, 0x79, 0x41, // 0x83
|
||||||
|
0x22, 0x54, 0x54, 0x78, 0x42, // 0x84
|
||||||
|
0x21, 0x55, 0x54, 0x78, 0x40, // 0x85
|
||||||
|
0x20, 0x54, 0x55, 0x79, 0x40, // 0x86
|
||||||
|
0x0C, 0x1E, 0x52, 0x72, 0x12, // 0x87
|
||||||
|
0x39, 0x55, 0x55, 0x55, 0x59, // 0x88
|
||||||
|
0x39, 0x54, 0x54, 0x54, 0x59, // 0x89
|
||||||
|
0x39, 0x55, 0x54, 0x54, 0x58, // 0x8A
|
||||||
|
0x00, 0x00, 0x45, 0x7C, 0x41, // 0x8B
|
||||||
|
0x00, 0x02, 0x45, 0x7D, 0x42, // 0x8C
|
||||||
|
0x00, 0x01, 0x45, 0x7C, 0x40, // 0x8D
|
||||||
|
0x7D, 0x12, 0x11, 0x12, 0x7D, // 0x8E
|
||||||
|
0xF0, 0x28, 0x25, 0x28, 0xF0, // 0x8F
|
||||||
|
0x7C, 0x54, 0x55, 0x45, 0x00, // 0x90
|
||||||
|
0x20, 0x54, 0x54, 0x7C, 0x54, // 0x91
|
||||||
|
0x7C, 0x0A, 0x09, 0x7F, 0x49, // 0x92
|
||||||
|
0x32, 0x49, 0x49, 0x49, 0x32, // 0x93
|
||||||
|
0x3A, 0x44, 0x44, 0x44, 0x3A, // 0x94
|
||||||
|
0x32, 0x4A, 0x48, 0x48, 0x30, // 0x95
|
||||||
|
0x3A, 0x41, 0x41, 0x21, 0x7A, // 0x96
|
||||||
|
0x3A, 0x42, 0x40, 0x20, 0x78, // 0x97
|
||||||
|
0x00, 0x9D, 0xA0, 0xA0, 0x7D, // 0x98
|
||||||
|
0x3D, 0x42, 0x42, 0x42, 0x3D, // 0x99
|
||||||
|
0x3D, 0x40, 0x40, 0x40, 0x3D, // 0x9A
|
||||||
|
0x3C, 0x24, 0xFF, 0x24, 0x24, // 0x9B
|
||||||
|
0x48, 0x7E, 0x49, 0x43, 0x66, // 0x9C
|
||||||
|
0x2B, 0x2F, 0xFC, 0x2F, 0x2B, // 0x9D
|
||||||
|
0xFF, 0x09, 0x29, 0xF6, 0x20, // 0x9E
|
||||||
|
0xC0, 0x88, 0x7E, 0x09, 0x03, // 0x9F
|
||||||
|
0x20, 0x54, 0x54, 0x79, 0x41, // 0xA0
|
||||||
|
0x00, 0x00, 0x44, 0x7D, 0x41, // 0xA1
|
||||||
|
0x30, 0x48, 0x48, 0x4A, 0x32, // 0xA2
|
||||||
|
0x38, 0x40, 0x40, 0x22, 0x7A, // 0xA3
|
||||||
|
0x00, 0x7A, 0x0A, 0x0A, 0x72, // 0xA4
|
||||||
|
0x7D, 0x0D, 0x19, 0x31, 0x7D, // 0xA5
|
||||||
|
0x26, 0x29, 0x29, 0x2F, 0x28, // 0xA6
|
||||||
|
0x26, 0x29, 0x29, 0x29, 0x26, // 0xA7
|
||||||
|
0x30, 0x48, 0x4D, 0x40, 0x20, // 0xA8
|
||||||
|
0x38, 0x08, 0x08, 0x08, 0x08, // 0xA9
|
||||||
|
0x08, 0x08, 0x08, 0x08, 0x38, // 0xAA
|
||||||
|
0x2F, 0x10, 0xC8, 0xAC, 0xBA, // 0xAB
|
||||||
|
0x2F, 0x10, 0x28, 0x34, 0xFA, // 0xAC
|
||||||
|
0x00, 0x00, 0x7B, 0x00, 0x00, // 0xAD
|
||||||
|
0x08, 0x14, 0x2A, 0x14, 0x22, // 0xAE
|
||||||
|
0x22, 0x14, 0x2A, 0x14, 0x08, // 0xAF
|
||||||
|
0x55, 0x00, 0x55, 0x00, 0x55, // 0xB0
|
||||||
|
0xAA, 0x55, 0xAA, 0x55, 0xAA, // 0xB1
|
||||||
|
0xFF, 0x55, 0xFF, 0x55, 0xFF, // 0xB2
|
||||||
|
0x00, 0x00, 0x00, 0xFF, 0x00, // 0xB3
|
||||||
|
0x10, 0x10, 0x10, 0xFF, 0x00, // 0xB4
|
||||||
|
0x14, 0x14, 0x14, 0xFF, 0x00, // 0xB5
|
||||||
|
0x10, 0x10, 0xFF, 0x00, 0xFF, // 0xB6
|
||||||
|
0x10, 0x10, 0xF0, 0x10, 0xF0, // 0xB7
|
||||||
|
0x14, 0x14, 0x14, 0xFC, 0x00, // 0xB8
|
||||||
|
0x14, 0x14, 0xF7, 0x00, 0xFF, // 0xB9
|
||||||
|
0x00, 0x00, 0xFF, 0x00, 0xFF, // 0xBA
|
||||||
|
0x14, 0x14, 0xF4, 0x04, 0xFC, // 0xBB
|
||||||
|
0x14, 0x14, 0x17, 0x10, 0x1F, // 0xBC
|
||||||
|
0x10, 0x10, 0x1F, 0x10, 0x1F, // 0xBD
|
||||||
|
0x14, 0x14, 0x14, 0x1F, 0x00, // 0xBE
|
||||||
|
0x10, 0x10, 0x10, 0xF0, 0x00, // 0xBF
|
||||||
|
0x00, 0x00, 0x00, 0x1F, 0x10, // 0xC0
|
||||||
|
0x10, 0x10, 0x10, 0x1F, 0x10, // 0xC1
|
||||||
|
0x10, 0x10, 0x10, 0xF0, 0x10, // 0xC2
|
||||||
|
0x00, 0x00, 0x00, 0xFF, 0x10, // 0xC3
|
||||||
|
0x10, 0x10, 0x10, 0x10, 0x10, // 0xC4
|
||||||
|
0x10, 0x10, 0x10, 0xFF, 0x10, // 0xC5
|
||||||
|
0x00, 0x00, 0x00, 0xFF, 0x14, // 0xC6
|
||||||
|
0x00, 0x00, 0xFF, 0x00, 0xFF, // 0xC7
|
||||||
|
0x00, 0x00, 0x1F, 0x10, 0x17, // 0xC8
|
||||||
|
0x00, 0x00, 0xFC, 0x04, 0xF4, // 0xC9
|
||||||
|
0x14, 0x14, 0x17, 0x10, 0x17, // 0xCA
|
||||||
|
0x14, 0x14, 0xF4, 0x04, 0xF4, // 0xCB
|
||||||
|
0x00, 0x00, 0xFF, 0x00, 0xF7, // 0xCC
|
||||||
|
0x14, 0x14, 0x14, 0x14, 0x14, // 0xCD
|
||||||
|
0x14, 0x14, 0xF7, 0x00, 0xF7, // 0xCE
|
||||||
|
0x14, 0x14, 0x14, 0x17, 0x14, // 0xCF
|
||||||
|
0x10, 0x10, 0x1F, 0x10, 0x1F, // 0xD0
|
||||||
|
0x14, 0x14, 0x14, 0xF4, 0x14, // 0xD1
|
||||||
|
0x10, 0x10, 0xF0, 0x10, 0xF0, // 0xD2
|
||||||
|
0x00, 0x00, 0x1F, 0x10, 0x1F, // 0xD3
|
||||||
|
0x00, 0x00, 0x00, 0x1F, 0x14, // 0xD4
|
||||||
|
0x00, 0x00, 0x00, 0xFC, 0x14, // 0xD5
|
||||||
|
0x00, 0x00, 0xF0, 0x10, 0xF0, // 0xD6
|
||||||
|
0x10, 0x10, 0xFF, 0x10, 0xFF, // 0xD7
|
||||||
|
0x14, 0x14, 0x14, 0xFF, 0x14, // 0xD8
|
||||||
|
0x10, 0x10, 0x10, 0x1F, 0x00, // 0xD9
|
||||||
|
0x00, 0x00, 0x00, 0xF0, 0x10, // 0xDA
|
||||||
|
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // 0xDB
|
||||||
|
0xF0, 0xF0, 0xF0, 0xF0, 0xF0, // 0xDC
|
||||||
|
0xFF, 0xFF, 0xFF, 0x00, 0x00, // 0xDD
|
||||||
|
0x00, 0x00, 0x00, 0xFF, 0xFF, // 0xDE
|
||||||
|
0x0F, 0x0F, 0x0F, 0x0F, 0x0F, // 0xDF
|
||||||
|
0x38, 0x44, 0x44, 0x38, 0x44, // 0xE0
|
||||||
|
0xFC, 0x4A, 0x4A, 0x4A, 0x34, // 0xE1
|
||||||
|
0x7E, 0x02, 0x02, 0x06, 0x06, // 0xE2
|
||||||
|
0x02, 0x7E, 0x02, 0x7E, 0x02, // 0xE3
|
||||||
|
0x63, 0x55, 0x49, 0x41, 0x63, // 0xE4
|
||||||
|
0x38, 0x44, 0x44, 0x3C, 0x04, // 0xE5
|
||||||
|
0x40, 0x7E, 0x20, 0x1E, 0x20, // 0xE6
|
||||||
|
0x06, 0x02, 0x7E, 0x02, 0x02, // 0xE7
|
||||||
|
0x99, 0xA5, 0xE7, 0xA5, 0x99, // 0xE8
|
||||||
|
0x1C, 0x2A, 0x49, 0x2A, 0x1C, // 0xE9
|
||||||
|
0x4C, 0x72, 0x01, 0x72, 0x4C, // 0xEA
|
||||||
|
0x30, 0x4A, 0x4D, 0x4D, 0x30, // 0xEB
|
||||||
|
0x30, 0x48, 0x78, 0x48, 0x30, // 0xEC
|
||||||
|
0xBC, 0x62, 0x5A, 0x46, 0x3D, // 0xED
|
||||||
|
0x3E, 0x49, 0x49, 0x49, 0x00, // 0xEE
|
||||||
|
0x7E, 0x01, 0x01, 0x01, 0x7E, // 0xEF
|
||||||
|
0x2A, 0x2A, 0x2A, 0x2A, 0x2A, // 0xF0
|
||||||
|
0x44, 0x44, 0x5F, 0x44, 0x44, // 0xF1
|
||||||
|
0x40, 0x51, 0x4A, 0x44, 0x40, // 0xF2
|
||||||
|
0x40, 0x44, 0x4A, 0x51, 0x40, // 0xF3
|
||||||
|
0x00, 0x00, 0xFF, 0x01, 0x03, // 0xF4
|
||||||
|
0xE0, 0x80, 0xFF, 0x00, 0x00, // 0xF5
|
||||||
|
0x08, 0x08, 0x6B, 0x6B, 0x08, // 0xF6
|
||||||
|
0x36, 0x12, 0x36, 0x24, 0x36, // 0xF7
|
||||||
|
0x06, 0x0F, 0x09, 0x0F, 0x06, // 0xF8
|
||||||
|
0x00, 0x00, 0x18, 0x18, 0x00, // 0xF9
|
||||||
|
0x00, 0x00, 0x10, 0x10, 0x00, // 0xFA
|
||||||
|
0x30, 0x40, 0xFF, 0x01, 0x01, // 0xFB
|
||||||
|
0x00, 0x1F, 0x01, 0x01, 0x1E, // 0xFC
|
||||||
|
0x00, 0x19, 0x1D, 0x17, 0x12, // 0xFD
|
||||||
|
0x00, 0x3C, 0x3C, 0x3C, 0x3C, // 0xFE
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00 // 0xFF
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
38
Software/Class-Port-Ported/src/pins.h
Normal file
38
Software/Class-Port-Ported/src/pins.h
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
#ifndef _PINS_H_
|
||||||
|
#define _PINS_H_
|
||||||
|
#include <ch32v20x.h>
|
||||||
|
|
||||||
|
#ifdef CH32V203
|
||||||
|
//Pins Shift Register
|
||||||
|
#define PORT_SR GPIOA
|
||||||
|
#define SR_SER GPIO_Pin_5
|
||||||
|
#define SR_RCK GPIO_Pin_6
|
||||||
|
#define SR_BSS GPIO_Pin_7
|
||||||
|
|
||||||
|
//Pins 74154 Binary Decoder (for Rows)
|
||||||
|
#define PORT_BD GPIOB
|
||||||
|
#define BD_OE GPIO_Pin_5
|
||||||
|
#define BD_B0 GPIO_Pin_9
|
||||||
|
#define BD_B1 GPIO_Pin_8
|
||||||
|
#define BD_B2 GPIO_Pin_7
|
||||||
|
#define BD_B3 GPIO_Pin_6
|
||||||
|
|
||||||
|
//Buzzer Pin
|
||||||
|
#define PORT_BUZ GPIOA
|
||||||
|
#define BUZ_PIN GPIO_Pin_15
|
||||||
|
|
||||||
|
//Button Pins
|
||||||
|
//Up Down ADC
|
||||||
|
#define PORT_ADC GPIOB
|
||||||
|
#define ADC_UD GPIO_Pin_1
|
||||||
|
//Left Right ADC
|
||||||
|
#define ADC_LR GPIO_Pin_0
|
||||||
|
|
||||||
|
#define PORT_AB_BUTTONS GPIOB
|
||||||
|
//A button
|
||||||
|
#define BUT_A GPIO_Pin_4
|
||||||
|
//B button
|
||||||
|
#define BUT_B GPIO_Pin_3
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
5
Software/Class-Port-Ported/src/typedefs.h
Normal file
5
Software/Class-Port-Ported/src/typedefs.h
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#ifndef _TYPEDEFS_H_
|
||||||
|
#define _TYPEDEFS_H_
|
||||||
|
typedef unsigned char uint8_t;
|
||||||
|
// typedef unsigned short uint16_t;
|
||||||
|
#endif
|
||||||
11
Software/Class-Port-Ported/test/README
Normal file
11
Software/Class-Port-Ported/test/README
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
This directory is intended for PlatformIO Test Runner and project tests.
|
||||||
|
|
||||||
|
Unit Testing is a software testing method by which individual units of
|
||||||
|
source code, sets of one or more MCU program modules together with associated
|
||||||
|
control data, usage procedures, and operating procedures, are tested to
|
||||||
|
determine whether they are fit for use. Unit testing finds problems early
|
||||||
|
in the development cycle.
|
||||||
|
|
||||||
|
More information about PlatformIO Unit Testing:
|
||||||
|
- https://docs.platformio.org/en/latest/advanced/unit-testing/index.html
|
||||||
Loading…
Reference in New Issue
Block a user