AMU Library 3.0
C/C++ library for communicating with AMU (Aerospace Measurement Unit) devices
Loading...
Searching...
No Matches
amu_device.c File Reference

TODO. More...

#include "amu_config_internal.h"
#include "amu_device.h"
#include "amu_types.h"
#include "amu_regs.h"
#include "amu_commands.h"
#include "scpi.h"

Go to the source code of this file.

Functions

volatile amu_device_tamu_dev_init (amu_transfer_fptr_t transfer_ptr)
 TODO.
int8_t amu_dev_transfer (uint8_t address, uint8_t reg, uint8_t *data, size_t len, uint8_t rw)
 Transfering... TODO.
uint8_t amu_dev_busy (uint8_t address)
 Checks to see if the AMU device is busy.
int8_t amu_dev_send_command (uint8_t address, CMD_t command)
 Sends a command to an AMU device.
int8_t amu_dev_send_command_data (uint8_t address, CMD_t command, uint8_t len)
 Move local transfer reg to remote transfer reg, then send command.
int8_t amu_dev_query_command (uint8_t address, CMD_t command, uint8_t commandDataLen, uint8_t responseLength)
 TODO.
uint8_t amu_scan_for_devices (uint8_t startAddress, uint8_t endAddress)
 Scans for any devices that might be connected in order to identify them.
int8_t amu_get_num_devices ()
int8_t amu_get_num_connected_devices ()
uint8_t amu_get_device_address (uint8_t deviceNum)
 Device addresses are used for TODO.
uint8_t _amu_route_command (uint8_t deviceNum, CMD_t cmd, size_t transferLen, bool query)
 TODO.
void _amu_transfer_read (size_t offset, void *data, size_t len)
 TODO: explain the transfer part of a transfer read.
void _amu_transfer_write (size_t offset, void *data, size_t len)
 TODO: explain the transfer part of a transfer write.
volatile uint8_t * amu_dev_get_transfer_reg_ptr (void)
amu_data_reg_tamu_get_register_ptr (uint8_t reg)

Variables

static uint8_t amu_dev_initialized = 0
static uint8_t amu_device_addresses [16]
static volatile uint8_t amu_transfer_reg [(40 *sizeof(float))]
static uint16_t transfer_reg_data_len = 0
static uint8_t amu_num_devices = 0
volatile amu_device_t amu_device

Detailed Description

TODO.

Author
CJM28241
Date
5/7/2019 3:56:47 PM

Definition in file amu_device.c.

Function Documentation

◆ _amu_route_command()

uint8_t _amu_route_command ( uint8_t deviceNum,
CMD_t cmd,
size_t transferLen,
bool query )

TODO.

TODO

Parameters
deviceNumTODO
cmdTODO
transferLenTODO
queryTODO
Returns
uint8_t TODO

< Root command for I2C/USB commands

< Root command for I2C/USB commands

Definition at line 242 of file amu_device.c.

◆ _amu_transfer_read()

void _amu_transfer_read ( size_t offset,
void * data,
size_t len )

TODO: explain the transfer part of a transfer read.

Parameters
offsetTODO
dataTODO
lenTODO

Definition at line 307 of file amu_device.c.

◆ _amu_transfer_write()

void _amu_transfer_write ( size_t offset,
void * data,
size_t len )

TODO: explain the transfer part of a transfer write.

Parameters
offsetTODO
dataTODO
lenTODO

Definition at line 322 of file amu_device.c.

◆ amu_dev_busy()

uint8_t amu_dev_busy ( uint8_t address)

Checks to see if the AMU device is busy.

Parameters
addressTODO
Returns
uint8_t 1 is busy, 0 otherwise

Definition at line 107 of file amu_device.c.

◆ amu_dev_get_transfer_reg_ptr()

volatile uint8_t * amu_dev_get_transfer_reg_ptr ( void )

Definition at line 331 of file amu_device.c.

◆ amu_dev_init()

volatile amu_device_t * amu_dev_init ( amu_transfer_fptr_t transfer_ptr)

TODO.

Parameters
amu_device_tAny AMU device

Definition at line 58 of file amu_device.c.

◆ amu_dev_query_command()

int8_t amu_dev_query_command ( uint8_t address,
CMD_t command,
uint8_t commandDataLen,
uint8_t responseLength )

TODO.

Parameters
addressTODO
commandTODO
commandDataLenTODO
responseLengthTODO
Returns
int8_t

Definition at line 152 of file amu_device.c.

◆ amu_dev_send_command()

int8_t amu_dev_send_command ( uint8_t address,
CMD_t command )

Sends a command to an AMU device.

Parameters
addressTODO
commandCommand for the device
Returns
int8_t TODO

Definition at line 125 of file amu_device.c.

◆ amu_dev_send_command_data()

int8_t amu_dev_send_command_data ( uint8_t address,
CMD_t command,
uint8_t len )

Move local transfer reg to remote transfer reg, then send command.

Parameters
addressTODO
commandCommand for the device
lenLength of TODO
Returns
int8_t TODO

Definition at line 137 of file amu_device.c.

◆ amu_dev_transfer()

int8_t amu_dev_transfer ( uint8_t address,
uint8_t reg,
uint8_t * data,
size_t len,
uint8_t rw )

Transfering... TODO.

Parameters
addressTODO
regTODO
dataTODO
lenTODO
rwTODO
Returns
int8_t

Definition at line 97 of file amu_device.c.

◆ amu_get_device_address()

uint8_t amu_get_device_address ( uint8_t deviceNum)

Device addresses are used for TODO.

Parameters
deviceNumDevice number of interest
Returns
uint8_t Device address

Definition at line 224 of file amu_device.c.

◆ amu_get_num_connected_devices()

int8_t amu_get_num_connected_devices ( void )

Definition at line 214 of file amu_device.c.

◆ amu_get_num_devices()

int8_t amu_get_num_devices ( void )

Definition at line 210 of file amu_device.c.

◆ amu_get_register_ptr()

amu_data_reg_t * amu_get_register_ptr ( uint8_t reg)

Definition at line 333 of file amu_device.c.

◆ amu_scan_for_devices()

uint8_t amu_scan_for_devices ( uint8_t startAddress,
uint8_t endAddress )

Scans for any devices that might be connected in order to identify them.

Parameters
startAddressStart address of the scan range
endAddressEnd address of the scan range
Returns
uint8_t Number of devices found, including this device if AMU_DEVICE is defined

Definition at line 179 of file amu_device.c.

Variable Documentation

◆ amu_dev_initialized

uint8_t amu_dev_initialized = 0
static

Definition at line 21 of file amu_device.c.

◆ amu_device

volatile amu_device_t amu_device
Initial value:
= {
.transfer_reg = amu_transfer_reg,
.sweep_data = NULL,
.amu_regs = NULL,
.transfer = NULL,
.delay = NULL,
.watchdog_kick = NULL,
.hardware_reset = NULL,
.millis = NULL,
.process_cmd = NULL,
}
static volatile uint8_t amu_transfer_reg[(40 *sizeof(float))]
Definition amu_device.c:23

Definition at line 40 of file amu_device.c.

◆ amu_device_addresses

uint8_t amu_device_addresses[16]
static

Definition at line 22 of file amu_device.c.

◆ amu_num_devices

uint8_t amu_num_devices = 0
static

Definition at line 37 of file amu_device.c.

◆ amu_transfer_reg

volatile uint8_t amu_transfer_reg[(40 *sizeof(float))]
static

Definition at line 23 of file amu_device.c.

◆ transfer_reg_data_len

uint16_t transfer_reg_data_len = 0
static

Definition at line 24 of file amu_device.c.