0.1.2 LTC2991

This commit is contained in:
rob tillaart 2021-12-20 20:24:00 +01:00
parent 121f872926
commit ef444f9cf5
11 changed files with 92 additions and 68 deletions

View File

@ -2,6 +2,10 @@ compile:
# Choosing to run compilation tests on 2 different Arduino platforms
platforms:
- uno
- leonardo
- due
- zero
# - due
# - zero
# - leonardo
- m4
- esp32
# - esp8266
# - mega2560

View File

@ -4,10 +4,14 @@ name: Arduino CI
on: [push, pull_request]
jobs:
arduino_ci:
runTest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: Arduino-CI/action@master
# Arduino-CI/action@v0.1.1
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6
- run: |
gem install arduino_ci
arduino_ci.rb

View File

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2021-2021 Rob Tillaart
Copyright (c) 2021-2022 Rob Tillaart
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -1,7 +1,7 @@
//
// FILE: LTC2991.cpp
// AUTHOR: Rob Tillaart
// VERSION: 0.1.1
// VERSION: 0.1.2
// DATE: 2021-05-10
// PURPOSE: Library for LTC2991 temperature and voltage control IC
// URL: https://github.com/RobTillaart/LTC2991
@ -9,7 +9,8 @@
// HISTORY:
// 0.1.0 2021-05-10 initial version
// 0.1.1 2021-05-16 add trigger_conversion(), set_PWM_fast()
// performance optimizations, some default values, and cleanup.
// performance optimizations, some default values, and clean up.
// 0.1.2 update library.json, license, minor edits
#include "LTC2991.h"

View File

@ -2,7 +2,7 @@
//
// FILE: LTC2991.h
// AUTHOR: Rob Tillaart
// VERSION: 0.1.1
// VERSION: 0.1.2
// DATE: 2021-05-10
// PURPOSE: Library for LTC2991 temperature and voltage control IC
// URL: https://github.com/RobTillaart/LTC2991
@ -11,7 +11,7 @@
#include "Arduino.h"
#include "Wire.h"
#define LTC2991_LIB_VERSION (F("0.1.1"))
#define LTC2991_LIB_VERSION (F("0.1.2"))
class LTC2991
@ -114,4 +114,6 @@ private:
};
// -- END OF FILE --

View File

@ -1,21 +1,27 @@
[![Arduino CI](https://github.com/RobTillaart/LTC2991/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci)
[![Arduino-lint](https://github.com/RobTillaart/LTC2991/actions/workflows/arduino-lint.yml/badge.svg)](https://github.com/RobTillaart/LTC2991/actions/workflows/arduino-lint.yml)
[![JSON check](https://github.com/RobTillaart/LTC2991/actions/workflows/jsoncheck.yml/badge.svg)](https://github.com/RobTillaart/LTC2991/actions/workflows/jsoncheck.yml)
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/RobTillaart/LTC2991/blob/master/LICENSE)
[![GitHub release](https://img.shields.io/github/release/RobTillaart/LTC2991.svg?maxAge=3600)](https://github.com/RobTillaart/LTC2991/releases)
# LTC2991
Arduino library for an LTC2991 temperature and voltage control IC
Arduino library for an LTC2991 temperature and voltage control IC.
## Description
Experimental - not tested myself, (no hardware)
LTC2991 is an experimental library for the LTC2991 IC which is typically used to monitor temperature and voltage. It also has a PWM out to control e.g. a fan.
LTC2991 is an experimental library for the LTC2991 IC which is typically used
to monitor temperature and voltage. It also has a PWM out to control e.g. a fan.
The IC supports normal voltage measurement (8 lines), differential voltage measurements (4 pairs) and temperature measurements (4 pairs). These can be combined in a mix. As the IC has only 8 inputs available one has to choose what.
The IC supports normal voltage measurement (8 lines), differential voltage
measurements (4 pairs) and temperature measurements (4 pairs).
These can be combined in a mix.
As the IC has only 8 inputs available one has to choose what.
Read the datasheet for the details.
@ -25,8 +31,8 @@ Read the datasheet for the details.
### Constructor and setup
- **LTC2991(const int8_t address, TwoWire \*wire = Wire);**
- **bool begin(const uint8_t sda, const uint8_t scl)** for ESP32 and ESP8266; initializes the class.
- **LTC2991(const uint8_t address, TwoWire \*wire = Wire)**
- **bool begin(const uint8_t sda, const uint8_t scl)** for ESP32 and ESP8266; initializes the class.
sets I2C pins.
returns true if the LTC2991 address is on the I2C bus.
- **bool begin()** UNO ea. initializes the class.
@ -37,9 +43,9 @@ returns true if the LTC2991 address is on the I2C bus.
### Status functions
- **bool new_data(uint8_t channel)** true if there is a new **external** measurement (temperature or voltage) available.
- **new_temperature()** true if there is a new **internal** temperature measurement available.
- **new_voltage()** true, if ther is a new **internal** voltage measurement available.
- **is_busy()** true if converting...
- **bool new_temperature()** true if there is a new **internal** temperature measurement available.
- **bool new_voltage()** true, if there is a new **internal** voltage measurement available.
- **bool is_busy()** true if converting...
### External measurements
@ -55,21 +61,22 @@ The following functions work on pairs
- **void trigger_conversion(uint8_t n)** wrapper around enable(n, true), better naming.
- **void trigger_conversion_all()** triggers conversions for all 4 channels/pairs.
- **void enable(uint8_t n, bool enable)** enable or disable an external line. disable can be used to stop the repeat mode.
- **void enable(uint8_t n, bool enable)** enable or disable an external line.
disable can be used to stop the repeat mode.
- **bool is_enabled(uint8_t n)** idem
- **void enable_filter(uint8_t n, bool enable)** enable filter - not investigated.
- **bool is_enabled_filter(uint8_t n)** idem
- **bool is_enabled_filter(uint8_t n)** idem.
- **void set_Kelvin(uint8_t n)** sets temperature mode to Kelvin,
implicit set_mode_temperature(),
implicit set_mode_temperature().
- **void set_Celsius(uint8_t n)** sets temperature mode to Celsius,
implicit set_mode_temperature
implicit set_mode_temperature.
- **void set_temp_scale(uint8_t n, bool Kelvin = true)** used to switch between Kelvin and Celsius.
- **char get_temp_scale(uint8_t n)** returns 'K' or 'C'
- **void set_mode_temperature(uint8_t n)** sets operational mode
- **void set_mode_voltage_differential(uint8_t n)** sets operational mode
- **void set_mode_voltage_normal(uint8_t n)** sets operational mode
- **uint8_t get_operational_mode(uint8_t n)** returns operational mode
- **uint8_t get_differential_mode(uint8_t n)** returns differential flag
- **char get_temp_scale(uint8_t n)** returns 'K' or 'C'.
- **void set_mode_temperature(uint8_t n)** sets operational mode.
- **void set_mode_voltage_differential(uint8_t n)** sets operational mode.
- **void set_mode_voltage_normal(uint8_t n)** sets operational mode.
- **uint8_t get_operational_mode(uint8_t n)** returns operational mode.
- **uint8_t get_differential_mode(uint8_t n)** returns differential flag.
- **float get_value(uint8_t channel)** channel = 1..8;
depending on the operational mode it returns the temperature or the
(differential) voltage.
@ -77,21 +84,23 @@ depending on the operational mode it returns the temperature or the
### Internal measurements
- **void enable_Tintern_Vcc(bool enable)** enable internal temperature measurements
- **bool is_enabled_Tintern_Vcc()** idem
- **void enable_Tintern_Vcc(bool enable)** enable internal temperature measurements.
- **bool is_enabled_Tintern_Vcc()** idem.
- **void enable_filter_Tintern(bool enable)** enable filter - not investigated
- **bool is_enabled_filter_Tintern()**
- **void set_Kelvin_Tintern()** use Kelvin
- **void set_Celsius_Tintern()** use Celsius
- **void set_temp_scale_Tintern(bool Kelvin = true)** Obsolete?
- **char get_temp_scale_Tintern()** returns 'K' or 'C'
- **float get_Tintern()** returns internal temperature
- **void set_Kelvin_Tintern()** use Kelvin.
- **void set_Celsius_Tintern()** use Celsius.
- **void set_temp_scale_Tintern(bool Kelvin = true)** Obsolete?.
- **char get_temp_scale_Tintern()** returns 'K' or 'C'.
- **float get_Tintern()** returns internal temperature.
- **float get_VCC()** returns the internal voltage.
### Configuration
- **void set_acquisition_repeat()** set continuous measurement mode
- **void set_acquisition_single()** set single shot mode. Note that before a measurement one needs to call trigger_conversion();
- **void set_acquisition_repeat()** set continuous measurement mode.
- **void set_acquisition_single()** set single shot mode.
Note that before a measurement one needs to call trigger_conversion();
- **uint8_t get_acquisition_mode()** return mode set (0,1)
@ -100,10 +109,10 @@ depending on the operational mode it returns the temperature or the
- **void set_PWM(uint16_t value = 0)** value is 0..511
- **void set_PWM(uint16_t value = 0)** value is 0..511, less resolution (256 steps)
- **uint16_t get_PWM()** returns the value from the PWM register, when using PWM_fast this can differ 1.
- **void invert_PWM(bool invert)** idem
- **bool is_inverted_PWM()** idem
- **void enable_PWM(bool enable)** idem
- **bool is_enabled_PWM()** idem
- **void invert_PWM(bool invert)** idem.
- **bool is_inverted_PWM()** idem.
- **void enable_PWM(bool enable)** idem.
- **bool is_enabled_PWM()** idem.
### Performance
@ -117,17 +126,19 @@ To be measured when hardware is available...
See examples..
### TODO
### Future
#### must
- get hardware to
- test test test
- update documentation
#### could
- cache registers (which) or
- cache a number of flags to speed up retrieving data
- optimize multibyte read / write
- optimize multi-byte read / write
- add Fahrenheit
- do low level in Kelvin and convert to KFC as needed.
- would simplify get_value

View File

@ -34,3 +34,4 @@ void loop()
// -- END OF FILE --

View File

@ -1,6 +1,6 @@
# Syntax Coloring Map For LTC2991
# Syntax Colouring Map For LTC2991
# Datatypes (KEYWORD1)
# Data types (KEYWORD1)
LTC2991 KEYWORD1
# Methods and Functions (KEYWORD2)

View File

@ -1,6 +1,6 @@
{
"name": "LTC2991",
"keywords": "voltage temperature differential PWM",
"keywords": "voltage,temperature,differential,PWM",
"description": "Arduino library for a LTC2991",
"authors":
[
@ -15,8 +15,9 @@
"type": "git",
"url": "https://github.com/RobTillaart/LTC2991.git"
},
"version": "0.1.1",
"version": "0.1.2",
"license": "MIT",
"frameworks": "arduino",
"platforms": "*"
"platforms": "*",
"headers": "LTC2991.h"
}

View File

@ -1,5 +1,5 @@
name=LTC2991
version=0.1.1
version=0.1.2
author=Rob Tillaart <rob.tillaart@gmail.com>
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
sentence=Arduino library for LTC2991

View File

@ -38,8 +38,10 @@
unittest_setup()
{
fprintf(stderr, "LTC2991_LIB_VERSION: %s\n", (char *) LTC2991_LIB_VERSION);
}
unittest_teardown()
{
}
@ -47,8 +49,6 @@ unittest_teardown()
unittest(test_constructor)
{
fprintf(stderr, "VERSION: %s\n", LTC2991_LIB_VERSION);
LTC2991(0x20);
fprintf(stderr, "no tests yet");