Main Page | Modules | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

PORT - Procedure for parallel port usage


Files

file  otPort.h
 Parallel Port Library for BF51x.

Modules

 Version History
 Port F access and configuration shortcuts
 Port G access and configuration shortcuts
 Port H access and configuration shortcuts
 Port - Code example

Enumerations

enum  PortId { PP_F, PP_G, PP_H }
 Port selection. More...
enum  PortConfig {
  P_OUT, P_IN, P_IN_H, P_FUN1,
  P_FUN2, P_FUN3
}
 Port mode selection. More...

Functions

void PortConfig (int portId, int bit, int function)
 Configure a bit (15:0) of a desidered port with a requested function, see PortConfig. Each port can be configured as INPUT, OUTPUT or FUNCTION.
void PortFastSwitch (int portId, int bit, int function)
 Switch a bit (15:0) of a desidered port as input (P_IN) or output (P_OUT). For correctness it is good to use this function after having used PortConfig at least once.
It is a quick way to change the bit of a port from input to output or vice versa.
It is used by the functions of SMBus.
void PortSet (int portId, int bit, bool set)
 Set or reset a bit on specified port.
void PortToggle (int portId, int bit)
 Toggle a bit on specified port.
bool PortGet (int portId, int bit)
 Read a bit on specified port.
void PortFSetInterruptService (int bit, void(*pCallback)(), bool rising)
 Configure an interrupt for a bit(s) on port F.
void PortFInterruptEnable (int bit, bool ena)
 Enable or Disable the interrupt by selected bit(s) on port F.
void PortGSetInterruptService (int bit, void(*pCallback)(), bool rising)
 Configure an interrupt for a bit(s) on port G.
void PortFSetInterruptBothEdges (int bit, bool both)
 Enable an interrupt for a bit(s) on port F on rising and falling edge.
void PortGSetInterruptBothEdges (int bit, bool both)
 Enable an interrupt for a bit(s) on port G on rising and falling edge.
void PortGInterruptEnable (int bit, bool ena)
 Enable or Disable the interrupt by selected bit(s) on port G.
void PortFClearInterrupt ()
 Clear the interrupt request on port F.
void PortGClearInterrupt ()
 Clear the interrupt request on port G.

Variables

volatile U16_ppf [20]
 Trick for C++ compatibility.
volatile U16_ppg [20]
 Trick for C++ compatibility.
volatile U16_pph [20]
 Trick for C++ compatibility.

Enumeration Type Documentation

enum PortConfig
 

Enumeration values:
P_OUT  Output port.
P_IN  Input port.
P_IN_H  Input port with histeresis.
P_FUN1  Function 1.
P_FUN2  Function 2.
P_FUN3  Function 3.

enum PortId
 

Enumeration values:
PP_F  Port F.
PP_G  Port G.
PP_H  Port H.


Function Documentation

void PortConfig int  portId,
int  bit,
int  function
 

Parameters:
portId Port identifier PortId
bit Bit number from 0 to 15 (port H is 0 to 7 for BF51x)
function Port function for selected bit see PortConfig

void PortFastSwitch int  portId,
int  bit,
int  function
 

Parameters:
portId Port identifier PortId
bit Bit number from 0 to 15 (port H is 0 to 7 for BF51x)
function Port function for selected bit, P_IN or P_OUT

void PortFClearInterrupt  ) 
 

This procedure must be called by the interrupt handler (callback)

void PortFInterruptEnable int  bit,
bool  ena
 

Parameters:
bit Specify which bit is used, use BIT macro to convert the bit number to its weight
ena If true enable the interrupt on specified bit(s)

void PortFSetInterruptBothEdges int  bit,
bool  both
 

Parameters:
bit Set which bit(s) is used to generate an interrupt, use BIT macro to convert the bit number to its weight
both Set true to enable

void PortFSetInterruptService int  bit,
void(*)()  pCallback,
bool  rising
 

Parameters:
bit Set which bit(s) is used to generate an interrupt, use BIT macro to convert the bit number to its weight
pCallback Pointer to a function called by the intterupt handler
rising If true the interrupt is active on the rising edge of the signal(s)
 // Generate an iterrupt of the rising edge of bit 2 on port F
 PortFSetInterruptService(BIT(2), myFunction, true);
See also:
PortFInterruptEnable, PortFClearInterrupt

void PortGClearInterrupt  ) 
 

This procedure must be called by the interrupt handler (callback)

bool PortGet int  portId,
int  bit
 

Parameters:
portId Port identifier PortId
bit Bit number from 0 to 15 (port H is 0 to 7 for BF51x)

void PortGInterruptEnable int  bit,
bool  ena
 

Parameters:
bit Specify which bit is used, use BIT macro to convert the bit number to its weight
ena If true enable the interrupt on specified bit(s)

void PortGSetInterruptBothEdges int  bit,
bool  both
 

Parameters:
bit Set which bit(s) is used to generate an interrupt, use BIT macro to convert the bit number to its weight
both Set true to enable

void PortGSetInterruptService int  bit,
void(*)()  pCallback,
bool  rising
 

Parameters:
bit Set which bit(s) is used to generate an interrupt, use BIT macro to convert the bit number to its weight
pCallback Pointer to a function called by the intterupt handler
rising If true the interrupt is active on the rising edge of the signal(s)
 // Generate an iterrupt of the falling edge of bit 4 on port G
 PortGSetInterruptService(BIT(4), myFunction, false);
See also:
PortGInterruptEnable, PortGClearInterrupt

void PortSet int  portId,
int  bit,
bool  set
 

Parameters:
portId Port identifier PortId
bit Bit number from 0 to 15 (port H is 0 to 7 for BF51x)
set If true the bit is set else is cleared

void PortToggle int  portId,
int  bit
 

Parameters:
portId Port identifier PortId
bit Bit number from 0 to 15 (port H is 0 to 7 for BF51x)


Variable Documentation

volatile U16* _ppf[20]
 

volatile U16* _ppg[20]
 

volatile U16* _pph[20]
 

footer

otStudio - Library Reference - (C) 2020-25 Officina Turini, All Rights Reserved
Document built with Doxygen 1.4.0