Main Site Documentation

Disposing of SPI


#1

Ive created a driver class for an spi device

I need to initiate the class then dispose of it and re-initialise… over and over.

I set the current instance class to null and it still complains.

On re-entry at the class creation

this.spi = new SPI(config);

I cant seem to set the instance of spi to null
and there is no dispose option.
Does my class need a destructor?


#2

Setting the class to null does NOT invoke the SPI class destructor right away. This happens at garbage collection time.

Try forcing garbage collection by calling Debug.GC(true). This will cause garbage collection to occur and the destructor of the SPI class to be called.


#3

Sorry ignore that post

I just created a funtion within the class to remove the SPI instance…

Sorry…

Thanks any way Mike! I just keep thinking C++