Initial commit

This commit is contained in:
Jochen Friedrich 2021-01-01 14:06:20 +01:00
commit 66c5a26d69
1145 changed files with 938088 additions and 0 deletions

View file

@ -0,0 +1,212 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta charset="utf-8" />
<meta name="generator" content="pandoc" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<title>Release Notes for BSP Components Common Drivers</title>
<style type="text/css">
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
span.underline{text-decoration: underline;}
div.column{display: inline-block; vertical-align: top; width: 50%;}
</style>
<link rel="stylesheet" href="../../../../_htmresc/mini-st.css" />
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
<![endif]-->
</head>
<body>
<div class="row">
<div class="col-sm-12 col-lg-4">
<div class="card fluid">
<div class="sectione dark">
<center>
<h1 id="release-notes-for-bsp-components-common-drivers"><small>Release Notes for</small> <mark>BSP Components Common Drivers</mark></h1>
<p>Copyright © 2017 STMicroelectronics<br />
</p>
<a href="https://www.st.com" class="logo"><img src="../../../../_htmresc/st_logo.png" alt="ST logo" /></a>
</center>
</div>
</div>
<h1 id="license">License</h1>
<p>Licensed by ST under BSD 3-Clause license (the "License"). You may not use this package except in compliance with the License. You may obtain a copy of the License at:</p>
<p><a href="https://opensource.org/licenses/BSD-3-Clause">https://opensource.org/licenses/BSD-3-Clause</a></p>
<h1 id="purpose">Purpose</h1>
<p>This directory contains the BSP components common drivers.</p>
</div>
<div class="col-sm-12 col-lg-8">
<h1 id="update-history">Update History</h1>
<div class="collapse">
<input type="checkbox" id="collapse-section22" checked aria-hidden="true"> <label for="collapse-section22" aria-hidden="true">V5.1.2 / 03-April-2019</label>
<div>
<h2 id="main-changes">Main Changes</h2>
<ul>
<li>Update release notes format</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section21" aria-hidden="true"> <label for="collapse-section21" aria-hidden="true">V5.1.1 / 31-August-2018</label>
<div>
<h2 id="main-changes-1">Main Changes</h2>
<ul>
<li>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)</li>
<li>Correct sensor names in headers files hsensor.h and psensor.h</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section20" aria-hidden="true"> <label for="collapse-section20" aria-hidden="true">V5.1.0 / 21-November-2017</label>
<div>
<h2 id="main-changes-2">Main Changes</h2>
<ul>
<li>Add dpredriver.h: support of DP redriver class</li>
<li>Add pwrmon.h: support of power monitor class</li>
<li>Add usbtypecswitch.h: support of USB type C switch class</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section19" aria-hidden="true"> <label for="collapse-section19" aria-hidden="true">V5.0.0 / 01-March-2017</label>
<div>
<h2 id="main-changes-3">Main Changes</h2>
<ul>
<li>Add hsensor.h: support of humidity class</li>
<li>Add psensor.h: support of pressure class</li>
<li>Update tsensor.h: Temperature can be negative</li>
<li>Update accelero.h: LowPower API can enable or disable the low power mode</li>
<li>Update magneto.h: LowPower API can enable or disable the low power mode</li>
</ul>
<p><strong><span class="underline"><span style="font-size: 10pt; font-family: Verdana; color: black;">Notes:</span></span></strong></p>
<p>This version breaks the compatibility with previous versions.</p>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section18" aria-hidden="true"> <label for="collapse-section18" aria-hidden="true">V4.0.1 / 21-July-2015</label>
<div>
<h2 id="main-changes-4">Main Changes</h2>
<ul>
<li>tsensor.h: Fix compilation issue on TSENSOR_InitTypeDef</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section17" aria-hidden="true"> <label for="collapse-section17" aria-hidden="true">V4.0.0 / 22-June-2015</label>
<div>
<h2 id="main-changes-5">Main Changes</h2>
<ul>
<li>accelero.h: add *DeInit field in ACCELERO_DrvTypeDef structure</li>
<li>audio.h: add *DeInit field in AUDIO_DrvTypeDef structure</li>
<li>idd.h:
<ul>
<li>add Shunt0StabDelay, Shunt1StabDelay, Shunt2StabDelay, Shunt3StabDelay, Shunt4StabDelay and ShuntNbOnBoard fields in IDD_ConfigTypeDef structure</li>
<li>rename ShuntNumber field to ShuntNbUsed in IDD_ConfigTypeDef structure</li>
</ul></li>
<li>magneto.h: add *DeInit field in MAGNETO_DrvTypeDef structure</li>
</ul>
<p><strong><span class="underline"><span style="font-size: 10pt; font-family: Verdana; color: black;">Important Note:</span></span></strong></p>
<p>This release V4.0.0 is not backward compatible with V3.0.0.</p>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section16" aria-hidden="true"> <label for="collapse-section16" aria-hidden="true">V3.0.0 / 28-April-2015</label>
<div>
<h2 id="main-changes-6">Main Changes</h2>
<ul>
<li>accelero.h: add <em>LowPower</em> field in ACCELERO_DrvTypeDef structure</li>
<li>magneto.h: add <em>LowPower</em> field in MAGNETO_DrvTypeDef structure</li>
<li>gyro.h: add <em>DeInit</em> and <em>LowPower</em> fields in GYRO_DrvTypeDef structure</li>
<li>camera.h: add CAMERA_COLOR_EFFECT_NONE define</li>
<li>idd.h:
<ul>
<li>add MeasureNb, DeltaDelayUnit and DeltaDelayValue fields in IDD_ConfigTypeDef structure</li>
<li>rename PreDelay field to PreDelayUnit in IDD_ConfigTypeDef structure</li>
</ul></li>
</ul>
<p><strong><span class="underline"><span style="font-size: 10pt; font-family: Verdana; color: black;">Important Note:</span></span></strong></p>
<p>This release V3.0.0 is not backward compatible with V2.2.0.</p>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section155" aria-hidden="true"> <label for="collapse-section155" aria-hidden="true">V2.2.0 / 09-February-2015</label>
<div>
<h2 id="main-changes-7">Main Changes</h2>
<ul>
<li>Magnetometer driver function prototypes added (magneto.h file)</li>
<li>Update “idd.h” file to provide DeInit() and WakeUp() services in IDD current measurement driver</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section15" aria-hidden="true"> <label for="collapse-section15" aria-hidden="true">V2.1.0 / 06-February-2015</label>
<div>
<h2 id="main-changes-8">Main Changes</h2>
<ul>
<li>IDD current measurement driver function prototypes added (idd.h file)</li>
<li>io.h: add new typedef enum IO_PinState with IO_PIN_RESET and IO_PIN_SET values</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section12" aria-hidden="true"> <label for="collapse-section12" aria-hidden="true">V2.0.0 / 15-December-2014</label>
<div>
<h2 id="main-changes-9">Main Changes</h2>
<ul>
<li>Update “io.h” file to support MFX (Multi Function eXpander) device available on some STM32 boards
<ul>
<li>add new entries for IO_ModeTypedef enumeration structure</li>
<li>update the IO_DrvTypeDef structure
<ul>
<li>Update all return values and function parameters to uint32_t</li>
<li>Add a return value for Config field</li>
</ul></li>
</ul></li>
</ul>
<p><strong><span class="underline"><span style="font-size: 10pt; font-family: Verdana; color: black;">Important Note:</span></span></strong></p>
<p>This version V2.0.0 is not backward compatible with V1.2.1.</p>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section9" aria-hidden="true"> <label for="collapse-section9" aria-hidden="true">V1.2.1 / 02-December-2014</label>
<div>
<h2 id="main-changes-10">Main Changes</h2>
<ul>
<li>gyro.h: change “__GIRO_H” by “__GYRO_H” to fix compilation issue under Mac OS</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section8" aria-hidden="true"> <label for="collapse-section8" aria-hidden="true">V1.2.0 / 18-June-2014</label>
<div>
<h2 id="main-changes-11">Main Changes</h2>
<ul>
<li>EPD (E Paper Display) driver function prototype added (epd.h file)</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section7" aria-hidden="true"> <label for="collapse-section7" aria-hidden="true">V1.1.0 / 21-March-2014</label>
<div>
<h2 id="main-changes-12">Main Changes</h2>
<ul>
<li>Temperature Sensor driver function prototype added</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section7" aria-hidden="true"> <label for="collapse-section7" aria-hidden="true">V1.0.0 / 18-February-2014</label>
<div>
<h2 id="main-changes-13">Main Changes</h2>
<ul>
<li>First official release with Accelerometer, Audio, Camera, Gyroscope, IO, LCD and Touch Screen drivers function prototypes</li>
</ul>
</div>
</div>
</div>
</div>
<footer class="sticky">
For complete documentation on <mark>STM32 Microcontrollers</mark> , visit: <a href="http://www.st.com/STM32">http://www.st.com/STM32</a>
</footer>
</body>
</html>

View file

@ -0,0 +1,125 @@
/**
******************************************************************************
* @file accelero.h
* @author MCD Application Team
* @brief This header file contains the functions prototypes for the Accelerometer driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2017 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 __ACCELERO_H
#define __ACCELERO_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include <stdint.h>
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @addtogroup ACCELERO
* @{
*/
/** @defgroup ACCELERO_Exported_Types
* @{
*/
/** @defgroup ACCELERO_Driver_structure Accelerometer Driver structure
* @{
*/
typedef struct
{
void (*Init)(uint16_t);
void (*DeInit)(void);
uint8_t (*ReadID)(void);
void (*Reset)(void);
void (*LowPower)(uint16_t);
void (*ConfigIT)(void);
void (*EnableIT)(uint8_t);
void (*DisableIT)(uint8_t);
uint8_t (*ITStatus)(uint16_t);
void (*ClearIT)(void);
void (*FilterConfig)(uint8_t);
void (*FilterCmd)(uint8_t);
void (*GetXYZ)(int16_t *);
}ACCELERO_DrvTypeDef;
/**
* @}
*/
/** @defgroup ACCELERO_Configuration_structure Accelerometer Configuration structure
* @{
*/
/* ACCELERO struct */
typedef struct
{
uint8_t Power_Mode; /* Power-down/Normal Mode */
uint8_t AccOutput_DataRate; /* OUT data rate */
uint8_t Axes_Enable; /* Axes enable */
uint8_t High_Resolution; /* High Resolution enabling/disabling */
uint8_t BlockData_Update; /* Block Data Update */
uint8_t Endianness; /* Endian Data selection */
uint8_t AccFull_Scale; /* Full Scale selection */
uint8_t Communication_Mode;
}ACCELERO_InitTypeDef;
/* ACCELERO High Pass Filter struct */
typedef struct
{
uint8_t HighPassFilter_Mode_Selection; /* Internal filter mode */
uint8_t HighPassFilter_CutOff_Frequency; /* High pass filter cut-off frequency */
uint8_t HighPassFilter_AOI1; /* HPF_enabling/disabling for AOI function on interrupt 1 */
uint8_t HighPassFilter_AOI2; /* HPF_enabling/disabling for AOI function on interrupt 2 */
uint8_t HighPassFilter_Data_Sel;
uint8_t HighPassFilter_Stat;
}ACCELERO_FilterConfigTypeDef;
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* __ACCELERO_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,104 @@
/**
******************************************************************************
* @file audio.h
* @author MCD Application Team
* @brief This header file contains the common defines and functions prototypes
* for the Audio driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2017 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 __AUDIO_H
#define __AUDIO_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include <stdint.h>
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @addtogroup AUDIO
* @{
*/
/** @defgroup AUDIO_Exported_Constants
* @{
*/
/* Codec audio Standards */
#define CODEC_STANDARD 0x04
#define I2S_STANDARD I2S_STANDARD_PHILIPS
/**
* @}
*/
/** @defgroup AUDIO_Exported_Types
* @{
*/
/** @defgroup AUDIO_Driver_structure Audio Driver structure
* @{
*/
typedef struct
{
uint32_t (*Init)(uint16_t, uint16_t, uint8_t, uint32_t);
void (*DeInit)(void);
uint32_t (*ReadID)(uint16_t);
uint32_t (*Play)(uint16_t, uint16_t*, uint16_t);
uint32_t (*Pause)(uint16_t);
uint32_t (*Resume)(uint16_t);
uint32_t (*Stop)(uint16_t, uint32_t);
uint32_t (*SetFrequency)(uint16_t, uint32_t);
uint32_t (*SetVolume)(uint16_t, uint8_t);
uint32_t (*SetMute)(uint16_t, uint32_t);
uint32_t (*SetOutputMode)(uint16_t, uint8_t);
uint32_t (*Reset)(uint16_t);
}AUDIO_DrvTypeDef;
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* __AUDIO_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,123 @@
/**
******************************************************************************
* @file camera.h
* @author MCD Application Team
* @brief This header file contains the common defines and functions prototypes
* for the camera driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2017 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 __CAMERA_H
#define __CAMERA_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include <stdint.h>
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @addtogroup CAMERA
* @{
*/
/** @defgroup CAMERA_Exported_Types
* @{
*/
/** @defgroup CAMERA_Driver_structure Camera Driver structure
* @{
*/
typedef struct
{
void (*Init)(uint16_t, uint32_t);
uint16_t (*ReadID)(uint16_t);
void (*Config)(uint16_t, uint32_t, uint32_t, uint32_t);
}CAMERA_DrvTypeDef;
/**
* @}
*/
/**
* @}
*/
/** @defgroup CAMERA_Exported_Constants
* @{
*/
#define CAMERA_R160x120 0x00 /* QQVGA Resolution */
#define CAMERA_R320x240 0x01 /* QVGA Resolution */
#define CAMERA_R480x272 0x02 /* 480x272 Resolution */
#define CAMERA_R640x480 0x03 /* VGA Resolution */
#define CAMERA_CONTRAST_BRIGHTNESS 0x00 /* Camera contrast brightness features */
#define CAMERA_BLACK_WHITE 0x01 /* Camera black white feature */
#define CAMERA_COLOR_EFFECT 0x03 /* Camera color effect feature */
#define CAMERA_BRIGHTNESS_LEVEL0 0x00 /* Brightness level -2 */
#define CAMERA_BRIGHTNESS_LEVEL1 0x01 /* Brightness level -1 */
#define CAMERA_BRIGHTNESS_LEVEL2 0x02 /* Brightness level 0 */
#define CAMERA_BRIGHTNESS_LEVEL3 0x03 /* Brightness level +1 */
#define CAMERA_BRIGHTNESS_LEVEL4 0x04 /* Brightness level +2 */
#define CAMERA_CONTRAST_LEVEL0 0x05 /* Contrast level -2 */
#define CAMERA_CONTRAST_LEVEL1 0x06 /* Contrast level -1 */
#define CAMERA_CONTRAST_LEVEL2 0x07 /* Contrast level 0 */
#define CAMERA_CONTRAST_LEVEL3 0x08 /* Contrast level +1 */
#define CAMERA_CONTRAST_LEVEL4 0x09 /* Contrast level +2 */
#define CAMERA_BLACK_WHITE_BW 0x00 /* Black and white effect */
#define CAMERA_BLACK_WHITE_NEGATIVE 0x01 /* Negative effect */
#define CAMERA_BLACK_WHITE_BW_NEGATIVE 0x02 /* BW and Negative effect */
#define CAMERA_BLACK_WHITE_NORMAL 0x03 /* Normal effect */
#define CAMERA_COLOR_EFFECT_NONE 0x00 /* No effects */
#define CAMERA_COLOR_EFFECT_BLUE 0x01 /* Blue effect */
#define CAMERA_COLOR_EFFECT_GREEN 0x02 /* Green effect */
#define CAMERA_COLOR_EFFECT_RED 0x03 /* Red effect */
#define CAMERA_COLOR_EFFECT_ANTIQUE 0x04 /* Antique effect */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* __CAMERA_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,104 @@
/**
******************************************************************************
* @file dpredriver.h
* @author MCD Application Team
* @brief This header file contains the functions prototypes for the
* DisplayPort Linear Redriver.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2017 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 __DPREDRIVER_H
#define __DPREDRIVER_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include <stdint.h>
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @addtogroup DPREDRIVER
* @{
*/
/** @defgroup DPREDRIVER_Exported_Types
* @{
*/
/** @defgroup DPREDRIVER_Channel_Identifier Channel Identifier
* @{
*/
typedef enum {
CHANNEL_DP0 = 0,
CHANNEL_DP1,
CHANNEL_DP2,
CHANNEL_DP3,
CHANNEL_RX1,
CHANNEL_RX2,
CHANNEL_SSTX
} DPREDRIVER_ChannelId_t;
/**
* @}
*/
/** @defgroup DPREDRIVER_Driver_structure DisplayPort Linear Redriver Driver structure
* @{
*/
typedef struct
{
uint32_t (*Init)(uint16_t);
void (*DeInit)(uint16_t);
uint32_t (*PowerOn)(uint16_t);
uint32_t (*PowerOff)(uint16_t);
uint32_t (*SetEQGain)(uint16_t, DPREDRIVER_ChannelId_t, uint8_t);
uint32_t (*EnableChannel)(uint16_t, DPREDRIVER_ChannelId_t);
uint32_t (*DisableChannel)(uint16_t, DPREDRIVER_ChannelId_t);
}DPREDRIVER_Drv_t;
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* __DPREDRIVER_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,97 @@
/**
******************************************************************************
* @file epd.h
* @author MCD Application Team
* @brief This file contains all the functions prototypes for the
* EPD (E Paper Display) driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2017 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 __EPD_H
#define __EPD_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include <stdint.h>
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @addtogroup Common
* @{
*/
/** @addtogroup EPD
* @{
*/
/** @defgroup EPD_Exported_Types
* @{
*/
/** @defgroup EPD_Driver_structure E Paper Display Driver structure
* @{
*/
typedef struct
{
void (*Init)(void);
void (*WritePixel)(uint8_t);
/* Optimized operation */
void (*SetDisplayWindow)(uint16_t, uint16_t, uint16_t, uint16_t);
void (*RefreshDisplay)(void);
void (*CloseChargePump)(void);
uint16_t (*GetEpdPixelWidth)(void);
uint16_t (*GetEpdPixelHeight)(void);
void (*DrawImage)(uint16_t, uint16_t, uint16_t, uint16_t, uint8_t*);
}
EPD_DrvTypeDef;
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* EPD_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,127 @@
/**
******************************************************************************
* @file gyro.h
* @author MCD Application Team
* @brief This header file contains the functions prototypes for the gyroscope driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2017 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 __GYRO_H
#define __GYRO_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include <stdint.h>
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @addtogroup GYRO
* @{
*/
/** @defgroup GYRO_Exported_Types
* @{
*/
/** @defgroup GYRO_Driver_structure Gyroscope Driver structure
* @{
*/
typedef struct
{
void (*Init)(uint16_t);
void (*DeInit)(void);
uint8_t (*ReadID)(void);
void (*Reset)(void);
void (*LowPower)(uint16_t);
void (*ConfigIT)(uint16_t);
void (*EnableIT)(uint8_t);
void (*DisableIT)(uint8_t);
uint8_t (*ITStatus)(uint16_t, uint16_t);
void (*ClearIT)(uint16_t, uint16_t);
void (*FilterConfig)(uint8_t);
void (*FilterCmd)(uint8_t);
void (*GetXYZ)(float *);
}GYRO_DrvTypeDef;
/**
* @}
*/
/** @defgroup GYRO_Config_structure Gyroscope Configuration structure
* @{
*/
typedef struct
{
uint8_t Power_Mode; /* Power-down/Sleep/Normal Mode */
uint8_t Output_DataRate; /* OUT data rate */
uint8_t Axes_Enable; /* Axes enable */
uint8_t Band_Width; /* Bandwidth selection */
uint8_t BlockData_Update; /* Block Data Update */
uint8_t Endianness; /* Endian Data selection */
uint8_t Full_Scale; /* Full Scale selection */
}GYRO_InitTypeDef;
/* GYRO High Pass Filter struct */
typedef struct
{
uint8_t HighPassFilter_Mode_Selection; /* Internal filter mode */
uint8_t HighPassFilter_CutOff_Frequency; /* High pass filter cut-off frequency */
}GYRO_FilterConfigTypeDef;
/*GYRO Interrupt struct */
typedef struct
{
uint8_t Latch_Request; /* Latch interrupt request into CLICK_SRC register */
uint8_t Interrupt_Axes; /* X, Y, Z Axes Interrupts */
uint8_t Interrupt_ActiveEdge; /* Interrupt Active edge */
}GYRO_InterruptConfigTypeDef;
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* __GYRO_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,83 @@
/**
******************************************************************************
* @file hsensor.h
* @author MCD Application Team
* @brief This header file contains the functions prototypes for the
* Humidity Sensor driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2017 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 __HSENSOR_H
#define __HSENSOR_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include <stdint.h>
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @addtogroup HSENSOR
* @{
*/
/** @defgroup HSENSOR_Exported_Types
* @{
*/
/** @defgroup HSENSOR_Driver_structure Humidity Sensor Driver structure
* @{
*/
typedef struct
{
void (*Init)(uint16_t);
uint8_t (*ReadID)(uint16_t);
float (*ReadHumidity)(uint16_t);
}HSENSOR_DrvTypeDef;
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* __HSENSOR_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,150 @@
/**
******************************************************************************
* @file idd.h
* @author MCD Application Team
* @brief This file contains all the functions prototypes for the IDD driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2017 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 __IDD_H
#define __IDD_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include <stdint.h>
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @addtogroup IDD
* @{
*/
/** @defgroup IDD_Exported_Types IDD Exported Types
* @{
*/
/** @defgroup IDD_Config_structure IDD Configuration structure
* @{
*/
typedef struct
{
uint16_t AmpliGain; /*!< Specifies ampli gain value
*/
uint16_t VddMin; /*!< Specifies minimum MCU VDD can reach to protect MCU from reset
*/
uint16_t Shunt0Value; /*!< Specifies value of Shunt 0 if existing
*/
uint16_t Shunt1Value; /*!< Specifies value of Shunt 1 if existing
*/
uint16_t Shunt2Value; /*!< Specifies value of Shunt 2 if existing
*/
uint16_t Shunt3Value; /*!< Specifies value of Shunt 3 if existing
*/
uint16_t Shunt4Value; /*!< Specifies value of Shunt 4 if existing
*/
uint16_t Shunt0StabDelay; /*!< Specifies delay of Shunt 0 stabilization if existing
*/
uint16_t Shunt1StabDelay; /*!< Specifies delay of Shunt 1 stabilization if existing
*/
uint16_t Shunt2StabDelay; /*!< Specifies delay of Shunt 2 stabilization if existing
*/
uint16_t Shunt3StabDelay; /*!< Specifies delay of Shunt 3 stabilization if existing
*/
uint16_t Shunt4StabDelay; /*!< Specifies delay of Shunt 4 stabilization if existing
*/
uint8_t ShuntNbOnBoard; /*!< Specifies number of shunts that are present on board
This parameter can be a value of @ref IDD_shunt_number */
uint8_t ShuntNbUsed; /*!< Specifies number of shunts used for measurement
This parameter can be a value of @ref IDD_shunt_number */
uint8_t VrefMeasurement; /*!< Specifies if Vref is automatically measured before each Idd measurement
This parameter can be a value of @ref IDD_Vref_Measurement */
uint8_t Calibration; /*!< Specifies if calibration is done before each Idd measurement
*/
uint8_t PreDelayUnit; /*!< Specifies Pre delay unit
This parameter can be a value of @ref IDD_PreDelay */
uint8_t PreDelayValue; /*!< Specifies Pre delay value in selected unit
*/
uint8_t MeasureNb; /*!< Specifies number of Measure to be performed
This parameter can be a value between 1 and 256 */
uint8_t DeltaDelayUnit; /*!< Specifies Delta delay unit
This parameter can be a value of @ref IDD_DeltaDelay */
uint8_t DeltaDelayValue; /*!< Specifies Delta delay between 2 measures
value can be between 1 and 128 */
}IDD_ConfigTypeDef;
/**
* @}
*/
/** @defgroup IDD_Driver_structure IDD Driver structure
* @{
*/
typedef struct
{
void (*Init)(uint16_t);
void (*DeInit)(uint16_t);
uint16_t (*ReadID)(uint16_t);
void (*Reset)(uint16_t);
void (*LowPower)(uint16_t);
void (*WakeUp)(uint16_t);
void (*Start)(uint16_t);
void (*Config)(uint16_t,IDD_ConfigTypeDef);
void (*GetValue)(uint16_t, uint32_t *);
void (*EnableIT)(uint16_t);
void (*ClearIT)(uint16_t);
uint8_t (*GetITStatus)(uint16_t);
void (*DisableIT)(uint16_t);
void (*ErrorEnableIT)(uint16_t);
void (*ErrorClearIT)(uint16_t);
uint8_t (*ErrorGetITStatus)(uint16_t);
void (*ErrorDisableIT)(uint16_t);
uint8_t (*ErrorGetSrc)(uint16_t);
uint8_t (*ErrorGetCode)(uint16_t);
}IDD_DrvTypeDef;
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* __IDD_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,132 @@
/**
******************************************************************************
* @file io.h
* @author MCD Application Team
* @brief This file contains all the functions prototypes for the IO driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2017 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 __IO_H
#define __IO_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include <stdint.h>
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @addtogroup IO
* @{
*/
/** @defgroup IO_Exported_Types
* @{
*/
/**
* @brief IO Bit SET and Bit RESET enumeration
*/
typedef enum
{
IO_PIN_RESET = 0,
IO_PIN_SET
}IO_PinState;
typedef enum
{
IO_MODE_INPUT = 0, /* input floating */
IO_MODE_OUTPUT, /* output Push Pull */
IO_MODE_IT_RISING_EDGE, /* float input - irq detect on rising edge */
IO_MODE_IT_FALLING_EDGE, /* float input - irq detect on falling edge */
IO_MODE_IT_LOW_LEVEL, /* float input - irq detect on low level */
IO_MODE_IT_HIGH_LEVEL, /* float input - irq detect on high level */
/* following modes only available on MFX*/
IO_MODE_ANALOG, /* analog mode */
IO_MODE_OFF, /* when pin isn't used*/
IO_MODE_INPUT_PU, /* input with internal pull up resistor */
IO_MODE_INPUT_PD, /* input with internal pull down resistor */
IO_MODE_OUTPUT_OD, /* Open Drain output without internal resistor */
IO_MODE_OUTPUT_OD_PU, /* Open Drain output with internal pullup resistor */
IO_MODE_OUTPUT_OD_PD, /* Open Drain output with internal pulldown resistor */
IO_MODE_OUTPUT_PP, /* PushPull output without internal resistor */
IO_MODE_OUTPUT_PP_PU, /* PushPull output with internal pullup resistor */
IO_MODE_OUTPUT_PP_PD, /* PushPull output with internal pulldown resistor */
IO_MODE_IT_RISING_EDGE_PU, /* push up resistor input - irq on rising edge */
IO_MODE_IT_RISING_EDGE_PD, /* push dw resistor input - irq on rising edge */
IO_MODE_IT_FALLING_EDGE_PU, /* push up resistor input - irq on falling edge */
IO_MODE_IT_FALLING_EDGE_PD, /* push dw resistor input - irq on falling edge */
IO_MODE_IT_LOW_LEVEL_PU, /* push up resistor input - irq detect on low level */
IO_MODE_IT_LOW_LEVEL_PD, /* push dw resistor input - irq detect on low level */
IO_MODE_IT_HIGH_LEVEL_PU, /* push up resistor input - irq detect on high level */
IO_MODE_IT_HIGH_LEVEL_PD, /* push dw resistor input - irq detect on high level */
}IO_ModeTypedef;
/** @defgroup IO_Driver_structure IO Driver structure
* @{
*/
typedef struct
{
void (*Init)(uint16_t);
uint16_t (*ReadID)(uint16_t);
void (*Reset)(uint16_t);
void (*Start)(uint16_t, uint32_t);
uint8_t (*Config)(uint16_t, uint32_t, IO_ModeTypedef);
void (*WritePin)(uint16_t, uint32_t, uint8_t);
uint32_t (*ReadPin)(uint16_t, uint32_t);
void (*EnableIT)(uint16_t);
void (*DisableIT)(uint16_t);
uint32_t (*ITStatus)(uint16_t, uint32_t);
void (*ClearIT)(uint16_t, uint32_t);
}IO_DrvTypeDef;
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* __IO_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,96 @@
/**
******************************************************************************
* @file lcd.h
* @author MCD Application Team
* @brief This file contains all the functions prototypes for the LCD driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2017 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 __LCD_H
#define __LCD_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include <stdint.h>
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @addtogroup LCD
* @{
*/
/** @defgroup LCD_Exported_Types
* @{
*/
/** @defgroup LCD_Driver_structure LCD Driver structure
* @{
*/
typedef struct
{
void (*Init)(void);
uint16_t (*ReadID)(void);
void (*DisplayOn)(void);
void (*DisplayOff)(void);
void (*SetCursor)(uint16_t, uint16_t);
void (*WritePixel)(uint16_t, uint16_t, uint16_t);
uint16_t (*ReadPixel)(uint16_t, uint16_t);
/* Optimized operation */
void (*SetDisplayWindow)(uint16_t, uint16_t, uint16_t, uint16_t);
void (*DrawHLine)(uint16_t, uint16_t, uint16_t, uint16_t);
void (*DrawVLine)(uint16_t, uint16_t, uint16_t, uint16_t);
uint16_t (*GetLcdPixelWidth)(void);
uint16_t (*GetLcdPixelHeight)(void);
void (*DrawBitmap)(uint16_t, uint16_t, uint8_t*);
void (*DrawRGBImage)(uint16_t, uint16_t, uint16_t, uint16_t, uint8_t*);
}LCD_DrvTypeDef;
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* __LCD_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,107 @@
/**
******************************************************************************
* @file magneto.h
* @author MCD Application Team
* @brief This header file contains the functions prototypes for the MAGNETO driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2017 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 __MAGNETO_H
#define __MAGNETO_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include <stdint.h>
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @addtogroup MAGNETO
* @{
*/
/** @defgroup MAGNETO_Exported_Types
* @{
*/
/** @defgroup MAGNETO_Config_structure Magnetometer Configuration structure
* @{
*/
typedef struct
{
uint8_t Register1;
uint8_t Register2;
uint8_t Register3;
uint8_t Register4;
uint8_t Register5;
}MAGNETO_InitTypeDef;
/**
* @}
*/
/** @defgroup MAGNETO_Driver_structure Magnetometer Driver structure
* @{
*/
typedef struct
{
void (*Init)(MAGNETO_InitTypeDef);
void (*DeInit)(void);
uint8_t (*ReadID)(void);
void (*Reset)(void);
void (*LowPower)(uint16_t);
void (*ConfigIT)(void);
void (*EnableIT)(uint8_t);
void (*DisableIT)(uint8_t);
uint8_t (*ITStatus)(uint16_t);
void (*ClearIT)(void);
void (*FilterConfig)(uint8_t);
void (*FilterCmd)(uint8_t);
void (*GetXYZ)(int16_t *);
}MAGNETO_DrvTypeDef;
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* __MAGNETO_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,83 @@
/**
******************************************************************************
* @file psensor.h
* @author MCD Application Team
* @brief This header file contains the functions prototypes for the
* Pressure Sensor driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2017 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 __PSENSOR_H
#define __PSENSOR_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include <stdint.h>
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @addtogroup PSENSOR
* @{
*/
/** @defgroup PSENSOR_Exported_Types
* @{
*/
/** @defgroup PSENSOR_Driver_structure Pressure Sensor Driver structure
* @{
*/
typedef struct
{
void (*Init)(uint16_t);
uint8_t (*ReadID)(uint16_t);
float (*ReadPressure)(uint16_t);
}PSENSOR_DrvTypeDef;
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* __PSENSOR_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,246 @@
/**
******************************************************************************
* @file pwrmon.h
* @author MCD Application Team
* @brief This header file contains the functions prototypes for the
* Current/Power Monitor device driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2017 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 __PWRMON_H
#define __PWRMON_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include <stdint.h>
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @addtogroup PWRMON
* @{
*/
/** @defgroup PWRMON_Exported_Types
* @{
*/
/** @defgroup PWRMON_Operating_Mode_enum Power Monitor Operating Mode enums
* @{
*/
typedef enum {
OPERATING_MODE_TRIGGERED = 0,
OPERATING_MODE_CONTINUOUS,
OPERATING_MODE_NB
} PWRMON_OperatingMode_t;
/**
* @}
*/
/** @defgroup PWRMON_Conversion_Time_enum Power Monitor Conversion_Time enums
* @{
*/
typedef enum {
CONVERT_TIME_140 = 0,
CONVERT_TIME_204,
CONVERT_TIME_332,
CONVERT_TIME_588,
CONVERT_TIME_1100,
CONVERT_TIME_2116,
CONVERT_TIME_4156,
CONVERT_TIME_8244,
CONVERT_TIME_NB
} PWRMON_ConvertTime_t;
/**
* @}
*/
/** @defgroup PWRMON_Conversion_Time_enum Power Monitor Conversion_Time enums
* @{
*/
typedef enum {
AVERAGING_MODE_1 = 0,
AVERAGING_MODE_4,
AVERAGING_MODE_16,
AVERAGING_MODE_64,
AVERAGING_MODE_128,
AVERAGING_MODE_256,
AVERAGING_MODE_512,
AVERAGING_MODE_1024,
AVERAGING_MODE_NB
} PWRMON_AveragingMode_t;
/**
* @}
*/
/** @defgroup PWRMON_Device_Configuration_structure Power Monitor Device Configuration structure
* @{
*/
typedef struct
{
PWRMON_ConvertTime_t ShuntConvertTime;
PWRMON_ConvertTime_t BusConvertTime;
PWRMON_AveragingMode_t AveragingMode;
} PWRMON_Config_t;
/**
* @}
*/
/** @defgroup PWRMON_Alert_Polarity_enum Power Monitor Alert Polarity enums
* @{
*/
typedef enum {
ALERT_POLARITY_NORMAL = 0,
ALERT_POLARITY_INVERTED,
ALERT_POLARITY_NB
} PWRMON_AlertPolarity_t;
/**
* @}
*/
/** @defgroup PWRMON_Alert_Latch_Enable_enum Power Monitor Alert Latch Enable enums
* @{
*/
typedef enum {
ALERT_LATCH_DISABLE = 0,
ALERT_LATCH_ENABLE,
ALERT_LATCH_NB
} PWRMON_AlertLatchEnable_t;
/**
* @}
*/
/** @defgroup PWRMON_Alert_Function_enum Power Monitor Alert Function enums
* @{
*/
typedef enum {
ALERT_FUNCTION_NONE = 0,
ALERT_FUNCTION_SOL,
ALERT_FUNCTION_SUL,
ALERT_FUNCTION_BOL,
ALERT_FUNCTION_BUL,
ALERT_FUNCTION_POL,
ALERT_FUNCTION_NB,
} PWRMON_AlertFunction_t;
/**
* @}
*/
/** @defgroup PWRMON_Alert_Configuration_structure Power Monitor Alert Configuration structure
* @{
*/
typedef struct
{
PWRMON_AlertPolarity_t Polarity;
PWRMON_AlertLatchEnable_t LatchEnable;
} PWRMON_AlertPinConfig_t;
/**
* @}
*/
/** @defgroup PWRMON_Voltage_Input_enum Power Monitor Voltage Input enums
* @{
*/
typedef enum {
VOLTAGE_INPUT_SHUNT = 0,
VOLTAGE_INPUT_BUS,
VOLTAGE_INPUT_ALL,
VOLTAGE_INPUT_NB
} PWRMON_InputSignal_t;
/**
* @}
*/
/** @defgroup PWRMON_Flag_enum Power Monitor Flag enums
* @{
*/
typedef enum {
FLAG_ALERT_FUNCTION = 0,
FLAG_CONVERSION_READY,
FLAG_MATH_OVERFLOW,
FLAG_NB
} PWRMON_Flag_t;
/**
* @}
*/
/** @defgroup PWRMON_Driver_structure Power Monitor Driver structure
* @{
*/
typedef struct
{
void (*Init)(uint16_t, PWRMON_Config_t *);
void (*DeInit)(uint16_t);
uint16_t (*ReadId)(uint16_t);
void (*Reset)(uint16_t);
void (*SetCalibration)(uint16_t, uint16_t);
uint16_t (*GetCalibration)(uint16_t);
void (*SetAlertFunction)(uint16_t, PWRMON_AlertFunction_t);
PWRMON_AlertFunction_t (*GetAlertFunction)(uint16_t);
void (*AlertPinConfig)(uint16_t, PWRMON_AlertPinConfig_t *);
void (*SetVBusThreshold)(uint16_t, uint16_t);
uint16_t (*GetVBusThreshold)(uint16_t);
void (*SetVShuntThreshold)(uint16_t, int16_t);
int16_t (*GetVShuntThreshold)(uint16_t);
void (*SetPowerThreshold)(uint16_t, uint32_t);
uint32_t (*GetPowerThreshold)(uint16_t);
void (*AlertThresholdEnableIT)(uint16_t);
void (*AlertThresholdDisableIT)(uint16_t);
void (*ConversionReadyEnableIT)(uint16_t);
void (*ConversionReadyDisableIT)(uint16_t);
void (*StartConversion)(uint16_t, PWRMON_InputSignal_t, PWRMON_OperatingMode_t);
void (*StopConversion)(uint16_t);
uint16_t (*GetVBus)(uint16_t);
int16_t (*GetVShunt)(uint16_t);
uint16_t (*GetPower)(uint16_t);
int16_t (*GetCurrent)(uint16_t);
uint8_t (*GetFlag)(uint16_t, PWRMON_Flag_t);
} PWRMON_Drv_t;
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* __PWRMON_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,89 @@
/**
******************************************************************************
* @file ts.h
* @author MCD Application Team
* @brief This file contains all the functions prototypes for the Touch Screen driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2017 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 __TS_H
#define __TS_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include <stdint.h>
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @addtogroup TS
* @{
*/
/** @defgroup TS_Exported_Types
* @{
*/
/** @defgroup TS_Driver_structure Touch Sensor Driver structure
* @{
*/
typedef struct
{
void (*Init)(uint16_t);
uint16_t (*ReadID)(uint16_t);
void (*Reset)(uint16_t);
void (*Start)(uint16_t);
uint8_t (*DetectTouch)(uint16_t);
void (*GetXY)(uint16_t, uint16_t*, uint16_t*);
void (*EnableIT)(uint16_t);
void (*ClearIT)(uint16_t);
uint8_t (*GetITStatus)(uint16_t);
void (*DisableIT)(uint16_t);
}TS_DrvTypeDef;
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* __TS_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,100 @@
/**
******************************************************************************
* @file tsensor.h
* @author MCD Application Team
* @brief This header file contains the functions prototypes for the
* Temperature Sensor driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2017 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 __TSENSOR_H
#define __TSENSOR_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include <stdint.h>
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @addtogroup TSENSOR
* @{
*/
/** @defgroup TSENSOR_Exported_Types
* @{
*/
/** @defgroup TSENSOR_Config_structure Temperature Sensor Configuration structure
* @{
*/
typedef struct
{
uint8_t AlertMode; /* Alert Mode Temperature out of range*/
uint8_t ConversionMode; /* Continuous/One Shot Mode */
uint8_t ConversionResolution; /* Temperature Resolution */
uint8_t ConversionRate; /* Number of measure per second */
int8_t TemperatureLimitHigh; /* High Temperature Limit Range */
int8_t TemperatureLimitLow; /* Low Temperature Limit Range */
}TSENSOR_InitTypeDef;
/**
* @}
*/
/** @defgroup TSENSOR_Driver_structure Temperature Sensor Driver structure
* @{
*/
typedef struct
{
void (*Init)(uint16_t, TSENSOR_InitTypeDef *);
uint8_t (*IsReady)(uint16_t, uint32_t);
uint8_t (*ReadStatus)(uint16_t);
float (*ReadTemp)(uint16_t);
}TSENSOR_DrvTypeDef;
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* __TSENSOR_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,114 @@
/**
******************************************************************************
* @file usbtypecswitch.h
* @author MCD Application Team
* @brief This header file contains the functions prototypes for the
* crossbar switch device for USB Type-C systems.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2017 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 __USBTYPECSWITCH_H
#define __USBTYPECSWITCH_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include <stdint.h>
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @addtogroup TYPECSWITCH
* @{
*/
/** @defgroup TYPECSWITCH_Exported_Types
* @{
*/
typedef enum {
USB_NORMAL = 0,
USB_FLIPPED,
DFP_D_PIN_ASSIGNMENT_A_NORMAL,
DFP_D_PIN_ASSIGNMENT_A_FLIPPED,
DFP_D_PIN_ASSIGNMENT_B_NORMAL,
DFP_D_PIN_ASSIGNMENT_B_FLIPPED,
DFP_D_PIN_ASSIGNMENT_C_NORMAL,
DFP_D_PIN_ASSIGNMENT_C_FLIPPED,
DFP_D_PIN_ASSIGNMENT_D_NORMAL,
DFP_D_PIN_ASSIGNMENT_D_FLIPPED,
DFP_D_PIN_ASSIGNMENT_E_NORMAL,
DFP_D_PIN_ASSIGNMENT_E_FLIPPED,
DFP_D_PIN_ASSIGNMENT_F_NORMAL,
DFP_D_PIN_ASSIGNMENT_F_FLIPPED,
UFP_D_PIN_ASSIGNMENT_A_NORMAL,
UFP_D_PIN_ASSIGNMENT_A_FLIPPED,
UFP_D_PIN_ASSIGNMENT_B_NORMAL,
UFP_D_PIN_ASSIGNMENT_B_FLIPPED,
UFP_D_PIN_ASSIGNMENT_C_NORMAL,
UFP_D_PIN_ASSIGNMENT_C_FLIPPED,
UFP_D_PIN_ASSIGNMENT_D_NORMAL,
UFP_D_PIN_ASSIGNMENT_D_FLIPPED,
UFP_D_PIN_ASSIGNMENT_E_NORMAL,
UFP_D_PIN_ASSIGNMENT_E_FLIPPED,
UFP_D_PIN_ASSIGNMENT_F_NORMAL,
UFP_D_PIN_ASSIGNMENT_F_FLIPPED
} TYPECSWITCH_Mode_t;
/** @defgroup TYPECSWITCH_Driver_structure USB Type-C Crossbar Switch Driver structure
* @{
*/
typedef struct
{
uint32_t (*Init)(uint16_t);
void (*DeInit)(uint16_t);
uint32_t (*PowerOn)(uint16_t);
uint32_t (*PowerOff)(uint16_t);
uint32_t (*SetMode)(uint16_t, TYPECSWITCH_Mode_t);
uint32_t (*IsSupportedMode)(TYPECSWITCH_Mode_t);
} TYPECSWITCH_Drv_t;
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* __USBTYPECSWITCH_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,65 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta charset="utf-8" />
<meta name="generator" content="pandoc" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<title>Release Notes for CBTL08GP053 Component Drivers</title>
<style type="text/css">
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
span.underline{text-decoration: underline;}
div.column{display: inline-block; vertical-align: top; width: 50%;}
</style>
<link rel="stylesheet" href="../../../../_htmresc/mini-st.css" />
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
<![endif]-->
</head>
<body>
<div class="row">
<div class="col-sm-12 col-lg-4">
<div class="card fluid">
<div class="sectione dark">
<center>
<h1 id="release-notes-for-cbtl08gp053-component-drivers"><small>Release Notes for</small> <mark>CBTL08GP053 Component Drivers</mark></h1>
<p>Copyright © 2017 STMicroelectronics<br />
</p>
<a href="https://www.st.com" class="logo"><img src="../../../../_htmresc/st_logo.png" alt="ST logo" /></a>
</center>
</div>
</div>
<h1 id="license">License</h1>
<p>Licensed by ST under BSD 3-Clause license (the "License"). You may not use this package except in compliance with the License. You may obtain a copy of the License at:</p>
<p><a href="https://opensource.org/licenses/BSD-3-Clause">https://opensource.org/licenses/BSD-3-Clause</a></p>
<h1 id="purpose">Purpose</h1>
<p>This directory contains the CBTL08GP053 component drivers.</p>
</div>
<div class="col-sm-12 col-lg-8">
<h1 id="update-history">Update History</h1>
<div class="collapse">
<input type="checkbox" id="collapse-section12" checked aria-hidden="true"> <label for="collapse-section12" aria-hidden="true">V1.0.1 / 23-July-2020</label>
<div>
<h2 id="main-changes">Main Changes</h2>
<ul>
<li>Fix minor mispelled words</li>
<li>Update Release Notes format</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section11" aria-hidden="true"> <label for="collapse-section11" aria-hidden="true">V1.0.0 / 16-November-2017</label>
<div>
<h2 id="main-changes-1">Main Changes</h2>
<ul>
<li>First official release of CBTL08GP053 Component driver</li>
</ul>
</div>
</div>
</div>
</div>
<footer class="sticky">
For complete documentation on <mark>STM32 Microcontrollers</mark> , visit: <a href="http://www.st.com/STM32">http://www.st.com/STM32</a>
</footer>
</body>
</html>

View file

@ -0,0 +1,391 @@
/**
******************************************************************************
* @file cbtl08gp053.c
* @author MCD Application Team
* @brief This file provides a set of functions needed to manage the CBTL08GP053
* (Crossbar switch device for USB Type-C systems).
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include "cbtl08gp053.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @defgroup CBTL08GP053
* @brief This file provides a set of functions needed to drive the
* CBTL08GP053 Crossbar switch device for USB Type-C systems.
* @{
*/
/** @defgroup CBTL08GP053_Private_TypesDefinitions
* @{
*/
/**
* @}
*/
/** @defgroup CBTL08GP053_Private_Defines
* @{
*/
/**
* @}
*/
/** @defgroup CBTL08GP053_Private_Macros
* @{
*/
/**
* @}
*/
/** @defgroup CBTL08GP053_Private_Variables
* @{
*/
#ifdef DBG_BSP_MUX
CBTL08GP053_TypeDef CBTL08GP053 =
{
.SYS_CTRL = 0x00,
.OP1_CTRL = 0x00,
.OP2_CTRL = 0x00,
.OP3_CTRL = 0x00,
.OP4_CTRL = 0x00,
.OP5_CTRL = 0x00,
.CROSS5_CTRL = 0x01,
.SW_CTRL = 0x00,
.SW_CTRL = 0x00,
.REVISION = 0xA0
};
#endif /* DBG_BSP_MUX */
/* Type-C Crosspoint Switch Driver structure initialization */
TYPECSWITCH_Drv_t cbtl08gp053_drv = {
cbtl08gp053_Init,
cbtl08gp053_DeInit,
cbtl08gp053_PowerOn,
cbtl08gp053_PowerOff,
cbtl08gp053_SetMode,
cbtl08gp053_IsSupportedMode
};
/* Supported USB Type-C pin assignments */
static const uint32_t cbtl08gp053_SupportedModes =
( 1 << USB_NORMAL |
1 << USB_FLIPPED |
1 << DFP_D_PIN_ASSIGNMENT_C_NORMAL |
1 << DFP_D_PIN_ASSIGNMENT_C_FLIPPED |
1 << DFP_D_PIN_ASSIGNMENT_D_NORMAL |
1 << DFP_D_PIN_ASSIGNMENT_D_FLIPPED |
1 << DFP_D_PIN_ASSIGNMENT_E_NORMAL |
1 << DFP_D_PIN_ASSIGNMENT_E_FLIPPED |
1 << DFP_D_PIN_ASSIGNMENT_F_NORMAL |
1 << DFP_D_PIN_ASSIGNMENT_F_FLIPPED |
1 << UFP_D_PIN_ASSIGNMENT_C_NORMAL |
1 << UFP_D_PIN_ASSIGNMENT_C_FLIPPED |
1 << UFP_D_PIN_ASSIGNMENT_D_NORMAL |
1 << UFP_D_PIN_ASSIGNMENT_D_FLIPPED |
1 << UFP_D_PIN_ASSIGNMENT_E_NORMAL |
1 << UFP_D_PIN_ASSIGNMENT_E_FLIPPED );
/**
* @}
*/
/** @defgroup CBTL08GP053_Private_FunctionPrototypes
* @{
*/
/**
* @}
*/
/** @defgroup CBTL08GP053_Private_Functions
* @{
*/
/**
* @brief Initialize the CBTL08GP053 and configure the needed hardware resources.
* @param Address CBTL08GP053 address on communication Bus.
* @retval 0: successful, else failed
*/
uint32_t cbtl08gp053_Init(uint16_t Address)
{
uint32_t err_count = 0;
/* Low level init */
err_count += MUX_IO_Init();
/* Restore CBTL08GP053 registers reset values */
MUX_IO_Write(Address, CBTL08GP053_REG_SYS_CTRL, 0x00);
MUX_IO_Write(Address, CBTL08GP053_REG_OP1_CTRL, 0x00);
MUX_IO_Write(Address, CBTL08GP053_REG_OP2_CTRL, 0x00);
MUX_IO_Write(Address, CBTL08GP053_REG_OP3_CTRL, 0x00);
MUX_IO_Write(Address, CBTL08GP053_REG_OP4_CTRL, 0x00);
MUX_IO_Write(Address, CBTL08GP053_REG_OP5_CTRL, 0x00);
MUX_IO_Write(Address, CBTL08GP053_REG_CROSS5_CTRL, 0x01);
MUX_IO_Write(Address, CBTL08GP053_REG_SW_CTRL, 0x00);
return err_count;
}
/**
* @brief Release the hardware resources required to use the CBTL08GP053.
* @param Address CBTL08GP053 address on communication Bus.
* @retval none
*/
void cbtl08gp053_DeInit(uint16_t Address)
{
/* Restore CBTL08GP053 registers reset values */
MUX_IO_Write(Address, CBTL08GP053_REG_SYS_CTRL, 0x00);
MUX_IO_Write(Address, CBTL08GP053_REG_OP1_CTRL, 0x00);
MUX_IO_Write(Address, CBTL08GP053_REG_OP2_CTRL, 0x00);
MUX_IO_Write(Address, CBTL08GP053_REG_OP3_CTRL, 0x00);
MUX_IO_Write(Address, CBTL08GP053_REG_OP4_CTRL, 0x00);
MUX_IO_Write(Address, CBTL08GP053_REG_OP5_CTRL, 0x00);
MUX_IO_Write(Address, CBTL08GP053_REG_CROSS5_CTRL, 0x01);
MUX_IO_Write(Address, CBTL08GP053_REG_SW_CTRL, 0x00);
/* Low level de-init */
MUX_IO_DeInit();
}
/**
* @brief Power on the CBTL08GP053.
* @param Address CBTL08GP053 address on communication Bus.
* @retval 0: successful, else failed
*/
uint32_t cbtl08gp053_PowerOn(uint16_t Address)
{
uint32_t err_count = 0;
/* Set SYS_CTRL.SWTICH_EN bit */
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_SYS_CTRL, CBTL08GP053_REG_SYS_CTRL_SWITCH_EN);
return err_count;
}
/**
* @brief Power down the CBTL08GP053.
* @param Address CBTL08GP053 address on communication Bus.
* @retval 0: successful, else failed
*/
uint32_t cbtl08gp053_PowerOff(uint16_t Address)
{
uint32_t err_count = 0;
/* Clear SYS_CTRL.SWTICH_EN bit */
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_SYS_CTRL, 0x00);
return err_count;
}
/**
* @brief Configure the CBTL08GP053 according to the requested USB Type-C
* connector pin assignment.
* @param Address CBTL08GP053 address on communication Bus.
* @param Mode USB Type-C connector pin assignment
* @retval 0: success, else error
*/
uint32_t cbtl08gp053_SetMode(uint16_t Address, TYPECSWITCH_Mode_t Mode)
{
uint32_t err_count = 0;
uint8_t sw_ctrl = (CBTL08GP053_REG_SW_X5_SET |
CBTL08GP053_REG_SW_OP1_SET |
CBTL08GP053_REG_SW_OP2_SET |
CBTL08GP053_REG_SW_OP3_SET |
CBTL08GP053_REG_SW_OP4_SET |
CBTL08GP053_REG_SW_OP5_SET);
/* Transition to safe mode prior updating cross switch configuration */
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP1_CTRL, 0x00);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP2_CTRL, 0x00);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP3_CTRL, 0x00);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP4_CTRL, 0x00);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP5_CTRL, 0x00);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_CROSS5_CTRL, 0x00);
/* Configure cross switch */
switch(Mode)
{
case USB_NORMAL:
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP1_CTRL, CBTL08GP053_REG_OP1_CTRL_EN_IP1);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP2_CTRL, 0x00);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP3_CTRL, CBTL08GP053_REG_OP3_CTRL_EN_IP4);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP4_CTRL, 0x00);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP5_CTRL, 0x00);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_CROSS5_CTRL, 0x00);
break;
case USB_FLIPPED:
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP1_CTRL, 0x00);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP2_CTRL, CBTL08GP053_REG_OP1_CTRL_EN_IP1);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP3_CTRL, 0x00);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP4_CTRL, CBTL08GP053_REG_OP3_CTRL_EN_IP4);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP5_CTRL, 0x00);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_CROSS5_CTRL, 0x00);
break;
case DFP_D_PIN_ASSIGNMENT_C_NORMAL:
case DFP_D_PIN_ASSIGNMENT_E_NORMAL:
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP1_CTRL, CBTL08GP053_REG_OP1_CTRL_EN_IP2);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP2_CTRL, CBTL08GP053_REG_OP2_CTRL_EN_IP3);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP3_CTRL, CBTL08GP053_REG_OP3_CTRL_EN_IP5);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP4_CTRL, CBTL08GP053_REG_OP4_CTRL_EN_IP6);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP5_CTRL, CBTL08GP053_REG_OP5_CTRL_EN_IP7);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_CROSS5_CTRL, CBTL08GP053_REG_CROSS5_PASS);
break;
case DFP_D_PIN_ASSIGNMENT_C_FLIPPED:
case DFP_D_PIN_ASSIGNMENT_E_FLIPPED:
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP1_CTRL, CBTL08GP053_REG_OP1_CTRL_EN_IP3);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP2_CTRL, CBTL08GP053_REG_OP2_CTRL_EN_IP2);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP3_CTRL, CBTL08GP053_REG_OP3_CTRL_EN_IP6);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP4_CTRL, CBTL08GP053_REG_OP4_CTRL_EN_IP5);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP5_CTRL, CBTL08GP053_REG_OP5_CTRL_EN_IP7);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_CROSS5_CTRL, CBTL08GP053_REG_CROSS5_CROSS);
break;
case DFP_D_PIN_ASSIGNMENT_D_NORMAL:
case DFP_D_PIN_ASSIGNMENT_F_NORMAL:
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP1_CTRL, CBTL08GP053_REG_OP1_CTRL_EN_IP1);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP2_CTRL, CBTL08GP053_REG_OP2_CTRL_EN_IP3);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP3_CTRL, CBTL08GP053_REG_OP3_CTRL_EN_IP4);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP4_CTRL, CBTL08GP053_REG_OP4_CTRL_EN_IP6);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP5_CTRL, CBTL08GP053_REG_OP5_CTRL_EN_IP7);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_CROSS5_CTRL, CBTL08GP053_REG_CROSS5_PASS);
break;
case DFP_D_PIN_ASSIGNMENT_D_FLIPPED:
case DFP_D_PIN_ASSIGNMENT_F_FLIPPED:
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP1_CTRL, CBTL08GP053_REG_OP1_CTRL_EN_IP3);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP2_CTRL, CBTL08GP053_REG_OP2_CTRL_EN_IP1);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP3_CTRL, CBTL08GP053_REG_OP3_CTRL_EN_IP6);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP4_CTRL, CBTL08GP053_REG_OP4_CTRL_EN_IP4);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP5_CTRL, CBTL08GP053_REG_OP5_CTRL_EN_IP7);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_CROSS5_CTRL, CBTL08GP053_REG_CROSS5_CROSS);
break;
case UFP_D_PIN_ASSIGNMENT_C_NORMAL:
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP1_CTRL, CBTL08GP053_REG_OP1_CTRL_EN_IP2);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP2_CTRL, CBTL08GP053_REG_OP2_CTRL_EN_IP3);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP3_CTRL, CBTL08GP053_REG_OP3_CTRL_EN_IP5);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP4_CTRL, CBTL08GP053_REG_OP4_CTRL_EN_IP6);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP5_CTRL, CBTL08GP053_REG_OP5_CTRL_EN_IP7);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_CROSS5_CTRL, CBTL08GP053_REG_CROSS5_CROSS);
break;
case UFP_D_PIN_ASSIGNMENT_C_FLIPPED:
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP1_CTRL, CBTL08GP053_REG_OP1_CTRL_EN_IP3);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP2_CTRL, CBTL08GP053_REG_OP2_CTRL_EN_IP2);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP3_CTRL, CBTL08GP053_REG_OP3_CTRL_EN_IP6);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP4_CTRL, CBTL08GP053_REG_OP4_CTRL_EN_IP5);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP5_CTRL, CBTL08GP053_REG_OP5_CTRL_EN_IP7);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_CROSS5_CTRL, CBTL08GP053_REG_CROSS5_PASS);
break;
case UFP_D_PIN_ASSIGNMENT_D_NORMAL:
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP1_CTRL, CBTL08GP053_REG_OP1_CTRL_EN_IP1);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP2_CTRL, CBTL08GP053_REG_OP2_CTRL_EN_IP3);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP3_CTRL, CBTL08GP053_REG_OP3_CTRL_EN_IP4);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP4_CTRL, CBTL08GP053_REG_OP4_CTRL_EN_IP6);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP5_CTRL, CBTL08GP053_REG_OP5_CTRL_EN_IP7);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_CROSS5_CTRL, CBTL08GP053_REG_CROSS5_CROSS);
break;
case UFP_D_PIN_ASSIGNMENT_D_FLIPPED:
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP1_CTRL, CBTL08GP053_REG_OP1_CTRL_EN_IP3);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP2_CTRL, CBTL08GP053_REG_OP2_CTRL_EN_IP1);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP3_CTRL, CBTL08GP053_REG_OP3_CTRL_EN_IP6);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP4_CTRL, CBTL08GP053_REG_OP4_CTRL_EN_IP4);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP5_CTRL, CBTL08GP053_REG_OP5_CTRL_EN_IP7);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_CROSS5_CTRL, CBTL08GP053_REG_CROSS5_PASS);
break;
case UFP_D_PIN_ASSIGNMENT_E_NORMAL:
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP1_CTRL, CBTL08GP053_REG_OP1_CTRL_EN_IP2);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP2_CTRL, CBTL08GP053_REG_OP2_CTRL_EN_IP3);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP3_CTRL, CBTL08GP053_REG_OP3_CTRL_EN_IP5);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP4_CTRL, CBTL08GP053_REG_OP4_CTRL_EN_IP6);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP5_CTRL, CBTL08GP053_REG_OP5_CTRL_EN_IP7);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_CROSS5_CTRL, CBTL08GP053_REG_CROSS5_CROSS);
break;
case UFP_D_PIN_ASSIGNMENT_E_FLIPPED:
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP1_CTRL, CBTL08GP053_REG_OP1_CTRL_EN_IP3);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP2_CTRL, CBTL08GP053_REG_OP2_CTRL_EN_IP2);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP3_CTRL, CBTL08GP053_REG_OP3_CTRL_EN_IP6);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP4_CTRL, CBTL08GP053_REG_OP4_CTRL_EN_IP5);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP5_CTRL, CBTL08GP053_REG_OP5_CTRL_EN_IP7);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_CROSS5_CTRL, CBTL08GP053_REG_CROSS5_PASS);
break;
default:
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP1_CTRL, 0x00);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP2_CTRL, 0x00);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP3_CTRL, 0x00);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP4_CTRL, 0x00);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_OP5_CTRL, 0x00);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_CROSS5_CTRL, 0x00);
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_SW_CTRL, sw_ctrl);
break;
}
/* Enable cross switch configuration */
err_count += MUX_IO_Write(Address, CBTL08GP053_REG_SW_CTRL, sw_ctrl);
return err_count;
}
/**
* @brief Indicate whether the requested USB Type-C connector pin assignment
* is supported by the CBTL08GP053.
* @param Mode USB Type-C connector pin assignment
* @retval 0: success, else error
*/
uint32_t cbtl08gp053_IsSupportedMode(TYPECSWITCH_Mode_t Mode)
{
return (((1 << Mode) & cbtl08gp053_SupportedModes ) == 0) ? 0 : 1;
}
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,369 @@
/**
******************************************************************************
* @file cbtl08gp053.h
* @author MCD Application Team
* @brief This file contains all the functions prototypes for the CBTL08GP053
* (Crossbar switch device for USB Type-C systems).
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __CBTL08GP053_H
#define __CBTL08GP053_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include <stdint.h>
#include "../Common/usbtypecswitch.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @addtogroup CBTL08GP053
* @{
*/
#ifdef DBG_BSP_MUX
typedef struct
{
uint8_t RESERVED1; /*!< Address offset: 0x00 */
uint8_t SYS_CTRL; /*!< Address offset: 0x01 */
uint8_t OP1_CTRL; /*!< Address offset: 0x02 */
uint8_t OP2_CTRL; /*!< Address offset: 0x03 */
uint8_t OP3_CTRL; /*!< Address offset: 0x04 */
uint8_t OP4_CTRL; /*!< Address offset: 0x05 */
uint8_t OP5_CTRL; /*!< Address offset: 0x06 */
uint8_t CROSS5_CTRL; /*!< Address offset: 0x07 */
uint8_t SW_CTRL; /*!< Address offset: 0x08 */
uint8_t REVISION; /*!< Address offset: 0x09 */
} CBTL08GP053_TypeDef;
extern CBTL08GP053_TypeDef CBTL08GP053;
#endif /* DBG_BSP_MUX */
/** @defgroup CBTL08GP053_Exported_Constants
* @{
*/
/******************************* Register Map ********************************/
#define CBTL08GP053_REG_SYS_CTRL 0x01 /*!< */
#define CBTL08GP053_REG_OP1_CTRL 0x02 /*!< */
#define CBTL08GP053_REG_OP2_CTRL 0x03 /*!< */
#define CBTL08GP053_REG_OP3_CTRL 0x04 /*!< */
#define CBTL08GP053_REG_OP4_CTRL 0x05 /*!< */
#define CBTL08GP053_REG_OP5_CTRL 0x06 /*!< */
#define CBTL08GP053_REG_CROSS5_CTRL 0x07 /*!< */
#define CBTL08GP053_REG_SW_CTRL 0x08 /*!< */
#define CBTL08GP053_REG_REVISION 0x09 /*!< */
/********************* Bit definition for SYS_CTRL register *****************/
#define CBTL08GP053_REG_SYS_CTRL_SWITCH_EN_Pos (7U)
#define CBTL08GP053_REG_SYS_CTRL_SWITCH_EN_Msk (0x1U << CBTL08GP053_REG_SYS_CTRL_SWITCH_EN_Pos) /*!< 0x80*/
#define CBTL08GP053_REG_SYS_CTRL_SWITCH_EN CBTL08GP053_REG_SYS_CTRL_SWITCH_EN_Msk /*!< */
/********************* Bit definition for OP1_CTRL register *****************/
#define CBTL08GP053_REG_OP1_CTRL_EN_IP1_Pos (0U)
#define CBTL08GP053_REG_OP1_CTRL_EN_IP1_Msk (0x1U << CBTL08GP053_REG_OP1_CTRL_EN_IP1_Pos) /*!< 0x01 */
#define CBTL08GP053_REG_OP1_CTRL_EN_IP1 CBTL08GP053_REG_OP1_CTRL_EN_IP1_Msk /*!< */
#define CBTL08GP053_REG_OP1_CTRL_EN_IP2_Pos (1U)
#define CBTL08GP053_REG_OP1_CTRL_EN_IP2_Msk (0x1U << CBTL08GP053_REG_OP1_CTRL_EN_IP2_Pos) /*!< 0x02 */
#define CBTL08GP053_REG_OP1_CTRL_EN_IP2 CBTL08GP053_REG_OP1_CTRL_EN_IP2_Msk /*!< */
#define CBTL08GP053_REG_OP1_CTRL_EN_IP3_Pos (2U)
#define CBTL08GP053_REG_OP1_CTRL_EN_IP3_Msk (0x1U << CBTL08GP053_REG_OP1_CTRL_EN_IP3_Pos) /*!< 0x04 */
#define CBTL08GP053_REG_OP1_CTRL_EN_IP3 CBTL08GP053_REG_OP1_CTRL_EN_IP3_Msk /*!< */
/********************* Bit definition for OP2_CTRL register *****************/
#define CBTL08GP053_REG_OP2_CTRL_EN_IP1_Pos (0U)
#define CBTL08GP053_REG_OP2_CTRL_EN_IP1_Msk (0x1U << CBTL08GP053_REG_OP2_CTRL_EN_IP1_Pos) /*!< 0x01 */
#define CBTL08GP053_REG_OP2_CTRL_EN_IP1 CBTL08GP053_REG_OP2_CTRL_EN_IP1_Msk /*!< */
#define CBTL08GP053_REG_OP2_CTRL_EN_IP2_Pos (1U)
#define CBTL08GP053_REG_OP2_CTRL_EN_IP2_Msk (0x1U << CBTL08GP053_REG_OP2_CTRL_EN_IP2_Pos) /*!< 0x02 */
#define CBTL08GP053_REG_OP2_CTRL_EN_IP2 CBTL08GP053_REG_OP2_CTRL_EN_IP2_Msk /*!< */
#define CBTL08GP053_REG_OP2_CTRL_EN_IP3_Pos (2U)
#define CBTL08GP053_REG_OP2_CTRL_EN_IP3_Msk (0x1U << CBTL08GP053_REG_OP2_CTRL_EN_IP3_Pos) /*!< 0x04 */
#define CBTL08GP053_REG_OP2_CTRL_EN_IP3 CBTL08GP053_REG_OP2_CTRL_EN_IP3_Msk /*!< */
/********************* Bit definition for OP3_CTRL register *****************/
#define CBTL08GP053_REG_OP3_CTRL_EN_IP4_Pos (3U)
#define CBTL08GP053_REG_OP3_CTRL_EN_IP4_Msk (0x1U << CBTL08GP053_REG_OP3_CTRL_EN_IP4_Pos) /*!< 0x08 */
#define CBTL08GP053_REG_OP3_CTRL_EN_IP4 CBTL08GP053_REG_OP3_CTRL_EN_IP4_Msk /*!< */
#define CBTL08GP053_REG_OP3_CTRL_EN_IP5_Pos (4U)
#define CBTL08GP053_REG_OP3_CTRL_EN_IP5_Msk (0x1U << CBTL08GP053_REG_OP3_CTRL_EN_IP5_Pos) /*!< 0x10 */
#define CBTL08GP053_REG_OP3_CTRL_EN_IP5 CBTL08GP053_REG_OP3_CTRL_EN_IP5_Msk /*!< */
#define CBTL08GP053_REG_OP3_CTRL_EN_IP6_Pos (5U)
#define CBTL08GP053_REG_OP3_CTRL_EN_IP6_Msk (0x1U << CBTL08GP053_REG_OP3_CTRL_EN_IP6_Pos) /*!< 0x20 */
#define CBTL08GP053_REG_OP3_CTRL_EN_IP6 CBTL08GP053_REG_OP3_CTRL_EN_IP6_Msk /*!< */
/********************* Bit definition for OP4_CTRL register *****************/
#define CBTL08GP053_REG_OP4_CTRL_EN_IP4_Pos (3U)
#define CBTL08GP053_REG_OP4_CTRL_EN_IP4_Msk (0x1U << CBTL08GP053_REG_OP4_CTRL_EN_IP4_Pos) /*!< 0x08 */
#define CBTL08GP053_REG_OP4_CTRL_EN_IP4 CBTL08GP053_REG_OP4_CTRL_EN_IP4_Msk /*!< */
#define CBTL08GP053_REG_OP4_CTRL_EN_IP5_Pos (4U)
#define CBTL08GP053_REG_OP4_CTRL_EN_IP5_Msk (0x1U << CBTL08GP053_REG_OP4_CTRL_EN_IP5_Pos) /*!< 0x10 */
#define CBTL08GP053_REG_OP4_CTRL_EN_IP5 CBTL08GP053_REG_OP4_CTRL_EN_IP5_Msk /*!< */
#define CBTL08GP053_REG_OP4_CTRL_EN_IP6_Pos (5U)
#define CBTL08GP053_REG_OP4_CTRL_EN_IP6_Msk (0x1U << CBTL08GP053_REG_OP4_CTRL_EN_IP6_Pos) /*!< 0x20 */
#define CBTL08GP053_REG_OP4_CTRL_EN_IP6 CBTL08GP053_REG_OP4_CTRL_EN_IP6_Msk /*!< */
/********************* Bit definition for OP5_CTRL register *****************/
#define CBTL08GP053_REG_OP5_CTRL_EN_IP7_Pos (6U)
#define CBTL08GP053_REG_OP5_CTRL_EN_IP7_Msk (0x1U << CBTL08GP053_REG_OP5_CTRL_EN_IP7_Pos) /*!< 0x40 */
#define CBTL08GP053_REG_OP5_CTRL_EN_IP7 CBTL08GP053_REG_OP5_CTRL_EN_IP7_Msk /*!< */
#define CBTL08GP053_REG_OP5_CTRL_EN_IP8_Pos (7U)
#define CBTL08GP053_REG_OP5_CTRL_EN_IP8_Msk (0x1U << CBTL08GP053_REG_OP5_CTRL_EN_IP8_Pos) /*!< 0x80 */
#define CBTL08GP053_REG_OP5_CTRL_EN_IP8 CBTL08GP053_REG_OP5_CTRL_EN_IP8_Msk /*!< */
/****************** Bit definition for CROSS5_CTRL register *****************/
#define CBTL08GP053_REG_CROSS5_PASS_Pos (0U)
#define CBTL08GP053_REG_CROSS5_PASS_Msk (0x1U << CBTL08GP053_REG_CROSS5_PASS_Pos) /*!< 0x01 */
#define CBTL08GP053_REG_CROSS5_PASS CBTL08GP053_REG_CROSS5_PASS_Msk /*!< */
#define CBTL08GP053_REG_CROSS5_CROSS_Pos (1U)
#define CBTL08GP053_REG_CROSS5_CROSS_Msk (0x1U << CBTL08GP053_REG_CROSS5_CROSS_Pos) /*!< 0x02 */
#define CBTL08GP053_REG_CROSS5_CROSS CBTL08GP053_REG_CROSS5_CROSS_Msk /*!< */
/******************* Bit definition for SW_CTRL register ********************/
#define CBTL08GP053_REG_SW_OP1_SET_Pos (0U)
#define CBTL08GP053_REG_SW_OP1_SET_Msk (0x1U << CBTL08GP053_REG_SW_OP1_SET_Pos) /*!< 0x01 */
#define CBTL08GP053_REG_SW_OP1_SET CBTL08GP053_REG_SW_OP1_SET_Msk /*!< */
#define CBTL08GP053_REG_SW_OP2_SET_Pos (1U)
#define CBTL08GP053_REG_SW_OP2_SET_Msk (0x1U << CBTL08GP053_REG_SW_OP2_SET_Pos) /*!< 0x02 */
#define CBTL08GP053_REG_SW_OP2_SET CBTL08GP053_REG_SW_OP2_SET_Msk /*!< */
#define CBTL08GP053_REG_SW_OP3_SET_Pos (2U)
#define CBTL08GP053_REG_SW_OP3_SET_Msk (0x1U << CBTL08GP053_REG_SW_OP3_SET_Pos) /*!< 0x04 */
#define CBTL08GP053_REG_SW_OP3_SET CBTL08GP053_REG_SW_OP3_SET_Msk /*!< */
#define CBTL08GP053_REG_SW_OP4_SET_Pos (3U)
#define CBTL08GP053_REG_SW_OP4_SET_Msk (0x1U << CBTL08GP053_REG_SW_OP4_SET_Pos) /*!< 0x08 */
#define CBTL08GP053_REG_SW_OP4_SET CBTL08GP053_REG_SW_OP4_SET_Msk /*!< */
#define CBTL08GP053_REG_SW_OP5_SET_Pos (4U)
#define CBTL08GP053_REG_SW_OP5_SET_Msk (0x1U << CBTL08GP053_REG_SW_OP5_SET_Pos) /*!< 0x10 */
#define CBTL08GP053_REG_SW_OP5_SET CBTL08GP053_REG_SW_OP5_SET_Msk /*!< */
#define CBTL08GP053_REG_SW_X5_SET_Pos (5U)
#define CBTL08GP053_REG_SW_X5_SET_Msk (0x1U << CBTL08GP053_REG_SW_X5_SET_Pos) /*!< 0x20 */
#define CBTL08GP053_REG_SW_X5_SET CBTL08GP053_REG_SW_X5_SET_Msk /*!< */
/******************** Bit definition for REVISION register ******************/
#define CBTL08GP053_REVISION_REV_ID_Pos (0U)
#define CBTL08GP053_REVISION_REV_ID_Msk (0xFFU << CBTL08GP053_REVISION_REV_ID_Pos) /*!< 0xFF */
#define CBTL08GP053_REVISION_REV_ID CBTL08GP053_REVISION_REV_ID_Msk /*!< */
/** @defgroup CBTL08GP053_DisplayPort_Alternate_Mode
* @{
*/
#define CBTL08GP053_DP_ALTMODE_DFP_D_C_E_NORMAL 0x00U
#define CBTL08GP053_DP_ALTMODE_DFP_D_C_E_FLIPPED 0x01U
#define CBTL08GP053_DP_ALTMODE_DFP_D_D_F_NORMAL 0x02U
#define CBTL08GP053_DP_ALTMODE_DFP_D_D_F_FLIPPED 0x03U
#define CBTL08GP053_DP_ALTMODE_UFP_D_C_NORMAL 0x04U
#define CBTL08GP053_DP_ALTMODE_UFP_D_C_FLIPPED 0x05U
#define CBTL08GP053_DP_ALTMODE_UFP_D_D_NORMAL 0x06U
#define CBTL08GP053_DP_ALTMODE_UFP_D_D_FLIPPED 0x07U
#define CBTL08GP053_DP_ALTMODE_UFP_D_E_NORMAL 0x08U
#define CBTL08GP053_DP_ALTMODE_UFP_D_E_FLIPPED 0x09U
/**
* @}
*/
/** @defgroup CBTL08GP053_DisplayPort_Standby_Mode
* @{
*/
#define CBTL08GP053_DP_STANDBYMODE_SAFE 0x00U
#define CBTL08GP053_DP_STANDBYMODE_USB3_NORMAL 0x01U
#define CBTL08GP053_DP_STANDBYMODE_USB3_FLIPPED 0x02U
/**
* @}
*/
/**
* @}
*/
#if defined(CBTL08GP053_DEBUG)
/** @defgroup CBTL08GP053_Exported_Structure CBTL08GP053 Exported Structure
* @{
*/
typedef union {
uint8_t Register;
struct {
uint8_t RESERVED :7;
uint8_t SWITCH_EN :1;
};
} CBTL08GP053_SysCtrlTypeDef;
typedef union {
uint8_t Register;
struct {
uint8_t IP1 :1;
uint8_t IP2 :1;
uint8_t IP3 :1;
uint8_t RESERVED :5;
};
} CBTL08GP053_Op1CtrlTypeDef;
typedef union {
uint8_t Register;
struct {
uint8_t IP1 :1;
uint8_t IP2 :1;
uint8_t IP3 :1;
uint8_t RESERVED :5;
};
} CBTL08GP053_Op2CtrlTypeDef;
typedef union {
uint8_t Register;
struct {
uint8_t RESERVED1 :3;
uint8_t IP4 :1;
uint8_t IP5 :1;
uint8_t IP6 :1;
uint8_t RESERVED2 :2;
};
} CBTL08GP053_Op3CtrlTypeDef;
typedef union {
uint8_t Register;
struct {
uint8_t RESERVED1 :3;
uint8_t IP4 :1;
uint8_t IP5 :1;
uint8_t IP6 :1;
uint8_t RESERVED2 :2;
};
} CBTL08GP053_Op4CtrlTypeDef;
typedef union {
uint8_t Register;
struct {
uint8_t RESERVED :6;
uint8_t IP7 :1;
uint8_t IP8 :1;
};
} CBTL08GP053_Op5CtrlTypeDef;
typedef union {
uint8_t Register;
struct {
uint8_t PASS :1;
uint8_t CROSS :1;
uint8_t RESERVED :6;
};
} CBTL08GP053_Cross5CtrlTypeDef;
typedef union {
uint8_t Register;
struct {
uint8_t OP1_SET :1;
uint8_t OP2_SET :1;
uint8_t OP3_SET :1;
uint8_t OP4_SET :1;
uint8_t OP5_SET :1;
uint8_t X5_SET :1;
uint8_t RESERVED :2;
};
} CBTL08GP053_SwCtrlTypeDef;
typedef struct
{
CBTL08GP053_SysCtrlTypeDef SysCtrl; /*!< SYS_CTRL register (0x01) */
CBTL08GP053_Op1CtrlTypeDef Op1Ctrl; /*!< OP1_CTRL Registers (0x02) */
CBTL08GP053_Op2CtrlTypeDef Op2Ctrl; /*!< OP2_CTRL Registers (0x03) */
CBTL08GP053_Op3CtrlTypeDef Op3Ctrl; /*!< OP3_CTRL Registers (0x04) */
CBTL08GP053_Op4CtrlTypeDef Op4Ctrl; /*!< OP4_CTRL Registers (0x05) */
CBTL08GP053_Op5CtrlTypeDef Op5Ctrl; /*!< OP5_CTRL Registers (0x06) */
CBTL08GP053_Cross5CtrlTypeDef Cross5Ctrl; /*!< CROSS5_CTRL Registers (0x07) */
CBTL08GP053_SwCtrlTypeDef SwCtrl; /*!< SW_CTRL Registers (0x08) */
uint8_t Revision; /*!< REVISION Registers (0x09) */
} CBTL08GP053_RegistersTypeDef;
/**
* @}
*/
#endif /* CBTL08GP053_DEBUG */
/** @defgroup CBTL08GP053_Exported_Functions
* @{
*/
/* USB Type-C Crosspoint Switch management functions */
uint32_t cbtl08gp053_Init(uint16_t Address);
void cbtl08gp053_DeInit(uint16_t Address);
uint32_t cbtl08gp053_PowerOn(uint16_t Address);
uint32_t cbtl08gp053_PowerOff(uint16_t Address);
uint32_t cbtl08gp053_SetMode(uint16_t Address, TYPECSWITCH_Mode_t Mode);
uint32_t cbtl08gp053_IsSupportedMode(TYPECSWITCH_Mode_t Mode);
/* MUX IO functions */
uint8_t MUX_IO_Init(void);
void MUX_IO_DeInit(void);
uint8_t MUX_IO_Write(uint16_t Addr, uint16_t Reg, uint8_t Data);
uint8_t MUX_IO_Read(uint16_t Addr, uint16_t Reg, uint8_t *pData);
uint32_t MUX_IO_IsDeviceReady(uint16_t DevAddress, uint32_t Trials);
/**
* @}
*/
/** @defgroup CBTL08GP053_Exported_Variables
* @{
*/
/* Type-C Crosspoint Switch Driver */
extern TYPECSWITCH_Drv_t cbtl08gp053_drv;
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* __CBTL08GP053_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,232 @@
<!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></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 HX8347D 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;
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: &quot;Arial&quot;,&quot;sans-serif&quot;; 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 HX8347D Component Drivers</h1>
<p style="text-align: center;">Copyright 2014
STMicroelectronics</p>
<p style="text-align: center;"><span style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;; 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: 229px;">V1.1.2 / 11-October-2018</h3>
</div>
<div class="topic3" id="changes">
<h4><b><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;"></span><u><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;"></span></u></b><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
Changes</span></u></b><o:p style="font-family: Helvetica,Arial,sans-serif;"></o:p></h4>
<span style="font-size: 12pt; font-family: Helvetica,Arial,sans-serif;"></span><span style="font-size: 11pt; color: rgb(0, 32, 96); font-family: Helvetica,Arial,sans-serif;" lang="EN-US"></span><span style="font-size: 10pt; font-family: Helvetica,Arial,sans-serif;"></span><span style="font-size: 10pt; font-family: Verdana;">Fix&nbsp;</span><small><span style="font-family: Verdana;" id="summary_container"><span id="short_desc_nonedit_display">HardFault issue in
hx8347d_DrawBitmap()</span></span></small><span style="font-size: 10pt; font-family: Helvetica,Arial,sans-serif;"></span>
<span style="font-size: 10pt; font-family: Helvetica,Arial,sans-serif;"></span></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: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;"></span></u></b><br>
<h3 style="width: 229px;">V1.1.1 / 24-November-2014</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-family: Verdana; font-size: 10pt;">hx8347d.h:
change </span><span style="font-family: Verdana; font-size: 10pt;">"\" by</span><span style="font-family: Verdana; font-size: 10pt;"> "/"&nbsp;</span><span style="font-family: Verdana; font-size: 10pt;"></span><span style="font-family: Verdana; font-size: 10pt;">in the</span><span style="font-family: Verdana; font-size: 10pt;"> include path
to fix compilation issue with Linux</span></li>
</ul>
<h3 style="width: 229px;">V1.1.0 / 11-July-2014</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-family: Verdana; font-size: 10pt;">Harmonize all
LCD controllers Link usage (change LCD_IO_WriteData() to
LCD_IO_WriteMultipleData())</span><span style="font-family: Verdana; font-size: 10pt;"></span></li>
</ul>
<h3 style="width: 229px;">V1.0.0 / 06-May-2014</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<span>&nbsp;</span></span><span style="font-size: 10pt; font-family: Verdana;">HX8347D LCD
Component</span><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"><span>&nbsp;</span>driver</span></li>
</ul>
<b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;"><o:p></o:p></span></u></b><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><br>
</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: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;"></span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"><span style="color: black;"></span></span>,
visit:&nbsp;<a href="http://www.st.com/STM32" target="_blank">www.st.com/STM32</a></p>
<br>
</div>
</div>
</body></html>

View file

@ -0,0 +1,485 @@
/**
******************************************************************************
* @file hx8347d.c
* @author MCD Application Team
* @brief This file includes the LCD driver for HX8347D LCD.
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</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 "hx8347d.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @addtogroup HX8347D
* @brief This file provides a set of functions needed to drive the
* HX8347D LCD.
* @{
*/
/** @defgroup HX8347D_Private_TypesDefinitions
* @{
*/
/**
* @}
*/
/** @defgroup HX8347D_Private_Defines
* @{
*/
/**
* @}
*/
/** @defgroup HX8347D_Private_Macros
* @{
*/
/**
* @}
*/
/** @defgroup HX8347D_Private_Variables
* @{
*/
LCD_DrvTypeDef hx8347d_drv =
{
hx8347d_Init,
hx8347d_ReadID,
hx8347d_DisplayOn,
hx8347d_DisplayOff,
hx8347d_SetCursor,
hx8347d_WritePixel,
hx8347d_ReadPixel,
hx8347d_SetDisplayWindow,
hx8347d_DrawHLine,
hx8347d_DrawVLine,
hx8347d_GetLcdPixelWidth,
hx8347d_GetLcdPixelHeight,
hx8347d_DrawBitmap,
};
static uint8_t Is_hx8347d_Initialized = 0;
static uint16_t ArrayRGB[320] = {0};
/**
* @}
*/
/** @defgroup HX8347D_Private_FunctionPrototypes
* @{
*/
/**
* @}
*/
/** @defgroup HX8347D_Private_Functions
* @{
*/
/**
* @brief Initialise the HX8347D LCD Component.
* @param None
* @retval None
*/
void hx8347d_Init(void)
{
if(Is_hx8347d_Initialized == 0)
{
Is_hx8347d_Initialized = 1;
/* Initialise HX8347D low level bus layer --------------------------------*/
LCD_IO_Init();
/* Driving ability setting */
hx8347d_WriteReg(LCD_REG_234, 0x00);
hx8347d_WriteReg(LCD_REG_235, 0x20);
hx8347d_WriteReg(LCD_REG_236, 0x0C);
hx8347d_WriteReg(LCD_REG_237, 0xC4);
hx8347d_WriteReg(LCD_REG_232, 0x40);
hx8347d_WriteReg(LCD_REG_233, 0x38);
hx8347d_WriteReg(LCD_REG_241, 0x01);
hx8347d_WriteReg(LCD_REG_242, 0x10);
hx8347d_WriteReg(LCD_REG_39, 0xA3);
/* Adjust the Gamma Curve */
hx8347d_WriteReg(LCD_REG_64, 0x01);
hx8347d_WriteReg(LCD_REG_65, 0x00);
hx8347d_WriteReg(LCD_REG_66, 0x00);
hx8347d_WriteReg(LCD_REG_67, 0x10);
hx8347d_WriteReg(LCD_REG_68, 0x0E);
hx8347d_WriteReg(LCD_REG_69, 0x24);
hx8347d_WriteReg(LCD_REG_70, 0x04);
hx8347d_WriteReg(LCD_REG_71, 0x50);
hx8347d_WriteReg(LCD_REG_72, 0x02);
hx8347d_WriteReg(LCD_REG_73, 0x13);
hx8347d_WriteReg(LCD_REG_74, 0x19);
hx8347d_WriteReg(LCD_REG_75, 0x19);
hx8347d_WriteReg(LCD_REG_76, 0x16);
hx8347d_WriteReg(LCD_REG_80, 0x1B);
hx8347d_WriteReg(LCD_REG_81, 0x31);
hx8347d_WriteReg(LCD_REG_82, 0x2F);
hx8347d_WriteReg(LCD_REG_83, 0x3F);
hx8347d_WriteReg(LCD_REG_84, 0x3F);
hx8347d_WriteReg(LCD_REG_85, 0x3E);
hx8347d_WriteReg(LCD_REG_86, 0x2F);
hx8347d_WriteReg(LCD_REG_87, 0x7B);
hx8347d_WriteReg(LCD_REG_88, 0x09);
hx8347d_WriteReg(LCD_REG_89, 0x06);
hx8347d_WriteReg(LCD_REG_90, 0x06);
hx8347d_WriteReg(LCD_REG_91, 0x0C);
hx8347d_WriteReg(LCD_REG_92, 0x1D);
hx8347d_WriteReg(LCD_REG_93, 0xCC);
/* Power voltage setting */
hx8347d_WriteReg(LCD_REG_27, 0x1B);
hx8347d_WriteReg(LCD_REG_26, 0x01);
hx8347d_WriteReg(LCD_REG_36, 0x2F);
hx8347d_WriteReg(LCD_REG_37, 0x57);
/*****VCOM offset ****/
hx8347d_WriteReg(LCD_REG_35, 0x86);
/* Power on setting up flow */
hx8347d_WriteReg(LCD_REG_24, 0x36); /* Display frame rate = 70Hz RADJ = '0110' */
hx8347d_WriteReg(LCD_REG_25, 0x01); /* OSC_EN = 1 */
hx8347d_WriteReg(LCD_REG_28, 0x06); /* AP[2:0] = 111 */
hx8347d_WriteReg(LCD_REG_29, 0x06); /* AP[2:0] = 111 */
hx8347d_WriteReg(LCD_REG_31,0x90); /* GAS=1, VOMG=00, PON=1, DK=0, XDK=0, DVDH_TRI=0, STB=0*/
hx8347d_WriteReg(LCD_REG_39, 1); /* REF = 1 */
LCD_Delay(10);
/* 262k/65k color selection */
hx8347d_WriteReg(LCD_REG_23, 0x05); /* default 0x06 262k color, 0x05 65k color */
/* SET PANEL */
hx8347d_WriteReg(LCD_REG_54, 0x09); /* SS_PANEL = 1, GS_PANEL = 0,REV_PANEL = 0, BGR_PANEL = 1 */
/* Display ON flow */
hx8347d_WriteReg(LCD_REG_40, 0x38); /* GON=1, DTE=1, D=10 */
LCD_Delay(60);
hx8347d_WriteReg(LCD_REG_40, 0x3C); /* GON=1, DTE=1, D=11 */
/* Set GRAM Area - Partial Display Control */
hx8347d_WriteReg(LCD_REG_1, 0x00); /* DP_STB = 0, DP_STB_S = 0, SCROLL = 0, */
hx8347d_WriteReg(LCD_REG_2, 0x00); /* Column address start 2 */
hx8347d_WriteReg(LCD_REG_3, 0x00); /* Column address start 1 */
hx8347d_WriteReg(LCD_REG_4, 0x01); /* Column address end 2 */
hx8347d_WriteReg(LCD_REG_5, 0x3F); /* Column address end 1 */
hx8347d_WriteReg(LCD_REG_6, 0x00); /* Row address start 2 */
hx8347d_WriteReg(LCD_REG_7, 0x00); /* Row address start 2 */
hx8347d_WriteReg(LCD_REG_8, 0x00); /* Row address end 2 */
hx8347d_WriteReg(LCD_REG_9, 0xEF); /* Row address end 1 */
hx8347d_WriteReg(LCD_REG_22, 0xE0); /* Memory access control: MY = 1, MX = 0, MV = 1, ML = 0 */
}
/* Set the Cursor */
hx8347d_SetCursor(0, 0);
/* Prepare to write GRAM */
LCD_IO_WriteReg(LCD_REG_34);
}
/**
* @brief Enables the Display.
* @param None
* @retval None
*/
void hx8347d_DisplayOn(void)
{
/* Power On sequence ---------------------------------------------------------*/
hx8347d_WriteReg(LCD_REG_24, 0x36); /* Display frame rate = 70Hz RADJ = '0110' */
hx8347d_WriteReg(LCD_REG_25, 0x01); /* OSC_EN = 1 */
hx8347d_WriteReg(LCD_REG_28, 0x06); /* AP[2:0] = 111 */
hx8347d_WriteReg(LCD_REG_31,0x90); /* GAS=1, VOMG=00, PON=1, DK=0, XDK=0, DVDH_TRI=0, STB=0*/
LCD_Delay(10);
/* 262k/65k color selection */
hx8347d_WriteReg(LCD_REG_23, 0x05); /* default 0x06 262k color, 0x05 65k color */
/* SET PANEL */
hx8347d_WriteReg(LCD_REG_54, 0x09); /* SS_PANEL = 1, GS_PANEL = 0,REV_PANEL = 0, BGR_PANEL = 1 */
/* Display On */
hx8347d_WriteReg(LCD_REG_40, 0x38);
LCD_Delay(60);
hx8347d_WriteReg(LCD_REG_40, 0x3C);
}
/**
* @brief Disables the Display.
* @param None
* @retval None
*/
void hx8347d_DisplayOff(void)
{
/* Power Off sequence ---------------------------------------------------------*/
hx8347d_WriteReg(LCD_REG_23, 0x0000); /* default 0x06 262k color, 0x05 65k color */
hx8347d_WriteReg(LCD_REG_24, 0x0000); /* Display frame rate = 70Hz RADJ = '0110' */
hx8347d_WriteReg(LCD_REG_25, 0x0000); /* OSC_EN = 1 */
hx8347d_WriteReg(LCD_REG_28, 0x0000); /* AP[2:0] = 111 */
hx8347d_WriteReg(LCD_REG_31, 0x0000); /* GAS=1, VOMG=00, PON=1, DK=0, XDK=0, DVDH_TRI=0, STB=0*/
hx8347d_WriteReg(LCD_REG_54, 0x0000); /* SS_PANEL = 1, GS_PANEL = 0,REV_PANEL = 0, BGR_PANEL = 1 */
/* Display Off */
hx8347d_WriteReg(LCD_REG_40, 0x38);
LCD_Delay(60);
hx8347d_WriteReg(LCD_REG_40, 0x04);
}
/**
* @brief Get the LCD pixel Width.
* @param None
* @retval The Lcd Pixel Width
*/
uint16_t hx8347d_GetLcdPixelWidth(void)
{
return (uint16_t)HX8347D_LCD_PIXEL_WIDTH;
}
/**
* @brief Get the LCD pixel Height.
* @param None
* @retval The Lcd Pixel Height
*/
uint16_t hx8347d_GetLcdPixelHeight(void)
{
return (uint16_t)HX8347D_LCD_PIXEL_HEIGHT;
}
/**
* @brief Get the HX8347D ID.
* @param None
* @retval The HX8347D ID
*/
uint16_t hx8347d_ReadID(void)
{
if(Is_hx8347d_Initialized == 0)
{
hx8347d_Init();
Is_hx8347d_Initialized = 1;
}
return (hx8347d_ReadReg(0x00));
}
/**
* @brief Set Cursor position.
* @param Xpos: specifies the X position.
* @param Ypos: specifies the Y position.
* @retval None
*/
void hx8347d_SetCursor(uint16_t Xpos, uint16_t Ypos)
{
hx8347d_WriteReg(LCD_REG_6, 0x00);
hx8347d_WriteReg(LCD_REG_7, Xpos);
hx8347d_WriteReg(LCD_REG_2, Ypos >> 8);
hx8347d_WriteReg(LCD_REG_3, Ypos & 0xFF);
}
/**
* @brief Write pixel.
* @param Xpos: specifies the X position.
* @param Ypos: specifies the Y position.
* @param RGBCode: the RGB pixel color
* @retval None
*/
void hx8347d_WritePixel(uint16_t Xpos, uint16_t Ypos, uint16_t RGBCode)
{
/* Set Cursor */
hx8347d_SetCursor(Xpos, Ypos);
/* Prepare to write GRAM */
LCD_IO_WriteReg(LCD_REG_34);
/* Write 16-bit GRAM Reg */
LCD_IO_WriteMultipleData((uint8_t*)&RGBCode, 2);
}
/**
* @brief Read pixel.
* @param None
* @retval the RGB pixel color
*/
uint16_t hx8347d_ReadPixel(uint16_t Xpos, uint16_t Ypos)
{
/* Set Cursor */
hx8347d_SetCursor(Xpos, Ypos);
/* Dummy read */
LCD_IO_ReadData(LCD_REG_34);
/* Read 16-bit Reg */
return (LCD_IO_ReadData(LCD_REG_34));
}
/**
* @brief Writes to the selected LCD register.
* @param LCDReg: address of the selected register.
* @param LCDRegValue: value to write to the selected register.
* @retval None
*/
void hx8347d_WriteReg(uint8_t LCDReg, uint16_t LCDRegValue)
{
LCD_IO_WriteReg(LCDReg);
/* Write 16-bit GRAM Reg */
LCD_IO_WriteMultipleData((uint8_t*)&LCDRegValue, 2);
}
/**
* @brief Reads the selected LCD Register.
* @param LCDReg: address of the selected register.
* @retval LCD Register Value.
*/
uint16_t hx8347d_ReadReg(uint8_t LCDReg)
{
/* Read 16-bit Reg */
return (LCD_IO_ReadData(LCDReg));
}
/**
* @brief Sets a display window
* @param Xpos: specifies the X bottom left position.
* @param Ypos: specifies the Y bottom left position.
* @param Height: display window height.
* @param Width: display window width.
* @retval None
*/
void hx8347d_SetDisplayWindow(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height)
{
/* Horizontal GRAM Start Address */
hx8347d_WriteReg(LCD_REG_6, (Xpos) >> 8); /* SP */
hx8347d_WriteReg(LCD_REG_7, (Xpos) & 0xFF); /* SP */
/* Horizontal GRAM End Address */
hx8347d_WriteReg(LCD_REG_8, (Xpos + Height - 1) >> 8); /* EP */
hx8347d_WriteReg(LCD_REG_9, (Xpos + Height - 1) & 0xFF); /* EP */
/* Vertical GRAM Start Address */
hx8347d_WriteReg(LCD_REG_2, (Ypos) >> 8); /* SC */
hx8347d_WriteReg(LCD_REG_3, (Ypos) & 0xFF); /* SC */
/* Vertical GRAM End Address */
hx8347d_WriteReg(LCD_REG_4, (Ypos + Width - 1) >> 8); /* EC */
hx8347d_WriteReg(LCD_REG_5, (Ypos + Width - 1) & 0xFF); /* EC */
}
/**
* @brief Draw vertical line.
* @param RGBCode: Specifies the RGB color
* @param Xpos: specifies the X position.
* @param Ypos: specifies the Y position.
* @param Length: specifies the Line length.
* @retval None
*/
void hx8347d_DrawHLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length)
{
uint32_t i = 0;
/* Set Cursor */
hx8347d_SetCursor(Xpos, Ypos);
/* Prepare to write GRAM */
LCD_IO_WriteReg(LCD_REG_34);
/* Sent a complete line */
for(i = 0; i < Length; i++)
{
ArrayRGB[i] = RGBCode;
}
LCD_IO_WriteMultipleData((uint8_t*)&ArrayRGB[0], Length * 2);
}
/**
* @brief Draw vertical line.
* @param RGBCode: Specifies the RGB color
* @param Xpos: specifies the X position.
* @param Ypos: specifies the Y position.
* @param Length: specifies the Line length.
* @retval None
*/
void hx8347d_DrawVLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length)
{
uint16_t counter = 0;
/* Set Cursor */
hx8347d_SetCursor(Xpos, Ypos);
/* Prepare to write GRAM */
LCD_IO_WriteReg(LCD_REG_34);
/* Fill a complete vertical line */
for(counter = 0; counter < Length; counter++)
{
ArrayRGB[counter] = RGBCode;
}
/* Write 16-bit GRAM Reg */
LCD_IO_WriteMultipleData((uint8_t*)&ArrayRGB[0], Length * 2);
}
/**
* @brief Displays a bitmap picture loaded in the internal Flash.
* @param BmpAddress: Bmp picture address in the internal Flash.
* @retval None
*/
void hx8347d_DrawBitmap(uint16_t Xpos, uint16_t Ypos, uint8_t *pbmp)
{
uint32_t index = 0, size = 0;
/* Read bitmap size */
size = pbmp[2] + (pbmp[3] << 8) + (pbmp[4] << 16) + (pbmp[5] << 24);
/* Get bitmap data address offset */
index = pbmp[10] + (pbmp[11] << 8) + (pbmp[12] << 16) + (pbmp[13] << 24);
size = (size - index)/2;
pbmp += index;
/* Set GRAM write direction and BGR = 0 */
/* Memory access control: MY = 1, MX = 0, MV = 1, ML = 0 */
hx8347d_WriteReg(LCD_REG_22, 0xA0);
/* Set Cursor */
hx8347d_SetCursor(Xpos, Ypos);
/* Prepare to write GRAM */
LCD_IO_WriteReg(LCD_REG_34);
LCD_IO_WriteMultipleData((uint8_t*)pbmp, size*2);
/* Set GRAM write direction and BGR = 0 */
/* Memory access control: MY = 1, MX = 1, MV = 1, ML = 0 */
hx8347d_WriteReg(LCD_REG_22, 0xE0);
}
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,259 @@
/**
******************************************************************************
* @file hx8347d.h
* @author MCD Application Team
* @brief This file contains all the functions prototypes for the hx8347d.c
* driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</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 HX8347D_H
#define HX8347D_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "../Common/lcd.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @addtogroup HX8347D
* @{
*/
/** @defgroup HX8347D_Exported_Types
* @{
*/
/**
* @}
*/
/** @defgroup HX8347D_Exported_Constants
* @{
*/
/**
* @brief HX8347D ID
*/
#define HX8347D_ID 0x0047
/**
* @brief HX8347D Size
*/
#define HX8347D_LCD_PIXEL_WIDTH ((uint16_t)320)
#define HX8347D_LCD_PIXEL_HEIGHT ((uint16_t)240)
/**
* @brief HX8347D Registers
*/
#define LCD_REG_0 0x00
#define LCD_REG_1 0x01
#define LCD_REG_2 0x02
#define LCD_REG_3 0x03
#define LCD_REG_4 0x04
#define LCD_REG_5 0x05
#define LCD_REG_6 0x06
#define LCD_REG_7 0x07
#define LCD_REG_8 0x08
#define LCD_REG_9 0x09
#define LCD_REG_10 0x0A
#define LCD_REG_12 0x0C
#define LCD_REG_13 0x0D
#define LCD_REG_14 0x0E
#define LCD_REG_15 0x0F
#define LCD_REG_16 0x10
#define LCD_REG_17 0x11
#define LCD_REG_18 0x12
#define LCD_REG_19 0x13
#define LCD_REG_20 0x14
#define LCD_REG_21 0x15
#define LCD_REG_22 0x16
#define LCD_REG_23 0x17
#define LCD_REG_24 0x18
#define LCD_REG_25 0x19
#define LCD_REG_26 0x1A
#define LCD_REG_27 0x1B
#define LCD_REG_28 0x1C
#define LCD_REG_29 0x1D
#define LCD_REG_30 0x1E
#define LCD_REG_31 0x1F
#define LCD_REG_32 0x20
#define LCD_REG_33 0x21
#define LCD_REG_34 0x22
#define LCD_REG_35 0x23
#define LCD_REG_36 0x24
#define LCD_REG_37 0x25
#define LCD_REG_39 0x27
#define LCD_REG_40 0x28
#define LCD_REG_41 0x29
#define LCD_REG_43 0x2B
#define LCD_REG_45 0x2D
#define LCD_REG_48 0x30
#define LCD_REG_49 0x31
#define LCD_REG_50 0x32
#define LCD_REG_51 0x33
#define LCD_REG_52 0x34
#define LCD_REG_53 0x35
#define LCD_REG_54 0x36
#define LCD_REG_55 0x37
#define LCD_REG_56 0x38
#define LCD_REG_57 0x39
#define LCD_REG_59 0x3B
#define LCD_REG_60 0x3C
#define LCD_REG_61 0x3D
#define LCD_REG_62 0x3E
#define LCD_REG_63 0x3F
#define LCD_REG_64 0x40
#define LCD_REG_65 0x41
#define LCD_REG_66 0x42
#define LCD_REG_67 0x43
#define LCD_REG_68 0x44
#define LCD_REG_69 0x45
#define LCD_REG_70 0x46
#define LCD_REG_71 0x47
#define LCD_REG_72 0x48
#define LCD_REG_73 0x49
#define LCD_REG_74 0x4A
#define LCD_REG_75 0x4B
#define LCD_REG_76 0x4C
#define LCD_REG_77 0x4D
#define LCD_REG_78 0x4E
#define LCD_REG_79 0x4F
#define LCD_REG_80 0x50
#define LCD_REG_81 0x51
#define LCD_REG_82 0x52
#define LCD_REG_83 0x53
#define LCD_REG_84 0x54
#define LCD_REG_85 0x55
#define LCD_REG_86 0x56
#define LCD_REG_87 0x57
#define LCD_REG_88 0x58
#define LCD_REG_89 0x59
#define LCD_REG_90 0x5A
#define LCD_REG_91 0x5B
#define LCD_REG_92 0x5C
#define LCD_REG_93 0x5D
#define LCD_REG_96 0x60
#define LCD_REG_97 0x61
#define LCD_REG_106 0x6A
#define LCD_REG_118 0x76
#define LCD_REG_128 0x80
#define LCD_REG_129 0x81
#define LCD_REG_130 0x82
#define LCD_REG_131 0x83
#define LCD_REG_132 0x84
#define LCD_REG_133 0x85
#define LCD_REG_134 0x86
#define LCD_REG_135 0x87
#define LCD_REG_136 0x88
#define LCD_REG_137 0x89
#define LCD_REG_139 0x8B
#define LCD_REG_140 0x8C
#define LCD_REG_141 0x8D
#define LCD_REG_143 0x8F
#define LCD_REG_144 0x90
#define LCD_REG_145 0x91
#define LCD_REG_146 0x92
#define LCD_REG_147 0x93
#define LCD_REG_148 0x94
#define LCD_REG_149 0x95
#define LCD_REG_150 0x96
#define LCD_REG_151 0x97
#define LCD_REG_152 0x98
#define LCD_REG_153 0x99
#define LCD_REG_154 0x9A
#define LCD_REG_157 0x9D
#define LCD_REG_192 0xC0
#define LCD_REG_193 0xC1
#define LCD_REG_227 0xE3
#define LCD_REG_229 0xE5
#define LCD_REG_231 0xE7
#define LCD_REG_239 0xEF
#define LCD_REG_232 0xE8
#define LCD_REG_233 0xE9
#define LCD_REG_234 0xEA
#define LCD_REG_235 0xEB
#define LCD_REG_236 0xEC
#define LCD_REG_237 0xED
#define LCD_REG_241 0xF1
#define LCD_REG_242 0xF2
/**
* @}
*/
/** @defgroup HX8347D_Exported_Functions
* @{
*/
void hx8347d_Init(void);
uint16_t hx8347d_ReadID(void);
void hx8347d_WriteReg(uint8_t LCDReg, uint16_t LCDRegValue);
uint16_t hx8347d_ReadReg(uint8_t LCDReg);
void hx8347d_DisplayOn(void);
void hx8347d_DisplayOff(void);
void hx8347d_SetCursor(uint16_t Xpos, uint16_t Ypos);
void hx8347d_WritePixel(uint16_t Xpos, uint16_t Ypos, uint16_t RGBCode);
uint16_t hx8347d_ReadPixel(uint16_t Xpos, uint16_t Ypos);
void hx8347d_DrawHLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length);
void hx8347d_DrawVLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length);
void hx8347d_DrawBitmap(uint16_t Xpos, uint16_t Ypos, uint8_t *pbmp);
void hx8347d_SetDisplayWindow(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height);
uint16_t hx8347d_GetLcdPixelWidth(void);
uint16_t hx8347d_GetLcdPixelHeight(void);
/* LCD driver structure */
extern LCD_DrvTypeDef hx8347d_drv;
/* LCD IO functions */
void LCD_IO_Init(void);
void LCD_IO_WriteMultipleData(uint8_t *pData, uint32_t Size);
void LCD_IO_WriteReg(uint8_t Reg);
uint16_t LCD_IO_ReadData(uint16_t Reg);
void LCD_Delay (uint32_t delay);
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* HX8347D_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,74 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta charset="utf-8" />
<meta name="generator" content="pandoc" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<title>Release Notes for SN65DP141 Component Drivers</title>
<style type="text/css">
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
span.underline{text-decoration: underline;}
div.column{display: inline-block; vertical-align: top; width: 50%;}
</style>
<link rel="stylesheet" href="../../../../_htmresc/mini-st.css" />
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
<![endif]-->
</head>
<body>
<div class="row">
<div class="col-sm-12 col-lg-4">
<div class="card fluid">
<div class="sectione dark">
<center>
<h1 id="release-notes-for-sn65dp141-component-drivers"><small>Release Notes for</small> <mark>SN65DP141 Component Drivers</mark></h1>
<p>Copyright © 2017 STMicroelectronics<br />
</p>
<a href="https://www.st.com" class="logo"><img src="../../../../_htmresc/st_logo.png" alt="ST logo" /></a>
</center>
</div>
</div>
<h1 id="license">License</h1>
<p>Licensed by ST under BSD 3-Clause license (the "License"). You may not use this package except in compliance with the License. You may obtain a copy of the License at:</p>
<p><a href="https://opensource.org/licenses/BSD-3-Clause">https://opensource.org/licenses/BSD-3-Clause</a></p>
<h1 id="purpose">Purpose</h1>
<p>This directory contains the SN65DP141 component drivers.</p>
</div>
<div class="col-sm-12 col-lg-8">
<h1 id="update-history">Update History</h1>
<div class="collapse">
<input type="checkbox" id="collapse-section13" checked aria-hidden="true"> <label for="collapse-section13" aria-hidden="true">V1.0.2 / 23-July-2020</label>
<div>
<h2 id="main-changes">Main Changes</h2>
<ul>
<li>Update release notes format</li>
<li>Correct misspelled words</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section12" aria-hidden="true"> <label for="collapse-section12" aria-hidden="true">V1.0.1 / 10-October-2018</label>
<div>
<h2 id="main-changes-1">Main Changes</h2>
<ul>
<li>Fix compilation warnings detected by IAR V8.30.1</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section11" aria-hidden="true"> <label for="collapse-section11" aria-hidden="true">V1.0.0 / 16-November-2017</label>
<div>
<h2 id="main-changes-2">Main Changes</h2>
<ul>
<li>First official release of SN65DP141 Component driver</li>
</ul>
</div>
</div>
</div>
</div>
<footer class="sticky">
For complete documentation on <mark>STM32 Microcontrollers</mark> , visit: <a href="http://www.st.com/STM32">http://www.st.com/STM32</a>
</footer>
</body>
</html>

View file

@ -0,0 +1,346 @@
/**
******************************************************************************
* @file sn65dp141.c
* @author MCD Application Team
* @brief This file provides a set of functions needed to manage the SN65DP141
* DisplayPort Linear Redriver.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2017 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 "sn65dp141.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @defgroup SN65DP141
* @brief This file provides a set of functions needed to drive the
* SN65DP141 DisplayPort Linear Redriver.
* @{
*/
/** @defgroup SN65DP141_Private_TypesDefinitions
* @{
*/
/**
* @}
*/
/** @defgroup SN65DP141_Private_Defines
* @{
*/
/**
* @}
*/
/** @defgroup SN65DP141_Private_Macros
* @{
*/
/**
* @}
*/
/** @defgroup SN65DP141_Private_Variables
* @{
*/
/* DisplayPort Linear Redriver Driver structure initialization */
DPREDRIVER_Drv_t sn65dp141_drv =
{
sn65dp141_Init,
sn65dp141_DeInit,
sn65dp141_PowerOn,
sn65dp141_PowerOff,
sn65dp141_SetEQGain,
sn65dp141_EnableChannel,
sn65dp141_DisableChannel
};
/**
* @}
*/
/** @defgroup SN65DP141_Private_FunctionPrototypes
* @{
*/
/**
* @}
*/
/** @defgroup SN65DP141_Private_Functions
* @{
*/
/**
* @brief Initialize the SN65DP141 and configure the needed hardware resources.
* @param Address Device address on communication Bus.
* @retval None
*/
uint32_t sn65dp141_Init(uint16_t Address)
{
uint32_t err_count = 0;
/* Low level init */
err_count += MUX_IO_Init();
/* Restore SN65DP141 registers reset values */
err_count += MUX_IO_Write(Address, SN65DP141_REG_CFG, 0x00);
err_count += MUX_IO_Write(Address, SN65DP141_REG_CHEN, 0x00);
err_count += MUX_IO_Write(Address, SN65DP141_REG_CH0_CFG, 0x00);
err_count += MUX_IO_Write(Address, SN65DP141_REG_CH0_EN, 0x00);
err_count += MUX_IO_Write(Address, SN65DP141_REG_CH1_CFG, 0x00);
err_count += MUX_IO_Write(Address, SN65DP141_REG_CH1_EN, 0x00);
err_count += MUX_IO_Write(Address, SN65DP141_REG_CH2_CFG, 0x00);
err_count += MUX_IO_Write(Address, SN65DP141_REG_CH2_EN, 0x00);
err_count += MUX_IO_Write(Address, SN65DP141_REG_CH3_CFG, 0x00);
err_count += MUX_IO_Write(Address, SN65DP141_REG_CH3_EN, 0x00);
return err_count;
}
/**
* @brief Release the hardware resources required to use the SN65DP141
* @param Address SN65DP141 address on communication Bus.
* @retval none
*/
void sn65dp141_DeInit(uint16_t Address)
{
/* Restore SN65DP141 registers reset values */
MUX_IO_Write(Address, SN65DP141_REG_CFG, 0x00);
MUX_IO_Write(Address, SN65DP141_REG_CHEN, 0x00);
MUX_IO_Write(Address, SN65DP141_REG_CH0_CFG, 0x00);
MUX_IO_Write(Address, SN65DP141_REG_CH0_EN, 0x00);
MUX_IO_Write(Address, SN65DP141_REG_CH1_CFG, 0x00);
MUX_IO_Write(Address, SN65DP141_REG_CH1_EN, 0x00);
MUX_IO_Write(Address, SN65DP141_REG_CH2_CFG, 0x00);
MUX_IO_Write(Address, SN65DP141_REG_CH2_EN, 0x00);
MUX_IO_Write(Address, SN65DP141_REG_CH3_CFG, 0x00);
MUX_IO_Write(Address, SN65DP141_REG_CH3_EN, 0x00);
/* Low level de-init */
MUX_IO_DeInit();
}
/**
* @brief Power on the SN65DP141.
* @param Address SN65DP141 address on communication Bus.
* @retval 0: successful, else failed
*/
uint32_t sn65dp141_PowerOn(uint16_t Address)
{
uint32_t err_count = 0;
uint8_t cfg;
/* Read General Device Settings register*/
err_count += MUX_IO_Read(Address, SN65DP141_REG_CFG, &cfg);
/* Clear PWRDOWN bit of General Device Settings register */
cfg &= ~SN65DP141_REG_CFG_PWRDOWN;
err_count += MUX_IO_Write(Address, SN65DP141_REG_CFG, cfg);
return err_count;
}
/**
* @brief Power down the SN65DP141.
* @param Address SN65DP141 address on communication Bus.
* @retval 0: successful, else failed
*/
uint32_t sn65dp141_PowerOff(uint16_t Address)
{
uint32_t err_count = 0;
uint8_t cfg;
/* Read General Device Settings register*/
err_count += MUX_IO_Read(Address, SN65DP141_REG_CFG, &cfg);
/* Set PWRDOWN bit of General Device Settings register */
cfg |= SN65DP141_REG_CFG_PWRDOWN;
err_count += MUX_IO_Write(Address, SN65DP141_REG_CFG, cfg);
return err_count;
}
/**
* @brief Set the equalizer gain for a given channel.
* @param Address SN65DP141 address on communication Bus.
* @param ChannelId Channel identifier.
* This parameter can be take one of the following values:
* CHANNEL_DP0
* CHANNEL_DP1
* CHANNEL_DP2
* CHANNEL_DP3
* @param EQGain Equalizer gain.
* This parameter must be a value between 0x00 and 0x07.
* @retval 0: successful, else failed
*/
uint32_t sn65dp141_SetEQGain(uint16_t Address,
DPREDRIVER_ChannelId_t ChannelId,
uint8_t EQGain)
{
uint32_t err_count = 0;
uint8_t chctrl;
uint8_t cfg;
switch(ChannelId)
{
case CHANNEL_DP0:
cfg = SN65DP141_REG_CH0_CFG;
break;
case CHANNEL_DP1:
cfg = SN65DP141_REG_CH1_CFG;
break;
case CHANNEL_DP2:
cfg = SN65DP141_REG_CH2_CFG;
break;
case CHANNEL_DP3:
cfg = SN65DP141_REG_CH3_CFG;
break;
default:
cfg = SN65DP141_REG_CH0_CFG;
break;
}
/* Read Channel x Control Settings register */
err_count += MUX_IO_Read(Address, cfg, &chctrl);
/* Set the equalizer gain bit field (EQ setting) for concerned channel */
chctrl = (chctrl & (~(uint8_t)SN65DP141_REG_CHxCFG_EQ_SETTING_Msk)) | (EQGain << SN65DP141_REG_CHxCFG_EQ_SETTING_Pos);
/* Enable Max gain for TX & RX */
chctrl |= SN65DP141_REG_CHxCFG_RX_GAIN_1 | SN65DP141_REG_CHxCFG_EQ_DC_GAIN | SN65DP141_REG_CHxCFG_TX_GAIN;
/* Update Channel x Control Settings register */
err_count += MUX_IO_Write(Address, cfg, chctrl);
return err_count;
}
/**
* @brief Enable a DP channel.
* @param Address SN65DP141 address on communication Bus.
* @param ChannelId Channel identifier.
* This parameter can be take one of the following values:
* CHANNEL_DP0
* CHANNEL_DP1
* CHANNEL_DP2
* CHANNEL_DP3
* @retval 0: successful, else failed
*/
uint32_t sn65dp141_EnableChannel(uint16_t Address,
DPREDRIVER_ChannelId_t ChannelId)
{
uint32_t err_count = 0;
uint8_t chen;
/* Read Channel Enable register */
err_count += MUX_IO_Read(Address, SN65DP141_REG_CHEN, &chen);
/* Clear LN_EN_CHx bit of Channel Enable register */
switch(ChannelId)
{
case CHANNEL_DP0:
chen &= ~SN65DP141_REG_CHEN_LN_EN_CH0;
break;
case CHANNEL_DP1:
chen &= ~SN65DP141_REG_CHEN_LN_EN_CH1;
break;
case CHANNEL_DP2:
chen &= ~SN65DP141_REG_CHEN_LN_EN_CH2;
break;
case CHANNEL_DP3:
chen &= ~SN65DP141_REG_CHEN_LN_EN_CH3;
break;
default:
/* Nothing to do */
break;
}
err_count += MUX_IO_Write(Address, SN65DP141_REG_CHEN, chen);
return err_count;
}
/**
* @brief Disable a DP channel.
* @param Address SN65DP141 address on communication Bus.
* @param ChannelId Channel identifier.
* This parameter can be take one of the following values:
* CHANNEL_DP0
* CHANNEL_DP1
* CHANNEL_DP2
* CHANNEL_DP3
* @retval 0: successful, else failed
*/
uint32_t sn65dp141_DisableChannel(uint16_t Address,
DPREDRIVER_ChannelId_t ChannelId)
{
uint32_t err_count = 0;
uint8_t chen;
/* Read Channel Enable register */
err_count += MUX_IO_Read(Address, SN65DP141_REG_CHEN, &chen);
/* Set LN_EN_CHx bit of Channel Enable register */
switch(ChannelId)
{
case CHANNEL_DP0:
chen |= SN65DP141_REG_CHEN_LN_EN_CH0;
break;
case CHANNEL_DP1:
chen |= SN65DP141_REG_CHEN_LN_EN_CH1;
break;
case CHANNEL_DP2:
chen |= SN65DP141_REG_CHEN_LN_EN_CH2;
break;
case CHANNEL_DP3:
chen |= SN65DP141_REG_CHEN_LN_EN_CH3;
break;
default:
/* Nothing to do */
break;
}
err_count += MUX_IO_Write(Address, SN65DP141_REG_CHEN, chen);
return err_count;
}
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,395 @@
/**
******************************************************************************
* @file sn65dp141.h
* @author MCD Application Team
* @brief Header for sn65dp141.h module
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2017 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 SN65DP141_H
#define SN65DP141_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include <stdint.h>
#include "../Common/dpredriver.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @addtogroup SN65DP141
* @{
*/
/** @defgroup SN65DP141_Exported_Constants
* @{
*/
/******************************* Register Map ********************************/
#define SN65DP141_REG_CFG 0x00 /*!< General Device Settings register */
#define SN65DP141_REG_CHEN 0x01 /*!< Channel Enable register */
#define SN65DP141_REG_CH0_CFG 0x02 /*!< Channel 0 Control Settings register */
#define SN65DP141_REG_CH0_EN 0x03 /*!< Channel 0 Enable Settings register */
#define SN65DP141_REG_CH1_CFG 0x05 /*!< Channel 1 Control Settings register */
#define SN65DP141_REG_CH1_EN 0x06 /*!< Channel 1 Enable Settings register */
#define SN65DP141_REG_CH2_CFG 0x08 /*!< Channel 2 Control Settings register */
#define SN65DP141_REG_CH2_EN 0x09 /*!< Channel 2 Enable Settings register */
#define SN65DP141_REG_CH3_CFG 0x0B /*!< Channel 3 Control Settings register */
#define SN65DP141_REG_CH3_EN 0x0C /*!< Channel 3 Enable Settings register */
/*********** Bit definition for General Device Settings register *************/
#define SN65DP141_REG_CFG_EQ_MODE_Pos (1U)
#define SN65DP141_REG_CFG_EQ_MODE_Msk (0x1U << SN65DP141_REG_CFG_EQ_MODE_Pos) /*!< 0x04*/
#define SN65DP141_REG_CFG_EQ_MODE SN65DP141_REG_CFG_EQ_MODE_Msk /*!< EQ mode (Cable mode v.s. Trace mode) */
#define SN65DP141_REG_CFG_SYNC_ALL_Pos (3U)
#define SN65DP141_REG_CFG_SYNC_ALL_Msk (0x1U << SN65DP141_REG_CFG_SYNC_ALL_Pos) /*!< 0x08*/
#define SN65DP141_REG_CFG_SYNC_ALL SN65DP141_REG_CFG_SYNC_ALL_Msk /*!< All settings from channel 1 will be used on all channels */
#define SN65DP141_REG_CFG_SYNC_23_Pos (4U)
#define SN65DP141_REG_CFG_SYNC_23_Msk (0x1U << SN65DP141_REG_CFG_SYNC23_Pos) /*!< 0x10*/
#define SN65DP141_REG_CFG_SYNC_23 SN65DP141_REG_CFG_SYNC_23_Msk /*!< All settings from channel 2 will be used for channel 2 and 3 */
#define SN65DP141_REG_CFG_SYNC_01_Pos (5U)
#define SN65DP141_REG_CFG_SYNC_01_Msk (0x1U << SN65DP141_REG_CFG_SYNC01_Pos) /*!< 0x20*/
#define SN65DP141_REG_CFG_SYNC_01 SN65DP141_REG_CFG_SYNC_01_Msk /*!< All settings from channel 1 will be used for channel 0 and 1 */
#define SN65DP141_REG_CFG_PWRDOWN_Pos (6U)
#define SN65DP141_REG_CFG_PWRDOWN_Msk (0x1U << SN65DP141_REG_CFG_PWRDOWN_Pos) /*!< 0x40*/
#define SN65DP141_REG_CFG_PWRDOWN SN65DP141_REG_CFG_PWRDOWN_Msk /*!< Power down the device */
#define SN65DP141_REG_CFG_SW_GPIO_Pos (7U)
#define SN65DP141_REG_CFG_SW_GPIO_Msk (0x1U << SN65DP141_REG_CFG_SW_GPIO_Pos) /*!< 0x80*/
#define SN65DP141_REG_CFG_SW_GPIO SN65DP141_REG_CFG_SW_GPIO_Msk /*!< Switching logic is controlled by GPIO or I2C */
/*********** Bit definition for Channel Enable register *************/
#define SN65DP141_REG_CHEN_LN_EN_CH0_Pos (0U)
#define SN65DP141_REG_CHEN_LN_EN_CH0_Msk (0x1U << SN65DP141_REG_CHEN_LN_EN_CH0_Pos) /*!< 0x01 */
#define SN65DP141_REG_CHEN_LN_EN_CH0 SN65DP141_REG_CHEN_LN_EN_CH0_Msk /*!< Channel 0 enable */
#define SN65DP141_REG_CHEN_LN_EN_CH1_Pos (1U)
#define SN65DP141_REG_CHEN_LN_EN_CH1_Msk (0x1U << SN65DP141_REG_CHEN_LN_EN_CH1_Pos) /*!< 0x02 */
#define SN65DP141_REG_CHEN_LN_EN_CH1 SN65DP141_REG_CHEN_LN_EN_CH1_Msk /*!< Channel 1 enable */
#define SN65DP141_REG_CHEN_LN_EN_CH2_Pos (2U)
#define SN65DP141_REG_CHEN_LN_EN_CH2_Msk (0x1U << SN65DP141_REG_CHEN_LN_EN_CH2_Pos) /*!< 0x04 */
#define SN65DP141_REG_CHEN_LN_EN_CH2 SN65DP141_REG_CHEN_LN_EN_CH2_Msk /*!< Channel 2 enable */
#define SN65DP141_REG_CHEN_LN_EN_CH3_Pos (3U)
#define SN65DP141_REG_CHEN_LN_EN_CH3_Msk (0x1U << SN65DP141_REG_CHEN_LN_EN_CH3_Pos) /*!< 0x08 */
#define SN65DP141_REG_CHEN_LN_EN_CH3 SN65DP141_REG_CHEN_LN_EN_CH3_Msk /*!< Channel 3 enable */
/*********** Bit definition for Channel x Control Settings register *************/
#define SN65DP141_REG_CHxCFG_RX_GAIN_Pos (0U)
#define SN65DP141_REG_CHxCFG_RX_GAIN_Msk (0x3U << SN65DP141_REG_CHxCFG_RX_GAIN_Pos) /*!< 0x03 */
#define SN65DP141_REG_CHxCFG_RX_GAIN SN65DP141_REG_CHxCFG_RX_GAIN_Msk /*!< Channel[x] RX_GAIN control */
#define SN65DP141_REG_CHxCFG_RX_GAIN_0 (0x1U << SN65DP141_REG_CHxCFG_RX_GAIN_Pos) /*!< 0x01 */
#define SN65DP141_REG_CHxCFG_RX_GAIN_1 (0x2U << SN65DP141_REG_CHxCFG_RX_GAIN_Pos) /*!< 0x02 */
#define SN65DP141_REG_CHxCFG_EQ_DC_GAIN_Pos (2U)
#define SN65DP141_REG_CHxCFG_EQ_DC_GAIN_Msk (0x1U << SN65DP141_REG_CHxCFG_EQ_DC_GAIN_Pos) /*!< 0x04 */
#define SN65DP141_REG_CHxCFG_EQ_DC_GAIN SN65DP141_REG_CHxCFG_EQ_DC_GAIN_Msk /*!< Channel[x] EQ DC gain */
#define SN65DP141_REG_CHxCFG_TX_GAIN_Pos (3U)
#define SN65DP141_REG_CHxCFG_TX_GAIN_Msk (0x1U << SN65DP141_REG_CHxCFG_TX_GAIN_Pos) /*!< 0x08 */
#define SN65DP141_REG_CHxCFG_TX_GAIN SN65DP141_REG_CHxCFG_TX_GAIN_Msk /*!< Channel[x] TX_DC_GAIN control */
#define SN65DP141_REG_CHxCFG_EQ_SETTING_Pos (4U)
#define SN65DP141_REG_CHxCFG_EQ_SETTING_Msk (0x7U << SN65DP141_REG_CHxCFG_EQ_SETTING_Pos) /*!< 0x70 */
#define SN65DP141_REG_CHxCFG_EQ_SETTING SN65DP141_REG_CHxCFG_EQ_SETTING_Msk /*!< Channel[x] TX_DC_GAIN control */
#define SN65DP141_REG_CHxCFG_EQ_SETTING_0 (0x1U << SN65DP141_REG_CHxCFG_EQ_SETTING_Pos) /*!< 0x10 */
#define SN65DP141_REG_CHxCFG_EQ_SETTING_1 (0x2U << SN65DP141_REG_CHxCFG_EQ_SETTING_Pos) /*!< 0x20 */
#define SN65DP141_REG_CHxCFG_EQ_SETTING_2 (0x4U << SN65DP141_REG_CHxCFG_EQ_SETTING_Pos) /*!< 0x40 */
/*********** Bit definition for Channel x Enable Settings register *************/
#define SN65DP141_REG_CHxCTL_DRV_EN_Pos (0U)
#define SN65DP141_REG_CHxCTL_DRV_EN_Msk (0x1U << SN65DP141_REG_CHxCTL_DRV_EN_Pos) /*!< 0x01 */
#define SN65DP141_REG_CHxCTL_DRV_EN SN65DP141_REG_CHxCTL_DRV_EN_Msk /*!< Channel[0] driver stage enable */
#define SN65DP141_REG_CHxCTL_EQ_EN_Pos (1U)
#define SN65DP141_REG_CHxCTL_EQ_EN_Msk (0x1U << SN65DP141_REG_CHxCTL_EQ_EN_Pos) /*!< 0x02 */
#define SN65DP141_REG_CHxCTL_EQ_EN SN65DP141_REG_CHxCTL_EQ_EN_Msk /*!< Channel[0] EQ stage enable */
#define SN65DP141_REG_CHxCTL_DRV_PEAK_Pos (2U)
#define SN65DP141_REG_CHxCTL_DRV_PEAK_Msk (0x1U << SN65DP141_REG_CHxCTL_DRV_PEAK_Pos) /*!< 0x04 */
#define SN65DP141_REG_CHxCTL_DRV_PEAK SN65DP141_REG_CHxCTL_DRV_PEAK_Msk /*!< Channel[0] driver peaking */
/** @defgroup SN65DP141_Channel_Identifier
* @{
*/
#define SN65DP141_CHANNEL_1 0x00U
#define SN65DP141_CHANNEL_2 0x01U
#define SN65DP141_CHANNEL_3 0x04U
#define SN65DP141_CHANNEL_4 0x08U
#define SN65DP141_CHANNEL_ALL 0x0FU
/**
* @}
*/
/** @defgroup SN65DP141_EQ_Mode
* @{
*/
#define SN65DP141_EQ_MODE_CABLE 0x00U
#define SN65DP141_EQ_MODE_TRACE SN65DP141_REG_CFG_EQ_MODE
/**
* @}
*/
/** @defgroup SN65DP141_Channel_Tracking
* @{
*/
#define SN65DP141_CHANNEL_TRACKING_NONE 0x00U
#define SN65DP141_CHANNEL_TRACKING_01 SN65DP141_REG_CFG_SYNC_01
#define SN65DP141_CHANNEL_TRACKING_23 SN65DP141_REG_CFG_SYNC_23
#define SN65DP141_CHANNEL_TRACKING_ALL SN65DP141_REG_CFG_SYNC_ALL
/**
* @}
*/
/** @defgroup SN65DP141_EQGAIN SN65DP141 Equalizer Gain
* @{
*/
#define SN65DP141_EQGAIN_0 0x0U
#define SN65DP141_EQGAIN_1 0x1U
#define SN65DP141_EQGAIN_2 0x2U
#define SN65DP141_EQGAIN_3 0x3U
#define SN65DP141_EQGAIN_4 0x4U
#define SN65DP141_EQGAIN_5 0x5U
#define SN65DP141_EQGAIN_6 0x6U
#define SN65DP141_EQGAIN_7 0x7U
/**
* @}
*/
/** @defgroup SN65DP141_Channel_RXGAIN
* @{
*/
#define SN65DP141_CHANNEL_RXGAIN_LOW 0x00U
#define SN65DP141_CHANNEL_RXGAIN_HIZ SN65DP141_REG_CHxCFG_RX_GAIN_0
#define SN65DP141_CHANNEL_RXGAIN_HIGH SN65DP141_REG_CHxCFG_RX_GAIN_1
/**
* @}
*/
/** @defgroup SN65DP141_Channel_EQDCGAIN
* @{
*/
#define SN65DP141_CHANNEL_EQDCGAIN_MINUS6DB 0x00U
#define SN65DP141_CHANNEL_EQDCGAIN_0DB SN65DP141_REG_CHxCFG_EQ_DC_GAIN
/**
* @}
*/
/** @defgroup SN65DP141_Channel_TXGAIN
* @{
*/
#define SN65DP141_CHANNEL_RXGAIN_0DB 0x00U
#define SN65DP141_CHANNEL_RXGAIN_6DB SN65DP141_REG_CHxCFG_TX_GAIN
/**
* @}
*/
/**
* @}
*/
#if defined(SN65DP141_DEBUG)
/** @defgroup SN65DP141_Exported_Structure SN65DP141 Exported Structure
* @{
*/
typedef union {
uint8_t Register;
struct {
uint8_t RESERVED :2;
uint8_t EQ_MODE :1;
uint8_t SYNC_ALL :1;
uint8_t SYNC_23 :1;
uint8_t SYNC_01 :1;
uint8_t PWRDOWN :1;
uint8_t SW_GPIO :1;
};
} SN65DP141_GeneralTypeDef;
typedef union {
uint8_t Register;
struct {
uint8_t LN_EN_CH0 :1;
uint8_t LN_EN_CH1 :1;
uint8_t LN_EN_CH2 :1;
uint8_t LN_EN_CH3 :1;
uint8_t RESERVED :4;
};
} SN65DP141_ChannelEnableTypeDef;
typedef union {
uint8_t Register;
struct {
uint8_t RX_GAIN_0 :1;
uint8_t RX_GAIN_1 :1;
uint8_t EQ_DC_GAIN :1;
uint8_t TX_GAIN :1;
uint8_t EQ_Setting_0 :1;
uint8_t EQ_Setting_1 :1;
uint8_t EQ_Setting_2 :1;
uint8_t RESERVED :1;
};
} SN65DP141_Channel0CtrlTypeDef;
typedef union {
uint8_t Register;
struct {
uint8_t RSVDRV_EN :1;
uint8_t EQ_EN :1;
uint8_t DRV_PEAK :1;
uint8_t RESERVED :5;
};
} SN65DP141_Channel0EnableTypeDef;
typedef union {
uint8_t Register;
struct {
uint8_t RX_GAIN_0 :1;
uint8_t RX_GAIN_1 :1;
uint8_t EQ_DC_GAIN :1;
uint8_t TX_GAIN :1;
uint8_t EQ_Setting_0 :1;
uint8_t EQ_Setting_1 :1;
uint8_t EQ_Setting_2 :1;
uint8_t RESERVED :1;
};
} SN65DP141_Channel1CtrlTypeDef;
typedef union {
uint8_t Register;
struct {
uint8_t RSVDRV_EN :1;
uint8_t EQ_EN :1;
uint8_t DRV_PEAK :1;
uint8_t RESERVED :5;
};
} SN65DP141_Channel1EnableTypeDef;
typedef union {
uint8_t Register;
struct {
uint8_t RX_GAIN_0 :1;
uint8_t RX_GAIN_1 :1;
uint8_t EQ_DC_GAIN :1;
uint8_t TX_GAIN :1;
uint8_t EQ_Setting_0 :1;
uint8_t EQ_Setting_1 :1;
uint8_t EQ_Setting_2 :1;
uint8_t RESERVED :1;
};
} SN65DP141_Channel2CtrlTypeDef;
typedef union {
uint8_t Register;
struct {
uint8_t RSVDRV_EN :1;
uint8_t EQ_EN :1;
uint8_t DRV_PEAK :1;
uint8_t RESERVED :5;
};
} SN65DP141_Channel2EnableTypeDef;
typedef union {
uint8_t Register;
struct {
uint8_t RX_GAIN_0 :1;
uint8_t RX_GAIN_1 :1;
uint8_t EQ_DC_GAIN :1;
uint8_t TX_GAIN :1;
uint8_t EQ_Setting_0 :1;
uint8_t EQ_Setting_1 :1;
uint8_t EQ_Setting_2 :1;
uint8_t RESERVED :1;
};
} SN65DP141_Channel3CtrlTypeDef;
typedef union {
uint8_t Register;
struct {
uint8_t RSVDRV_EN :1;
uint8_t EQ_EN :1;
uint8_t DRV_PEAK :1;
uint8_t RESERVED :5;
};
} SN65DP141_Channel3EnableTypeDef;
typedef struct
{
SN65DP141_GeneralTypeDef General; /*!< 0x00 (General Device Settings) */
SN65DP141_ChannelEnableTypeDef ChannelEnable; /*!< 0x01 (Channel Enable) */
SN65DP141_Channel0CtrlTypeDef Channel0Ctrl; /*!< 0x02 (Channel 0 Control Settings) */
SN65DP141_Channel0EnableTypeDef Channel0Enable; /*!< 0x03 (Channel 0 Enable Settings) */
SN65DP141_Channel1CtrlTypeDef Channel1Ctrl; /*!< 0x05 (Channel 1 Control Settings) */
SN65DP141_Channel1EnableTypeDef Channel1Enable; /*!< 0x06 (Channel 1 Enable Settings) */
SN65DP141_Channel2CtrlTypeDef Channel2Ctrl; /*!< 0x08 (Channel 2 Control Settings) */
SN65DP141_Channel2EnableTypeDef Channel2Enable; /*!< 0x09 (Channel 2 Enable Settings) */
SN65DP141_Channel3CtrlTypeDef Channel3Ctrl; /*!< 0x0B (Channel 3 Control Settings) */
SN65DP141_Channel3EnableTypeDef Channel3Enable; /*!< 0x0C (Channel 3 Enable Settings) */
} SN65DP141_RegistersTypeDef;
/**
* @}
*/
#endif /* SN65DP141_DEBUG */
/** @defgroup SN65DP141_Exported_Functions
* @{
*/
uint32_t sn65dp141_Init(uint16_t Address);
void sn65dp141_DeInit(uint16_t Address);
uint32_t sn65dp141_PowerOn(uint16_t Address);
uint32_t sn65dp141_PowerOff(uint16_t Address);
uint32_t sn65dp141_SetEQGain(uint16_t Address, DPREDRIVER_ChannelId_t ChannelId, uint8_t EQGain);
uint32_t sn65dp141_EnableChannel(uint16_t Address, DPREDRIVER_ChannelId_t ChannelId);
uint32_t sn65dp141_DisableChannel(uint16_t Address, DPREDRIVER_ChannelId_t ChannelId);
/* MUX IO functions */
uint8_t MUX_IO_Init(void);
void MUX_IO_DeInit(void);
uint8_t MUX_IO_Write(uint16_t Addr, uint16_t Reg, uint8_t Data);
uint8_t MUX_IO_Read(uint16_t Addr, uint16_t Reg, uint8_t *pData);
uint32_t MUX_IO_IsDeviceReady(uint16_t DevAddress, uint32_t Trials);
/**
* @}
*/
/** @defgroup SN65DP141_Exported_Variables
* @{
*/
/* DisplayPort Linear Redriver Driver structure */
extern DPREDRIVER_Drv_t sn65dp141_drv;
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* SN65DP141_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -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: &quot;Arial&quot;,&quot;sans-serif&quot;; 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&nbsp;<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: &quot;Arial&quot;,&quot;sans-serif&quot;; 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: &quot;Verdana&quot;,&quot;sans-serif&quot;; 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 &amp; 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&nbsp;</span><span style="font-family: Verdana; font-size: 10pt;">"\"
by&nbsp;</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: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;"></span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"><span style="color: black;"></span></span>,
visit:&nbsp;<a href="http://www.st.com/STM32" target="_blank">www.st.com/STM32</a></p>
<br>
</div>
</div>
</body></html>

View 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>&copy; 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****/

View 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>&copy; 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****/

View file

@ -0,0 +1,83 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta charset="utf-8" />
<meta name="generator" content="pandoc" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<title>Release Notes for TUSB546 Component Drivers</title>
<style type="text/css">
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
span.underline{text-decoration: underline;}
div.column{display: inline-block; vertical-align: top; width: 50%;}
</style>
<link rel="stylesheet" href="../../../../_htmresc/mini-st.css" />
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
<![endif]-->
</head>
<body>
<div class="row">
<div class="col-sm-12 col-lg-4">
<div class="card fluid">
<div class="sectione dark">
<center>
<h1 id="release-notes-for-tusb546-component-drivers"><small>Release Notes for</small> <mark>TUSB546 Component Drivers</mark></h1>
<p>Copyright © 2017 STMicroelectronics<br />
</p>
<a href="https://www.st.com" class="logo"><img src="../../../../_htmresc/st_logo.png" alt="ST logo" /></a>
</center>
</div>
</div>
<h1 id="license">License</h1>
<p>Licensed by ST under BSD 3-Clause license (the "License"). You may not use this package except in compliance with the License. You may obtain a copy of the License at:</p>
<p><a href="https://opensource.org/licenses/BSD-3-Clause">https://opensource.org/licenses/BSD-3-Clause</a></p>
<h1 id="purpose">Purpose</h1>
<p>This directory contains the TUSB546 component drivers.</p>
</div>
<div class="col-sm-12 col-lg-8">
<h1 id="update-history">Update History</h1>
<div class="collapse">
<input type="checkbox" id="collapse-section3" checked aria-hidden="true"> <label for="collapse-section3" aria-hidden="true">V1.0.3 / 23-July-2020</label>
<div>
<h2 id="main-changes">Main Changes</h2>
<ul>
<li>Correct misspelled words</li>
<li>Update Release Notes format</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section4" aria-hidden="true"> <label for="collapse-section4" aria-hidden="true">V1.0.2 / 10-October-2018</label>
<div>
<h2 id="main-changes-1">Main Changes</h2>
<ul>
<li>Fix compilation warnings detected by IAR V8.30.1</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section2" aria-hidden="true"> <label for="collapse-section2" aria-hidden="true">V1.0.1 / 16-March-2018</label>
<div>
<h2 id="main-changes-2">Main Changes</h2>
<ul>
<li>Correct compilation warnings detected by SW4STM32 gcc compiler</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section1" aria-hidden="true"> <label for="collapse-section1" aria-hidden="true">V1.0.0 / 16-November-2017</label>
<div>
<h2 id="main-changes-3">Main Changes</h2>
<ul>
<li>First official release of TUSB546 Component drivers</li>
</ul>
</div>
</div>
</div>
</div>
<footer class="sticky">
For complete documentation on <mark>STM32 Microcontrollers</mark> , visit: <a href="http://www.st.com/STM32">http://www.st.com/STM32</a>
</footer>
</body>
</html>

View file

@ -0,0 +1,533 @@
/**
******************************************************************************
* @file tusb546.c
* @author MCD Application Team
* @brief This file provides a set of functions needed to manage the TUSB546
* (USB Type-C DP ALT Mode Linear Redriver Crosspoint Switch).
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2017 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 "tusb546.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @defgroup TUSB546
* @brief This file provides a set of functions needed to drive the
* TUSB546 USB Type-C DP ALT Mode Linear Redriver Crosspoint Switch.
* @{
*/
/** @defgroup TUSB546_Private_TypesDefinitions
* @{
*/
/**
* @}
*/
/** @defgroup TUSB546_Private_Defines
* @{
*/
/**
* @}
*/
/** @defgroup TUSB546_Private_Macros
* @{
*/
/**
* @}
*/
/** @defgroup TUSB546_Private_Variables
* @{
*/
/* Type-C Crosspoint Switch Driver structure initialization */
TYPECSWITCH_Drv_t tusb546_drv_CrossSwitch =
{
tusb546_CrossSwitch_Init,
tusb546_CrossSwitch_DeInit,
tusb546_CrossSwitch_PowerOn,
tusb546_CrossSwitch_PowerOff,
tusb546_CrossSwitch_SetMode,
tusb546_CrossSwitch_IsSupportedMode
};
/* DisplayPort Linear Redriver driver structure initialization*/
DPREDRIVER_Drv_t tusb546_drv_LinearRedriver =
{
tusb546_DPRedriver_Init,
tusb546_DPRedriver_DeInit,
tusb546_DPRedriver_PowerOn,
tusb546_DPRedriver_PowerOff,
tusb546_DPRedriver_SetEQGain,
tusb546_DPRedriver_EnableChannel,
tusb546_DPRedriver_DisableChannel
};
/* Supported USB Type-C pin assignments */
static const uint32_t tusb546_SupportedModes =
( 1 << USB_NORMAL |
1 << USB_FLIPPED |
1 << DFP_D_PIN_ASSIGNMENT_C_NORMAL |
1 << DFP_D_PIN_ASSIGNMENT_C_FLIPPED |
1 << DFP_D_PIN_ASSIGNMENT_D_NORMAL |
1 << DFP_D_PIN_ASSIGNMENT_D_FLIPPED |
1 << DFP_D_PIN_ASSIGNMENT_E_NORMAL |
1 << DFP_D_PIN_ASSIGNMENT_E_FLIPPED |
1 << DFP_D_PIN_ASSIGNMENT_F_NORMAL |
1 << DFP_D_PIN_ASSIGNMENT_F_FLIPPED );
static uint8_t tusb546_IsInitialized_CrossSwitch = 0;
static uint8_t tusb546_IsInitialized_DPRedriver = 0;
/**
* @}
*/
/** @defgroup TUSB546_Private_FunctionPrototypes
* @{
*/
/**
* @}
*/
/** @defgroup TUSB546_Private_Functions
* @{
*/
/**
* @brief Initialize the TUSB546 and configure the needed hardware resources
* (Type-C cross switch part).
* @param Address TUSB546 address on communication Bus.
* @retval 0: successful, else failed
*/
uint32_t tusb546_CrossSwitch_Init(uint16_t Address)
{
uint32_t err_count = 0;
tusb546_IsInitialized_CrossSwitch = 1;
if (!tusb546_IsInitialized_DPRedriver)
{
/* Low level init */
err_count += MUX_IO_Init();
/* Restore TUSB546 registers reset values */
err_count += MUX_IO_Write(Address, TUSB546_REG_CTRL, 0x01);
err_count += MUX_IO_Write(Address, TUSB546_REG_DP_CTRL1, 0x00);
err_count += MUX_IO_Write(Address, TUSB546_REG_DP_CTRL2, 0x00);
err_count += MUX_IO_Write(Address, TUSB546_REG_DP_CTRL4, 0x00);
err_count += MUX_IO_Write(Address, TUSB546_REG_USB3_CTRL1, 0x00);
err_count += MUX_IO_Write(Address, TUSB546_REG_USB3_CTRL2, 0x00);
err_count += MUX_IO_Write(Address, TUSB546_REG_USB3_CTRL3, 0x00);
}
return err_count;
}
/**
* @brief Release the hardware resources required to use the TUSB546
* (Type-C cross switch part).
* @param Address TUSB546 address on communication Bus.
* @retval none
*/
void tusb546_CrossSwitch_DeInit(uint16_t Address)
{
tusb546_IsInitialized_CrossSwitch = 0;
if ((!tusb546_IsInitialized_CrossSwitch) &&
(!tusb546_IsInitialized_DPRedriver))
{
/* Restore TUSB546 registers reset values */
MUX_IO_Write(Address, TUSB546_REG_CTRL, 0x01);
MUX_IO_Write(Address, TUSB546_REG_DP_CTRL1, 0x00);
MUX_IO_Write(Address, TUSB546_REG_DP_CTRL2, 0x00);
MUX_IO_Write(Address, TUSB546_REG_DP_CTRL4, 0x00);
MUX_IO_Write(Address, TUSB546_REG_USB3_CTRL1, 0x00);
MUX_IO_Write(Address, TUSB546_REG_USB3_CTRL2, 0x00);
MUX_IO_Write(Address, TUSB546_REG_USB3_CTRL3, 0x00);
/* Low level de-init */
MUX_IO_DeInit();
}
}
/**
* @brief Power on the TUSB546 (Type-C cross switch part).
* @param Address TUSB546 address on communication Bus.
* @retval 0: successful, else failed
*/
uint32_t tusb546_CrossSwitch_PowerOn(uint16_t Address)
{
uint32_t err_count = 0;
/* Enable USB3x port */
err_count += MUX_IO_Write(Address, TUSB546_REG_CTRL, TUSB546_REG_CTRL_CTLSEL_0);
return err_count;
}
/**
* @brief Power down the TUSB546 (Type-C cross switch part).
* @param Address TUSB546 address on communication Bus.
* @retval 0: successful, else failed
*/
uint32_t tusb546_CrossSwitch_PowerOff(uint16_t Address)
{
uint32_t err_count = 0;
/* All RX and TX for USB3 and DisplayPort are disabled */
err_count += MUX_IO_Write(Address, TUSB546_REG_CTRL, 0);
return err_count;
}
/**
* @brief Configure the TUSB546 according to the requested USB Type-C
* connector pin assignment.
* @param Address TUSB546 address on communication Bus.
* @param Mode USB Type-C connector pin assignment
* @retval 0: success, else error
*/
uint32_t tusb546_CrossSwitch_SetMode(uint16_t Address, TYPECSWITCH_Mode_t Mode)
{
uint32_t err_count = 0;
uint8_t flipsel;
uint8_t ctlsel;
uint8_t ctlreg;
switch(Mode)
{
case USB_NORMAL:
flipsel = 0;
ctlsel = TUSB546_REG_CTRL_CTLSEL_0;
break;
case USB_FLIPPED:
flipsel = TUSB546_REG_CTRL_FLIPSEL;
ctlsel = TUSB546_REG_CTRL_CTLSEL_0;
break;
case DFP_D_PIN_ASSIGNMENT_C_NORMAL:
case DFP_D_PIN_ASSIGNMENT_E_NORMAL:
flipsel = 0;
ctlsel = TUSB546_REG_CTRL_CTLSEL_1;
break;
case DFP_D_PIN_ASSIGNMENT_C_FLIPPED:
case DFP_D_PIN_ASSIGNMENT_E_FLIPPED:
flipsel = TUSB546_REG_CTRL_FLIPSEL;
ctlsel = TUSB546_REG_CTRL_CTLSEL_1;
break;
case DFP_D_PIN_ASSIGNMENT_D_NORMAL:
case DFP_D_PIN_ASSIGNMENT_F_NORMAL:
flipsel = 0;
ctlsel = TUSB546_REG_CTRL_CTLSEL;
break;
case DFP_D_PIN_ASSIGNMENT_D_FLIPPED:
case DFP_D_PIN_ASSIGNMENT_F_FLIPPED:
flipsel = TUSB546_REG_CTRL_FLIPSEL;
ctlsel = TUSB546_REG_CTRL_CTLSEL;
break;
default:
flipsel = 0;
ctlsel = 0;
break;
}
/* Get actual device configuration */
err_count += MUX_IO_Read(Address, TUSB546_REG_CTRL, &ctlreg);
ctlreg = (ctlreg & ~(uint8_t)(TUSB546_REG_CTRL_FLIPSEL | TUSB546_REG_CTRL_CTLSEL)) | (flipsel | ctlsel);
/* Update device configuration */
err_count += MUX_IO_Write(Address, TUSB546_REG_CTRL, ctlreg);
return err_count;
}
/**
* @brief Indicate whether the requested USB Type-C connector pin assignment
* is supported by the TUSB546.
* @param Mode USB Type-C connector pin assignment
* @retval 1: Mode supported, else Mode not supported
*/
uint32_t tusb546_CrossSwitch_IsSupportedMode(TYPECSWITCH_Mode_t Mode)
{
return (((1 << Mode) & tusb546_SupportedModes ) == 0) ? 0 : 1;
}
/**
* @brief Initialize the TUSB546 and configure the needed hardware resources
* (DisplayPort linear redriver part).
* @param Address TUSB546 address on communication Bus.
* @retval 0: successful, else failed
*/
uint32_t tusb546_DPRedriver_Init(uint16_t Address)
{
uint32_t err_count = 0;
tusb546_IsInitialized_DPRedriver = 1;
if (!tusb546_IsInitialized_CrossSwitch)
{
/* Low level init */
err_count += MUX_IO_Init();
}
return err_count;
}
/**
* @brief Release the hardware resources required to use the TUSB546
* (DisplayPort linear redriver part).
* @param Address TUSB546 address on communication Bus.
* @retval none
*/
void tusb546_DPRedriver_DeInit(uint16_t Address)
{
tusb546_IsInitialized_DPRedriver = 0;
if ((!tusb546_IsInitialized_CrossSwitch) &&
(!tusb546_IsInitialized_DPRedriver))
{
/* Restore TUSB546 registers reset values */
MUX_IO_Write(Address, TUSB546_REG_CTRL, 0x01);
MUX_IO_Write(Address, TUSB546_REG_DP_CTRL1, 0x00);
MUX_IO_Write(Address, TUSB546_REG_DP_CTRL2, 0x00);
MUX_IO_Write(Address, TUSB546_REG_DP_CTRL4, 0x00);
MUX_IO_Write(Address, TUSB546_REG_USB3_CTRL1, 0x00);
MUX_IO_Write(Address, TUSB546_REG_USB3_CTRL2, 0x00);
MUX_IO_Write(Address, TUSB546_REG_USB3_CTRL3, 0x00);
/* Low level de-init */
MUX_IO_DeInit();
}
}
/**
* @brief Power on the TUSB546 (DisplayPort linear redriver part).
* @param Address TUSB546 address on communication Bus.
* @retval 0: successful, else failed
*/
uint32_t tusb546_DPRedriver_PowerOn(uint16_t Address)
{
return 0;
}
/**
* @brief Power down the TUSB546 (DisplayPort linear redriver part).
* @param Address TUSB546 address on communication Bus.
* @retval 0: successful, else failed
*/
uint32_t tusb546_DPRedriver_PowerOff(uint16_t Address)
{
return 0;
}
/**
* @brief Set the equalizer gain for a given channel.
* @param Address TUSB546 address on communication Bus.
* @param ChannelId Channel identifier.
* This parameter can be take one of the following values:
* CHANNEL_DP0
* CHANNEL_DP1
* CHANNEL_DP2
* CHANNEL_DP3
* CHANNEL_RX1
* CHANNEL_RX2
* CHANNEL_SSTX
* @param EQGain Equalizer gain.
* This parameter must be a value between 0x00 and 0x0F.
* @retval 0: successful, else failed
*/
uint32_t tusb546_DPRedriver_SetEQGain(uint16_t Address,
DPREDRIVER_ChannelId_t ChannelId,
uint8_t EQGain)
{
uint32_t err_count = 0;
uint8_t eqsel = 0;
uint8_t reg_offset = 0;
uint8_t ctlreg;
uint8_t mask = 0;
switch(ChannelId)
{
case CHANNEL_DP0:
reg_offset = TUSB546_REG_DP_CTRL1;
mask = TUSB546_REG_DP_CTRL1_DP0EQ_SEL_Msk;
eqsel = EQGain;
break;
case CHANNEL_DP1:
reg_offset = TUSB546_REG_DP_CTRL1;
mask = TUSB546_REG_DP_CTRL1_DP1EQ_SEL_Msk;
eqsel = (EQGain << TUSB546_REG_DP_CTRL1_DP1EQ_SEL_Pos);
break;
case CHANNEL_DP2:
reg_offset = TUSB546_REG_DP_CTRL2;
mask = TUSB546_REG_DP_CTRL2_DP2EQ_SEL_Msk;
eqsel = EQGain;
break;
case CHANNEL_DP3:
reg_offset = TUSB546_REG_DP_CTRL2;
mask = TUSB546_REG_DP_CTRL2_DP3EQ_SEL_Msk;
eqsel = (EQGain << TUSB546_REG_DP_CTRL2_DP3EQ_SEL_Pos);
break;
case CHANNEL_RX1:
reg_offset = TUSB546_REG_USB3_CTRL1;
mask = TUSB546_REG_USB3_CTRL1_EQ1_SEL_Msk;
eqsel = EQGain;
break;
case CHANNEL_RX2:
reg_offset = TUSB546_REG_USB3_CTRL1;
mask = TUSB546_REG_USB3_CTRL1_EQ2_SEL_Msk;
eqsel = (EQGain << TUSB546_REG_USB3_CTRL1_EQ2_SEL_Pos);
break;
case CHANNEL_SSTX:
reg_offset = TUSB546_REG_USB3_CTRL2;
mask = TUSB546_USB3_CTRL2_SSEQ_SEL_Msk;
eqsel = EQGain;
break;
}
if (reg_offset != 0)
{
/* Set EQ_OVERRIDE to use EQ settings from registers instead of value sample from pins */
err_count += MUX_IO_Write(Address, TUSB546_REG_CTRL, TUSB546_REG_CTRL_EQ_OVERRIDE);
/* Get actual EQ configuration */
err_count += MUX_IO_Read(Address, reg_offset, &ctlreg);
ctlreg = (ctlreg & ~(mask)) | eqsel;
/* Update EQ configuration */
err_count += MUX_IO_Write(Address, reg_offset, ctlreg);
}
return err_count;
}
/**
* @brief Enable a DP channel.
* @param Address TUSB546 address on communication Bus.
* @param ChannelId Channel identifier.
* This parameter can be take one of the following values:
* CHANNEL_DP0
* CHANNEL_DP1
* CHANNEL_DP2
* CHANNEL_DP3
* @retval 0: successful, else failed
*/
uint32_t tusb546_DPRedriver_EnableChannel(uint16_t Address,
DPREDRIVER_ChannelId_t ChannelId)
{
uint32_t err_count = 0;
uint8_t ctlreg;
err_count += MUX_IO_Read(Address, TUSB546_REG_DP_CTRL4, &ctlreg);
switch(ChannelId)
{
case CHANNEL_DP0:
ctlreg &= ~TUSB546_REG_DP_CTRL4_DP0_DISABLE;
break;
case CHANNEL_DP1:
ctlreg &= ~TUSB546_REG_DP_CTRL4_DP1_DISABLE;
break;
case CHANNEL_DP2:
ctlreg &= ~TUSB546_REG_DP_CTRL4_DP2_DISABLE;
break;
case CHANNEL_DP3:
ctlreg &= ~TUSB546_REG_DP_CTRL4_DP3_DISABLE;
break;
default:
/* Nothing to do */
break;
}
/* Enable the DP line */
err_count += MUX_IO_Write(Address, TUSB546_REG_DP_CTRL4, ctlreg);
return err_count;
}
/**
* @brief Disable a DP channel.
* @param Address TUSB546 address on communication Bus.
* @param ChannelId Channel identifier.
* This parameter can be take one of the following values:
* CHANNEL_DP0
* CHANNEL_DP1
* CHANNEL_DP2
* CHANNEL_DP3
* @retval 0: successful, else failed
*/
uint32_t tusb546_DPRedriver_DisableChannel(uint16_t Address,
DPREDRIVER_ChannelId_t ChannelId)
{
uint32_t err_count = 0;
uint8_t ctlreg;
err_count += MUX_IO_Read(Address, TUSB546_REG_DP_CTRL4, &ctlreg);
switch(ChannelId)
{
case CHANNEL_DP0:
ctlreg |= TUSB546_REG_DP_CTRL4_DP0_DISABLE;
break;
case CHANNEL_DP1:
ctlreg |= TUSB546_REG_DP_CTRL4_DP1_DISABLE;
break;
case CHANNEL_DP2:
ctlreg |= TUSB546_REG_DP_CTRL4_DP2_DISABLE;
break;
case CHANNEL_DP3:
ctlreg |= TUSB546_REG_DP_CTRL4_DP3_DISABLE;
break;
default:
/* Nothing to do */
break;
}
/* Disable the DP line */
err_count += MUX_IO_Write(Address, TUSB546_REG_DP_CTRL4, ctlreg);
return err_count;
}
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View file

@ -0,0 +1,474 @@
/**
******************************************************************************
* @file tusb546.h
* @author MCD Application Team
* @brief Header for tusb546.h module
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2017 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 TUSB546_H
#define TUSB546_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include <stdint.h>
#include "../Common/usbtypecswitch.h"
#include "../Common/dpredriver.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @addtogroup TUSB546
* @{
*/
/** @defgroup TUSB546_Exported_Constants
* @{
*/
/******************************* Register Map ********************************/
#define TUSB546_REG_CTRL 0x0A /*!< */
#define TUSB546_REG_DP_CTRL1 0x10 /*!< */
#define TUSB546_REG_DP_CTRL2 0x11 /*!< */
#define TUSB546_REG_DP_CTRL3 0x12 /*!< */
#define TUSB546_REG_DP_CTRL4 0x13 /*!< */
#define TUSB546_REG_USB3_CTRL1 0x20 /*!< */
#define TUSB546_REG_USB3_CTRL2 0x21 /*!< */
#define TUSB546_REG_USB3_CTRL3 0x22 /*!< */
/*********************** Bit definition for CTRL register *******************/
#define TUSB546_REG_CTRL_CTLSEL_Pos (0U)
#define TUSB546_REG_CTRL_CTLSEL_Msk (0x3U << TUSB546_REG_CTRL_CTLSEL_Pos) /*!< 0x03*/
#define TUSB546_REG_CTRL_CTLSEL TUSB546_REG_CTRL_CTLSEL_Msk /*!< DP Alt mode and USB 3.1 Switch Control */
#define TUSB546_REG_CTRL_CTLSEL_0 (0x1 << TUSB546_REG_CTRL_CTLSEL_Pos) /*!< 0x01 */
#define TUSB546_REG_CTRL_CTLSEL_1 (0x2 << TUSB546_REG_CTRL_CTLSEL_Pos) /*!< 0x02 */
#define TUSB546_REG_CTRL_FLIPSEL_Pos (2U)
#define TUSB546_REG_CTRL_FLIPSEL_Msk (0x1U << TUSB546_REG_CTRL_FLIPSEL_Pos) /*!< 0x04*/
#define TUSB546_REG_CTRL_FLIPSEL TUSB546_REG_CTRL_FLIPSEL_Msk /*!< Flip Control */
#define TUSB546_REG_CTRL_HPDIN_OVERRIDE_Pos (3U)
#define TUSB546_REG_CTRL_HPDIN_OVERRIDE_Msk (0x1U << TUSB546_REG_CTRL_HPDIN_OVERRIDE_Pos) /*!< 0x08*/
#define TUSB546_REG_CTRL_HPDIN_OVERRIDE TUSB546_REG_CTRL_HPDIN_OVERRIDE_Msk /*!< HPDIN control */
#define TUSB546_REG_CTRL_EQ_OVERRIDE_Pos (4U)
#define TUSB546_REG_CTRL_EQ_OVERRIDE_Msk (0x1U << TUSB546_REG_CTRL_EQ_OVERRIDE_Pos) /*!< 0x10*/
#define TUSB546_REG_CTRL_EQ_OVERRIDE TUSB546_REG_CTRL_EQ_OVERRIDE_Msk /*!< EQ settings control */
#define TUSB546_REG_CTRL_SWAP_HPDIN_Pos (5U)
#define TUSB546_REG_CTRL_SWAP_HPDIN_Msk (0x1U << TUSB546_REG_CTRL_SWAP_HPDIN_Pos) /*!< 0x20*/
#define TUSB546_REG_CTRL_SWAP_HPDIN TUSB546_REG_CTRL_SWAP_HPDIN_Msk /*!< HPDIN pin control */
/********************* Bit definition for DP_CTRL1 register *****************/
#define TUSB546_REG_DP_CTRL1_DP0EQ_SEL_Pos (0U)
#define TUSB546_REG_DP_CTRL1_DP0EQ_SEL_Msk (0xFU << TUSB546_REG_DP_CTRL1_DP0EQ_SEL_Pos) /*!< 0x0F */
#define TUSB546_REG_DP_CTRL1_DP0EQ_SEL TUSB546_REG_DP_CTRL1_DP0EQ_SEL_Msk /*!< Field selects between 0 to 14dB of EQ for DP lane 0 */
#define TUSB546_REG_DP_CTRL1_DP0EQ_SEL_0 (0x1 << TUSB546_REG_DP_CTRL1_DP0EQ_SEL_Pos) /*!< 0x01 */
#define TUSB546_REG_DP_CTRL1_DP0EQ_SEL_1 (0x2 << TUSB546_REG_DP_CTRL1_DP0EQ_SEL_Pos) /*!< 0x02 */
#define TUSB546_REG_DP_CTRL1_DP0EQ_SEL_2 (0x4 << TUSB546_REG_DP_CTRL1_DP0EQ_SEL_Pos) /*!< 0x04 */
#define TUSB546_REG_DP_CTRL1_DP0EQ_SEL_4 (0x8 << TUSB546_REG_DP_CTRL1_DP0EQ_SEL_Pos) /*!< 0x08 */
#define TUSB546_REG_DP_CTRL1_DP1EQ_SEL_Pos (4U)
#define TUSB546_REG_DP_CTRL1_DP1EQ_SEL_Msk (0xFU << TUSB546_REG_DP_CTRL1_DP1EQ_SEL_Pos) /*!< 0xF0*/
#define TUSB546_REG_DP_CTRL1_DP1EQ_SEL TUSB546_REG_DP_CTRL1_DP1EQ_SEL_Msk /*!< Field selects between 0 to 14dB of EQ for DP lane 1 */
#define TUSB546_REG_DP_CTRL1_DP1EQ_SEL_0 (0x1 << TUSB546_REG_DP_CTRL1_DP1EQ_SEL_Pos) /*!< 0x10 */
#define TUSB546_REG_DP_CTRL1_DP1EQ_SEL_1 (0x2 << TUSB546_REG_DP_CTRL1_DP1EQ_SEL_Pos) /*!< 0x20 */
#define TUSB546_REG_DP_CTRL1_DP1EQ_SEL_2 (0x4 << TUSB546_REG_DP_CTRL1_DP1EQ_SEL_Pos) /*!< 0x40 */
#define TUSB546_REG_DP_CTRL1_DP1EQ_SEL_4 (0x8 << TUSB546_REG_DP_CTRL1_DP1EQ_SEL_Pos) /*!< 0x80 */
/********************* Bit definition for DP_CTRL2 register *****************/
#define TUSB546_REG_DP_CTRL2_DP2EQ_SEL_Pos (0U)
#define TUSB546_REG_DP_CTRL2_DP2EQ_SEL_Msk (0xFU << TUSB546_REG_DP_CTRL2_DP2EQ_SEL_Pos) /*!< 0x0F */
#define TUSB546_REG_DP_CTRL2_DP2EQ_SEL TUSB546_REG_DP_CTRL2_DP2EQ_SEL_Msk /*!< Field selects between 0 to 14dB of EQ for DP lane 2 */
#define TUSB546_REG_DP_CTRL1_DP2EQ_SEL_0 (0x1 << TUSB546_REG_DP_CTRL2_DP2EQ_SEL_Pos) /*!< 0x01 */
#define TUSB546_REG_DP_CTRL1_DP2EQ_SEL_1 (0x2 << TUSB546_REG_DP_CTRL2_DP2EQ_SEL_Pos) /*!< 0x02 */
#define TUSB546_REG_DP_CTRL1_DP2EQ_SEL_2 (0x4 << TUSB546_REG_DP_CTRL2_DP2EQ_SEL_Pos) /*!< 0x04 */
#define TUSB546_REG_DP_CTRL1_DP2EQ_SEL_4 (0x8 << TUSB546_REG_DP_CTRL2_DP2EQ_SEL_Pos) /*!< 0x08 */
#define TUSB546_REG_DP_CTRL2_DP3EQ_SEL_Pos (4U)
#define TUSB546_REG_DP_CTRL2_DP3EQ_SEL_Msk (0xFU << TUSB546_REG_DP_CTRL2_DP3EQ_SEL_Pos) /*!< 0xF0*/
#define TUSB546_REG_DP_CTRL2_DP3EQ_SEL TUSB546_REG_DP_CTRL2_DP3EQ_SEL_Msk /*!< Field selects between 0 to 14dB of EQ for DP lane 3 */
#define TUSB546_REG_DP_CTRL1_DP3EQ_SEL_0 (0x1 << TUSB546_REG_DP_CTRL2_DP3EQ_SEL_Pos) /*!< 0x10 */
#define TUSB546_REG_DP_CTRL1_DP3EQ_SEL_1 (0x2 << TUSB546_REG_DP_CTRL2_DP3EQ_SEL_Pos) /*!< 0x20 */
#define TUSB546_REG_DP_CTRL1_DP3EQ_SEL_2 (0x4 << TUSB546_REG_DP_CTRL2_DP3EQ_SEL_Pos) /*!< 0x40 */
#define TUSB546_REG_DP_CTRL1_DP3EQ_SEL_4 (0x8 << TUSB546_REG_DP_CTRL2_DP3EQ_SEL_Pos) /*!< 0x80 */
/********************* Bit definition for DP_CTRL3 register *****************/
#define TUSB546_REG_DP_CTRL3_LANE_COUNT_SET_Pos (0U)
#define TUSB546_REG_DP_CTRL3_LANE_COUNT_SET_Msk (0x1FU << TUSB546_REG_DP_CTRL3_LANE_COUNT_SET_Pos) /*!< 0x1F */
#define TUSB546_REG_DP_CTRL3_LANE_COUNT_SET TUSB546_REG_DP_CTRL3_LANE_COUNT_SET_Msk /*!< */
#define TUSB546_REG_DP_CTRL3_SET_POWER_STATE_Pos (5U)
#define TUSB546_REG_DP_CTRL3_SET_POWER_STATE_Msk (0x3U << TUSB546_REG_DP_CTRL3_SET_POWER_STATE5_Pos) /*!< 0x60 */
#define TUSB546_REG_DP_CTRL3_SET_POWER_STATE TUSB546_REG_DP_CTRL3_SET_POWER_STATE5_Msk /*!< */
#define TUSB546_REG_DP_CTRL3_SET_POWER_STATE_0 (0x1 << TUSB546_REG_DP_CTRL3_SET_POWER_STATE_Pos) /*!< 0x20 */
#define TUSB546_REG_DP_CTRL3_SET_POWER_STATE_1 (0x2 << TUSB546_REG_DP_CTRL3_SET_POWER_STATE_Pos) /*!< 0x40 */
/********************* Bit definition for DP_CTRL4 register *****************/
#define TUSB546_REG_DP_CTRL4_DP0_DISABLE_Pos (0U)
#define TUSB546_REG_DP_CTRL4_DP0_DISABLE_Msk (0x1U << TUSB546_REG_DP_CTRL4_DP0_DISABLE_Pos) /*!< 0x01 */
#define TUSB546_REG_DP_CTRL4_DP0_DISABLE TUSB546_REG_DP_CTRL4_DP0_DISABLE_Msk /*!< DP Lane 0 disable */
#define TUSB546_REG_DP_CTRL4_DP1_DISABLE_Pos (1U)
#define TUSB546_REG_DP_CTRL4_DP1_DISABLE_Msk (0x1U << TUSB546_REG_DP_CTRL4_DP1_DISABLE_Pos) /*!< 0x02 */
#define TUSB546_REG_DP_CTRL4_DP1_DISABLE TUSB546_REG_DP_CTRL4_DP1_DISABLE_Msk /*!< DP Lane 1 disable */
#define TUSB546_REG_DP_CTRL4_DP2_DISABLE_Pos (2U)
#define TUSB546_REG_DP_CTRL4_DP2_DISABLE_Msk (0x1U << TUSB546_REG_DP_CTRL4_DP2_DISABLE_Pos) /*!< 0x04 */
#define TUSB546_REG_DP_CTRL4_DP2_DISABLE TUSB546_REG_DP_CTRL4_DP2_DISABLE_Msk /*!< DP Lane 2 disable */
#define TUSB546_REG_DP_CTRL4_DP3_DISABLE_Pos (3U)
#define TUSB546_REG_DP_CTRL4_DP3_DISABLE_Msk (0x1U << TUSB546_REG_DP_CTRL4_DP3_DISABLE_Pos) /*!< 0x08 */
#define TUSB546_REG_DP_CTRL4_DP3_DISABLE TUSB546_REG_DP_CTRL4_DP3_DISABLE_Msk /*!< DP Lane 3 disable */
#define TUSB546_REG_DP_CTRL4_AUX_SBU_OVR_Pos (4U)
#define TUSB546_REG_DP_CTRL4_AUX_SBU_OVR_Msk (0x3U << TUSB546_REG_DP_CTRL4_AUX_SBU_OVR_Pos) /*!< 0x30 */
#define TUSB546_REG_DP_CTRL4_AUX_SBU_OVR TUSB546_REG_DP_CTRL4_AUX_SBU_OVR_Msk /*!< AUX to SBU config */
#define TUSB546_REG_DP_CTRL4_AUX_SBU_OVR_0 (0x1 << TUSB546_REG_DP_CTRL4_AUX_SBU_OVR_Pos) /*!< 0x10 */
#define TUSB546_REG_DP_CTRL4_AUX_SBU_OVR_1 (0x2 << TUSB546_REG_DP_CTRL4_AUX_SBU_OVR_Pos) /*!< 0x20 */
#define TUSB546_REG_DP_CTRL4_SNOOP_DISABLE_Pos (7U)
#define TUSB546_REG_DP_CTRL4_SNOOP_DISABLE_Msk (0x1U << TUSB546_REG_DP_CTRL4_SNOOP_DISABLE_Pos) /*!< 0x80 */
#define TUSB546_REG_DP_CTRL4_SNOOP_DISABLE TUSB546_REG_DP_CTRL4_SNOOP_DISABLE_Msk /*!< AUX snoop disable */
/******************** Bit definition for USB3_CTRL1 register ****************/
#define TUSB546_REG_USB3_CTRL1_EQ1_SEL_Pos (0U)
#define TUSB546_REG_USB3_CTRL1_EQ1_SEL_Msk (0xFU << TUSB546_REG_USB3_CTRL1_EQ1_SEL_Pos) /*!< 0x0F */
#define TUSB546_REG_USB3_CTRL1_EQ1_SEL TUSB546_REG_USB3_CTRL1_EQ1_SEL_Msk /*!< Field selects between 0 to 11 dB of EQ for USB3.1 RX1 receiver */
#define TUSB546_REG_USB3_CTRL1_EQ1_SEL_0 (0x1 << TUSB546_REG_USB3_CTRL1_EQ1_SEL_Pos) /*!< 0x01 */
#define TUSB546_REG_USB3_CTRL1_EQ1_SEL_1 (0x2 << TUSB546_REG_USB3_CTRL1_EQ1_SEL_Pos) /*!< 0x02 */
#define TUSB546_REG_USB3_CTRL1_EQ1_SEL_2 (0x4 << TUSB546_REG_USB3_CTRL1_EQ1_SEL_Pos) /*!< 0x04 */
#define TUSB546_REG_USB3_CTRL1_EQ1_SEL_4 (0x8 << TUSB546_REG_USB3_CTRL1_EQ1_SEL_Pos) /*!< 0x08 */
#define TUSB546_REG_USB3_CTRL1_EQ2_SEL_Pos (4U)
#define TUSB546_REG_USB3_CTRL1_EQ2_SEL_Msk (0xFU << TUSB546_REG_USB3_CTRL1_EQ2_SEL_Pos) /*!< 0xF0 */
#define TUSB546_REG_USB3_CTRL1_EQ2_SEL TUSB546_REG_USB3_CTRL1_EQ2_SEL_Msk /*!< Field selects between 0 to 11 dB of EQ for USB3.1 RX2 receiver */
#define TUSB546_REG_USB3_CTRL1_EQ2_SEL_0 (0x1 << TUSB546_REG_USB3_CTRL1_EQ2_SEL_Pos) /*!< 0x10 */
#define TUSB546_REG_USB3_CTRL1_EQ2_SEL_1 (0x2 << TUSB546_REG_USB3_CTRL1_EQ2_SEL_Pos) /*!< 0x20 */
#define TUSB546_REG_USB3_CTRL1_EQ2_SEL_2 (0x4 << TUSB546_REG_USB3_CTRL1_EQ2_SEL_Pos) /*!< 0x40 */
#define TUSB546_REG_USB3_CTRL1_EQ2_SEL_4 (0x8 << TUSB546_REG_USB3_CTRL1_EQ2_SEL_Pos) /*!< 0x80 */
/******************** Bit definition for USB3_CTRL2 register ****************/
#define TUSB546_USB3_CTRL2_SSEQ_SEL_Pos (0U)
#define TUSB546_USB3_CTRL2_SSEQ_SEL_Msk (0xFU << TUSB546_USB3_CTRL2_SSEQ_SEL_Pos) /*!< 0x0F */
#define TUSB546_USB3_CTRL2_SSEQ_SEL TUSB546_USB3_CTRL2_SSEQ_SEL_Msk /*!< Field selects between 0 to 9 dB of EQ for USB3.1 SSTXP/N receiver */
#define TUSB546_USB3_CTRL2_SSEQ_SEL_0 (0x1 << TUSB546_USB3_CTRL2_SSEQ_SEL_Pos) /*!< 0x01 */
#define TUSB546_USB3_CTRL2_SSEQ_SEL_1 (0x2 << TUSB546_USB3_CTRL2_SSEQ_SEL_Pos) /*!< 0x02 */
#define TUSB546_USB3_CTRL2_SSEQ_SEL_2 (0x4 << TUSB546_USB3_CTRL2_SSEQ_SEL_Pos) /*!< 0x04 */
#define TUSB546_USB3_CTRL2_SSEQ_SEL_4 (0x8 << TUSB546_USB3_CTRL2_SSEQ_SEL_Pos) /*!< 0x08 */
/******************** Bit definition for USB3_CTRL3 register ****************/
#define TUSB546_REG_USB3_CTRL3_COMPLIANCE_Pos (0U)
#define TUSB546_REG_USB3_CTRL3_COMPLIANCE_Msk (0x3U << TUSB546_REG_USB3_CTRL3_COMPLIANCE_Pos) /*!< 0x03 */
#define TUSB546_REG_USB3_CTRL3_COMPLIANCE TUSB546_REG_USB3_CTRL3_COMPLIANCE_Msk /*!< Compliance mode */
#define TUSB546_REG_USB3_CTRL3_COMPLIANCE_0 (0x1 << TUSB546_REG_USB3_CTRL3_COMPLIANCE_Pos) /*!< 0x01 */
#define TUSB546_REG_USB3_CTRL3_COMPLIANCE_1 (0x2 << TUSB546_REG_USB3_CTRL3_COMPLIANCE_Pos) /*!< 0x02 */
#define TUSB546_REG_USB3_CTRL3_DFP_RXDET_INTERVAL_Pos (2U)
#define TUSB546_REG_USB3_CTRL3_DFP_RXDET_INTERVAL_Msk (0x3U << TUSB546_REG_USB3_CTRL3_DFP_RXDET_INTERVAL_Pos) /*!< 0x0C */
#define TUSB546_REG_USB3_CTRL3_DFP_RXDET_INTERVAL TUSB546_REG_USB3_CTRL3_DFP_RXDET_INTERVAL_Msk /*!< Rx.Detect interval for the Downstream facing port */
#define TUSB546_REG_USB3_CTRL3_DFP_RXDET_INTERVAL_0 (0x1 << TUSB546_REG_USB3_CTRL3_DFP_RXDET_INTERVAL_Pos) /*!< 0x04 */
#define TUSB546_REG_USB3_CTRL3_DFP_RXDET_INTERVAL_1 (0x2 << TUSB546_REG_USB3_CTRL3_DFP_RXDET_INTERVAL_Pos) /*!< 0x08 */
#define TUSB546_REG_USB3_CTRL3_DISABLE_U2U3_RXDET_Pos (4U)
#define TUSB546_REG_USB3_CTRL3_DISABLE_U2U3_RXDET_Msk (0x1U << TUSB546_REG_USB3_CTRL3_DISABLE_U2U3_RXDET_Pos) /*!< 0x10 */
#define TUSB546_REG_USB3_CTRL3_DISABLE_U2U3_RXDET TUSB546_REG_USB3_CTRL3_DISABLE_U2U3_RXDET_Msk /*!< Rx.Detect in U2/U3 disabled */
#define TUSB546_REG_USB3_CTRL3_U2U3_LFPS_DEBOUNCE_Pos (5U)
#define TUSB546_REG_USB3_CTRL3_U2U3_LFPS_DEBOUNCE_Msk (0x1U << TUSB546_REG_USB3_CTRL3_U2U3_LFPS_DEBOUNCE_Pos) /*!< 0x20 */
#define TUSB546_REG_USB3_CTRL3_U2U3_LFPS_DEBOUNCE TUSB546_REG_USB3_CTRL3_U2U3_LFPS_DEBOUNCE_Msk /*!< Debounce of LFPS before U2/U3 exit enabled */
#define TUSB546_REG_USB3_CTRL3_LFPS_EQ_Pos (6U)
#define TUSB546_REG_USB3_CTRL3_LFPS_EQ_Msk (0x1U << TUSB546_REG_USB3_CTRL3_LFPS_EQ_Pos) /*!< 0x40 */
#define TUSB546_REG_USB3_CTRL3_LFPS_EQ TUSB546_REG_USB3_CTRL3_LFPS_EQ_Msk /*!< EQ settings control */
#define TUSB546_REG_USB3_CM_ACTIVE_EQ_Pos (7U)
#define TUSB546_REG_USB3_CM_ACTIVE_EQ_Msk (0x1U << TUSB546_REG_USB3_CM_ACTIVE_EQ_Pos) /*!< 0x80 */
#define TUSB546_REG_USB3_CM_ACTIVE_EQ TUSB546_REG_USB3_CM_ACTIVE_EQ_Msk /*!< USB 3.1 compliance mode */
/** @defgroup TUSB546_MODE TUSB546 functioning mode
* @{
*/
#define TUSB546_MODE_DISABLED 0x0U
#define TUSB546_MODE_USB3_ONLY TUSB546_REG_CTRL_CTLSEL_0
#define TUSB546_MODE_FOUR_DPLANES TUSB546_REG_CTRL_CTLSEL_1
#define TUSB546_MODE_TWO_DPLANES_USB3 TUSB546_REG_CTRL_CTLSEL
/**
* @}
*/
/** @defgroup TUSB546_ORIENTATION TUSB546 Type-C Cable Orientation
* @{
*/
#define TUSB546_ORIENTATION_NORMAL 0x0U
#define TUSB546_ORIENTATION_FLIPPED TUSB546_REG_CTRL_FLIPSEL
/**
* @}
*/
/** @defgroup TUSB546_DPLANE DP Lane Identifier
* @{
*/
#define TUSB546_DPLANE_0 0x0U
#define TUSB546_DPLANE_1 0x2U
#define TUSB546_DPLANE_2 0x4U
#define TUSB546_DPLANE_3 0x8U
#define TUSB546_DPLANE_ALL 0xFU
/**
* @}
*/
/** @defgroup TUSB546_USBSIGNAL TUSB546 USB 3.1 signal identifier
* @{
*/
#define TUSB546_USBSIGNAL_RX1 0x0U
#define TUSB546_USBSIGNAL_RX2 0x1U
#define TUSB546_USBSIGNAL_SSTX 0x2U
/**
* @}
*/
/** @defgroup TUSB546_EQGAIN TUSB546 Equalizer Gain
* @{
.------------------------.-------------------------.-------------------------.------------------------.
| Equalization setting # | USB3.1 DFP EQ Gain (dB) | USB3.1 UFP EQ Gain (dB) | DISPLAYPORT LANES (dB) |
'------------------------'-------------------------'-------------------------'------------------------'
| 0 | 0.2 | -1.6 | 1.0 |
| 1 | 1.2 | -0.5 | 3.3 |
| 2 | 2.2 | 0.5 | 4.9 |
| 3 | 3.3 | 1.6 | 6.5 |
| 4 | 4.2 | 2.4 | 7.5 |
| 5 | 5.1 | 3.4 | 8.6 |
| 6 | 5.9 | 4.1 | 9.5 |
| 7 | 6.7 | 4.9 | 10.4 |
| 8 | 7.4 | 5.7 | 11.1 |
| 9 | 8.1 | 6.4 | 11.7 |
| 10 | 8.7 | 6.9 | 12.3 |
| 11 | 9.3 | 7.5 | 12.8 |
| 12 | 9.7 | 8.0 | 13.2 |
| 13 | 10.2 | 8.5 | 13.6 |
| 14 | 10.6 | 8.9 | 14.0 |
| 15 | 11.1 | 9.4 | 14.4 |
'------------------------'-------------------------'-------------------------'------------------------'
*/
#define TUSB546_EQGAIN_0 0x0U
#define TUSB546_EQGAIN_1 0x1U
#define TUSB546_EQGAIN_2 0x2U
#define TUSB546_EQGAIN_3 0x3U
#define TUSB546_EQGAIN_4 0x4U
#define TUSB546_EQGAIN_5 0x5U
#define TUSB546_EQGAIN_6 0x6U
#define TUSB546_EQGAIN_7 0x7U
#define TUSB546_EQGAIN_8 0x8U
#define TUSB546_EQGAIN_9 0x9U
#define TUSB546_EQGAIN_10 0xAU
#define TUSB546_EQGAIN_11 0xBU
#define TUSB546_EQGAIN_12 0xCU
#define TUSB546_EQGAIN_13 0xDU
#define TUSB546_EQGAIN_14 0xEU
#define TUSB546_EQGAIN_15 0xFU
/**
* @}
*/
/** @defgroup TUSB546_DPCDREG TUSB546 Display Port Configuration Data (DPCD) register identifier
* @{
*/
#define TUSB546_DPCDREG_LANE_COUNT_SET 0x0U
#define TUSB546_DPCDREG_SET_POWER 0x1U
/**
* @}
*/
/** @defgroup TUSB546_AUXTOSBU TUSB546 AUXp or AUXn to SBU1 or SBU2 connect/disconnect override
* @{
*/
#define TUSB546_AUXTOSBU_DEFAULT 0x0U
#define TUSB546_AUXTOSBU_OVERRIDE 0x1U
#define TUSB546_AUXTOSBU_OPEN 0x2U
/**
* @}
*/
/** @defgroup TUSB546_USB3_COMPLIANCEMODE USB 3.1 Compliance mode
* @{
*/
#define TUSB546_USB3_COMPLIANCEMODE_FSM 0x0U
#define TUSB546_USB3_COMPLIANCEMODE_DFP TUSB546_REG_USB3_CTRL3_COMPLIANCE_0
#define TUSB546_USB3_COMPLIANCEMODE_UFP TUSB546_REG_USB3_CTRL3_COMPLIANCE_1
#define TUSB546_USB3_COMPLIANCEMODE_DISABLED TUSB546_REG_USB3_CTRL3_COMPLIANCE
/**
* @}
*/
/** @defgroup TUSB546_RXDET_INTERVAL USB 3.1 Rx.Detect interval for the Downstream facing port (TX1P/N and TX2P/N)
* @{
*/
#define TUSB546_RXDET_INTERVAL_8MS 0x0U
#define TUSB546_RXDET_INTERVAL_12MS TUSB546_REG_USB3_CTRL3_DFP_RXDET_INTERVAL_0
#define TUSB546_RXDET_INTERVAL_48MS TUSB546_REG_USB3_CTRL3_DFP_RXDET_INTERVAL_1
#define TUSB546_RXDET_INTERVAL_96MS TUSB546_REG_USB3_CTRL3_DFP_RXDET_INTERVAL
/**
* @}
*/
/**
* @}
*/
#if defined(TUSB546_DEBUG)
/** @defgroup TUSB546_Exported_Structure TUSB546 Exported Structure
* @{
*/
typedef union {
uint8_t Register;
struct {
uint8_t CTLSEL:2;
uint8_t FLIPSEL:1;
uint8_t HPDIN_OVRRIDE:1;
uint8_t EQ_OVERRIDE:1;
uint8_t SWAP_HPDIN :1;
uint8_t Reserved:2;
};
} TUSB546_GeneralRegTypeDef;
typedef union {
uint8_t Register;
struct {
uint8_t DP0EQ_SEL:4;
uint8_t DP1EQ_SEL:4;
};
} TUSB546_DPCtrlStatusReg10TypeDef;
typedef union {
uint8_t Register;
struct {
uint8_t DP2EQ_SEL:4;
uint8_t DP3EQ_SEL:4;
};
} TUSB546_DPCtrlStatusReg11TypeDef;
typedef union {
uint8_t Register;
struct {
uint8_t LANE_COUNT_SET :5;
uint8_t SET_POWER_STATE :2;
uint8_t Reserved :1;
};
} TUSB546_DPCtrlStatusReg12TypeDef;
typedef union {
uint8_t Register;
struct {
uint8_t DP0_DISABLE :1;
uint8_t DP1_DISABLE :1;
uint8_t DP2_DISABLE :1;
uint8_t DP3_DISABLE :1;
uint8_t AUX_SBU_OVR :2;
uint8_t Reserved :1;
uint8_t AUX_SNOOP_DISABLE :1;
};
} TUSB546_DPCtrlStatusReg13TypeDef;
typedef union {
uint8_t Register;
struct {
uint8_t Reserved :8;
};
} TUSB546_USBCtrlStatusReg20TypeDef;
typedef union {
uint8_t Register;
struct {
uint8_t Reserved :8;
};
} TUSB546_USBCtrlStatusReg21TypeDef;
typedef union {
uint8_t Register;
struct {
uint8_t Reserved :8;
};
} TUSB546_USBCtrlStatusReg22TypeDef;
typedef struct
{
TUSB546_GeneralRegTypeDef General; /*!< General Registers (0x0A) */
TUSB546_DPCtrlStatusReg10TypeDef DPCtrlStatus10; /*!< DisplayPort Control/Status Registers (0x10)*/
TUSB546_DPCtrlStatusReg11TypeDef DPCtrlStatus11; /*!< DisplayPort Control/Status Registers (0x11)*/
TUSB546_DPCtrlStatusReg12TypeDef DPCtrlStatus12; /*!< DisplayPort Control/Status Registers (0x12) */
TUSB546_DPCtrlStatusReg13TypeDef DPCtrlStatus13; /*!< DisplayPort Control/Status Registers (0x13) */
TUSB546_USBCtrlStatusReg20TypeDef USBCtrlStatus20;/*!< USB3.1 Control/Status Registers (0x20) */
TUSB546_USBCtrlStatusReg21TypeDef USBCtrlStatus21;/*!< USB3.1 Control/Status Registers (0x21) */
TUSB546_USBCtrlStatusReg22TypeDef USBCtrlStatus22;/*!< USB3.1 Control/Status Registers (0x22) */
} TUSB546_RegistersTypeDef;
/**
* @}
*/
#endif /* TUSB546_DEBUG */
/** @defgroup TUSB546_Exported_Functions
* @{
*/
/* USB Type-C cross switch management functions */
uint32_t tusb546_CrossSwitch_Init(uint16_t Address);
void tusb546_CrossSwitch_DeInit(uint16_t Address);
uint32_t tusb546_CrossSwitch_PowerOn(uint16_t Address);
uint32_t tusb546_CrossSwitch_PowerOff(uint16_t Address);
uint32_t tusb546_CrossSwitch_SetMode(uint16_t Address, TYPECSWITCH_Mode_t Mode);
uint32_t tusb546_CrossSwitch_IsSupportedMode(TYPECSWITCH_Mode_t Mode);
/* DisplayPort Linear Redriver management functions */
uint32_t tusb546_DPRedriver_Init(uint16_t Address);
void tusb546_DPRedriver_DeInit(uint16_t Address);
uint32_t tusb546_DPRedriver_PowerOn(uint16_t Address);
uint32_t tusb546_DPRedriver_PowerOff(uint16_t Address);
uint32_t tusb546_DPRedriver_SetEQGain(uint16_t Address, DPREDRIVER_ChannelId_t ChannelId, uint8_t EQGain);
uint32_t tusb546_DPRedriver_EnableChannel(uint16_t Address, DPREDRIVER_ChannelId_t ChannelId);
uint32_t tusb546_DPRedriver_DisableChannel(uint16_t Address, DPREDRIVER_ChannelId_t ChannelId);
/* MUX IO functions */
uint8_t MUX_IO_Init(void);
void MUX_IO_DeInit(void);
uint8_t MUX_IO_Write(uint16_t Addr, uint16_t Reg, uint8_t Data);
uint8_t MUX_IO_Read(uint16_t Addr, uint16_t Reg, uint8_t *pData);
uint32_t MUX_IO_IsDeviceReady(uint16_t DevAddress, uint32_t Trials);
/**
* @}
*/
/** @defgroup TUSB546_Exported_Variables
* @{
*/
/* USB Type-C crossbar switch driver structure */
extern TYPECSWITCH_Drv_t tusb546_drv_CrossSwitch;
/* Displayport Linear Redriver driver structure */
extern DPREDRIVER_Drv_t tusb546_drv_LinearRedriver;
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* TUSB546_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/