gpio.h File Reference


Detailed Description

API for GPIO (digital IO) access.

Software License
See the MBCSL for details.
Author:
Sven Schlender (kontakt at mobacon dot de)
Date:
2010-10-29


Defines

#define GPIOWriteSPIChipSelect(Value)   LATFbits.LATF7 = Value
 In SPI mode the SPI_CS pin can be quickly written with this function.
#define GPIOWriteSPIInt(Value)   LATCbits.LATC2 = Value
 In SPI slave mode the int pin can be quickly written with this function.
#define GPIOWriteSPIBusy(Value)   LATAbits.LATA3 = Value
 In SPI slave mode the busy pin can be quickly written with this function.
#define GPIOReadSPIRegister()   PORTBbits.RB1
 In SPI slave mode the register pin can be quickly read with this function.
#define GPIOWriteSPINetzerDataValid(Value)   LATAbits.LATA2 = Value
 In SPI slave mode the data valid pin can be quickly written with this function.
#define GPIOReadSPIMasterWrite()   PORTDbits.RD1
 In SPI slave mode the master data valid can be quickly read with this function.
#define GPIOReadSPIClock()   PORTCbits.RC3
 In SPI mode the SPI_INT pin can be quickly read with this function.

Enumerations

enum  PortType_t {
  PT_DIG_INPUT = 0, PT_DIG_OUTPUT, PT_ANALOG_INPUT, PT_PWM,
  PT_IMPULSE
}
 A GPIO channel can be configured as one of this types. More...
enum  TimerPrescaler_t { TMR_PRESCALER1 = 0, TMR_PRESCALER2, TMR_PRESCALER4, TMR_PRESCALER8 }
 Use this enumerator to configure prescaler values for impulse generation. More...
enum  PWMFrequencies_t { PF_2500_HZ = 0, PF_10000_HZ, PF_40000_HZ }
 Use this enumerator to configure prescaler values for PWM generation. More...
enum  ImpulseMode_t { IPM_SINGLE = 0, IPM_TRIGGERED, IPM_CONTINUOUS }
 Modes for impulse generation. More...
enum  GPIOServerConnection_t { GPIO_SERVER_NOT_RUNNING = 0, GPIO_SERVER_RUNNING, GPIO_SERVER_CONNECTED }
 This enumerator is used to express the GPIO server state. More...
enum  EdgeCounterMode_t { EC_DISABLED = 0, EC_DECREMENTS, EC_INCREMENTS }
 Modes of the edge trigger counter. More...
enum  EdgeTriggerMode_t { ET_DISABLED = 0, ET_FALLING, ET_RISING }
 Modes of the edge trigger interrupt. More...
enum  EdgeFilterMode_t {
  EF_DISABLED = 0, EF_1_MS, EF_10_MS, EF_100_MS,
  EF_250_MS
}
 Filter mode for the edge trigger interrupt. More...
enum  EventMode_t { EM_DISABLED = 0, EM_ON_FALLING_EDGES, EM_ON_RISING_EDGES, EM_ON_ALL_EDGES }
 Modes for the GPIO event service. More...
enum  GPIORadix_t { RADIX_IS_HEXADECIMAL = 0, RADIX_IS_DECIMAL }
 Display radix for numbers on webpages and GPIO server. More...

Functions

void GPIOInit (SerialMode_t Mode)
 Initializes the GPIO module in the requested mode.
void GPIOResetToFactory (void)
 Resets the GPIO module EEPROM section to well known start parameters.
WORD GPIOGetTCPPort (BOOL bPersistent)
 Delivers the current configured TCP port of the GPIO server.
void GPIOSetTCPPortPersistent (WORD Port)
 Configures a new TCP port for the GPIO server.
BOOL GPIOInitTask (void)
 After initializing network and application stuff the application should call this function to prepare task members needed for proper GPIO task operation.
void GPIOTask (void)
 Call this function periodically from main application to execute GPIO module tasks.
void GPIOStopTask (void)
 On network errors or shut down events these function should be called by the main application to proper stop the GPIO tasks (i.e disconnecting a connected client).
BOOL bGPIOCheckForStoppedTask (void)
 Before shutting down the application should poll for valid GPIO task shutdown.
PortType_t GPIOGetPortType (BYTE GPIOChannel)
 Delivers the current port configuration of a GPIO pin.
BOOL GPIOIsPortOverwritten (BYTE GPIOChannel)
 Delivers if the port is currently overwritten by an alternative pin (i.e serial).
void GPIOSetPortValue (BYTE Channel, BOOL Value)
 This function sets the state for a single IO pin.
BOOL GPIOGetPinValue (BYTE GPIOChannel)
 This function reads the state from a single IO pin.
GPIOServerConnection_t GPIOGetServerState (void)
 This function delivers the current state of the GPIO server.
DWORD GPIOGetConnectedIP (void)
 Delivers the IP of a client who is connected to GPIO server.
void GPIOResetEdgeCounter (BYTE Channel)
 Thread safe reset the edge counter for the given channel.
BOOL GPIOServerIsActivated (void)
 Getter for activated GPIO server.
void GPIOActivateServerPersistent (BOOL Activate)
 Setter for GPIO server state.
ROM BYTE * GPIOGetPortName (BYTE Channel)
 Delivers the port alias name for the given channel.
EventMode_t GPIOGetEventMode (BYTE Channel)
 Delivers the GPIO server event mode of a GPIO channel.
void GPIOSetEventMode (BYTE Channel, EventMode_t Mode)
 Sets the GPIO server event mode of a GPIO channel.
void GPIOSetPortType (BYTE Channel, PortType_t PortType)
 Sets the port mode of a GPIO channel.
BOOL GPIOGetStartupValue (BYTE Channel)
 Delivers the startup value for a given channel.
void GPIOSetStartupValue (BYTE Channel, BOOL Value)
 Configures the startup value for binary output configured values.
void GPIOFlushToEEPROM (void)
 All prior changed values are persistently written to EEPROM.
void GPIOConfigurePort (BYTE Channel)
 Call this function for a given channel to reconfigure the port and all other peripherals associated with the new port function.
BOOL GPIOIsTypeSupportedByPort (BYTE Channel, PortType_t PortType)
 Determines programmatically if a given port supports a requested configuration.
BOOL GPIOGetImpulseLogic (BYTE Channel)
 Delivers the configured logic for an impulse channel.
TimerPrescaler_t GPIOGetImpulsePrescaler (void)
 Delivers the configured prescaler for all impulse channel.
WORD GPIOGetStartImpulseWidth (BYTE Channel)
 Delivers the configured startup value for an impulse channel.
WORD GPIOGetCurrentImpulseWidth (BYTE Channel)
 Delivers the current value for an impulse channel.
void GPIOSetImpulseLogic (BYTE Channel, BOOL Logic)
 Configures the logic for an impulse channel.
void GPIOSetImpulsePrescaler (TimerPrescaler_t Prescaler)
 Configures the prescaler for all impulse channel.
void GPIOSetStartupImpulseWidth (BYTE Channel, WORD ImpulseWidth)
 Configures the startup value for an impulse channel.
void GPIOSetCurrentImpulseWidth (BYTE Channel, WORD ImpulseWidth)
 Sets the value for an impulse or pwm channel.
EdgeTriggerMode_t GPIOGetEdgeTriggerMode (BYTE Channel)
 Delivers the current mode of the edge trigger for a given channel.
EdgeFilterMode_t GPIOGetEdgeFilterMode (BYTE Channel)
 Delivers the current filter mode of the edge trigger for a given channel.
EdgeCounterMode_t GPIOGetEdgeCounterMode (BYTE Channel)
 Delivers the current counter mode of the edge trigger for a given channel.
DWORD GPIOGetEdgeCounter (BYTE Channel)
 Delivers the current edge counter value.
void GPIOSetEdgeTriggerMode (BYTE Channel, EdgeTriggerMode_t Mode)
 Configures a new edge trigger mode for a given channel.
void GPIOSetEdgeFilterMode (BYTE Channel, EdgeFilterMode_t Mode)
 Configures a new edge filter mode for a given channel.
void GPIOSetEdgeCounterMode (BYTE Channel, EdgeCounterMode_t Mode)
 Configures a new edge counter mode for a given channel.
void GPIOSetAllPinValues (WORD NewValue)
 Use this function to write to all pins at once.
void GPIOSetPWMLogic (BYTE Channel, BOOL Value)
 Configures the logic for a pwm channel.
void GPIOSetPWMFrequency (PWMFrequencies_t Value)
 Configures the frequency for all pwm channel.
void GPIOSetPWMStartDuty (BYTE Channel, WORD Value)
 Configures the startup value of a pwm channel.
BOOL GPIOGetPWMLogic (BYTE Channel)
 Delivers the configured logic for a pwm channel.
PWMFrequencies_t GPIOGetPWMFrequency (void)
 Delivers the configured frequency for all pwm channel.
WORD GPIOGetPWMStartDuty (BYTE Channel)
 Delivers the configured startup value for a pwm channel.
ImpulseMode_t GPIOGetImpulseMode (void)
 Delivers the configured mode for all impulse channel.
void GPIOSetImpulseMode (ImpulseMode_t Mode)
 Sets a new mode for all impulse channel.
void GPIOReconfigurePeripherals (void)
 Call this function after reconfiguring a single or multiple ports with GPIOConfigurePort.
void GPIOInitPeripherals (void)
 Call this function before reconfiguring a single or multiple ports with GPIOConfigurePort.
GPIORadix_t GPIOGetRadix (void)
 Delivers the currently set radix for displaying values on the GPIO server and the web interface.
void GPIOSetRadix (GPIORadix_t NewRadix)
 Sets a new radix for displaying values on the GPIO server and the web interface.
BYTE GPIOGetRefresh (void)
 Delivers the currently set refresh rate for auto refreshing the GPIO web interface.
void GPIOSetRefresh (BYTE Refresh)
 Sets a new refresh rate for auto refreshing the GPIO web interface.
BOOL GPIOIsScriptActive (void)
 Delivers if javascript for the GPIO web interface is currently active.
void GPIOActivateScript (BOOL Active)
 Activates or deactivates javascript for the GPIO web interface.
BOOL GPIOIsAuthActive (void)
 Delivers if authentication for the GPIO server is currently active.
void GPIOActivateAuth (BOOL Active)
 Activates or deactivates authentication for the GPIO server.


Generated on Fri Mar 29 10:34:27 2013 for Netzer by  doxygen 1.5.5