Speeduino
Loading...
Searching...
No Matches
speeduino
idle.h
Go to the documentation of this file.
1
#ifndef IDLE_H
2
#define IDLE_H
3
4
#include "
globals.h
"
5
#include "
table2d.h
"
6
#include BOARD_H
//Note that this is not a real file, it is defined in globals.h.
7
8
#define IAC_ALGORITHM_NONE 0U
9
#define IAC_ALGORITHM_ONOFF 1U
10
#define IAC_ALGORITHM_PWM_OL 2U
11
#define IAC_ALGORITHM_PWM_CL 3U
12
#define IAC_ALGORITHM_STEP_OL 4U
13
#define IAC_ALGORITHM_STEP_CL 5U
14
#define IAC_ALGORITHM_PWM_OLCL 6U
//Openloop plus closedloop IAC control
15
#define IAC_ALGORITHM_STEP_OLCL 7U
//Openloop plus closedloop IAC control
16
17
#define IDLE_PIN_LOW() *idle_pin_port &= ~(idle_pin_mask)
18
#define IDLE_PIN_HIGH() *idle_pin_port |= (idle_pin_mask)
19
#define IDLE2_PIN_LOW() *idle2_pin_port &= ~(idle2_pin_mask)
20
#define IDLE2_PIN_HIGH() *idle2_pin_port |= (idle2_pin_mask)
21
22
#define STEPPER_FORWARD 0
23
#define STEPPER_BACKWARD 1
24
#define STEPPER_POWER_WHEN_ACTIVE 0
25
#define IDLE_TABLE_SIZE 10
26
27
enum
StepperStatus
{
SOFF
,
STEPPING
,
COOLING
};
//The 2 statuses that a stepper can have. STEPPING means that a high pulse is currently being sent and will need to be turned off at some point.
28
29
struct
StepperIdle
30
{
31
int
curIdleStep
;
//Tracks the current location of the stepper
32
int
targetIdleStep
;
//What the targeted step is
33
volatile
StepperStatus
stepperStatus
;
34
volatile
unsigned
long
stepStartTime
;
35
};
36
37
extern
uint16_t
idle_pwm_max_count
;
//Used for variable PWM frequency
38
extern
long
FeedForwardTerm
;
39
40
void
initialiseIdle
(
bool
forcehoming
);
41
void
idleControl
(
void
);
42
void
initialiseIdleUpOutput
(
void
);
43
void
disableIdle
(
void
);
44
void
idleInterrupt
(
void
);
45
46
#endif
globals.h
rshift
static uint32_t rshift(uint32_t a)
Bitwise right shift - generic, unoptimized, case.
Definition
bit_shifts.h:349
idleInterrupt
void idleInterrupt(void)
Definition
idle.cpp:845
initialiseIdleUpOutput
void initialiseIdleUpOutput(void)
Definition
idle.cpp:276
disableIdle
void disableIdle(void)
Definition
idle.cpp:800
idle_pwm_max_count
uint16_t idle_pwm_max_count
Definition
idle.cpp:28
FeedForwardTerm
long FeedForwardTerm
Definition
idle.cpp:31
idleControl
void idleControl(void)
Definition
idle.cpp:410
initialiseIdle
void initialiseIdle(bool forcehoming)
Definition
idle.cpp:72
StepperStatus
StepperStatus
Definition
idle.h:27
SOFF
@ SOFF
Definition
idle.h:27
COOLING
@ COOLING
Definition
idle.h:27
STEPPING
@ STEPPING
Definition
idle.h:27
StepperIdle
Definition
idle.h:30
StepperIdle::targetIdleStep
int targetIdleStep
Definition
idle.h:32
StepperIdle::stepStartTime
volatile unsigned long stepStartTime
Definition
idle.h:34
StepperIdle::stepperStatus
volatile StepperStatus stepperStatus
Definition
idle.h:33
StepperIdle::curIdleStep
int curIdleStep
Definition
idle.h:31
table2d.h
Generated by
1.9.8