Skip to content

Commit

Permalink
Merge pull request #53 from melexis/remove_bits_per_long
Browse files Browse the repository at this point in the history
Remove BITS_PER_LONG reference
  • Loading branch information
Letme authored Nov 7, 2024
2 parents 7d5272f + db7c1c7 commit 9a73108
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 40 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/c-cpp-coveralls.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
sudo apt update
sudo apt-get install -y gcc-${{ matrix.gcc_version }} ruby rake gcc-multilib lcov wget
pip install gcovr==5.0
wget https://github.com/ThrowTheSwitch/Ceedling/releases/download/0.32.0-772f5f4/ceedling-0.32.0-772f5f4.gem -O ceedling.gem
wget https://github.com/ThrowTheSwitch/Ceedling/releases/download/1.0.0-60c24c2/ceedling-1.0.0-60c24c2.gem -O ceedling.gem
sudo gem install ceedling.gem
sudo gem install coveralls-lcov
sudo ln -fs /usr/bin/gcov-${{ matrix.gcc_version }} /usr/bin/gcov
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
gcc_version: ['10','11','12']
gcc_version: ['11','12','13']
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v3
Expand All @@ -25,7 +25,7 @@ jobs:
sudo apt update
sudo apt-get install -y gcc-${{ matrix.gcc_version }} ruby rake gcc-multilib lcov wget
pip install --user gcovr==3.3
wget https://github.com/ThrowTheSwitch/Ceedling/releases/download/0.32.0-772f5f4/ceedling-0.32.0-772f5f4.gem -O ceedling.gem
wget https://github.com/ThrowTheSwitch/Ceedling/releases/download/1.0.0-60c24c2/ceedling-1.0.0-60c24c2.gem -O ceedling.gem
sudo gem install ceedling.gem
- name: Unit tests
run: make utest CC=gcc
Expand All @@ -46,7 +46,7 @@ jobs:
run: |
sudo apt-get install -y clang-${{ matrix.clang_version }} ruby rake gcc-multilib lcov wget
pip install --user gcovr==3.3
wget https://github.com/ThrowTheSwitch/Ceedling/releases/download/0.32.0-772f5f4/ceedling-0.32.0-772f5f4.gem -O ceedling.gem
wget https://github.com/ThrowTheSwitch/Ceedling/releases/download/1.0.0-60c24c2/ceedling-1.0.0-60c24c2.gem -O ceedling.gem
sudo gem install ceedling.gem
sudo ln -fs /usr/bin/clang-${{ matrix.clang_version }} /usr/bin/clang
sudo ln -fs /usr/bin/llvm-cov-${{ matrix.clang_version }} /usr/bin/llvm-cov
Expand Down
40 changes: 12 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ in library `inc/` folder and you need to point your compiler `-I` flag there.
After you have your environment set you need to enter below flow to your program.

```C
/* Before include, make sure you have BITS_PER_LONG defined. This is a CPU
* specific value which is used to generate bit masks. You can also use -D
* to input definition to compiler via command line
*/
#include "mlx90632.h"

/* Declare and implement here functions you find in mlx90632_depends.h */
Expand Down Expand Up @@ -90,10 +86,6 @@ in library `inc/` folder and you need to point your compiler `-I` flag there.
After you have your environment set you need to enter below flow to your program.
```C
/* Before include, make sure you have BITS_PER_LONG defined. This is a CPU
* specific value which is used to generate bit masks. You can also use -D
* to input definition to compiler via command line
*/
#include "mlx90632.h"
/* Declare and implement here functions you find in mlx90632_depends.h */
Expand All @@ -109,14 +101,14 @@ int main(void)
double object; /**< Object temperature in degrees Celsius */
/* Read sensor EEPROM registers needed for calcualtions */
/* You can check if the device supports extended measurement mode */
ret = mlx90632_init();
if(status == ERANGE)
{
/* Extended mode is supported */
}
/* Set MLX90632 in extended mode */
ret = mlx90632_set_meas_type(MLX90632_MTYP_EXTENDED)
if(ret < 0)
Expand All @@ -131,15 +123,15 @@ int main(void)
/* Now start calculations (no more i2c accesses) */
/* Calculate ambient temperature */
ambient = mlx90632_calc_temp_ambient_extended(ambient_new_raw, ambient_old_raw,
ambient = mlx90632_calc_temp_ambient_extended(ambient_new_raw, ambient_old_raw,
PT, PR, PG, PO, Gb);
/* Get preprocessed temperatures needed for object temperature calculation */
double pre_ambient = mlx90632_preprocess_temp_ambient_extended(ambient_new_raw,
ambient_old_raw, Gb);
double pre_object = mlx90632_preprocess_temp_object_extended(object_new_raw, ambient_new_raw,
ambient_old_raw, Ka);
/* Calculate object temperature assuming the reflected temperature equals ambient*/
object = mlx90632_calc_temp_object_extended(pre_object, pre_ambient, ambient, Ea, Eb, Ga, Fa, Fb, Ha, Hb);
}
Expand All @@ -152,10 +144,6 @@ in library `inc/` folder and you need to point your compiler `-I` flag there.
After you have your environment set you need to enter below flow to your program.

```C
/* Before include, make sure you have BITS_PER_LONG defined. This is a CPU
* specific value which is used to generate bit masks. You can also use -D
* to input definition to compiler via command line
*/
#include "mlx90632.h"

/* Declare and implement here functions you find in mlx90632_depends.h */
Expand All @@ -171,7 +159,7 @@ int main(void)
double object; /**< Object temperature in degrees Celsius */

/* Read sensor EEPROM registers needed for calcualtions */

/* Set MLX90632 in burst mode */
ret = mlx90632_set_meas_type(MLX90632_MTYP_MEDICAL_BURST)
if(ret < 0)
Expand Down Expand Up @@ -208,10 +196,6 @@ in library `inc/` folder and you need to point your compiler `-I` flag there.
After you have your environment set you need to enter below flow to your program.
```C
/* Before include, make sure you have BITS_PER_LONG defined. This is a CPU
* specific value which is used to generate bit masks. You can also use -D
* to input definition to compiler via command line
*/
#include "mlx90632.h"
/* Declare and implement here functions you find in mlx90632_depends.h */
Expand All @@ -227,14 +211,14 @@ int main(void)
double object; /**< Object temperature in degrees Celsius */
/* Read sensor EEPROM registers needed for calcualtions */
/* You can check if the device supports extended measurement mode */
ret = mlx90632_init();
if(status == ERANGE)
{
/* Extended mode is supported */
}
/* Set MLX90632 in extended burst mode */
ret = mlx90632_set_meas_type(MLX90632_MTYP_EXTENDED_BURST)
if(ret < 0)
Expand All @@ -249,15 +233,15 @@ int main(void)
/* Now start calculations (no more i2c accesses) */
/* Calculate ambient temperature */
ambient = mlx90632_calc_temp_ambient_extended(ambient_new_raw, ambient_old_raw,
ambient = mlx90632_calc_temp_ambient_extended(ambient_new_raw, ambient_old_raw,
PT, PR, PG, PO, Gb);
/* Get preprocessed temperatures needed for object temperature calculation */
double pre_ambient = mlx90632_preprocess_temp_ambient_extended(ambient_new_raw,
ambient_old_raw, Gb);
double pre_object = mlx90632_preprocess_temp_object_extended(object_new_raw, ambient_new_raw,
ambient_old_raw, Ka);
/* Calculate object temperature assuming the reflected temperature equals ambient*/
object = mlx90632_calc_temp_object_extended(pre_object, pre_ambient, ambient, Ea, Eb, Ga, Fa, Fb, Ha, Hb);
}
Expand All @@ -272,6 +256,6 @@ faster development with automatic mocking ([CMock](http://www.throwtheswitch.org
and wider range of unit test macros ([Unity](http://www.throwtheswitch.org/unity/)).
Because of it, cloning repository requires adding a `--recursive` flag
(so `git clone --recursive <url> <destination>`) or initialization of submodules
afterwards using `git submodule update --init --recursive`.
afterwards using `git submodule update --init --recursive`.


4 changes: 0 additions & 4 deletions doxygen/main.dox
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@
* After you have your environment set you need to enter below flow to your program.
*
* \code{.c}
* /* Before include, make sure you have BITS_PER_LONG defined. This is a CPU
* * specific value which is used to generate bit masks. You can also use -D
* * to input definition to compiler via command line
* */
* #include "mlx90632.h"
*
* /* Declare and implement here functions you find in mlx90632_depends.h */
Expand Down
4 changes: 0 additions & 4 deletions inc/mlx90632.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@
#define BIT(x)(1U << (x))
#endif
#ifndef GENMASK
#ifndef BITS_PER_LONG
#warning "Using default BITS_PER_LONG value"
#define BITS_PER_LONG 64 /**< Define how many bits per long your CPU has */
#endif
#define GENMASK(h, l) \
((((1U << h) - 1) | (1U << h)) & ~((1U << l) - 1))
#endif
Expand Down

0 comments on commit 9a73108

Please sign in to comment.