Remove logic from code -- we only blink

disable_blink
LEdoian 3 years ago
parent eb7fc13fa0
commit 2241252f4d

@ -17,12 +17,8 @@
#include <stdbool.h> #include <stdbool.h>
//#define DELAY 8000000 // Should be a second, or maybe not (second iff 8MHz clk, 1/3second if 24MHz clk) // Too long!! //#define DELAY 8000000 // Should be a second, or maybe not (second iff 8MHz clk, 1/3second if 24MHz clk) // Too long!!
#define DELAY 4000000 // This is bad -- it's a value that was found to be OK
#define STM32F1 1 // Needed for libopencm3 #define STM32F1 1 // Needed for libopencm3
volatile enum {FORWARD, BACKWARD} direction;
volatile bool running = false;
void setup_system (void) { void setup_system (void) {
// Set up clock // Set up clock
rcc_clock_setup_in_hse_8mhz_out_24mhz(); rcc_clock_setup_in_hse_8mhz_out_24mhz();
@ -116,26 +112,6 @@ int main (void) {
setup(); setup();
while (true) __asm ("wfi"); while (true) __asm ("wfi");
#ifdef NOT_ACTUALLY_DEFINED
// Array of what leds should be on
uint16_t states[4] = {0, 0, GPIO8, GPIO8};
char state = 0;
int i;
// Initial wait
while (!running) ;
while (true) {
for (i=0 ; i<DELAY ; i++) {
__asm ("nop");
}
state = (direction == FORWARD ? (state + 1)%4 : (/*state+4-1*/ state+3)%4 ); // New state
gpio_set(GPIOC, states[state]);
gpio_clear(GPIOC, (GPIO8) ^ states[state]);
}
#endif
return 0; return 0;
} }

Loading…
Cancel
Save