From 89ee198a04df6e0fee2f7bbad39a99798f9d7afa Mon Sep 17 00:00:00 2001 From: Roland Sahlsten Date: Tue, 24 May 2011 21:02:43 +0000 Subject: First version of MainProcessingUnit mpu. git-svn-id: https://svn.spreadspace.org/mur.sat@27 7de4ea59-55d0-425e-a1af-a3118ea81d4c --- software/mpu/src/gpio/gpio.h | 66 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 software/mpu/src/gpio/gpio.h (limited to 'software/mpu/src/gpio/gpio.h') diff --git a/software/mpu/src/gpio/gpio.h b/software/mpu/src/gpio/gpio.h new file mode 100644 index 0000000..e56e07e --- /dev/null +++ b/software/mpu/src/gpio/gpio.h @@ -0,0 +1,66 @@ +/***************************************************************************** + * gpio.h: Header file for NXP LPC13xx Family Microprocessors + * + * Copyright(C) 2008, NXP Semiconductor + * All rights reserved. + * + * History + * 2008.09.01 ver 1.00 Preliminary version, first Release + * 2009.12.09 ver 1.05 Mod to use mask registers for GPIO writes + inlining (.h) + * +******************************************************************************/ +#ifndef __GPIO_H +#define __GPIO_H + +#define PORT0 0 +#define PORT1 1 +#define PORT2 2 +#define PORT3 3 + +void GPIO_IRQHandler(void); +void GPIOInit( void ); +void GPIOSetInterrupt( uint32_t portNum, uint32_t bitPosi, uint32_t sense, + uint32_t single, uint32_t event ); +void GPIOIntEnable( uint32_t portNum, uint32_t bitPosi ); +void GPIOIntDisable( uint32_t portNum, uint32_t bitPosi ); +uint32_t GPIOIntStatus( uint32_t portNum, uint32_t bitPosi ); +void GPIOIntClear( uint32_t portNum, uint32_t bitPosi ); + +static LPC_GPIO_TypeDef (* const LPC_GPIO[4]) = { LPC_GPIO0, LPC_GPIO1, LPC_GPIO2, LPC_GPIO3 }; + +/***************************************************************************** +** Function name: GPIOSetValue +** +** Descriptions: Set/clear a bitvalue in a specific bit position +** in GPIO portX(X is the port number.) +** +** parameters: port num, bit position, bit value +** Returned value: None +** +*****************************************************************************/ +static __INLINE void GPIOSetValue( uint32_t portNum, uint32_t bitPosi, uint32_t bitVal ) +{ + LPC_GPIO[portNum]->MASKED_ACCESS[(1<DIR |= 1<DIR &= ~(1<