Advertisement
Guest User

Untitled

a guest
Aug 16th, 2016
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.10 KB | None | 0 0
  1. /*
  2. ===============================================================================
  3.  Name        : LBE_digitalReadTest.c
  4.  Author      : $(author)
  5.  Version     :
  6.  Copyright   : $(copyright)
  7.  Description : main definition
  8. ===============================================================================
  9. */
  10.  
  11. #if defined (__USE_LPCOPEN)
  12. #if defined(NO_BOARD_LIB)
  13. #include "chip.h"
  14. #else
  15. #include "board.h"
  16. #endif
  17. #endif
  18.  
  19. #include <cr_section_macros.h>
  20.  
  21. #if defined (__MULTICORE_MASTER_SLAVE_M0SLAVE) || \
  22.     defined (__MULTICORE_MASTER_SLAVE_M4SLAVE)
  23. #include "boot_multicore_slave.h"
  24. #endif
  25.  
  26. // TODO: insert other include files here
  27. #include "pinFunc.h"
  28. // TODO: insert other definitions and declarations here
  29.  
  30. int main(void) {
  31.  
  32. #if defined (__USE_LPCOPEN)
  33.     // Read clock settings and update SystemCoreClock variable
  34.     SystemCoreClockUpdate();
  35. #if !defined(NO_BOARD_LIB)
  36. #if defined (__MULTICORE_MASTER) || defined (__MULTICORE_NONE)
  37.     // Set up and initialize all required blocks and
  38.     // functions related to the board hardware
  39.     initBoard();
  40. #endif
  41.     // Set the LED to the state of "On"
  42.     Board_LED_Set(0, true);
  43.  
  44. #endif
  45. #endif
  46.  
  47. #if defined (__MULTICORE_MASTER_SLAVE_M0SLAVE) || \
  48.     defined (__MULTICORE_MASTER_SLAVE_M4SLAVE)
  49.     boot_multicore_slave();
  50. #endif
  51.  
  52.     // TODO: insert code here
  53.     bool pinState = false;
  54.     setPinDigOut(1, 12);    // Set D0 for Digital Out
  55.     setPinDigitalIn(0,6);       // Set D7 for Digital In
  56.     digitalWrite(1, 12, true);  // set D0 High
  57.     Chip_GPIO_SetPinState( LPC_GPIO, 0, 29, true);
  58.     bool derp = Chip_GPIO_GetPinState( LPC_GPIO, 0, 29);
  59.     //DEBUGOUT("\nDING\n");
  60.  
  61.     // Force the counter to be placed into memory
  62.     //volatile static int i = 0 ;
  63.     // Enter an infinite loop, just incrementing a counter
  64.     while(1)
  65.     {
  66.         pinState = digitalRead(0, 6);   // Read in state on D7
  67.         if(pinState)
  68.         {
  69.             Board_LED_Set(0, false);
  70.             Board_LED_Set(1, true);
  71.         }
  72.         else
  73.         {
  74.             Board_LED_Set(0, true);
  75.             Board_LED_Set(1, false);
  76.         }
  77.     }
  78.     return 0 ;
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement