Content originally posted in LPCWare by gbm on Sun Jun 19 12:31:58 MST 2011
As the code is trivial, the only operation that could take some significant time is the GPIO access. If you need to set several IO pins in a single port, make a mask variable, OR it with all active bit masks and then do:
[SIZE=2]LPC_GPIO2->[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]MASKED_ACCESS[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][mask] = mask;
Actually [/SIZE][SIZE=2]LPC_GPIO2->[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]MASKED_ACCESS[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][mask] = 0xffffffff; would do the same
[/SIZE]