Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
CC3200GPIO.hxx File Reference
#include "os/Gpio.hxx"
#include "inc/hw_types.h"
#include "inc/hw_ints.h"
#include "driverlib/gpio.h"
#include "driverlib/prcm.h"
#include "inc/hw_memmap.h"
#include "driverlib/rom_map.h"

Go to the source code of this file.

Classes

class  CC3200Gpio< GPIO_BASE, GPIO_PIN >
 Generic GPIO class implementation. More...
 
struct  GpioOutputPin< Base, SAFE_VALUE, INVERT >
 Parametric GPIO output class. More...
 
struct  GpioOutputSafeLow< Defs >
 Defines a GPIO output pin, initialized to be an output pin with low level. More...
 
struct  GpioOutputSafeHigh< Defs >
 Defines a GPIO output pin, initialized to be an output pin with high level. More...
 
struct  GpioInputPin< Base, ACTIVE_HIGH >
 Parametric GPIO input class. More...
 
struct  GpioInputOutputPin< Defs >
 Common class for GPIO input pins. More...
 

Macros

#define DECL_PIN(NAME, PORT, NUM)
 Helper macro for declaring a pin.
 
#define GPIO_PIN(NAME, BaseClass, PORT, NUM)
 Helper macro for defining GPIO pins on the CC3200 microcontrollers.
 

Detailed Description

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Helper declarations for using GPIO pins on CC3200 MCUs.

Note about barriers:

GCC is extremely efficient at optimizing the memory access instructions that we use for writing to GPIO output pins. In many cases writing to multiple GPIO pins turns into back-to-back Thumb instructions, and the hardware peripheral seems to be unable to process bus transactions this fast. We therefore add a barrier after each GPIO write. The barrier ensures that the execution continues after the GPIO write only once the transaction is successfully completed by the bus. We tested that back to back GPIO writes are operational. The barrier also ensures correct sequencing against other effects of the running program. One GPIO write is about 50 nsec (4 clock cycles), the shortest pulse we can generate is 100 nsec.

Author
Balazs Racz
Date
2 Dec 2014

Definition in file CC3200GPIO.hxx.

Macro Definition Documentation

◆ DECL_PIN

#define DECL_PIN (   NAME,
  PORT,
  NUM 
)
Value:
static const auto NAME##_PERIPH = PRCM_GPIO##PORT; \
static const auto NAME##_BASE = GPIO##PORT##_BASE; \
static const auto NAME##_PIN = GPIO_PIN_##NUM; \
static const auto NAME##_INT = INT_GPIO##PORT

Helper macro for declaring a pin.

Deprecated:
, use GPIO_PIN instead.

Definition at line 63 of file CC3200GPIO.hxx.

◆ GPIO_PIN

#define GPIO_PIN (   NAME,
  BaseClass,
  PORT,
  NUM 
)
Value:
struct NAME##Defs \
{ \
DECL_PIN(GPIO, PORT, NUM); \
}; \
typedef BaseClass<NAME##Defs> NAME##_Pin

Helper macro for defining GPIO pins on the CC3200 microcontrollers.

Parameters
NAMEis the basename of the declaration. For NAME==FOO the macro declared FOO_Pin as a structure on which the read-write functions will be available.
BaseClassis the initialization structure, such as GpioOutputSafeHigh or GpioOutputSafeLow.
PORTis the letter/number (e.g A0, A1, A2, A3)
NUMis the pin number, such as 3

Example: GPIO_PIN(FOO, GpioOutputSafeHigh, A0, 3); ... FOO_Pin::set(true);

Definition at line 255 of file CC3200GPIO.hxx.