OSCtoCV Library

Dependents:   OSCtoCVConverter

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers OSCtoCV_Euclidean.h Source File

OSCtoCV_Euclidean.h

00001 /*
00002     OSCtoCV Euclidean Sequencer
00003 */
00004 
00005 #pragma O3
00006 #pragma Otime
00007 
00008 #ifndef OSCtoCV_EUCLIDEAN_H
00009 #define OSCtoCV_EUCLIDEAN_H
00010 
00011 #include "mbed.h"
00012 #include "OSCtoCV.h"
00013 
00014 //-------------------------------------------------------------
00015 // Euclidean Sequencer Functions
00016 
00017 // Euclidean Sequencer return triggerState
00018 unsigned int EuclideanSeq(int trigger, bool reset, bool gatesoff, bool auto_offset);
00019     
00020 // Init Euclidean Sequencer
00021 void InitEuclideanSeq(void);
00022 
00023 // Euclid calculation function
00024 inline unsigned int Euclid(int n, int k, int o);
00025 
00026 // Reads a bit of a number
00027 inline int BitRead(uint16_t b, int bitPos);
00028 
00029 // Function to right rotate n by d bits
00030 inline uint16_t BitReadOffset(int shift, uint16_t value, uint16_t pattern_length);
00031 
00032 // Function to find the binary length of a number by counting bitwise
00033 inline int findlength(unsigned int bnry);
00034 
00035 // Function to concatenate two binary numbers bitwise
00036 inline unsigned int ConcatBin(unsigned int bina, unsigned int binb);
00037 
00038 // routine triggered by each beat
00039 inline void Sync(int active_channel, bool gatesoff);
00040 
00041 /* 3 functions to read each encoder   
00042    returns +1, 0 or -1 dependent on direction 
00043    Contains no internal debounce, so calls should be delayed 
00044  */
00045 
00046 // Check Euclidean Seq N(length) Value
00047 inline int EncodeReadN(int ch);
00048 inline int EncodeReadK(int ch);
00049 inline int EncodeReadO(int ch);
00050 
00051 #endif