generated from niwciu/Embeded_Project_Template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from niwciu/feature/readme_file_update
Feature/readme file update
- Loading branch information
Showing
15 changed files
with
294 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Run Lizard Library Check | ||
name: Run Code Complexity Check | ||
on: | ||
workflow_dispatch: | ||
push: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
* @file LED_driver.h | ||
* @author niwciu (niwciu@gmail.com) | ||
* @brief simple module for driving LED on nucleo board. Allowe to init turn on and off the LED | ||
* @version 0.0.1 | ||
* @date 2024-08-04 | ||
* | ||
* @copyright Copyright (c) 2024 | ||
* | ||
*/ | ||
|
||
#ifndef _LED_DRIVER_H_ | ||
#define _LED_DRIVER_H_ | ||
|
||
#ifdef __cplusplus | ||
extern "C" | ||
{ | ||
#endif /* __cplusplus */ | ||
|
||
#include "stm32g070xx.h" | ||
|
||
// LED port and pin defines | ||
#define LED_PORT (GPIOA) | ||
#define LED_PORT_CLK_EN (RCC_IOPENR_GPIOAEN) | ||
#define MODER_LED_Msk (GPIO_MODER_MODE5_Msk) | ||
#define MODER_LED_0 (GPIO_MODER_MODE5_0) | ||
#define LED_OUT_PIN (GPIO_ODR_OD5) | ||
|
||
void LED_init(void); | ||
void LED_on(void); | ||
void LED_off(void); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif /* __cplusplus */ | ||
#endif /* _LED_DRIVER_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
examples/STM32G070RB_MODBUS_SLAVE/Core/Inc/modbus_driver_config.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/** | ||
* @file modbus_driver_config.h | ||
* @author niwciu (niwciu@gmail.com) | ||
* @brief Header file with defines that speed up modbus driver configuration specially when porting driver to different USARTs and Timers | ||
* @version 0.0.1 | ||
* @date 2024-05-24 | ||
* | ||
* @copyright Copyright (c) 2024 | ||
* | ||
*/ | ||
#pragma once | ||
|
||
#include "stm32g070xx.h" | ||
|
||
#define RX_DATA_BUF_SIZE 256 | ||
#define LOW 0 | ||
#define HIGH 1 | ||
|
||
/** modbus USART configuration*/ | ||
#define MODBUS_USART (USART2) | ||
#define MODBUS_USART_CLK APBENR1 | ||
#define MODBUS_USART_CLK_EN (RCC_APBENR1_USART2EN) | ||
#define MODBUS_USART_CLK_FREQ 64000000UL | ||
#define MODBUS_USART_IRQN USART2_IRQn | ||
#define MODBUS_USART_IRQHandler USART2_IRQHandler | ||
#define MODBUS_USART_IRQ_PRIORITY 10 | ||
|
||
#define MODBUS_USART_PORT (GPIOA) | ||
|
||
#define MODBUS_USART_RX_MODE (GPIO_MODER_MODE3_1) | ||
#define MODBUS_USART_TX_MODE (GPIO_MODER_MODE2_1) | ||
#define MODBUS_USART_DE_MODE (GPIO_MODER_MODE1_1) | ||
|
||
#define MODBUS_USART_RX_MODE_Msk (GPIO_MODER_MODE3) | ||
#define MODBUS_USART_TX_MODE_Msk (GPIO_MODER_MODE2) | ||
#define MODBUS_USART_DE_MODE_Msk (GPIO_MODER_MODE1) | ||
|
||
#define MODBUS_USART_RX_AF_Msk (GPIO_AFRL_AFSEL3) | ||
#define MODBUS_USART_TX_AF_Msk (GPIO_AFRL_AFSEL2) | ||
#define MODBUS_USART_DE_AF_Msk (GPIO_AFRL_AFSEL1) | ||
|
||
#define MODBUS_USART_RX_AF (GPIO_AFRL_AFSEL3_0) | ||
#define MODBUS_USART_TX_AF (GPIO_AFRL_AFSEL2_0) | ||
#define MODBUS_USART_DE_AF (GPIO_AFRL_AFSEL1_0) | ||
|
||
#define MODBUS_USART_AF_REG (LOW) | ||
|
||
#define MODBUS_USART_GPIO_CLK_EN (RCC_IOPENR_GPIOAEN) | ||
|
||
/** modbus Timer configuration*/ | ||
#define MODBUS_TIMER (TIM7) | ||
#define MODBUS_TIMER_CLK_EN (RCC_APBENR1_TIM7EN) | ||
#define MODBUS_TIMER_CLK_FREQ 64000000UL | ||
#define MODBUS_TIMER_IRQN TIM7_IRQn | ||
#define MODBUS_TIMER_IRQHandler TIM7_LPTIM2_IRQHandler | ||
#define MODBUS_TIMER_IRQ_PRIORITY 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* @file LED_driver.c | ||
* @author niwciu (niwciu@gmail.com) | ||
* @brief simple module for driving LED on nucleo board. Allowe to init turn on and off the LED | ||
* @version 0.0.1 | ||
* @date 2024-08-04 | ||
* | ||
* @copyright Copyright (c) 2024 | ||
* | ||
*/ | ||
#include "LED_driver.h" | ||
|
||
void LED_init(void) | ||
{ | ||
RCC->IOPENR |= LED_PORT_CLK_EN; | ||
LED_PORT->MODER &= (~MODER_LED_Msk); | ||
LED_PORT->MODER |= MODER_LED_0; | ||
} | ||
|
||
void LED_on(void) | ||
{ | ||
LED_PORT->ODR |= LED_OUT_PIN; | ||
} | ||
void LED_off(void) | ||
{ | ||
LED_PORT->ODR &= ~LED_OUT_PIN; | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.