Skip to content

Commit

Permalink
Add small delay to main loop.
Browse files Browse the repository at this point in the history
Avoid mtbbus_send_lock to be locked for a big portion of time so
inquiries are sent properly.
  • Loading branch information
horacekj committed Aug 4, 2021
1 parent 17d1b4f commit 5f647a7
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "lib/libusb_stm32"]
path = lib/libusb_stm32
url = [email protected]:dmitrystu/libusb_stm32.git
[submodule "lib/dwt_delay"]
path = lib/dwt_delay
url = [email protected]:keatis/dwt_delay.git
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ C_SOURCES = \
lib/libusb_stm32/src/usbd_core.c \
lib/eeprom/ee.c \
lib/ina219/adafruit_ina219.c \
lib/dwt_delay/dwt_delay.c \
$(wildcard src/*.c)

ASM_SOURCES = startup_stm32f103xb.s
Expand Down Expand Up @@ -85,6 +86,7 @@ C_OR_CPP_INCLUDES = \
-Ilib/libusb_stm32/inc \
-Ilib/eeprom \
-Ilib/ina219 \
-Ilib/dwt_delay \
-I inc

AS_INCLUDES =
Expand Down
2 changes: 1 addition & 1 deletion inc/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

#define MTBUSB_TYPE 0x01
#define FW_VER_MAJOR 0x01
#define FW_VER_MINOR 0x00
#define FW_VER_MINOR 0x01
#define MTBBUS_PROT_VER_MAJOR 0x04
#define MTBBUS_PROT_VER_MINOR 0x00
1 change: 1 addition & 0 deletions lib/dwt_delay
Submodule dwt_delay added at 674f7b
4 changes: 4 additions & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "ee.h"
#include "leds.h"
#include "adafruit_ina219.h"
#include "dwt_delay.h"

/* Private variables ---------------------------------------------------------*/

Expand Down Expand Up @@ -112,12 +113,15 @@ int main(void) {
poll_usb_tx_flags();
poll_speed_change();
config_save_poll();

DWT_Delay(200); // 200 us
}
}

void init(void) {
if (!clock_init())
error_handler();
DWT_Init();
HAL_Init();
gpio_init();
leds_init();
Expand Down

0 comments on commit 5f647a7

Please sign in to comment.