-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMagSpoof.h
45 lines (35 loc) · 877 Bytes
/
MagSpoof.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#pragma once
// Resources and inspired from:
// https://pe2bz.philpem.me.uk/Comm01/-%20Digital/-%20MagneticCards/Info-900-MagCardDecode/magcard.html
// https://github.com/miaoski/magspoof/
// https://github.com/samyk/magspoof/
// https://github.com/joshlf/magspoof/
#include <stdint.h>
class MagSpoof
{
public:
enum BPC
{
BPC7 = 7,
BPC6 = 6,
BPC5 = 5,
BPC4 = 4,
};
enum Parity
{
Odd,
Even
};
MagSpoof(uint8_t pinA, uint8_t pinB, uint8_t pinEnable, uint8_t clock, BPC bpc, Parity parity);
void setup();
char convertChar(char c);
void playBit(int sendBit, uint8_t& dir);
void playTrack(const char* track);
private:
const uint8_t m_pinA;
const uint8_t m_pinB;
const uint8_t m_pinEnable;
const uint32_t m_clock;
const BPC m_bpc;
const Parity m_parity;
};