mirror of
https://github.com/eddyem/stm32samples.git
synced 2025-12-06 10:45:11 +03:00
remove trash
This commit is contained in:
parent
8f9e80afa9
commit
9c3632b755
@ -20,41 +20,12 @@
|
|||||||
#include "hardware.h"
|
#include "hardware.h"
|
||||||
#include "usart.h"
|
#include "usart.h"
|
||||||
|
|
||||||
//#include <arm_math.h>
|
|
||||||
|
|
||||||
volatile uint32_t Tms = 0;
|
volatile uint32_t Tms = 0;
|
||||||
|
|
||||||
void sys_tick_handler(void){
|
void sys_tick_handler(void){
|
||||||
++Tms;
|
++Tms;
|
||||||
}
|
}
|
||||||
|
|
||||||
# define IEEE_754_FLOAT_MANTISSA_BITS (23)
|
|
||||||
# define IEEE_754_FLOAT_EXPONENT_BITS (8)
|
|
||||||
# define IEEE_754_FLOAT_SIGN_BITS (1)
|
|
||||||
# if (IS_BIG_ENDIAN == 1)
|
|
||||||
typedef union {
|
|
||||||
float value;
|
|
||||||
struct {
|
|
||||||
__int8_t sign : IEEE_754_FLOAT_SIGN_BITS;
|
|
||||||
__int8_t exponent : IEEE_754_FLOAT_EXPONENT_BITS;
|
|
||||||
__uint32_t mantissa : IEEE_754_FLOAT_MANTISSA_BITS;
|
|
||||||
};
|
|
||||||
} IEEE_754_float;
|
|
||||||
# else
|
|
||||||
typedef union {
|
|
||||||
float value;
|
|
||||||
struct {
|
|
||||||
__uint32_t mantissa : IEEE_754_FLOAT_MANTISSA_BITS;
|
|
||||||
__int8_t exponent : IEEE_754_FLOAT_EXPONENT_BITS;
|
|
||||||
__int8_t sign : IEEE_754_FLOAT_SIGN_BITS;
|
|
||||||
};
|
|
||||||
} IEEE_754_float;
|
|
||||||
# endif
|
|
||||||
|
|
||||||
|
|
||||||
#define P(x) usart_putchar(x)
|
|
||||||
#define S(x) usart_send(x)
|
|
||||||
|
|
||||||
// be careful: if pow10 would be bigger you should change str[] size!
|
// be careful: if pow10 would be bigger you should change str[] size!
|
||||||
static const float pwr10[] = {1., 10., 100., 1000., 10000.};
|
static const float pwr10[] = {1., 10., 100., 1000., 10000.};
|
||||||
static const float rounds[] = {0.5, 0.05, 0.005, 0.0005, 0.00005};
|
static const float rounds[] = {0.5, 0.05, 0.005, 0.0005, 0.00005};
|
||||||
@ -132,14 +103,11 @@ int main(void){
|
|||||||
float x = 0.519, more = 5.123;
|
float x = 0.519, more = 5.123;
|
||||||
while(1){
|
while(1){
|
||||||
if(Tms - ctr > 499){
|
if(Tms - ctr > 499){
|
||||||
//usart_send("ping\n");
|
|
||||||
ctr = Tms;
|
ctr = Tms;
|
||||||
pin_toggle(GPIOB, 1 << 1 | 1 << 0); // toggle LED @ PB0
|
pin_toggle(GPIOB, 1 << 1 | 1 << 0); // toggle LED @ PB0
|
||||||
/**/
|
/**/
|
||||||
if((x += 0.519) > more){
|
if((x += 0.519) > more){
|
||||||
//usart_send("MORE!\n");
|
|
||||||
more += 5.123;
|
more += 5.123;
|
||||||
//__get_FPSCR();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(bufovr){
|
if(bufovr){
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user