-1

While i was developing code at Keil there is a transmit function;

 HAL_StatusTypeDef HAL_SPI_Transmit(SPI_HandleTypeDef *hspi, uint8_t *pData, 
 uint16_t Size, uint32_t Timeout)

While i was using pData as a pointer as i add above like *(buf+spi_ri) i get error. (uint8_t is incompatible with parameter of type "uint8_t")

And when i declare without pointer (buf+spi_ri) there is no error.

I have to get buffer's pointer it is okay. But when i don't use (*) in the HAL_SPI_Transmit function declaration is it okay or will i read buffer without not pointing inside of buffer?

Thanks

void SPI_COM(uint8_t lenght,uint8_t *buf)

{   
      uint8_t spi_cnt = lenght;

      uint8_t spi_wi = 0;

      uint8_t spi_ri = 0;

    while( spi_wi != spi_cnt )
    {
        if( __HAL_SPI_GET_FLAG( &hspi2, SPI_FLAG_TXE ) &&  (spi_ri < lenght) )

        {
          //HAL_StatusTypeDef HAL_SPI_Transmit(SPI_HandleTypeDef *hspi, uint8_t


        *pData, uint16_t Size, uint32_t Timeout)


            HAL_SPI_Transmit( &hspi2,  (buf+spi_ri), (uint16_t) 1, (uint32_t)100 );


        }

    }  

ERROR PIC

Said Ediz
  • 13
  • 5

1 Answers1

0

You are mixing a uint8_t with a uint8_t pointer.

Ant
  • 1,668
  • 2
  • 18
  • 35