libsle4442  0.2-5
sle_bbg.h
Go to the documentation of this file.
1 /* This file is part of libsle4442.
2  * Copyright (C) 2010, 2013 Enrico Rossi
3  *
4  * Libsle4442 is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as
6  * published by the Free Software Foundation, either version 3 of the
7  * License, or (at your option) any later version.
8  *
9  * Libsle4442 is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this program.
16  * If not, see <http://www.gnu.org/licenses/>.
17  */
18 
27 #ifndef SLE_BBG_H
28 #define SLE_BBG_H
29 
53 #define SLE_PORT PORTA
54 #define SLE_PIN PINA
55 #define SLE_DDR DDRA
56 #define SLE_PRESENT 3
57 #define SLE_RST 0
58 #define SLE_CK 1
59 #define SLE_IO 2
60 
61 /* You should not change anything below */
62 
70 #define OUT 2
71 #define IN 3
72 
107 #define ck_delay() _delay_us(25)
108 #define ck_delay_front() _delay_us(4)
109 #define ck_delay_reset() _delay_us(50)
110 #define set_ck_1 SLE_PORT |= (1<<SLE_CK)
111 #define set_ck_0 SLE_PORT &= ~(1<<SLE_CK)
112 #define set_rst_1 SLE_PORT |= (1<<SLE_RST)
113 #define set_rst_0 SLE_PORT &= ~(1<<SLE_RST)
114 
115 void ck_pulse(void);
116 void set_io(const uint8_t io);
117 uint8_t read_byte(void);
118 void send_byte(uint8_t byte);
119 void send_rst(uint8_t *atr);
120 void send_cmd(const uint8_t control, const uint8_t address, const uint8_t data);
121 uint8_t processing(void);
122 
123 #endif
void send_rst(uint8_t *atr)
Definition: sle_bbg.c:181
uint8_t * atr
ptr to a 4 bytes ATR header returned by the ATZ command.
Definition: sle.h:93
uint8_t processing(void)
Definition: sle_bbg.c:225
void ck_pulse(void)
Definition: sle_bbg.c:39
void send_byte(uint8_t byte)
Definition: sle_bbg.c:153
void send_cmd(const uint8_t control, const uint8_t address, const uint8_t data)
Definition: sle_bbg.c:209
void set_io(const uint8_t io)
Definition: sle_bbg.c:60
uint8_t read_byte(void)
Definition: sle_bbg.c:122