eBoard ①⑧⑨
Written for SIA 2017/2018
eagle_ShiftExt.h
Go to the documentation of this file.
1 #ifndef EAGLE_EBOARD_HELPLIB_SHIFTEXT
2  #define EAGLE_EBOARD_HELPLIB_SHIFTEXT
3 
12 //=====================================================================================================================================================
13 // Shift extension
14 //=====================================================================================================================================================
15 
16  //-------------------------------------------------------------------------------------------------------------------------------------------------
17  // variables
18  //-------------------------------------------------------------------------------------------------------------------------------------------------
19 
23  long store_bits = 0L;
24 
25  //-------------------------------------------------------------------------------------------------------------------------------------------------
26  // shift single
27  //-------------------------------------------------------------------------------------------------------------------------------------------------
28 
37  void shiftSingle(optVAL_t idx, bool val);
38 
39  //-------------------------------------------------------------------------------------------------------------------------------------------------
40  // shift all
41  //-------------------------------------------------------------------------------------------------------------------------------------------------
42 
46  void shiftAll(void);
47 
49  void shiftSingle(optVAL_t idx, bool val) {
50  bitWrite(store_bits,idx,val);
51  shiftAll();
52  }
53  void shiftAll(void){
54  digitalWrite(PIN_SHIFT_LAT,LOW);
55  for(optVAL_t c = 0; (c<32 && !STOP); c++){
56  digitalWrite(PIN_SHIFT_CLK,LOW);
57  shiftOut(PIN_SHIFT_DAT,PIN_SHIFT_CLK,MSBFIRST,bitRead(store_bits,c));
58  }
59  digitalWrite(PIN_SHIFT_LAT,LOW);
60  }
62 
63 #endif
#define PIN_SHIFT_CLK
Definition: eBoard.h:587
static bool STOP
Definition: eBoard.h:123
#define PIN_SHIFT_LAT
Definition: eBoard.h:599
long store_bits
[SHIFT] Manipulate me to set Pins via bitSet operations
void shiftAll(void)
[SHIFT] Changes bits according to store_bits
void shiftSingle(optVAL_t idx, bool val)
[SHIFT] Changes a single output Pin
int optVAL_t
Definition: eBoard.h:137
#define PIN_SHIFT_DAT
Definition: eBoard.h:593