OSCtoCV Library
Diff: OSCtoCV_Euclidean.h
- Revision:
- 0:cd43a974c54c
- Child:
- 1:981b62bb5c87
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OSCtoCV_Euclidean.h Sun Jan 17 09:30:32 2016 +0000 @@ -0,0 +1,51 @@ +/* + 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