#include <types.h>
#include <cpu_def.h>
#include <mcu_regs.h>
#include <system_def.h>
#include <string.h>
#include <boot_fn.h>
#include <pxmc.h>
#include <pxmcbsp.h>
#include <ctype.h>
#include <stdlib.h>
#include <utils.h>
#include <periph/sci_rs232.h>
#include <periph/sci_channels.h>
#include <stdio.h>
#include <stdbool.h>
#include <cmd_proc.h>
#include "cmd_pxmc.h"
#include <candriver.h>
#include <canOpenDriver.h>
#include <can_ids.h>
Classes | |
struct | odometryData_t |
Defines | |
#define | INLINE |
#define | MAX(a, b) ((a)>(b)?(a):(b)) |
#define | _PXMC_MAX_OUT_ 0x6f |
#define | CMD_ARR_STACK_SIZE 4 |
#define | ODOMETRY_TABLE_SIZE 10 |
#define | ODOMETRY_PERIOD 50 |
#define | ODOMETRY_TIMEOUT (3*ODOMETRY_PERIOD) |
#define | PERIOD 1000 |
Odometry (IRC2010) | |
#define | LED_LIVE 0 |
D1: Blinks once per second when software is alive. | |
#define | LED_CAN_REC 1 |
D2: Blinks when a CAN message is received:
| |
#define | LED_ERROR 2 |
D3: Light = Unhandled exception, Slow blink (4s) = motor error. | |
#define | LED_RESET 3 |
D4: Blinks for 1 s after reset. | |
Functions | |
int | cmd_do_quit (cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) |
int | cmd_do_canst (cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) |
int | cmd_do_setflags (cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) |
int | cmd_do_haltest (cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) |
Rotates motor slowly four turns forward and than two turns backward (in a feedforward manner). | |
int | cmd_do_setindex (cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) |
int | cmd_do_setvang (cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) |
int | cmd_do_setshift (cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) |
int | cmd_do_showene (cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) |
int | cmd_do_nopxmc (cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) |
int | cmd_do_mypwm (cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) |
int | cmd_do_help_wd (cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) |
void | unhandled_exception (void) |
void | print_mcs_err (pxmc_state_t *mcs, char *name) |
void | led_can_rec (unsigned duration_msec) |
void | _print (char *ptr) |
int | main () |
Variables | |
bool | odometry_triggered = false |
unsigned char | trig_seq |
int | runtime_display = 0 |
int | slowgo = 0 |
cmd_des_t const ** | cmd_list = cmd_list_default |
cmd_des_t const | cmd_des_help |
cmd_des_t const | cmd_des_showene |
cmd_des_t const | cmd_des_mypwm |
cmd_des_t const | cmd_des_nopxmc |
cmd_des_t const | cmd_des_disp |
cmd_des_t const | cmd_des_slowgo |
cmd_des_t const | cmd_des_setindex |
cmd_des_t const | cmd_des_setvang |
cmd_des_t const | cmd_des_halindex |
cmd_des_t const | cmd_des_setshift |
cmd_des_t const | cmd_des_quit |
cmd_des_t const | cmd_des_canst |
cmd_des_t const | cmd_des_setflags |
cmd_io_t | cmd_io_rs232_line |
cmd_des_t const * | cmd_list_default [] |
short | idxRecive = 0 |
short | idxStore = 0 |
struct odometryData_t | oddata [ODOMETRY_TABLE_SIZE] |
#define _PXMC_MAX_OUT_ 0x6f |
#define CMD_ARR_STACK_SIZE 4 |
#define INLINE |
#define ODOMETRY_PERIOD 50 |
#define ODOMETRY_TABLE_SIZE 10 |
#define ODOMETRY_TIMEOUT (3*ODOMETRY_PERIOD) |
#define PERIOD 1000 |
void _print | ( | char * | ptr | ) |
int cmd_do_canst | ( | cmd_io_t * | cmd_io, | |
const struct cmd_des * | des, | |||
char * | param[] | |||
) |
int cmd_do_haltest | ( | cmd_io_t * | cmd_io, | |
const struct cmd_des * | des, | |||
char * | param[] | |||
) |
Rotates motor slowly four turns forward and than two turns backward (in a feedforward manner).
During movement it displays values read from HAL sensors and tries to detect correct index mark position.
int cmd_do_help_wd | ( | cmd_io_t * | cmd_io, | |
const struct cmd_des * | des, | |||
char * | param[] | |||
) |
int cmd_do_mypwm | ( | cmd_io_t * | cmd_io, | |
const struct cmd_des * | des, | |||
char * | param[] | |||
) |
int cmd_do_nopxmc | ( | cmd_io_t * | cmd_io, | |
const struct cmd_des * | des, | |||
char * | param[] | |||
) |
int cmd_do_quit | ( | cmd_io_t * | cmd_io, | |
const struct cmd_des * | des, | |||
char * | param[] | |||
) |
int cmd_do_setflags | ( | cmd_io_t * | cmd_io, | |
const struct cmd_des * | des, | |||
char * | param[] | |||
) |
int cmd_do_setindex | ( | cmd_io_t * | cmd_io, | |
const struct cmd_des * | des, | |||
char * | param[] | |||
) |
int cmd_do_setshift | ( | cmd_io_t * | cmd_io, | |
const struct cmd_des * | des, | |||
char * | param[] | |||
) |
int cmd_do_setvang | ( | cmd_io_t * | cmd_io, | |
const struct cmd_des * | des, | |||
char * | param[] | |||
) |
int cmd_do_showene | ( | cmd_io_t * | cmd_io, | |
const struct cmd_des * | des, | |||
char * | param[] | |||
) |
void led_can_rec | ( | unsigned | duration_msec | ) |
int main | ( | void | ) |
void print_mcs_err | ( | pxmc_state_t * | mcs, | |
char * | name | |||
) |
void unhandled_exception | ( | void | ) |
cmd_des_t const cmd_des_canst |
{0, 0,"CANST","Print CAN controller status", cmd_do_canst}
cmd_des_t const cmd_des_disp |
{0, CDESM_OPCHR|CDESM_RW,"DISP","switch on/off runtime display of variables", cmd_do_rw_int, {(char*)&runtime_display}}
cmd_des_t const cmd_des_halindex |
{0, 0,"HALTEST?","show hal state with respect to ptindex", cmd_do_haltest}
cmd_des_t const cmd_des_help |
{0, 0,"HELP","prints help for commands", cmd_do_help_wd,{(char*)&cmd_list}}
cmd_des_t const cmd_des_mypwm |
{0, 0,"x#","test", cmd_do_mypwm}
cmd_des_t const cmd_des_nopxmc |
{0, 0,"NOPXMC?","switch of pxmc controller and output", cmd_do_nopxmc}
cmd_des_t const cmd_des_quit |
{0, 0,"QUIT","exit", cmd_do_quit}
cmd_des_t const cmd_des_setflags |
{0, 0,"setflags","set some flags", cmd_do_setflags}
cmd_des_t const cmd_des_setindex |
{0, 0,"SETINDEX?","changes pxms_ptindx", cmd_do_setindex}
cmd_des_t const cmd_des_setshift |
{0, 0,"SETSHIFT?","changes pxms_ptshift", cmd_do_setshift}
cmd_des_t const cmd_des_setvang |
{0, 0,"SETVANG?","changes pxms_ptvang", cmd_do_setvang}
cmd_des_t const cmd_des_showene |
{0, 0,"SHOWENE?","shows ene and couple others parameters", cmd_do_showene}
cmd_des_t const cmd_des_slowgo |
{0, CDESM_OPCHR|CDESM_RW,"SLOWGO","program controlled movement", cmd_do_rw_int, {(char*)&slowgo}}
cmd_io_t cmd_io_rs232_line |
cmd_des_t const** cmd_list = cmd_list_default |
cmd_des_t const* cmd_list_default[] |
{ &cmd_des_help, &cmd_des_quit, &cmd_des_setflags, &cmd_des_mypwm, &cmd_des_setindex, &cmd_des_setvang, &cmd_des_halindex, &cmd_des_setshift, &cmd_des_showene, &cmd_des_nopxmc, &cmd_des_disp, &cmd_des_slowgo, &cmd_des_canst, (cmd_des_t*)1, (cmd_des_t*)cmd_stm_default, NULL }
short idxRecive = 0 |
short idxStore = 0 |
struct odometryData_t oddata[ODOMETRY_TABLE_SIZE] |
bool odometry_triggered = false |
int runtime_display = 0 |
int slowgo = 0 |
unsigned char trig_seq |