mirror of
https://github.com/EFeru/hoverboard-sideboard-hack-STM.git
synced 2025-07-28 20:08:52 +00:00
Visual update and minor fixes
- minor bug fixes - added LED board picture
This commit is contained in:
parent
4a470e97b6
commit
e849a9ded8
9
.gitignore
vendored
9
.gitignore
vendored
@ -2,15 +2,14 @@
|
||||
.pioenvs/
|
||||
.vscode/
|
||||
MDK-ARM/DebugConfig/
|
||||
MDK-ARM/Listing/
|
||||
MDK-ARM/Objects/
|
||||
MDK-ARM/RTE/
|
||||
MDK-ARM/sideboard_CobeMX_prj/
|
||||
MDK-ARM/*.uvguix
|
||||
MDK-ARM/.lst
|
||||
MDK-ARM/*.uvguix.*
|
||||
build/
|
||||
!build/VARIANT_DEBUG/firmware.hex
|
||||
!build/VARIANT_DEBUG/firmware.bin
|
||||
!build/VARIANT_DEBUG/firmware.elf
|
||||
!build/VARIANT_DEBUG/firmware.axf
|
||||
!build/VARIANT_HOVERBOARD/firmware.hex
|
||||
!build/VARIANT_HOVERBOARD/firmware.bin
|
||||
!build/VARIANT_HOVERBOARD/firmware.elf
|
||||
!build/VARIANT_HOVERBOARD/firmware.axf
|
@ -28,7 +28,6 @@
|
||||
#endif
|
||||
|
||||
/* ==================================== DO NOT TOUCH SETTINGS ==================================== */
|
||||
#define PRINTF_FLOAT_SUPPORT // [-] Uncomment this for printf to support float on Serial Debug. It will increase code size!
|
||||
#define BYPASS_CUBEMX_DEFINES // [-] Use this flag to bypass the Ports definitions generated by CUBE MX in main.h and use the ones in defines.h
|
||||
#define MPU6050 // [-] Define IMU sensor type
|
||||
#define MPU_GYRO_FSR 2000 // [deg/s] Set Gyroscope Full Scale Range: 250 deg/s, 500 deg/s, 1000 deg/s, 2000 deg/s. !! DMP sensor fusion works only with 2000 deg/s !!
|
||||
@ -37,6 +36,7 @@
|
||||
#define MPU_I2C_SPEED 400000 // [bit/s] Define I2C speed for communicating with the MPU6050
|
||||
#endif
|
||||
#define DELAY_IN_MAIN_LOOP 1 // [ms] Delay in the main loop
|
||||
// #define PRINTF_FLOAT_SUPPORT // [-] Uncomment this for printf to support float on Serial Debug. It will increase code size! Better to avoid it!
|
||||
/* =============================================================================================== */
|
||||
|
||||
|
||||
|
@ -31,7 +31,7 @@
|
||||
#define UART_DMA_CHANNEL_RX DMA1_Channel6
|
||||
|
||||
#if defined(PRINTF_FLOAT_SUPPORT) && defined(SERIAL_DEBUG) && defined(__GNUC__)
|
||||
asm(".global _printf_float"); // this is the magic trick for printf to support float
|
||||
asm(".global _printf_float"); // this is the magic trick for printf to support float. Warning: It will increase code considerably! Better to avoid!
|
||||
#endif
|
||||
|
||||
/* =========================== Defines General =========================== */
|
||||
@ -58,6 +58,12 @@
|
||||
#define LED5_GPIO_Port GPIOB
|
||||
#define LED5_Pin GPIO_PIN_4 // BLUE2
|
||||
|
||||
#define LED1_SET (0x01)
|
||||
#define LED2_SET (0x02)
|
||||
#define LED3_SET (0x04)
|
||||
#define LED4_SET (0x08)
|
||||
#define LED5_SET (0x10)
|
||||
|
||||
/* =========================== Defines SENSORS =========================== */
|
||||
#define SENSOR1_GPIO_Port GPIOA
|
||||
#define SENSOR1_Pin GPIO_PIN_4
|
||||
|
@ -27,7 +27,7 @@
|
||||
/* general functions */
|
||||
void consoleLog(char *message);
|
||||
void get_tick_count_ms(unsigned long *count);
|
||||
void introDemoLED(uint32_t tDelay);
|
||||
void intro_demo_led(uint32_t tDelay);
|
||||
|
||||
/* i2c write/read functions */
|
||||
int8_t i2c_writeBytes(uint8_t slaveAddr, uint8_t regAddr, uint8_t length, uint8_t *data);
|
||||
|
@ -26,7 +26,7 @@
|
||||
<ToolsetNumber>0x4</ToolsetNumber>
|
||||
<ToolsetName>ARM-ADS</ToolsetName>
|
||||
<TargetOption>
|
||||
<CLKADS>64000000</CLKADS>
|
||||
<CLKADS>8000000</CLKADS>
|
||||
<OPTTT>
|
||||
<gFlags>1</gFlags>
|
||||
<BeepAtEnd>0</BeepAtEnd>
|
||||
@ -45,7 +45,7 @@
|
||||
<PageWidth>79</PageWidth>
|
||||
<PageLength>66</PageLength>
|
||||
<TabStop>8</TabStop>
|
||||
<ListingPath></ListingPath>
|
||||
<ListingPath>.\Listings\</ListingPath>
|
||||
</OPTLEX>
|
||||
<ListingPage>
|
||||
<CreateCListing>1</CreateCListing>
|
||||
@ -93,7 +93,7 @@
|
||||
<tRbreak>1</tRbreak>
|
||||
<tRwatch>1</tRwatch>
|
||||
<tRmem>1</tRmem>
|
||||
<tRfunc>1</tRfunc>
|
||||
<tRfunc>0</tRfunc>
|
||||
<tRbox>1</tRbox>
|
||||
<tRtrace>1</tRtrace>
|
||||
<sRSysVw>1</sRSysVw>
|
||||
@ -117,13 +117,18 @@
|
||||
<TargetDriverDllRegistry>
|
||||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
<Key>UL2CM3</Key>
|
||||
<Name>UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F10x_128 -FS08000000 -FL020000 -FP0($$Device:STM32F103C8$Flash\STM32F10x_128.FLM))</Name>
|
||||
<Key>ULP2CM3</Key>
|
||||
<Name>-U -O206 -S8 -C0 -P00 -N00("") -D00(00000000) -L00(0) -TO18 -TC10000000 -TP18 -TDX0 -TDD0 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F10x_128.FLM -FS08000000 -FL020000 -FP0($$Device:STM32F103C8$Flash\STM32F10x_128.FLM)</Name>
|
||||
</SetRegEntry>
|
||||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
<Key>ST-LINKIII-KEIL_SWO</Key>
|
||||
<Name>-U-O142 -O2254 -S0 -C0 -A0 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC800 -FN1 -FF0STM32F10x_128.FLM -FS08000000 -FL010000 -FP0($$Device:STM32F103C8$Flash\STM32F10x_128.FLM)</Name>
|
||||
<Name>-U-O718 -O718 -S0 -C0 -A0 -TO18 -TC10000000 -TP21 -TDS8004 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC1000 -FN1 -FF0STM32F10x_128.FLM -FS08000000 -FL020000 -FP0($$Device:STM32F103C8$Flash\STM32F10x_128.FLM)</Name>
|
||||
</SetRegEntry>
|
||||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
<Key>UL2CM3</Key>
|
||||
<Name>UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F10x_128 -FS08000000 -FL020000 -FP0($$Device:STM32F103C8$Flash\STM32F10x_128.FLM))</Name>
|
||||
</SetRegEntry>
|
||||
</TargetDriverDllRegistry>
|
||||
<Breakpoint/>
|
||||
@ -207,8 +212,8 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>../Src/main.c</PathWithFileName>
|
||||
<FilenameWithoutPath>main.c</FilenameWithoutPath>
|
||||
<PathWithFileName>..\Src\dma.c</PathWithFileName>
|
||||
<FilenameWithoutPath>dma.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
@ -219,7 +224,7 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>../Src/gpio.c</PathWithFileName>
|
||||
<PathWithFileName>..\Src\gpio.c</PathWithFileName>
|
||||
<FilenameWithoutPath>gpio.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
@ -231,8 +236,8 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>../Src/dma.c</PathWithFileName>
|
||||
<FilenameWithoutPath>dma.c</FilenameWithoutPath>
|
||||
<PathWithFileName>..\Src\i2c.c</PathWithFileName>
|
||||
<FilenameWithoutPath>i2c.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
@ -243,8 +248,8 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>../Src/i2c.c</PathWithFileName>
|
||||
<FilenameWithoutPath>i2c.c</FilenameWithoutPath>
|
||||
<PathWithFileName>..\Src\main.c</PathWithFileName>
|
||||
<FilenameWithoutPath>main.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
@ -255,42 +260,6 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>../Src/usart.c</PathWithFileName>
|
||||
<FilenameWithoutPath>usart.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>7</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>../Src/stm32f1xx_it.c</PathWithFileName>
|
||||
<FilenameWithoutPath>stm32f1xx_it.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>8</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>../Src/stm32f1xx_hal_msp.c</PathWithFileName>
|
||||
<FilenameWithoutPath>stm32f1xx_hal_msp.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>9</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\Src\mpu6050.c</PathWithFileName>
|
||||
<FilenameWithoutPath>mpu6050.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
@ -298,7 +267,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>10</FileNumber>
|
||||
<FileNumber>7</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -308,6 +277,42 @@
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>8</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\Src\stm32f1xx_hal_msp.c</PathWithFileName>
|
||||
<FilenameWithoutPath>stm32f1xx_hal_msp.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>9</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\Src\stm32f1xx_it.c</PathWithFileName>
|
||||
<FilenameWithoutPath>stm32f1xx_it.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>10</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\Src\usart.c</PathWithFileName>
|
||||
<FilenameWithoutPath>usart.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>11</FileNumber>
|
||||
@ -347,8 +352,8 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c</PathWithFileName>
|
||||
<FilenameWithoutPath>stm32f1xx_hal_gpio_ex.c</FilenameWithoutPath>
|
||||
<PathWithFileName>..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal.c</PathWithFileName>
|
||||
<FilenameWithoutPath>stm32f1xx_hal.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
@ -359,8 +364,8 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_i2c.c</PathWithFileName>
|
||||
<FilenameWithoutPath>stm32f1xx_hal_i2c.c</FilenameWithoutPath>
|
||||
<PathWithFileName>..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_cortex.c</PathWithFileName>
|
||||
<FilenameWithoutPath>stm32f1xx_hal_cortex.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
@ -371,8 +376,8 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c</PathWithFileName>
|
||||
<FilenameWithoutPath>stm32f1xx_hal_tim.c</FilenameWithoutPath>
|
||||
<PathWithFileName>..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_dma.c</PathWithFileName>
|
||||
<FilenameWithoutPath>stm32f1xx_hal_dma.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
@ -383,8 +388,8 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c</PathWithFileName>
|
||||
<FilenameWithoutPath>stm32f1xx_hal_tim_ex.c</FilenameWithoutPath>
|
||||
<PathWithFileName>..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash.c</PathWithFileName>
|
||||
<FilenameWithoutPath>stm32f1xx_hal_flash.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
@ -395,8 +400,8 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.c</PathWithFileName>
|
||||
<FilenameWithoutPath>stm32f1xx_hal_uart.c</FilenameWithoutPath>
|
||||
<PathWithFileName>..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash_ex.c</PathWithFileName>
|
||||
<FilenameWithoutPath>stm32f1xx_hal_flash_ex.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
@ -407,8 +412,8 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c</PathWithFileName>
|
||||
<FilenameWithoutPath>stm32f1xx_hal.c</FilenameWithoutPath>
|
||||
<PathWithFileName>..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio.c</PathWithFileName>
|
||||
<FilenameWithoutPath>stm32f1xx_hal_gpio.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
@ -419,8 +424,8 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c</PathWithFileName>
|
||||
<FilenameWithoutPath>stm32f1xx_hal_rcc.c</FilenameWithoutPath>
|
||||
<PathWithFileName>..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio_ex.c</PathWithFileName>
|
||||
<FilenameWithoutPath>stm32f1xx_hal_gpio_ex.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
@ -431,8 +436,8 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c</PathWithFileName>
|
||||
<FilenameWithoutPath>stm32f1xx_hal_rcc_ex.c</FilenameWithoutPath>
|
||||
<PathWithFileName>..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_i2c.c</PathWithFileName>
|
||||
<FilenameWithoutPath>stm32f1xx_hal_i2c.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
@ -443,8 +448,8 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c</PathWithFileName>
|
||||
<FilenameWithoutPath>stm32f1xx_hal_gpio.c</FilenameWithoutPath>
|
||||
<PathWithFileName>..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_pwr.c</PathWithFileName>
|
||||
<FilenameWithoutPath>stm32f1xx_hal_pwr.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
@ -455,8 +460,8 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c</PathWithFileName>
|
||||
<FilenameWithoutPath>stm32f1xx_hal_dma.c</FilenameWithoutPath>
|
||||
<PathWithFileName>..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc.c</PathWithFileName>
|
||||
<FilenameWithoutPath>stm32f1xx_hal_rcc.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
@ -467,8 +472,8 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c</PathWithFileName>
|
||||
<FilenameWithoutPath>stm32f1xx_hal_cortex.c</FilenameWithoutPath>
|
||||
<PathWithFileName>..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc_ex.c</PathWithFileName>
|
||||
<FilenameWithoutPath>stm32f1xx_hal_rcc_ex.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
@ -479,8 +484,8 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c</PathWithFileName>
|
||||
<FilenameWithoutPath>stm32f1xx_hal_pwr.c</FilenameWithoutPath>
|
||||
<PathWithFileName>..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_tim.c</PathWithFileName>
|
||||
<FilenameWithoutPath>stm32f1xx_hal_tim.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
@ -491,8 +496,8 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c</PathWithFileName>
|
||||
<FilenameWithoutPath>stm32f1xx_hal_flash.c</FilenameWithoutPath>
|
||||
<PathWithFileName>..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_tim_ex.c</PathWithFileName>
|
||||
<FilenameWithoutPath>stm32f1xx_hal_tim_ex.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
@ -503,8 +508,8 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c</PathWithFileName>
|
||||
<FilenameWithoutPath>stm32f1xx_hal_flash_ex.c</FilenameWithoutPath>
|
||||
<PathWithFileName>..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_uart.c</PathWithFileName>
|
||||
<FilenameWithoutPath>stm32f1xx_hal_uart.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
@ -523,7 +528,7 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>../Src/system_stm32f1xx.c</PathWithFileName>
|
||||
<PathWithFileName>..\Src\system_stm32f1xx.c</PathWithFileName>
|
||||
<FilenameWithoutPath>system_stm32f1xx.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
|
@ -17,12 +17,12 @@
|
||||
<Vendor>STMicroelectronics</Vendor>
|
||||
<PackID>Keil.STM32F1xx_DFP.2.3.0</PackID>
|
||||
<PackURL>http://www.keil.com/pack/</PackURL>
|
||||
<Cpu>IRAM(0x20000000-0x20004FFF) IROM(0x8000000-0x800FFFF) CLOCK(8000000) CPUTYPE("Cortex-M3")</Cpu>
|
||||
<Cpu>IRAM(0x20000000,0x00005000) IROM(0x08000000,0x00010000) CPUTYPE("Cortex-M3") CLOCK(12000000) ELITTLE</Cpu>
|
||||
<FlashUtilSpec></FlashUtilSpec>
|
||||
<StartupFile></StartupFile>
|
||||
<FlashDriverDll></FlashDriverDll>
|
||||
<DeviceId></DeviceId>
|
||||
<RegisterFile></RegisterFile>
|
||||
<FlashDriverDll>UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F10x_128 -FS08000000 -FL020000 -FP0($$Device:STM32F103C8$Flash\STM32F10x_128.FLM))</FlashDriverDll>
|
||||
<DeviceId>4235</DeviceId>
|
||||
<RegisterFile>$$Device:STM32F103C8$Device\Include\stm32f10x.h</RegisterFile>
|
||||
<MemoryEnv></MemoryEnv>
|
||||
<Cmp></Cmp>
|
||||
<Asm></Asm>
|
||||
@ -47,14 +47,14 @@
|
||||
<NotGenerated>0</NotGenerated>
|
||||
<InvalidFlash>1</InvalidFlash>
|
||||
</TargetStatus>
|
||||
<OutputDirectory>.\sideboard_CubeMX_prj\</OutputDirectory>
|
||||
<OutputDirectory>.\Objects\</OutputDirectory>
|
||||
<OutputName>firmware</OutputName>
|
||||
<CreateExecutable>1</CreateExecutable>
|
||||
<CreateLib>0</CreateLib>
|
||||
<CreateHexFile>1</CreateHexFile>
|
||||
<DebugInformation>1</DebugInformation>
|
||||
<BrowseInformation>1</BrowseInformation>
|
||||
<ListingPath></ListingPath>
|
||||
<ListingPath>.\Listings\</ListingPath>
|
||||
<HexFormatSelection>1</HexFormatSelection>
|
||||
<Merge32K>0</Merge32K>
|
||||
<CreateBatchFile>0</CreateBatchFile>
|
||||
@ -79,9 +79,9 @@
|
||||
<nStopB2X>0</nStopB2X>
|
||||
</BeforeMake>
|
||||
<AfterMake>
|
||||
<RunUserProg1>0</RunUserProg1>
|
||||
<RunUserProg1>1</RunUserProg1>
|
||||
<RunUserProg2>0</RunUserProg2>
|
||||
<UserProg1Name></UserProg1Name>
|
||||
<UserProg1Name>$K\ARM\ARMCC\bin\fromelf.exe --bin --output=.\Objects\@L.bin !L</UserProg1Name>
|
||||
<UserProg2Name></UserProg2Name>
|
||||
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
|
||||
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
|
||||
@ -105,7 +105,7 @@
|
||||
<StopOnExitCode>3</StopOnExitCode>
|
||||
<CustomArgument></CustomArgument>
|
||||
<IncludeLibraryModules></IncludeLibraryModules>
|
||||
<ComprImg>0</ComprImg>
|
||||
<ComprImg>1</ComprImg>
|
||||
</CommonProperty>
|
||||
<DllOption>
|
||||
<SimDllName>SARMCM3.DLL</SimDllName>
|
||||
@ -133,10 +133,10 @@
|
||||
<RunIndependent>0</RunIndependent>
|
||||
<UpdateFlashBeforeDebugging>1</UpdateFlashBeforeDebugging>
|
||||
<Capability>1</Capability>
|
||||
<DriverSelection>4100</DriverSelection>
|
||||
<DriverSelection>4096</DriverSelection>
|
||||
</Flash1>
|
||||
<bUseTDR>1</bUseTDR>
|
||||
<Flash2>STLink\ST-LINKIII-KEIL_SWO.dll</Flash2>
|
||||
<Flash2>BIN\UL2CM3.DLL</Flash2>
|
||||
<Flash3>"" ()</Flash3>
|
||||
<Flash4></Flash4>
|
||||
<pFcarmOut></pFcarmOut>
|
||||
@ -335,7 +335,7 @@
|
||||
<MiscControls></MiscControls>
|
||||
<Define>USE_HAL_DRIVER,STM32F103xB</Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath>../Inc;../Drivers/STM32F1xx_HAL_Driver/Inc;../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy;../Drivers/CMSIS/Device/ST/STM32F1xx/Include;../Drivers/CMSIS/Include</IncludePath>
|
||||
<IncludePath>..\Inc;..\Drivers\STM32F1xx_HAL_Driver\Inc;..\Drivers\STM32F1xx_HAL_Driver\Inc\Legacy;..\Drivers\CMSIS\Device\ST\STM32F1xx\Include;..\Drivers\CMSIS\Include</IncludePath>
|
||||
</VariousControls>
|
||||
</Cads>
|
||||
<Aads>
|
||||
@ -390,39 +390,24 @@
|
||||
<GroupName>Src</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>main.c</FileName>
|
||||
<FileName>dma.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>../Src/main.c</FilePath>
|
||||
<FilePath>..\Src\dma.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>gpio.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>../Src/gpio.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>dma.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>../Src/dma.c</FilePath>
|
||||
<FilePath>..\Src\gpio.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>i2c.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>../Src/i2c.c</FilePath>
|
||||
<FilePath>..\Src\i2c.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>usart.c</FileName>
|
||||
<FileName>main.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>../Src/usart.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f1xx_it.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>../Src/stm32f1xx_it.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f1xx_hal_msp.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>../Src/stm32f1xx_hal_msp.c</FilePath>
|
||||
<FilePath>..\Src\main.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>mpu6050.c</FileName>
|
||||
@ -434,6 +419,21 @@
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\Src\mpu6050_dmp.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f1xx_hal_msp.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\Src\stm32f1xx_hal_msp.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f1xx_it.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\Src\stm32f1xx_it.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>usart.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\Src\usart.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>util.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
@ -449,75 +449,75 @@
|
||||
<Group>
|
||||
<GroupName>HAL_Driver</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>stm32f1xx_hal_gpio_ex.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f1xx_hal_i2c.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_i2c.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f1xx_hal_tim.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f1xx_hal_tim_ex.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f1xx_hal_uart.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f1xx_hal.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f1xx_hal_rcc.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f1xx_hal_rcc_ex.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f1xx_hal_gpio.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f1xx_hal_dma.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c</FilePath>
|
||||
<FilePath>..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f1xx_hal_cortex.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c</FilePath>
|
||||
<FilePath>..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_cortex.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f1xx_hal_pwr.c</FileName>
|
||||
<FileName>stm32f1xx_hal_dma.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c</FilePath>
|
||||
<FilePath>..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_dma.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f1xx_hal_flash.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c</FilePath>
|
||||
<FilePath>..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f1xx_hal_flash_ex.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c</FilePath>
|
||||
<FilePath>..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash_ex.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f1xx_hal_gpio.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f1xx_hal_gpio_ex.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio_ex.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f1xx_hal_i2c.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_i2c.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f1xx_hal_pwr.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_pwr.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f1xx_hal_rcc.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f1xx_hal_rcc_ex.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc_ex.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f1xx_hal_tim.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_tim.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f1xx_hal_tim_ex.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_tim_ex.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f1xx_hal_uart.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_uart.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
@ -527,7 +527,7 @@
|
||||
<File>
|
||||
<FileName>system_stm32f1xx.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>../Src/system_stm32f1xx.c</FilePath>
|
||||
<FilePath>..\Src\system_stm32f1xx.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
@ -541,8 +541,8 @@
|
||||
<RTE>
|
||||
<apis/>
|
||||
<components>
|
||||
<component Cclass="CMSIS" Cgroup="CORE" Cvendor="ARM" Cversion="4.3.0" condition="CMSIS Core">
|
||||
<package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="4.5.0"/>
|
||||
<component Cclass="CMSIS" Cgroup="CORE" Cvendor="ARM" Cversion="5.3.0" condition="ARMv6_7_8-M Device">
|
||||
<package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="5.6.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="sideboard-hack"/>
|
||||
</targetInfos>
|
||||
|
@ -14,6 +14,9 @@ This repository implements the firmware for the hoveboard sideboards. The hovebo
|
||||
The original sideboard hardware supports one 4-pin cable that originally was connected to the hoveboard mainboard. It breaks out GND, 12/15V and USART. Additionally, two ports are used to connect to the LED boards. On the back of the board, two Photo Interrupter Optical Switches can be found, originally used to detect if a human is standing on the hoverboard.
|
||||

|
||||
|
||||
The LED boards consist of colored LEDs (blue, red, green, orange) used for design and to inform the user about the current hoverboard state.
|
||||

|
||||
|
||||
The heart of the sideboard is a [STM32F103C8T6](/docs/stm32f103c8-Datasheet.pdf) with the pinout shown in the follwing figure:
|
||||

|
||||
|
||||
@ -40,7 +43,7 @@ If you have never flashed your sideboard before, the MCU is probably locked. To
|
||||
|
||||
To build and flash choose one of the following methods:
|
||||
|
||||
### Method 1: Using Platformio (recommended)
|
||||
### Method 1: Using Platformio
|
||||
|
||||
- open the folder in the IDE of choice (vscode or Atom)
|
||||
- press the 'PlatformIO:Build' or the 'PlatformIO:Upload' button (bottom left in vscode).
|
||||
@ -48,6 +51,7 @@ To build and flash choose one of the following methods:
|
||||
### Method 2: Using Keil uVision
|
||||
|
||||
- in [Keil uVision](https://www.keil.com/download/product/), open the [sideboard-hack.uvproj](/MDK-ARM/)
|
||||
- if you are asked to install missing package, click `Yes`
|
||||
- click Build Target (or press F7) to build the firmware
|
||||
- click Load Code (or press F8) to flash the firmware.
|
||||
|
||||
|
61
Src/main.c
61
Src/main.c
@ -106,7 +106,8 @@ typedef struct{
|
||||
int16_t speedL_meas;
|
||||
int16_t batVoltage;
|
||||
int16_t boardTemp;
|
||||
int16_t checksum;
|
||||
uint16_t cmdLed;
|
||||
uint16_t checksum;
|
||||
} SerialFeedback;
|
||||
SerialFeedback Feedback;
|
||||
SerialFeedback NewFeedback;
|
||||
@ -118,8 +119,8 @@ static uint8_t timeoutFlagSerial = 0; // Timeout Flag for Rx Serial comman
|
||||
extern MPU_Data mpu; // holds the MPU-6050 data
|
||||
ErrorStatus mpuStatus = SUCCESS; // holds the MPU-6050 status: SUCCESS or ERROR
|
||||
|
||||
|
||||
uint8_t sensor1, sensor2; // holds the sensor1 and sensor 2 values
|
||||
FlagStatus sensor1, sensor2; // holds the sensor1 and sensor 2 values
|
||||
FlagStatus sensor1_read, sensor2_read; // holds the instantaneous Read for sensor1 and sensor 2
|
||||
|
||||
static uint32_t main_loop_counter; // main loop counter to perform task squeduling inside main()
|
||||
/* USER CODE END 0 */
|
||||
@ -170,9 +171,13 @@ int main(void)
|
||||
HAL_UART_Receive_DMA (&huart2, (uint8_t *)&NewFeedback, sizeof(NewFeedback));
|
||||
#endif
|
||||
|
||||
introDemoLED(100); // Short LEDs intro demo with 100 ms delay. This also gives some time for the MPU-6050 to initialize.
|
||||
intro_demo_led(100); // Short LEDs intro demo with 100 ms delay. This also gives some time for the MPU-6050 to power-up.
|
||||
if(mpu_config()) { // IMU MPU-6050 config
|
||||
mpuStatus = ERROR;
|
||||
HAL_GPIO_WritePin(LED2_GPIO_Port, LED2_Pin, GPIO_PIN_SET); // Turn on RED LED
|
||||
}
|
||||
else {
|
||||
HAL_GPIO_WritePin(LED2_GPIO_Port, LED2_Pin, GPIO_PIN_SET); // Turn on GREEN LED
|
||||
}
|
||||
mpu_handle_input('h'); // Print the User Help commands to serial
|
||||
|
||||
@ -186,11 +191,15 @@ int main(void)
|
||||
|
||||
// ==================================== LEDs Handling ====================================
|
||||
// HAL_GPIO_TogglePin(LED4_GPIO_Port, LED4_Pin); // Toggle BLUE1 LED
|
||||
if (SUCCESS == mpuStatus) {
|
||||
HAL_GPIO_WritePin(LED2_GPIO_Port, LED2_Pin, GPIO_PIN_SET); // Turn on GREEN LED
|
||||
} else {
|
||||
HAL_GPIO_WritePin(LED1_GPIO_Port, LED1_Pin, GPIO_PIN_SET); // Turn on RED LED
|
||||
#ifdef SERIAL_FEEDBACK
|
||||
if (!timeoutFlagSerial) {
|
||||
if (Feedback.cmdLed & LED1_SET) { HAL_GPIO_WritePin(LED1_GPIO_Port, LED1_Pin, GPIO_PIN_SET); } else { HAL_GPIO_WritePin(LED1_GPIO_Port, LED1_Pin, GPIO_PIN_RESET); }
|
||||
if (Feedback.cmdLed & LED2_SET) { HAL_GPIO_WritePin(LED2_GPIO_Port, LED2_Pin, GPIO_PIN_SET); } else { HAL_GPIO_WritePin(LED2_GPIO_Port, LED2_Pin, GPIO_PIN_RESET); }
|
||||
if (Feedback.cmdLed & LED3_SET) { HAL_GPIO_WritePin(LED3_GPIO_Port, LED3_Pin, GPIO_PIN_SET); } else { HAL_GPIO_WritePin(LED3_GPIO_Port, LED3_Pin, GPIO_PIN_RESET); }
|
||||
if (Feedback.cmdLed & LED4_SET) { HAL_GPIO_WritePin(LED4_GPIO_Port, LED4_Pin, GPIO_PIN_SET); } else { HAL_GPIO_WritePin(LED4_GPIO_Port, LED4_Pin, GPIO_PIN_RESET); }
|
||||
if (Feedback.cmdLed & LED5_SET) { HAL_GPIO_WritePin(LED5_GPIO_Port, LED5_Pin, GPIO_PIN_SET); } else { HAL_GPIO_WritePin(LED5_GPIO_Port, LED5_Pin, GPIO_PIN_RESET); }
|
||||
}
|
||||
#endif
|
||||
|
||||
// ==================================== USER Handling ====================================
|
||||
#ifdef SERIAL_DEBUG
|
||||
@ -209,36 +218,44 @@ int main(void)
|
||||
mpu_get_data();
|
||||
}
|
||||
// Print MPU data to Console
|
||||
if (main_loop_counter % 50 == 0 && SUCCESS == mpuStatus) {
|
||||
if (main_loop_counter % 50 == 0) {
|
||||
mpu_print_to_console();
|
||||
}
|
||||
|
||||
|
||||
// ==================================== SENSORS Handling ====================================
|
||||
sensor1_read = HAL_GPIO_ReadPin(SENSOR1_GPIO_Port, SENSOR1_Pin);
|
||||
sensor2_read = HAL_GPIO_ReadPin(SENSOR2_GPIO_Port, SENSOR2_Pin);
|
||||
|
||||
// SENSOR1
|
||||
if (HAL_GPIO_ReadPin(SENSOR1_GPIO_Port, SENSOR1_Pin)) {
|
||||
sensor1 = 1;
|
||||
// Sensor ACTIVE: Do something here
|
||||
if (sensor1 == RESET && sensor1_read == SET) {
|
||||
sensor1 = SET;
|
||||
// Sensor ACTIVE: Do something here (one time task on activation)
|
||||
HAL_GPIO_WritePin(LED4_GPIO_Port, LED4_Pin, GPIO_PIN_SET);
|
||||
consoleLog("-- SENSOR 1 Active --\n");
|
||||
HAL_Delay(50);
|
||||
} else {
|
||||
sensor1 = 0;
|
||||
} else if(sensor1 == SET && sensor1_read == RESET) {
|
||||
sensor1 = RESET;
|
||||
HAL_GPIO_WritePin(LED4_GPIO_Port, LED4_Pin, GPIO_PIN_RESET);
|
||||
}
|
||||
|
||||
// SENSOR2
|
||||
if (HAL_GPIO_ReadPin(SENSOR2_GPIO_Port, SENSOR2_Pin)) {
|
||||
sensor2 = 1;
|
||||
// Sensor ACTIVE: Do something here
|
||||
if (sensor2 == RESET && sensor2_read == SET) {
|
||||
sensor2 = SET;
|
||||
// Sensor ACTIVE: Do something here (one time task on activation)
|
||||
HAL_GPIO_WritePin(LED5_GPIO_Port, LED5_Pin, GPIO_PIN_SET);
|
||||
consoleLog("-- SENSOR 2 Active --\n");
|
||||
HAL_Delay(50);
|
||||
} else {
|
||||
sensor2 = 0;
|
||||
} else if (sensor2 == SET && sensor2_read == RESET) {
|
||||
sensor2 = RESET;
|
||||
HAL_GPIO_WritePin(LED5_GPIO_Port, LED5_Pin, GPIO_PIN_RESET);
|
||||
}
|
||||
|
||||
if (sensor1 == SET) {
|
||||
// Sensor ACTIVE: Do something here (continuous task)
|
||||
}
|
||||
if (sensor2 == SET) {
|
||||
// Sensor ACTIVE: Do something here (continuous task)
|
||||
}
|
||||
|
||||
|
||||
// ==================================== SERIAL Tx/Rx Handling ====================================
|
||||
#ifdef SERIAL_CONTROL
|
||||
@ -257,7 +274,7 @@ int main(void)
|
||||
#ifdef SERIAL_FEEDBACK
|
||||
uint16_t checksum;
|
||||
checksum = (uint16_t)(NewFeedback.start ^ NewFeedback.cmd1 ^ NewFeedback.cmd2 ^ NewFeedback.speedR ^ NewFeedback.speedL
|
||||
^ NewFeedback.speedR_meas ^ NewFeedback.speedL_meas ^ NewFeedback.batVoltage ^ NewFeedback.boardTemp);
|
||||
^ NewFeedback.speedR_meas ^ NewFeedback.speedL_meas ^ NewFeedback.batVoltage ^ NewFeedback.boardTemp ^ NewFeedback.cmdLed);
|
||||
if (NewFeedback.start == SERIAL_START_FRAME && NewFeedback.checksum == checksum) {
|
||||
if (timeoutFlagSerial) { // Check for previous timeout flag
|
||||
if (timeoutCntSerial-- <= 0) // Timeout de-qualification
|
||||
|
@ -2182,17 +2182,17 @@ static int accel_6500_self_test(long *bias_regular, long *bias_st, int debug)
|
||||
for (i = 0; i < 3; i++) {
|
||||
st_shift_cust[i] = bias_st[i] - bias_regular[i];
|
||||
if(debug) {
|
||||
log_i("Bias_Shift=%7.4f, Bias_Reg=%7.4f, Bias_HWST=%7.4f\r\n",
|
||||
st_shift_cust[i]/1.f, bias_regular[i]/1.f,
|
||||
bias_st[i]/1.f);
|
||||
log_i("OTP value: %7.4f\r\n", ct_shift_prod[i]/1.f);
|
||||
log_i("Bias_Shift=%ld, Bias_Reg=%ld, Bias_HWST=%ld\r\n",
|
||||
(long)st_shift_cust[i], bias_regular[i],
|
||||
bias_st[i]);
|
||||
log_i("OTP value: %ld\r\n", (long)ct_shift_prod[i]);
|
||||
}
|
||||
|
||||
st_shift_ratio[i] = st_shift_cust[i] / ct_shift_prod[i] - 1.f;
|
||||
|
||||
if(debug)
|
||||
log_i("ratio=%7.4f, threshold=%7.4f\r\n", st_shift_ratio[i]/1.f,
|
||||
test.max_accel_var/1.f);
|
||||
log_i("ratio=%ld, threshold=%ld\r\n", (long)st_shift_ratio[i],
|
||||
(long)test.max_accel_var);
|
||||
|
||||
if (fabs(st_shift_ratio[i]) > test.max_accel_var) {
|
||||
if(debug)
|
||||
@ -2208,15 +2208,15 @@ static int accel_6500_self_test(long *bias_regular, long *bias_st, int debug)
|
||||
|
||||
if(debug) {
|
||||
log_i("ACCEL:CRITERIA B\r\n");
|
||||
log_i("Min MG: %7.4f\r\n", accel_st_al_min/1.f);
|
||||
log_i("Max MG: %7.4f\r\n", accel_st_al_max/1.f);
|
||||
log_i("Min MG: %ld\r\n", (long)accel_st_al_min);
|
||||
log_i("Max MG: %ld\r\n", (long)accel_st_al_max);
|
||||
}
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
st_shift_cust[i] = bias_st[i] - bias_regular[i];
|
||||
|
||||
if(debug)
|
||||
log_i("Bias_shift=%7.4f, st=%7.4f, reg=%7.4f\n", st_shift_cust[i]/1.f, bias_st[i]/1.f, bias_regular[i]/1.f);
|
||||
log_i("Bias_shift=%ld, st=%ld, reg=%ld\n", (long)st_shift_cust[i], bias_st[i], bias_regular[i]);
|
||||
if(st_shift_cust[i] < accel_st_al_min || st_shift_cust[i] > accel_st_al_max) {
|
||||
if(debug)
|
||||
log_i("Accel FAIL axis:%d <= 225mg or >= 675mg\n", i);
|
||||
@ -2229,7 +2229,7 @@ static int accel_6500_self_test(long *bias_regular, long *bias_st, int debug)
|
||||
/* Self Test Pass/Fail Criteria C */
|
||||
accel_offset_max = test.max_g_offset * 65536.f;
|
||||
if(debug)
|
||||
log_i("Accel:CRITERIA C: bias less than %7.4f\n", accel_offset_max/1.f);
|
||||
log_i("Accel:CRITERIA C: bias less than %ld\n", (long)accel_offset_max);
|
||||
for (i = 0; i < 3; i++) {
|
||||
if(fabs(bias_regular[i]) > accel_offset_max) {
|
||||
if(debug)
|
||||
@ -2278,17 +2278,17 @@ static int gyro_6500_self_test(long *bias_regular, long *bias_st, int debug)
|
||||
st_shift_cust[i] = bias_st[i] - bias_regular[i];
|
||||
|
||||
if(debug) {
|
||||
log_i("Bias_Shift=%7.4f, Bias_Reg=%7.4f, Bias_HWST=%7.4f\r\n",
|
||||
st_shift_cust[i]/1.f, bias_regular[i]/1.f,
|
||||
bias_st[i]/1.f);
|
||||
log_i("OTP value: %7.4f\r\n", ct_shift_prod[i]/1.f);
|
||||
log_i("Bias_Shift=%ld, Bias_Reg=%ld, Bias_HWST=%ld\r\n",
|
||||
(long)st_shift_cust[i], bias_regular[i],
|
||||
bias_st[i]);
|
||||
log_i("OTP value: %ld\r\n", (long)ct_shift_prod[i]);
|
||||
}
|
||||
|
||||
st_shift_ratio[i] = st_shift_cust[i] / ct_shift_prod[i];
|
||||
|
||||
if(debug)
|
||||
log_i("ratio=%7.4f, threshold=%7.4f\r\n", st_shift_ratio[i]/1.f,
|
||||
test.max_gyro_var/1.f);
|
||||
log_i("ratio=%ld, threshold=%ld\r\n", (long)st_shift_ratio[i],
|
||||
(long)test.max_gyro_var);
|
||||
|
||||
if (fabs(st_shift_ratio[i]) < test.max_gyro_var) {
|
||||
if(debug)
|
||||
@ -2303,14 +2303,14 @@ static int gyro_6500_self_test(long *bias_regular, long *bias_st, int debug)
|
||||
|
||||
if(debug) {
|
||||
log_i("GYRO:CRITERIA B\r\n");
|
||||
log_i("Max DPS: %7.4f\r\n", gyro_st_al_max/1.f);
|
||||
log_i("Max DPS: %ld\r\n", (long)gyro_st_al_max);
|
||||
}
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
st_shift_cust[i] = bias_st[i] - bias_regular[i];
|
||||
|
||||
if(debug)
|
||||
log_i("Bias_shift=%7.4f, st=%7.4f, reg=%7.4f\n", st_shift_cust[i]/1.f, bias_st[i]/1.f, bias_regular[i]/1.f);
|
||||
log_i("Bias_shift=%ld, st=%ld, reg=%ld\n", (long)st_shift_cust[i], bias_st[i], bias_regular[i]);
|
||||
if(st_shift_cust[i] < gyro_st_al_max) {
|
||||
if(debug)
|
||||
log_i("GYRO FAIL axis:%d greater than 60dps\n", i);
|
||||
@ -2323,7 +2323,7 @@ static int gyro_6500_self_test(long *bias_regular, long *bias_st, int debug)
|
||||
/* Self Test Pass/Fail Criteria C */
|
||||
gyro_offset_max = test.min_dps * 65536.f;
|
||||
if(debug)
|
||||
log_i("Gyro:CRITERIA C: bias less than %7.4f\n", gyro_offset_max/1.f);
|
||||
log_i("Gyro:CRITERIA C: bias less than %ld\n", (long)gyro_offset_max);
|
||||
for (i = 0; i < 3; i++) {
|
||||
if(fabs(bias_regular[i]) > gyro_offset_max) {
|
||||
if(debug)
|
||||
@ -2455,8 +2455,8 @@ static int get_st_6500_biases(long *gyro, long *accel, unsigned char hw_test, in
|
||||
|
||||
|
||||
if(debug) {
|
||||
log_i("Accel offset data HWST bit=%d: %7.4f %7.4f %7.4f\r\n", hw_test, accel[0]/65536.f, accel[1]/65536.f, accel[2]/65536.f);
|
||||
log_i("Gyro offset data HWST bit=%d: %7.4f %7.4f %7.4f\r\n", hw_test, gyro[0]/65536.f, gyro[1]/65536.f, gyro[2]/65536.f);
|
||||
log_i("Accel offset data HWST bit=%d: %ld %ld %ld\r\n", hw_test, accel[0], accel[1], accel[2]);
|
||||
log_i("Gyro offset data HWST bit=%d: %ld %ld %ld\r\n", hw_test, gyro[0], gyro[1], gyro[2]);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -3228,14 +3228,14 @@ void mpu_start_self_test(void)
|
||||
if (result == 0x7) {
|
||||
#ifdef SERIAL_DEBUG
|
||||
consoleLog("Passed!\n");
|
||||
log_i("accel: %7.4f %7.4f %7.4f\n",
|
||||
accel[0]/65536.f,
|
||||
accel[1]/65536.f,
|
||||
accel[2]/65536.f);
|
||||
log_i("gyro: %7.4f %7.4f %7.4f\n",
|
||||
gyro[0]/65536.f,
|
||||
gyro[1]/65536.f,
|
||||
gyro[2]/65536.f);
|
||||
log_i("accel: %ld %ld %ld\n",
|
||||
accel[0],
|
||||
accel[1],
|
||||
accel[2]);
|
||||
log_i("gyro: %ld %ld %ld\n",
|
||||
gyro[0],
|
||||
gyro[1],
|
||||
gyro[2]);
|
||||
/* Test passed. We can trust the gyro data here, so now we need to update calibrated data*/
|
||||
#endif
|
||||
|
||||
|
12
Src/util.c
12
Src/util.c
@ -51,23 +51,21 @@ void get_tick_count_ms(unsigned long *count)
|
||||
#else
|
||||
#define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)
|
||||
#endif
|
||||
PUTCHAR_PROTOTYPE
|
||||
{
|
||||
PUTCHAR_PROTOTYPE {
|
||||
HAL_UART_Transmit(&huart2, (uint8_t *)&ch, 1, 1000);
|
||||
return ch;
|
||||
}
|
||||
|
||||
#ifdef __GNUC__
|
||||
int _write(int file, char *ptr, int len)
|
||||
{
|
||||
int DataIdx;
|
||||
for (DataIdx = 0; DataIdx < len; DataIdx++) { __io_putchar( *ptr++ );}
|
||||
int _write(int file, char *data, int len) {
|
||||
int i;
|
||||
for (i = 0; i < len; i++) { __io_putchar( *data++ );}
|
||||
return len;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void introDemoLED(uint32_t tDelay)
|
||||
void intro_demo_led(uint32_t tDelay)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 2.8 MiB |
Binary file not shown.
Before Width: | Height: | Size: 3.0 MiB |
BIN
docs/pictures/ledboard_pinout.png
Normal file
BIN
docs/pictures/ledboard_pinout.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 361 KiB |
@ -6,7 +6,7 @@ include_dir = Inc
|
||||
src_dir = Src
|
||||
|
||||
;=================== VARIANT SELECTION ==========================
|
||||
;default_envs = VARIANT_DEBUG ; DEFAULT Variant
|
||||
;default_envs = VARIANT_DEBUG ; DEBUG Variant
|
||||
;default_envs = VARIANT_HOVERBOARD ; HOVERBOARD Variant
|
||||
;================================================================
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user