STM32L0xx_Nucleo_32 BSP User Manual: Private Functions

STM32L0xx Nucleo 32 BSP Drivers

STM32L0xx_Nucleo_32 BSP User Manual
Private Functions

Functions

uint32_t BSP_GetVersion (void)
 This method returns the STM32L0XX NUCLEO 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 I2C1_Init (void)
 I2C Bus initialization.
void I2C1_Write (uint8_t Addr, uint8_t Reg, uint8_t Value)
 Writes a single data.
uint8_t I2C1_Read (uint8_t Addr, uint8_t Reg)
 Reads a single data.
HAL_StatusTypeDef I2C1_ReadBuffer (uint16_t Addr, uint8_t Reg, uint16_t RegSize, uint8_t *pBuffer, uint16_t Length)
 Reads multiple data on the BUS.
HAL_StatusTypeDef I2C1_IsDeviceReady (uint16_t DevAddress, uint32_t Trials)
 Checks if target device is ready for communication.
HAL_StatusTypeDef I2C1_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.
void I2C1_Error (void)
 Manages error callback by re-initializing I2C.
void I2C1_MspInit (I2C_HandleTypeDef *hi2c)
 I2C MSP Initialization.
uint8_t BSP_JOY_Init (void)
 Configures joystick available on adafruit 1.8" TFT shield managed through ADC to detect motion.
JOYState_TypeDef BSP_JOY_GetState (void)
 Returns the Joystick key pressed.
static void SPIx_MspInit (SPI_HandleTypeDef *hspi)
 Initializes SPI MSP.
static void SPIx_Init (void)
 Initializes SPI HAL.
static uint32_t SPIx_Read (void)
 SPI Read 4 bytes from device.
static void SPIx_Write (uint8_t Value)
 SPI Write a byte to device.
static void SPIx_Error (void)
 SPI error treatment function.
void SD_IO_Init (void)
 Initializes the SD Card and put it into StandBy State (Ready for data transfer).
void SD_IO_WriteByte (uint8_t Data)
 Writes a byte on the SD.
uint8_t SD_IO_ReadByte (void)
 Reads a byte from the SD.
HAL_StatusTypeDef SD_IO_WriteCmd (uint8_t Cmd, uint32_t Arg, uint8_t Crc, uint8_t Response)
 Sends 5 bytes command to the SD card and get response.
HAL_StatusTypeDef SD_IO_WaitResponse (uint8_t Response)
 Waits response from the SD card.
void SD_IO_WriteDummy (void)
 Sends dummy byte with CS High.
void LCD_IO_Init (void)
 Initializes the LCD.
void LCD_IO_WriteReg (uint8_t LCDReg)
 Writes command to select the LCD register.
void LCD_IO_WriteData (uint8_t Data)
 Writes data to select the LCD register.
void LCD_IO_WriteMultipleData (uint8_t *pData, uint32_t Size)
 Write register value.
void LCD_Delay (uint32_t Delay)
 Wait for loop in ms.
static void ADCx_MspInit (ADC_HandleTypeDef *hadc)
 Initializes ADC MSP.
static void ADCx_Init (void)
 Initializes ADC HAL.

Function Documentation

static void ADCx_Init ( void  ) [static]

Initializes ADC HAL.

Return values:
None

Definition at line 836 of file stm32l0xx_nucleo_32.c.

References ADCx_MspInit(), hnucleo_Adc, and NUCLEO_ADCx.

Referenced by BSP_JOY_Init().

static void ADCx_MspInit ( ADC_HandleTypeDef *  hadc) [static]

Initializes ADC MSP.

Parameters:
hadc,:ADC peripheral
Return values:
None

Definition at line 814 of file stm32l0xx_nucleo_32.c.

References NUCLEO_ADCx_CLK_ENABLE, NUCLEO_ADCx_GPIO_CLK_ENABLE, NUCLEO_ADCx_GPIO_PIN, and NUCLEO_ADCx_GPIO_PORT.

Referenced by ADCx_Init().

uint32_t BSP_GetVersion ( void  )

This method returns the STM32L0XX NUCLEO BSP Driver revision.

Return values:
version: 0xXYZR (8bits for each decimal, R for RC)

Definition at line 148 of file stm32l0xx_nucleo_32.c.

References __STM32L0XX_NUCLEO_32_BSP_VERSION.

Returns the Joystick key pressed.

Note:
To know which Joystick key is pressed we need to detect the voltage level on each key output
  • None : 3.3 V / 4095
  • SEL : 1.055 V / 1308
  • DOWN : 0.71 V / 88
  • LEFT : 3.0 V / 3720
  • RIGHT : 0.595 V / 737
  • UP : 1.65 V / 2046
Return values:
JOYState_TypeDef,:Code of the Joystick key pressed.

Definition at line 896 of file stm32l0xx_nucleo_32.c.

References hnucleo_Adc, JOY_DOWN, JOY_LEFT, JOY_NONE, JOY_RIGHT, JOY_SEL, and JOY_UP.

uint8_t BSP_JOY_Init ( void  )

Configures joystick available on adafruit 1.8" TFT shield managed through ADC to detect motion.

Return values:
Joystickstatus(0=> success, 1=> fail)

Definition at line 867 of file stm32l0xx_nucleo_32.c.

References ADCx_Init(), hnucleo_Adc, and sConfig.

void BSP_LED_Init ( Led_TypeDef  Led)

Configures LED GPIO.

Parameters:
Led,:Specifies the Led to be configured. This parameter can be one of following parameters:
  • LED3
Return values:
None

Definition at line 160 of file stm32l0xx_nucleo_32.c.

References LED_PIN, LED_PORT, and LEDx_GPIO_CLK_ENABLE.

void BSP_LED_Off ( Led_TypeDef  Led)

Turns selected LED Off.

Parameters:
Led,:Specifies the Led to be set off. This parameter can be one of following parameters:
  • LED3
Return values:
None

Definition at line 196 of file stm32l0xx_nucleo_32.c.

References LED_PIN, and LED_PORT.

void BSP_LED_On ( Led_TypeDef  Led)

Turns selected LED On.

Parameters:
Led,:Specifies the Led to be set on. This parameter can be one of following parameters:
  • LED3
Return values:
None

Definition at line 184 of file stm32l0xx_nucleo_32.c.

References LED_PIN, and LED_PORT.

void BSP_LED_Toggle ( Led_TypeDef  Led)

Toggles the selected LED.

Parameters:
Led,:Specifies the Led to be toggled. This parameter can be one of following parameters:
  • LED3
Return values:
None

Definition at line 208 of file stm32l0xx_nucleo_32.c.

References LED_PIN, and LED_PORT.

void I2C1_Error ( void  )

Manages error callback by re-initializing I2C.

Return values:
None

Definition at line 352 of file stm32l0xx_nucleo_32.c.

References heval_I2c1, and I2C1_Init().

Referenced by I2C1_Read(), I2C1_ReadBuffer(), I2C1_Write(), and I2C1_WriteBuffer().

void I2C1_Init ( void  )

I2C Bus initialization.

Return values:
None

Definition at line 223 of file stm32l0xx_nucleo_32.c.

References BSP_I2C1, heval_I2c1, I2C1_MspInit(), and I2C1_TIMING.

Referenced by I2C1_Error().

HAL_StatusTypeDef I2C1_IsDeviceReady ( uint16_t  DevAddress,
uint32_t  Trials 
)

Checks if target device is ready for communication.

Note:
This function is used with Memory devices
Parameters:
DevAddress,:Target device address
Trials,:Number of trials
Return values:
HALstatus

Definition at line 319 of file stm32l0xx_nucleo_32.c.

References heval_I2c1, and I2c1Timeout.

void I2C1_MspInit ( I2C_HandleTypeDef *  hi2c)

I2C MSP Initialization.

Parameters:
hi2c,:I2C handle
Return values:
None

Definition at line 366 of file stm32l0xx_nucleo_32.c.

References BSP_I2C1_CLK_ENABLE, BSP_I2C1_FORCE_RESET, BSP_I2C1_GPIO_CLK_ENABLE, BSP_I2C1_GPIO_PORT, BSP_I2C1_RELEASE_RESET, BSP_I2C1_SCL_PIN, BSP_I2C1_SCL_SDA_AF, and BSP_I2C1_SDA_PIN.

Referenced by I2C1_Init().

uint8_t I2C1_Read ( uint8_t  Addr,
uint8_t  Reg 
)

Reads a single data.

Parameters:
Addr,:I2C address
Reg,:Register address
Return values:
Readdata

Definition at line 270 of file stm32l0xx_nucleo_32.c.

References heval_I2c1, and I2C1_Error().

HAL_StatusTypeDef I2C1_ReadBuffer ( uint16_t  Addr,
uint8_t  Reg,
uint16_t  RegSize,
uint8_t *  pBuffer,
uint16_t  Length 
)

Reads multiple data on the BUS.

Parameters:
Addr: I2C Address
Reg: Reg Address
RegSize: The target register size (can be 8BIT or 16BIT)
pBuffer: pointer to read data buffer
Length: length of the data
Return values:
0if no problems to read multiple data

Definition at line 297 of file stm32l0xx_nucleo_32.c.

References heval_I2c1, I2C1_Error(), and I2c1Timeout.

void I2C1_Write ( uint8_t  Addr,
uint8_t  Reg,
uint8_t  Value 
)

Writes a single data.

Parameters:
Addr,:I2C address
Reg,:Register address
Value,:Data to be written
Return values:
None

Definition at line 250 of file stm32l0xx_nucleo_32.c.

References heval_I2c1, and I2C1_Error().

HAL_StatusTypeDef I2C1_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.

Parameters:
Addr,:Device address on BUS Bus.
Reg,:The target register address to write
RegSize,:The target register size (can be 8BIT or 16BIT)
pBuffer,:The target register value to be written
Length,:buffer size to be written
Return values:
None

Definition at line 333 of file stm32l0xx_nucleo_32.c.

References heval_I2c1, I2C1_Error(), and I2c1Timeout.

void LCD_Delay ( uint32_t  Delay)

Wait for loop in ms.

Parameters:
Delayin ms.
Return values:
None

Definition at line 801 of file stm32l0xx_nucleo_32.c.

void LCD_IO_Init ( void  )

Initializes the LCD.

Return values:
None

Definition at line 678 of file stm32l0xx_nucleo_32.c.

References LCD_CS_GPIO_CLK_ENABLE, LCD_CS_GPIO_PORT, LCD_CS_HIGH, LCD_CS_PIN, LCD_DC_GPIO_CLK_ENABLE, LCD_DC_GPIO_PORT, LCD_DC_PIN, and SPIx_Init().

void LCD_IO_WriteData ( uint8_t  Data)

Writes data to select the LCD register.

This function must be used after st7735_WriteReg() function

Parameters:
Data,:data to write to the selected register.
Return values:
None

Definition at line 730 of file stm32l0xx_nucleo_32.c.

References LCD_CS_HIGH, LCD_CS_LOW, LCD_DC_HIGH, and SPIx_Write().

void LCD_IO_WriteMultipleData ( uint8_t *  pData,
uint32_t  Size 
)

Write register value.

Parameters:
pDataPointer on the register value
SizeSize of byte to transmit to the register
Return values:
None

Definition at line 751 of file stm32l0xx_nucleo_32.c.

References hnucleo_Spi, LCD_CS_HIGH, LCD_CS_LOW, LCD_DC_HIGH, and SPIx_Write().

void LCD_IO_WriteReg ( uint8_t  LCDReg)

Writes command to select the LCD register.

Parameters:
LCDReg,:Address of the selected register.
Return values:
None

Definition at line 709 of file stm32l0xx_nucleo_32.c.

References LCD_CS_HIGH, LCD_CS_LOW, LCD_DC_LOW, and SPIx_Write().

void SD_IO_Init ( void  )

Initializes the SD Card and put it into StandBy State (Ready for data transfer).

Return values:
None

Definition at line 538 of file stm32l0xx_nucleo_32.c.

References SD_CS_GPIO_CLK_ENABLE, SD_CS_GPIO_PORT, SD_CS_HIGH, SD_CS_PIN, SD_DUMMY_BYTE, SD_IO_WriteByte(), and SPIx_Init().

uint8_t SD_IO_ReadByte ( void  )

Reads a byte from the SD.

Return values:
Thereceived byte.

Definition at line 584 of file stm32l0xx_nucleo_32.c.

References SPIx_Read().

Referenced by SD_IO_WaitResponse().

HAL_StatusTypeDef SD_IO_WaitResponse ( uint8_t  Response)

Waits response from the SD card.

Parameters:
Response,:Expected response from the SD card
Return values:
HAL_StatusTypeDefHAL Status

Definition at line 638 of file stm32l0xx_nucleo_32.c.

References SD_IO_ReadByte().

Referenced by SD_IO_WriteCmd().

void SD_IO_WriteByte ( uint8_t  Data)

Writes a byte on the SD.

Parameters:
Data,:byte to send.
Return values:
None

Definition at line 574 of file stm32l0xx_nucleo_32.c.

References SPIx_Write().

Referenced by SD_IO_Init(), SD_IO_WriteCmd(), and SD_IO_WriteDummy().

HAL_StatusTypeDef SD_IO_WriteCmd ( uint8_t  Cmd,
uint32_t  Arg,
uint8_t  Crc,
uint8_t  Response 
)

Sends 5 bytes command to the SD card and get response.

Parameters:
Cmd,:The user expected command to send to SD card.
Arg,:The command argument.
Crc,:The CRC.
Response,:Expected response from the SD card
Return values:
HAL_StatusTypeDefHAL Status

Definition at line 603 of file stm32l0xx_nucleo_32.c.

References SD_CS_LOW, SD_IO_WaitResponse(), SD_IO_WriteByte(), and SD_NO_RESPONSE_EXPECTED.

void SD_IO_WriteDummy ( void  )

Sends dummy byte with CS High.

Return values:
None

Definition at line 664 of file stm32l0xx_nucleo_32.c.

References SD_CS_HIGH, SD_DUMMY_BYTE, and SD_IO_WriteByte().

static void SPIx_Error ( void  ) [static]

SPI error treatment function.

Return values:
None

Definition at line 519 of file stm32l0xx_nucleo_32.c.

References hnucleo_Spi, and SPIx_Init().

Referenced by SPIx_Read(), and SPIx_Write().

static void SPIx_Init ( void  ) [static]

Initializes SPI HAL.

Return values:
None

Definition at line 443 of file stm32l0xx_nucleo_32.c.

References hnucleo_Spi, NUCLEO_SPIx, and SPIx_MspInit().

Referenced by LCD_IO_Init(), SD_IO_Init(), and SPIx_Error().

static void SPIx_MspInit ( SPI_HandleTypeDef *  hspi) [static]
static uint32_t SPIx_Read ( void  ) [static]

SPI Read 4 bytes from device.

Return values:
Readdata

Definition at line 478 of file stm32l0xx_nucleo_32.c.

References hnucleo_Spi, SPIx_Error(), and SpixTimeout.

Referenced by SD_IO_ReadByte().

static void SPIx_Write ( uint8_t  Value) [static]

SPI Write a byte to device.

Parameters:
Value,:value to be written
Return values:
None

Definition at line 501 of file stm32l0xx_nucleo_32.c.

References hnucleo_Spi, SPIx_Error(), and SpixTimeout.

Referenced by LCD_IO_WriteData(), LCD_IO_WriteMultipleData(), LCD_IO_WriteReg(), and SD_IO_WriteByte().

Generated on Mon Aug 28 2017 14:48:51 for STM32L0xx_Nucleo_32 BSP User Manual by   doxygen 1.7.6.1