Quantcast
Channel: Arduino Forum - Latest topics
Viewing all articles
Browse latest Browse all 15346

How to pass a File object as parameter to xTaskCreate()

$
0
0
#include<SPI.h>
#include<SD.h>
#include<FreeRTOS.h>
#include<task.h>
void encapsulateImage(void * pvParam)
{
//my function code
}

void setup()
{
  Serial.begin(9600);

  if(!SD.begin(4)) {//CS pin
    Serial.println("Initialization failed, or SDcard not present");
    while(1);
  }
  Serial.println("\nInitialization done");

  static const File imgFile;

  xTaskCreate(encapsulateImage, (const portCHAR *)"encapsulation", 400, (void*)imgFile, NULL, 1, &taskHandle);
  vTaskStartScheduler();

  Serial.println("failed to create the schedular");
  while(1);

}

void loop()
{

}

error message:
invalid cast from type 'const SDLib::File' to type 'void*'
xTaskCreate(encapsulateImage, (const portCHAR )"encapsulation", 400, (void)imgFile, NULL, 1, &taskHandle);

2 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 15346

Trending Articles