Only a general question… I realize that it is stated that SD requires a bit more work.
That said…
It is not critical but I would like to be able to detect when a SD card removed.
I tried using:
//RemovableMedia events
RemovableMedia.Insert += RemovableMedia_Insert;
RemovableMedia.Eject += RemovableMedia_Eject;
static void RemovableMedia_Insert(object sender, MediaEventArgs e)
{
// Usage code here
}
static void RemovableMedia_Eject(object sender, MediaEventArgs e)
{
Debug.Print("Event: Storage " + e.Volume.RootDirectory + "\" is ejected.");
}
I (occasionally - not always) receive the RemovableMedia_Insert event when the application first starts. Never anytime after the app begins. I never receive the RemovableMedia_Eject event.
Is there a way to override a pin (PB8) that is reserved so I can use something like:
private static Microsoft.SPOT.Hardware.InterruptPort sdDetectPin;
//SD detect pin G400HDR J235-PB8 - 3.3v when card is removed, ground card inserted
//G400 Pin 91 (PB8) 1*32+8=40
//System.Exception CLR_E_PIN_UNAVAILABLE (1) using PB8
sdDetectPin = new Microsoft.SPOT.Hardware.InterruptPort (Microsoft.SPOT.Hardware.Cpu.Pin)G400.Pin.PB8, true,
Microsoft.SPOT.Hardware.Port.ResistorMode.Disabled,
Microsoft.SPOT.Hardware.Port.InterruptMode.InterruptEdgeHigh);
//Interrupt handler
sdDetectPin.OnInterrupt += new Microsoft.SPOT.Hardware.NativeEventHandler(sdDetectPin_OnInterrupt);
Yes I know it is early for my dumb question, but I had to ask…