mirror of
https://github.com/WeActStudio/ArduinoCore-AT32F4.git
synced 2026-05-21 09:22:01 +00:00
@@ -735,7 +735,7 @@ void String::remove(unsigned int index, unsigned int count)
|
|||||||
}
|
}
|
||||||
char *writeTo = buffer + index;
|
char *writeTo = buffer + index;
|
||||||
len = len - count;
|
len = len - count;
|
||||||
strncpy(writeTo, buffer + index + count, len - index);
|
memmove(writeTo, buffer + index + count, len - index);
|
||||||
buffer[len] = 0;
|
buffer[len] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ void I2Cx_Init(i2c_type *I2Cx, uint32_t baudRate)
|
|||||||
|
|
||||||
void I2Cx_ClearADDRFlag(i2c_type* I2Cx)
|
void I2Cx_ClearADDRFlag(i2c_type* I2Cx)
|
||||||
{
|
{
|
||||||
__IO uint32_t tmpreg;
|
__attribute__((unused)) __IO uint32_t tmpreg;
|
||||||
|
|
||||||
tmpreg = I2Cx->sts1;
|
tmpreg = I2Cx->sts1;
|
||||||
|
|
||||||
|
|||||||
@@ -77,17 +77,19 @@ void Timer_ClockCmd(tmr_type* TIMx, bool Enable)
|
|||||||
|
|
||||||
static float Qsqrt(float number)
|
static float Qsqrt(float number)
|
||||||
{
|
{
|
||||||
|
union {
|
||||||
long i;
|
long i;
|
||||||
float x2, y;
|
float y;
|
||||||
|
} cast;
|
||||||
|
|
||||||
|
float x2;
|
||||||
const float threehalfs = 1.5f;
|
const float threehalfs = 1.5f;
|
||||||
x2 = number * 0.5f;
|
x2 = number * 0.5f;
|
||||||
y = number;
|
cast.y = number;
|
||||||
i = *(long*)&y;
|
cast.i = 0x5f3759df - (cast.i >> 1);
|
||||||
i = 0x5f3759df - (i >> 1);
|
cast.y = cast.y * (threehalfs - (x2 * cast.y * cast.y));
|
||||||
y = *(float*)&i;
|
cast.y = cast.y * (threehalfs - (x2 * cast.y * cast.y));
|
||||||
y = y * (threehalfs - (x2 * y * y));
|
return 1.0f / cast.y;
|
||||||
y = y * (threehalfs - (x2 * y * y));
|
|
||||||
return 1.0f / y;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user