On Mon, 17 May 2021 20:37:36 -0700, in gmane.comp.hardware.beagleboard.user "John Dammeyer" <johnd-5o6ditlojsohvde0pjs...@public.gmane.org> wrote:
>A bit of a mystery in how it works other than it creates an OS fault to signal >issues. My new function is more complicated: >{ > The ExportPin procedure has been expanded to test to see if it is already > exported. If it was already there then a new bit flag is set so that when > the application calls to unexport pins, the ones that were there are left > alone. >} >procedure TSysfsGPIO.ExportPin(const Pin: TPinIdentifier); >var val : StdChar; >begin > // First check to see if we already exported this pin inside this > application. > if (not IsPinBitSet(Pin, ExportedBitmask)) then begin Suggest if (not (IsPinBitSet(Pin, ExportedBitmask) or IsPinBitSet(Pin, ExportDefinedBitmask)) then begin That way you don't waste time with the TryReadCharFromFile() if you already know it was externally exported. > >So where does the delay suggestion you made come in? When we try and set the >direction of the pin! Which is done in the user application. >// Switch LED pin for output. >GPIO.PinMode[PinLED] := TPinMode.Output; > I'd put the delay immediately after // Wasn't exported when program started so now let's export it. if TryWriteTextToFile(FExportFileName, IntToStr(Pin)) then begin SetPinBit(Pin, ExportedBitmask); *** put delay statement here ***; end; > > >The only issue I've run into is the repeat until loop. Seems like the file is >readable in about 100mS but fails with the write unless the delay is 500mS. > Which "file" (there are so many created under each exported pin) <G> It may be that the OS default for those files permits reading -- but the group hasn't been changed yet so only root can write. Sometime after the creation, the logic that sets up special groups runs and changes the file to a group that allows you to write. -- Dennis L Bieber -- For more options, visit http://beagleboard.org/discuss --- You received this message because you are subscribed to the Google Groups "BeagleBoard" group. To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/40a7ag9gv2635mshemm4euqic4370aodfr%404ax.com.