#include "conf_twim.h"
#include "conf_atsha204.h"
#include "twi_master.h"
#include "sha204_physical.h"
#include "sha204_lib_return_codes.h"
#include "sha204_timer.h"
Enumerations | |
enum | i2c_word_address { SHA204_I2C_PACKET_FUNCTION_RESET, SHA204_I2C_PACKET_FUNCTION_SLEEP, SHA204_I2C_PACKET_FUNCTION_IDLE, SHA204_I2C_PACKET_FUNCTION_NORMAL } |
This enumeration lists all packet types sent to a SHA204 device. More... | |
Functions | |
uint8_t | sha204p_idle (void) |
This I2C function puts the SHA204 device into idle state. More... | |
void | sha204p_init (void) |
This function initializes peripherals (timer and communication). More... | |
uint8_t | sha204p_receive_response (uint8_t size, uint8_t *response) |
This I2C function receives a response from the SHA204 device. More... | |
uint8_t | sha204p_reset_io (void) |
This I2C function resets the I/O buffer of the SHA204 device. More... | |
uint8_t | sha204p_resync (uint8_t size, uint8_t *response) |
This I2C function resynchronizes communication. More... | |
static uint8_t | sha204p_send (uint8_t word_address, uint8_t count, uint8_t *buffer) |
This function sends a I2C packet enclosed by a I2C start and stop to a SHA204 device. More... | |
uint8_t | sha204p_send_command (uint8_t count, uint8_t *command) |
This I2C function sends a command to the device. More... | |
void | sha204p_set_device_id (uint8_t id) |
This I2C function sets the I2C address. More... | |
uint8_t | sha204p_sleep (void) |
This I2C function puts the SHA204 device into low-power state. More... | |
uint8_t | sha204p_wakeup (void) |
This I2C function generates a Wake-up pulse and delays. More... | |
Variables | |
static uint8_t | device_address = SHA204_I2C_DEFAULT_ADDRESS >> 1 |
I2C address can be changed by calling sha204p_set_device_id. More... | |
enum i2c_word_address |
This enumeration lists all packet types sent to a SHA204 device.
The following byte stream is sent to a SHA204 TWI device: {I2C start} {I2C address} {word address} [{data}] {I2C stop}. Data are only sent after a word address of value SHA204_I2C_PACKET_FUNCTION_NORMAL.
|
static |
This function sends a I2C packet enclosed by a I2C start and stop to a SHA204 device.
This function combines a I2C packet send sequence that is common to all packet types. Only if word_address is \ref SHA204_I2C_PACKET_FUNCTION_NORMAL, count and buffer parameters are expected to be non-zero.
[in] | word_address | packet function code listed in i2c_word_address |
[in] | count | number of bytes in data buffer |
[in] | buffer | pointer to data buffer |
References twi_package_t::chip, device_address, SHA204_COMM_FAIL, SHA204_SUCCESS, and twi_master_write().
Referenced by sha204p_idle(), sha204p_reset_io(), sha204p_send_command(), and sha204p_sleep().
|
static |
I2C address can be changed by calling sha204p_set_device_id.
Referenced by sha204p_receive_response(), sha204p_send(), and sha204p_set_device_id().