swieeprom
2.0.0.7
|
SWI master driver implementation. More...
Macros | |
#define | BIT_MASK_VAL 0x80 |
Mask for bit sampling. More... | |
#define | HS_TRESET 96 |
Reset and Discovery Response Timing. More... | |
#define | HS_TDSCHG 150 |
#define | HS_TRRT 8 |
#define | HS_TDRR 1 |
#define | HS_TDACK 8 |
#define | HS_TMSDR 2 |
#define | HS_THTSS 150 |
#define | HS_TBIT 8 |
Data Communication Timing. More... | |
#define | HS_TLOW0 6 |
#define | HS_TLOW1 1 |
#define | HS_TRD 1 |
#define | HS_TMRS 1 |
#define | HS_THLD0 2 |
#define | HS_TRCV 2 |
Functions | |
int8_t | swi_init (void) |
Initializes SWI communication. More... | |
int8_t | swi_reset (void) |
Resets device and checks devices response. More... | |
void | swi_start (void) |
Send start SWI signal. More... | |
void | swi_stop (void) |
Send stop SWI signal. More... | |
void | swi_logic_write (swi_logic_lvl_t logic_level) |
Send logic signal to device. More... | |
uint8_t | swi_logic_read (void) |
Receive logic signal from device. More... | |
uint8_t | swi_send_byte (uint8_t byte_to_send) |
Send byte to device. More... | |
void | swi_receive_byte (uint8_t *byte_to_receive, swi_acknowledgement_t ack_nack) |
Receive byte from device. More... | |
SWI master driver implementation.
#define BIT_MASK_VAL 0x80 |
Mask for bit sampling.
Mask for bit sampling for data read/write
#define HS_TBIT 8 |
Data Communication Timing.
Data Communication Timing for HIGH SPEED functionality
#define HS_TDACK 8 |
#define HS_TDRR 1 |
#define HS_TDSCHG 150 |
#define HS_THLD0 2 |
#define HS_THTSS 150 |
#define HS_TLOW0 6 |
#define HS_TLOW1 1 |
#define HS_TMRS 1 |
#define HS_TMSDR 2 |
#define HS_TRCV 2 |
#define HS_TRD 1 |
#define HS_TRESET 96 |
Reset and Discovery Response Timing.
Reset and Discovery Response Timing for HIGH SPEED functionality
#define HS_TRRT 8 |
int8_t swi_init | ( | void | ) |
Initializes SWI communication.
Initializes GPIO for data and SWI driver, restarts device, discovers device.
0
- Success, -1
- Error. uint8_t swi_logic_read | ( | void | ) |
Receive logic signal from device.
Sends signal for response and returns logic level.
0
- SWI_LOGIC_0, 1
- SWI_LOGIC_1. void swi_logic_write | ( | swi_logic_lvl_t | logic_level | ) |
Send logic signal to device.
Sends logic 0 or 1 relative to parameter logic_level.
[in] | logic_level | :
|
void swi_receive_byte | ( | uint8_t * | byte_to_receive, |
swi_acknowledgement_t | ack_nack | ||
) |
Receive byte from device.
Sample byte receive from device.
[out] | byte_to_receive | : Byte that received data will be stored in. |
[in] | ack_nack | :
|
int8_t swi_reset | ( | void | ) |
Resets device and checks devices response.
Resets device and sends discovery signal.
0
- Device found, -1
- No device. uint8_t swi_send_byte | ( | uint8_t | byte_to_send | ) |
Send byte to device.
Sends desired byte to device and check response.
[in] | byte_to_send | : Byte that will be sent. |
0
- SWI_ACK, 1
- SWI_NACK. void swi_start | ( | void | ) |
Send start SWI signal.
Sends to device signal for starting communication.
void swi_stop | ( | void | ) |
Send stop SWI signal.
Sends to device signal for stoping communication.