Main Page | Modules | File List | Globals

testpic.cpp File Reference


Detailed Description

AXIS PIC Test Suite.

Test software to communicate with the AXIS PIC.

Author:
Mike Ballinger
Date:
11/1/05

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <popt.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "../../sw/kernel_driver/axis.h"
#include "picapi.h"
#include "17682.h"

Include dependency graph for testpic.cpp:

Include dependency graph

Defines

#define PIC_FILENAME   "/dev/axis_0/spi_0"

Functions

int DisplayVersionInformation (int fdPIC)
 Displays to screen both the current issue of this software in addition to the firmware version of the PIC.

int ReadPowerOnAndOffTimes (int fdPIC)
 Displays to screen the last PIC power off and power on times.

int ReadRealTimeClock (int fdPIC)
 Displays to screen the current PIC RTC.

int SetRealTimeClock (int fdPIC)
 Sets the PIC clock to the current PC time.

int ReadAnalogueInputs (int fdPIC, unsigned int adcNum)
 Reads the specified analogue port and displays to screen.

int ClearSwitchLog (int fdPIC)
 Empties the power-off switch log buffer.

int ReadSwitchLog (int fdPIC)
 Reads the entire power-off switch log and displays it to screen.

int ReadSwitches (int fdPIC)
 Reads the switch position and displays to screen as an 8-bit binary value.

int CheckPICFlags (int fdPIC)
 Reads the state of the internal PIC flags, and if any are set then it is displayed to screen.

int ReadBatteryVoltage (int fdPIC)
 Reads the current PIC battery voltage and displays to screen. This is a 10-bit value with a corresponding range of 0 to 1023.

int ReadBatteryMaxRef (int fdPIC)
 Reads the maximum battery reference voltage and displays to screen. This is a 10-bit value with a corresponding range of 0 to 1023.

int ReadMinETXVoltage (int fdPIC)
 Reads the minimum ETX voltage and displays to screen. This is a 10-bit value with a corresponding range of 0 to 1023.

int BatteryFastCharge (int fdPIC, int fastCharge)
 Controls battery fast charge. Please note that it is not recommended to leave the battery fast charging for long periods of time.

int ConfigureDigitalInput (int fdPIC, int input)
 Configures either RA2 or RA4 as a digital input.

int ConfigureAnalogueInput (int fdPIC, int input)
 Configures either RA2 or RA4 as an analogue input.

void BitDump (int num, int numBits)
 Displays an integer value in binary format.

int main (int argc, const char **argv)

Define Documentation

#define PIC_FILENAME   "/dev/axis_0/spi_0"
 


Function Documentation

int BatteryFastCharge int  fdPIC,
int  fastCharge
 

Controls battery fast charge. Please note that it is not recommended to leave the battery fast charging for long periods of time.

Date:
11/1/05
Author:
Mike Ballinger
Parameters:
fdPIC - The PIC handle. This is obtained after a call to PIC_Initialise( ).
fastCharge - If this value is TRUE then fast charging will be turned on, and if FALSE then fast charging will be turned off.
Returns:
Success/error code. See list of PIC API Return Codes.

Here is the call graph for this function:

void BitDump int  num,
int  numBits
 

Displays an integer value in binary format.

Date:
11/1/05
Author:
Mike Ballinger
Parameters:
int num - The value to display.
int numBits - The number of bits in the value.

int CheckPICFlags int  fdPIC  ) 
 

Reads the state of the internal PIC flags, and if any are set then it is displayed to screen.

The following PIC flags are checked:

  • Watchdog reset flag
  • Power On reset flag
  • Brown Out reset flag
  • Oscillator failure flag
  • Power-off switch logger overflow flag

Date:
11/1/05
Author:
Mike Ballinger
Parameters:
fdPIC - The PIC handle. This is obtained after a call to PIC_Initialise( ).
Returns:
Success/error code. See list of PIC API Return Codes.

Here is the call graph for this function:

int ClearSwitchLog int  fdPIC  ) 
 

Empties the power-off switch log buffer.

Date:
11/1/05
Author:
Mike Ballinger
Parameters:
fdPIC - The PIC handle. This is obtained after a call to PIC_Initialise( ).
Returns:
Success/error code. See list of PIC API Return Codes.

Here is the call graph for this function:

int ConfigureAnalogueInput int  fdPIC,
int  input
 

Configures either RA2 or RA4 as an analogue input.

Date:
11/1/05
Author:
Mike Ballinger
Parameters:
fdPIC - The PIC handle. This is obtained after a call to PIC_Initialise( ).
input - The input to configure. Valid values are 2 (RA2) and 4 (RA4).
Returns:
Success/error code. See list of PIC API Return Codes.

Here is the call graph for this function:

int ConfigureDigitalInput int  fdPIC,
int  input
 

Configures either RA2 or RA4 as a digital input.

Date:
11/1/05
Author:
Mike Ballinger
Parameters:
fdPIC - The PIC handle. This is obtained after a call to PIC_Initialise( ).
input - The input to configure. Valid values are 2 (RA2) and 4 (RA4).
Returns:
Success/error code. See list of PIC API Return Codes.

Here is the call graph for this function:

int DisplayVersionInformation int  fdPIC  ) 
 

Displays to screen both the current issue of this software in addition to the firmware version of the PIC.

Date:
11/1/05
Author:
Mike Ballinger
Parameters:
fdPIC - The PIC handle. This is obtained after a call to PIC_Initialise( ).
Returns:
Success/error code. See list of PIC API Return Codes.

Here is the call graph for this function:

int main int  argc,
const char **  argv
 

Here is the call graph for this function:

int ReadAnalogueInputs int  fdPIC,
unsigned int  adcNum
 

Reads the specified analogue port and displays to screen.

Date:
11/1/05
Author:
Mike Ballinger
Parameters:
fdPIC - The PIC handle. This is obtained after a call to PIC_Initialise( ).
adcNum - Analogue port to read, valid values are 1 - 5.
Returns:
Success/error code. See list of PIC API Return Codes.

Here is the call graph for this function:

int ReadBatteryMaxRef int  fdPIC  ) 
 

Reads the maximum battery reference voltage and displays to screen. This is a 10-bit value with a corresponding range of 0 to 1023.

Date:
11/1/05
Author:
Mike Ballinger
Parameters:
fdPIC - The PIC handle. This is obtained after a call to PIC_Initialise( ).
Returns:
Success/error code. See list of PIC API Return Codes.

Here is the call graph for this function:

int ReadBatteryVoltage int  fdPIC  ) 
 

Reads the current PIC battery voltage and displays to screen. This is a 10-bit value with a corresponding range of 0 to 1023.

Date:
11/1/05
Author:
Mike Ballinger
Parameters:
fdPIC - The PIC handle. This is obtained after a call to PIC_Initialise( ).
Returns:
Success/error code. See list of PIC API Return Codes.

Here is the call graph for this function:

int ReadMinETXVoltage int  fdPIC  ) 
 

Reads the minimum ETX voltage and displays to screen. This is a 10-bit value with a corresponding range of 0 to 1023.

Date:
11/1/05
Author:
Mike Ballinger
Parameters:
fdPIC - The PIC handle. This is obtained after a call to PIC_Initialise( ).
Returns:
Success/error code. See list of PIC API Return Codes.

Here is the call graph for this function:

int ReadPowerOnAndOffTimes int  fdPIC  ) 
 

Displays to screen the last PIC power off and power on times.

Date:
11/1/05
Author:
Mike Ballinger
Parameters:
fdPIC - The PIC handle. This is obtained after a call to PIC_Initialise( ).
Returns:
Success/error code. See list of PIC API Return Codes.

Here is the call graph for this function:

int ReadRealTimeClock int  fdPIC  ) 
 

Displays to screen the current PIC RTC.

Date:
11/1/05
Author:
Mike Ballinger
Parameters:
fdPIC - The PIC handle. This is obtained after a call to PIC_Initialise( ).
Returns:
Success/error code. See list of PIC API Return Codes.

Here is the call graph for this function:

int ReadSwitches int  fdPIC  ) 
 

Reads the switch position and displays to screen as an 8-bit binary value.

Date:
11/1/05
Author:
Mike Ballinger
Parameters:
fdPIC - The PIC handle. This is obtained after a call to PIC_Initialise( ).
Returns:
Success/error code. See list of PIC API Return Codes.

Here is the call graph for this function:

int ReadSwitchLog int  fdPIC  ) 
 

Reads the entire power-off switch log and displays it to screen.

Date:
11/1/05
Author:
Mike Ballinger
Parameters:
fdPIC - The PIC handle. This is obtained after a call to PIC_Initialise( ).
Returns:
Success/error code. See list of PIC API Return Codes.

Here is the call graph for this function:

int SetRealTimeClock int  fdPIC  ) 
 

Sets the PIC clock to the current PC time.

Date:
11/1/05
Author:
Mike Ballinger
Parameters:
fdPIC - The PIC handle. This is obtained after a call to PIC_Initialise( ).
Returns:
Success/error code. See list of PIC API Return Codes.

Here is the call graph for this function:


Generated on Mon Jan 24 14:26:44 2005 for AXIS PIC API by doxygen 1.3.6