/****************************************************************

This example copies the values on buttons (SW1 to SW4 and BT5) to the LEDs (D0 to D4).

SW6 is not used.

It is referenced in the QuickStart document and serves as basis for it.

Make sure that the enabling jumpers are set for the buttons and the LEDs

Also make sure that the boot mode selected on the board is the same as the mode 
 selected in the target options. (RAM by default, i.e. Boot0=0 and Boot1=1)

****************************************************************

This program will only work with the STR75x devices.

****************************************************************/


 #include "STR75x.h"

 void Init(void)
 {
 	// GPIO clock gating
 	 MRCC->PCLKEN |= 0x01000000;
 	
	// P2[14..10] as open drain outputs,
	// other P2 bits as HiZ inputs
#define OUTMASK 0x00007C00
   GPIO2->PC0 &= ~OUTMASK;
   GPIO2->PC1 &= ~OUTMASK;
   GPIO2->PC2 |=  OUTMASK;
 	
	// P1[14..10] as pull up/down inputs,
	// other P1 bits as HiZ inputs 	 
#define INMASK 0x00007C00
	GPIO1->PM  &= ~INMASK;
 	GPIO1->PC0 |= INMASK;
 	GPIO1->PC1 |= INMASK;
 	GPIO1->PC2 &= ~INMASK;
	GPIO1->PD  |= INMASK;
	GPIO1->PM  |= INMASK;
 }
 
 
 int main(void)
 {
	Init();

 	while(1)
 	{
		GPIO2->PD = (GPIO1->PD);
 	}
 }
 
 
 

