Mercurial > hg > beaglert
comparison core/I2c_Codec.cpp @ 182:4c5acd649d46
Fixed I2c_Codec
| author | Giulio Moro <giuliomoro@yahoo.it> |
|---|---|
| date | Fri, 15 Jan 2016 23:46:25 +0000 |
| parents | 5f4408705eed |
| children | 869f5e703844 |
comparison
equal
deleted
inserted
replaced
| 181:391ad036557d | 182:4c5acd649d46 |
|---|---|
| 243 float k=j+d/10000.0f; | 243 float k=j+d/10000.0f; |
| 244 return k; | 244 return k; |
| 245 } | 245 } |
| 246 | 246 |
| 247 float I2c_Codec::getAudioSamplingRate(){ | 247 float I2c_Codec::getAudioSamplingRate(){ |
| 248 int pllP=1; //TODO: create get/set for pllP and pllR | |
| 249 int pllR=1; | |
| 250 long int PLLCLK_IN=12000000; | 248 long int PLLCLK_IN=12000000; |
| 251 // f_{S(ref)} = (PLLCLK_IN × K × R)/(2048 × P) | 249 // f_{S(ref)} = (PLLCLK_IN × K × R)/(2048 × P) |
| 252 float fs = (PLLCLK_IN/2048.0f) * getPllK()*pllR/(float)pllP; | 250 float fs = (PLLCLK_IN/2048.0f) * getPllK()*getPllR()/(float)getPllP(); |
| 253 return fs; | 251 return fs; |
| 254 } | 252 } |
| 255 | 253 |
| 256 int I2c_Codec::setPga(float newGain, unsigned short int channel){ | 254 int I2c_Codec::setPga(float newGain, unsigned short int channel){ |
| 257 unsigned short int reg; | 255 unsigned short int reg; |
