diff --git a/examples/pinproctest/pinproctest.h b/examples/pinproctest/pinproctest.h index 6a9bc67..d5434eb 100644 --- a/examples/pinproctest/pinproctest.h +++ b/examples/pinproctest/pinproctest.h @@ -27,6 +27,12 @@ * pinproctest.cpp * libpinproc */ +#ifndef PINPROCTEST_PINPROCTEST_H +#define PINPROCTEST_PINPROCTEST_H +#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif + #include #include #include @@ -75,3 +81,5 @@ void ConfigureDMD(PRHandle proc); void UpdateDots(unsigned char * dots, unsigned int dotOffset); void UpdateAlphaDisplay(PRHandle, int); + +#endif /* PINPROCTEST_PINPROCTEST_H */ diff --git a/include/pinproc.h b/include/pinproc.h index a5ee89d..8f02c38 100644 --- a/include/pinproc.h +++ b/include/pinproc.h @@ -27,9 +27,11 @@ * @brief libpinproc, P-ROC Layer 1 API (Preliminary) * */ - -#ifndef _PINPROC_H_ -#define _PINPROC_H_ +#ifndef PINPROC_PINPROC_H +#define PINPROC_PINPROC_H +#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif /* * 3rd party "stdint.h" replacement available for Visual C++ before version 2010. @@ -93,7 +95,7 @@ PR_EXPORT void PRLogSetLevel(PRLogLevel level); PR_EXPORT const char *PRGetLastErrorText(); -/** +/** * @defgroup device Device Creation & Deletion * @{ */ @@ -118,7 +120,7 @@ PR_EXPORT void PRDelete(PRHandle handle); /**< Destroys an existin /** * @brief Resets internally maintained driver and switch rule structures. - * @param resetFlags Specify #kPRResetFlagDefault to only reset the configuration in host memory. #kPRResetFlagUpdateDevice will write the default configuration to the device, effectively disabling all drivers and switch rules. + * @param resetFlags Specify #kPRResetFlagDefault to only reset the configuration in host memory. #kPRResetFlagUpdateDevice will write the default configuration to the device, effectively disabling all drivers and switch rules. */ PR_EXPORT PRResult PRReset(PRHandle handle, uint32_t resetFlags); @@ -156,9 +158,9 @@ PR_EXPORT PRResult PRManagerUpdateConfig(PRHandle handle, PRManagerConfig *manag #define kPRDriverGroupsMax (26) /**< Number of available driver groups. */ #define kPRDriverCount (256) /**< Total number of drivers */ -#define kPRDriverAuxCmdOutput (2) -#define kPRDriverAuxCmdDelay (1) -#define kPRDriverAuxCmdJump (0) +#define kPRDriverAuxCmdOutput (2) +#define kPRDriverAuxCmdDelay (1) +#define kPRDriverAuxCmdJump (0) typedef struct PRDriverGlobalConfig { bool_t enableOutputs; // Formerly enable_direct_outputs @@ -225,7 +227,7 @@ PR_EXPORT PRResult PRDriverGetState(PRHandle handle, uint8_t driverNum, PRDriver PR_EXPORT PRResult PRDriverUpdateState(PRHandle handle, PRDriverState *driverState); /** * @brief Loads the driver defaults for the given machine type. - * + * * PRReset() calls this function internally; this function is useful for basing custom driver settings off of the defaults for a particular machine. * @note This function does not update the P-ROC hardware, only the internal data structures. Use PRDriverGetGlobalConfig() and PRDriverGetGroupConfig() to retrieve the settings. */ @@ -233,106 +235,106 @@ PR_EXPORT PRResult PRDriverLoadMachineTypeDefaults(PRHandle handle, PRMachineTyp // Driver Group Helper functions: -/** - * Disables (turns off) the given driver group. +/** + * Disables (turns off) the given driver group. * This function is provided for convenience. See PRDriverGroupDisable() for a full description. */ PR_EXPORT PRResult PRDriverGroupDisable(PRHandle handle, uint8_t groupNum); // Driver Helper functions: -/** - * Disables (turns off) the given driver. +/** + * Disables (turns off) the given driver. * This function is provided for convenience. See PRDriverStateDisable() for a full description. */ PR_EXPORT PRResult PRDriverDisable(PRHandle handle, uint8_t driverNum); -/** - * Pulses the given driver for a number of milliseconds. +/** + * Pulses the given driver for a number of milliseconds. * This function is provided for convenience. See PRDriverStatePulse() for a full description. */ PR_EXPORT PRResult PRDriverPulse(PRHandle handle, uint8_t driverNum, uint8_t milliseconds); -/** - * Assigns a repeating schedule to the given driver. +/** + * Assigns a repeating schedule to the given driver. * This function is provided for convenience. See PRDriverStateSchedule() for a full description. */ PR_EXPORT PRResult PRDriverSchedule(PRHandle handle, uint8_t driverNum, uint32_t schedule, uint8_t cycleSeconds, bool_t now); -/** - * Assigns a pitter-patter schedule (repeating on/off) to the given driver. +/** + * Assigns a pitter-patter schedule (repeating on/off) to the given driver. * This function is provided for convenience. See PRDriverStatePatter() for a full description. */ PR_EXPORT PRResult PRDriverPatter(PRHandle handle, uint8_t driverNum, uint8_t millisecondsOn, uint8_t millisecondsOff, uint8_t originalOnTime); -/** - * Assigns a pitter-patter schedule (repeating on/off) to the given driver on for the given duration. +/** + * Assigns a pitter-patter schedule (repeating on/off) to the given driver on for the given duration. * This function is provided for convenience. See PRDriverStatePulsedPatter() for a full description. */ PR_EXPORT PRResult PRDriverPulsedPatter(PRHandle handle, uint8_t driverNum, uint8_t millisecondsOn, uint8_t millisecondsOff, uint8_t originalOnTime); -/** - * Assigns a pitter-patter schedule (repeating on/off) to the given driver for the given duration. +/** + * Assigns a pitter-patter schedule (repeating on/off) to the given driver for the given duration. * This function is provided for convenience. See PRDriverStatePatter() for a full description. */ PR_EXPORT PRResult PRDriverPulsedPatter(PRHandle handle, uint8_t driverNum, uint8_t millisecondsOn, uint8_t millisecondsOff, uint8_t originalOnTime); -/** +/** * Prepares an Aux Command to drive the Aux bus. - * This function is provided for convenience. + * This function is provided for convenience. */ PR_EXPORT void PRDriverAuxPrepareOutput(PRDriverAuxCommand *auxCommand, uint8_t data, uint8_t extraData, uint8_t enables, bool_t muxEnables, uint16_t delayTime); -/** +/** * Prepares an Aux Command to delay the Aux logic. - * This function is provided for convenience. + * This function is provided for convenience. */ PR_EXPORT void PRDriverAuxPrepareDelay(PRDriverAuxCommand *auxCommand, uint16_t delayTime); -/** +/** * Prepares an Aux Command to have the Aux memory pointer jump to a new address. - * This function is provided for convenience. + * This function is provided for convenience. */ PR_EXPORT void PRDriverAuxPrepareJump(PRDriverAuxCommand *auxCommand, uint8_t jumpAddr); -/** +/** * Prepares a disabled Aux Command. - * This function is provided for convenience. + * This function is provided for convenience. */ PR_EXPORT void PRDriverAuxPrepareDisable(PRDriverAuxCommand *auxCommand); /** Tickle the watchdog timer. */ PR_EXPORT PRResult PRDriverWatchdogTickle(PRHandle handle); -/** +/** * Changes the given #PRDriverGroupConfig to reflect a disabled group. * @note The driver group config structure must be applied using PRDriverUpdateGroupConfig() to have any effect. */ PR_EXPORT void PRDriverGroupStateDisable(PRDriverGroupConfig *driverGroup); -/** +/** * Changes the given #PRDriverState to reflect a disabled state. * @note The driver state structure must be applied using PRDriverUpdateState() or linked to a switch rule using PRSwitchUpdateRule() to have any effect. */ PR_EXPORT void PRDriverStateDisable(PRDriverState *driverState); -/** +/** * Changes the given #PRDriverState to reflect a pulse state. * @param milliseconds Number of milliseconds to pulse the driver for. * @note The driver state structure must be applied using PRDriverUpdateState() or linked to a switch rule using PRSwitchUpdateRule() to have any effect. */ PR_EXPORT void PRDriverStatePulse(PRDriverState *driverState, uint8_t milliseconds); -/** +/** * Changes the given #PRDriverState to reflect a scheduled state. - * Assigns a repeating schedule to the given driver. + * Assigns a repeating schedule to the given driver. * @note The driver state structure must be applied using PRDriverUpdateState() or linked to a switch rule using PRSwitchUpdateRule() to have any effect. */ PR_EXPORT void PRDriverStateSchedule(PRDriverState *driverState, uint32_t schedule, uint8_t cycleSeconds, bool_t now); -/** +/** * @brief Changes the given #PRDriverState to reflect a pitter-patter schedule state. * Assigns a pitter-patter schedule (repeating on/off) to the given driver. * @note The driver state structure must be applied using PRDriverUpdateState() or linked to a switch rule using PRSwitchUpdateRule() to have any effect. - * + * * Use originalOnTime to pulse the driver for a number of milliseconds before the pitter-patter schedule begins. */ PR_EXPORT void PRDriverStatePatter(PRDriverState *driverState, uint8_t millisecondsOn, uint8_t millisecondsOff, uint8_t originalOnTime); -/** +/** * @brief Changes the given #PRDriverState to reflect a pitter-patter schedule state. * Just like the regular Patter above, but PulsePatter only drives the patter * scheduled for the given number of milliseconds before disabling the driver. */ PR_EXPORT void PRDriverStatePulsedPatter(PRDriverState *driverState, uint8_t millisecondsOn, uint8_t millisecondsOff, uint8_t patterTime); -/** +/** * Write Aux Port commands into the Aux Port command memory. */ @@ -371,7 +373,7 @@ typedef struct PREvent { uint32_t time; /**< Time (in milliseconds) that this event occurred. */ } PREvent; -/** Get all of the available events that have been received. +/** Get all of the available events that have been received. * \return Number of events returned; -1 if an error occurred. */ PR_EXPORT int PRGetEvents(PRHandle handle, PREvent *eventsOut, int maxEvents); @@ -406,31 +408,31 @@ PR_EXPORT PRResult PRSwitchUpdateConfig(PRHandle handle, PRSwitchConfig *switchC /** * @brief Configures the handling of switch rules within P-ROC. - * + * * P-ROC's switch rule system allows the user to decide which switch events are returned to software, * as well as optionally linking one or more driver state changes to rules to create immediate feedback (such as in pop bumpers). - * - * For instance, P-ROC can provide debounced switch events for a flipper button so software can apply lange change behavior. + * + * For instance, P-ROC can provide debounced switch events for a flipper button so software can apply lange change behavior. * This is accomplished by configuring the P-ROC with a switch rule for the flipper button and then receiving the events via the PRGetEvents() call. * The same switch can also be configured with a non-debounced rule to fire a flipper coil. * Multiple driver changes can be tied to a single switch state transition to create more complicated effects: a slingshot * switch that fires the slingshot coil, a flash lamp, and a score event. - * + * * P-ROC holds four different switch rules for each switch: closed to open and open to closed, each with a debounced and non-debounced versions: * - #kPREventTypeSwitchOpenDebounced - * - #kPREventTypeSwitchClosedDebounced + * - #kPREventTypeSwitchClosedDebounced * - #kPREventTypeSwitchOpenNondebounced * - #kPREventTypeSwitchClosedNondebounced - * + * * @section Examples - * + * * Configuring a basic switch rule to simply notify software via PRGetEvents() without affecting any coil/lamp drivers: * @code * PRSwitchRule rule; * rule.notifyHost = true; * PRSwitchUpdateRule(handle, switchNum, kPREventTypeSwitchOpenDebounced, &rule, NULL, 0); * @endcode - * + * * Configuring a pop bumper switch to pulse the coil and a flash lamp for 50ms each: * @code * // Configure a switch rule to fire the coil and flash lamp: @@ -441,14 +443,14 @@ PR_EXPORT PRResult PRSwitchUpdateConfig(PRHandle handle, PRSwitchConfig *switchC * PRDriverGetState(handle, drvFlashLamp1, &drivers[1]); * PRDriverStatePulse(&drivers[0], 50); * PRDriverStatePulse(&drivers[1], 50); - * PRSwitchUpdateRule(handle, swPopBumper1, kPREventTypeSwitchClosedNondebounced, + * PRSwitchUpdateRule(handle, swPopBumper1, kPREventTypeSwitchClosedNondebounced, * &rule, drivers, 2); * // Now configure a switch rule to process scoring in software: * rule.notifyHost = true; - * PRSwitchUpdateRule(handle, swPopBumper1, kPREventTypeSwitchClosedDebounced, + * PRSwitchUpdateRule(handle, swPopBumper1, kPREventTypeSwitchClosedDebounced, * &rule, NULL, 0); * @endcode - * + * * @param handle The P-ROC device handle. * @param switchNum The index of the switch this configuration affects. * @param eventType The switch rule for the specified switchNum to be configured. @@ -531,8 +533,8 @@ PR_EXTERN_C_END /** * @mainpage libpinproc API Documentation - * + * * This is the documentation for libpinproc, the P-ROC Layer 1 API. */ -#endif // _PINPROC_H_ +#endif /* PINPROC_PINPROC_H */ diff --git a/src/PRCommon.h b/src/PRCommon.h index b3a541f..8508761 100644 --- a/src/PRCommon.h +++ b/src/PRCommon.h @@ -22,8 +22,11 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ -#ifndef _PRCOMMON_H_ -#define _PRCOMMON_H_ +#ifndef PINPROC_PRCOMMON_H +#define PINPROC_PRCOMMON_H +#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif #ifdef NDEBUG # define DEBUG(block) @@ -34,4 +37,4 @@ void PRLog(PRLogLevel level, const char *format, ...); void PRSetLastErrorText(const char *format, ...); -#endif // _PRCOMMON_H_ +#endif /* PINPROC_PRCOMMON_H */ diff --git a/src/PRDevice.h b/src/PRDevice.h index 6a7d3a7..2582d1c 100644 --- a/src/PRDevice.h +++ b/src/PRDevice.h @@ -27,6 +27,11 @@ * PRDevice.h * libpinproc */ +#ifndef PINPROC_PRDEVICE_H +#define PINPROC_PRDEVICE_H +#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif #include "pinproc.h" #include "PRCommon.h" @@ -167,3 +172,5 @@ protected: queue freeSwitchRuleIndexes; /**< Indexes of available switch rules. */ PRSwitchRuleInternal *GetSwitchRuleByIndex(uint16_t index); }; + +#endif /* PINPROC_PRDEVICE_H */ diff --git a/src/PRHardware.h b/src/PRHardware.h index 508d45c..b733dbd 100644 --- a/src/PRHardware.h +++ b/src/PRHardware.h @@ -23,8 +23,11 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ -#ifndef _PROC_HARDWARE_H_ -#define _PROC_HARDWARE_H_ +#ifndef PINPROC_PRHARDWARE_H +#define PINPROC_PRHARDWARE_H +#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif #include #include "pinproc.h" @@ -244,7 +247,7 @@ typedef struct PRSwitchRuleInternal { } PRSwitchRuleInternal; -bool_t IsStern (uint32_t hardware_data); +bool_t IsStern (uint32_t hardware_data); uint32_t CreateRegRequestWord( uint32_t select, uint32_t addr, uint32_t num_words); uint32_t CreateBurstCommand ( uint32_t select, uint32_t addr, uint32_t num_words); int32_t CreateManagerUpdateConfigBurst ( uint32_t * burst, PRManagerConfig *manager_config); @@ -274,4 +277,4 @@ void PRHardwareClose(); int PRHardwareRead(uint8_t *buffer, int maxBytes); int PRHardwareWrite(uint8_t *buffer, int bytes); -#endif // _PROC_HARDWARE_H_ +#endif /* PINPROC_PRHARDWARE_H */ diff --git a/utils/pinprocfw/lenval.h b/utils/pinprocfw/lenval.h index 28af600..01fd684 100644 --- a/utils/pinprocfw/lenval.h +++ b/utils/pinprocfw/lenval.h @@ -3,9 +3,11 @@ /* abstract: This file contains a description of the */ /* data structure "lenval". */ /*******************************************************/ - -#ifndef lenval_dot_h -#define lenval_dot_h +#ifndef PINPROCFW_LENVAL_H +#define PINPROCFW_LENVAL_H +#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif /* the lenVal structure is a byte oriented type used to store an */ /* arbitrary length binary value. As an example, the hex value */ @@ -90,5 +92,4 @@ extern void SetBit(lenVal *lv, int byte, int bit, short val); /* read from XSVF numBytes bytes of data into x */ extern void readVal(lenVal *x, short numBytes); -#endif - +#endif /* PINPROCFW_LENVAL_H */ diff --git a/utils/pinprocfw/pinprocfw.h b/utils/pinprocfw/pinprocfw.h index de4dddf..1621e87 100644 --- a/utils/pinprocfw/pinprocfw.h +++ b/utils/pinprocfw/pinprocfw.h @@ -10,8 +10,11 @@ * in the readByte() function. * FINALLY - Call xsvfExecute(). *****************************************************************************/ -#ifndef PINPROCFW_H -#define PINPROCFW_H +#ifndef PINPROCFW_PINPROCFW_H +#define PINPROCFW_PINPROCFW_H +#if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4 +#pragma once +#endif #if defined(__WIN32__) || defined(_WIN32) #include @@ -67,5 +70,4 @@ void readByte(unsigned char *data); void waitTime(long microsec); -#endif /* PINPROCFW_H */ - +#endif /* PINPROCFW_PINPROCFW_H */