#include <stdio.h>
#include <aversive.h>
#include <aversive/wait.h>
#include <timer.h>
#include <mf2_server.h>
#include <mf2_server_config.h>
Go to the source code of this file.
Defines | |
#define | data_Z() do { cbi(DDR(MF2_SERVER_DATA_PORT), MF2_SERVER_DATA_BIT); } while(0) |
#define | data_0() do { sbi(DDR(MF2_SERVER_DATA_PORT), MF2_SERVER_DATA_BIT); } while(0) |
#define | read_data() (bit_is_set(PIN(MF2_SERVER_DATA_PORT), MF2_SERVER_DATA_BIT)) |
#define | data_is_Z() (!bit_is_set(DDR(MF2_SERVER_DATA_PORT), MF2_SERVER_DATA_BIT)) |
#define | clk_Z() do { cbi(DDR(MF2_SERVER_CLK_PORT), MF2_SERVER_CLK_BIT); } while(0) |
#define | clk_0() do { sbi(DDR(MF2_SERVER_CLK_PORT), MF2_SERVER_CLK_BIT); } while(0) |
#define | read_clk() (bit_is_set(PIN(MF2_SERVER_CLK_PORT), MF2_SERVER_CLK_BIT)) |
#define | clk_is_Z() (!bit_is_set(DDR(MF2_SERVER_CLK_PORT), MF2_SERVER_CLK_BIT)) |
#define | MF2_SERVER_STATE_READY 0 |
#define | MF2_SERVER_STATE_SEND 1 |
#define | MF2_SERVER_STATE_RECV 2 |
#define | WAIT_KBD_CYCLE 600 |
#define | WAIT_KBD_CYCLE4 WAIT_KBD_CYCLE/4 |
#define | dump() do {} while(0) |
Typedefs | |
typedef void( | event )(char) |
Functions | |
void | recv (void) |
int8_t | mf2_server_ready (void) |
void | disp (char c) |
void | mf2_server_timer_cb (void) |
int8_t | mf2_server_send (char c) |
void | mf2_server_init (void) |
void | mf2_server_register_tx_event (void(*f)(char)) |
void | mf2_server_register_rx_event (void(*f)(char)) |
#define clk_0 | ( | ) | do { sbi(DDR(MF2_SERVER_CLK_PORT), MF2_SERVER_CLK_BIT); } while(0) |
Definition at line 39 of file mf2_server.c.
#define clk_is_Z | ( | ) | (!bit_is_set(DDR(MF2_SERVER_CLK_PORT), MF2_SERVER_CLK_BIT)) |
Definition at line 41 of file mf2_server.c.
#define clk_Z | ( | ) | do { cbi(DDR(MF2_SERVER_CLK_PORT), MF2_SERVER_CLK_BIT); } while(0) |
Definition at line 38 of file mf2_server.c.
#define data_0 | ( | ) | do { sbi(DDR(MF2_SERVER_DATA_PORT), MF2_SERVER_DATA_BIT); } while(0) |
Definition at line 34 of file mf2_server.c.
#define data_is_Z | ( | ) | (!bit_is_set(DDR(MF2_SERVER_DATA_PORT), MF2_SERVER_DATA_BIT)) |
Definition at line 36 of file mf2_server.c.
#define data_Z | ( | ) | do { cbi(DDR(MF2_SERVER_DATA_PORT), MF2_SERVER_DATA_BIT); } while(0) |
Definition at line 33 of file mf2_server.c.
#define dump | ( | ) | do {} while(0) |
#define MF2_SERVER_STATE_READY 0 |
Definition at line 43 of file mf2_server.c.
Referenced by mf2_server_ready(), and mf2_server_timer_cb().
#define MF2_SERVER_STATE_RECV 2 |
#define MF2_SERVER_STATE_SEND 1 |
#define read_clk | ( | ) | (bit_is_set(PIN(MF2_SERVER_CLK_PORT), MF2_SERVER_CLK_BIT)) |
#define read_data | ( | ) | (bit_is_set(PIN(MF2_SERVER_DATA_PORT), MF2_SERVER_DATA_BIT)) |
#define WAIT_KBD_CYCLE 600 |
Definition at line 58 of file mf2_server.c.
#define WAIT_KBD_CYCLE4 WAIT_KBD_CYCLE/4 |
typedef void( event)(char) |
Definition at line 49 of file mf2_server.c.
void disp | ( | char | c | ) |
void mf2_server_init | ( | void | ) |
Definition at line 362 of file mf2_server.c.
References cbi, clk_Z, data_Z, and mf2_server_timer_cb().
int8_t mf2_server_ready | ( | void | ) |
Definition at line 122 of file mf2_server.c.
References MF2_SERVER_STATE_READY.
Referenced by mf2_server_send().
void mf2_server_register_rx_event | ( | void(*)(char) | f | ) |
Definition at line 387 of file mf2_server.c.
References parse_symbols::f, IRQ_LOCK, IRQ_UNLOCK, and rx_event.
void mf2_server_register_tx_event | ( | void(*)(char) | f | ) |
Definition at line 377 of file mf2_server.c.
References parse_symbols::f, IRQ_LOCK, IRQ_UNLOCK, and tx_event.
int8_t mf2_server_send | ( | char | c | ) |
Definition at line 338 of file mf2_server.c.
References clk_Z, data_Z, IRQ_LOCK, IRQ_UNLOCK, mf2_server_ready(), MF2_SERVER_STATE_SEND, and mf2_server_timer_cb().
void mf2_server_timer_cb | ( | void | ) |
Definition at line 150 of file mf2_server.c.
References clk_0, clk_Z, data_0, data_Z, dump, MF2_SERVER_STATE_READY, MF2_SERVER_STATE_RECV, read_clk, read_data, and rx_event.
Referenced by mf2_server_init(), and mf2_server_send().
void recv | ( | void | ) |
Definition at line 62 of file mf2_server.c.
References clk_0, clk_Z, data_0, data_Z, i, read_data, wait_4cyc, and WAIT_KBD_CYCLE4.