1
0
forked from me/IronOS

Bump I2C speed back up

This commit is contained in:
Ben V. Brown
2018-03-03 21:20:01 +11:00
parent f14ea321a7
commit 57949a7937
3 changed files with 32 additions and 30 deletions

View File

@@ -148,7 +148,7 @@ static void MX_ADC1_Init(void) {
static void MX_I2C1_Init(void) {
hi2c1.Instance = I2C1;
hi2c1.Init.ClockSpeed = 50000;
hi2c1.Init.ClockSpeed = 100000;
hi2c1.Init.DutyCycle = I2C_DUTYCYCLE_2;
hi2c1.Init.OwnAddress1 = 0;
hi2c1.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;

View File

@@ -102,38 +102,40 @@ static void printShortDescription(uint32_t shortDescIndex,
}
static int userConfirmation(const char* message) {
uint8_t maxOffset = strlen(message) + 7;
uint32_t messageStart = xTaskGetTickCount();
uint8_t maxOffset = strlen(message) + 7;
uint32_t messageStart = xTaskGetTickCount();
lcd.setFont(0);
lcd.setCursor(0, 0);
lcd.setFont(0);
lcd.setCursor(0, 0);
for (;;) {
int16_t messageOffset = (((xTaskGetTickCount() - messageStart) / 15) % maxOffset);
for (;;) {
int16_t messageOffset = (((xTaskGetTickCount() - messageStart) / 15)
% maxOffset);
lcd.clearScreen();
lcd.setCursor(12 * (7 - messageOffset), 0);
lcd.print(message);
lcd.clearScreen();
lcd.setCursor(12 * (7 - messageOffset), 0);
lcd.print(message);
ButtonState buttons = getButtonState();
switch (buttons) {
case BUTTON_F_SHORT:
//User confirmed
return 1;
ButtonState buttons = getButtonState();
switch (buttons) {
case BUTTON_F_SHORT:
//User confirmed
return 1;
case BUTTON_BOTH:
case BUTTON_B_SHORT:
case BUTTON_F_LONG:
case BUTTON_B_LONG:
return 0;
case BUTTON_NONE:
break;
default:
case BUTTON_BOTH:
case BUTTON_B_SHORT:
case BUTTON_F_LONG:
case BUTTON_B_LONG:
return 0;
}
case BUTTON_NONE:
break;
}
lcd.refresh();
osDelay(50);
}
lcd.refresh();
osDelay(50);
}
return 0;
}

View File

@@ -349,7 +349,7 @@ static void gui_settingsMenu() {
descriptionStart = HAL_GetTick();
int16_t descriptionOffset = ((((HAL_GetTick() - descriptionStart)
/ 10) % (maxOffset * 3))) * 4;
/ 30) % (maxOffset * 3))) * 4;
//^ Rolling offset based on time
lcd.setCursor(((7 * 12) - descriptionOffset), 0);
lcd.print(settingsMenu[currentScreen].description);
@@ -749,13 +749,13 @@ void startGUITask(void const *argument) {
break;
}
uint32_t ticks = xTaskGetTickCount();
ticks += 400; //4 seconds
ticks += 400; //4 seconds from now
while (xTaskGetTickCount() < ticks) {
if (showBootLogoIfavailable() == false)
ticks = xTaskGetTickCount();
ButtonState buttons = getButtonState();
if (buttons)
ticks = xTaskGetTickCount();
ticks = xTaskGetTickCount();//make timeout now so we will exit
GUIDelay();
}