Prusa MINI Firmware overview
FilamentSensorBase Class Reference

#include <runout.h>

Inheritance diagram for FilamentSensorBase:

Static Public Member Functions

static void setup ()
 
static uint8_t poll_runout_pins ()
 
static uint8_t poll_runout_states ()
 

Static Protected Member Functions

static void filament_present (const uint8_t extruder)
 

Member Function Documentation

◆ filament_present()

static void FilamentSensorBase::filament_present ( const uint8_t  extruder)
staticprotected
Here is the caller graph for this function:

◆ setup()

static void FilamentSensorBase::setup ( )
static
133  {
134  #if ENABLED(FIL_RUNOUT_PULLUP)
135  #define INIT_RUNOUT_PIN(P) SET_INPUT_PULLUP(P)
136  #elif ENABLED(FIL_RUNOUT_PULLDOWN)
137  #define INIT_RUNOUT_PIN(P) SET_INPUT_PULLDOWN(P)
138  #else
139  #define INIT_RUNOUT_PIN(P) SET_INPUT(P)
140  #endif
141 
143  #if NUM_RUNOUT_SENSORS > 1
145  #if NUM_RUNOUT_SENSORS > 2
146  INIT_RUNOUT_PIN(FIL_RUNOUT3_PIN);
147  #if NUM_RUNOUT_SENSORS > 3
148  INIT_RUNOUT_PIN(FIL_RUNOUT4_PIN);
149  #if NUM_RUNOUT_SENSORS > 4
150  INIT_RUNOUT_PIN(FIL_RUNOUT5_PIN);
151  #if NUM_RUNOUT_SENSORS > 5
152  INIT_RUNOUT_PIN(FIL_RUNOUT6_PIN);
153  #endif
154  #endif
155  #endif
156  #endif
157  #endif
158  }

◆ poll_runout_pins()

static uint8_t FilamentSensorBase::poll_runout_pins ( )
static
161  {
162  return (
163  (READ(FIL_RUNOUT_PIN ) ? _BV(0) : 0)
164  #if NUM_RUNOUT_SENSORS > 1
165  | (READ(FIL_RUNOUT2_PIN) ? _BV(1) : 0)
166  #if NUM_RUNOUT_SENSORS > 2
167  | (READ(FIL_RUNOUT3_PIN) ? _BV(2) : 0)
168  #if NUM_RUNOUT_SENSORS > 3
169  | (READ(FIL_RUNOUT4_PIN) ? _BV(3) : 0)
170  #if NUM_RUNOUT_SENSORS > 4
171  | (READ(FIL_RUNOUT5_PIN) ? _BV(4) : 0)
172  #if NUM_RUNOUT_SENSORS > 5
173  | (READ(FIL_RUNOUT6_PIN) ? _BV(5) : 0)
174  #endif
175  #endif
176  #endif
177  #endif
178  #endif
179  );
180  }
Here is the caller graph for this function:

◆ poll_runout_states()

static uint8_t FilamentSensorBase::poll_runout_states ( )
static
183  {
184  return poll_runout_pins() ^ uint8_t(
185  #if DISABLED(FIL_RUNOUT_INVERTING)
187  #else
188  0
189  #endif
190  );
191  }
Here is the call graph for this function:
FilamentSensorBase::poll_runout_pins
static uint8_t poll_runout_pins()
Definition: runout.h:161
FIL_RUNOUT2_PIN
#define FIL_RUNOUT2_PIN
Definition: pins_GT2560_V3.h:83
INIT_RUNOUT_PIN
#define INIT_RUNOUT_PIN(P)
DISABLED
#define DISABLED(V...)
Definition: macros.h:178
NUM_RUNOUT_SENSORS
#define NUM_RUNOUT_SENSORS
Definition: pins_FORMBOT_TREX3.h:132
uint8_t
const uint8_t[]
Definition: 404_html.c:3
_BV
#define _BV(bit)
Definition: wiring_constants.h:99
FIL_RUNOUT_PIN
#define FIL_RUNOUT_PIN
Definition: pins_RAMPS_LINUX.h:216
READ
#define READ(IO)
Definition: fastio.h:95