Speeduino
Loading...
Searching...
No Matches
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 0
9#define IAC_ALGORITHM_ONOFF 1
10#define IAC_ALGORITHM_PWM_OL 2
11#define IAC_ALGORITHM_PWM_CL 3
12#define IAC_ALGORITHM_STEP_OL 4
13#define IAC_ALGORITHM_STEP_CL 5
14#define IAC_ALGORITHM_PWM_OLCL 6 //Openloop plus closedloop IAC control
15#define IAC_ALGORITHM_STEP_OLCL 7 //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
27enum 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
30{
31 int curIdleStep; //Tracks the current location of the stepper
32 int targetIdleStep; //What the targeted step is
34 volatile unsigned long stepStartTime;
35};
36
37extern uint16_t idle_pwm_max_count; //Used for variable PWM frequency
38extern long FeedForwardTerm;
39
41void idleControl(void);
42void initialiseIdleUpOutput(void);
43void disableIdle(void);
44void idleInterrupt(void);
45
46#endif
static uint32_t rshift(uint32_t a)
Bitwise right shift - generic, unoptimized, case.
Definition bit_shifts.h:349
void idleInterrupt(void)
Definition idle.cpp:845
void initialiseIdleUpOutput(void)
Definition idle.cpp:276
void disableIdle(void)
Definition idle.cpp:800
uint16_t idle_pwm_max_count
Definition idle.cpp:28
long FeedForwardTerm
Definition idle.cpp:31
void idleControl(void)
Definition idle.cpp:410
void initialiseIdle(bool forcehoming)
Definition idle.cpp:72
StepperStatus
Definition idle.h:27
@ SOFF
Definition idle.h:27
@ COOLING
Definition idle.h:27
@ STEPPING
Definition idle.h:27
Definition idle.h:30
int targetIdleStep
Definition idle.h:32
volatile unsigned long stepStartTime
Definition idle.h:34
volatile StepperStatus stepperStatus
Definition idle.h:33
int curIdleStep
Definition idle.h:31