Sync inav to Gitea
Make sure docs are updated / settings_md (push) Canceled after 0s
Build firmware / test (push) Canceled after 0s
Build firmware / build-SITL-Windows (push) Canceled after 0s
Build firmware / build-SITL-Mac (push) Canceled after 0s
Build firmware / build-SITL-Linux (push) Canceled after 0s
Build firmware / build-SITL-Linux-arm64 (push) Canceled after 0s
Build firmware / upload-artifacts (push) Canceled after 0s
Build firmware / build-single-target (push) Canceled after 0s
Build firmware / build (9) (push) Canceled after 0s
Build firmware / build (8) (push) Canceled after 0s
Build firmware / build (7) (push) Canceled after 0s
Build firmware / build (6) (push) Canceled after 0s
Build firmware / build (5) (push) Canceled after 0s
Build firmware / build (4) (push) Canceled after 0s
Build firmware / build (3) (push) Canceled after 0s
Build firmware / build (2) (push) Canceled after 0s
Build firmware / build (14) (push) Canceled after 0s
Build firmware / build (13) (push) Canceled after 0s
Build firmware / build (12) (push) Canceled after 0s
Build firmware / build (11) (push) Canceled after 0s
Build firmware / build (10) (push) Canceled after 0s
Build firmware / build (1) (push) Canceled after 0s
Build firmware / build (0) (push) Canceled after 0s
Build firmware / detect (push) Canceled after 0s
Build pre-release / build (push) Canceled after 0s
Build pre-release / Release (push) Canceled after 0s

This commit is contained in:
2026-08-03 16:37:40 +08:00
commit dac37fd077
14095 changed files with 5603119 additions and 0 deletions
@@ -0,0 +1,186 @@
/**
******************************************************************************
* @file adafruit_802_conf.h
* @author MCD Application Team
* @brief This file includes the nucleo configuration and errno files
*
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2018 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 ADAFRUIT_802_CONF_H
#define ADAFRUIT_802_CONF_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32f4xx_nucleo_conf.h"
#include "stm32f4xx_nucleo_errno.h"
#include "stm32f4xx_nucleo_bus.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup ADAFRUIT_802
* @{
*/
/** @defgroup ADAFRUIT_802_CONFIG Config
* @{
*/
#if !defined (USE_NUCLEO_64) && !defined (USE_NUCLEO_144)
#error "Board Pin number not defined"
#endif
/** @defgroup ADAFRUIT_802_CONFIG_Exported_Constants Exported Constants
* @{
*/
#define BUS_SPIx_Init BSP_SPI1_Init
#define BUS_SPIx_Recv BSP_SPI1_Recv
#define BUS_SPIx_Send BSP_SPI1_Send
#define BUS_SPIx_SendRecv BSP_SPI1_SendRecv
/**
* @brief ADC Interface pins
* used to detect motion of Joystick available on Adafruit 1.8" TFT shield
*/
#if defined (USE_NUCLEO_64)
#define ADAFRUIT_802_ADCx ADC1
#define ADAFRUIT_802_ADCx_CLK_ENABLE() __HAL_RCC_ADC1_CLK_ENABLE()
#define ADAFRUIT_802_ADCx_CLK_DISABLE() __HAL_RCC_ADC1_CLK_DISABLE()
#define ADAFRUIT_802_ADCx_CHANNEL ADC_CHANNEL_8
#define ADAFRUIT_802_ADCx_GPIO_PORT GPIOB
#define ADAFRUIT_802_ADCx_GPIO_PIN GPIO_PIN_0
#define ADAFRUIT_802_ADCx_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
#define ADAFRUIT_802_ADCx_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
#else /* USE_NUCLEO_144 */
#if defined(ADC3)
#define ADAFRUIT_802_ADCx ADC3
#define ADAFRUIT_802_ADCx_CLK_ENABLE() __HAL_RCC_ADC3_CLK_ENABLE()
#define ADAFRUIT_802_ADCx_CLK_DISABLE() __HAL_RCC_ADC3_CLK_DISABLE()
#define ADAFRUIT_802_ADCx_CHANNEL ADC_CHANNEL_9
#define ADAFRUIT_802_ADCx_GPIO_PORT GPIOF
#define ADAFRUIT_802_ADCx_GPIO_PIN GPIO_PIN_3
#define ADAFRUIT_802_ADCx_GPIO_CLK_ENABLE() __HAL_RCC_GPIOF_CLK_ENABLE()
#define ADAFRUIT_802_ADCx_GPIO_CLK_DISABLE() __HAL_RCC_GPIOF_CLK_DISABLE()
#else
#define ADAFRUIT_802_ADCx ADC1
#define ADAFRUIT_802_ADCx_CLK_ENABLE() __HAL_RCC_ADC1_CLK_ENABLE()
#define ADAFRUIT_802_ADCx_CLK_DISABLE() __HAL_RCC_ADC1_CLK_DISABLE()
#define ADAFRUIT_802_ADCx_CHANNEL ADC_CHANNEL_11
#define ADAFRUIT_802_ADCx_GPIO_PORT GPIOC
#define ADAFRUIT_802_ADCx_GPIO_PIN GPIO_PIN_1
#define ADAFRUIT_802_ADCx_GPIO_CLK_ENABLE() __HAL_RCC_GPIOC_CLK_ENABLE()
#define ADAFRUIT_802_ADCx_GPIO_CLK_DISABLE() __HAL_RCC_GPIOC_CLK_DISABLE()
#endif
#endif
#define ADAFRUIT_802_ADCx_RANK 1U
#define ADAFRUIT_802_ADCx_SAMPLETIME ADC_SAMPLETIME_3CYCLES
#define ADAFRUIT_802_ADCx_PRESCALER ADC_CLOCKPRESCALER_PCLK_DIV4
#define ADAFRUIT_802_ADCx_POLL_TIMEOUT 10U
#if defined (USE_NUCLEO_64)
/**
* @brief SD Control Interface pins (shield D4)
*/
#define ADAFRUIT_802_SD_CS_PIN GPIO_PIN_5
#define ADAFRUIT_802_SD_CS_GPIO_PORT GPIOB
#define ADAFRUIT_802_SD_CS_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
#define ADAFRUIT_802_SD_CS_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
/**
* @brief LCD Control Interface pins (shield D10)
*/
#define ADAFRUIT_802_LCD_CS_PIN GPIO_PIN_6
#define ADAFRUIT_802_LCD_CS_GPIO_PORT GPIOB
#define ADAFRUIT_802_LCD_CS_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
#define ADAFRUIT_802_LCD_CS_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
/**
* @brief LCD Data/Command Interface pins (shield D8)
*/
#define ADAFRUIT_802_LCD_DC_PIN GPIO_PIN_9
#define ADAFRUIT_802_LCD_DC_GPIO_PORT GPIOA
#define ADAFRUIT_802_LCD_DC_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
#define ADAFRUIT_802_LCD_DC_GPIO_CLK_DISABLE() __HAL_RCC_GPIOA_CLK_DISABLE()
#else /* USE_NUCLEO_144 */
/**
* @brief SD Control Interface pins (shield D4)
*/
#define ADAFRUIT_802_SD_CS_PIN GPIO_PIN_14
#define ADAFRUIT_802_SD_CS_GPIO_PORT GPIOF
#define ADAFRUIT_802_SD_CS_GPIO_CLK_ENABLE() __HAL_RCC_GPIOF_CLK_ENABLE()
#define ADAFRUIT_802_SD_CS_GPIO_CLK_DISABLE() __HAL_RCC_GPIOF_CLK_DISABLE()
/**
* @brief LCD Control Interface pins (shield D10)
*/
#define ADAFRUIT_802_LCD_CS_PIN GPIO_PIN_14
#define ADAFRUIT_802_LCD_CS_GPIO_PORT GPIOD
#define ADAFRUIT_802_LCD_CS_GPIO_CLK_ENABLE() __HAL_RCC_GPIOD_CLK_ENABLE()
#define ADAFRUIT_802_LCD_CS_GPIO_CLK_DISABLE() __HAL_RCC_GPIOD_CLK_DISABLE()
/**
* @brief LCD Data/Command Interface pins (shield D8)
*/
#define ADAFRUIT_802_LCD_DC_PIN GPIO_PIN_12
#define ADAFRUIT_802_LCD_DC_GPIO_PORT GPIOF
#define ADAFRUIT_802_LCD_DC_GPIO_CLK_ENABLE() __HAL_RCC_GPIOF_CLK_ENABLE()
#define ADAFRUIT_802_LCD_DC_GPIO_CLK_DISABLE() __HAL_RCC_GPIOF_CLK_DISABLE()
#endif
/**
* @brief SD Control Lines management
*/
#define ADAFRUIT_802_SD_CS_LOW() HAL_GPIO_WritePin(ADAFRUIT_802_SD_CS_GPIO_PORT, ADAFRUIT_802_SD_CS_PIN, GPIO_PIN_RESET)
#define ADAFRUIT_802_SD_CS_HIGH() HAL_GPIO_WritePin(ADAFRUIT_802_SD_CS_GPIO_PORT, ADAFRUIT_802_SD_CS_PIN, GPIO_PIN_SET)
/**
* @brief LCD Control Lines management
*/
#define ADAFRUIT_802_LCD_CS_LOW() HAL_GPIO_WritePin(ADAFRUIT_802_LCD_CS_GPIO_PORT, ADAFRUIT_802_LCD_CS_PIN, GPIO_PIN_RESET)
#define ADAFRUIT_802_LCD_CS_HIGH() HAL_GPIO_WritePin(ADAFRUIT_802_LCD_CS_GPIO_PORT, ADAFRUIT_802_LCD_CS_PIN, GPIO_PIN_SET)
#define ADAFRUIT_802_LCD_DC_LOW() HAL_GPIO_WritePin(ADAFRUIT_802_LCD_DC_GPIO_PORT, ADAFRUIT_802_LCD_DC_PIN, GPIO_PIN_RESET)
#define ADAFRUIT_802_LCD_DC_HIGH() HAL_GPIO_WritePin(ADAFRUIT_802_LCD_DC_GPIO_PORT, ADAFRUIT_802_LCD_DC_PIN, GPIO_PIN_SET)
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* ADAFRUIT_802_CONF_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
@@ -0,0 +1,138 @@
/**
******************************************************************************
* @file adafruit_802_conf.h
* @author MCD Application Team
* @brief This file includes the nucleo configuration and errno files
*
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2018 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 ADAFRUIT_802_CONF_H
#define ADAFRUIT_802_CONF_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32f7xx_nucleo_conf.h"
#include "stm32f7xx_nucleo_errno.h"
#include "stm32f7xx_nucleo_bus.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup ADAFRUIT_802
* @{
*/
/** @defgroup ADAFRUIT_802_CONFIG Config
* @{
*/
#if !defined (USE_NUCLEO_144)
#error "Board Pin number not defined"
#endif
/** @defgroup ADAFRUIT_802_CONFIG_Exported_Constants Exported Constants
* @{
*/
#define BUS_SPIx_Init BSP_SPI1_Init
#define BUS_SPIx_Recv BSP_SPI1_Recv
#define BUS_SPIx_Send BSP_SPI1_Send
#define BUS_SPIx_SendRecv BSP_SPI1_SendRecv
/**
* @brief ADC Interface pins
* used to detect motion of Joystick available on Adafruit 1.8" TFT shield
*/
#if defined (USE_NUCLEO_144)
#define NUCLEO_ADCx ADC3
#define NUCLEO_ADCx_CLK_ENABLE() __HAL_RCC_ADC3_CLK_ENABLE()
#define NUCLEO_ADCx_CLK_DISABLE() __HAL_RCC_ADC3_CLK_DISABLE()
#define NUCLEO_ADCx_CHANNEL ADC_CHANNEL_9
#define NUCLEO_ADCx_GPIO_PORT GPIOF
#define NUCLEO_ADCx_GPIO_PIN GPIO_PIN_3
#define NUCLEO_ADCx_GPIO_CLK_ENABLE() __HAL_RCC_GPIOF_CLK_ENABLE()
#define NUCLEO_ADCx_GPIO_CLK_DISABLE() __HAL_RCC_GPIOF_CLK_DISABLE()
#define ADAFRUIT_802_ADCx_RANK 1U
#define ADAFRUIT_802_ADCx_SAMPLETIME ADC_SAMPLETIME_3CYCLES
#define ADAFRUIT_802_ADCx_PRESCALER ADC_CLOCK_SYNC_DIV4
#define ADAFRUIT_802_ADCx_POLL_TIMEOUT 10U
/**
* @brief SD Control Interface pins (shield D4)
*/
#define NUCLEO_SD_CS_PIN GPIO_PIN_14
#define NUCLEO_SD_CS_GPIO_PORT GPIOF
#define NUCLEO_SD_CS_GPIO_CLK_ENABLE() __HAL_RCC_GPIOF_CLK_ENABLE()
#define NUCLEO_SD_CS_GPIO_CLK_DISABLE() __HAL_RCC_GPIOF_CLK_DISABLE()
/**
* @brief LCD Control Interface pins (shield D10)
*/
#define NUCLEO_LCD_CS_PIN GPIO_PIN_14
#define NUCLEO_LCD_CS_GPIO_PORT GPIOD
#define NUCLEO_LCD_CS_GPIO_CLK_ENABLE() __HAL_RCC_GPIOD_CLK_ENABLE()
#define NUCLEO_LCD_CS_GPIO_CLK_DISABLE() __HAL_RCC_GPIOD_CLK_DISABLE()
/**
* @brief LCD Data/Command Interface pins (shield D8)
*/
#define NUCLEO_LCD_DC_PIN GPIO_PIN_12
#define NUCLEO_LCD_DC_GPIO_PORT GPIOF
#define NUCLEO_LCD_DC_GPIO_CLK_ENABLE() __HAL_RCC_GPIOF_CLK_ENABLE()
#define NUCLEO_LCD_DC_GPIO_CLK_DISABLE() __HAL_RCC_GPIOF_CLK_DISABLE()
#endif
/**
* @brief SD Control Lines management
*/
#define SD_CS_LOW() HAL_GPIO_WritePin(NUCLEO_SD_CS_GPIO_PORT, NUCLEO_SD_CS_PIN, GPIO_PIN_RESET)
#define SD_CS_HIGH() HAL_GPIO_WritePin(NUCLEO_SD_CS_GPIO_PORT, NUCLEO_SD_CS_PIN, GPIO_PIN_SET)
/**
* @brief LCD Control Lines management
*/
#define LCD_CS_LOW() HAL_GPIO_WritePin(NUCLEO_LCD_CS_GPIO_PORT, NUCLEO_LCD_CS_PIN, GPIO_PIN_RESET)
#define LCD_CS_HIGH() HAL_GPIO_WritePin(NUCLEO_LCD_CS_GPIO_PORT, NUCLEO_LCD_CS_PIN, GPIO_PIN_SET)
#define LCD_DC_LOW() HAL_GPIO_WritePin(NUCLEO_LCD_DC_GPIO_PORT, NUCLEO_LCD_DC_PIN, GPIO_PIN_RESET)
#define LCD_DC_HIGH() HAL_GPIO_WritePin(NUCLEO_LCD_DC_GPIO_PORT, NUCLEO_LCD_DC_PIN, GPIO_PIN_SET)
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* ADAFRUIT_802_CONF_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
@@ -0,0 +1,136 @@
/**
******************************************************************************
* @file adafruit_802_conf.h
* @author MCD Application Team
* @brief This file includes the nucleo configuration and errno files
*
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2018 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 ADAFRUIT_802_CONF_H
#define ADAFRUIT_802_CONF_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32g4xx_nucleo_conf.h"
#include "stm32g4xx_nucleo_errno.h"
#include "stm32g4xx_nucleo_bus.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup ADAFRUIT_802
* @{
*/
/** @defgroup ADAFRUIT_802_CONFIG Config
* @{
*/
#if !defined (USE_NUCLEO_64)
#error "Board Pin number not defined"
#endif
/** @defgroup ADAFRUIT_802_CONFIG_Exported_Constants Exported Constants
* @{
*/
#define BUS_SPIx_Init BSP_SPI1_Init
#define BUS_SPIx_Recv BSP_SPI1_Recv
#define BUS_SPIx_Send BSP_SPI1_Send
#define BUS_SPIx_SendRecv BSP_SPI1_SendRecv
/**
* @brief ADC Interface pins
* used to detect motion of Joystick available on Adafruit 1.8" TFT shield
*/
#define ADAFRUIT_802_ADCx ADC1
#define ADAFRUIT_802_ADCx_CLK_ENABLE() __HAL_RCC_ADC12_CLK_ENABLE()
#define ADAFRUIT_802_ADCx_CLK_DISABLE() __HAL_RCC_ADC12_CLK_DISABLE()
#define ADAFRUIT_802_ADCx_CHANNEL ADC_CHANNEL_15
#define ADAFRUIT_802_ADCx_GPIO_PORT GPIOB
#define ADAFRUIT_802_ADCx_GPIO_PIN GPIO_PIN_0
#define ADAFRUIT_802_ADCx_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
#define ADAFRUIT_802_ADCx_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
#define ADAFRUIT_802_ADCx_RANK ADC_REGULAR_RANK_1
#define ADAFRUIT_802_ADCx_SAMPLETIME ADC_SAMPLETIME_24CYCLES_5
#define ADAFRUIT_802_ADCx_PRESCALER ADC_CLOCK_SYNC_PCLK_DIV4
#define ADAFRUIT_802_ADCx_POLL_TIMEOUT 10U
/**
* @brief SD Control Interface pins (shield D4)
*/
#define ADAFRUIT_802_SD_CS_PIN GPIO_PIN_5
#define ADAFRUIT_802_SD_CS_GPIO_PORT GPIOB
#define ADAFRUIT_802_SD_CS_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
#define ADAFRUIT_802_SD_CS_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
/**
* @brief LCD Control Interface pins (shield D10)
*/
#define ADAFRUIT_802_LCD_CS_PIN GPIO_PIN_6
#define ADAFRUIT_802_LCD_CS_GPIO_PORT GPIOB
#define ADAFRUIT_802_LCD_CS_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
#define ADAFRUIT_802_LCD_CS_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
/**
* @brief LCD Data/Command Interface pins (shield D8)
*/
#define ADAFRUIT_802_LCD_DC_PIN GPIO_PIN_9
#define ADAFRUIT_802_LCD_DC_GPIO_PORT GPIOA
#define ADAFRUIT_802_LCD_DC_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
#define ADAFRUIT_802_LCD_DC_GPIO_CLK_DISABLE() __HAL_RCC_GPIOA_CLK_DISABLE()
/**
* @brief SD Control Lines management
*/
#define ADAFRUIT_802_SD_CS_LOW() HAL_GPIO_WritePin(ADAFRUIT_802_SD_CS_GPIO_PORT, ADAFRUIT_802_SD_CS_PIN, GPIO_PIN_RESET)
#define ADAFRUIT_802_SD_CS_HIGH() HAL_GPIO_WritePin(ADAFRUIT_802_SD_CS_GPIO_PORT, ADAFRUIT_802_SD_CS_PIN, GPIO_PIN_SET)
/**
* @brief LCD Control Lines management
*/
#define ADAFRUIT_802_LCD_CS_LOW() HAL_GPIO_WritePin(ADAFRUIT_802_LCD_CS_GPIO_PORT, ADAFRUIT_802_LCD_CS_PIN, GPIO_PIN_RESET)
#define ADAFRUIT_802_LCD_CS_HIGH() HAL_GPIO_WritePin(ADAFRUIT_802_LCD_CS_GPIO_PORT, ADAFRUIT_802_LCD_CS_PIN, GPIO_PIN_SET)
#define ADAFRUIT_802_LCD_DC_LOW() HAL_GPIO_WritePin(ADAFRUIT_802_LCD_DC_GPIO_PORT, ADAFRUIT_802_LCD_DC_PIN, GPIO_PIN_RESET)
#define ADAFRUIT_802_LCD_DC_HIGH() HAL_GPIO_WritePin(ADAFRUIT_802_LCD_DC_GPIO_PORT, ADAFRUIT_802_LCD_DC_PIN, GPIO_PIN_SET)
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* ADAFRUIT_802_CONF_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
@@ -0,0 +1,161 @@
/**
******************************************************************************
* @file adafruit_802_conf.h
* @author MCD Application Team
* @brief This file includes the nucleo configuration and errno files
*
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2019 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 ADAFRUIT_802_CONF_H
#define ADAFRUIT_802_CONF_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32h7xx_nucleo_conf.h"
#include "stm32h7xx_nucleo_errno.h"
#include "stm32h7xx_nucleo_bus.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup ADAFRUIT_802
* @{
*/
/** @defgroup ADAFRUIT_802_CONFIG Config
* @{
*/
/** @defgroup ADAFRUIT_802_CONFIG_Exported_Constants Exported Constants
* @{
*/
#define BUS_SPIx_Init BSP_SPI1_Init
#define BUS_SPIx_Recv BSP_SPI1_Recv
#define BUS_SPIx_Send BSP_SPI1_Send
#define BUS_SPIx_SendRecv BSP_SPI1_SendRecv
/**
* @brief ADC Interface pins
* used to detect motion of Joystick available on Adafruit 1.8" TFT shield
*/
#if defined (USE_NUCLEO_H745ZI_Q) || defined (USE_NUCLEO_H743ZI2) || defined (USE_NUCLEO_H7A3ZI_Q)
#define ADAFRUIT_802_ADCx ADC1
#define ADAFRUIT_802_ADCx_CLK_ENABLE() __HAL_RCC_ADC12_CLK_ENABLE()
#define ADAFRUIT_802_ADCx_CLK_DISABLE() __HAL_RCC_ADC12_CLK_DISABLE()
#define ADAFRUIT_802_ADCx_CHANNEL ADC_CHANNEL_5
#define ADAFRUIT_802_ADCx_GPIO_PORT GPIOB
#define ADAFRUIT_802_ADCx_GPIO_PIN GPIO_PIN_1
#define ADAFRUIT_802_ADCx_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
#define ADAFRUIT_802_ADCx_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
#else /* USE_NUCLEO_H743ZI */
#define ADAFRUIT_802_ADCx ADC3
#define ADAFRUIT_802_ADCx_CLK_ENABLE() __HAL_RCC_ADC3_CLK_ENABLE()
#define ADAFRUIT_802_ADCx_CLK_DISABLE() __HAL_RCC_ADC3_CLK_DISABLE()
#define ADAFRUIT_802_ADCx_CHANNEL ADC_CHANNEL_5
#define ADAFRUIT_802_ADCx_GPIO_PORT GPIOF
#define ADAFRUIT_802_ADCx_GPIO_PIN GPIO_PIN_3
#define ADAFRUIT_802_ADCx_GPIO_CLK_ENABLE() __HAL_RCC_GPIOF_CLK_ENABLE()
#define ADAFRUIT_802_ADCx_GPIO_CLK_DISABLE() __HAL_RCC_GPIOF_CLK_DISABLE()
#endif
#define ADAFRUIT_802_ADCx_RANK ADC_REGULAR_RANK_1
#define ADAFRUIT_802_ADCx_SAMPLETIME ADC_SAMPLETIME_2CYCLES_5
#define ADAFRUIT_802_ADCx_PRESCALER ADC_CLOCKPRESCALER_PCLK_DIV4
#define ADAFRUIT_802_ADCx_POLL_TIMEOUT 10U
/**
* @brief SD Control Interface pins (shield D4)
*/
#define ADAFRUIT_802_SD_CS_PIN GPIO_PIN_14
#if defined (USE_NUCLEO_H745ZI_Q) || defined (USE_NUCLEO_H743ZI2) || defined (USE_NUCLEO_H7A3ZI_Q)
#define ADAFRUIT_802_SD_CS_GPIO_PORT GPIOE
#define ADAFRUIT_802_SD_CS_GPIO_CLK_ENABLE() __HAL_RCC_GPIOE_CLK_ENABLE()
#define ADAFRUIT_802_SD_CS_GPIO_CLK_DISABLE() __HAL_RCC_GPIOE_CLK_DISABLE()
#else /* USE_NUCLEO_H743ZI */
#define ADAFRUIT_802_SD_CS_GPIO_PORT GPIOF
#define ADAFRUIT_802_SD_CS_GPIO_CLK_ENABLE() __HAL_RCC_GPIOF_CLK_ENABLE()
#define ADAFRUIT_802_SD_CS_GPIO_CLK_DISABLE() __HAL_RCC_GPIOF_CLK_DISABLE()
#endif
/**
* @brief LCD Control Interface pins (shield D10)
*/
#define ADAFRUIT_802_LCD_CS_PIN GPIO_PIN_14
#define ADAFRUIT_802_LCD_CS_GPIO_PORT GPIOD
#define ADAFRUIT_802_LCD_CS_GPIO_CLK_ENABLE() __HAL_RCC_GPIOD_CLK_ENABLE()
#define ADAFRUIT_802_LCD_CS_GPIO_CLK_DISABLE() __HAL_RCC_GPIOD_CLK_DISABLE()
/**
* @brief LCD Data/Command Interface pins (shield D8)
*/
#if defined (USE_NUCLEO_H743ZI2)
#define ADAFRUIT_802_LCD_DC_PIN GPIO_PIN_3
#define ADAFRUIT_802_LCD_DC_GPIO_PORT GPIOF
#define ADAFRUIT_802_LCD_DC_GPIO_CLK_ENABLE() __HAL_RCC_GPIOF_CLK_ENABLE()
#define ADAFRUIT_802_LCD_DC_GPIO_CLK_DISABLE() __HAL_RCC_GPIOF_CLK_DISABLE()
#elif defined (USE_NUCLEO_H745ZI_Q) || defined (USE_NUCLEO_H7A3ZI_Q)
#define ADAFRUIT_802_LCD_DC_PIN GPIO_PIN_9
#define ADAFRUIT_802_LCD_DC_GPIO_PORT GPIOG
#define ADAFRUIT_802_LCD_DC_GPIO_CLK_ENABLE() __HAL_RCC_GPIOG_CLK_ENABLE()
#define ADAFRUIT_802_LCD_DC_GPIO_CLK_DISABLE() __HAL_RCC_GPIOG_CLK_DISABLE()
#else /* USE_NUCLEO_H743ZI */
#define ADAFRUIT_802_LCD_DC_PIN GPIO_PIN_12
#define ADAFRUIT_802_LCD_DC_GPIO_PORT GPIOF
#define ADAFRUIT_802_LCD_DC_GPIO_CLK_ENABLE() __HAL_RCC_GPIOF_CLK_ENABLE()
#define ADAFRUIT_802_LCD_DC_GPIO_CLK_DISABLE() __HAL_RCC_GPIOF_CLK_DISABLE()
#endif
/**
* @brief SD Control Lines management
*/
#define ADAFRUIT_802_SD_CS_LOW() HAL_GPIO_WritePin(ADAFRUIT_802_SD_CS_GPIO_PORT, ADAFRUIT_802_SD_CS_PIN, GPIO_PIN_RESET)
#define ADAFRUIT_802_SD_CS_HIGH() HAL_GPIO_WritePin(ADAFRUIT_802_SD_CS_GPIO_PORT, ADAFRUIT_802_SD_CS_PIN, GPIO_PIN_SET)
/**
* @brief LCD Control Lines management
*/
#define ADAFRUIT_802_LCD_CS_LOW() HAL_GPIO_WritePin(ADAFRUIT_802_LCD_CS_GPIO_PORT, ADAFRUIT_802_LCD_CS_PIN, GPIO_PIN_RESET)
#define ADAFRUIT_802_LCD_CS_HIGH() HAL_GPIO_WritePin(ADAFRUIT_802_LCD_CS_GPIO_PORT, ADAFRUIT_802_LCD_CS_PIN, GPIO_PIN_SET)
#define ADAFRUIT_802_LCD_DC_LOW() HAL_GPIO_WritePin(ADAFRUIT_802_LCD_DC_GPIO_PORT, ADAFRUIT_802_LCD_DC_PIN, GPIO_PIN_RESET)
#define ADAFRUIT_802_LCD_DC_HIGH() HAL_GPIO_WritePin(ADAFRUIT_802_LCD_DC_GPIO_PORT, ADAFRUIT_802_LCD_DC_PIN, GPIO_PIN_SET)
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* ADAFRUIT_802_CONF_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
@@ -0,0 +1,172 @@
/**
******************************************************************************
* @file adafruit_802_conf.h
* @author MCD Application Team
* @brief This file includes the nucleo configuration and errno files
*
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2018 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 ADAFRUIT_802_CONF_H
#define ADAFRUIT_802_CONF_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32l4xx_nucleo_conf.h"
#include "stm32l4xx_nucleo_errno.h"
#include "stm32l4xx_nucleo_bus.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup ADAFRUIT_802
* @{
*/
/** @defgroup ADAFRUIT_802_CONFIG Config
* @{
*/
#if !defined (USE_NUCLEO_64) && !defined (USE_NUCLEO_144)
#error "Board Pin number not defined"
#endif
/** @defgroup ADAFRUIT_802_CONFIG_Exported_Constants Exported Constants
* @{
*/
#define BUS_SPIx_Init BSP_SPI1_Init
#define BUS_SPIx_Recv BSP_SPI1_Recv
#define BUS_SPIx_Send BSP_SPI1_Send
#define BUS_SPIx_SendRecv BSP_SPI1_SendRecv
/**
* @brief ADC Interface pins
* used to detect motion of Joystick available on Adafruit 1.8" TFT shield
*/
#define ADAFRUIT_802_ADCx ADC1
#define ADAFRUIT_802_ADCx_CLK_ENABLE() __HAL_RCC_ADC_CLK_ENABLE()
#define ADAFRUIT_802_ADCx_CLK_DISABLE() __HAL_RCC_ADC_CLK_DISABLE()
#if defined (USE_NUCLEO_64)
#define ADAFRUIT_802_ADCx_CHANNEL ADC_CHANNEL_15
#define ADAFRUIT_802_ADCx_GPIO_PORT GPIOB
#define ADAFRUIT_802_ADCx_GPIO_PIN GPIO_PIN_0
#define ADAFRUIT_802_ADCx_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
#define ADAFRUIT_802_ADCx_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
#else /* USE_NUCLEO_144 */
#define ADAFRUIT_802_ADCx_CHANNEL ADC_CHANNEL_2
#define ADAFRUIT_802_ADCx_GPIO_PORT GPIOC
#define ADAFRUIT_802_ADCx_GPIO_PIN GPIO_PIN_1
#define ADAFRUIT_802_ADCx_GPIO_CLK_ENABLE() __HAL_RCC_GPIOC_CLK_ENABLE()
#define ADAFRUIT_802_ADCx_GPIO_CLK_DISABLE() __HAL_RCC_GPIOC_CLK_DISABLE()
#endif
#define ADAFRUIT_802_ADCx_RANK 1U
#define ADAFRUIT_802_ADCx_SAMPLETIME ADC_SAMPLETIME_24CYCLES_5
#define ADAFRUIT_802_ADCx_PRESCALER ADC_CLOCK_SYNC_PCLK_DIV4
#define ADAFRUIT_802_ADCx_POLL_TIMEOUT 10U
#if defined (USE_NUCLEO_64)
/**
* @brief SD Control Interface pins (shield D4)
*/
#define ADAFRUIT_802_SD_CS_PIN GPIO_PIN_5
#define ADAFRUIT_802_SD_CS_GPIO_PORT GPIOB
#define ADAFRUIT_802_SD_CS_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
#define ADAFRUIT_802_SD_CS_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
/**
* @brief LCD Control Interface pins (shield D10)
*/
#define ADAFRUIT_802_LCD_CS_PIN GPIO_PIN_6
#define ADAFRUIT_802_LCD_CS_GPIO_PORT GPIOB
#define ADAFRUIT_802_LCD_CS_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
#define ADAFRUIT_802_LCD_CS_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
/**
* @brief LCD Data/Command Interface pins (shield D8)
*/
#define ADAFRUIT_802_LCD_DC_PIN GPIO_PIN_9
#define ADAFRUIT_802_LCD_DC_GPIO_PORT GPIOA
#define ADAFRUIT_802_LCD_DC_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
#define ADAFRUIT_802_LCD_DC_GPIO_CLK_DISABLE() __HAL_RCC_GPIOA_CLK_DISABLE()
#else /* USE_NUCLEO_144 */
/**
* @brief SD Control Interface pins (shield D4)
*/
#define ADAFRUIT_802_SD_CS_PIN GPIO_PIN_14
#define ADAFRUIT_802_SD_CS_GPIO_PORT GPIOF
#define ADAFRUIT_802_SD_CS_GPIO_CLK_ENABLE() __HAL_RCC_GPIOF_CLK_ENABLE()
#define ADAFRUIT_802_SD_CS_GPIO_CLK_DISABLE() __HAL_RCC_GPIOF_CLK_DISABLE()
/**
* @brief LCD Control Interface pins (shield D10)
*/
#define ADAFRUIT_802_LCD_CS_PIN GPIO_PIN_14
#define ADAFRUIT_802_LCD_CS_GPIO_PORT GPIOD
#define ADAFRUIT_802_LCD_CS_GPIO_CLK_ENABLE() __HAL_RCC_GPIOD_CLK_ENABLE()
#define ADAFRUIT_802_LCD_CS_GPIO_CLK_DISABLE() __HAL_RCC_GPIOD_CLK_DISABLE()
/**
* @brief LCD Data/Command Interface pins (shield D8)
*/
#define ADAFRUIT_802_LCD_DC_PIN GPIO_PIN_12
#define ADAFRUIT_802_LCD_DC_GPIO_PORT GPIOF
#define ADAFRUIT_802_LCD_DC_GPIO_CLK_ENABLE() __HAL_RCC_GPIOF_CLK_ENABLE()
#define ADAFRUIT_802_LCD_DC_GPIO_CLK_DISABLE() __HAL_RCC_GPIOF_CLK_DISABLE()
#endif
/**
* @brief SD Control Lines management
*/
#define ADAFRUIT_802_SD_CS_LOW() HAL_GPIO_WritePin(ADAFRUIT_802_SD_CS_GPIO_PORT, ADAFRUIT_802_SD_CS_PIN, GPIO_PIN_RESET)
#define ADAFRUIT_802_SD_CS_HIGH() HAL_GPIO_WritePin(ADAFRUIT_802_SD_CS_GPIO_PORT, ADAFRUIT_802_SD_CS_PIN, GPIO_PIN_SET)
/**
* @brief LCD Control Lines management
*/
#define ADAFRUIT_802_LCD_CS_LOW() HAL_GPIO_WritePin(ADAFRUIT_802_LCD_CS_GPIO_PORT, ADAFRUIT_802_LCD_CS_PIN, GPIO_PIN_RESET)
#define ADAFRUIT_802_LCD_CS_HIGH() HAL_GPIO_WritePin(ADAFRUIT_802_LCD_CS_GPIO_PORT, ADAFRUIT_802_LCD_CS_PIN, GPIO_PIN_SET)
#define ADAFRUIT_802_LCD_DC_LOW() HAL_GPIO_WritePin(ADAFRUIT_802_LCD_DC_GPIO_PORT, ADAFRUIT_802_LCD_DC_PIN, GPIO_PIN_RESET)
#define ADAFRUIT_802_LCD_DC_HIGH() HAL_GPIO_WritePin(ADAFRUIT_802_LCD_DC_GPIO_PORT, ADAFRUIT_802_LCD_DC_PIN, GPIO_PIN_SET)
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* ADAFRUIT_802_CONF_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
@@ -0,0 +1,133 @@
/**
******************************************************************************
* @file adafruit_802_conf.h
* @author MCD Application Team
* @brief This file includes the nucleo configuration and errno files
*
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2019 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 ADAFRUIT_802_CONF_H
#define ADAFRUIT_802_CONF_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32wlxx_nucleo_conf.h"
#include "stm32wlxx_nucleo_errno.h"
#include "stm32wlxx_nucleo_bus.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup ADAFRUIT_802
* @{
*/
/** @defgroup ADAFRUIT_802_CONFIG Config
* @{
*/
/** @defgroup ADAFRUIT_802_CONFIG_Exported_Constants Exported Constants
* @{
*/
#define BUS_SPIx_Init BSP_SPI1_Init
#define BUS_SPIx_Recv BSP_SPI1_Recv
#define BUS_SPIx_Send BSP_SPI1_Send
#define BUS_SPIx_SendRecv BSP_SPI1_SendRecv
/**
* @brief ADC Interface pins
* used to detect motion of Joystick available on Adafruit 1.8" TFT shield
*/
#define ADAFRUIT_802_ADCx ADC1
#define ADAFRUIT_802_ADCx_CLK_ENABLE() __HAL_RCC_ADC_CLK_ENABLE()
#define ADAFRUIT_802_ADCx_CLK_DISABLE() __HAL_RCC_ADC_CLK_DISABLE()
#define ADAFRUIT_802_ADCx_CHANNEL ADC_CHANNEL_3
#define ADAFRUIT_802_ADCx_GPIO_PORT GPIOB
#define ADAFRUIT_802_ADCx_GPIO_PIN GPIO_PIN_4
#define ADAFRUIT_802_ADCx_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
#define ADAFRUIT_802_ADCx_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
#define ADAFRUIT_802_ADCx_RANK ADC_REGULAR_RANK_1
#define ADAFRUIT_802_ADCx_SAMPLETIME LL_ADC_SAMPLINGTIME_COMMON_1
#define ADAFRUIT_802_ADCx_PRESCALER ADC_CLOCK_SYNC_PCLK_DIV4
#define ADAFRUIT_802_ADCx_POLL_TIMEOUT 10U
/**
* @brief SD Control Interface pins (shield D4)
*/
#define ADAFRUIT_802_SD_CS_PIN GPIO_PIN_5
#define ADAFRUIT_802_SD_CS_GPIO_PORT GPIOB
#define ADAFRUIT_802_SD_CS_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
#define ADAFRUIT_802_SD_CS_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
/**
* @brief LCD Control Interface pins (shield D10)
*/
#define ADAFRUIT_802_LCD_CS_PIN GPIO_PIN_4
#define ADAFRUIT_802_LCD_CS_GPIO_PORT GPIOA
#define ADAFRUIT_802_LCD_CS_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
#define ADAFRUIT_802_LCD_CS_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
/**
* @brief LCD Data/Command Interface pins (shield D8)
*/
#define ADAFRUIT_802_LCD_DC_PIN GPIO_PIN_2
#define ADAFRUIT_802_LCD_DC_GPIO_PORT GPIOC
#define ADAFRUIT_802_LCD_DC_GPIO_CLK_ENABLE() __HAL_RCC_GPIOC_CLK_ENABLE()
#define ADAFRUIT_802_LCD_DC_GPIO_CLK_DISABLE() __HAL_RCC_GPIOC_CLK_DISABLE()
/**
* @brief SD Control Lines management
*/
#define ADAFRUIT_802_SD_CS_LOW() HAL_GPIO_WritePin(ADAFRUIT_802_SD_CS_GPIO_PORT, ADAFRUIT_802_SD_CS_PIN, GPIO_PIN_RESET)
#define ADAFRUIT_802_SD_CS_HIGH() HAL_GPIO_WritePin(ADAFRUIT_802_SD_CS_GPIO_PORT, ADAFRUIT_802_SD_CS_PIN, GPIO_PIN_SET)
/**
* @brief LCD Control Lines management
*/
#define ADAFRUIT_802_LCD_CS_LOW() HAL_GPIO_WritePin(ADAFRUIT_802_LCD_CS_GPIO_PORT, ADAFRUIT_802_LCD_CS_PIN, GPIO_PIN_RESET)
#define ADAFRUIT_802_LCD_CS_HIGH() HAL_GPIO_WritePin(ADAFRUIT_802_LCD_CS_GPIO_PORT, ADAFRUIT_802_LCD_CS_PIN, GPIO_PIN_SET)
#define ADAFRUIT_802_LCD_DC_LOW() HAL_GPIO_WritePin(ADAFRUIT_802_LCD_DC_GPIO_PORT, ADAFRUIT_802_LCD_DC_PIN, GPIO_PIN_RESET)
#define ADAFRUIT_802_LCD_DC_HIGH() HAL_GPIO_WritePin(ADAFRUIT_802_LCD_DC_GPIO_PORT, ADAFRUIT_802_LCD_DC_PIN, GPIO_PIN_SET)
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* ADAFRUIT_802_CONF_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
@@ -0,0 +1,273 @@
<!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 Adafruit_Shield Driver</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-adafruit_shield-driver"><strong>Release Notes for Adafruit_Shield Driver</strong></h1>
<p>Copyright © 2014 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>
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:
<center>
<a href="https://opensource.org/licenses/BSD-3-Clause">https://opensource.org/licenses/BSD-3-Clause</a>
</center>
<h1 id="purpose">Purpose</h1>
<p>The BSP (Board Specific Package) drivers are parts of the STM32Cube package based on the HAL drivers and provide a set of high level APIs relative to the hardware components and features in the evaluation boards, discovery kits and nucleo boards coming with the STM32Cube package for a given STM32 serie.</p>
<p>The BSP drivers allow a quick access to the boards services using high level APIs and without any specific configuration as the link with the HAL and the external components is done in intrinsic within the drivers.</p>
<p>From project settings points of view, user has only to add the necessary drivers files in the workspace and call the needed functions from examples. However some low level configuration functions are weak and can be overridden by the applications if user wants to change some BSP drivers default behavior.</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-section18" checked aria-hidden="true"> <label for="collapse-section18" aria-hidden="true"><strong>V5.0.1 / 13-March-2020</strong></label>
<div>
<h2 id="main-changes">Main Changes</h2>
<ul>
<li>Minor changes to fix typos</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section17" aria-hidden="true"> <label for="collapse-section17" aria-hidden="true"><strong>V5.0.0 / 25-February-2020</strong></label>
<div>
<h2 id="main-changes-1">Main Changes</h2>
<ul>
<li>Rename GUI_Drv_t into UTILS_LCD_Drv_t</li>
</ul>
<h2 id="backward-compatibility">Backward Compatibility</h2>
<ul>
<li>This version breaks the compatibility with previous versions</li>
</ul>
<h2 id="dependencies">Dependencies</h2>
<ul>
<li>Components/common v7.0.0</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section16" aria-hidden="true"> <label for="collapse-section16" aria-hidden="true"><strong>V4.0.4 / 15-October-2019</strong></label>
<div>
<h2 id="main-changes-2">Main Changes</h2>
<ul>
<li>adafruit_802.c
<ul>
<li>Updated to support STM32WLxx devices</li>
</ul></li>
<li>Add Adafruit_Config/adafruit_802_conf_STM32WLxx_Nucleo.h
<ul>
<li>Remove support of USE_NUCLEO_H7A3ZI nucleo board</li>
</ul></li>
<li>Update st_logo.png inclusion path in Release notes</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section15" aria-hidden="true"> <label for="collapse-section15" aria-hidden="true"><strong>V4.0.3 / 25-June-2019</strong></label>
<div>
<h2 id="main-changes-3">Main Changes</h2>
<ul>
<li>adafruit_802_sd.c
<ul>
<li>Update SD token for Start Multiple Block Write operation to 0xFC instead of 0xFD</li>
</ul></li>
<li>Adafruit_Config/adafruit_802_conf_STM32H7xx_Nucleo.h
<ul>
<li>Remove support of USE_NUCLEO_H7A3ZI nucleo board</li>
</ul></li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section14" aria-hidden="true"> <label for="collapse-section14" aria-hidden="true"><strong>V4.0.2 / 30-May-2019</strong></label>
<div>
<h2 id="main-changes-4">Main Changes</h2>
<ul>
<li>stm32_adafruit_sd.h
<ul>
<li>Remove volatile qualification for SD_CID structures fields</li>
</ul></li>
<li>Adafruit_Config/adafruit_802_conf_STM32H7xx_Nucleo.h
<ul>
<li>Add support of USE_NUCLEO_H7A3ZI_Q nucleo board</li>
</ul></li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section13" aria-hidden="true"> <label for="collapse-section13" aria-hidden="true"><strong>V4.0.1 / 25-April-2019</strong></label>
<div>
<h2 id="main-changes-5">Main Changes</h2>
<ul>
<li>Add adafruit_802_conf_STM32H7xx_Nucleo.h file under Adafruit_Config folder</li>
<li>adafruit_802_lcd.c/.h:
<ul>
<li>Update context content</li>
<li>Update checks on functions returned value</li>
</ul></li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section12" aria-hidden="true"> <label for="collapse-section12" aria-hidden="true"><strong>V4.0.0 / 12-April-2019</strong></label>
<div>
<h2 id="main-changes-6">Main Changes</h2>
<ul>
<li>Official release of component drivers for Adafruit_Shield in line with STM32Cube BSP drivers development guidelines (UM2298)</li>
</ul>
<h2 id="backward-compatibility-1">Backward Compatibility</h2>
<p>This version breaks the compatibility with previous versions</p>
<h2 id="dependencies-1">Dependencies</h2>
<ul>
<li>Components/common v6.0.0</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section9" aria-hidden="true"> <label for="collapse-section9" aria-hidden="true"><strong>V3.0.3 / 30-April-2018</strong></label>
<div>
<h2 id="main-changes-7">Main Changes</h2>
<ul>
<li>stm32_adafruit_sd.c:
<ul>
<li>Fix BSP_SD_ReadBlocks and BSP_SD_WriteBlocks to support SDHC cards</li>
</ul></li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section8" aria-hidden="true"> <label for="collapse-section8" aria-hidden="true"><strong>V3.0.2 / 24-August-2017</strong></label>
<div>
<h2 id="main-changes-8">Main Changes</h2>
<ul>
<li>stm32_adafruit_lcd.c:
<ul>
<li>Fix compilation errors with SW4STM32 toolchain</li>
</ul></li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section7" aria-hidden="true"> <label for="collapse-section7" aria-hidden="true"><strong>V3.0.1 / 02-June-2017</strong></label>
<div>
<h2 id="main-changes-9">Main Changes</h2>
<ul>
<li>Add general description of BSP drivers</li>
<li>Add Dependencies section</li>
<li>Support of PDSC</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section6" aria-hidden="true"> <label for="collapse-section6" aria-hidden="true"><strong>V3.0.0 / 23-December-2016</strong></label>
<div>
<h2 id="main-changes-10">Main Changes</h2>
<ul>
<li>Update BSP_SD_ReadBlocks and BSP_SD_WriteBlocks following new HAL SD drivers implementation</li>
<li>Update BSP_SD_Erase implementation to manage SDHC and SDSC cards</li>
<li>Fix block size to 512 bytes for all card types</li>
</ul>
<h2 id="backward-compatibility-2">Backward Compatibility</h2>
<p>These Adafruit BSP drivers break the compatibility with previous versions.</p>
<h2 id="dependencies-2">Dependencies</h2>
<p>If FatFs is required, “FatFS R0.11 ST modified 20161223” must be used with this version of Adafruit BSP drivers.</p>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section5" aria-hidden="true"> <label for="collapse-section5" aria-hidden="true"><strong>V2.0.1 / 04-November-2015</strong></label>
<div>
<h2 id="main-changes-11">Main Changes</h2>
<ul>
<li>Fix GNU GCC warning on missing break instruction in SD_GetDataResponse()</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section4" aria-hidden="true"> <label for="collapse-section4" aria-hidden="true"><strong>V2.0.0 / 10-September-2015</strong></label>
<div>
<h2 id="main-changes-12">Main Changes</h2>
<ul>
<li>Improve SD over SPI protocol implementation</li>
<li><strong>Note</strong>
<ul>
<li>This new implementation requires to increase Heap_Size by 0x200</li>
</ul></li>
</ul>
<h2 id="dependencies-3">Dependencies</h2>
<ul>
<li>This driver version needs BSP Nucleo driver V2.0.0 and later</li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section3" aria-hidden="true"> <label for="collapse-section3" aria-hidden="true"><strong>V1.1.1 / 21-November-2014</strong></label>
<div>
<h2 id="main-changes-13">Main Changes</h2>
<ul>
<li>stm32_adafruit_sd.c
<ul>
<li>Add workaround for the issue seen on some STM32 Nucleo boards; reading the SD card status will return an error</li>
<li>A fix will be implemented in next release</li>
</ul></li>
<li>stm32_adafruit_lcd.h:
<ul>
<li>Change “" by”/" in the include path to fix compilation issue under Linux</li>
</ul></li>
<li>Miscellaneous:
<ul>
<li>Comments update</li>
</ul></li>
</ul>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section2" aria-hidden="true"> <label for="collapse-section2" aria-hidden="true"><strong>V1.1.0 / 22-July-2014</strong></label>
<div>
<h2 id="main-changes-14">Main Changes</h2>
<ul>
<li>Add new user API BSP_LCD_DrawBitmap() to draw a bitmap picture loaded in the STM32 MCU internal memory</li>
<li>Add new static API SetDisplayWindow(), needed by BSP_LCD_DrawBitmap()</li>
<li>Update static API DrawChar()</li>
</ul>
<h2 id="dependencies-4">Dependencies</h2>
<p>This driver version needs ST7735 component driver V1.1.0 and later.</p>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section1" aria-hidden="true"> <label for="collapse-section1" aria-hidden="true"><strong>V1.0.0 / 22-April-2014</strong></label>
<div>
<h2 id="main-changes-15">Main Changes</h2>
<ul>
<li>First official release of <strong>Adafruit Shield</strong> driver</li>
</ul>
</div>
</div>
</div>
</div>
<footer class="sticky">
For complete documentation on <mark>STM32 Microcontrollers</mark> , visit: <span style="font-color: blue;"><a href="http://www.st.com/STM32">www.st.com</a></span>
</footer>
</body>
</html>
File diff suppressed because it is too large Load Diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

@@ -0,0 +1,468 @@
/**
******************************************************************************
* @file adafruit_802.c
* @author MCD Application Team
* @brief This file provides set of firmware functions to manage:
* - Joystick available on Adafruit 1.8" TFT LCD shield (reference ID 802)
*
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2018 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 "adafruit_802.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup ADAFRUIT_802
* @{
*/
/** @addtogroup ADAFRUIT_802_LOW_LEVEL
* @{
*/
/** @defgroup ADAFRUIT_802_LOW_LEVEL_Private_Variables LOW LEVEL Private Variables
* @{
*/
#if (USE_HAL_ADC_REGISTER_CALLBACKS == 1)
static uint32_t IsJoyMspCbValid = 0;
#endif
static ADC_HandleTypeDef hJoyHandle;
/**
* @}
*/
/** @defgroup ADAFRUIT_802_LOW_LEVEL_Private_FunctionPrototypes LOW LEVEL Private FunctionPrototypes
* @{
*/
static void JOY1_MspInit(ADC_HandleTypeDef *hadc);
static void JOY1_MspDeInit(ADC_HandleTypeDef *hadc);
/**
* @}
*/
/** @addtogroup ADAFRUIT_802_LOW_LEVEL_Exported_Functions
* @{
*/
/**
* @brief Configures the joystick.
* @param JOY Joystick to be initialized
* @param JoyMode Button mode.
* This parameter is not used as the ADC pin should be always configured
* in analog mode.
* @param JoyPins There are no physical pins but voltage levels
* @retval BSP status
*/
int32_t ADAFRUIT_802_JOY_Init(JOY_TypeDef JOY, JOYMode_TypeDef JoyMode, JOYPin_TypeDef JoyPins)
{
/* Prevent unused argument(s) compilation warning */
UNUSED(JoyPins);
UNUSED(JoyMode);
int32_t ret = BSP_ERROR_NONE;
if(JOY >= JOYn)
{
ret = BSP_ERROR_WRONG_PARAM;
}
else
{
#if (USE_HAL_ADC_REGISTER_CALLBACKS == 0)
/* Init the UART Msp */
JOY1_MspInit(&hJoyHandle);
#else
if(IsJoyMspCbValid == 0U)
{
if(ADAFRUIT_802_JOY_RegisterDefaultMspCallbacks(JOY) != BSP_ERROR_NONE)
{
return BSP_ERROR_MSP_FAILURE;
}
}
#endif
if(MX_ADAFRUIT_802_ADC_Init(&hJoyHandle) != HAL_OK)
{
ret = BSP_ERROR_PERIPH_FAILURE;
}
else
{
#if defined(ADC_CALFACT_CALFACT_S)
/* Run ADC calibration */
#if defined(ADC_CR_ADCALLIN)
if(HAL_ADCEx_Calibration_Start(&hJoyHandle, ADC_CALIB_OFFSET, ADC_SINGLE_ENDED) != HAL_OK)
{
ret = BSP_ERROR_PERIPH_FAILURE;
}
else
{
if(HAL_ADCEx_Calibration_Start(&hJoyHandle, ADC_CALIB_OFFSET_LINEARITY, ADC_SINGLE_ENDED) != HAL_OK)
{
ret = BSP_ERROR_PERIPH_FAILURE;
}
}
#else
if(HAL_ADCEx_Calibration_Start(&hJoyHandle, ADC_SINGLE_ENDED) != HAL_OK)
{
ret = BSP_ERROR_PERIPH_FAILURE;
}
#endif
#endif /* defined(ADC_CALFACT_CALFACT_S) */
}
}
return ret;
}
/**
* @brief DeInit joystick GPIOs.
* @param JOY Joystick to be de-initialized
* @param JoyPins There are no physical pins but voltage levels
* @retval BSP status
*/
int32_t ADAFRUIT_802_JOY_DeInit(JOY_TypeDef JOY, JOYPin_TypeDef JoyPins)
{
/* Prevent unused argument(s) compilation warning */
UNUSED(JoyPins);
int32_t ret = BSP_ERROR_NONE;
/* ADC configuration */
hJoyHandle.Instance = ADAFRUIT_802_ADCx;
if(JOY >= JOYn)
{
ret = BSP_ERROR_WRONG_PARAM;
}
else
{
#if (USE_HAL_ADC_REGISTER_CALLBACKS == 0)
JOY1_MspDeInit(&hJoyHandle);
#endif /* (USE_HAL_UART_REGISTER_CALLBACKS == 0) */
if(HAL_ADC_DeInit(&hJoyHandle) != HAL_OK)
{
ret = BSP_ERROR_PERIPH_FAILURE;
}
}
return ret;
}
/**
* @brief Returns the Joystick key pressed.
* @param JOY Joystick to get its pins' state
* @retval BSP error code if value is negative or one of the following values:
* - JOY_NONE : 3.3 V / 4095
* - JOY_SEL : 1.055 V / 1308
* - JOY_DOWN : 0.71 V / 88
* - JOY_LEFT : 3.0 V / 3720
* - JOY_RIGHT : 0.595 V / 737
* - JOY_UP : 1.65 V / 2046
*/
int32_t ADAFRUIT_802_JOY_GetState(JOY_TypeDef JOY)
{
int32_t ret;
uint32_t keyconvertedvalue;
if(JOY >= JOYn)
{
ret = BSP_ERROR_WRONG_PARAM;
}/* Start the conversion process */
else if(HAL_ADC_Start(&hJoyHandle) != HAL_OK)
{
ret = BSP_ERROR_PERIPH_FAILURE;
}/* Wait for the end of conversion */
else if(HAL_ADC_PollForConversion(&hJoyHandle, ADAFRUIT_802_ADCx_POLL_TIMEOUT) != HAL_OK)
{
ret = BSP_ERROR_PERIPH_FAILURE;
}/* Check if the continuous conversion of regular channel is finished */
else if((HAL_ADC_GetState(&hJoyHandle) & HAL_ADC_STATE_REG_EOC) != HAL_ADC_STATE_REG_EOC)
{
ret = BSP_ERROR_BUSY;
}
else
{
/* Get the converted value of regular channel */
keyconvertedvalue = HAL_ADC_GetValue(&hJoyHandle);
if((keyconvertedvalue > 2010U) && (keyconvertedvalue < 2500U))
{
ret = (int32_t)JOY_UP;
}
else if((keyconvertedvalue > 680U) && (keyconvertedvalue < 900U))
{
ret = (int32_t)JOY_RIGHT;
}
else if((keyconvertedvalue > 1270U) && (keyconvertedvalue < 1500U))
{
ret = (int32_t)JOY_SEL;
}
else if((keyconvertedvalue > 50U) && (keyconvertedvalue < 200U))
{
ret = (int32_t)JOY_DOWN;
}
else if((keyconvertedvalue > 3400U) && (keyconvertedvalue < 3760U))
{
ret = (int32_t)JOY_LEFT;
}
else
{
ret = (int32_t)JOY_NONE;
}
}
/* Return the code of the Joystick key pressed */
return ret;
}
/**
* @brief Configures ADC peripheral
* @param hadc ADC handle
* @retval HAL error code
*/
__weak HAL_StatusTypeDef MX_ADAFRUIT_802_ADC_Init(ADC_HandleTypeDef *hadc)
{
HAL_StatusTypeDef ret = HAL_OK;
ADC_ChannelConfTypeDef sConfig;
/* ADC configuration */
hadc->Instance = ADAFRUIT_802_ADCx;
hadc->Init.ClockPrescaler = ADAFRUIT_802_ADCx_PRESCALER;
hadc->Init.Resolution = ADC_RESOLUTION_12B;
#if defined(ADC_CR2_ALIGN)
hadc->Init.DataAlign = ADC_DATAALIGN_RIGHT;
#endif
hadc->Init.ScanConvMode = (uint32_t)DISABLE;
#if defined(ADC_EOC_SINGLE_CONV)
hadc->Init.EOCSelection = ADC_EOC_SINGLE_CONV;
#endif
hadc->Init.ContinuousConvMode = DISABLE;
hadc->Init.NbrOfConversion = 1;
hadc->Init.DiscontinuousConvMode = DISABLE;
#if defined(ADC_CFGR_DISCNUM)
hadc->Init.NbrOfDiscConversion = 0;
#endif
hadc->Init.ExternalTrigConv = ADC_SOFTWARE_START;
hadc->Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE;
#if defined(ADC_CR2_DMA)
hadc->Init.DMAContinuousRequests = DISABLE;
#endif
#if defined(ADC_SMPR_SMP1) && defined(ADC_SMPR_SMP2)
hadc->Init.SamplingTimeCommon1 = ADC_SAMPLETIME_39CYCLES_5;
hadc->Init.SamplingTimeCommon2 = ADC_SAMPLETIME_39CYCLES_5;
#endif
#if defined(ADC_CFGR2_LFTRIG)
hadc->Init.TriggerFrequencyMode = ADC_TRIGGER_FREQ_HIGH;
#endif
if (HAL_ADC_Init(hadc) != HAL_OK)
{
ret = HAL_ERROR;
}
else
{
/**Configure for the selected ADC regular channel its corresponding rank in the sequencer and its sample time.
*/
sConfig.Channel = ADAFRUIT_802_ADCx_CHANNEL;
sConfig.Rank = ADAFRUIT_802_ADCx_RANK;
sConfig.SamplingTime = ADAFRUIT_802_ADCx_SAMPLETIME;
#if defined(ADC_OFR1_OFFSET1)
sConfig.Offset = 0;
#endif
#if defined(ADC_SINGLE_ENDED)
sConfig.SingleDiff = ADC_SINGLE_ENDED;
#endif
#if defined(ADC_OFFSET_NONE)
sConfig.OffsetNumber = ADC_OFFSET_NONE;
#endif
if (HAL_ADC_ConfigChannel(hadc, &sConfig) != HAL_OK)
{
ret = HAL_ERROR;
}
}
return ret;
}
#if (USE_HAL_ADC_REGISTER_CALLBACKS == 1)
/**
* @brief Register Default ADCx Bus Msp Callbacks
* @param JOY Joystick to be configured.
* This parameter can be JOY1
* @retval BSP status
*/
int32_t ADAFRUIT_802_JOY_RegisterDefaultMspCallbacks(JOY_TypeDef JOY)
{
int32_t ret = BSP_ERROR_NONE;
if(JOY >= JOYn)
{
ret = BSP_ERROR_WRONG_PARAM;
}
else
{
__HAL_ADC_RESET_HANDLE_STATE(&hJoyHandle);
/* Register default MspInit/MspDeInit Callback */
if(HAL_ADC_RegisterCallback(&hJoyHandle, HAL_ADC_MSPINIT_CB_ID, JOY1_MspInit) != HAL_OK)
{
ret = BSP_ERROR_PERIPH_FAILURE;
}
else if(HAL_ADC_RegisterCallback(&hJoyHandle, HAL_ADC_MSPDEINIT_CB_ID, JOY1_MspDeInit) != HAL_OK)
{
ret = BSP_ERROR_PERIPH_FAILURE;
}
else
{
IsJoyMspCbValid = 1U;
}
}
/* BSP status */
return ret;
}
/**
* @brief Register ADCx Bus Msp Callback registering
* @param JOY Joystick to be configured.
* This parameter can be JOY1
* @param Callbacks pointer to ADCx MspInit/MspDeInit callback functions
* @retval BSP status
*/
int32_t ADAFRUIT_802_JOY_RegisterMspCallbacks(JOY_TypeDef JOY, ADAFRUIT_802_JOY_Cb_t *Callback)
{
int32_t ret = BSP_ERROR_NONE;
if(JOY >= JOYn)
{
ret = BSP_ERROR_WRONG_PARAM;
}
else
{
__HAL_ADC_RESET_HANDLE_STATE(&hJoyHandle);
/* Register MspInit/MspDeInit Callbacks */
if(HAL_ADC_RegisterCallback(&hJoyHandle, HAL_ADC_MSPINIT_CB_ID, Callback->pMspInitCb) != HAL_OK)
{
ret = BSP_ERROR_PERIPH_FAILURE;
}
else if(HAL_ADC_RegisterCallback(&hJoyHandle, HAL_ADC_MSPDEINIT_CB_ID, Callback->pMspDeInitCb) != HAL_OK)
{
ret = BSP_ERROR_PERIPH_FAILURE;
}
else
{
IsJoyMspCbValid = 1U;
}
}
/* BSP status */
return ret;
}
#endif /* USE_HAL_ADC_REGISTER_CALLBACKS */
/**
* @}
*/
/** @defgroup ADAFRUIT_802_LOW_LEVEL_Private_Functions LOW LEVEL Private Functions
* @{
*/
/**
* @brief Initializes ADC MSP.
* @param hadc ADC handle
* @retval None
*/
static void JOY1_MspInit(ADC_HandleTypeDef *hadc)
{
GPIO_InitTypeDef GPIO_InitStruct;
#if defined (RCC_ADCCLKSOURCE_SYSCLK) || defined (RCC_ADC12CLKSOURCE_SYSCLK)
RCC_PeriphCLKInitTypeDef RCC_PeriphCLKInitStruct;
#endif
/* Prevent unused argument(s) compilation warning */
UNUSED(hadc);
/*** Configure the GPIOs ***/
/* Enable GPIO clock */
ADAFRUIT_802_ADCx_GPIO_CLK_ENABLE();
/* Configure the selected ADC Channel as analog input */
GPIO_InitStruct.Pin = ADAFRUIT_802_ADCx_GPIO_PIN;
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
#if defined (RCC_ADCCLKSOURCE_SYSCLK) || defined (RCC_ADC12CLKSOURCE_SYSCLK)
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
#endif
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(ADAFRUIT_802_ADCx_GPIO_PORT, &GPIO_InitStruct);
/*** Configure the ADC peripheral ***/
/* Enable ADC clock */
ADAFRUIT_802_ADCx_CLK_ENABLE();
#if defined (RCC_ADCCLKSOURCE_SYSCLK)
/* Configure SYSCLK as source clock for ADC */
RCC_PeriphCLKInitStruct.PeriphClockSelection = RCC_PERIPHCLK_ADC;
RCC_PeriphCLKInitStruct.AdcClockSelection = RCC_ADCCLKSOURCE_SYSCLK;
HAL_RCCEx_PeriphCLKConfig(&RCC_PeriphCLKInitStruct);
#elif defined (RCC_ADC12CLKSOURCE_SYSCLK)
RCC_PeriphCLKInitStruct.PeriphClockSelection = RCC_PERIPHCLK_ADC12;
RCC_PeriphCLKInitStruct.Adc12ClockSelection = RCC_ADC12CLKSOURCE_SYSCLK;
HAL_RCCEx_PeriphCLKConfig(&RCC_PeriphCLKInitStruct);
#endif
}
/**
* @brief DeInitializes ADC MSP.
* @param hadc ADC handle
* @note ADC DeInit does not disable the GPIO clock
* @retval None
*/
static void JOY1_MspDeInit(ADC_HandleTypeDef *hadc)
{
GPIO_InitTypeDef GPIO_InitStruct;
/* Prevent unused argument(s) compilation warning */
UNUSED(hadc);
/*** DeInit the ADC peripheral ***/
/* Disable ADC clock */
ADAFRUIT_802_ADCx_CLK_DISABLE();
/* Configure the selected ADC Channel as analog input */
GPIO_InitStruct.Pin = ADAFRUIT_802_ADCx_GPIO_PIN ;
HAL_GPIO_DeInit(ADAFRUIT_802_ADCx_GPIO_PORT, GPIO_InitStruct.Pin);
}
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
@@ -0,0 +1,118 @@
/**
******************************************************************************
* @file adafruit_802.h
* @author MCD Application Team
* @brief This file contains definitions for:
* - Joystick available on Adafruit 1.8" TFT LCD shield (reference ID 802)
*
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2018 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 ADAFRUIT_802_H
#define ADAFRUIT_802_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "adafruit_802_conf.h"
/** @addtogroup BSP
* @{
*/
/** @defgroup ADAFRUIT_802 ADAFRUIT_802
* @{
*/
/** @defgroup ADAFRUIT_802_LOW_LEVEL STM32 ADAFRUIT_802 LOW LEVEL
* @brief This file provides set of firmware functions to manage joystick
* available on Adafruit shield.
* @{
*/
/** @defgroup ADAFRUIT_802_LOW_LEVEL_Exported_Types LOW LEVEL Exported Types
* @{
*/
typedef enum
{
JOY1 = 0U,
JOYn
}JOY_TypeDef;
typedef enum
{
JOY_MODE_GPIO = 0U,
JOY_MODE_EXTI = 1U,
}JOYMode_TypeDef;
typedef enum
{
JOY_NONE = 0x00U,
JOY_SEL = 0x01U,
JOY_DOWN = 0x02U,
JOY_LEFT = 0x04U,
JOY_RIGHT = 0x08U,
JOY_UP = 0x10U,
JOY_ALL = 0x1FU
}JOYPin_TypeDef;
#if (USE_HAL_ADC_REGISTER_CALLBACKS == 1)
typedef struct
{
pADC_CallbackTypeDef pMspInitCb;
pADC_CallbackTypeDef pMspDeInitCb;
}ADAFRUIT_802_JOY_Cb_t;
#endif /* (USE_HAL_ADC_REGISTER_CALLBACKS == 1) */
/**
* @}
*/
/** @defgroup ADAFRUIT_802_LOW_LEVEL_Exported_Functions LOW LEVEL Exported_Functions
* @{
*/
int32_t ADAFRUIT_802_JOY_Init(JOY_TypeDef JOY, JOYMode_TypeDef JoyMode, JOYPin_TypeDef JoyPins);
int32_t ADAFRUIT_802_JOY_DeInit(JOY_TypeDef JOY, JOYPin_TypeDef JoyPins);
int32_t ADAFRUIT_802_JOY_GetState(JOY_TypeDef JOY);
#if (USE_HAL_ADC_REGISTER_CALLBACKS == 1)
int32_t ADAFRUIT_802_JOY_RegisterDefaultMspCallbacks(JOY_TypeDef JOY);
int32_t ADAFRUIT_802_JOY_RegisterMspCallbacks(JOY_TypeDef JOY, ADAFRUIT_802_JOY_Cb_t *Callback);
#endif /* (USE_HAL_ADC_REGISTER_CALLBACKS == 1) */
HAL_StatusTypeDef MX_ADAFRUIT_802_ADC_Init(ADC_HandleTypeDef *hadc);
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* ADAFRUIT_802_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
@@ -0,0 +1,80 @@
/**
******************************************************************************
* @file adafruit_802_conf_template.h
* @author MCD Application Team
* @brief This file includes the nucleo configuration file that contains definitions for:
* - ADC information(GPIOs and configuration) used for Joystick
* - SPI information(GPIOs and configuration) used for microSD and LCD available
* on Adafruit 1.8" TFT LCD shield (reference ID 802)
*
*
* There are two ways to use this file:
* 1.
* - Copy stm32_adafruit_conf_template.h to the application and rename it to stm32_adafruit_conf.h
* - Fill stm32_adafruit_conf.h with adequate resources definition that can be directly
* copied from "Adafruit_Config" folder depending on the used nucleo board.
* - Un-comment and update the below lines with correct nucleo files
*
* 2.
* - Copy the required configuration file from "Adafruit_Config" folder to the
* application and rename it to stm32_adafruit_conf.h
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2018 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 ADAFRUIT_802_CONF_H
#define ADAFRUIT_802_CONF_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
/* #include "stm32xxxx_nucleo_conf.h"
#include "stm32xxxx_nucleo_errno.h"
*/
/** @addtogroup BSP
* @{
*/
/** @addtogroup ADAFRUIT_802
* @{
*/
/** @defgroup ADAFRUIT_802_CONFIG Config
* @{
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* ADAFRUIT_802_CONF_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
@@ -0,0 +1,776 @@
/**
******************************************************************************
* @file adafruit_802_lcd.c
* @author MCD Application Team
* @brief This file includes the driver for Liquid Crystal Display (LCD) module
* mounted on the Adafruit 1.8" TFT LCD shield (reference ID 802),
* that is used with the STM32 Nucleo board through SPI interface.
******************************************************************************
@verbatim
How To use this driver:
--------------------------
- This driver is used to drive directly the LCD mounted on on the Adafruit 1.8" TFT LCD
shield (reference ID 802)
The following IP are implied : SPI
Driver description:
---------------------
+ Initialization steps:
o Initialize the LCD with required orientation using the ADAFRUIT_802_LCD_Init() function.
- LCD_ORIENTATION_PORTRAIT
- LCD_ORIENTATION_PORTRAIT_ROT180
- LCD_ORIENTATION_LANDSCAPE
- LCD_ORIENTATION_LANDSCAPE_ROT180
o Enable the LCD display using the ADAFRUIT_802_LCD_DisplayOn() function.
o Disable the LCD display using the ADAFRUIT_802_LCD_DisplayOff() function.
o Write a pixel to the LCD memory using the ADAFRUIT_802_LCD_WritePixel() function.
o Draw an horizontal line using the ADAFRUIT_802_LCD_DrawHLine() function.
o Draw a vertical line using the ADAFRUIT_802_LCD_DrawVLine() function.
o Draw a bitmap image using the ADAFRUIT_802_LCD_DrawBitmap() function.
o Select the LCD layer to be used using the ADAFRUIT_802_LCD_SelectLayer() function.
o Set the display brightness using the ADAFRUIT_802_LCD_SetBrightness() function.
o Get the display brightness using the ADAFRUIT_802_LCD_GetBrightness() function.
o Read a pixel from the LCD memory using the ADAFRUIT_802_LCD_ReadPixel() function.
+ Display on LCD
o To draw and fill a basic shapes (dot, line, rectangle, circle, ellipse, .. bitmap)
on LCD and display text, utility stm32_lcd.c/.h must be called. Once the LCD is initialized,
user should call UTIL_LCD_SetFuncDriver() API to link board LCD drivers to UTIL LCD drivers.
The basic lcd services, defined in lcd utility, are ready for use.
Note:
--------
- Regarding the "Instance" parameter, needed for all functions, it is used to select
an LCD instance. On the "Adafruit 1.8" TFT LCD shield", only one LCD instance is availble. Then, this
parameter should be 0.
- The LCD support only 1 layer. Thus ADAFRUIT_802_LCD_SelectLayer function set always
the Active Layer to 0
- SetBrightness, GetBrightness and ReadPixel features are not supported
@endverbatim
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2018 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 "adafruit_802_lcd.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup ADAFRUIT_802
* @{
*/
/** @addtogroup ADAFRUIT_802_LCD
* @{
*/
/** @defgroup ADAFRUIT_802_LCD_Private_Variables LCD Private Variables
* @{
*/
static void *Lcd_CompObj = NULL;
static LCD_Drv_t *Lcd_Drv = NULL;
ADAFRUIT_802_LCD_Ctx_t Lcd_Ctx[LCD_INSTANCES_NBR];
/**
* @}
*/
/** @addtogroup ADAFRUIT_802_LCD_Exported_Variables
* @{
*/
const LCD_UTILS_Drv_t LCD_Driver =
{
ADAFRUIT_802_LCD_DrawBitmap,
ADAFRUIT_802_LCD_FillRGBRect,
ADAFRUIT_802_LCD_DrawHLine,
ADAFRUIT_802_LCD_DrawVLine,
ADAFRUIT_802_LCD_FillRect,
ADAFRUIT_802_LCD_ReadPixel,
ADAFRUIT_802_LCD_WritePixel,
ADAFRUIT_802_LCD_GetXSize,
ADAFRUIT_802_LCD_GetYSize,
NULL,
ADAFRUIT_802_LCD_GetPixelFormat
};
/**
* @}
*/
/** @defgroup ADAFRUIT_802_LCD_Private_FunctionPrototypes LCD Private Function Prototypes
* @{
*/
static int32_t ST7735_Probe(uint32_t Orientation);
static int32_t LCD_IO_Init(void);
static int32_t LCD_IO_DeInit(void);
static int32_t LCD_IO_WriteReg(uint8_t Reg, uint8_t* pData, uint32_t Length);
static int32_t LCD_IO_SendData(uint8_t *pData, uint32_t Length);
/**
* @}
*/
/** @addtogroup ADAFRUIT_802_LCD_Exported_Functions
* @{
*/
/**
* @brief Initializes the LCD with a given orientation.
* @param Instance LCD Instance
* @param orientation Select display orientation:
* - LCD_ORIENTATION_PORTRAIT
* - LCD_ORIENTATION_LANDSCAPE
* - LCD_ORIENTATION_PORTRAIT_ROT180
* - LCD_ORIENTATION_LANDSCAPE_ROT180
* @retval Error status
*/
int32_t ADAFRUIT_802_LCD_Init(uint32_t Instance, uint32_t Orientation)
{
int32_t ret;
if((Orientation > LCD_ORIENTATION_LANDSCAPE_ROT180) || (Instance >= LCD_INSTANCES_NBR))
{
ret = BSP_ERROR_WRONG_PARAM;
}
else
{
if(ST7735_Probe(Orientation) != BSP_ERROR_NONE)
{
ret = BSP_ERROR_UNKNOWN_COMPONENT;
}
else if(ADAFRUIT_802_LCD_GetXSize(Instance, &Lcd_Ctx[Instance].XSize) != BSP_ERROR_NONE)
{
ret = BSP_ERROR_COMPONENT_FAILURE;
}
else if(ADAFRUIT_802_LCD_GetYSize(Instance, &Lcd_Ctx[Instance].YSize) != BSP_ERROR_NONE)
{
ret = BSP_ERROR_COMPONENT_FAILURE;
}
else
{
/* Clear the LCD screen with white color */
ret = ADAFRUIT_802_LCD_FillRect(Instance, 0U, 0U, Lcd_Ctx[Instance].XSize, Lcd_Ctx[Instance].YSize, 0xFFFFFFFFU);
}
}
return ret;
}
/**
* @brief DeInitializes the LCD.
* @param Instance LCD Instance
* @retval Error status
*/
int32_t ADAFRUIT_802_LCD_DeInit(uint32_t Instance)
{
int32_t ret;
if(Instance >= LCD_INSTANCES_NBR)
{
ret = BSP_ERROR_WRONG_PARAM;
}
else
{
ret = LCD_IO_DeInit();
}
return ret;
}
/**
* @brief Gets the LCD Active LCD Pixel Format.
* @param Instance LCD Instance
* @param PixelFormat Active LCD Pixel Format
* @retval BSP status
*/
int32_t ADAFRUIT_802_LCD_GetPixelFormat(uint32_t Instance, uint32_t *PixelFormat)
{
int32_t ret = BSP_ERROR_NONE;
if(Instance >= LCD_INSTANCES_NBR)
{
ret = BSP_ERROR_WRONG_PARAM;
}
else
{
/* Only RGB565 format is supported */
*PixelFormat = LCD_PIXEL_FORMAT_RGB565;
}
return ret;
}
/**
* @brief Gets the LCD X size.
* @param Instance LCD Instance
* @param XSize LCD width
* @retval Error status
*/
int32_t ADAFRUIT_802_LCD_GetXSize(uint32_t Instance, uint32_t *XSize)
{
int32_t ret = BSP_ERROR_NONE;
if(Instance >= LCD_INSTANCES_NBR)
{
ret = BSP_ERROR_WRONG_PARAM;
}
else
{
if(Lcd_Drv->GetXSize(Lcd_CompObj, XSize) < 0)
{
ret = BSP_ERROR_COMPONENT_FAILURE;
}
}
return ret;
}
/**
* @brief Gets the LCD Y size.
* @param Instance LCD Instance
* @param YSize LCD hieght
* @retval Error status
*/
int32_t ADAFRUIT_802_LCD_GetYSize(uint32_t Instance, uint32_t *YSize)
{
int32_t ret = BSP_ERROR_NONE;
if(Instance >= LCD_INSTANCES_NBR)
{
ret = BSP_ERROR_WRONG_PARAM;
}
else
{
if(Lcd_Drv->GetYSize(Lcd_CompObj, YSize) < 0)
{
ret = BSP_ERROR_COMPONENT_FAILURE;
}
}
return ret;
}
/**
* @brief Reads an LCD pixel.
* @param Instance LCD Instance
* @param Xpos X position
* @param Ypos Y position
* @param Color RGB color
* @retval Error status
*/
int32_t ADAFRUIT_802_LCD_ReadPixel(uint32_t Instance, uint32_t Xpos, uint32_t Ypos, uint32_t *Color)
{
/* Prevent unused argument(s) compilation warning */
UNUSED(Instance);
UNUSED(Xpos);
UNUSED(Ypos);
UNUSED(Color);
return BSP_ERROR_FEATURE_NOT_SUPPORTED;
}
/**
* @brief Draws a pixel on LCD.
* @param Instance LCD Instance
* @param Xpos X position
* @param Ypos Y position
* @param Color RGB color
* @retval Error status
*/
int32_t ADAFRUIT_802_LCD_WritePixel(uint32_t Instance, uint32_t Xpos, uint32_t Ypos, uint32_t Color)
{
int32_t ret = BSP_ERROR_NONE;
if(Instance >= LCD_INSTANCES_NBR)
{
ret = BSP_ERROR_WRONG_PARAM;
}
else if(Lcd_Drv->SetPixel != NULL)
{
if(Lcd_Drv->SetPixel(Lcd_CompObj, Xpos, Ypos, Color) < 0)
{
ret = BSP_ERROR_COMPONENT_FAILURE;
}
}
else
{
ret = BSP_ERROR_FEATURE_NOT_SUPPORTED;
}
return ret;
}
/**
* @brief Draws an horizontal line.
* @param Instance LCD Instance
* @param Xpos X position
* @param Ypos Y position
* @param Length Line length
* @param Color RGB color
* @retval Error status
*/
int32_t ADAFRUIT_802_LCD_DrawHLine(uint32_t Instance, uint32_t Xpos, uint32_t Ypos, uint32_t Length, uint32_t Color)
{
int32_t ret = BSP_ERROR_NONE;
if(Instance >= LCD_INSTANCES_NBR)
{
ret = BSP_ERROR_WRONG_PARAM;
}
else if(Lcd_Drv->DrawHLine != NULL)
{
if(Lcd_Drv->DrawHLine(Lcd_CompObj, Xpos, Ypos, Length, Color) < 0)
{
ret = BSP_ERROR_COMPONENT_FAILURE;
}
}
else
{
ret = BSP_ERROR_FEATURE_NOT_SUPPORTED;
}
return ret;
}
/**
* @brief Draws a vertical line.
* @param Instance LCD Instance
* @param Xpos X position
* @param Ypos Y position
* @param Length Line length
* @param Color RGB color
* @retval Error status
*/
int32_t ADAFRUIT_802_LCD_DrawVLine(uint32_t Instance, uint32_t Xpos, uint32_t Ypos, uint32_t Length, uint32_t Color)
{
int32_t ret = BSP_ERROR_NONE;
if(Instance >= LCD_INSTANCES_NBR)
{
ret = BSP_ERROR_WRONG_PARAM;
}
else if(Lcd_Drv->DrawVLine != NULL)
{
if(Lcd_Drv->DrawVLine(Lcd_CompObj, Xpos, Ypos, Length, Color) < 0)
{
ret = BSP_ERROR_COMPONENT_FAILURE;
}
}
else
{
ret = BSP_ERROR_FEATURE_NOT_SUPPORTED;
}
return ret;
}
/**
* @brief Draws a bitmap picture (16 bpp).
* @param Instance LCD Instance
* @param Xpos Bmp X position in the LCD
* @param Ypos Bmp Y position in the LCD
* @param pBmp Pointer to Bmp picture address.
* @retval Error status
*/
int32_t ADAFRUIT_802_LCD_DrawBitmap(uint32_t Instance, uint32_t Xpos, uint32_t Ypos, uint8_t *pBmp)
{
int32_t ret = BSP_ERROR_NONE;
if(Instance >= LCD_INSTANCES_NBR)
{
ret = BSP_ERROR_WRONG_PARAM;
}
else if(Lcd_Drv->DrawBitmap != NULL)
{
if(Lcd_Drv->DrawBitmap(Lcd_CompObj, Xpos, Ypos, pBmp) < 0)
{
ret = BSP_ERROR_COMPONENT_FAILURE;
}
}
else
{
ret = BSP_ERROR_FEATURE_NOT_SUPPORTED;
}
return ret;
}
/**
* @brief Draws a full RGB rectangle
* @param Instance LCD Instance.
* @param Xpos specifies the X position.
* @param Ypos specifies the Y position.
* @param pData pointer to RGB data
* @param Width specifies the rectangle width.
* @param Height Specifies the rectangle height
* @retval BSP status
*/
int32_t ADAFRUIT_802_LCD_FillRGBRect(uint32_t Instance, uint32_t Xpos, uint32_t Ypos, uint8_t *pData, uint32_t Width, uint32_t Height)
{
int32_t ret = BSP_ERROR_NONE;
if (Instance >= LCD_INSTANCES_NBR)
{
ret = BSP_ERROR_WRONG_PARAM;
}
else if(Lcd_Drv->FillRGBRect != NULL)
{
/* Draw the horizontal line on LCD */
if (Lcd_Drv->FillRGBRect(Lcd_CompObj, Xpos, Ypos, pData, Width, Height) < 0)
{
ret = BSP_ERROR_COMPONENT_FAILURE;
}
}
else
{
ret = BSP_ERROR_FEATURE_NOT_SUPPORTED;
}
return ret;
}
/**
* @brief Draws a full rectangle.
* @param Instance LCD instance
* @param Xpos X position
* @param Ypos Y position
* @param Width Rectangle width
* @param Height Rectangle height
* @param Color RGB color
* @retval BSP status
*/
int32_t ADAFRUIT_802_LCD_FillRect(uint32_t Instance, uint32_t Xpos, uint32_t Ypos, uint32_t Width, uint32_t Height, uint32_t Color)
{
int32_t ret = BSP_ERROR_NONE;
if(Instance >= LCD_INSTANCES_NBR)
{
ret = BSP_ERROR_WRONG_PARAM;
}
else if(Lcd_Drv->FillRect != NULL)
{
if(Lcd_Drv->FillRect(Lcd_CompObj, Xpos, Ypos, Width, Height, Color) < 0)
{
ret = BSP_ERROR_COMPONENT_FAILURE;
}
}
else
{
ret = BSP_ERROR_FEATURE_NOT_SUPPORTED;
}
return ret;
}
/**
* @brief Enables the display.
* @param Instance LCD Instance
* @retval Error status
*/
int32_t ADAFRUIT_802_LCD_DisplayOn(uint32_t Instance)
{
int32_t ret = BSP_ERROR_NONE;
if(Instance >= LCD_INSTANCES_NBR)
{
ret = BSP_ERROR_WRONG_PARAM;
}
else if(Lcd_Drv->DisplayOn != NULL)
{
if(Lcd_Drv->DisplayOn(Lcd_CompObj) < 0)
{
ret = BSP_ERROR_COMPONENT_FAILURE;
}
}
else
{
ret = BSP_ERROR_FEATURE_NOT_SUPPORTED;
}
return ret;
}
/**
* @brief Disables the display.
* @param Instance LCD Instance
* @retval Error status
*/
int32_t ADAFRUIT_802_LCD_DisplayOff(uint32_t Instance)
{
int32_t ret = BSP_ERROR_NONE;
if(Instance >= LCD_INSTANCES_NBR)
{
ret = BSP_ERROR_WRONG_PARAM;
}
else if(Lcd_Drv->DisplayOff != NULL)
{
if(Lcd_Drv->DisplayOff(Lcd_CompObj) < 0)
{
ret = BSP_ERROR_COMPONENT_FAILURE;
}
}
else
{
ret = BSP_ERROR_FEATURE_NOT_SUPPORTED;
}
return ret;
}
/**
* @brief Set the brightness value
* @param Instance LCD Instance
* @param Brightness [00: Min (black), 100 Max]
* @retval Error status
*/
int32_t ADAFRUIT_802_LCD_SetBrightness(uint32_t Instance, uint32_t Brightness)
{
int32_t ret = BSP_ERROR_NONE;
if(Instance >= LCD_INSTANCES_NBR)
{
ret = BSP_ERROR_WRONG_PARAM;
}
else if(Lcd_Drv->SetBrightness != NULL)
{
if(Lcd_Drv->SetBrightness(Lcd_CompObj, Brightness) < 0)
{
ret = BSP_ERROR_COMPONENT_FAILURE;
}
}
else
{
ret = BSP_ERROR_FEATURE_NOT_SUPPORTED;
}
return ret;
}
/**
* @brief Get the brightness value
* @param Instance LCD Instance
* @param Brightness [00: Min (black), 100 Max]
* @retval Error status
*/
int32_t ADAFRUIT_802_LCD_GetBrightness(uint32_t Instance, uint32_t *Brightness)
{
int32_t ret = BSP_ERROR_NONE;
if(Instance >= LCD_INSTANCES_NBR)
{
ret = BSP_ERROR_WRONG_PARAM;
}
else if(Lcd_Drv->GetBrightness != NULL)
{
if(Lcd_Drv->GetBrightness(Lcd_CompObj, Brightness) < 0)
{
ret = BSP_ERROR_COMPONENT_FAILURE;
}
}
else
{
ret = BSP_ERROR_FEATURE_NOT_SUPPORTED;
}
return ret;
}
/**
* @}
*/
/** @defgroup ADAFRUIT_802_LCD_Private_Functions LCD Private Functions
* @{
*/
/**
* @brief Register Bus IOs if component ID is OK
* @param Orientation Display orientation
* @retval Error status
*/
static int32_t ST7735_Probe(uint32_t Orientation)
{
int32_t ret = BSP_ERROR_NONE;
ST7735_IO_t IOCtx;
static ST7735_Object_t ST7735Obj;
/* Configure the audio driver */
IOCtx.Address = 0;
IOCtx.Init = LCD_IO_Init;
IOCtx.DeInit = LCD_IO_DeInit;
IOCtx.GetTick = BSP_GetTick;
IOCtx.WriteReg = LCD_IO_WriteReg;
IOCtx.SendData = LCD_IO_SendData;
if(ST7735_RegisterBusIO(&ST7735Obj, &IOCtx) != ST7735_OK)
{
ret = BSP_ERROR_BUS_FAILURE;
}
else
{
Lcd_CompObj = &ST7735Obj;
Lcd_Drv = (LCD_Drv_t *) &ST7735_LCD_Driver;
if(Lcd_Drv->Init(Lcd_CompObj, ST7735_FORMAT_DEFAULT, Orientation) != ST7735_OK)
{
ret = BSP_ERROR_COMPONENT_FAILURE;
}
}
return ret;
}
/**
* @brief Initializes the LCD
* @retval None
*/
static int32_t LCD_IO_Init(void)
{
int32_t ret = BSP_ERROR_NONE;
GPIO_InitTypeDef GPIO_InitStruct;
/* LCD_CS_GPIO and LCD_DC_GPIO Periph clock enable */
ADAFRUIT_802_LCD_CS_GPIO_CLK_ENABLE();
ADAFRUIT_802_LCD_DC_GPIO_CLK_ENABLE();
/* Configure LCD_CS_PIN pin: LCD Card CS pin */
GPIO_InitStruct.Pin = ADAFRUIT_802_LCD_CS_PIN;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
HAL_GPIO_Init(ADAFRUIT_802_LCD_CS_GPIO_PORT, &GPIO_InitStruct);
/* Configure LCD_DC_PIN pin: LCD Card DC pin */
GPIO_InitStruct.Pin = ADAFRUIT_802_LCD_DC_PIN;
HAL_GPIO_Init(ADAFRUIT_802_LCD_DC_GPIO_PORT, &GPIO_InitStruct);
/* LCD chip select high */
ADAFRUIT_802_LCD_CS_HIGH();
/* LCD SPI Config */
if(BUS_SPIx_Init() != BSP_ERROR_NONE)
{
ret = BSP_ERROR_NO_INIT;
}
return ret;
}
/**
* @brief De-Initializes the LCD
* @retval None
*/
static int32_t LCD_IO_DeInit(void)
{
GPIO_InitTypeDef GPIO_InitStruct;
/* LCD chip de-select high */
ADAFRUIT_802_LCD_CS_LOW();
/* Configure LCD_CS_PIN pin: LCD Card CS pin */
GPIO_InitStruct.Pin = ADAFRUIT_802_LCD_CS_PIN;
HAL_GPIO_DeInit(ADAFRUIT_802_LCD_CS_GPIO_PORT, GPIO_InitStruct.Pin);
/* Configure LCD_DC_PIN pin: LCD Card DC pin */
GPIO_InitStruct.Pin = ADAFRUIT_802_LCD_DC_PIN;
HAL_GPIO_DeInit(ADAFRUIT_802_LCD_DC_GPIO_PORT, GPIO_InitStruct.Pin);
/* LCD_CS_GPIO and LCD_DC_GPIO Periph clock disable */
ADAFRUIT_802_LCD_CS_GPIO_CLK_DISABLE();
ADAFRUIT_802_LCD_DC_GPIO_CLK_DISABLE();
return BSP_ERROR_NONE;
}
/**
* @brief Writes command to select the LCD register.
* @param Reg Address of the selected register.
* @param pData pointer to data to write to the register
* @param Length length of data to write to the register
* @retval Error status
*/
static int32_t LCD_IO_WriteReg(uint8_t Reg, uint8_t* pData, uint32_t Length)
{
int32_t ret;
/* Reset LCD control line CS */
ADAFRUIT_802_LCD_CS_LOW();
/* Set LCD data/command line DC to Low */
ADAFRUIT_802_LCD_DC_LOW();
/* Send Command */
if(BUS_SPIx_Send(&Reg, 1) != BSP_ERROR_NONE)
{
ret = BSP_ERROR_PERIPH_FAILURE;
}
else
{
/* Deselect : Chip Select high */
ADAFRUIT_802_LCD_CS_HIGH();
/* Send Data */
ret = LCD_IO_SendData(pData, Length);
}
return ret;
}
/**
* @brief Send data to select the LCD GRAM.
* @param pData pointer to data to write to LCD GRAM.
* @param Length length of data to write to LCD GRAM
* @retval Error status
*/
static int32_t LCD_IO_SendData(uint8_t *pData, uint32_t Length)
{
int32_t ret = BSP_ERROR_NONE;
if(Length != 0U)
{
/* Reset LCD control line CS */
ADAFRUIT_802_LCD_CS_LOW();
/* Set LCD data/command line DC to High */
ADAFRUIT_802_LCD_DC_HIGH();
if(BUS_SPIx_Send(pData, Length) != BSP_ERROR_NONE)
{
ret = BSP_ERROR_PERIPH_FAILURE;
}
/* Deselect : Chip Select high */
ADAFRUIT_802_LCD_CS_HIGH();
}
return ret;
}
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
@@ -0,0 +1,138 @@
/**
******************************************************************************
* @file adafruit_802_lcd.h
* @author MCD Application Team
* @brief This file contains the common defines and functions prototypes for
* the adafruit_802_lcd.c driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2018 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 ADAFRUIT_802_LCD_H
#define ADAFRUIT_802_LCD_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "adafruit_802.h"
#include "adafruit_802_conf.h"
#include "lcd.h"
#include "../Components/st7735/st7735.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup ADAFRUIT_802
* @{
*/
/** @defgroup ADAFRUIT_802_LCD LCD
* @{
*/
/** @defgroup ADAFRUIT_802_LCD_Exported_Variables LCD Exported Variables
* @{
*/
extern const LCD_UTILS_Drv_t LCD_Driver;
/**
* @}
*/
/** @defgroup ADAFRUIT_802_LCD_Exported_Constants LCD Exported Constants
* @{
*/
#define LCD_INSTANCES_NBR 1U
#define LCD_ORIENTATION_PORTRAIT 0x00U /* Portrait orientation choice of LCD screen */
#define LCD_ORIENTATION_PORTRAIT_ROT180 0x01U /* Portrait rotated 180° orientation choice of LCD screen */
#define LCD_ORIENTATION_LANDSCAPE 0x02U /* Landscape orientation choice of LCD screen */
#define LCD_ORIENTATION_LANDSCAPE_ROT180 0x03U /* Landscape rotated 180° orientation choice of LCD screen */
/**
* @}
*/
/** @defgroup ADAFRUIT_802_LCD_Exported_Types LCD Exported Types
* @{
*/
typedef struct
{
uint32_t XSize;
uint32_t YSize;
uint32_t PixelFormat;
uint32_t IsMspCallbacksValid;
} ADAFRUIT_802_LCD_Ctx_t;
/**
* @}
*/
/** @addtogroup ADAFRUIT_802_LCD_Exported_Variables
* @{
*/
extern ADAFRUIT_802_LCD_Ctx_t Lcd_Ctx[LCD_INSTANCES_NBR];
/**
* @}
*/
/** @defgroup ADAFRUIT_802_LCD_Exported_Functions LCD Exported Functions
* @{
*/
int32_t ADAFRUIT_802_LCD_Init(uint32_t Instance, uint32_t Orientation);
int32_t ADAFRUIT_802_LCD_DeInit(uint32_t Instance);
/* LCD generic APIs: Display control */
int32_t ADAFRUIT_802_LCD_DisplayOn(uint32_t Instance);
int32_t ADAFRUIT_802_LCD_DisplayOff(uint32_t Instance);
int32_t ADAFRUIT_802_LCD_SetBrightness(uint32_t Instance, uint32_t Brightness);
int32_t ADAFRUIT_802_LCD_GetBrightness(uint32_t Instance, uint32_t *Brightness);
int32_t ADAFRUIT_802_LCD_GetXSize(uint32_t Instance, uint32_t *XSize);
int32_t ADAFRUIT_802_LCD_GetYSize(uint32_t Instance, uint32_t *YSize);
/* LCD generic APIs: Draw operations. This list of APIs is required for
lcd gfx utilities */
int32_t ADAFRUIT_802_LCD_GetPixelFormat(uint32_t Instance, uint32_t *PixelFormat);
int32_t ADAFRUIT_802_LCD_DrawBitmap(uint32_t Instance, uint32_t Xpos, uint32_t Ypos, uint8_t *pBmp);
int32_t ADAFRUIT_802_LCD_FillRGBRect(uint32_t Instance, uint32_t Xpos, uint32_t Ypos, uint8_t *pData, uint32_t Width, uint32_t Height);
int32_t ADAFRUIT_802_LCD_DrawHLine(uint32_t Instance, uint32_t Xpos, uint32_t Ypos, uint32_t Length, uint32_t Color);
int32_t ADAFRUIT_802_LCD_DrawVLine(uint32_t Instance, uint32_t Xpos, uint32_t Ypos, uint32_t Length, uint32_t Color);
int32_t ADAFRUIT_802_LCD_FillRect(uint32_t Instance, uint32_t Xpos, uint32_t Ypos, uint32_t Width, uint32_t Height, uint32_t Color);
int32_t ADAFRUIT_802_LCD_ReadPixel(uint32_t Instance, uint32_t Xpos, uint32_t Ypos, uint32_t *Color);
int32_t ADAFRUIT_802_LCD_WritePixel(uint32_t Instance, uint32_t Xpos, uint32_t Ypos, uint32_t Color);
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* ADAFRUIT_802_LCD_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,223 @@
/**
******************************************************************************
* @file adafruit_802_sd.h
* @author MCD Application Team
* @brief This file contains the common defines and functions prototypes for
* the adafruit_802_sd.c driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2018 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 ADAFRUIT_802_SD_H
#define ADAFRUIT_802_SD_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "adafruit_802_conf.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup ADAFRUIT_802
* @{
*/
/** @defgroup ADAFRUIT_802_SD SD
* @{
*/
/** @defgroup ADAFRUIT_802_SD_Exported_Types SD Exported Types
* @{
*/
typedef struct
{
uint32_t Reserved1:2U; /* Reserved */
uint32_t DeviceSize:12U; /* Device Size */
uint32_t MaxRdCurrentVDDMin:3U; /* Max. read current @ VDD min */
uint32_t MaxRdCurrentVDDMax:3U; /* Max. read current @ VDD max */
uint32_t MaxWrCurrentVDDMin:3U; /* Max. write current @ VDD min */
uint32_t MaxWrCurrentVDDMax:3U; /* Max. write current @ VDD max */
uint32_t DeviceSizeMul:3U; /* Device size multiplier */
} SD_Version_1_t;
typedef struct
{
uint32_t Reserved1:6U; /* Reserved */
uint32_t DeviceSize:22U; /* Device Size */
uint32_t Reserved2:1U; /* Reserved */
} SD_Version_2_t;
/**
* @brief Card Specific Data: CSD Register
*/
typedef struct
{
/* Header part */
uint32_t CSDStruct:2U; /* CSD structure */
uint32_t Reserved1:6U; /* Reserved */
uint32_t TAAC:8U; /* Data read access-time 1 */
uint32_t NSAC:8U; /* Data read access-time 2 in CLK cycles */
uint32_t MaxBusClkFrec:8U; /* Max. bus clock frequency */
uint32_t CardComdClasses:12U; /* Card command classes */
uint32_t RdBlockLen:4U; /* Max. read data block length */
uint32_t PartBlockRead:1U; /* Partial blocks for read allowed */
uint32_t WrBlockMisalign:1U; /* Write block misalignment */
uint32_t RdBlockMisalign:1U; /* Read block misalignment */
uint32_t DSRImpl:1U; /* DSR implemented */
/* v1 or v2 struct */
union csd_version
{
SD_Version_1_t v1;
SD_Version_2_t v2;
} version;
uint32_t EraseSingleBlockEnable:1U; /* Erase single block enable */
uint32_t EraseSectorSize:7U; /* Erase group size multiplier */
uint32_t WrProtectGrSize:7U; /* Write protect group size */
uint32_t WrProtectGrEnable:1U; /* Write protect group enable */
uint32_t Reserved2:2U; /* Reserved */
uint32_t WrSpeedFact:3U; /* Write speed factor */
uint32_t MaxWrBlockLen:4U; /* Max. write data block length */
uint32_t WriteBlockPartial:1U; /* Partial blocks for write allowed */
uint32_t Reserved3:5U; /* Reserved */
uint32_t FileFormatGrouop:1U; /* File format group */
uint32_t CopyFlag:1U; /* Copy flag (OTP) */
uint32_t PermWrProtect:1U; /* Permanent write protection */
uint32_t TempWrProtect:1U; /* Temporary write protection */
uint32_t FileFormat:2U; /* File Format */
uint32_t Reserved4:2U; /* Reserved */
uint32_t crc:7U; /* Reserved */
uint32_t Reserved5:1U; /* always 1*/
} SD_CardSpecificData_t;
/**
* @brief Card Identification Data: CID Register
*/
typedef struct
{
uint32_t ManufacturerID; /* ManufacturerID */
uint32_t OEM_AppliID; /* OEM/Application ID */
uint32_t ProdName1; /* Product Name part1 */
uint32_t ProdName2; /* Product Name part2*/
uint32_t ProdRev; /* Product Revision */
uint32_t ProdSN; /* Product Serial Number */
uint32_t Reserved1; /* Reserved1 */
uint32_t ManufactDate; /* Manufacturing Date */
uint32_t CID_CRC; /* CID CRC */
uint32_t Reserved2; /* always 1 */
} SD_CardIdData_t;
/**
* @brief SD Card information
*/
typedef struct
{
SD_CardSpecificData_t Csd;
SD_CardIdData_t Cid;
uint32_t CardCapacity; /*!< Card Capacity */
uint32_t CardBlockSize; /*!< Card Block Size */
uint32_t LogBlockNbr; /*!< Specifies the Card logical Capacity in blocks */
uint32_t LogBlockSize; /*!< Specifies logical block size in bytes */
} SD_CardInfo_t;
/**
* @}
*/
/** @defgroup ADAFRUIT_802_SPI_SD_Exported_Constants SD Exported Constants
* @{
*/
/**
* @brief Block Size
*/
#define ADAFRUIT_SD_BLOCK_SIZE 512U
/**
* @brief SD instance number
*/
#define SD_INSTANCES_NBR 1UL
/**
* @brief SD transfer state definition
*/
#define SD_TRANSFER_OK 0U
#define SD_TRANSFER_BUSY 1U
/**
* @brief SD detection on its memory slot
*/
#define SD_PRESENT 1UL
#define SD_NOT_PRESENT 0UL
/**
* @brief SD capacity type
*/
#define ADAFRUIT_802_CARD_SDSC 0UL /* SD Standard Capacity */
#define ADAFRUIT_802_CARD_SDHC 1UL /* SD High Capacity */
/**
* @brief SD Card information structure
*/
#define ADAFRUIT_802_SD_CardInfo_t SD_CardInfo_t
/**
* @}
*/
/** @defgroup ADAFRUIT_802_SD_Exported_Functions SD Exported Functions
* @{
*/
int32_t ADAFRUIT_802_SD_Init(uint32_t Instance);
int32_t ADAFRUIT_802_SD_DeInit(uint32_t Instance);
int32_t ADAFRUIT_802_SD_DetectITConfig(uint32_t Instance);
int32_t ADAFRUIT_802_SD_ReadBlocks(uint32_t Instance, uint32_t *pData, uint32_t BlockIdx, uint32_t BlocksNbr);
int32_t ADAFRUIT_802_SD_WriteBlocks(uint32_t Instance, uint32_t *pData, uint32_t BlockIdx, uint32_t BlocksNbr);
int32_t ADAFRUIT_802_SD_ReadBlocks_DMA(uint32_t Instance, uint32_t *pData, uint32_t BlockIdx, uint32_t BlocksNbr);
int32_t ADAFRUIT_802_SD_WriteBlocks_DMA(uint32_t Instance, uint32_t *pData, uint32_t BlockIdx, uint32_t BlocksNbr);
int32_t ADAFRUIT_802_SD_ReadBlocks_IT(uint32_t Instance, uint32_t *pData, uint32_t BlockIdx, uint32_t BlocksNbr);
int32_t ADAFRUIT_802_SD_WriteBlocks_IT(uint32_t Instance, uint32_t *pData, uint32_t BlockIdx, uint32_t BlocksNbr);
int32_t ADAFRUIT_802_SD_Erase(uint32_t Instance, uint32_t BlockIdx, uint32_t BlocksNbr);
int32_t ADAFRUIT_802_SD_GetCardState(uint32_t Instance);
int32_t ADAFRUIT_802_SD_GetCardInfo(uint32_t Instance, ADAFRUIT_802_SD_CardInfo_t *CardInfo);
int32_t ADAFRUIT_802_SD_IsDetected(uint32_t Instance);
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* ADAFRUIT_802_SD_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/