From c8fd6991786ccddb44547b619178bb391f3f9b96 Mon Sep 17 00:00:00 2001 From: siddhu8990 Date: Thu, 18 Aug 2016 15:47:18 +0530 Subject: RPi-PWM and basic imaage processing --- src/c/elementaryFunctions/bitset/u16bitsets.c | 4 ++-- src/c/elementaryFunctions/bitset/u8bitsets.c | 4 ++-- src/c/elementaryFunctions/includes/fix.h | 3 +++ src/c/elementaryFunctions/linspace/dlinspacea.c | 6 +++--- src/c/elementaryFunctions/linspace/dlinspaces.c | 4 ++-- src/c/elementaryFunctions/logspace/dlogspacea.c | 6 +++--- src/c/elementaryFunctions/logspace/dlogspaces.c | 4 ++-- 7 files changed, 17 insertions(+), 14 deletions(-) (limited to 'src/c/elementaryFunctions') diff --git a/src/c/elementaryFunctions/bitset/u16bitsets.c b/src/c/elementaryFunctions/bitset/u16bitsets.c index 953e46c..ff72be3 100644 --- a/src/c/elementaryFunctions/bitset/u16bitsets.c +++ b/src/c/elementaryFunctions/bitset/u16bitsets.c @@ -7,12 +7,12 @@ uint16 u16bitsets(uint16 value,int position,int bit_value) { if(bit_value==1) { - unsigned char mask1 = 1 << (position-1) ; // we could cast to unsigned char, just to be safe + unsigned char mask1 = 1 << (position-1) ; /* we could cast to unsigned char, just to be safe */ return (mask1 | value); } else { - unsigned char mask2 = ~(1 << (position-1)); // we could cast to unsigned char, just to be safe + unsigned char mask2 = ~(1 << (position-1)); /*we could cast to unsigned char, just to be safe*/ return (mask2 & value); } diff --git a/src/c/elementaryFunctions/bitset/u8bitsets.c b/src/c/elementaryFunctions/bitset/u8bitsets.c index 5f44dcd..b97a157 100644 --- a/src/c/elementaryFunctions/bitset/u8bitsets.c +++ b/src/c/elementaryFunctions/bitset/u8bitsets.c @@ -7,12 +7,12 @@ uint8 u8bitsets(uint8 value,int position,int bit_value) { if(bit_value==1) { - unsigned char mask1 = 1 << (position-1) ; // we could cast to unsigned char, just to be safe + unsigned char mask1 = 1 << (position-1) ; /* we could cast to unsigned char, just to be safe */ return (mask1 | value); } else { - unsigned char mask2 = ~(1 << (position-1)); // we could cast to unsigned char, just to be safe + unsigned char mask2 = ~(1 << (position-1)); /* we could cast to unsigned char, just to be safe */ return (mask2 & value); } diff --git a/src/c/elementaryFunctions/includes/fix.h b/src/c/elementaryFunctions/includes/fix.h index d3e7f88..592905b 100644 --- a/src/c/elementaryFunctions/includes/fix.h +++ b/src/c/elementaryFunctions/includes/fix.h @@ -17,6 +17,9 @@ #include "floatComplex.h" #include "doubleComplex.h" #include "types.h" +#include "floor.h" +#include "ceil.h" + #ifdef __cplusplus extern "C" { diff --git a/src/c/elementaryFunctions/linspace/dlinspacea.c b/src/c/elementaryFunctions/linspace/dlinspacea.c index f67968d..d2ca698 100644 --- a/src/c/elementaryFunctions/linspace/dlinspacea.c +++ b/src/c/elementaryFunctions/linspace/dlinspacea.c @@ -7,7 +7,7 @@ void dlinspacea(double *low_limit,int _row,double *up_limit,double range_num,dou { int i,j,k; double temp; - float step_iterate[_row]; // for each row the spacing between two values is different. + float step_iterate[_row]; /* for each row the spacing between two values is different.*/ for(i=0;i<_row;i++) { @@ -16,7 +16,7 @@ void dlinspacea(double *low_limit,int _row,double *up_limit,double range_num,dou } for(j=0;j < _row;j++) { - out[j] = low_limit[j]; // For every row first element is the first value of low_limit array + out[j] = low_limit[j]; /* For every row first element is the first value of low_limit array*/ temp = low_limit[j]; for(k=1;k < (double)range_num;k++ ) { @@ -24,7 +24,7 @@ void dlinspacea(double *low_limit,int _row,double *up_limit,double range_num,dou temp = out[(_row*k)+j]; if(k == (double)range_num-1 ) { - out[(_row*k)+j] = (double)up_limit[j]; // Last value of output is equal to first value of up_limit array + out[(_row*k)+j] = (double)up_limit[j]; /* Last value of output is equal to first value of up_limit array*/ } } diff --git a/src/c/elementaryFunctions/linspace/dlinspaces.c b/src/c/elementaryFunctions/linspace/dlinspaces.c index 82b88e3..daeb825 100644 --- a/src/c/elementaryFunctions/linspace/dlinspaces.c +++ b/src/c/elementaryFunctions/linspace/dlinspaces.c @@ -8,14 +8,14 @@ void dlinspaces(double low_limit,double up_limit,double range_num,double *out) int j; double temp = low_limit; float step_iterate = (up_limit-low_limit)/(range_num-1); - out[0] = low_limit; //First value of output is equal to low_limit value + out[0] = low_limit; /*First value of output is equal to low_limit value*/ for(j=1; j<(double)range_num; j++) { out[j] = temp + step_iterate; temp = out[j]; if(j == (double)range_num-1 ) { - out[j] = (double)up_limit; // Last value of output is equal to up_limit value + out[j] = (double)up_limit; /* Last value of output is equal to up_limit value*/ } } diff --git a/src/c/elementaryFunctions/logspace/dlogspacea.c b/src/c/elementaryFunctions/logspace/dlogspacea.c index f8b283c..9ea551b 100644 --- a/src/c/elementaryFunctions/logspace/dlogspacea.c +++ b/src/c/elementaryFunctions/logspace/dlogspacea.c @@ -8,7 +8,7 @@ void dlogspacea(double *low_limit,int _row,double *up_limit,double range_num,dou { int i,j,k; double temp; - double step_iterate[_row]; // for each row the spacing between two values is different. + double step_iterate[_row]; /* for each row the spacing between two values is different.*/ for(i=0;i<_row;i++) { step_iterate[i] = pow(10,((up_limit[i]-low_limit[i])/(range_num-1))); @@ -17,7 +17,7 @@ void dlogspacea(double *low_limit,int _row,double *up_limit,double range_num,dou } for(j=0;j < _row;j++) { - out[j] = pow(10,low_limit[j]); // For every row first element is equal to 10 raise to the first value of low_limit array + out[j] = pow(10,low_limit[j]); /* For every row first element is equal to 10 raise to the first value of low_limit array*/ temp = out[j]; for(k=1;k < (double)range_num;k++ ) { @@ -25,7 +25,7 @@ void dlogspacea(double *low_limit,int _row,double *up_limit,double range_num,dou temp = out[(_row*k)+j]; if(k == (double)range_num-1 ) { - out[(_row*k)+j] = pow(10,((double)up_limit[j])); // For every row Last value of output is equal to 10 raise to first value of up_limit array + out[(_row*k)+j] = pow(10,((double)up_limit[j])); /* For every row Last value of output is equal to 10 raise to first value of up_limit array*/ } } diff --git a/src/c/elementaryFunctions/logspace/dlogspaces.c b/src/c/elementaryFunctions/logspace/dlogspaces.c index 7970321..851713b 100644 --- a/src/c/elementaryFunctions/logspace/dlogspaces.c +++ b/src/c/elementaryFunctions/logspace/dlogspaces.c @@ -9,14 +9,14 @@ void dlogspaces(double low_limit,double up_limit,double range_num,double *out) int j; double temp = pow(10,low_limit); double step_iterate = pow(10,((up_limit-low_limit)/(range_num-1))); - out[0] = pow(10,low_limit); //First value of output is equal to low_limit value + out[0] = pow(10,low_limit); /*First value of output is equal to low_limit value*/ for(j=1; j<(double)range_num; j++) { out[j] = temp*step_iterate; temp = out[j]; if(j == (double)range_num-1 ) { - out[j] = pow(10,((double)up_limit)); // Last value of output is equal to up_limit value + out[j] = pow(10,((double)up_limit)); /* Last value of output is equal to up_limit value*/ } } -- cgit