MySensors Library & Examples  2.3.2-62-ge298769
Public Member Functions | List of all members
atsha204Class Class Reference

Detailed Description

atsha204Class class

Examples
SecurityPersonalizer.ino.

Definition at line 303 of file sha204_library.h.

#include <sha204_library.h>

+ Collaboration diagram for atsha204Class:

Public Member Functions

 atsha204Class (uint8_t pin)
 Constructor. More...
 
uint8_t sha204c_wakeup (uint8_t *response)
 Wake up device. More...
 
uint8_t sha204c_send_and_receive (uint8_t *tx_buffer, uint8_t rx_size, uint8_t *rx_buffer, uint8_t execution_delay, uint8_t execution_timeout)
 Send and receive data. More...
 
uint8_t sha204c_resync (uint8_t size, uint8_t *response)
 Resyncronize the device. More...
 
uint8_t sha204m_random (uint8_t *tx_buffer, uint8_t *rx_buffer, uint8_t mode)
 Generate random data. More...
 
uint8_t sha204m_dev_rev (uint8_t *tx_buffer, uint8_t *rx_buffer)
 Read device revision. More...
 
uint8_t sha204m_read (uint8_t *tx_buffer, uint8_t *rx_buffer, uint8_t zone, uint16_t address)
 Read from device. More...
 
uint8_t sha204m_execute (uint8_t op_code, uint8_t param1, uint16_t param2, uint8_t datalen1, uint8_t *data1, uint8_t datalen2, uint8_t *data2, uint8_t datalen3, uint8_t *data3, uint8_t tx_size, uint8_t *tx_buffer, uint8_t rx_size, uint8_t *rx_buffer)
 Execute command. More...
 
uint8_t sha204m_check_parameters (uint8_t op_code, uint8_t param1, uint16_t param2, uint8_t datalen1, uint8_t *data1, uint8_t datalen2, uint8_t *data2, uint8_t datalen3, uint8_t *data3, uint8_t tx_size, uint8_t *tx_buffer, uint8_t rx_size, uint8_t *rx_buffer)
 Validate parameters. More...
 
uint8_t getSerialNumber (uint8_t *response)
 Gets the serial number. More...
 
uint16_t calculateAndUpdateCrc (uint8_t length, uint8_t *data, uint16_t current_crc)
 Calculates and update crc. More...
 

Constructor & Destructor Documentation

◆ atsha204Class()

atsha204Class::atsha204Class ( uint8_t  pin)
explicit

Constructor.

Parameters
[in]pinThe pin to use for communication

Member Function Documentation

◆ calculateAndUpdateCrc()

uint16_t atsha204Class::calculateAndUpdateCrc ( uint8_t  length,
uint8_t *  data,
uint16_t  current_crc 
)

Calculates and update crc.

Parameters
[in]lengthThe length
dataThe data
[in]current_crcThe current crc
Returns
The updated crc
Examples
SecurityPersonalizer.ino.

◆ getSerialNumber()

uint8_t atsha204Class::getSerialNumber ( uint8_t *  response)

Gets the serial number.

Parameters
responseThe response
Returns
The serial number
Examples
SecurityPersonalizer.ino.

◆ sha204c_resync()

uint8_t atsha204Class::sha204c_resync ( uint8_t  size,
uint8_t *  response 
)

Resyncronize the device.

Parameters
[in]sizeThe size of the response buffer
responseThe response
Returns
Error code (SHA204_SUCCESS if OK)
Examples
SecurityPersonalizer.ino.

◆ sha204c_send_and_receive()

uint8_t atsha204Class::sha204c_send_and_receive ( uint8_t *  tx_buffer,
uint8_t  rx_size,
uint8_t *  rx_buffer,
uint8_t  execution_delay,
uint8_t  execution_timeout 
)

Send and receive data.

Parameters
tx_bufferThe transmit buffer
[in]rx_sizeThe receive size
rx_bufferThe receive buffer
[in]execution_delayThe execution delay
[in]execution_timeoutThe execution timeout
Returns
Error code (SHA204_SUCCESS if OK)

◆ sha204c_wakeup()

uint8_t atsha204Class::sha204c_wakeup ( uint8_t *  response)

Wake up device.

Parameters
responseThe response from the device
Returns
Error code (SHA204_SUCCESS if OK)
Examples
SecurityPersonalizer.ino.

◆ sha204m_check_parameters()

uint8_t atsha204Class::sha204m_check_parameters ( uint8_t  op_code,
uint8_t  param1,
uint16_t  param2,
uint8_t  datalen1,
uint8_t *  data1,
uint8_t  datalen2,
uint8_t *  data2,
uint8_t  datalen3,
uint8_t *  data3,
uint8_t  tx_size,
uint8_t *  tx_buffer,
uint8_t  rx_size,
uint8_t *  rx_buffer 
)

Validate parameters.

Parameters
[in]op_codeThe operation code
[in]param1The parameter 1
[in]param2The parameter 2
[in]datalen1The datalen 1
data1The data 1
[in]datalen2The datalen 2
data2The data 2
[in]datalen3The datalen 3
data3The data 3
[in]tx_sizeThe transmit size
tx_bufferThe transmit buffer
[in]rx_sizeThe receive size
rx_bufferThe receive buffer
Returns
Error code (SHA204_SUCCESS if OK)

◆ sha204m_dev_rev()

uint8_t atsha204Class::sha204m_dev_rev ( uint8_t *  tx_buffer,
uint8_t *  rx_buffer 
)

Read device revision.

Parameters
tx_bufferThe transmit buffer
rx_bufferThe receive buffer
Returns
Error code (SHA204_SUCCESS if OK)
Examples
SecurityPersonalizer.ino.

◆ sha204m_execute()

uint8_t atsha204Class::sha204m_execute ( uint8_t  op_code,
uint8_t  param1,
uint16_t  param2,
uint8_t  datalen1,
uint8_t *  data1,
uint8_t  datalen2,
uint8_t *  data2,
uint8_t  datalen3,
uint8_t *  data3,
uint8_t  tx_size,
uint8_t *  tx_buffer,
uint8_t  rx_size,
uint8_t *  rx_buffer 
)

Execute command.

Parameters
[in]op_codeThe operation code
[in]param1The parameter 1
[in]param2The parameter 2
[in]datalen1The datalen 1
data1The data 1
[in]datalen2The datalen 2
data2The data 2
[in]datalen3The datalen 3
data3The data 3
[in]tx_sizeThe transmit size
tx_bufferThe transmit buffer
[in]rx_sizeThe receive size
rx_bufferThe receive buffer
Returns
Error code (SHA204_SUCCESS if OK)
Examples
SecurityPersonalizer.ino.

◆ sha204m_random()

uint8_t atsha204Class::sha204m_random ( uint8_t *  tx_buffer,
uint8_t *  rx_buffer,
uint8_t  mode 
)

Generate random data.

Parameters
tx_bufferThe transmit buffer
rx_bufferThe receive buffer
[in]modeThe mode
Returns
Error code (SHA204_SUCCESS if OK)
Examples
SecurityPersonalizer.ino.

◆ sha204m_read()

uint8_t atsha204Class::sha204m_read ( uint8_t *  tx_buffer,
uint8_t *  rx_buffer,
uint8_t  zone,
uint16_t  address 
)

Read from device.

Parameters
tx_bufferThe transmit buffer
rx_bufferThe receive buffer
[in]zoneThe zone
[in]addressThe address
Returns
Error code (SHA204_SUCCESS if OK)
Examples
SecurityPersonalizer.ino.

The documentation for this class was generated from the following file: