|
Cheetah Software
1.0
|
#include <byteswap.h>#include <math.h>#include <pthread.h>#include <stdio.h>#include <string.h>#include <linux/spi/spidev.h>#include <rt/rt_spi.h>#include <rt/rt_spi_lcm.h>#include <lcm/lcm-cpp.hpp>
Include dependency graph for rt_spi.cpp:Go to the source code of this file.
Functions | |
| int | spi_open () |
| uint32_t | xor_checksum (uint32_t *data, size_t len) |
| void | fake_spine_control (spi_command_t *cmd, spi_data_t *data, spi_torque_t *torque_out, int board_num) |
| void | init_spi () |
| void | spi_to_spine (spi_command_t *cmd, spine_cmd_t *spine_cmd, int leg_0) |
| void | spine_to_spi (spi_data_t *data, spine_data_t *spine_data, int leg_0) |
| void | spi_send_receive (spi_command_t *command, spi_data_t *data) |
| void | spi_driver_run () |
| spi_command_t * | get_spi_command () |
| spi_data_t * | get_spi_data () |
Variables | |
| lcm::LCM * | lcm_spi |
| unsigned char | spi_mode = SPI_MODE_0 |
| unsigned char | spi_bits_per_word = 8 |
| unsigned int | spi_speed = 6000000 |
| uint8_t | lsb = 0x01 |
| int | spi_1_fd = -1 |
| int | spi_2_fd = -1 |
| static spine_cmd_t | g_spine_cmd |
| static spine_data_t | g_spine_data |
| spi_command_t | spi_command_drv |
| spi_data_t | spi_data_drv |
| spi_torque_t | spi_torque |
| pthread_mutex_t | spi_mutex |
| const float | max_torque [3] = {17.f, 17.f, 26.f} |
| const float | wimp_torque [3] = {6.f, 6.f, 6.f} |
| const float | disabled_torque [3] = {0.f, 0.f, 0.f} |
| const float | abad_side_sign [4] = {-1.f, -1.f, 1.f, 1.f} |
| const float | hip_side_sign [4] = {-1.f, 1.f, -1.f, 1.f} |
| const float | knee_side_sign [4] = {-.6429f, .6429f, -.6429f, .6429f} |
| const float | abad_offset [4] = {0.f, 0.f, 0.f, 0.f} |
| const float | hip_offset [4] = {M_PI / 2.f, -M_PI / 2.f, -M_PI / 2.f, M_PI / 2.f} |
| const float | knee_offset [4] |
| int | spi_driver_iterations = 0 |
| void fake_spine_control | ( | spi_command_t * | cmd, |
| spi_data_t * | data, | ||
| spi_torque_t * | torque_out, | ||
| int | board_num | ||
| ) |
Definition at line 62 of file rt_spi.cpp.
References disabled_torque, max_torque, and wimp_torque.
Here is the caller graph for this function:| spi_command_t* get_spi_command | ( | ) |
Definition at line 332 of file rt_spi.cpp.
References spi_command_drv.
Here is the caller graph for this function:| spi_data_t* get_spi_data | ( | ) |
Definition at line 337 of file rt_spi.cpp.
References spi_data_drv.
Here is the caller graph for this function:| void init_spi | ( | ) |
Definition at line 110 of file rt_spi.cpp.
References K_EXPECTED_COMMAND_SIZE, K_EXPECTED_DATA_SIZE, spi_command_drv, spi_data_drv, spi_mutex, and spi_open().
Here is the call graph for this function:
Here is the caller graph for this function:| void spi_driver_run | ( | ) |
Definition at line 319 of file rt_spi.cpp.
References fake_spine_control(), publish_spi_torque(), spi_command_drv, spi_data_drv, spi_mutex, spi_send_receive(), and spi_torque.
Here is the call graph for this function:
Here is the caller graph for this function:| int spi_open | ( | ) |
Definition at line 137 of file rt_spi.cpp.
References lsb, spi_1_fd, spi_2_fd, spi_bits_per_word, spi_mode, and spi_speed.
Here is the caller graph for this function:| void spi_send_receive | ( | spi_command_t * | command, |
| spi_data_t * | data | ||
| ) |
Definition at line 260 of file rt_spi.cpp.
References K_WORDS_PER_MESSAGE, spi_1_fd, spi_2_fd, spi_bits_per_word, spi_driver_iterations, spi_to_spine(), and spine_to_spi().
Here is the call graph for this function:
Here is the caller graph for this function:| void spi_to_spine | ( | spi_command_t * | cmd, |
| spine_cmd_t * | spine_cmd, | ||
| int | leg_0 | ||
| ) |
Definition at line 189 of file rt_spi.cpp.
References abad_offset, abad_side_sign, spine_cmd_t::checksum, spine_cmd_t::flags, hip_offset, hip_side_sign, spine_cmd_t::kd_abad, spine_cmd_t::kd_hip, spine_cmd_t::kd_knee, knee_offset, knee_side_sign, spine_cmd_t::kp_abad, spine_cmd_t::kp_hip, spine_cmd_t::kp_knee, spine_cmd_t::q_des_abad, spine_cmd_t::q_des_hip, spine_cmd_t::q_des_knee, spine_cmd_t::qd_des_abad, spine_cmd_t::qd_des_hip, spine_cmd_t::qd_des_knee, spine_cmd_t::tau_abad_ff, spine_cmd_t::tau_hip_ff, spine_cmd_t::tau_knee_ff, and xor_checksum().
Here is the call graph for this function:
Here is the caller graph for this function:| void spine_to_spi | ( | spi_data_t * | data, |
| spine_data_t * | spine_data, | ||
| int | leg_0 | ||
| ) |
Definition at line 235 of file rt_spi.cpp.
References abad_offset, abad_side_sign, spine_data_t::checksum, spine_data_t::flags, hip_offset, hip_side_sign, knee_offset, knee_side_sign, spine_data_t::q_abad, spine_data_t::q_hip, spine_data_t::q_knee, spine_data_t::qd_abad, spine_data_t::qd_hip, spine_data_t::qd_knee, and xor_checksum().
Here is the call graph for this function:
Here is the caller graph for this function:| uint32_t xor_checksum | ( | uint32_t * | data, |
| size_t | len | ||
| ) |
Definition at line 35 of file rt_spi.cpp.
|
static |
Definition at line 24 of file rt_spi.cpp.
|
static |
Definition at line 25 of file rt_spi.cpp.
Definition at line 44 of file rt_spi.cpp.
| const float knee_offset[4] |
Definition at line 45 of file rt_spi.cpp.
| const float knee_side_sign[4] = {-.6429f, .6429f, -.6429f, .6429f} |
Definition at line 40 of file rt_spi.cpp.
| lcm::LCM* lcm_spi |
Definition at line 12 of file rt_spi.cpp.
| uint8_t lsb = 0x01 |
Definition at line 17 of file rt_spi.cpp.
Definition at line 33 of file rt_spi.cpp.
| int spi_1_fd = -1 |
Definition at line 19 of file rt_spi.cpp.
| int spi_2_fd = -1 |
Definition at line 20 of file rt_spi.cpp.
| unsigned char spi_bits_per_word = 8 |
Definition at line 15 of file rt_spi.cpp.
| spi_command_t spi_command_drv |
Definition at line 27 of file rt_spi.cpp.
| spi_data_t spi_data_drv |
Definition at line 28 of file rt_spi.cpp.
| int spi_driver_iterations = 0 |
Definition at line 186 of file rt_spi.cpp.
| unsigned char spi_mode = SPI_MODE_0 |
Definition at line 14 of file rt_spi.cpp.
| pthread_mutex_t spi_mutex |
Definition at line 31 of file rt_spi.cpp.
| unsigned int spi_speed = 6000000 |
Definition at line 16 of file rt_spi.cpp.
| spi_torque_t spi_torque |
Definition at line 29 of file rt_spi.cpp.
Definition at line 34 of file rt_spi.cpp.