Rebalance ram
This commit is contained in:
@@ -34,6 +34,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
static I2C_HandleTypeDef *i2c;
|
static I2C_HandleTypeDef *i2c;
|
||||||
|
static void I2C1_ClearBusyFlagErratum();
|
||||||
static SemaphoreHandle_t I2CSemaphore;
|
static SemaphoreHandle_t I2CSemaphore;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "stm32f1xx_hal.h"
|
#include "stm32f1xx_hal.h"
|
||||||
#define SETTINGSVERSION \
|
#define SETTINGSVERSION \
|
||||||
0x16 /*Change this if you change the struct below to prevent people getting \
|
0x18 /*Change this if you change the struct below to prevent people getting \
|
||||||
out of sync*/
|
out of sync*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
* Created on: 14Apr.,2018
|
* Created on: 14Apr.,2018
|
||||||
* Author: Ralim
|
* Author: Ralim
|
||||||
*/
|
*/
|
||||||
|
#include "hardware.h"
|
||||||
#include "FRToSI2C.hpp"
|
#include "FRToSI2C.hpp"
|
||||||
#define I2CUSESDMA
|
#define I2CUSESDMA
|
||||||
I2C_HandleTypeDef* FRToSI2C::i2c;
|
I2C_HandleTypeDef* FRToSI2C::i2c;
|
||||||
@@ -12,14 +12,13 @@ SemaphoreHandle_t FRToSI2C::I2CSemaphore;
|
|||||||
void FRToSI2C::CpltCallback() {
|
void FRToSI2C::CpltCallback() {
|
||||||
i2c->State = HAL_I2C_STATE_READY; // Force state reset (even if tx error)
|
i2c->State = HAL_I2C_STATE_READY; // Force state reset (even if tx error)
|
||||||
if (I2CSemaphore) {
|
if (I2CSemaphore) {
|
||||||
|
|
||||||
xSemaphoreGiveFromISR(I2CSemaphore, NULL);
|
xSemaphoreGiveFromISR(I2CSemaphore, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FRToSI2C::Mem_Read(uint16_t DevAddress, uint16_t MemAddress,
|
void FRToSI2C::Mem_Read(uint16_t DevAddress, uint16_t MemAddress,
|
||||||
uint16_t MemAddSize, uint8_t* pData, uint16_t Size) {
|
uint16_t MemAddSize, uint8_t* pData, uint16_t Size) {
|
||||||
#ifdef I2CUSESDMA
|
|
||||||
if (I2CSemaphore == NULL) {
|
if (I2CSemaphore == NULL) {
|
||||||
// no RToS, run blocking code
|
// no RToS, run blocking code
|
||||||
HAL_I2C_Mem_Read(i2c, DevAddress, MemAddress, MemAddSize, pData, Size,
|
HAL_I2C_Mem_Read(i2c, DevAddress, MemAddress, MemAddSize, pData, Size,
|
||||||
@@ -29,17 +28,23 @@ void FRToSI2C::Mem_Read(uint16_t DevAddress, uint16_t MemAddress,
|
|||||||
// Get the mutex so we can use the I2C port
|
// Get the mutex so we can use the I2C port
|
||||||
// Wait up to 1 second for the mutex
|
// Wait up to 1 second for the mutex
|
||||||
if (xSemaphoreTake(I2CSemaphore, (TickType_t)50) == pdTRUE) {
|
if (xSemaphoreTake(I2CSemaphore, (TickType_t)50) == pdTRUE) {
|
||||||
if (HAL_I2C_Mem_Read(i2c, DevAddress, MemAddress, MemAddSize, pData, Size,
|
#ifdef I2CUSESDMA
|
||||||
5000) != HAL_OK) {
|
if (HAL_I2C_Mem_Read_DMA(i2c, DevAddress, MemAddress, MemAddSize,
|
||||||
}
|
pData, Size) != HAL_OK) {
|
||||||
|
|
||||||
|
I2C1_ClearBusyFlagErratum();
|
||||||
xSemaphoreGive(I2CSemaphore);
|
xSemaphoreGive(I2CSemaphore);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
|
||||||
|
HAL_I2C_Mem_Read(i2c, DevAddress, MemAddress, MemAddSize, pData, Size,
|
||||||
|
5000);
|
||||||
|
xSemaphoreGive(I2CSemaphore);
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
HAL_I2C_Mem_Read(i2c, DevAddress, MemAddress, MemAddSize, pData, Size,
|
|
||||||
5000);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
void FRToSI2C::I2C_RegisterWrite(uint8_t address, uint8_t reg, uint8_t data) {
|
void FRToSI2C::I2C_RegisterWrite(uint8_t address, uint8_t reg, uint8_t data) {
|
||||||
Mem_Write(address, reg, I2C_MEMADD_SIZE_8BIT, &data, 1);
|
Mem_Write(address, reg, I2C_MEMADD_SIZE_8BIT, &data, 1);
|
||||||
@@ -52,7 +57,7 @@ uint8_t FRToSI2C::I2C_RegisterRead(uint8_t add, uint8_t reg) {
|
|||||||
}
|
}
|
||||||
void FRToSI2C::Mem_Write(uint16_t DevAddress, uint16_t MemAddress,
|
void FRToSI2C::Mem_Write(uint16_t DevAddress, uint16_t MemAddress,
|
||||||
uint16_t MemAddSize, uint8_t* pData, uint16_t Size) {
|
uint16_t MemAddSize, uint8_t* pData, uint16_t Size) {
|
||||||
#ifdef I2CUSESDMA
|
|
||||||
if (I2CSemaphore == NULL) {
|
if (I2CSemaphore == NULL) {
|
||||||
// no RToS, run blocking code
|
// no RToS, run blocking code
|
||||||
HAL_I2C_Mem_Write(i2c, DevAddress, MemAddress, MemAddSize, pData, Size,
|
HAL_I2C_Mem_Write(i2c, DevAddress, MemAddress, MemAddSize, pData, Size,
|
||||||
@@ -62,22 +67,26 @@ void FRToSI2C::Mem_Write(uint16_t DevAddress, uint16_t MemAddress,
|
|||||||
// Get the mutex so we can use the I2C port
|
// Get the mutex so we can use the I2C port
|
||||||
// Wait up to 1 second for the mutex
|
// Wait up to 1 second for the mutex
|
||||||
if (xSemaphoreTake(I2CSemaphore, (TickType_t)50) == pdTRUE) {
|
if (xSemaphoreTake(I2CSemaphore, (TickType_t)50) == pdTRUE) {
|
||||||
|
#ifdef I2CUSESDMA
|
||||||
|
if (HAL_I2C_Mem_Write_DMA(i2c, DevAddress, MemAddress, MemAddSize,
|
||||||
|
pData, Size) != HAL_OK) {
|
||||||
|
|
||||||
|
I2C1_ClearBusyFlagErratum();
|
||||||
|
xSemaphoreGive(I2CSemaphore);
|
||||||
|
}
|
||||||
|
#else
|
||||||
if (HAL_I2C_Mem_Write(i2c, DevAddress, MemAddress, MemAddSize, pData,
|
if (HAL_I2C_Mem_Write(i2c, DevAddress, MemAddress, MemAddSize, pData,
|
||||||
Size, 5000) != HAL_OK) {
|
Size, 5000) != HAL_OK) {
|
||||||
}
|
}
|
||||||
xSemaphoreGive(I2CSemaphore);
|
xSemaphoreGive(I2CSemaphore);
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
HAL_I2C_Mem_Write(i2c, DevAddress, MemAddress, MemAddSize, pData, Size,
|
|
||||||
5000);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FRToSI2C::Transmit(uint16_t DevAddress, uint8_t* pData, uint16_t Size) {
|
void FRToSI2C::Transmit(uint16_t DevAddress, uint8_t* pData, uint16_t Size) {
|
||||||
#ifdef I2CUSESDMA
|
|
||||||
if (I2CSemaphore == NULL) {
|
if (I2CSemaphore == NULL) {
|
||||||
// no RToS, run blocking code
|
// no RToS, run blocking code
|
||||||
HAL_I2C_Master_Transmit(i2c, DevAddress, pData, Size, 5000);
|
HAL_I2C_Master_Transmit(i2c, DevAddress, pData, Size, 5000);
|
||||||
@@ -86,13 +95,91 @@ void FRToSI2C::Transmit(uint16_t DevAddress, uint8_t* pData, uint16_t Size) {
|
|||||||
// Get the mutex so we can use the I2C port
|
// Get the mutex so we can use the I2C port
|
||||||
// Wait up to 1 second for the mutex
|
// Wait up to 1 second for the mutex
|
||||||
if (xSemaphoreTake(I2CSemaphore, (TickType_t)50) == pdTRUE) {
|
if (xSemaphoreTake(I2CSemaphore, (TickType_t)50) == pdTRUE) {
|
||||||
if (HAL_I2C_Master_Transmit_DMA(i2c, DevAddress, pData, Size) != HAL_OK) {
|
#ifdef I2CUSESDMA
|
||||||
}
|
|
||||||
// xSemaphoreGive(I2CSemaphore);
|
if (HAL_I2C_Master_Transmit_DMA(i2c, DevAddress, pData, Size)
|
||||||
} else {
|
!= HAL_OK) {
|
||||||
}
|
|
||||||
|
I2C1_ClearBusyFlagErratum();
|
||||||
|
xSemaphoreGive(I2CSemaphore);
|
||||||
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
HAL_I2C_Master_Transmit(i2c, DevAddress, pData, Size, 5000);
|
HAL_I2C_Master_Transmit(i2c, DevAddress, pData, Size, 5000);
|
||||||
|
xSemaphoreGive(I2CSemaphore);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
} else {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void FRToSI2C::I2C1_ClearBusyFlagErratum() {
|
||||||
|
GPIO_InitTypeDef GPIO_InitStruct;
|
||||||
|
int timeout = 100;
|
||||||
|
int timeout_cnt = 0;
|
||||||
|
|
||||||
|
// 1. Clear PE bit.
|
||||||
|
i2c->Instance->CR1 &= ~(0x0001);
|
||||||
|
/**I2C1 GPIO Configuration
|
||||||
|
PB6 ------> I2C1_SCL
|
||||||
|
PB7 ------> I2C1_SDA
|
||||||
|
*/
|
||||||
|
// 2. Configure the SCL and SDA I/Os as General Purpose Output Open-Drain, High level (Write 1 to GPIOx_ODR).
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_OD;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||||
|
|
||||||
|
GPIO_InitStruct.Pin = SCL_Pin;
|
||||||
|
HAL_GPIO_Init(SCL_GPIO_Port, &GPIO_InitStruct);
|
||||||
|
HAL_GPIO_WritePin(SCL_GPIO_Port, SCL_Pin, GPIO_PIN_SET);
|
||||||
|
|
||||||
|
GPIO_InitStruct.Pin = SDA_Pin;
|
||||||
|
HAL_GPIO_Init(SDA_GPIO_Port, &GPIO_InitStruct);
|
||||||
|
HAL_GPIO_WritePin(SDA_GPIO_Port, SDA_Pin, GPIO_PIN_SET);
|
||||||
|
|
||||||
|
while (GPIO_PIN_SET != HAL_GPIO_ReadPin(SDA_GPIO_Port, SDA_Pin)) {
|
||||||
|
//Move clock to release I2C
|
||||||
|
HAL_GPIO_WritePin(SCL_GPIO_Port, SCL_Pin, GPIO_PIN_RESET);
|
||||||
|
asm("nop");
|
||||||
|
asm("nop");
|
||||||
|
asm("nop");
|
||||||
|
asm("nop");
|
||||||
|
HAL_GPIO_WritePin(SCL_GPIO_Port, SCL_Pin, GPIO_PIN_SET);
|
||||||
|
|
||||||
|
timeout_cnt++;
|
||||||
|
if (timeout_cnt > timeout)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 12. Configure the SCL and SDA I/Os as Alternate function Open-Drain.
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||||
|
|
||||||
|
GPIO_InitStruct.Pin = SCL_Pin;
|
||||||
|
HAL_GPIO_Init(SCL_GPIO_Port, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
GPIO_InitStruct.Pin = SDA_Pin;
|
||||||
|
HAL_GPIO_Init(SDA_GPIO_Port, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
HAL_GPIO_WritePin(SCL_GPIO_Port, SCL_Pin, GPIO_PIN_SET);
|
||||||
|
HAL_GPIO_WritePin(SDA_GPIO_Port, SDA_Pin, GPIO_PIN_SET);
|
||||||
|
|
||||||
|
// 13. Set SWRST bit in I2Cx_CR1 register.
|
||||||
|
i2c->Instance->CR1 |= 0x8000;
|
||||||
|
|
||||||
|
asm("nop");
|
||||||
|
|
||||||
|
// 14. Clear SWRST bit in I2Cx_CR1 register.
|
||||||
|
i2c->Instance->CR1 &= ~0x8000;
|
||||||
|
|
||||||
|
asm("nop");
|
||||||
|
|
||||||
|
// 15. Enable the I2C peripheral by setting the PE bit in I2Cx_CR1 register
|
||||||
|
i2c->Instance->CR1 |= 0x0001;
|
||||||
|
|
||||||
|
// Call initialization function.
|
||||||
|
HAL_I2C_Init(i2c);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -361,13 +361,13 @@ static void MX_DMA_Init(void) {
|
|||||||
|
|
||||||
/* DMA interrupt init */
|
/* DMA interrupt init */
|
||||||
/* DMA1_Channel1_IRQn interrupt configuration */
|
/* DMA1_Channel1_IRQn interrupt configuration */
|
||||||
HAL_NVIC_SetPriority(DMA1_Channel1_IRQn, 15, 0);
|
HAL_NVIC_SetPriority(DMA1_Channel1_IRQn, 5, 0);
|
||||||
HAL_NVIC_EnableIRQ(DMA1_Channel1_IRQn);
|
HAL_NVIC_EnableIRQ(DMA1_Channel1_IRQn);
|
||||||
/* DMA1_Channel6_IRQn interrupt configuration */
|
/* DMA1_Channel6_IRQn interrupt configuration */
|
||||||
HAL_NVIC_SetPriority(DMA1_Channel6_IRQn, 15, 0);
|
HAL_NVIC_SetPriority(DMA1_Channel6_IRQn, 5, 0);
|
||||||
HAL_NVIC_EnableIRQ(DMA1_Channel6_IRQn);
|
HAL_NVIC_EnableIRQ(DMA1_Channel6_IRQn);
|
||||||
/* DMA1_Channel7_IRQn interrupt configuration */
|
/* DMA1_Channel7_IRQn interrupt configuration */
|
||||||
HAL_NVIC_SetPriority(DMA1_Channel7_IRQn, 15, 0);
|
HAL_NVIC_SetPriority(DMA1_Channel7_IRQn, 5, 0);
|
||||||
HAL_NVIC_EnableIRQ(DMA1_Channel7_IRQn);
|
HAL_NVIC_EnableIRQ(DMA1_Channel7_IRQn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ int main(void) {
|
|||||||
|
|
||||||
/* Create the thread(s) */
|
/* Create the thread(s) */
|
||||||
/* definition and creation of GUITask */
|
/* definition and creation of GUITask */
|
||||||
osThreadDef(GUITask, startGUITask, osPriorityBelowNormal, 0, 4 * 1024 / 4);
|
osThreadDef(GUITask, startGUITask, osPriorityBelowNormal, 0, 5 * 1024 / 4);
|
||||||
GUITaskHandle = osThreadCreate(osThread(GUITask), NULL);
|
GUITaskHandle = osThreadCreate(osThread(GUITask), NULL);
|
||||||
|
|
||||||
/* definition and creation of PIDTask */
|
/* definition and creation of PIDTask */
|
||||||
@@ -77,7 +77,7 @@ int main(void) {
|
|||||||
PIDTaskHandle = osThreadCreate(osThread(PIDTask), NULL);
|
PIDTaskHandle = osThreadCreate(osThread(PIDTask), NULL);
|
||||||
if (PCBVersion < 3) {
|
if (PCBVersion < 3) {
|
||||||
/* definition and creation of MOVTask */
|
/* definition and creation of MOVTask */
|
||||||
osThreadDef(MOVTask, startMOVTask, osPriorityNormal, 0, 2 * 1024 / 4);
|
osThreadDef(MOVTask, startMOVTask, osPriorityNormal, 0, 3 * 1024 / 4);
|
||||||
MOVTaskHandle = osThreadCreate(osThread(MOVTask), NULL);
|
MOVTaskHandle = osThreadCreate(osThread(MOVTask), NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -501,6 +501,7 @@ static void gui_solderingMode(uint8_t jumpToSleep) {
|
|||||||
* --> Double button to exit
|
* --> Double button to exit
|
||||||
*/
|
*/
|
||||||
bool boostModeOn = false;
|
bool boostModeOn = false;
|
||||||
|
uint8_t badTipCounter = 0;
|
||||||
uint32_t sleepThres = 0;
|
uint32_t sleepThres = 0;
|
||||||
if (systemSettings.SleepTime < 6)
|
if (systemSettings.SleepTime < 6)
|
||||||
sleepThres = systemSettings.SleepTime * 10 * 100;
|
sleepThres = systemSettings.SleepTime * 10 * 100;
|
||||||
@@ -549,14 +550,10 @@ static void gui_solderingMode(uint8_t jumpToSleep) {
|
|||||||
OLED::clearScreen();
|
OLED::clearScreen();
|
||||||
OLED::setFont(0);
|
OLED::setFont(0);
|
||||||
uint16_t tipTemp = getTipRawTemp(0);
|
uint16_t tipTemp = getTipRawTemp(0);
|
||||||
if (tipTemp > 32752) {
|
if (tipTemp > 32760) {
|
||||||
OLED::print(BadTipString);
|
badTipCounter++;
|
||||||
OLED::refresh();
|
|
||||||
currentlyActiveTemperatureTarget = 0;
|
|
||||||
waitForButtonPress();
|
|
||||||
currentlyActiveTemperatureTarget = 0;
|
|
||||||
return;
|
|
||||||
} else {
|
} else {
|
||||||
|
badTipCounter = 0;
|
||||||
if (systemSettings.detailedSoldering) {
|
if (systemSettings.detailedSoldering) {
|
||||||
OLED::setFont(1);
|
OLED::setFont(1);
|
||||||
OLED::print(SolderingAdvancedPowerPrompt); // Power:
|
OLED::print(SolderingAdvancedPowerPrompt); // Power:
|
||||||
@@ -615,6 +612,14 @@ static void gui_solderingMode(uint8_t jumpToSleep) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (badTipCounter > 128) {
|
||||||
|
OLED::print(BadTipString);
|
||||||
|
OLED::refresh();
|
||||||
|
currentlyActiveTemperatureTarget = 0;
|
||||||
|
waitForButtonPress();
|
||||||
|
currentlyActiveTemperatureTarget = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
OLED::refresh();
|
OLED::refresh();
|
||||||
|
|
||||||
// Update the setpoints for the temperature
|
// Update the setpoints for the temperature
|
||||||
@@ -944,10 +949,11 @@ void startPIDTask(void const *argument __unused) {
|
|||||||
if (currentlyActiveTemperatureTarget) {
|
if (currentlyActiveTemperatureTarget) {
|
||||||
// Cap the max set point to 450C
|
// Cap the max set point to 450C
|
||||||
if (currentlyActiveTemperatureTarget > ctoTipMeasurement(450)) {
|
if (currentlyActiveTemperatureTarget > ctoTipMeasurement(450)) {
|
||||||
|
//Maximum allowed output
|
||||||
currentlyActiveTemperatureTarget = ctoTipMeasurement(450);
|
currentlyActiveTemperatureTarget = ctoTipMeasurement(450);
|
||||||
}
|
} else if (currentlyActiveTemperatureTarget > 32400) {
|
||||||
if (currentlyActiveTemperatureTarget > 32500) {
|
//Cap to max adc reading
|
||||||
currentlyActiveTemperatureTarget = 32500;
|
currentlyActiveTemperatureTarget = 32400;
|
||||||
}
|
}
|
||||||
|
|
||||||
// As we get close to our target, temp noise causes the system
|
// As we get close to our target, temp noise causes the system
|
||||||
@@ -1185,9 +1191,13 @@ void HAL_I2C_MemTxCpltCallback(I2C_HandleTypeDef *hi2c __unused) {
|
|||||||
FRToSI2C::CpltCallback();
|
FRToSI2C::CpltCallback();
|
||||||
}
|
}
|
||||||
void HAL_I2C_ErrorCallback(I2C_HandleTypeDef *hi2c __unused) {
|
void HAL_I2C_ErrorCallback(I2C_HandleTypeDef *hi2c __unused) {
|
||||||
|
asm("bkpt");
|
||||||
|
|
||||||
FRToSI2C::CpltCallback();
|
FRToSI2C::CpltCallback();
|
||||||
}
|
}
|
||||||
void HAL_I2C_AbortCpltCallback(I2C_HandleTypeDef *hi2c __unused) {
|
void HAL_I2C_AbortCpltCallback(I2C_HandleTypeDef *hi2c __unused) {
|
||||||
|
asm("bkpt");
|
||||||
|
|
||||||
FRToSI2C::CpltCallback();
|
FRToSI2C::CpltCallback();
|
||||||
}
|
}
|
||||||
void HAL_I2C_MemRxCpltCallback(I2C_HandleTypeDef *hi2c __unused) {
|
void HAL_I2C_MemRxCpltCallback(I2C_HandleTypeDef *hi2c __unused) {
|
||||||
@@ -1195,6 +1205,7 @@ void HAL_I2C_MemRxCpltCallback(I2C_HandleTypeDef *hi2c __unused) {
|
|||||||
}
|
}
|
||||||
void vApplicationStackOverflowHook(xTaskHandle *pxTask __unused,
|
void vApplicationStackOverflowHook(xTaskHandle *pxTask __unused,
|
||||||
signed portCHAR *pcTaskName __unused) {
|
signed portCHAR *pcTaskName __unused) {
|
||||||
|
asm("bkpt");
|
||||||
// We dont have a good way to handle a stack overflow at this point in time
|
// We dont have a good way to handle a stack overflow at this point in time
|
||||||
NVIC_SystemReset();
|
NVIC_SystemReset();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ void HAL_I2C_MspInit(I2C_HandleTypeDef* hi2c) {
|
|||||||
GPIO_InitStruct.Pin = SCL_Pin | SDA_Pin;
|
GPIO_InitStruct.Pin = SCL_Pin | SDA_Pin;
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
|
||||||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_MEDIUM;
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||||
|
|
||||||
/* Peripheral clock enable */
|
/* Peripheral clock enable */
|
||||||
|
|||||||
Reference in New Issue
Block a user