|
Sonoma (MAXREFDES14#) Code Documentation
V01.00
Isolated EMP (Energy Measurement Processor)
|
#include "xbasic_types.h"#include "xspi_l.h"#include "stdio.h"#include "xiic_l.h"#include "xuartlite_i.h"#include "xparameters.h"#include "xgpio.h"#include "xgpio_l.h"#include "MAXREFDES14.h"Go to the source code of this file.
Functions | |
| int | SpiRW (u32 unPeripheralAddressSPI, unsigned int unCPHA, unsigned int unCPOL, u8 *auchWriteBuf, u8 *auchReadBuf, int unNumBytes, u8 uchCsActiveHigh) |
| Perform a SPI read or write. | |
| void | delay (int nStopValue) |
| Loop for nStopValue iterations to provide a delay. | |
| void | led_knight_rider (XGpio *pLED_GPIO, int nNumberOfTimes) |
| Blink a row of LEDs nNumberOfTimes times. | |
| void | max_configure_PMOD_port (u8 uchPmodPortA, u8 uchPmodPortB, u8 uchPmodPortC, u8 uchPmodPortD) |
| Configure driving peripherals on each Pmod port. | |
| int | check_if_i2c_device_is_present () |
| Test for SDA and SCL pullups. | |
| int | number_raised_to_power (int nBase, int nExponent) |
| Raise nBase to the nExponent power (operates with integers only). | |
| int | receive_byte_with_timeout (u32 unUartAddress, int nTimeoutInTenthsOfSeconds, u8 *uchRxData) |
| Receive a byte from the UART located at *pUartAddress. | |
| void | set_seven_segment_character (u8 uchDigitNumber, u8 uchValue, u8 uchDecimalActive) |
| void | print_seven_segment_number (float fNumber) |
| void | print_seven_segment_time (struct maximDateTime *t) |
| int | GetLine (char *sInputString, unsigned int unMaxSize) |
| Retrieve a line of characters from the default Hyperterminal UART (DEFAULT_HYPERTERMINAL_UART). | |
| void | print_asterisks (int nQuantity) |
| Print nQuantity of asterisks to the default Hyperterminal UART. | |
| void | printf_temp (float fTemp, u8 uchPrintCelsius, u8 uchAddCarriageReturn) |
| Print temperature as xx.x as degrees F or C. | |
| void | print_seven_segment_temperature (float temp, u8 uchPrintCelsius) |
| void | print_seven_segment_four_digits (char *puchArray) |
| int | htoi (char *sStr) |
| u8 | getUartByte (u32 nUartAddress) |
| Get a byte from either the full UART in the Zynq PS, or a Xilinx UartLite. | |
Variables | |
| struct maximDateTime * | t |
Project: Maxim Plug-in Peripheral Modules
Filename: utilities.h
Description: This module contains a collection of general utility
functions which are not specific to any particular
module.
Revision History:
4-13-12 Rev 1.0 Seth Messimer Initial Release
7-20-12 Rev 1.4 Nathan Young Additional functions
This code follows the following naming conventions.
char chPmodValue char (array) sPmodString[16] float fPmodValue int nPmodValue int (array) anPmodValue[16] u16 uPmodValue u8 uchPmodValue u8 (array) auchPmodBuffer[16] unsigned int unPmodValue int * punPmodValue
Definition in file utilities.h.
| int check_if_i2c_device_is_present | ( | ) |
Test for SDA and SCL pullups.
| None |
| TRUE | if pull-ups present, FALSE if pullups not present |
Definition at line 261 of file utilities.c.
| void delay | ( | int | nStopValue | ) |
Loop for nStopValue iterations to provide a delay.
| [in] | nStopValue | - number of iterations to loop |
| None |
Definition at line 165 of file utilities.c.
| int GetLine | ( | char * | sInputString, |
| unsigned int | unMaxSize | ||
| ) |
Retrieve a line of characters from the default Hyperterminal UART (DEFAULT_HYPERTERMINAL_UART).
| [in] | sInputString | - pointer to buffer for input string |
| [in] | unMaxSize | - maximum number of characters to input |
| TRUE | if operation succeeded |
Definition at line 393 of file utilities.c.
| u8 getUartByte | ( | u32 | nUartAddress | ) |
Get a byte from either the full UART in the Zynq PS, or a Xilinx UartLite.
| [in] | unUartAddress. | 32 bit UART address |
| Returns | the next byte from the Uart Rx FIFO |
Definition at line 442 of file utilities.c.
| int htoi | ( | char * | sStr | ) |
Definition at line 457 of file utilities.c.
| void led_knight_rider | ( | XGpio * | pLED_GPIO, |
| int | nNumberOfTimes | ||
| ) |
Blink a row of LEDs nNumberOfTimes times.
| [in] | *pLED_GPIO | - address of the GPIO peripheral driving the LEDs in MicroBlaze memory map |
| None |
Definition at line 186 of file utilities.c.
| void max_configure_PMOD_port | ( | u8 | uchPmodPortA, |
| u8 | uchPmodPortB, | ||
| u8 | uchPmodPortC, | ||
| u8 | uchPmodPortD | ||
| ) |
Configure driving peripherals on each Pmod port.
| [in] | uchPmodPortA | - 2-bit number to define configuration for Pmod port A |
| [in] | uchPmodPortB | - 2-bit number to define configuration for Pmod port B |
| [in] | uchPmodPortC | - 2-bit number to define configuration for Pmod port C |
| [in] | uchPmodPortD | - 2-bit number to define configuration for Pmod port D |
| TRUE | if operation succeeded |
Definition at line 221 of file utilities.c.
| int number_raised_to_power | ( | int | nBase, |
| int | nExponent | ||
| ) |
Raise nBase to the nExponent power (operates with integers only).
| [in] | nBase | - base |
| [in] | nExponent | - exponent |
| Base^Exponent |
Definition at line 308 of file utilities.c.
| void print_asterisks | ( | int | nQuantity | ) |
Print nQuantity of asterisks to the default Hyperterminal UART.
| [in] | nQuantity | - number of asterisks to print |
| None |
Definition at line 64 of file utilities.c.
| void print_seven_segment_four_digits | ( | char * | puchArray | ) |
| void print_seven_segment_number | ( | float | fNumber | ) |
| void print_seven_segment_temperature | ( | float | temp, |
| u8 | uchPrintCelsius | ||
| ) |
| void print_seven_segment_time | ( | struct maximDateTime * | t | ) |
| void printf_temp | ( | float | fTemp, |
| u8 | uchPrintCelsius, | ||
| u8 | uchAddCarriageReturn | ||
| ) |
Print temperature as xx.x as degrees F or C.
| [in] | fTemp | - temperature to print in celsius |
| [in] | uchPrintCelsius | - true = print as celsius, false = print as fahrenheit |
| [in] | uchAddCarriageReturn | - true = add a carriage return |
| None |
Definition at line 420 of file utilities.c.
| int receive_byte_with_timeout | ( | u32 | unUartAddress, |
| int | nTimeoutInTenthsOfSeconds, | ||
| u8 * | uchRxData | ||
| ) |
Receive a byte from the UART located at *pUartAddress.
| [in] | unUartAddress | - address of the UART peripheral in MicroBlaze memory map |
| [in] | nTimeoutInTenthsOfSeconds | - amount of time to allow before TIMEOUT |
| [out] | *uchRxData | - received data is stored at uchRxData |
| TRUE | if operation succeeded |
Definition at line 337 of file utilities.c.
| void set_seven_segment_character | ( | u8 | uchDigitNumber, |
| u8 | uchValue, | ||
| u8 | uchDecimalActive | ||
| ) |
| int SpiRW | ( | u32 | unPeripheralAddressSPI, |
| unsigned int | unCPHA, | ||
| unsigned int | unCPOL, | ||
| u8 * | auchWriteBuf, | ||
| u8 * | auchReadBuf, | ||
| int | unNumBytes, | ||
| u8 | uchCsActiveHigh | ||
| ) |
Perform a SPI read or write.
| [in] | unPeripheralAddressSPI | - |
| [in] | unCPHA | - phase of SCK (edge to trigger on). 0=Leading edge, 1=Trailing edge |
| [in] | unCPOL | - polarity of SCK. 0=Active high, 1=Active low |
| [in] | auchWriteBuf | - pointer to write data buffer |
| [in] | auchReadBuf | - pointer to read data buffer |
| [in] | unNumBytes | - number of bytes to transfer |
| [in] | uchCsActiveHigh | - polarity of slave select 0=active low, 1=active high |
| Always | returns 0 |
Definition at line 78 of file utilities.c.
| struct maximDateTime* t |
Definition at line 101 of file utilities.h.