From ed1c1efa7aee67d36a37212c13998318f02c4350 Mon Sep 17 00:00:00 2001 From: lonkaars Date: Wed, 19 Oct 2022 22:12:31 +0200 Subject: moved constants around --- .gitignore | 15 ++++++++++++--- stm32f091/consts.h | 19 +++++++++++++++++++ stm32f091/esp8266.c | 3 ++- stm32f091/readme.md | 7 +++++++ stm32f091/setup.h | 15 +-------------- stm32f091/wifi.def.h | 5 +++++ 6 files changed, 46 insertions(+), 18 deletions(-) create mode 100644 stm32f091/consts.h create mode 100644 stm32f091/readme.md create mode 100644 stm32f091/wifi.def.h diff --git a/.gitignore b/.gitignore index aba4463..18c2616 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,21 @@ -copyright +# blob **/*.o -stm32f091/main.elf -stm32f091/main.bin **/.cache **/compile_commands.json + +# stm32-specific files +stm32f091/main.elf +stm32f091/main.bin +stm32f091/wifi.h + +# client-specific files client/makefile client/client client/moc_* + +# others shared/main .qmake.stash .vscode/.cortex-debug.registers.state.json +copyright + diff --git a/stm32f091/consts.h b/stm32f091/consts.h new file mode 100644 index 0000000..e0d92bb --- /dev/null +++ b/stm32f091/consts.h @@ -0,0 +1,19 @@ +#pragma once + +#include "wifi.h" + +#define WS_PINOUT_I2C_SDA_PIN GPIO_PIN_9 +#define WS_PINOUT_I2C_SDA_PORT GPIOB +#define WS_PINOUT_I2C_SCL_PIN GPIO_PIN_8 +#define WS_PINOUT_I2C_SCL_PORT GPIOB + +#define WS_PINOUT_USART1_RX_PIN GPIO_PIN_10 +#define WS_PINOUT_USART1_RX_PORT GPIOA +#define WS_PINOUT_USART1_TX_PIN GPIO_PIN_9 +#define WS_PINOUT_USART1_TX_PORT GPIOA + +#define WS_PINOUT_USART2_RX_PIN GPIO_PIN_3 +#define WS_PINOUT_USART2_RX_PORT GPIOA +#define WS_PINOUT_USART2_TX_PIN GPIO_PIN_2 +#define WS_PINOUT_USART2_TX_PORT GPIOA + diff --git a/stm32f091/esp8266.c b/stm32f091/esp8266.c index 4c5d0d2..9fccf70 100644 --- a/stm32f091/esp8266.c +++ b/stm32f091/esp8266.c @@ -5,6 +5,7 @@ #include "esp8266.h" #include "setup.h" +#include "consts.h" void ws_esp8266_ATsendCommand(uint8_t* data){ char dataChar[20]; @@ -126,7 +127,7 @@ void ws_esp8266_mode(){ HAL_Delay(1000); } void ws_esp8266_connect(){ - uint8_t Tx_network[]="AT+CWJAP=\"Test\",\"12345678\"\r\n"; + uint8_t Tx_network[]="AT+CWJAP=\"" WS_ESP8266_WLAN_SSID "\",\"" WS_ESP8266_WLAN_PASSWD "\"\r\n"; HAL_UART_Transmit(&huart1, Tx_network,strlen((char*)Tx_network),1000); diff --git a/stm32f091/readme.md b/stm32f091/readme.md new file mode 100644 index 0000000..97492d5 --- /dev/null +++ b/stm32f091/readme.md @@ -0,0 +1,7 @@ +# stm32 firmware subdirectory + +- uses make +- make sure to initialize the git submodules +- all warnings from source files in the lib/ subfolder are hidden +- copy wifi.def.h to wifi.h and edit the network credentials + diff --git a/stm32f091/setup.h b/stm32f091/setup.h index 8ca3720..04fa177 100644 --- a/stm32f091/setup.h +++ b/stm32f091/setup.h @@ -4,20 +4,7 @@ #include #include -#define WS_PINOUT_I2C_SDA_PIN GPIO_PIN_9 -#define WS_PINOUT_I2C_SDA_PORT GPIOB -#define WS_PINOUT_I2C_SCL_PIN GPIO_PIN_8 -#define WS_PINOUT_I2C_SCL_PORT GPIOB - -#define WS_PINOUT_USART1_RX_PIN GPIO_PIN_10 -#define WS_PINOUT_USART1_RX_PORT GPIOA -#define WS_PINOUT_USART1_TX_PIN GPIO_PIN_9 -#define WS_PINOUT_USART1_TX_PORT GPIOA - -#define WS_PINOUT_USART2_RX_PIN GPIO_PIN_3 -#define WS_PINOUT_USART2_RX_PORT GPIOA -#define WS_PINOUT_USART2_TX_PIN GPIO_PIN_2 -#define WS_PINOUT_USART2_TX_PORT GPIOA +#include "consts.h" extern I2C_HandleTypeDef hi2c1; extern UART_HandleTypeDef huart1; diff --git a/stm32f091/wifi.def.h b/stm32f091/wifi.def.h new file mode 100644 index 0000000..f0748d2 --- /dev/null +++ b/stm32f091/wifi.def.h @@ -0,0 +1,5 @@ +#pragma once + +#define WS_ESP8266_WLAN_SSID "Test" +#define WS_ESP8266_WLAN_PASSWD "12345678" + -- cgit v1.2.3