Defines | Enumerations | Functions | Variables
this_node.h File Reference
#include "GenericTypeDefs.h"
#include <plib.h>
#include <peripheral/can.h>
#include <peripheral/timer.h>
#include "hardware/can/shadow_can.h"
#include "misc/typedefs_shadow.h"
#include "tests/assert_shadow.h"
#include "this_node_serial_number.h"
#include "0220_palm_edc_ethercat_protocol.h"
#include "simple_can/simple_can.h"
#include "hardware/spi/spi_32.h"
#include "hardware/uart/uart_32.h"
#include "internal_reporting/internal_reporting.h"
#include "hardware/ports/port_pin.h"
#include "hardware/spi/spi_parallel_32.h"
#include "hardware/i2c/i2c_32.h"
#include "hardware/eeprom/eeprom_i2c.h"
#include "hardware/et1200/et1200_interface.h"
#include "hardware/et1200/et1200_eeprom_contents.h"
#include "hardware/et1200/et1200.h"
#include "syntouch/biotac_2_3_parallel.h"
#include "pst/pst_parallel.h"
#include "itg3200/itg3200.h"
#include "leds/leds.h"
#include "../support/svnversion.h"
Include dependency graph for this_node.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define ACCEL_CS_PIN   'G', 9
#define ALL_LED_BITS_PORTB   0b1000000000000000
#define ALL_LED_BITS_PORTC   0b0010000000000000
#define ALL_LED_BITS_PORTD   0b0000000100010001
#define ALL_LED_BITS_PORTE   0b0000000000000000
#define ALL_LED_BITS_PORTF   0b0000000000100000
#define AUTO_TRIGGER   0
 Trigger sampling even if there is no EtherCAT activity. Useful for debugging.
#define CAN_BASE_ADR_MOTORS_RX   0x0300
#define CAN_BASE_ADR_MOTORS_TX   0x0200
#define CAN_BUS_SPEED_HZ   1000000
#define DUAL_CAN_AVAILABLE
#define ET1200_CHIP_SELECT_PIN   'C', 14
#define ET1200_EEPROM_PIN   'G', 2
#define ET1200_RESET_PIN   'F', 3
#define ET1200_SOMI_PIN   'G', 7
#define ET1200_SPI_CHANNEL   0
#define FF_SOMI   (porte & 0x0004)
#define FIND_FREE_CAN_BUFFER_MAX_TRIES   8
#define I2C_PORT   I2C1, 400000
#define INCLUDE_IMPLEMENTATION_DETAILS
#define LED_AL_ERR_PIN   'C', 13
#define LED_CAN1_ERR_PIN   'D', 8
#define LED_CAN1_RX_PIN   'D', 4
#define LED_CAN1_TX_PIN   'D', 0
#define LED_CAN2_ERR_PIN   'F', 5
#define LED_CAN2_RX_PIN   'B', 15
#define LED_CAN2_TX_PIN   'F', 4
#define LF_SOMI   (porte & 0x0008)
#define MF_SOMI   (porte & 0x0002)
#define NO_STRINGS
#define NUM_LEDS   7
#define NUM_PINS_PER_PORT   16
#define NUM_PORTS   7
#define NUM_SPI_PORTS   2
#define PALM_PCB_01
#define PERIPHERAL_BUS_CLOCK_HZ   40000000
#define PIN_BIT(x)   (1<<x)
#define RF_SOMI   (porte & 0x0001)
#define SPI2_CS_PIN   'D', 11
#define SPI_BUF   SPI2ABUF
#define SPI_CLOCK_PIN   'D', 6
#define SPI_CON   SPI2ACON
#define SPI_CS_PIN   'D', 7
#define SPI_MOSI_PIN   'D', 5
#define SPI_PORT   SPI_CHANNEL2A, 10, ET1200_chip_select
#define SPI_STAT   SPI2ASTAT
#define SPI_STATbits   SPI2ASTATbits
#define SPIP_CHIP_SELECT_DOWN   LATDCLR = PIN_BIT(7);
#define SPIP_CHIP_SELECT_UP   LATDSET = PIN_BIT(7);
#define SPIP_CLOCK_DOWN   LATDCLR = PIN_BIT(6);
#define SPIP_CLOCK_UP   LATDSET = PIN_BIT(6);
#define SPIP_INPUT_BIT_0   (porte & 0x0001)
#define SPIP_INPUT_BIT_1   (porte & 0x0002)
#define SPIP_INPUT_BIT_2   (porte & 0x0004)
#define SPIP_INPUT_BIT_3   (porte & 0x0008)
#define SPIP_INPUT_BIT_4   (porte & 0x0010)
#define SPIP_INPUT_BIT_5   (porte & 0x0020)
#define SPIP_INPUT_BIT_6   (porte & 0x0040)
#define SPIP_INPUT_BIT_7   (porte & 0x0080)
#define SPIP_MOSI_DOWN   LATDCLR = PIN_BIT(5);
#define SPIP_MOSI_UP   LATDSET = PIN_BIT(5);
#define SYSTEM_FREQ_HZ   80000000
#define TH_SOMI   (porte & 0x0040)
#define THIS_NODE_PRODUCT_CODE   0x0006
#define USE_SIMPLE_PST_CS
 Use PALM_PCB_00 for the real palm board.

Enumerations

enum  ERROR_CODE { CAN_ERROR_CODES, SIMPLE_CAN_ERROR_CODES }
enum  EVENT_CODE { CAN_EVENT_CODES }

Functions

void bad_CAN_message_seen (void)
void Check_For_EtherCAT_Packet (void)
void Collect_All_CAN_Messages (void)
void delay_ms (int32u milliseconds)
void delay_us (int32u microseconds)
void Fill_Sensor_Data_Structure (I2C_MODULE I2Cm)
int32u get_frame_time_us (void)
int8u get_from_motor_data_type (void)
int8u get_which_motors (void)
void handle_configuration_message (CAN_message *message)
void initialise_this_node (void)
void Read_All_Sensors (void)
void Read_Commands_From_ET1200 (void)
void Send_All_CAN_Messages (void)
void Send_Sensor_Data_Structure (void)
void Service_EtherCAT_Packet (void)
void Translate_SOMI_Bits (void)
void Wait_For_Until_Frame_Time (int32u frame_time_us)
void write_status_data_To_ET1200 (void)

Variables

ETHERCAT_CAN_BRIDGE_DATA can_bridge_data_from_ROS
ETHERCAT_CAN_BRIDGE_DATA can_bridge_data_to_ROS
int64u node_id
 Which group this documentation should go in.
int8u palm_EDC_0200_sensor_mapping [64]

Detailed Description

This Node definition for the 0220 Palm EDC node

Definition in file this_node.h.


Define Documentation

#define ACCEL_CS_PIN   'G', 9

Definition at line 269 of file this_node.h.

#define ALL_LED_BITS_PORTB   0b1000000000000000

Definition at line 281 of file this_node.h.

#define ALL_LED_BITS_PORTC   0b0010000000000000

Definition at line 282 of file this_node.h.

#define ALL_LED_BITS_PORTD   0b0000000100010001

Definition at line 283 of file this_node.h.

#define ALL_LED_BITS_PORTE   0b0000000000000000

Definition at line 284 of file this_node.h.

#define ALL_LED_BITS_PORTF   0b0000000000100000

Definition at line 285 of file this_node.h.

#define AUTO_TRIGGER   0

Trigger sampling even if there is no EtherCAT activity. Useful for debugging.

Definition at line 259 of file this_node.h.

#define CAN_BASE_ADR_MOTORS_RX   0x0300

Definition at line 140 of file this_node.h.

#define CAN_BASE_ADR_MOTORS_TX   0x0200

Definition at line 139 of file this_node.h.

#define CAN_BUS_SPEED_HZ   1000000

Definition at line 131 of file this_node.h.

Definition at line 44 of file this_node.h.

#define ET1200_CHIP_SELECT_PIN   'C', 14

Definition at line 261 of file this_node.h.

#define ET1200_EEPROM_PIN   'G', 2

Definition at line 263 of file this_node.h.

#define ET1200_RESET_PIN   'F', 3

Definition at line 262 of file this_node.h.

#define ET1200_SOMI_PIN   'G', 7

Definition at line 268 of file this_node.h.

#define ET1200_SPI_CHANNEL   0

Definition at line 138 of file this_node.h.

#define FF_SOMI   (porte & 0x0004)

Definition at line 297 of file this_node.h.

Definition at line 141 of file this_node.h.

#define I2C_PORT   I2C1, 400000

Definition at line 279 of file this_node.h.

The INCLUDE_IMPLEMENTATION_DETAILS define exposes implementation details to this_node.h

All other code should not be exposed to implementation details.

Definition at line 69 of file this_node.h.

#define LED_AL_ERR_PIN   'C', 13

Definition at line 276 of file this_node.h.

#define LED_CAN1_ERR_PIN   'D', 8

Definition at line 272 of file this_node.h.

#define LED_CAN1_RX_PIN   'D', 4

Definition at line 271 of file this_node.h.

#define LED_CAN1_TX_PIN   'D', 0

Definition at line 270 of file this_node.h.

#define LED_CAN2_ERR_PIN   'F', 5

Definition at line 275 of file this_node.h.

#define LED_CAN2_RX_PIN   'B', 15

Definition at line 274 of file this_node.h.

#define LED_CAN2_TX_PIN   'F', 4

Definition at line 273 of file this_node.h.

#define LF_SOMI   (porte & 0x0008)

Definition at line 300 of file this_node.h.

#define MF_SOMI   (porte & 0x0002)

Definition at line 298 of file this_node.h.

#define NO_STRINGS

Definition at line 60 of file this_node.h.

#define NUM_LEDS   7

Definition at line 135 of file this_node.h.

#define NUM_PINS_PER_PORT   16

Definition at line 134 of file this_node.h.

#define NUM_PORTS   7

Definition at line 133 of file this_node.h.

#define NUM_SPI_PORTS   2

Definition at line 136 of file this_node.h.

#define PALM_PCB_01

Use PALM_PCB_00 for the old prototype board.

Definition at line 188 of file this_node.h.

#define PERIPHERAL_BUS_CLOCK_HZ   40000000

Definition at line 130 of file this_node.h.

#define PIN_BIT (   x)    (1<<x)

Definition at line 303 of file this_node.h.

#define RF_SOMI   (porte & 0x0001)

Definition at line 299 of file this_node.h.

#define SPI2_CS_PIN   'D', 11

Definition at line 264 of file this_node.h.

#define SPI_BUF   SPI2ABUF

Definition at line 314 of file this_node.h.

#define SPI_CLOCK_PIN   'D', 6

Definition at line 266 of file this_node.h.

#define SPI_CON   SPI2ACON

Definition at line 316 of file this_node.h.

#define SPI_CS_PIN   'D', 7

Definition at line 265 of file this_node.h.

#define SPI_MOSI_PIN   'D', 5

Definition at line 267 of file this_node.h.

#define SPI_PORT   SPI_CHANNEL2A, 10, ET1200_chip_select

Definition at line 278 of file this_node.h.

#define SPI_STAT   SPI2ASTAT

Definition at line 315 of file this_node.h.

#define SPI_STATbits   SPI2ASTATbits

Definition at line 317 of file this_node.h.

#define SPIP_CHIP_SELECT_DOWN   LATDCLR = PIN_BIT(7);

Definition at line 306 of file this_node.h.

#define SPIP_CHIP_SELECT_UP   LATDSET = PIN_BIT(7);

Definition at line 305 of file this_node.h.

#define SPIP_CLOCK_DOWN   LATDCLR = PIN_BIT(6);

Definition at line 309 of file this_node.h.

#define SPIP_CLOCK_UP   LATDSET = PIN_BIT(6);

Definition at line 308 of file this_node.h.

#define SPIP_INPUT_BIT_0   (porte & 0x0001)

Definition at line 288 of file this_node.h.

#define SPIP_INPUT_BIT_1   (porte & 0x0002)

Definition at line 289 of file this_node.h.

#define SPIP_INPUT_BIT_2   (porte & 0x0004)

Definition at line 290 of file this_node.h.

#define SPIP_INPUT_BIT_3   (porte & 0x0008)

Definition at line 291 of file this_node.h.

#define SPIP_INPUT_BIT_4   (porte & 0x0010)

Definition at line 292 of file this_node.h.

#define SPIP_INPUT_BIT_5   (porte & 0x0020)

Definition at line 293 of file this_node.h.

#define SPIP_INPUT_BIT_6   (porte & 0x0040)

Definition at line 294 of file this_node.h.

#define SPIP_INPUT_BIT_7   (porte & 0x0080)

Definition at line 295 of file this_node.h.

#define SPIP_MOSI_DOWN   LATDCLR = PIN_BIT(5);

Definition at line 312 of file this_node.h.

#define SPIP_MOSI_UP   LATDSET = PIN_BIT(5);

Definition at line 311 of file this_node.h.

#define SYSTEM_FREQ_HZ   80000000

Definition at line 129 of file this_node.h.

#define TH_SOMI   (porte & 0x0040)

Definition at line 301 of file this_node.h.

#define THIS_NODE_PRODUCT_CODE   0x0006

Definition at line 123 of file this_node.h.

Use PALM_PCB_00 for the real palm board.

Definition at line 258 of file this_node.h.


Enumeration Type Documentation

enum ERROR_CODE

Used for reporting error events, or a change in error state. E.G. the change from CAN1_HAPPY to CAN1_SAD Error and event codes relevant to CAN are defined in the shadow_can.h etc. this enum simply collects together the error codes relevant to this node.

Enumerator:
CAN_ERROR_CODES 
SIMPLE_CAN_ERROR_CODES 

Definition at line 94 of file this_node.h.

enum EVENT_CODE

Used for reporting general events, or a change in state. E.G. the change from Idle mode to Active mode Error and event codes relevant to CAN are defined in the shadow_can.h etc. this enum simply collects together the event codes relevant to this node.

Enumerator:
CAN_EVENT_CODES 

Definition at line 107 of file this_node.h.


Function Documentation

void bad_CAN_message_seen ( void  )
void Check_For_EtherCAT_Packet ( void  )

Ask the ET1200 if an EtherCAT packet arrived. If so, get it serviced. Also, handle the LEDs etc if they need doing.

Author:
Hugo Elias

Definition at line 514 of file this_node.c.

void Collect_All_CAN_Messages ( void  )
void delay_ms ( int32u  milliseconds)

Correct length pause, which works by watching the CP0 COUNT register. This code handles one rollover, so, as long as the delay isn't more than 107 seconds, you should be OK.

Parameters:
millisecondsThe number of microseconds to pause for
Author:
Hugo Elias

Definition at line 825 of file this_node.c.

void delay_us ( int32u  microseconds)

Correct length pause, which works by watching the CP0 COUNT register.

Parameters:
microsecondsThe number of microseconds to pause for
Author:
Hugo Elias

Definition at line 805 of file this_node.c.

void Fill_Sensor_Data_Structure ( I2C_MODULE  I2Cm)

Return the time in microseconds since the the beginning of the current 1ms frame. The timer is started when the PIC sees that new Command data are available.

Author:
Hugo Elias

Definition at line 326 of file this_node.c.

int8u get_which_motors ( void  )
void handle_configuration_message ( CAN_message *  message)
void initialise_this_node ( void  )

Initialise the hardware of this node. I/O pins SPI I2C LEDs ET1200 interface ET1200 CAN buses parallel SPI tactile sensors

Author:
Hugo Elias

Definition at line 162 of file this_node.c.

void Read_All_Sensors ( void  )

Read all of the Joint and Tactile sensors on the Palm

Author:
Hugo Elias

Definition at line 394 of file this_node.c.

void Read_Commands_From_ET1200 ( void  )

Definition at line 261 of file this_node.c.

void Send_All_CAN_Messages ( void  )
void Send_Sensor_Data_Structure ( void  )
void Service_EtherCAT_Packet ( void  )

This is the main function of the whole node. It's called every time an EtherCAT packet arrives.

Author:
Hugo Elias

Definition at line 550 of file this_node.c.

void Translate_SOMI_Bits ( void  )
void Wait_For_Until_Frame_Time ( int32u  frame_time_us)

Wait until a certain time within the 1000us frame time. This is a useful function for waiting until the last moment to see if any more CAN messages arrive, before writing data back to the ET1200.

Frame time is in microseconds, starting at 0 when the EtherCAT packet arrives, and should never be seen to go beyond 1000, when the next EtherCAT packet should arrive.

Parameters:
frame_time_usThe frame time in microseconds.
Author:
Hugo Elias

Definition at line 369 of file this_node.c.

void write_status_data_To_ET1200 ( void  ) [inline]

Write the whole etherCAT_status_data[] array to the ET1200. Once these data are written, we are ready for the next EtherCAT packet to arrive, and the idle timer starts.

Author:
Hugo Elias

Definition at line 277 of file this_node.c.


Variable Documentation

ETHERCAT_CAN_BRIDGE_DATA can_bridge_data_from_ROS

Definition at line 52 of file this_node.c.

ETHERCAT_CAN_BRIDGE_DATA can_bridge_data_to_ROS

Definition at line 53 of file this_node.c.

Which group this documentation should go in.

Definition at line 44 of file this_node.c.

Definition at line 75 of file this_node.c.



sr_external_dependencies
Author(s): Ugo Cupcic/ ugo@shadowrobot.com, software@shadowrobot.com
autogenerated on Thu Jan 2 2014 12:01:42