Motor Evaluation Kit NEVC-MCTRL-100-t01-1.0.0
Firmware for NEVB-MCTRL-100-01 for trapezoidal control of BLDC motors using Hall-effect sensors
Loading...
Searching...
No Matches
scpi.h
Go to the documentation of this file.
1/* This file has been prepared for Doxygen automatic documentation generation.*/
30#ifndef __SCPI_H_
31#define __SCPI_H_
32
34#define __AVR_ATmega32U4__ 1
35
36// Include libraries
37#include <stdio.h>
38#include <stdlib.h>
39#include <string.h>
40#include "src/SCPI_Parser/SCPI_Parser.h"
41#include <Arduino.h>
42#include <avr/io.h>
43#include "main.h"
44
47#define SCPI_INPUT_BUFFER_LENGTH 64
48
50#define SCPI_ERROR_QUEUE_SIZE 4
51
53#define SCPI_IDN1 "NEXPERIA"
55#define SCPI_IDN2 "NEVB-MCTRL-100-xx"
57#define SCPI_IDN3 NULL
59#define SCPI_IDN4 "NEVC-MCTRL-100-t01-1.0.0"
60
61// External variable declarations
62extern const scpi_command_t scpi_commands[];
63extern scpi_interface_t scpi_interface;
64extern char scpi_input_buffer[];
65extern scpi_error_t scpi_error_queue_data[];
66extern scpi_t scpi_context;
67extern volatile motorconfigs_t motorConfigs;
68extern volatile motorflags_t motorFlags;
69extern volatile faultflags_t faultFlags;
70extern volatile uint16_t lastCommutationTicks;
71extern volatile uint16_t current;
72extern volatile uint16_t gateVref;
73extern volatile uint8_t speedInput;
74
75// External prototypes
77extern void TimersInit(void);
79extern void ConfigsInit(void);
80
81// Function prototypes
82size_t SCPI_Write(scpi_t *context, const char *data, size_t len);
83int SCPI_Error(scpi_t *context, int_fast16_t err);
84scpi_result_t SCPI_Control(scpi_t *context, scpi_ctrl_name_t ctrl, scpi_reg_val_t val);
85scpi_result_t SCPI_Reset(scpi_t *context);
86scpi_result_t SCPI_Flush(scpi_t *context);
87
328#endif /* __SCPI_H_ */
Motor control header file.
scpi_interface_t scpi_interface
SCPI interface structure.
Definition scpi.cpp:651
scpi_result_t SCPI_Reset(scpi_t *context)
Resets the SCPI context.
Definition scpi.cpp:622
scpi_result_t SCPI_Control(scpi_t *context, scpi_ctrl_name_t ctrl, scpi_reg_val_t val)
Handles control messages for the SCPI interface (dummy)
Definition scpi.cpp:605
volatile motorflags_t motorFlags
Motor control flags placed in I/O space for fast access.
Definition main.ino:76
scpi_error_t scpi_error_queue_data[]
SCPI error queue data array.
Definition scpi.cpp:673
volatile uint8_t speedInput
The most recent "speed" input measurement.
Definition main.ino:125
const scpi_command_t scpi_commands[]
Array of SCPI commands.
Definition scpi.cpp:504
volatile motorconfigs_t motorConfigs
Motor Configs.
Definition main.ino:90
size_t SCPI_Write(scpi_t *context, const char *data, size_t len)
Writes data to the SCPI interface.
Definition scpi.cpp:549
volatile uint16_t current
Current measurement (Register Value).
Definition main.ino:161
int SCPI_Error(scpi_t *context, int_fast16_t err)
Handles SCPI errors and outputs them to the Serial interface.
Definition scpi.cpp:581
void ConfigsInit(void)
Initializes motorConfigs.
volatile faultflags_t faultFlags
Fault flags placed in I/O space for fast access.
Definition main.ino:84
char scpi_input_buffer[]
SCPI input buffer.
Definition scpi.cpp:665
volatile uint16_t lastCommutationTicks
The number of 'ticks' between two hall sensor changes (store).
Definition main.ino:118
void TimersInit(void)
Initializes and synchronizes Timers.
Definition main.ino:405
scpi_t scpi_context
SCPI context structure.
Definition scpi.cpp:681
scpi_result_t SCPI_Flush(scpi_t *context)
Flushes the Serial interface buffer.
Definition scpi.cpp:565
volatile uint16_t gateVref
Gate voltage measurement (Register Value)
Definition main.ino:190
Collection of all fault flags.
Definition main.h:999
Collection of motor configurations.
Definition main.h:1024
Collection of all motor control flags.
Definition main.h:979