OSCtoCV Library
OSCtoCV_Euclidean.h
- Committer:
- casiotone401
- Date:
- 2016-01-17
- Revision:
- 0:cd43a974c54c
- Child:
- 1:981b62bb5c87
File content as of revision 0:cd43a974c54c:
/* OSCtoCV Euclidean Sequencer */ #pragma O3 #pragma Otime #ifndef OSCtoCV_EUCLIDEAN_H #define OSCtoCV_EUCLIDEAN_H #include "mbed.h" #include "OSCtoCV.h" //------------------------------------------------------------- // Euclidean Sequencer Functions // Euclidean Sequencer void EuclideanSeq(int trigger, bool reset, bool gatesoff); // Init Euclidean Sequencer void InitEuclideanSeq(void); // Euclid calculation function unsigned int Euclid(int n, int k, int o); // Reads a bit of a number inline int BitRead(uint16_t b, int bitPos); // Function to right rotate n by d bits inline uint16_t BitReadOffset(int shift, uint16_t value, uint16_t pattern_length); // Function to find the binary length of a number by counting bitwise inline int findlength(unsigned int bnry); // Function to concatenate two binary numbers bitwise inline unsigned int ConcatBin(unsigned int bina, unsigned int binb); // routine triggered by each beat void Sync(int active_channel, bool gatesoff); /* 3 functions to read each encoder returns +1, 0 or -1 dependent on direction Contains no internal debounce, so calls should be delayed */ // Check Euclidean Seq N(length) Value inline int EncodeReadN(int ch); inline int EncodeReadK(int ch); inline int EncodeReadO(int ch); #endif