Git Product home page Git Product logo

lmt01-driver's Introduction

LMT01 Temperature Sensor API

A simple driver for the Texas Instrument's LMT01 temperature sensor.

Introduction

This package contains the LMT01 sensor driver. The driver includes lmt01.c and lmt01.h files.

Integration details

  • Integrate lmt01.h and lmt01.c files into the project
  • Include the lmt01.h file in your code like below.
#include "lmt_01.h"

File information

  • lmt01.h : This header file contains the declarations of the driver APIs.
  • lmt01.c : This source file contains the definitions of the driver APIs.

Supported interfaces

  • Timer (with clock sourced mapped to GPIO)

User Guide

Prerequisite

  • The LMT01 has a unique interface. A series of pulses outputted by the device are used to represent the temperature value. This number of pulses varies with the temperature value.
  • This driver requires a timer to be preconfigured with the ability to increment it's counter with every pulse received over GPIO.

Initialising the device

To intialise the device, the user must create a device structure. The user can do this by creating an instance of the structure lmt01_dev. The user must then fill in the various parameters as shown below.

lmt01_status_t rslt = LMT_OK;
lmt01_dev lmt;

lmt.timer = <timer context>;
lmt.start_timer = usr_start_timer;
lmt.stop_timer = usr_stop_timer;
lmt.set_timer_cnt = usr_set_timer_cnt;
lmt.get_timer_cnt = usr_get_timer_cnt;
lmt.delay_ms = usr_delay_ms;

rslt = lmt_init(&lmt);

float temp = -1;

/* Obtain reading from LMT sensor */
rslt = lmt_get_temperature(&lmt, &temp, CONV_TYPE_LUT);

Templates for function pointers

void usr_start_timer(void *timer)
{
}

void usr_stop_timer(void *timer)
{
}

void usr_set_timer_cnt(void *timer, uint32_t *val)
{
}

void usr_get_timer_cnt(void *timer, uint32_t *val)
{
}

void usr_delay_ms(uint32_t period_ms)
{
}

lmt01-driver's People

Contributors

farly7 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

jabastien

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.