Hotfix: BMA Accel wedges I2C if probed too fast after boot

Only an issue on Pinecil as it boots much faster than Miniware units.
This commit is contained in:
Ben V. Brown
2021-01-17 20:13:02 +11:00
parent cb34fb56e3
commit 2425902fbc
8 changed files with 25 additions and 30 deletions

View File

@@ -385,18 +385,10 @@ bool FRToSI2C::lock() {
if (I2CSemaphore == nullptr) {
return false;
}
if (xTaskGetSchedulerState() != taskSCHEDULER_RUNNING) {
return true;
}
return xSemaphoreTake(I2CSemaphore, TICKS_SECOND) == pdTRUE;
}
void FRToSI2C::unlock() {
if (xTaskGetSchedulerState() != taskSCHEDULER_RUNNING) {
return;
}
xSemaphoreGive(I2CSemaphore);
}
void FRToSI2C::unlock() { xSemaphoreGive(I2CSemaphore); }
bool FRToSI2C::writeRegistersBulk(const uint8_t address, const I2C_REG *registers, const uint8_t registersLength) {
for (int index = 0; index < registersLength; index++) {

View File

@@ -5,8 +5,8 @@
* Author: Ralim
*/
#ifndef BSP_MINIWARE_IRQ_H_
#define BSP_MINIWARE_IRQ_H_
#ifndef BSP_PINE64_IRQ_H_
#define BSP_PINE64_IRQ_H_
#include "BSP.h"
#include "I2C_Wrapper.hpp"
@@ -53,4 +53,4 @@ extern volatile uint8_t i2c_process_flag;
#ifdef __cplusplus
}
#endif
#endif /* BSP_MINIWARE_IRQ_H_ */
#endif /* BSP_PINE64_IRQ_H_ */

View File

@@ -5,8 +5,8 @@
* Author: Ralim
*/
#ifndef BSP_MINIWARE_MODEL_CONFIG_H_
#define BSP_MINIWARE_MODEL_CONFIG_H_
#ifndef BSP_PINE64_MODEL_CONFIG_H_
#define BSP_PINE64_MODEL_CONFIG_H_
/*
* Lookup for mapping features <-> Models
*/
@@ -29,4 +29,4 @@
#define BATTFILTERDEPTH 32
#endif
#endif /* BSP_MINIWARE_MODEL_CONFIG_H_ */
#endif /* BSP_PINE64_MODEL_CONFIG_H_ */

View File

@@ -5,8 +5,8 @@
* Author: Ralim
*/
#ifndef BSP_MINIWARE_PINS_H_
#define BSP_MINIWARE_PINS_H_
#ifndef BSP_PINE64_PINS_H_
#define BSP_PINE64_PINS_H_
#include "gd32vf103_gpio.h"
#define KEY_B_Pin BIT(1)
@@ -50,4 +50,4 @@
#define FUSB302_IRQ_Pin BIT(5)
#define FUSB302_IRQ_GPIO_Port GPIOB
#endif /* BSP_MINIWARE_PINS_H_ */
#endif /* BSP_PINE64_PINS_H_ */

View File

@@ -5,8 +5,8 @@
* Author: Ben V. Brown
*/
#ifndef SETUP_H_
#define SETUP_H_
#ifndef PINE_SETUP_H_
#define PINE_SETUP_H_
#include "gd32vf103_libopt.h"
#include <stdint.h>
@@ -21,4 +21,4 @@ void setupFUSBIRQ();
#endif
extern const uint8_t holdoffTicks;
extern const uint8_t tempMeasureTicks;
#endif /* SETUP_H_ */
#endif /* PINE_SETUP_H_ */

View File

@@ -5,7 +5,7 @@
* Author: Ralim
*/
#ifndef BSP_MINIWARE_UNITSETTINGS_H_
#define BSP_MINIWARE_UNITSETTINGS_H_
#ifndef BSP_PINE64_UNITSETTINGS_H_
#define BSP_PINE64_UNITSETTINGS_H_
#endif /* BSP_MINIWARE_UNITSETTINGS_H_ */
#endif /* BSP_PINE64_UNITSETTINGS_H_ */