Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- ===============================================================================
- Name : LBE_digitalReadTest.c
- Author : $(author)
- Version :
- Copyright : $(copyright)
- Description : main definition
- ===============================================================================
- */
- #if defined (__USE_LPCOPEN)
- #if defined(NO_BOARD_LIB)
- #include "chip.h"
- #else
- #include "board.h"
- #endif
- #endif
- #include <cr_section_macros.h>
- #if defined (__MULTICORE_MASTER_SLAVE_M0SLAVE) || \
- defined (__MULTICORE_MASTER_SLAVE_M4SLAVE)
- #include "boot_multicore_slave.h"
- #endif
- // TODO: insert other include files here
- #include "pinFunc.h"
- // TODO: insert other definitions and declarations here
- int main(void) {
- #if defined (__USE_LPCOPEN)
- // Read clock settings and update SystemCoreClock variable
- SystemCoreClockUpdate();
- #if !defined(NO_BOARD_LIB)
- #if defined (__MULTICORE_MASTER) || defined (__MULTICORE_NONE)
- // Set up and initialize all required blocks and
- // functions related to the board hardware
- initBoard();
- #endif
- // Set the LED to the state of "On"
- Board_LED_Set(0, true);
- #endif
- #endif
- #if defined (__MULTICORE_MASTER_SLAVE_M0SLAVE) || \
- defined (__MULTICORE_MASTER_SLAVE_M4SLAVE)
- boot_multicore_slave();
- #endif
- // TODO: insert code here
- bool pinState = false;
- setPinDigOut(1, 12); // Set D0 for Digital Out
- setPinDigitalIn(0,6); // Set D7 for Digital In
- digitalWrite(1, 12, true); // set D0 High
- Chip_GPIO_SetPinState( LPC_GPIO, 0, 29, true);
- bool derp = Chip_GPIO_GetPinState( LPC_GPIO, 0, 29);
- //DEBUGOUT("\nDING\n");
- // Force the counter to be placed into memory
- //volatile static int i = 0 ;
- // Enter an infinite loop, just incrementing a counter
- while(1)
- {
- pinState = digitalRead(0, 6); // Read in state on D7
- if(pinState)
- {
- Board_LED_Set(0, false);
- Board_LED_Set(1, true);
- }
- else
- {
- Board_LED_Set(0, true);
- Board_LED_Set(1, false);
- }
- }
- return 0 ;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement