Skip to content

Commit

Permalink
Merge pull request #145 from shinhub/uart_lib_remove
Browse files Browse the repository at this point in the history
Uart lib remove
  • Loading branch information
securechicken authored Sep 14, 2019
2 parents 78afa54 + 298053e commit d1f176b
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 508 deletions.
3 changes: 0 additions & 3 deletions Firmware/ChameleonMini/ChameleonMini.cproj
Original file line number Diff line number Diff line change
Expand Up @@ -382,9 +382,6 @@
<Compile Include="Terminal\XModem.c">
<SubType>compile</SubType>
</Compile>
<Compile Include="Uart.c">
<SubType>compile</SubType>
</Compile>
<None Include="LUFA\Drivers\USB\Core\EndpointStream.h">
<SubType>compile</SubType>
</None>
Expand Down
1 change: 0 additions & 1 deletion Firmware/ChameleonMini/ChameleonMini.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include "System.h"
#include "Memory.h"
#include "LED.h"
#include "Uart.h"
#include "Terminal/Terminal.h"
#include "Codec/Codec.h"
#include "Application/Application.h"
Expand Down
30 changes: 14 additions & 16 deletions Firmware/ChameleonMini/Codec/ISO14443-2A.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
#include "../System.h"
#include "../Application/Application.h"
#include "Codec.h"
#include "../Uart.h"

/* Timing definitions for ISO14443A */
#define ISO14443A_SUBCARRIER_DIVIDER 16
#define ISO14443A_BIT_GRID_CYCLES 128
Expand All @@ -67,7 +67,7 @@

/* Sampling is done using internal clock, synchronized to the field modulation.
* For that we need to convert the bit rate for the internal clock. */
#define SAMPLE_RATE_SYSTEM_CYCLES ((uint16_t) (((uint64_t) F_CPU * ISO14443A_BIT_RATE_CYCLES) / CODEC_CARRIER_FREQ) )
#define SAMPLE_RATE_SYSTEM_CYCLES ((uint16_t) (((uint64_t) F_CPU * ISO14443A_BIT_RATE_CYCLES) / CODEC_CARRIER_FREQ) )

static volatile struct {
volatile bool DemodFinished;
Expand Down Expand Up @@ -315,12 +315,12 @@ ISR(CODEC_TIMER_OVF_VECT) {
/* Fallthrough to first bit */

case LOADMOD_START_BIT0:
CODEC_LOADMOD_PORT.OUTSET = CODEC_LOADMOD_MASK;
CODEC_LOADMOD_PORT.OUTSET = CODEC_LOADMOD_MASK;
LoadModState = LOADMOD_START_BIT1;
break;

case LOADMOD_START_BIT1:
CODEC_LOADMOD_PORT.OUTCLR = CODEC_LOADMOD_MASK;
CODEC_LOADMOD_PORT.OUTCLR = CODEC_LOADMOD_MASK;
LoadModState = LOADMOD_DATA0;

/* Fetch first byte */
Expand All @@ -329,9 +329,9 @@ ISR(CODEC_TIMER_OVF_VECT) {

case LOADMOD_DATA0:
if (DataRegister & 1) {
CODEC_LOADMOD_PORT.OUTSET = CODEC_LOADMOD_MASK;
CODEC_LOADMOD_PORT.OUTSET = CODEC_LOADMOD_MASK;
} else {
CODEC_LOADMOD_PORT.OUTCLR = CODEC_LOADMOD_MASK;
CODEC_LOADMOD_PORT.OUTCLR = CODEC_LOADMOD_MASK;
}

LoadModState = LOADMOD_DATA1;
Expand All @@ -341,9 +341,9 @@ ISR(CODEC_TIMER_OVF_VECT) {
Temp8 = DataRegister;

if (Temp8 & 1) {
CODEC_LOADMOD_PORT.OUTCLR = CODEC_LOADMOD_MASK;
CODEC_LOADMOD_PORT.OUTCLR = CODEC_LOADMOD_MASK;
} else {
CODEC_LOADMOD_PORT.OUTSET = CODEC_LOADMOD_MASK;
CODEC_LOADMOD_PORT.OUTSET = CODEC_LOADMOD_MASK;
}

DataRegister = Temp8 >> 1;
Expand All @@ -370,19 +370,19 @@ ISR(CODEC_TIMER_OVF_VECT) {

case LOADMOD_PARITY0:
if (*ParityBufferPtr) {
CODEC_LOADMOD_PORT.OUTSET = CODEC_LOADMOD_MASK;
CODEC_LOADMOD_PORT.OUTSET = CODEC_LOADMOD_MASK;
} else {
CODEC_LOADMOD_PORT.OUTCLR = CODEC_LOADMOD_MASK;
CODEC_LOADMOD_PORT.OUTCLR = CODEC_LOADMOD_MASK;
}

LoadModState = LOADMOD_PARITY1;
break;

case LOADMOD_PARITY1:
if (*ParityBufferPtr) {
CODEC_LOADMOD_PORT.OUTCLR = CODEC_LOADMOD_MASK;
CODEC_LOADMOD_PORT.OUTCLR = CODEC_LOADMOD_MASK;
} else {
CODEC_LOADMOD_PORT.OUTSET = CODEC_LOADMOD_MASK;
CODEC_LOADMOD_PORT.OUTSET = CODEC_LOADMOD_MASK;
}

if (BitSent == BitCount) {
Expand All @@ -398,12 +398,12 @@ ISR(CODEC_TIMER_OVF_VECT) {
break;

case LOADMOD_STOP_BIT0:
CODEC_LOADMOD_PORT.OUTCLR = CODEC_LOADMOD_MASK;
CODEC_LOADMOD_PORT.OUTCLR = CODEC_LOADMOD_MASK;
LoadModState = LOADMOD_STOP_BIT1;
break;

case LOADMOD_STOP_BIT1:
CODEC_LOADMOD_PORT.OUTCLR = CODEC_LOADMOD_MASK;
CODEC_LOADMOD_PORT.OUTCLR = CODEC_LOADMOD_MASK;
LoadModState = LOADMOD_FINISHED;
break;

Expand Down Expand Up @@ -444,8 +444,6 @@ void ISO14443ACodecTask(void) {

/* Call application if we received data */
AnswerBitCount = ApplicationProcess(CodecBuffer, DemodBitCount);
//for(uint16_t i=0;i<=DemodBitCount/8;i++)
//uart_putc_hex(CodecBuffer[i]);
if (AnswerBitCount & ISO14443A_APP_CUSTOM_PARITY) {
/* Application has generated it's own parity bits.
* Clear this option bit. */
Expand Down
2 changes: 1 addition & 1 deletion Firmware/ChameleonMini/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ F_CPU = 32000000
F_USB = 48000000
TARGET = ChameleonMini
OPTIMIZATION = s
SRC += $(TARGET).c LUFADescriptors.c System.c Configuration.c Random.c Common.c Memory.c Button.c Settings.c LED.c Map.c AntennaLevel.c Uart.c
SRC += $(TARGET).c LUFADescriptors.c System.c Configuration.c Random.c Common.c Memory.c Button.c Settings.c LED.c Map.c AntennaLevel.c
SRC += Terminal/Terminal.c Terminal/Commands.c Terminal/XModem.c Terminal/CommandLine.c
SRC += Codec/Codec.c Codec/ISO14443-2A.c
SRC += Application/MifareUltralight.c Application/MifareClassic.c Application/ISO14443-3A.c Application/Crypto1.c Application/Detection.c
Expand Down
Loading

0 comments on commit d1f176b

Please sign in to comment.