Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
YXZhu committed Jul 10, 2022
0 parents commit 33aa7a4
Show file tree
Hide file tree
Showing 130 changed files with 44,918 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Specific
astyle.out
boards.local.txt
platform.local.txt
path_config.json
update_config.json
variant_config.json

# Backup
*.bak
*.gho
*.ori
*.swp
*.tmp

# macOS
# General
.DS_Store
.AppleDouble
.LSOverride

# Patch
*.orig
*.rej

# Python
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# VisualStudioCode
.vscode/*
*.code-workspace

Unsupport/*
88 changes: 88 additions & 0 deletions ArduinoCore-AT32F403A/boards.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
#
menu.upload_method=Upload method
menu.pll_clock_source=pll_clock_source
menu.pll_mult=pll_mult
menu.pll_output_range=pll_output_range

WeActStudioAT32F4.name=AT32F403ACGU7 BlackPill Boards
WeActStudioAT32F4.build.mcu=cortex-m4
WeActStudioAT32F4.build.f_cpu=80000000L
WeActStudioAT32F4.build.board=AT32F403ACGxx
WeActStudioAT32F4.build.vect_flags=-DUSER_ADDR_ROM=0x08000000
WeActStudioAT32F4.build.core=arduino
WeActStudioAT32F4.build.extra_flags=-DAT32F403ACGU7 -USE_STDPERIPH_DRIVER
WeActStudioAT32F4.build.variant=AT32F403ACGU7
WeActStudioAT32F4.build.variant_system_lib=FrameLib.a
WeActStudioAT32F4.build.ldscript=linker_scripts\AT32F403AxG_FLASH.ld

WeActStudioAT32F4.menu.pll_clock_source.hext_div2=high speed external crystal div 2
WeActStudioAT32F4.menu.pll_clock_source.hext_div2.build.f_pll_clock_source=2
WeActStudioAT32F4.menu.pll_clock_source.hext_div2.build.f_hext_div=CRM_HEXT_DIV_2
WeActStudioAT32F4.menu.pll_clock_source.hext_div2.build.f_hsi_div=CRM_HICK48_DIV6
WeActStudioAT32F4.menu.pll_clock_source.hext_div3=high speed external crystal div 3
WeActStudioAT32F4.menu.pll_clock_source.hext_div3.build.f_pll_clock_source=2
WeActStudioAT32F4.menu.pll_clock_source.hext_div3.build.f_hext_div=CRM_HEXT_DIV_3
WeActStudioAT32F4.menu.pll_clock_source.hext_div3.build.f_hsi_div=CRM_HICK48_DIV6
WeActStudioAT32F4.menu.pll_clock_source.hext_div4=high speed external crystal div 4
WeActStudioAT32F4.menu.pll_clock_source.hext_div4.build.f_pll_clock_source=2
WeActStudioAT32F4.menu.pll_clock_source.hext_div4.build.f_hext_div=CRM_HEXT_DIV_4
WeActStudioAT32F4.menu.pll_clock_source.hext_div4.build.f_hsi_div=CRM_HICK48_DIV6
WeActStudioAT32F4.menu.pll_clock_source.hext_div5=high speed external crystal div 5
WeActStudioAT32F4.menu.pll_clock_source.hext_div5.build.f_pll_clock_source=2
WeActStudioAT32F4.menu.pll_clock_source.hext_div5.build.f_hext_div=CRM_HEXT_DIV_5
WeActStudioAT32F4.menu.pll_clock_source.hext_div5.build.f_hsi_div=CRM_HICK48_DIV6
WeActStudioAT32F4.menu.pll_clock_source.hext_div1=high speed external crystal div 1
WeActStudioAT32F4.menu.pll_clock_source.hext_div1.build.f_pll_clock_source=1
WeActStudioAT32F4.menu.pll_clock_source.hext_div1.build.f_hext_div=CRM_HEXT_DIV_2
WeActStudioAT32F4.menu.pll_clock_source.hext_div1.build.f_hsi_div=CRM_HICK48_DIV6
WeActStudioAT32F4.menu.pll_clock_source.hsi_div6=high speed internal clock(48mhz) div 6
WeActStudioAT32F4.menu.pll_clock_source.hsi_div6.build.f_pll_clock_source=0
WeActStudioAT32F4.menu.pll_clock_source.hsi_div6.build.f_hsi_div=CRM_HICK48_DIV6
WeActStudioAT32F4.menu.pll_clock_source.hsi_div6.build.f_hext_div=CRM_HEXT_DIV_2
WeActStudioAT32F4.menu.pll_clock_source.hsi_div1=high speed internal clock(48mhz)
WeActStudioAT32F4.menu.pll_clock_source.hsi_div1.build.f_pll_clock_source=0
WeActStudioAT32F4.menu.pll_clock_source.hsi_div1.build.f_hsi_div=CRM_HICK48_NODIV
WeActStudioAT32F4.menu.pll_clock_source.hsi_div1.build.f_hext_div=CRM_HEXT_DIV_2

WeActStudioAT32F4.menu.pll_mult.pll_mult_60=pll multiplication factor 60
WeActStudioAT32F4.menu.pll_mult.pll_mult_60.build.f_pll_mult=CRM_PLL_MULT_60
WeActStudioAT32F4.menu.pll_mult.pll_mult_59=pll multiplication factor 59
WeActStudioAT32F4.menu.pll_mult.pll_mult_59.build.f_pll_mult=CRM_PLL_MULT_59
WeActStudioAT32F4.menu.pll_mult.pll_mult_58=pll multiplication factor 58
WeActStudioAT32F4.menu.pll_mult.pll_mult_58.build.f_pll_mult=CRM_PLL_MULT_58
WeActStudioAT32F4.menu.pll_mult.pll_mult_57=pll multiplication factor 57
WeActStudioAT32F4.menu.pll_mult.pll_mult_57.build.f_pll_mult=CRM_PLL_MULT_57
WeActStudioAT32F4.menu.pll_mult.pll_mult_56=pll multiplication factor 56
WeActStudioAT32F4.menu.pll_mult.pll_mult_56.build.f_pll_mult=CRM_PLL_MULT_56
WeActStudioAT32F4.menu.pll_mult.pll_mult_55=pll multiplication factor 55
WeActStudioAT32F4.menu.pll_mult.pll_mult_55.build.f_pll_mult=CRM_PLL_MULT_55
WeActStudioAT32F4.menu.pll_mult.pll_mult_54=pll multiplication factor 54
WeActStudioAT32F4.menu.pll_mult.pll_mult_54.build.f_pll_mult=CRM_PLL_MULT_54
WeActStudioAT32F4.menu.pll_mult.pll_mult_53=pll multiplication factor 53
WeActStudioAT32F4.menu.pll_mult.pll_mult_53.build.f_pll_mult=CRM_PLL_MULT_53
WeActStudioAT32F4.menu.pll_mult.pll_mult_52=pll multiplication factor 52
WeActStudioAT32F4.menu.pll_mult.pll_mult_52.build.f_pll_mult=CRM_PLL_MULT_52
WeActStudioAT32F4.menu.pll_mult.pll_mult_51=pll multiplication factor 51
WeActStudioAT32F4.menu.pll_mult.pll_mult_51.build.f_pll_mult=CRM_PLL_MULT_51
WeActStudioAT32F4.menu.pll_mult.pll_mult_50=pll multiplication factor 50
WeActStudioAT32F4.menu.pll_mult.pll_mult_50.build.f_pll_mult=CRM_PLL_MULT_50
WeActStudioAT32F4.menu.pll_mult.pll_mult_40=pll multiplication factor 40
WeActStudioAT32F4.menu.pll_mult.pll_mult_40.build.f_pll_mult=CRM_PLL_MULT_40
WeActStudioAT32F4.menu.pll_mult.pll_mult_30=pll multiplication factor 30
WeActStudioAT32F4.menu.pll_mult.pll_mult_30.build.f_pll_mult=CRM_PLL_MULT_30
WeActStudioAT32F4.menu.pll_mult.pll_mult_20=pll multiplication factor 20
WeActStudioAT32F4.menu.pll_mult.pll_mult_20.build.f_pll_mult=CRM_PLL_MULT_20
WeActStudioAT32F4.menu.pll_mult.pll_mult_10=pll multiplication factor 10
WeActStudioAT32F4.menu.pll_mult.pll_mult_10.build.f_pll_mult=CRM_PLL_MULT_10
WeActStudioAT32F4.menu.pll_mult.pll_mult_2=pll multiplication factor 2
WeActStudioAT32F4.menu.pll_mult.pll_mult_2.build.f_pll_mult=CRM_PLL_MULT_2

WeActStudioAT32F4.menu.pll_output_range.pll_output_range_gt72mhz=pll clock output range greater than 72mhz
WeActStudioAT32F4.menu.pll_output_range.pll_output_range_gt72mhz.build.f_pll_output_range=CRM_PLL_OUTPUT_RANGE_GT72MHZ
WeActStudioAT32F4.menu.pll_output_range.pll_output_range_le72mhz=pll clock output range less than or equal to 72mhz
WeActStudioAT32F4.menu.pll_output_range.pll_output_range_le72mhz.build.f_pll_output_range=CRM_PLL_OUTPUT_RANGE_LE72MHZ

WeActStudioAT32F4.menu.upload_method.USBDFUMethod=Artery DFU ISP
WeActStudioAT32F4.menu.upload_method.USBDFUMethod.upload.protocol=Artery_ISP
WeActStudioAT32F4.menu.upload_method.USBDFUMethod.upload.tool=Artery_ISP_Console
WeActStudioAT32F4.menu.upload_method.USBDFUMethod.upload.maximum_size=1048576
118 changes: 118 additions & 0 deletions ArduinoCore-AT32F403A/cores/arduino/Arduino.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
/*
* MIT License
* Copyright (c) 2017 - 2022 _VIFEXTech
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef __ARDUINO_H
#define __ARDUINO_H

#include <stdlib.h>
#include <stdbool.h>
#include "libcore/mcu_core.h"
#include "binary.h"
#include "avr/pgmspace.h"

#ifdef __cplusplus
extern "C" {
#endif

#define KEILDUINO_VERSION 100

#define PI 3.1415926535897932384626433832795f
#define HALF_PI 1.5707963267948966192313216916398f
#define TWO_PI 6.283185307179586476925286766559f
#define DEG_TO_RAD 0.017453292519943295769236907684886f
#define RAD_TO_DEG 57.295779513082320876798154814105f
#define EULER 2.718281828459045235360287471352f

#define SERIAL 0x0
#define DISPLAY 0x1

#define LSBFIRST 0x0
#define MSBFIRST 0x1

#define LOW 0x0
#define HIGH 0x1

#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define ABS(x) (((x)>0)?(x):-(x)) //abs(x) is define in stdlib.h
#define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))
#define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))
#define radians(deg) ((deg)*DEG_TO_RAD)
#define degrees(rad) ((rad)*RAD_TO_DEG)
#define sq(x) ((x)*(x))

#define lowByte(w) ((uint8_t) ((w) & 0xff))
#define highByte(w) ((uint8_t) ((w) >> 8))

#define bitRead(value, bit) (((value) >> (bit)) & 0x01)
#define bitSet(value, bit) ((value) |= (1UL << (bit)))
#define bitClear(value, bit) ((value) &= ~(1UL << (bit)))
#define bitWrite(value, bit, bitvalue) (bitvalue ? bitSet(value, bit) : bitClear(value, bit))

#ifndef _BV
# define _BV(bit) (1 << (bit))
#endif

#define clockCyclesPerMicrosecond() (F_CPU / 1000000L)
#define clockCyclesToMicroseconds(a) (((a) * 1000L) / (F_CPU / 1000L))
#define microsecondsToClockCycles(a) ((a) * (F_CPU / 1000000L))

#define delay(ms) delay_ms(ms)
#define delayMicroseconds(us) delay_us(us)

#define interrupts() sei()
#define noInterrupts() cli()

#define NOT_A_PIN 0xFF
#define NOT_A_PORT 0xFF
#define NOT_AN_INTERRUPT -1

#define boolean bool
typedef unsigned char byte;

void pinMode(uint8_t pin, PinMode_TypeDef mode);
void digitalWrite(uint8_t pin, uint8_t value);
uint8_t digitalRead(uint8_t pin);
void analogWrite(uint8_t pin, uint16_t value);
uint16_t analogRead(uint8_t pin);
uint16_t analogRead_DMA(uint8_t pin);
void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t value);
uint32_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint32_t bitOrder);
uint32_t pulseIn(uint32_t pin, uint32_t state, uint32_t timeout);

long map(long x, long in_min, long in_max, long out_min, long out_max);
float fmap(float x, float in_min, float in_max, float out_min, float out_max);
void yield(void);

#ifdef __cplusplus
}// extern "C"
#endif

#ifdef __cplusplus
# include "WCharacter.h"
# include "WString.h"
# include "WMath.h"
# include <libcore/Tone.h>
# include <libcore/HardwareSerial.h>
#endif

#endif
Loading

0 comments on commit 33aa7a4

Please sign in to comment.