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 BOARD_H //Note that this is not a real file, it is defined in globals.h.
6
7#define IAC_ALGORITHM_NONE 0U
8#define IAC_ALGORITHM_ONOFF 1U
9#define IAC_ALGORITHM_PWM_OL 2U
10#define IAC_ALGORITHM_PWM_CL 3U
11#define IAC_ALGORITHM_STEP_OL 4U
12#define IAC_ALGORITHM_STEP_CL 5U
13#define IAC_ALGORITHM_PWM_OLCL 6U //Openloop plus closedloop IAC control
14#define IAC_ALGORITHM_STEP_OLCL 7U //Openloop plus closedloop IAC control
15
16#define IDLE_PIN_LOW() *idle_pin_port &= ~(idle_pin_mask)
17#define IDLE_PIN_HIGH() *idle_pin_port |= (idle_pin_mask)
18#define IDLE2_PIN_LOW() *idle2_pin_port &= ~(idle2_pin_mask)
19#define IDLE2_PIN_HIGH() *idle2_pin_port |= (idle2_pin_mask)
20
21#define STEPPER_FORWARD 0
22#define STEPPER_BACKWARD 1
23#define STEPPER_POWER_WHEN_ACTIVE 0
24#define IDLE_TABLE_SIZE 10
25
26enum 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.
27
29{
30 int curIdleStep; //Tracks the current location of the stepper
31 int targetIdleStep; //What the targeted step is
33 volatile unsigned long stepStartTime;
34};
35
36extern uint16_t idle_pwm_max_count; //Used for variable PWM frequency
37extern long FeedForwardTerm;
38
40void idleControl(void);
41void initialiseIdleUpOutput(void);
42void disableIdle(void);
43void idleInterrupt(void);
44
45#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:785
void initialiseIdleUpOutput(void)
Definition idle.cpp:223
void disableIdle(void)
Definition idle.cpp:740
uint16_t idle_pwm_max_count
Definition idle.cpp:29
long FeedForwardTerm
Definition idle.cpp:32
void idleControl(void)
Definition idle.cpp:350
void initialiseIdle(bool forcehoming)
Definition idle.cpp:73
StepperStatus
Definition idle.h:26
@ SOFF
Definition idle.h:26
@ COOLING
Definition idle.h:26
@ STEPPING
Definition idle.h:26
Definition idle.h:29
int targetIdleStep
Definition idle.h:31
volatile unsigned long stepStartTime
Definition idle.h:33
volatile StepperStatus stepperStatus
Definition idle.h:32
int curIdleStep
Definition idle.h:30