Spell check all source code variables, comments and strings.
This commit is contained in:
parent
c647c27639
commit
d6edfe35c8
66 changed files with 247 additions and 247 deletions
|
@ -48,7 +48,7 @@ int main(void)
|
|||
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
|
||||
|
||||
for (;;)
|
||||
{
|
||||
{
|
||||
Process_AVRISP_Commands();
|
||||
|
||||
V2Params_UpdateParamValues();
|
||||
|
@ -111,20 +111,20 @@ void EVENT_USB_Device_ConfigurationChanged(void)
|
|||
}
|
||||
}
|
||||
|
||||
/** Processes incomming V2 Protocol commands from the host, returning a response when required. */
|
||||
void Process_AVRISP_Commands(void)
|
||||
{
|
||||
/** Processes incoming V2 Protocol commands from the host, returning a response when required. */
|
||||
void Process_AVRISP_Commands(void)
|
||||
{
|
||||
/* Device must be connected and configured for the task to run */
|
||||
if (USB_DeviceState != DEVICE_STATE_Configured)
|
||||
return;
|
||||
|
||||
return;
|
||||
|
||||
Endpoint_SelectEndpoint(AVRISP_DATA_EPNUM);
|
||||
|
||||
/* Check to see if a V2 Protocol command has been received */
|
||||
|
||||
/* Check to see if a V2 Protocol command has been received */
|
||||
if (Endpoint_IsOUTReceived())
|
||||
{
|
||||
/* Pass off processing of the V2 Protocol command to the V2 Protocol handler */
|
||||
{
|
||||
/* Pass off processing of the V2 Protocol command to the V2 Protocol handler */
|
||||
V2Protocol_ProcessCommand();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -36,12 +36,12 @@
|
|||
#define INCLUDE_FROM_V2PROTOCOL_C
|
||||
#include "V2Protocol.h"
|
||||
|
||||
/** Master V2 Protocol packet handler, for receieved V2 Protocol packets from a connected host.
|
||||
/** Master V2 Protocol packet handler, for received V2 Protocol packets from a connected host.
|
||||
* This routine decodes the issued command and passes off the handling of the command to the
|
||||
* appropriate function.
|
||||
*/
|
||||
void V2Protocol_ProcessCommand(void)
|
||||
{
|
||||
void V2Protocol_ProcessCommand(void)
|
||||
{
|
||||
uint8_t V2Command = Endpoint_Read_Byte();
|
||||
|
||||
switch (V2Command)
|
||||
|
@ -95,8 +95,8 @@ void V2Protocol_ProcessCommand(void)
|
|||
}
|
||||
|
||||
Endpoint_WaitUntilReady();
|
||||
Endpoint_SetEndpointDirection(ENDPOINT_DIR_OUT);
|
||||
}
|
||||
Endpoint_SetEndpointDirection(ENDPOINT_DIR_OUT);
|
||||
}
|
||||
|
||||
/** Handler for unknown V2 protocol commands. This discards all sent data and returns a
|
||||
* STATUS_CMD_UNKNOWN status back to the host.
|
||||
|
@ -105,7 +105,7 @@ void V2Protocol_ProcessCommand(void)
|
|||
*/
|
||||
static void V2Protocol_Command_Unknown(uint8_t V2Command)
|
||||
{
|
||||
/* Discard all incomming data */
|
||||
/* Discard all incoming data */
|
||||
while (Endpoint_BytesInEndpoint() == AVRISP_DATA_EPSIZE)
|
||||
{
|
||||
Endpoint_ClearOUT();
|
||||
|
@ -120,7 +120,7 @@ static void V2Protocol_Command_Unknown(uint8_t V2Command)
|
|||
Endpoint_ClearIN();
|
||||
}
|
||||
|
||||
/** Handler for the CMD_SIGN_ON command, returning the programmer ID string to the host. */
|
||||
/** Handler for the CMD_SIGN_ON command, returning the programmer ID string to the host. */
|
||||
static void V2Protocol_Command_SignOn(void)
|
||||
{
|
||||
Endpoint_ClearOUT();
|
||||
|
@ -151,7 +151,7 @@ static void V2Protocol_Command_GetSetParam(uint8_t V2Command)
|
|||
|
||||
Endpoint_Write_Byte(V2Command);
|
||||
|
||||
uint8_t ParamPrivs = V2Params_GetParameterPrivellages(ParamID);
|
||||
uint8_t ParamPrivs = V2Params_GetParameterPrivileges(ParamID);
|
||||
|
||||
if ((V2Command == CMD_SET_PARAMETER) && (ParamPrivs & PARAM_PRIV_WRITE))
|
||||
{
|
||||
|
|
|
@ -44,43 +44,43 @@ static ParameterItem_t ParameterTable[] =
|
|||
{
|
||||
{ .ParamID = PARAM_BUILD_NUMBER_LOW,
|
||||
.ParamValue = (LUFA_VERSION_INTEGER >> 8),
|
||||
.ParamPrivellages = PARAM_PRIV_READ },
|
||||
.ParamPrivileges = PARAM_PRIV_READ },
|
||||
|
||||
{ .ParamID = PARAM_BUILD_NUMBER_HIGH,
|
||||
.ParamValue = (LUFA_VERSION_INTEGER & 0xFF),
|
||||
.ParamPrivellages = PARAM_PRIV_READ },
|
||||
.ParamPrivileges = PARAM_PRIV_READ },
|
||||
|
||||
{ .ParamID = PARAM_HW_VER,
|
||||
.ParamValue = 0x00,
|
||||
.ParamPrivellages = PARAM_PRIV_READ },
|
||||
.ParamPrivileges = PARAM_PRIV_READ },
|
||||
|
||||
{ .ParamID = PARAM_SW_MAJOR,
|
||||
.ParamValue = 0x01,
|
||||
.ParamPrivellages = PARAM_PRIV_READ },
|
||||
.ParamPrivileges = PARAM_PRIV_READ },
|
||||
|
||||
{ .ParamID = PARAM_SW_MINOR,
|
||||
.ParamValue = 0x0C,
|
||||
.ParamPrivellages = PARAM_PRIV_READ },
|
||||
.ParamPrivileges = PARAM_PRIV_READ },
|
||||
|
||||
{ .ParamID = PARAM_VTARGET,
|
||||
.ParamValue = 0x32,
|
||||
.ParamPrivellages = PARAM_PRIV_READ },
|
||||
.ParamPrivileges = PARAM_PRIV_READ },
|
||||
|
||||
{ .ParamID = PARAM_SCK_DURATION,
|
||||
.ParamValue = (TOTAL_PROGRAMMING_SPEEDS - 1),
|
||||
.ParamPrivellages = PARAM_PRIV_READ | PARAM_PRIV_WRITE },
|
||||
.ParamPrivileges = PARAM_PRIV_READ | PARAM_PRIV_WRITE },
|
||||
|
||||
{ .ParamID = PARAM_RESET_POLARITY,
|
||||
.ParamValue = 0x00,
|
||||
.ParamPrivellages = PARAM_PRIV_WRITE },
|
||||
.ParamPrivileges = PARAM_PRIV_WRITE },
|
||||
|
||||
{ .ParamID = PARAM_STATUS_TGT_CONN,
|
||||
.ParamValue = 0x00,
|
||||
.ParamPrivellages = PARAM_PRIV_READ },
|
||||
.ParamPrivileges = PARAM_PRIV_READ },
|
||||
|
||||
{ .ParamID = PARAM_DISCHARGEDELAY,
|
||||
.ParamValue = 0x00,
|
||||
.ParamPrivellages = PARAM_PRIV_WRITE },
|
||||
.ParamPrivileges = PARAM_PRIV_WRITE },
|
||||
};
|
||||
|
||||
|
||||
|
@ -104,22 +104,22 @@ void V2Params_UpdateParamValues(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
/** Retrieves the host PC read/write privellages for a given parameter in the parameter table. This should
|
||||
/** Retrieves the host PC read/write privileges for a given parameter in the parameter table. This should
|
||||
* be called before calls to \ref V2Params_GetParameterValue() or \ref V2Params_SetParameterValue() when
|
||||
* getting or setting parameter values in response to requests from the host.
|
||||
*
|
||||
* \param[in] ParamID Parameter ID whose privellages are to be retrieved from the table
|
||||
* \param[in] ParamID Parameter ID whose privileges are to be retrieved from the table
|
||||
*
|
||||
* \return Privellages for the requested parameter, as a mask of PARAM_PRIV_* masks
|
||||
* \return Privileges for the requested parameter, as a mask of PARAM_PRIV_* masks
|
||||
*/
|
||||
uint8_t V2Params_GetParameterPrivellages(uint8_t ParamID)
|
||||
uint8_t V2Params_GetParameterPrivileges(uint8_t ParamID)
|
||||
{
|
||||
ParameterItem_t* ParamInfo = V2Params_GetParamFromTable(ParamID);
|
||||
|
||||
if (ParamInfo == NULL)
|
||||
return 0;
|
||||
|
||||
return ParamInfo->ParamPrivellages;
|
||||
return ParamInfo->ParamPrivileges;
|
||||
}
|
||||
|
||||
/** Retrieves the current value for a given parameter in the parameter table.
|
||||
|
@ -132,7 +132,7 @@ uint8_t V2Params_GetParameterValue(uint8_t ParamID)
|
|||
{
|
||||
ParameterItem_t* ParamInfo = V2Params_GetParamFromTable(ParamID);
|
||||
|
||||
if ((ParamInfo == NULL) || !(ParamInfo->ParamPrivellages & PARAM_PRIV_READ))
|
||||
if ((ParamInfo == NULL) || !(ParamInfo->ParamPrivileges & PARAM_PRIV_READ))
|
||||
return 0;
|
||||
|
||||
return ParamInfo->ParamValue;
|
||||
|
@ -149,7 +149,7 @@ void V2Params_SetParameterValue(uint8_t ParamID, uint8_t Value)
|
|||
{
|
||||
ParameterItem_t* ParamInfo = V2Params_GetParamFromTable(ParamID);
|
||||
|
||||
if ((ParamInfo == NULL) || !(ParamInfo->ParamPrivellages & PARAM_PRIV_WRITE))
|
||||
if ((ParamInfo == NULL) || !(ParamInfo->ParamPrivileges & PARAM_PRIV_WRITE))
|
||||
return;
|
||||
|
||||
ParamInfo->ParamValue = Value;
|
||||
|
@ -159,7 +159,7 @@ void V2Params_SetParameterValue(uint8_t ParamID, uint8_t Value)
|
|||
eeprom_write_byte(&EEPROM_Rest_Polarity, Value);
|
||||
}
|
||||
|
||||
/** Retrieves a parameter entry (including ID, value and privellages) from the parameter table that matches the given
|
||||
/** Retrieves a parameter entry (including ID, value and privileges) from the parameter table that matches the given
|
||||
* parameter ID.
|
||||
*
|
||||
* \param[in] ParamID Parameter ID to find in the table
|
||||
|
|
|
@ -33,14 +33,14 @@
|
|||
* Header file for V2ProtocolParams.c.
|
||||
*/
|
||||
|
||||
#ifndef _V2_PROTOCOL_PARAMS_
|
||||
#define _V2_PROTOCOL_PARAMS_
|
||||
|
||||
/* Includes: */
|
||||
#include <avr/io.h>
|
||||
#include <avr/eeprom.h>
|
||||
#ifndef _V2_PROTOCOL_PARAMS_
|
||||
#define _V2_PROTOCOL_PARAMS_
|
||||
|
||||
#include <LUFA/Version.h>
|
||||
/* Includes: */
|
||||
#include <avr/io.h>
|
||||
#include <avr/eeprom.h>
|
||||
|
||||
#include <LUFA/Version.h>
|
||||
|
||||
#if defined(ADC)
|
||||
#include <LUFA/Drivers/Peripheral/ADC.h>
|
||||
|
@ -50,32 +50,32 @@
|
|||
#include "V2ProtocolConstants.h"
|
||||
|
||||
/* Macros: */
|
||||
/** Parameter privellage mask to allow the host PC to read the parameter's value */
|
||||
/** Parameter privilege mask to allow the host PC to read the parameter's value */
|
||||
#define PARAM_PRIV_READ (1 << 0)
|
||||
|
||||
/** Parameter privellage mask to allow the host PC to change the parameter's value */
|
||||
/** Parameter privilege mask to allow the host PC to change the parameter's value */
|
||||
#define PARAM_PRIV_WRITE (1 << 1)
|
||||
|
||||
|
||||
/* Type Defines: */
|
||||
/** Type define for a parameter table entry indicating a PC readable or writable device parameter. */
|
||||
typedef struct
|
||||
{
|
||||
const uint8_t ParamID; /**< Parameter ID number to uniquely identify the parameter within the device */
|
||||
uint8_t ParamValue; /**< Current parameter's value within the device */
|
||||
uint8_t ParamPrivellages; /**< Parameter privellages to allow the host to read or write the parameter's value */
|
||||
} ParameterItem_t;
|
||||
|
||||
uint8_t ParamPrivileges; /**< Parameter privileges to allow the host to read or write the parameter's value */
|
||||
} ParameterItem_t;
|
||||
|
||||
/* Function Prototypes: */
|
||||
void V2Params_LoadNonVolatileParamValues(void);
|
||||
void V2Params_UpdateParamValues(void);
|
||||
|
||||
uint8_t V2Params_GetParameterPrivellages(uint8_t ParamID);
|
||||
uint8_t V2Params_GetParameterPrivileges(uint8_t ParamID);
|
||||
uint8_t V2Params_GetParameterValue(uint8_t ParamID);
|
||||
void V2Params_SetParameterValue(uint8_t ParamID, uint8_t Value);
|
||||
|
||||
#if defined(INCLUDE_FROM_V2PROTOCOL_PARAMS_C)
|
||||
static ParameterItem_t* V2Params_GetParamFromTable(uint8_t ParamID);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ uint32_t CurrentAddress;
|
|||
*/
|
||||
uint8_t V2Protocol_GetSPIPrescalerMask(void)
|
||||
{
|
||||
static const uint8_t SPIMaskFromSCKDuration[TOTAL_PROGRAMMING_SPEEDS] =
|
||||
static const uint8_t SPIMaskFromSCKDuration[] =
|
||||
{
|
||||
#if (F_CPU == 8000000)
|
||||
SPI_SPEED_FCPU_DIV_2, // AVRStudio = 8MHz SPI, Actual = 4MHz SPI
|
||||
|
@ -77,7 +77,7 @@ uint8_t V2Protocol_GetSPIPrescalerMask(void)
|
|||
}
|
||||
|
||||
/** Asserts or deasserts the target's reset line, using the correct polarity as set by the host using a SET PARAM command.
|
||||
* When not asserted, the line is tristated so as not to intefere with normal device operation.
|
||||
* When not asserted, the line is tristated so as not to interfere with normal device operation.
|
||||
*
|
||||
* \param[in] ResetTarget Boolean true when the target should be held in reset, false otherwise
|
||||
*/
|
||||
|
|
|
@ -83,7 +83,7 @@ RingBuff_Data_t Buffer_GetElement(RingBuff_t* Buffer)
|
|||
if (!(Buffer->Elements))
|
||||
return 0;
|
||||
#elif !defined(BUFF_NOEMPTYCHECK)
|
||||
#error No empty buffer check behaviour specified.
|
||||
#error No empty buffer check behavior specified.
|
||||
#endif
|
||||
|
||||
BuffData = *(Buffer->OutPtr);
|
||||
|
@ -109,7 +109,7 @@ RingBuff_Data_t Buffer_PeekElement(const RingBuff_t* Buffer)
|
|||
if (!(Buffer->Elements))
|
||||
return 0;
|
||||
#elif !defined(BUFF_NOEMPTYCHECK)
|
||||
#error No empty buffer check behaviour specified.
|
||||
#error No empty buffer check behavior specified.
|
||||
#endif
|
||||
|
||||
BuffData = *(Buffer->OutPtr);
|
||||
|
|
|
@ -1,100 +1,100 @@
|
|||
/*
|
||||
Copyright 2009 Denver Gingerich (denver [at] ossguy [dot] com)
|
||||
Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, and distribute this software
|
||||
and its documentation for any purpose and without fee is hereby
|
||||
granted, provided that the above copyright notice appear in all
|
||||
copies and that both that the copyright notice and this
|
||||
permission notice and warranty disclaimer appear in supporting
|
||||
documentation, and that the name of the author not be used in
|
||||
advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
The author disclaim all warranties with regard to this
|
||||
software, including all implied warranties of merchantability
|
||||
and fitness. In no event shall the author be liable for any
|
||||
special, indirect or consequential damages or any damages
|
||||
whatsoever resulting from loss of use, data or profits, whether
|
||||
in an action of contract, negligence or other tortious action,
|
||||
arising out of or in connection with the use or performance of
|
||||
this software.
|
||||
*/
|
||||
|
||||
/*
|
||||
NOTE: The user of this include file MUST define the following macros
|
||||
prior to including the file:
|
||||
|
||||
MAG_T1_CLOCK_PIN Pin connected to Track 1 clock wire (ie. PORTC1)
|
||||
MAG_T1_DATA_PIN Pin connected to Track 1 data wire (ie. PORTC2)
|
||||
MAG_T2_CLOCK_PIN Pin connected to Track 2 clock wire (ie. PORTC3)
|
||||
MAG_T2_DATA_PIN Pin connected to Track 2 data wire (ie. PORTC0)
|
||||
MAG_T3_CLOCK_PIN Pin connected to Track 3 clock wire (ie. PORTC5)
|
||||
MAG_T3_DATA_PIN Pin connected to Track 3 data wire (ie. PORTC6)
|
||||
MAG_CLS_PIN Pin connected to card loaded wire (ie. PORTC4)
|
||||
MAG_PIN PIN macro for the reader's port (ie. PINC)
|
||||
MAG_DDR DDR macro for the reader's port (ie. DDRC)
|
||||
MAG_PORT PORT macro for the reader's port (ie. PORTC)
|
||||
|
||||
The example macros listed above assume that the Track 2 data wire is
|
||||
connected to pin 0 on port C, the Track 2 clock wire is connected to
|
||||
pin 3 on port C (similarly for Tracks 1 and 3), and the card loaded
|
||||
wire is connected to pin 4 on port C.
|
||||
|
||||
If the magstripe reader you are using only reads one or two tracks,
|
||||
then set the clock and data pins for the tracks it doesn't read to a
|
||||
pin that is unused. For example, on the AT90USBKey, any of the pins on
|
||||
port C that do not have wires attached will be unused since they are
|
||||
not connected to any onboard devices (such as the joystick or
|
||||
temperature sensor).
|
||||
|
||||
Connecting wires to pins on different ports (ie. a data wire to pin 0
|
||||
on port C and a clock wire to pin 0 on port D) is currently
|
||||
unsupported. All pins specified above must be on the same port.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
*
|
||||
* Driver header for a TTL Magnetic Card reader device (such as the Omron V3B-4K).
|
||||
*/
|
||||
|
||||
#ifndef _MAGSTRIPEHW_H_
|
||||
#define _MAGSTRIPEHW_H_
|
||||
|
||||
/* Includes: */
|
||||
#include <avr/io.h>
|
||||
|
||||
#include <LUFA/Common/Common.h>
|
||||
|
||||
/* Private Interface - For use in library only: */
|
||||
/* Macros: */
|
||||
/** Mask of the track data, clock and card detection pins. */
|
||||
#define MAG_MASK (MAG_T1_DATA | MAG_T1_CLOCK | \
|
||||
MAG_T2_DATA | MAG_T2_CLOCK | \
|
||||
MAG_T3_DATA | MAG_T3_CLOCK | \
|
||||
MAG_CARDPRESENT)
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Inline Functions: */
|
||||
/** Initializes the magnetic stripe card reader ports and pins so that the card reader
|
||||
* device can be controlled and read by the card reader driver. This must be called before
|
||||
* trying to read any of the card reader's status lines.
|
||||
*/
|
||||
static inline void Magstripe_Init(void)
|
||||
{
|
||||
MAG_DDR &= ~MAG_MASK;
|
||||
MAG_PORT |= MAG_MASK;
|
||||
};
|
||||
|
||||
/** Returns the status of all the magnetic card reader's outputs.
|
||||
*
|
||||
* \return A mask indicating which card lines are high or low
|
||||
*/
|
||||
static inline uint8_t Magstripe_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
|
||||
static inline uint8_t Magstripe_GetStatus(void)
|
||||
{
|
||||
/* Magstripe IOs are active low and must be inverted when read */
|
||||
return ((uint8_t)~MAG_PIN & MAG_MASK);
|
||||
}
|
||||
|
||||
#endif
|
||||
/*
|
||||
Copyright 2009 Denver Gingerich (denver [at] ossguy [dot] com)
|
||||
Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, and distribute this software
|
||||
and its documentation for any purpose and without fee is hereby
|
||||
granted, provided that the above copyright notice appear in all
|
||||
copies and that both that the copyright notice and this
|
||||
permission notice and warranty disclaimer appear in supporting
|
||||
documentation, and that the name of the author not be used in
|
||||
advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
The author disclaim all warranties with regard to this
|
||||
software, including all implied warranties of merchantability
|
||||
and fitness. In no event shall the author be liable for any
|
||||
special, indirect or consequential damages or any damages
|
||||
whatsoever resulting from loss of use, data or profits, whether
|
||||
in an action of contract, negligence or other tortious action,
|
||||
arising out of or in connection with the use or performance of
|
||||
this software.
|
||||
*/
|
||||
|
||||
/*
|
||||
NOTE: The user of this include file MUST define the following macros
|
||||
prior to including the file:
|
||||
|
||||
MAG_T1_CLOCK_PIN Pin connected to Track 1 clock wire (i.e.. PORTC1)
|
||||
MAG_T1_DATA_PIN Pin connected to Track 1 data wire (i.e.. PORTC2)
|
||||
MAG_T2_CLOCK_PIN Pin connected to Track 2 clock wire (i.e.. PORTC3)
|
||||
MAG_T2_DATA_PIN Pin connected to Track 2 data wire (i.e.. PORTC0)
|
||||
MAG_T3_CLOCK_PIN Pin connected to Track 3 clock wire (i.e.. PORTC5)
|
||||
MAG_T3_DATA_PIN Pin connected to Track 3 data wire (i.e.. PORTC6)
|
||||
MAG_CLS_PIN Pin connected to card loaded wire (i.e.. PORTC4)
|
||||
MAG_PIN PIN macro for the reader's port (i.e.. PINC)
|
||||
MAG_DDR DDR macro for the reader's port (i.e.. DDRC)
|
||||
MAG_PORT PORT macro for the reader's port (i.e.. PORTC)
|
||||
|
||||
The example macros listed above assume that the Track 2 data wire is
|
||||
connected to pin 0 on port C, the Track 2 clock wire is connected to
|
||||
pin 3 on port C (similarly for Tracks 1 and 3), and the card loaded
|
||||
wire is connected to pin 4 on port C.
|
||||
|
||||
If the mag-stripe reader you are using only reads one or two tracks,
|
||||
then set the clock and data pins for the tracks it doesn't read to a
|
||||
pin that is unused. For example, on the AT90USBKey, any of the pins on
|
||||
port C that do not have wires attached will be unused since they are
|
||||
not connected to any onboard devices (such as the joystick or
|
||||
temperature sensor).
|
||||
|
||||
Connecting wires to pins on different ports (i.e.. a data wire to pin 0
|
||||
on port C and a clock wire to pin 0 on port D) is currently
|
||||
unsupported. All pins specified above must be on the same port.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
*
|
||||
* Driver header for a TTL Magnetic Card reader device (such as the Omron V3B-4K).
|
||||
*/
|
||||
|
||||
#ifndef _MAGSTRIPEHW_H_
|
||||
#define _MAGSTRIPEHW_H_
|
||||
|
||||
/* Includes: */
|
||||
#include <avr/io.h>
|
||||
|
||||
#include <LUFA/Common/Common.h>
|
||||
|
||||
/* Private Interface - For use in library only: */
|
||||
/* Macros: */
|
||||
/** Mask of the track data, clock and card detection pins. */
|
||||
#define MAG_MASK (MAG_T1_DATA | MAG_T1_CLOCK | \
|
||||
MAG_T2_DATA | MAG_T2_CLOCK | \
|
||||
MAG_T3_DATA | MAG_T3_CLOCK | \
|
||||
MAG_CARDPRESENT)
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Inline Functions: */
|
||||
/** Initializes the magnetic stripe card reader ports and pins so that the card reader
|
||||
* device can be controlled and read by the card reader driver. This must be called before
|
||||
* trying to read any of the card reader's status lines.
|
||||
*/
|
||||
static inline void Magstripe_Init(void)
|
||||
{
|
||||
MAG_DDR &= ~MAG_MASK;
|
||||
MAG_PORT |= MAG_MASK;
|
||||
};
|
||||
|
||||
/** Returns the status of all the magnetic card reader's outputs.
|
||||
*
|
||||
* \return A mask indicating which card lines are high or low
|
||||
*/
|
||||
static inline uint8_t Magstripe_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
|
||||
static inline uint8_t Magstripe_GetStatus(void)
|
||||
{
|
||||
/* Mag-stripe IOs are active low and must be inverted when read */
|
||||
return ((uint8_t)~MAG_PIN & MAG_MASK);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -83,7 +83,7 @@ RingBuff_Data_t Buffer_GetElement(RingBuff_t* Buffer)
|
|||
if (!(Buffer->Elements))
|
||||
return 0;
|
||||
#elif !defined(BUFF_NOEMPTYCHECK)
|
||||
#error No empty buffer check behaviour specified.
|
||||
#error No empty buffer check behavior specified.
|
||||
#endif
|
||||
|
||||
BuffData = *(Buffer->OutPtr);
|
||||
|
@ -109,7 +109,7 @@ RingBuff_Data_t Buffer_PeekElement(const RingBuff_t* Buffer)
|
|||
if (!(Buffer->Elements))
|
||||
return 0;
|
||||
#elif !defined(BUFF_NOEMPTYCHECK)
|
||||
#error No empty buffer check behaviour specified.
|
||||
#error No empty buffer check behavior specified.
|
||||
#endif
|
||||
|
||||
BuffData = *(Buffer->OutPtr);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue