Initial commit
This commit is contained in:
commit
66c5a26d69
1145 changed files with 938088 additions and 0 deletions
|
@ -0,0 +1,260 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head>
|
||||
<script><endnote><head>
|
||||
<script><endnote><head>
|
||||
<script><endnote><head>
|
||||
<script><endnote><head>
|
||||
<script><endnote><head>
|
||||
<script></script>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<link rel="File-List" href="Release_Notes_files/filelist.xml">
|
||||
<link rel="Edit-Time-Data" href="Release_Notes_files/editdata.mso"><title>Release Notes for STLM75 Component Drivers</title>
|
||||
|
||||
<style>
|
||||
div.Section1 {
|
||||
page: Section1;
|
||||
font-family: Arial,Helvetica,sans-serif;
|
||||
}
|
||||
h1 {
|
||||
font-size: 24pt;
|
||||
font-weight: bold;
|
||||
font-family: Arial,Helvetica,sans-serif;
|
||||
text-align: center;
|
||||
color: #3366ff;
|
||||
}
|
||||
h2 {
|
||||
margin: 12pt 0in 3pt;
|
||||
page-break-after: avoid;elease Notes for RK043FN48H-CT672B LCD Component Driver
|
||||
font-weight: bold;
|
||||
font-family: Arial,Helvetica,sans-serif;
|
||||
background-color: #3366ff;
|
||||
color: white;
|
||||
padding-left: 5px;
|
||||
font-size: 16pt;
|
||||
}
|
||||
h3 {
|
||||
margin-left: 0in;
|
||||
font-weight: bold;
|
||||
font-family: Arial,Helvetica,sans-serif;
|
||||
background-color: #3366ff;
|
||||
width: 200px;
|
||||
margin-right: 500pt;
|
||||
color: white;
|
||||
padding-left: 5px;
|
||||
padding-top: 2px;
|
||||
padding-bottom: 2px;
|
||||
font-size: 12pt;
|
||||
}
|
||||
h4 {
|
||||
font-family: Arial,Helvetica,sans-serif;
|
||||
font-weight: bold;
|
||||
text-decoration: underline;
|
||||
font-size: 12pt;
|
||||
}
|
||||
p {
|
||||
margin: 0px 0px 0px 0in;
|
||||
font-family: Arial,Helvetica,sans-serif;
|
||||
padding-top: 3px;
|
||||
padding-bottom: 3px;
|
||||
font-size: 12pt;
|
||||
}
|
||||
ul {
|
||||
font-family: Arial,Helvetica,sans-serif;
|
||||
margin-top: 3px;
|
||||
margin-bottom: 3px;
|
||||
font-size: 10pt;
|
||||
}
|
||||
caption {
|
||||
margin-top: 10px;
|
||||
font-family: Arial,Helvetica,sans-serif;
|
||||
font-size: 11pt;
|
||||
}
|
||||
hr {
|
||||
width: 100%;
|
||||
}
|
||||
.guidance {
|
||||
background-color: #e5b8b7;
|
||||
font-style: italic;
|
||||
font-family: Arial,Helvetica,sans-serif;
|
||||
padding-top: 3px;
|
||||
padding-bottom: 3px;
|
||||
margin-top: 3px;
|
||||
margin-bottom: 3px;
|
||||
font-size: 10pt;
|
||||
}
|
||||
.guidance_title {
|
||||
font-style: normal;
|
||||
font-weight: bold;
|
||||
text-decoration: underline;
|
||||
font-family: Arial,Helvetica,sans-serif;
|
||||
font-size: 10pt;
|
||||
}
|
||||
.tickets {
|
||||
border: 1pt solid #9cc2e5;
|
||||
font-family: Arial,Helvetica,sans-serif;
|
||||
margin-bottom: 3px;
|
||||
margin-top: 3px;
|
||||
font-size: 10pt;
|
||||
}
|
||||
.tickets th {
|
||||
border: 1pt solid #9cc2e5;
|
||||
font-size: 12pt;
|
||||
background-color: #39a9dc;
|
||||
color: white;
|
||||
text-align: center;
|
||||
}
|
||||
.tickets td {
|
||||
border: 1pt solid #9cc2e5;
|
||||
min-height: 32px;
|
||||
}
|
||||
tr:nth-child(even) {background-color: #cee2f2;}
|
||||
tr:nth-child(even) {background-color: #e8f1f9;}
|
||||
.topic1 {
|
||||
margin-top: 3px;
|
||||
margin-bottom: 3px;
|
||||
margin-left: 40px;
|
||||
}
|
||||
.topic2 {
|
||||
margin-top: 3px;
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
.topic3 {
|
||||
margin-top: 3px;
|
||||
margin-bottom: 3px;
|
||||
margin-left: 20px;
|
||||
}
|
||||
#purpose {
|
||||
margin-top: 3px;
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
#identification {
|
||||
margin-top: 3px;
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
</style><!--[if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]--><!--[if gte mso 9]><xml> <o:DocumentProperties> <o:Author>STMicroelectronics</o:Author> <o:LastAuthor>Raouf Hosni</o:LastAuthor> <o:Revision>69</o:Revision> <o:TotalTime>153</o:TotalTime> <o:Created>2009-02-27T19:26:00Z</o:Created> <o:LastSaved>2009-07-21T16:16:00Z</o:LastSaved> <o:Pages>1</o:Pages> <o:Words>410</o:Words> <o:Characters>2339</o:Characters> <o:Company>STMicroelectronics</o:Company> <o:Lines>19</o:Lines> <o:Paragraphs>5</o:Paragraphs> <o:CharactersWithSpaces>2744</o:CharactersWithSpaces> <o:Version>11.8132</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:Zoom>110</w:Zoom> <w:SpellingState>Clean</w:SpellingState> <w:GrammarState>Clean</w:GrammarState> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]--><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]--><!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="6146"/> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1"/> </o:shapelayout></xml><![endif]-->
|
||||
</head>
|
||||
<body link="blue" vlink="blue">
|
||||
<script type="text/javascript">
|
||||
var toggle_hist_disp = true;
|
||||
function toggle_history()
|
||||
{
|
||||
if (toggle_hist_disp)
|
||||
{
|
||||
toggle_hist_disp = false;
|
||||
var filter_off_text = document.createTextNode("Hide History");
|
||||
document.getElementById('filter_hist').innerHTML = "";
|
||||
document.getElementById('filter_hist').appendChild(filter_off_text);
|
||||
document.getElementById("history").hidden = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
toggle_hist_disp = true;
|
||||
var filter_on_text = document.createTextNode("Show History");
|
||||
document.getElementById('filter_hist').innerHTML = "";
|
||||
document.getElementById('filter_hist').appendChild(filter_on_text);
|
||||
document.getElementById("history").hidden = true;
|
||||
}
|
||||
}</script>
|
||||
<div style="width: 1034px;" class="Section1"><span style="font-size: 8pt; font-family: "Arial","sans-serif"; color: blue;"></span><small><a href="../../../../Release_Notes.html">Back to Release page</a></small>
|
||||
<div id="header">
|
||||
<h1 style="margin-bottom: 18pt; text-align: center;" align="center">Release
|
||||
Notes for <span style="font-size: 20pt; font-family: Verdana; color: rgb(51, 102, 255);">STLM75
|
||||
Component Drivers</span></h1>
|
||||
<p style="text-align: center;">Copyright 2014
|
||||
STMicroelectronics</p>
|
||||
<p style="text-align: center;"><span style="font-size: 10pt; font-family: "Arial","sans-serif"; color: black;"><img style="border: 0px solid ; width: 112px; height: 83px;" alt="" id="_x0000_i1026" src="../../../../_htmresc/st_logo.png"></span></p>
|
||||
</div>
|
||||
<div id="license" class="topic1">
|
||||
<h2>License</h2>
|
||||
This software component is licensed by ST under BSD 3-Clause
|
||||
license, the "License"; You may not use this component except in
|
||||
compliance with
|
||||
the License. You may obtain a copy of the License at:
|
||||
<p style="text-align: center;"><a href="https://opensource.org/licenses/BSD-3-Clause" target="_blank">https://opensource.org/licenses/BSD-3-Clause</a></p>
|
||||
</div>
|
||||
<br>
|
||||
<div id="release_container" class="topic1">
|
||||
<div class="topic2" id="identification">
|
||||
<h3 style="width: 220px;">V2.0.2 / 17-December-2018</h3>
|
||||
</div>
|
||||
<div class="topic3" id="changes">
|
||||
<p class="MsoNormal" style="margin-top: 4.5pt; margin-right: 0cm; margin-bottom: 4.5pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
|
||||
Changes<o:p></o:p></span></u></b></p>
|
||||
<ul style="margin-top: 0cm;" type="square">
|
||||
<li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Fix "Back to
|
||||
Release page" link</span></li>
|
||||
</ul>
|
||||
</div>
|
||||
<br>
|
||||
</div>
|
||||
<div style="margin-left: 40px;"><button id="filter_hist" onclick="toggle_history()">Show
|
||||
History</button><br>
|
||||
</div>
|
||||
<div id="history" class="topic1" hidden="">
|
||||
<h2>Update History</h2>
|
||||
<b><u><span style="font-size: 10pt; font-family: "Verdana","sans-serif"; color: black;"><br>
|
||||
</span></u></b>
|
||||
<h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 223px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V2.0.1
|
||||
/ 25-October-2018 <o:p></o:p></span></h3>
|
||||
<p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
|
||||
Changes<o:p></o:p></span></u></b></p>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<ul style="list-style-type: square;">
|
||||
<li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Fix
|
||||
compilation warning in STLM75_Init() with IAR V8.30.1</span></li>
|
||||
<li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Reformat
|
||||
the BSD 3-Clause license declaration in the files header (replace
|
||||
license terms by a web reference to OSI website where those terms lie)</span></li>
|
||||
</ul>
|
||||
<h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 223px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V2.0.0
|
||||
/ 11-September-2017 <o:p></o:p></span></h3>
|
||||
<p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
|
||||
Changes<o:p></o:p></span></u></b></p>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<ul style="list-style-type: square;">
|
||||
<li><span style="font-family: Verdana; font-size: 10pt;">Update
|
||||
STLM75_ReadTemp return float instead of uint16_t</span><span style="font-family: Verdana; font-size: 10pt;"></span></li>
|
||||
<li><span style="font-family: Verdana; font-size: 10pt;">Remove
|
||||
date & version from header</span></li>
|
||||
</ul>
|
||||
<h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 223px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.1
|
||||
/ 24-November-2014 <o:p></o:p></span></h3>
|
||||
<p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
|
||||
Changes<o:p></o:p></span></u></b></p>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<ul style="list-style-type: square;">
|
||||
<li><span style="font-family: Verdana; font-size: 10pt;">stlm75.h:
|
||||
change </span><span style="font-family: Verdana; font-size: 10pt;">"\"
|
||||
by </span><span style="font-family: Verdana; font-size: 10pt;">"/" in the
|
||||
include path to fix compilation issue under Linux</span></li>
|
||||
</ul>
|
||||
<h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.0
|
||||
/ 06-May-2014 <o:p></o:p></span></h3>
|
||||
<p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
|
||||
Changes<o:p></o:p></span></u></b></p>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<ul style="list-style-type: square;">
|
||||
<li><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;">First
|
||||
official release of STLM75 Temperature Sensor Component driver</span></li>
|
||||
</ul>
|
||||
<span style="font-size: 10pt; font-family: Verdana;"></span>
|
||||
<ul>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="product_doc" class="topic1">
|
||||
<hr>
|
||||
<p style="text-align: center;">For complete
|
||||
documentation on STM32 Microcontrollers<span style="font-size: 10pt; font-family: "Verdana","sans-serif"; color: black;"></span><span style="font-size: 10pt; font-family: "Verdana","sans-serif";"><span style="color: black;"></span></span>,
|
||||
visit: <a href="http://www.st.com/STM32" target="_blank">www.st.com/STM32</a></p>
|
||||
<br>
|
||||
</div>
|
||||
</div>
|
||||
</body></html>
|
180
USB-PD_Provider_1port/Drivers/BSP/Components/stlm75/stlm75.c
Normal file
180
USB-PD_Provider_1port/Drivers/BSP/Components/stlm75/stlm75.c
Normal file
|
@ -0,0 +1,180 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file stlm75.c
|
||||
* @author MCD Application Team
|
||||
* @brief This file provides a set of functions needed to manage the STLM75
|
||||
* Temperature Sensor.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2014 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under BSD 3-Clause license,
|
||||
* the "License"; You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at:
|
||||
* opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stlm75.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Components
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STLM75
|
||||
* @brief This file provides a set of functions needed to drive the
|
||||
* STLM75 Temperature Sensor.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STLM75_Private_TypesDefinitions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STLM75_Private_Defines
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STLM75_Private_Macros
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STLM75_Private_Variables
|
||||
* @{
|
||||
*/
|
||||
TSENSOR_DrvTypeDef Stlm75Drv =
|
||||
{
|
||||
STLM75_Init,
|
||||
STLM75_IsReady,
|
||||
STLM75_ReadStatus,
|
||||
STLM75_ReadTemp,
|
||||
};
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STLM75_Private_FunctionPrototypes
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STLM75_Private_Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Set STLM75 Initialization.
|
||||
* @param DeviceAddr : Device ID address.
|
||||
* @param pInitStruct: pointer to a STLM75_InitTypeDef structure
|
||||
* that contains the configuration setting for the STLM75.
|
||||
* @retval None
|
||||
*/
|
||||
void STLM75_Init(uint16_t DeviceAddr, TSENSOR_InitTypeDef *pInitStruct)
|
||||
{
|
||||
uint8_t confreg = 0;
|
||||
uint16_t tempreg = 0;
|
||||
|
||||
/* Set the Configuration Register */
|
||||
confreg = (uint8_t)(pInitStruct->AlertMode | pInitStruct->ConversionMode);
|
||||
TSENSOR_IO_Write(DeviceAddr, &confreg, LM75_REG_CONF, 1);
|
||||
|
||||
/* Set the Temperature Registers */
|
||||
/* Keep the sign bit and shift the temperature value (as given value is integer, the 0.5 digit is not set) */
|
||||
tempreg = (((pInitStruct->TemperatureLimitHigh & 0x7F) << 8) | (pInitStruct->TemperatureLimitHigh & 0x80));
|
||||
TSENSOR_IO_Write(DeviceAddr, (uint8_t*)(&tempreg), LM75_REG_TOS, 2);
|
||||
|
||||
tempreg = (((pInitStruct->TemperatureLimitLow & 0x7F) << 8) | (pInitStruct->TemperatureLimitLow & 0x80));
|
||||
TSENSOR_IO_Write(DeviceAddr, (uint8_t*)(&tempreg), LM75_REG_THYS, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if STLM75 sensor is ready or not
|
||||
* @param DeviceAddr : Device ID address.
|
||||
* @param Trials: Number of trials
|
||||
* @retval READY or NOT
|
||||
*/
|
||||
uint8_t STLM75_IsReady(uint16_t DeviceAddr, uint32_t Trials)
|
||||
{
|
||||
/* Configure the low level interface ---------------------------------------*/
|
||||
TSENSOR_IO_Init();
|
||||
|
||||
/* Check is Temperature Sensor is Ready to use */
|
||||
return TSENSOR_IO_IsDeviceReady(DeviceAddr, Trials);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Read The Temperature Sensor Status
|
||||
* @param DeviceAddr : Device ID address.
|
||||
* @retval Status
|
||||
*/
|
||||
uint8_t STLM75_ReadStatus(uint16_t DeviceAddr)
|
||||
{
|
||||
uint8_t tmp = 0;
|
||||
|
||||
/* Read Status register */
|
||||
TSENSOR_IO_Read(DeviceAddr, &tmp, LM75_REG_CONF, 1);
|
||||
|
||||
/* Return Temperature Sensor Status */
|
||||
return (uint8_t)(tmp);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Read temperature value of STLM75
|
||||
* @param DeviceAddr: Device ID address
|
||||
* @retval temperature value
|
||||
*/
|
||||
float STLM75_ReadTemp(uint16_t DeviceAddr)
|
||||
{
|
||||
uint16_t tempreg = 0;
|
||||
uint16_t tmp = 0;
|
||||
|
||||
/* Read Temperature registers */
|
||||
TSENSOR_IO_Read(DeviceAddr, (uint8_t*)(&tempreg), LM75_REG_TEMP, 2);
|
||||
|
||||
tmp = ((tempreg & 0x00FF) << 8) | ((tempreg & 0xFF00) >> 8);
|
||||
tempreg = (((tmp & 0x7F80) >> 7) | (tmp & 0x8000));
|
||||
|
||||
/* Return Temperature value */
|
||||
return (float)tempreg;
|
||||
}
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
126
USB-PD_Provider_1port/Drivers/BSP/Components/stlm75/stlm75.h
Normal file
126
USB-PD_Provider_1port/Drivers/BSP/Components/stlm75/stlm75.h
Normal file
|
@ -0,0 +1,126 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file stlm75.h
|
||||
* @author MCD Application Team
|
||||
* @brief This file contains all the functions prototypes for the stlm75.c
|
||||
* temperature sensor driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2014 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under BSD 3-Clause license,
|
||||
* the "License"; You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at:
|
||||
* opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __STLM75_H
|
||||
#define __STLM75_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "../Common/tsensor.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Components
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STLM75
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STLM75_Exported_Constants
|
||||
* @{
|
||||
*/
|
||||
/******************************************************************************/
|
||||
/*************************** START REGISTER MAPPING **************************/
|
||||
/******************************************************************************/
|
||||
|
||||
/***************************** Read Access Only *******************************/
|
||||
#define LM75_REG_TEMP 0x00 /*!< Temperature Register of LM75 */
|
||||
|
||||
/***************************** Read/Write Access ******************************/
|
||||
#define LM75_REG_CONF 0x01 /*!< Configuration Register of LM75 */
|
||||
#define LM75_REG_THYS 0x02 /*!< Temperature Register of LM75 */
|
||||
#define LM75_REG_TOS 0x03 /*!< Over-temp Shutdown threshold Register of LM75 */
|
||||
|
||||
/******************************************************************************/
|
||||
/**************************** END REGISTER MAPPING ***************************/
|
||||
/******************************************************************************/
|
||||
/** @defgroup Conversion_Mode_Selection
|
||||
* @{
|
||||
*/
|
||||
#define STLM75_CONTINUOUS_MODE ((uint8_t)0x00)
|
||||
#define STLM75_ONE_SHOT_MODE ((uint8_t)0x01)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup Operation_Mode
|
||||
* @{
|
||||
*/
|
||||
#define STLM75_COMPARATOR_MODE ((uint8_t)0x00)
|
||||
#define STLM75_INTERRUPT_MODE ((uint8_t)0x02)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STLM75_Exported_Functions
|
||||
* @{
|
||||
*/
|
||||
/* Sensor Configuration Functions */
|
||||
void STLM75_Init(uint16_t DeviceAddr, TSENSOR_InitTypeDef *pInitStruct);
|
||||
uint8_t STLM75_IsReady(uint16_t DeviceAddr, uint32_t Trials);
|
||||
/* Sensor Request Functions */
|
||||
uint8_t STLM75_ReadStatus(uint16_t DeviceAddr);
|
||||
float STLM75_ReadTemp(uint16_t DeviceAddr);
|
||||
|
||||
/* Temperature Sensor driver structure */
|
||||
extern TSENSOR_DrvTypeDef Stlm75Drv;
|
||||
|
||||
/* Temperature Sensor IO functions */
|
||||
void TSENSOR_IO_Init(void);
|
||||
void TSENSOR_IO_Write(uint16_t DevAddress, uint8_t* pBuffer, uint8_t WriteAddr, uint16_t Length);
|
||||
void TSENSOR_IO_Read(uint16_t DevAddress, uint8_t* pBuffer, uint8_t ReadAddr, uint16_t Length);
|
||||
uint16_t TSENSOR_IO_IsDeviceReady(uint16_t DevAddress, uint32_t Trials);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __STTS751_H */
|
||||
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
Loading…
Add table
Add a link
Reference in a new issue