STM32303C_EVAL BSP User Manual: stm32303c_eval.c File Reference

STM32303C EVAL BSP Drivers

stm32303c_eval.c File Reference

This file provides a set of firmware functions to manage LEDs, push-button and COM port available on STM32303C-EVAL evaluation board (MB1019) RevC from STMicroelectronics. More...

#include "stm32303c_eval.h"

Go to the source code of this file.

Defines

#define START_BYTE   0x70
#define SET_INDEX   0x00
#define READ_STATUS   0x01
#define LCD_WRITE_REG   0x02
#define LCD_READ_REG   0x03
#define SD_DUMMY_BYTE   0xFF
#define SD_NO_RESPONSE_EXPECTED   0x80
#define EEPROM_CMD_WREN   0x06
#define EEPROM_CMD_WRDI   0x04
#define EEPROM_CMD_RDSR   0x05
#define EEPROM_CMD_WRSR   0x01
#define EEPROM_CMD_WRITE   0x02
#define EEPROM_CMD_READ   0x03
#define EEPROM_WIP_FLAG   0x01
#define __STM32303C_EVAL_BSP_VERSION_MAIN   (0x02)
 STM32303C EVAL BSP Driver version number V2.1.2.
#define __STM32303C_EVAL_BSP_VERSION_SUB1   (0x01)
#define __STM32303C_EVAL_BSP_VERSION_SUB2   (0x02)
#define __STM32303C_EVAL_BSP_VERSION_RC   (0x00)
#define __STM32303C_EVAL_BSP_VERSION

Functions

static void I2Cx_Init (void)
 Eval I2Cx Bus initialization.
static void I2Cx_WriteData (uint16_t Addr, uint8_t Reg, uint16_t RegSize, uint8_t Value)
 Write a value in a register of the device through BUS.
static HAL_StatusTypeDef I2Cx_WriteBuffer (uint16_t Addr, uint8_t Reg, uint16_t RegSize, uint8_t *pBuffer, uint16_t Length)
 Write a value in a register of the device through BUS.
static uint8_t I2Cx_ReadData (uint16_t Addr, uint8_t Reg, uint16_t RegSize)
 Read a register of the device through BUS.
static HAL_StatusTypeDef I2Cx_ReadBuffer (uint16_t Addr, uint8_t Reg, uint16_t RegSize, uint8_t *pBuffer, uint16_t Length)
 Reads multiple data on the BUS.
static HAL_StatusTypeDef I2Cx_IsDeviceReady (uint16_t DevAddress, uint32_t Trials)
 Checks if target device is ready for communication.
static void I2Cx_Error (void)
 Eval I2Cx error treatment function.
static void I2Cx_MspInit (I2C_HandleTypeDef *hi2c)
 Initializes I2C MSP.
void EEPROM_I2C_IO_Init (void)
 Initializes peripherals used by the I2C EEPROM driver.
HAL_StatusTypeDef EEPROM_I2C_IO_WriteData (uint16_t DevAddress, uint16_t MemAddress, uint8_t *pBuffer, uint32_t BufferSize)
 Write data to I2C EEPROM driver.
HAL_StatusTypeDef EEPROM_I2C_IO_ReadData (uint16_t DevAddress, uint16_t MemAddress, uint8_t *pBuffer, uint32_t BufferSize)
 Read data from I2C EEPROM driver.
HAL_StatusTypeDef EEPROM_I2C_IO_IsDeviceReady (uint16_t DevAddress, uint32_t Trials)
 Checks if target device is ready for communication.
void TSENSOR_IO_Init (void)
 Initializes peripherals used by the I2C Temperature Sensor driver.
void TSENSOR_IO_Write (uint16_t DevAddress, uint8_t *pBuffer, uint8_t WriteAddr, uint16_t Length)
 Writes one byte to the TSENSOR.
void TSENSOR_IO_Read (uint16_t DevAddress, uint8_t *pBuffer, uint8_t ReadAddr, uint16_t Length)
 Reads one byte from the TSENSOR.
uint16_t TSENSOR_IO_IsDeviceReady (uint16_t DevAddress, uint32_t Trials)
 Checks if Temperature Sensor is ready for communication.
void AUDIO_IO_Init (void)
 Initializes peripherals used by the Audio Codec driver.
void AUDIO_IO_DeInit (void)
 DeInitializes Audio low level.
void AUDIO_IO_Write (uint16_t DevAddress, uint8_t Reg, uint8_t Value)
 Writes a single data on the Audio Codec.
uint8_t AUDIO_IO_Read (uint16_t DevAddress, uint8_t Reg)
 Reads a single data from the Audio Codec.
void AUDIO_IO_Delay (uint32_t Delay)
 Wait for loop in ms.
static void SPIx_Init (void)
 Initializes SPI HAL.
static void SPIx_Write (uint8_t Value)
 SPI Write a byte to device.
static uint32_t SPIx_Read (void)
 SPI Read 4 bytes from device.
static void SPIx_Error (void)
 SPI error treatment function.
static void SPIx_MspInit (SPI_HandleTypeDef *hspi)
 Initializes SPI MSP.
void LCD_IO_Init (void)
 Configures the LCD_SPI interface.
void LCD_IO_WriteMultipleData (uint8_t *pData, uint32_t Size)
 Write register value.
void LCD_IO_WriteReg (uint8_t Reg)
 register address.
uint16_t LCD_IO_ReadData (uint16_t Reg)
 Read register value.
void LCD_Delay (uint32_t Delay)
 Wait for loop in ms.
void EEPROM_SPI_IO_Init (void)
 Initializes the EEPROM SPI and put it into StandBy State (Ready for data transfer).
void EEPROM_SPI_IO_WriteByte (uint8_t Data)
 Write a byte on the EEPROM.
uint8_t EEPROM_SPI_IO_ReadByte (void)
 Read a byte from the EEPROM.
HAL_StatusTypeDef EEPROM_SPI_IO_WriteData (uint16_t MemAddress, uint8_t *pBuffer, uint32_t BufferSize)
 Write data to SPI EEPROM driver.
HAL_StatusTypeDef EEPROM_SPI_IO_ReadData (uint16_t MemAddress, uint8_t *pBuffer, uint32_t BufferSize)
 Read data from SPI EEPROM driver.
HAL_StatusTypeDef EEPROM_SPI_IO_WaitEepromStandbyState (void)
 Wait response from the SPI EEPROM.
void SD_IO_Init (void)
 Initializes the SD Card and put it into StandBy State (Ready for data transfer).
HAL_StatusTypeDef SD_IO_WriteCmd (uint8_t Cmd, uint32_t Arg, uint8_t Crc, uint8_t Response)
 Send 5 bytes command to the SD card and get response.
HAL_StatusTypeDef SD_IO_WaitResponse (uint8_t Response)
 Wait response from the SD card.
void SD_IO_WriteDummy (void)
 Send dummy byte with CS High.
void SD_IO_WriteByte (uint8_t Data)
 Write a byte on the SD.
uint8_t SD_IO_ReadByte (void)
 Read a byte from the SD.
uint32_t BSP_GetVersion (void)
 This method returns the STM32303C EVAL BSP Driver revision.
void BSP_LED_Init (Led_TypeDef Led)
 Configures LED GPIO.
void BSP_LED_On (Led_TypeDef Led)
 Turns selected LED On.
void BSP_LED_Off (Led_TypeDef Led)
 Turns selected LED Off.
void BSP_LED_Toggle (Led_TypeDef Led)
 Toggles the selected LED.
void BSP_PB_Init (Button_TypeDef Button, ButtonMode_TypeDef Button_Mode)
 Configures push button GPIO and EXTI Line.
uint32_t BSP_PB_GetState (Button_TypeDef Button)
 Returns the selected button state.
uint8_t BSP_JOY_Init (JOYMode_TypeDef Joy_Mode)
 Configures all button of the joystick in GPIO or EXTI modes.
JOYState_TypeDef BSP_JOY_GetState (void)
 Returns the current joystick status.
void BSP_COM_Init (COM_TypeDef COM, UART_HandleTypeDef *huart)
 Configures COM port.

Variables

GPIO_TypeDef * LED_PORT [LEDn]
 LED variables.
const uint16_t LED_PIN [LEDn]
GPIO_TypeDef * BUTTON_PORT [BUTTONn]
 BUTTON variables.
const uint16_t BUTTON_PIN [BUTTONn]
const uint16_t BUTTON_IRQn [BUTTONn]
GPIO_TypeDef * JOY_PORT [JOYn]
 JOYSTICK variables.
const uint16_t JOY_PIN [JOYn]
const uint8_t JOY_IRQn [JOYn]
USART_TypeDef * COM_USART [COMn] = {EVAL_COM1}
 COM variables.
GPIO_TypeDef * COM_TX_PORT [COMn] = {EVAL_COM1_TX_GPIO_PORT}
GPIO_TypeDef * COM_RX_PORT [COMn] = {EVAL_COM1_RX_GPIO_PORT}
const uint16_t COM_TX_PIN [COMn] = {EVAL_COM1_TX_PIN}
const uint16_t COM_RX_PIN [COMn] = {EVAL_COM1_RX_PIN}
const uint16_t COM_TX_AF [COMn] = {EVAL_COM1_TX_AF}
const uint16_t COM_RX_AF [COMn] = {EVAL_COM1_RX_AF}
uint32_t I2cxTimeout = EVAL_I2Cx_TIMEOUT_MAX
 BUS variables.
I2C_HandleTypeDef heval_I2c
uint32_t SpixTimeout = EVAL_SPIx_TIMEOUT_MAX
static SPI_HandleTypeDef heval_Spi

Detailed Description

This file provides a set of firmware functions to manage LEDs, push-button and COM port available on STM32303C-EVAL evaluation board (MB1019) RevC from STMicroelectronics.

Author:
MCD Application Team
Attention:

© COPYRIGHT(c) 2016 STMicroelectronics

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.

Definition in file stm32303c_eval.c.

Generated on Wed May 31 2017 10:00:44 for STM32303C_EVAL BSP User Manual by   doxygen 1.7.6.1