PebbleOS v4.47.0-1219-g7c542d7a9
Loading...
Searching...
No Matches
cia402.h File Reference
#include <stdbool.h>
#include <stdint.h>
#include <pbl/canopen/canopen.h>
#include <pbl/util/bits.h>

Data Structures

struct  pbl_cia402_ops
 Drive callbacks, each optional. More...
 
struct  pbl_cia402
 A drive. More...
 

Macros

#define PBL_CIA402_CONTROLWORD   0x6040U
 Controlword.
 
#define PBL_CIA402_STATUSWORD   0x6041U
 Statusword.
 
#define PBL_CIA402_MODES_OF_OPERATION   0x6060U
 Modes of operation.
 
#define PBL_CIA402_MODES_OF_OPERATION_DISPLAY   0x6061U
 Modes of operation display.
 
Statusword bits the application sets
#define PBL_CIA402_SW_WARNING   PBL_BIT(7)
 Warning.
 
#define PBL_CIA402_SW_TARGET_REACHED   PBL_BIT(10)
 Target reached.
 
#define PBL_CIA402_SW_INTERNAL_LIMIT   PBL_BIT(11)
 Internal limit active.
 
#define PBL_CIA402_SW_MODE_SPECIFIC   (PBL_BIT(12) | PBL_BIT(13))
 Operation mode specific bits.
 
#define PBL_CIA402_SW_MANUFACTURER   (PBL_BIT(14) | PBL_BIT(15))
 Manufacturer specific bits.
 

Enumerations

enum  pbl_cia402_mode {
  PBL_CIA402_MODE_NONE = 0 , PBL_CIA402_MODE_PROFILE_POSITION = 1 , PBL_CIA402_MODE_PROFILE_VELOCITY = 3 , PBL_CIA402_MODE_PROFILE_TORQUE = 4 ,
  PBL_CIA402_MODE_CYCLIC_POSITION = 8 , PBL_CIA402_MODE_CYCLIC_VELOCITY = 9 , PBL_CIA402_MODE_CYCLIC_TORQUE = 10
}
 Modes of operation. More...
 
enum  pbl_cia402_state {
  PBL_CIA402_NOT_READY_TO_SWITCH_ON , PBL_CIA402_SWITCH_ON_DISABLED , PBL_CIA402_READY_TO_SWITCH_ON , PBL_CIA402_SWITCHED_ON ,
  PBL_CIA402_OPERATION_ENABLED , PBL_CIA402_QUICK_STOP_ACTIVE , PBL_CIA402_FAULT_REACTION_ACTIVE , PBL_CIA402_FAULT
}
 States of the drive. More...
 

Functions

int pbl_cia402_init (struct pbl_cia402 *drive, struct pbl_canopen *co, const struct pbl_cia402_ops *ops, void *arg)
 Attach a drive to a node, initialized and not started, in switch on disabled.
 
enum pbl_cia402_state pbl_cia402_state (struct pbl_cia402 *drive)
 Get the state of a drive.
 
enum pbl_cia402_mode pbl_cia402_mode (struct pbl_cia402 *drive)
 Get the mode of operation of a drive.
 
int pbl_cia402_fault (struct pbl_cia402 *drive, uint16_t code)
 Report a fault: the drive goes to fault reaction active, sets the error code (0x603f) and raises an emergency.
 
void pbl_cia402_fault_reaction_done (struct pbl_cia402 *drive)
 End the fault reaction: the drive goes to fault, until the master resets it.
 
void pbl_cia402_quick_stop_done (struct pbl_cia402 *drive)
 End a quick stop: the drive goes to switch on disabled, or stays in quick stop active with quick stop option codes 5 to 8.
 
void pbl_cia402_set_status (struct pbl_cia402 *drive, uint16_t mask, uint16_t bits)
 Set statusword bits the application owns, PBL_CIA402_SW_* ones.