Go to the source code of this file.
Defines | |
#define | NUM_UART_MODS 1 |
#define | REPORT_ERROR(msg) reportError(ERROR_FILE_LINE(msg)) |
#define | USE_HEARTBEAT 1 |
#define | HB_LED _LATB15 |
#define | CONFIG_HB_LED() CONFIG_RB15_AS_DIG_OD_OUTPUT() |
Bitfield to struct conversion | |
Given a bitfield struct representing an SFR, convert this to a word (uint16) or to the high and low bytes (uint8) of that word. Note: though this looks ugly, it introduces no unexpected compiler overhead at -O1. See u16_INTTREGlast for an example. | |
#define | BITS2WORD(sfrBitfield) ( *((uint16*) &sfrBitfield) ) |
#define | BITS2BYTEL(sfrBitfield) ( ((uint8*) &sfrBitfield)[0] ) |
#define | BITS2BYTEH(sfrBitfield) ( ((uint8*) &sfrBitfield)[1] ) |
Functions | |
void | reportError (const char *szErrorMessage) |
void | printResetCause (void) |
void | configPinsForLowPower (void) |
void | configBasic (const char *psz_helloMsg) |
See also pic24_util.c for details on how these functions were implemented.
Definition in file pic24_util.h.
#define CONFIG_HB_LED | ( | ) | CONFIG_RB15_AS_DIG_OD_OUTPUT() |
Define a config function for the heartbeat pin.
Definition at line 735 of file pic24_util.h.
#define HB_LED _LATB15 |
Choose a pin for the heartbeat. If USE_HEARTBEAT is false, the heartbeat is disabled.
Definition at line 733 of file pic24_util.h.
#define NUM_UART_MODS 1 |
Defined the number of UART modules supported by this chip. NOTE: this only works when testing #defines, not testing variable. So, don't test UxSTA; instead, test _UxRXIF which is uniquely defined for each UART. (Idea taken from the C30 peripheral library, in uart.h.)
Definition at line 646 of file pic24_util.h.
#define REPORT_ERROR | ( | msg | ) | reportError(ERROR_FILE_LINE(msg)) |
Report an error on reset via reportError, also printing the file and line number where this macro was called via a call to ERROR_FILE_LINE.
msg | Error message to report |
Definition at line 697 of file pic24_util.h.
#define USE_HEARTBEAT 1 |
If this macro is true, heartbeat functionality is enabled. If false, heartbeat is disabled.
Definition at line 726 of file pic24_util.h.
void configBasic | ( | const char * | sz_helloMsg | ) |
Perform basic chip configuration:
sz_helloMsg | Hello message to print. |
Definition at line 454 of file pic24_util.c.
void configPinsForLowPower | ( | void | ) |
This function puts the PIC24 in low-power mode by:
WARNING: if pullups are enabled on pins used by the oscillator, the clock typically stops running. Currently, this code works for demo purposes with the FRC oscillator when used in the reset.c program. It *should* also work with primary and secondary oscillators, using conditional compiles in the code.
Definition at line 440 of file pic24_util.c.
void printResetCause | ( | void | ) |
Determines and prints the cause of a CPU reset. This should be called when the chip first starts up. For an example, see the configBasic function.
Definition at line 275 of file pic24_util.c.
void reportError | ( | const char * | sz_errorMessage | ) |
Report a critical error by recording a message in sz_lastError then resetting the chip, assuming hat printResetCause will be called during chip initialization.
sz_errorMessage | Error message to report. |
Definition at line 141 of file pic24_util.c.