eum c / Mbed 2 deprecated RegisterBlink

Dependencies:   mbed

main.cpp

Committer:
edumana
Date:
2015-01-07
Revision:
0:9a1865214ee0
Child:
1:158078765a61

File content as of revision 0:9a1865214ee0:

#include "mbed.h"

Serial pc(USBTX, USBRX);

void pr(volatile uint32_t *reg);

int main(){

    PORTA_PCR1 = 0x143; //Sets pin to GPIO
    PORTA_PCR2 = 0x143; //Sets pin to GPIO
    GPIOA_PDDR = 0x6; //Sets pin to output
    GPIOA_PSOR = 0x2; //Turns RED off, Leaves GREEN on
    
    while (1){
        int volatile counter = 0;
        while(counter < 10000000){
            counter++;
        }
        GPIOA_PTOR = 0x6; //Toggles 0110, RED and GREEN LEDs   
    }
}
//Print Register: pr
void pr(volatile uint32_t *reg){
    pc.printf("%x --> %x \n", reg, *reg);
}