ARM assembly language to control LEDs

Dependencies:   mbed

Fork of ECE_4180_Lab1_P1_Arm by Zack Braun

main.cpp

Committer:
jboettcher
Date:
2016-11-06
Revision:
1:1d27be3b634d
Parent:
0:94cb0da877bc

File content as of revision 1:1d27be3b634d:

#include "mbed.h"
// This program will blink LED1 and LED4
// using assembly language for LED1 and
// API functions for LED4
// declare external assembly language function (in a *.s file)
extern "C" int my_asm(int value);
// declare LED outputs – let C set them up as output bits
DigitalOut myled1(LED1);
DigitalOut myled4(LED4);
DigitalOut digOut(p30);
DigitalIn digIn(p21);
 
int main() {
     int value = 0; 
     while(1) {
     if (digIn) {
            value = 1;
        } else {
            value = 0;
        }
      //call assembly language function to control LED1
      my_asm(value);
     
      wait(0.2);
    }
}