Migrate all Miniware devices to use Bit-Bang I2C (#1838)

* MHP30 move to I2C Bit Banging

* Fixup Accelerometer drivers so all can use I2CBB

* No STM32 I2C driver anymore

* TS100 on I2CBB

* Miniware on BB

* Fixup S60 build

* format

format
This commit is contained in:
Ben V. Brown
2023-11-16 21:32:56 +11:00
committed by GitHub
parent c308fe8cc2
commit e3bad2adae
46 changed files with 144 additions and 8044 deletions

View File

@@ -7,16 +7,13 @@
#include "Setup.h"
#include "BSP.h"
#include "Pins.h"
#include "configuration.h"
#include "history.hpp"
#include <stdint.h>
ADC_HandleTypeDef hadc1;
ADC_HandleTypeDef hadc2;
DMA_HandleTypeDef hdma_adc1;
I2C_HandleTypeDef hi2c1;
DMA_HandleTypeDef hdma_i2c1_rx;
DMA_HandleTypeDef hdma_i2c1_tx;
IWDG_HandleTypeDef hiwdg;
TIM_HandleTypeDef htimADC;
TIM_HandleTypeDef htimTip;
@@ -27,7 +24,6 @@ uint16_t ADCReadings[ADC_SAMPLES]; // Used to store the adc readings for the han
// Functions
static void SystemClock_Config(void);
static void MX_ADC1_Init(void);
static void MX_I2C1_Init(void);
static void MX_IWDG_Init(void);
static void MX_TIP_CONTROL_TIMER_Init(void);
static void MX_ADC_CONTROL_TIMER_Init(void);
@@ -46,7 +42,7 @@ void Setup_HAL() {
MX_GPIO_Init();
MX_DMA_Init();
#ifndef I2C_SOFT_BUS_1
MX_I2C1_Init();
#error "Only Bit-Bang now"
#endif
MX_ADC1_Init();
MX_ADC2_Init();
@@ -277,20 +273,6 @@ static void MX_ADC2_Init(void) {
;
}
}
/* I2C1 init function */
static void MX_I2C1_Init(void) {
hi2c1.Instance = I2C1;
hi2c1.Init.ClockSpeed = 75000;
// OLED doesnt handle >100k when its asleep (off).
hi2c1.Init.DutyCycle = I2C_DUTYCYCLE_2;
hi2c1.Init.OwnAddress1 = 0;
hi2c1.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
hi2c1.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE;
hi2c1.Init.OwnAddress2 = 0;
hi2c1.Init.GeneralCallMode = I2C_GENERALCALL_DISABLE;
hi2c1.Init.NoStretchMode = I2C_NOSTRETCH_DISABLE;
HAL_I2C_Init(&hi2c1);
}
/* IWDG init function */
static void MX_IWDG_Init(void) {