Skip to content

Commit

Permalink
更新
Browse files Browse the repository at this point in the history
添加框架示意图
  • Loading branch information
FASTSHIFT committed Nov 15, 2019
1 parent c020d3e commit c2cdca3
Show file tree
Hide file tree
Showing 45 changed files with 11,704 additions and 117 deletions.
Binary file added Framework.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions _Keilduino (AT32F4xx)/ArduinoAPI/Arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ extern "C" {
#include "timer.h"

#define __AT32__
#define __STM32__

#define PI 3.1415926535897932384626433832795f
#define HALF_PI 1.5707963267948966192313216916398f
Expand Down
18 changes: 9 additions & 9 deletions _Keilduino (AT32F4xx)/ArduinoAPI/Print.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,12 +269,12 @@ void Print::xprintchar(char **str, int c)

int Print::xprints(char **out, const char *string, int width, int pad)
{
register int pc = 0, padchar = ' ';
int pc = 0, padchar = ' ';

if (width > 0)
{
register int len = 0;
register const char *ptr;
int len = 0;
const char *ptr;
for (ptr = string; *ptr; ++ptr) ++len;
if (len >= width) width = 0;
else width -= len;
Expand Down Expand Up @@ -307,9 +307,9 @@ int Print::xprinti(char **out, int i, int b, int sg, int width, int pad, int let
/* the following should be enough for 32 bit int */
#define PRINT_BUF_LEN 12
char print_buf[PRINT_BUF_LEN];
register char *s;
register int t, neg = 0, pc = 0;
register unsigned int u = (unsigned int)i;
char *s;
int t, neg = 0, pc = 0;
unsigned int u = (unsigned int)i;

if (i == 0)
{
Expand Down Expand Up @@ -355,8 +355,8 @@ int Print::xprinti(char **out, int i, int b, int sg, int width, int pad, int let

int Print::xprint( char **out, const char *format, va_list args)
{
register int width, pad;
register int pc = 0;
int width, pad;
int pc = 0;
char scr[2];

for (; *format != 0; ++format)
Expand Down Expand Up @@ -384,7 +384,7 @@ int Print::xprint( char **out, const char *format, va_list args)
}
if( *format == 's' )
{
register char *s = (char *)va_arg( args, int );
char *s = (char *)va_arg( args, int );
pc += xprints (out, s ? s : "(null)", width, pad);
continue;
}
Expand Down
5 changes: 3 additions & 2 deletions _Keilduino (AT32F4xx)/ArduinoAPI/Tone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,14 @@ void tone(uint8_t Pin, uint32_t freq)

if(ToneTimer != ToneTimer_Last)
{
Timer_Init(ToneTimer, (500000.0 / freq), tone_TimerHandler, 0, 0);
Timer_SetInterruptBase(ToneTimer, 0xFF, 0xFF, tone_TimerHandler, 0, 0);
Timer_SetInterruptTimeUpdate(ToneTimer, (500000.0f / freq));
TMR_Cmd(ToneTimer, ENABLE);
ToneTimer_Last = ToneTimer;
}
else
{
TimerSet_InterruptTimeUpdate(ToneTimer, 500000.0 / freq);
Timer_SetInterruptTimeUpdate(ToneTimer, 500000.0f / freq);
TMR_Cmd(ToneTimer, ENABLE);
}
}
Expand Down
5 changes: 1 addition & 4 deletions _Keilduino (AT32F4xx)/ArduinoAPI/Wire.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,9 @@

#define BUFFER_LENGTH 32

#pragma diag_suppress 122
#pragma diag_suppress 136

class TwoWire : public WireBase {
public:
uint8_t i2c_delay;
uint8_t i2c_delay;
uint8_t scl_pin;
uint8_t sda_pin;

Expand Down
3 changes: 2 additions & 1 deletion _Keilduino (AT32F4xx)/Core/mcu_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,11 @@ typedef TMR_Type TIM_TypeDef;
#define TIM15 TMR15

#define __AT32F4__
#define __STM32F4__
#define F_CPU SystemCoreClock
#define CYCLES_PER_MICROSECOND (F_CPU / 1000000U)

#define __KEILDUINO__ 100
#define __KEILDUINO__ 110

#define GPIO_HIGH(GPIOX,GPIO_PIN_X) (GPIOX->BSRE = GPIO_PIN_X)
#define GPIO_LOW(GPIOX,GPIO_PIN_X) (GPIOX->BRE = GPIO_PIN_X)
Expand Down
8 changes: 2 additions & 6 deletions _Keilduino (AT32F4xx)/Core/pwm.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void TIMx_OCxInit(TIM_TypeDef* TIMx, uint16_t arr, uint16_t psc, uint8_t TimerCh
if(!IS_TMR_ALL_PERIPH(TIMx))
return;

TimerClockCmd(TIMx, ENABLE);
Timer_ClockCmd(TIMx, ENABLE);

TMR_TimeBaseStructure.TMR_Period = arr;
TMR_TimeBaseStructure.TMR_DIV = psc;
Expand Down Expand Up @@ -72,11 +72,7 @@ void TIMx_OCxInit(TIM_TypeDef* TIMx, uint16_t arr, uint16_t psc, uint8_t TimerCh
}

TMR_Cmd(TIMx, ENABLE);

if(IS_APB2_TIM(TIMx))
{
TMR_CtrlPWMOutputs(TIMx, ENABLE);
}
TMR_CtrlPWMOutputs(TIMx, ENABLE);
}

/**
Expand Down
Loading

0 comments on commit c2cdca3

Please sign in to comment.