Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to use stm32h7xx_hal.h and can pass with some minor issues #1

Open
kwccoin opened this issue Sep 13, 2024 · 0 comments
Open

Try to use stm32h7xx_hal.h and can pass with some minor issues #1

kwccoin opened this issue Sep 13, 2024 · 0 comments

Comments

@kwccoin
Copy link

kwccoin commented Sep 13, 2024

As C99 cannot get

/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
// kwccoin: include the includes file here:
#include <stdio.h>
#include "liquidcrystal_i2c.h"
/* USER CODE END Includes */

...

/* Private variables ---------------------------------------------------------*/
/* USER CODE BEGIN PV */
I2C_HandleTypeDef hi2c2;
/* USER CODE END PV */

...

/* Private function prototypes -----------------------------------------------*/
void SystemClock_Config(void);
static void MPU_Config(void);
static void MX_GPIO_Init(void);
static void MX_I2C2_Init(void);
/* USER CODE BEGIN PFP */
//kwccoin not sure: 
//   see https://stackoverflow.com/questions/10162465/implicit-declaration-of-function-itoa-is-invalid-in-c99
char* itoa(int, char* , int);
/* USER CODE END PFP */

...

// kwccoin: 
//  remove this as x should be in the loop? 
// int x;
  for(int x=0; x<40; x=x+1)
  {
    HD44780_ScrollDisplayLeft();  //HD44780_ScrollDisplayRight();
    HAL_Delay(500);
  }

  // kwccoin:
  //  would this be better to use sprintf/printf
  //  but since itoa still work I have not changed it
  //int load = 15;
  //char buffer[100];
  //sprintf(buffer,"%d",load);
  //printf("buffer in int = %s\n",buffer);

  char snum[5];
  for ( int x = 1; x <= 200 ; x++ )
  {
    itoa(x, snum, 10);

	//  sprintf(buffer,"%d",x);
	//  printf("buffer in int = %s\n",buffer);

I need to update also the hi2c1 to hi2c2 as I c2 (as I use PF0 and PF1) and hence

   extern I2C_HandleTypeDef hi2c2

Seems there are warning about clock signal ... but it works. All might be minor issue.

@kwccoin kwccoin changed the title Try to use stm32h7xx_hal.h and still cannot pass Try to use stm32h7xx_hal.h and can pass with some minor issues Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant