summaryrefslogtreecommitdiff
path: root/openpicc/application/iso14443a_manchester.c
diff options
context:
space:
mode:
authorhenryk <henryk@6dc7ffe9-61d6-0310-9af1-9938baff3ed1>2008-03-03 09:18:19 +0000
committerhenryk <henryk@6dc7ffe9-61d6-0310-9af1-9938baff3ed1>2008-03-03 09:18:19 +0000
commitd3bab6e9439b7161b7724df0cc902f4adcf1ecce (patch)
treec160196b7d058ebc3670805540c1bba0d869f357 /openpicc/application/iso14443a_manchester.c
parent2f730c90916047ec0b419ed9469fa44f537b8ab6 (diff)
Implement transmission
Implement a 'pretender' for PoC: Since Rx is not working properly we'll just pretend to have received something based on the approximate length. Clarify length calculations in machester encoder and remove obsolete test code git-svn-id: https://svn.openpcd.org:2342/trunk@437 6dc7ffe9-61d6-0310-9af1-9938baff3ed1
Diffstat (limited to 'openpicc/application/iso14443a_manchester.c')
-rw-r--r--openpicc/application/iso14443a_manchester.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/openpicc/application/iso14443a_manchester.c b/openpicc/application/iso14443a_manchester.c
index 303491f..e8640fa 100644
--- a/openpicc/application/iso14443a_manchester.c
+++ b/openpicc/application/iso14443a_manchester.c
@@ -104,10 +104,10 @@ int manchester_encode(u_int8_t *sample_buf, u_int16_t sample_buf_len,
if(frame->parameters.a.format != STANDARD_FRAME) return -EINVAL; /* AC not implemented yet */
/* One bit data is 16 bit is 2 byte modulation data */
- enc_size = 2*2 /* SOF and EOF */
- + frame->numbytes * 8 * 2
- + ((frame->parameters.a.parity != NO_PARITY) ? 1 : 0)*8*2
- + 6;
+ enc_size = 1 /* SOF */
+ + frame->numbytes * ((frame->parameters.a.parity != NO_PARITY) ? 9 : 8) /* bits per byte */
+ + 1 /* EOF */;
+ enc_size = enc_size /* in bits */ * 2 /* bytes modulation data per bit raw data*/;
if (sample_buf_len < enc_size)
return -EINVAL;
@@ -115,9 +115,6 @@ int manchester_encode(u_int8_t *sample_buf, u_int16_t sample_buf_len,
memset(sample_buf, 0, enc_size);
samples16 = (u_int16_t*)sample_buf;
- (*samples16) = 5;
- samples16+=2; // SSC workaround
- //*(samples16++) = 0xb;
/* SOF */
*(samples16++) = MANCHESTER_SEQ_D;
personal git repositories of Harald Welte. Your mileage may vary