Skip to content

Instantly share code, notes, and snippets.

@d-boz-wtwh
d-boz-wtwh / getting-started-with-stm32f103.c
Created October 22, 2019 20:45
Microcontroller Projects
#include "stm32f1xx_hal.h" //This header contains all the functions prototypes for the HAL module driver.
void SystemClock_Config(void); //Initizing System Clock 8Mhz
void Error_Handler(void); //Error Handler- We are not going to use it.
static void MX_GPIO_Init(void); //GPIO Initialization function
HAL_Init(); //Initialize the Hal Drivers
HAL_GPIO_TogglePin(Led_GPIO_Port,Led_Pin); //Toggle Gpio
HAL_Delay(1000); //Delay 1second
__HAL_RCC_GPIOC_CLK_ENABLE(); //Enable GPIO Clock
HAL_GPIO_WritePin(Led_GPIO_Port, Led_Pin, GPIO_PIN_RESET); //Initialize the GPIO Pin Output Level
@d-boz-wtwh
d-boz-wtwh / getting-started-with-stm32f103.c
Created October 22, 2019 20:45
Microcontroller Projects
#include "main.h"
#include "stm32f1xx_hal.h" //This header contains all the functions prototypes
//for the HAL module driver.
void SystemClock_Config(void); //Initizing System Clock 8Mhz
void Error_Handler(void); //Error Handler- We are not going to use it.
static void MX_GPIO_Init(void); //GPIO Initialization function
int main(void)
@d-boz-wtwh
d-boz-wtwh / push-button-and-led-with-stm32f103.c
Created October 22, 2019 20:45
Microcontroller Projects
#include "main.h" //Main Header File
#include "stm32f1xx_hal.h" //Hal drivers included for stm32f103c8t
void SystemClock_Config(void); //System clock Configuration
void Error_Handler(void); //Error HAndler
static void MX_GPIO_Init(void); //GPIO Initialization
int main(void) //Main function
{
//MCU Configuration
/****************************************************
Dated: 10 October 2018
Property off: www.microcontroller-project.com
Written by : Usman Ali Butt (usa_butt@hotmail.com)
****************************************************/
/* Includes ------------------------------------------------------------------*/
#include "main.h"
#include "stm32f1xx_hal.h"
#include "main.h"
#include "stm32f1xx_hal.h"
void SystemClock_Config(void);
void Error_Handler(void);
static void MX_GPIO_Init(void);
int main(void)
{
@d-boz-wtwh
d-boz-wtwh / stm32-pwm-generation-using-timers.c
Created October 22, 2019 20:45
Microcontroller Projects
/****************************************************
*Property off = www.microcontroller-project.com *
*Author = Usman Ali Butt *
*Date = 21 March 2017 *
*****************************************************/
#include "main.h"
#include "stm32f1xx_hal.h"
@d-boz-wtwh
d-boz-wtwh / stm32-variable-pwm-with-timers.c
Created October 22, 2019 20:46
Microcontroller Projects
/****************************************************
*Property off = www.microcontroller-project.com *
*Author = Usman Ali Butt *
*Date = 10 April 2017 *
* *
*****************************************************/
#include "main.h"
#include "stm32f1xx_hal.h"
#include "main.h" //Main Header File
#include "stm32f1xx_hal.h" //Hal drivers included for stm32f103c8t
/* Private function prototypes -----------------------------------------------*/
void SystemClock_Config(void); //System clock Configuration
void Error_Handler(void); //Error HAndler
static void MX_GPIO_Init(void); //GPIO Initialization
int main(void) //Main function
{
/****************************************************
Dated: 03 November 2018
Property off: www.microcontroller-project.com
Written by : Usman Ali Butt (usa_butt@hotmail.com)
****************************************************/
/* Includes ------------------------------------------------------------------*/
#include "main.h"
#include "stm32f1xx_hal.h"
#include "gpio.h"
@d-boz-wtwh
d-boz-wtwh / led-bar-with-stm32-microcontroller.c
Created October 22, 2019 20:46
Microcontroller Projects
/********************************************************************************
Property off: www.microcontroller-project.com
Written by : Usman Ali Butt
Date : 21-June-2018
******************************************************************************/
/* Includes ------------------------------------------------------------------*/
#include "main.h"
#include "stm32f1xx_hal.h"