ATYSTMLIB_HAL: ATYSTMLIB_HAL

ATYSTMLIB_HAL V1_10_200722
ATYSTMLIB_HAL

Project

  • ATYSTMLIB_HAL

Author

  • ATY

Copyright

  • Copyright © 2020 MZ-ATY
  • This code follows:
    • MZ-ATY Various Contents Joint Statement - https://mengze.top/MZ-ATY_VCJS
    • CC 4.0 BY-NC-SA - https://creativecommons.org/licenses/by-nc-sa/4.0/
  • Your use will be deemed to have accepted the terms of this statement.
  • 您的使用行为将视为已接受本声明各项条款。

Descriptions

  • Familiar functions for STM32F1 series
Generated by doxygen 1.8.18


ATYSTMLIB_HAL: Todo List

Todo List
Global CheckCrc16Modbus (uint8_t *buf, uint8_t size)
"bufData" can creat with unkonw size


ATYSTMLIB_HAL: Data Structures

Data Structures
Here are the data structures with brief descriptions:
C PID


ATYSTMLIB_HAL: PID Struct Reference

Data Fields
PID Struct Reference

#include <PID_ATY.h>

Collaboration diagram for PID:

Data Fields

double | SetPoint
double | Proportion
double | Integral
double | Derivative
double | LastError
double | PrevError
double | SumError

Detailed Description

Definition at line 47 of file PID_ATY.h.

Field Documentation

◆ Derivative

double Derivative

Definition at line 51 of file PID_ATY.h.

◆ Integral

double Integral

Definition at line 50 of file PID_ATY.h.

◆ LastError

double LastError

Definition at line 52 of file PID_ATY.h.

◆ PrevError

double PrevError

Definition at line 53 of file PID_ATY.h.

◆ Proportion

double Proportion

Definition at line 49 of file PID_ATY.h.

◆ SetPoint

double SetPoint

Definition at line 48 of file PID_ATY.h.

◆ SumError

double SumError

Definition at line 54 of file PID_ATY.h.

The documentation for this struct was generated from the following file:
  • PID_ATY.h


ATYSTMLIB_HAL: Data Structure Index

Data Structure Index
p
p
PID
p


ATYSTMLIB_HAL: Data Fields

Here is a list of all struct and union fields with links to the structures/unions they belong to:
  • Derivative : PID
  • Integral : PID
  • LastError : PID
  • PrevError : PID
  • Proportion : PID
  • SetPoint : PID
  • SumError : PID


ATYSTMLIB_HAL: Data Fields - Variables

  • Derivative : PID
  • Integral : PID
  • LastError : PID
  • PrevError : PID
  • Proportion : PID
  • SetPoint : PID
  • SumError : PID


ATYSTMLIB_HAL: File List

File List
Here is a list of all files with brief descriptions:
CRC_ATY.h
FILTER_ATY.h
GPIO_ATY.h
I2C_ATY.h
INCLUDE_ATY.h
NXP74HC165_ATY.h
PID_ATY.h
RTC_ATY.h
TIMER_ATY.h
UART_ATY.h
UARTIO_ATY.h


ATYSTMLIB_HAL: CRC_ATY.h File Reference

Functions
CRC_ATY.h File Reference
#include "stm32f1xx_hal.h"
Include dependency graph for CRC_ATY.h:

Go to the source code of this file.

Functions

void | InvertUint8 (uint8_t *genBuf, uint8_t *srcBuf)
Invert buf with uint8_t size. More...
void | InvertUint16 (uint16_t *genBuf, uint16_t *srcBuf)
Invert buf with uint16_t size. More...
uint16_t | GenCrc16Modbus (uint8_t *buf, uint8_t size)
Generate CRC of Modbus 16. More...
uint8_t | GenCrc16ModbusHL (uint8_t *buf, uint8_t size, uint8_t highLow)
Generate CRC of Modbus 16 with high bit or low bit. More...
uint8_t | CheckCrc16Modbus (uint8_t *buf, uint8_t size)
Check CRC of Modbus 16. More...
void | UseOfCrc16Modbus (void)
Method of application. More...

Detailed Description

Project
  • ATYSTMLIB_HAL
Author
  • ATY
Copyright
  • Copyright © 2020 MZ-ATY
  • This code follows:
    • MZ-ATY Various Contents Joint Statement - https://mengze.top/MZ-ATY_VCJS
    • CC 4.0 BY-NC-SA - https://creativecommons.org/licenses/by-nc-sa/4.0/
  • Your use will be deemed to have accepted the terms of this statement.
  • 您的使用行为将视为已接受本声明各项条款。
Descriptions
  • Familiar functions of CRC for all codes
Update
  • 1_01_200318 > ATY
    1. Preliminary version, first Release
  • 1_03_200318 > ATY
    1. Add Conditional Compilation
    2. Add user port
  • 1_05_200722 > ATY
    1. Change parameters

Definition in file CRC_ATY.h.

Function Documentation

◆ CheckCrc16Modbus()

uint8_t CheckCrc16Modbus | ( | uint8_t * | buf,
 |  | uint8_t | size
 | ) |  |

Check CRC of Modbus 16.

Parameters
buf | - Generate buf
size | - Input source buf
Returns
Check CRC success or fault
Warning
Buf size should not cross the boundary, otherwise it will get stuck
Todo:
"bufData" can creat with unkonw size

Definition at line 151 of file CRC_ATY.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GenCrc16Modbus()

uint16_t GenCrc16Modbus | ( | uint8_t * | buf,
 |  | uint8_t | size
 | ) |  |

Generate CRC of Modbus 16.

Parameters
buf | - Generate buf
size | - Input source buf
Returns
Value of CRC generate
Warning
Buf size should not cross the boundary, otherwise it will get stuck

Definition at line 87 of file CRC_ATY.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GenCrc16ModbusHL()

uint8_t GenCrc16ModbusHL | ( | uint8_t * | buf,
 |  | uint8_t | size,
 |  | uint8_t | highLow
 | ) |  |

Generate CRC of Modbus 16 with high bit or low bit.

Parameters
buf | - Generate buf
size | - Input source buf
highLow | - Choose output high bit or low bit, 1 is high, 0 is low
Returns
Value of CRC generate in high bit or low bit
Warning
Buf size should not cross the boundary, otherwise it will get stuck

Definition at line 118 of file CRC_ATY.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ InvertUint16()

void InvertUint16 | ( | uint16_t * | genBuf,
 |  | uint16_t * | srcBuf
 | ) |  |

Invert buf with uint16_t size.

Parameters
genBuf | - Generate buf
srcBuf | - Input source buf

Definition at line 68 of file CRC_ATY.h.

Here is the caller graph for this function:

◆ InvertUint8()

void InvertUint8 | ( | uint8_t * | genBuf,
 |  | uint8_t * | srcBuf
 | ) |  |

Invert buf with uint8_t size.

Parameters
genBuf | - Generate buf
srcBuf | - Input source buf

Definition at line 51 of file CRC_ATY.h.

Here is the caller graph for this function:

◆ UseOfCrc16Modbus()

void UseOfCrc16Modbus ( void )

Method of application.

Definition at line 169 of file CRC_ATY.h.

Here is the call graph for this function:


ATYSTMLIB_HAL: FILTER_ATY.h File Reference

Macros | Functions | Variables
FILTER_ATY.h File Reference
#include "stm32f1xx_hal.h"
Include dependency graph for FILTER_ATY.h:

Go to the source code of this file.

Macros

#define | FILTER_8
You can define "FILTER_8" or "FILTER_32" to chose filter type. More...
#define | CHECK_TIMES 0x06
#define | CHECK_STATE 0x14

Functions

uint8_t FilterA_8 (uint8_t name, uint8_t state, uint8_t checkTimes)
8 byte size filter More...

Variables

volatile uint8_t filterState8 [CHECK_STATE][CHECK_TIMES] ={0}

Detailed Description

Project
  • ATYSTMLIB_HAL
Author
  • ATY
Copyright
  • Copyright © 2020 MZ-ATY
  • This code follows:
    • MZ-ATY Various Contents Joint Statement - https://mengze.top/MZ-ATY_VCJS
    • CC 4.0 BY-NC-SA - https://creativecommons.org/licenses/by-nc-sa/4.0/
  • Your use will be deemed to have accepted the terms of this statement.
  • 您的使用行为将视为已接受本声明各项条款。
Descriptions
  • Familiar functions of CRC for all codes
Update
  • 1_01_200318 > ATY
    1. Preliminary version, first Release
  • 1_02_200318 > ATY
    1. Add Conditional Compilation
    2. Add user port

Definition in file FILTER_ATY.h.

Macro Definition Documentation

◆ CHECK_STATE

#define CHECK_STATE 0x14

Definition at line 47 of file FILTER_ATY.h.

◆ CHECK_TIMES

#define CHECK_TIMES 0x06

Definition at line 46 of file FILTER_ATY.h.

◆ FILTER_8

#define FILTER_8

You can define "FILTER_8" or "FILTER_32" to chose filter type.

Definition at line 44 of file FILTER_ATY.h.

Function Documentation

◆ FilterA_8()

uint8_t FilterA_8 | ( | uint8_t | name,
 |  | uint8_t | state,
 |  | uint8_t | checkTimes
 | ) |  |

8 byte size filter

Parameters
name | - Which array bit to save
state | - The newest state of input
checkTimes | - Times to check
Returns
The newest state when it be stable
Warning
The real filter time depends on the total run time of the loop which contains this program multiply the number of filter times

Definition at line 61 of file FILTER_ATY.h.

Variable Documentation

◆ filterState8

volatile uint8_t filterState8[CHECK_STATE][CHECK_TIMES] ={0}

Definition at line 51 of file FILTER_ATY.h.


ATYSTMLIB_HAL: GPIO_ATY.h File Reference

Macros | Functions | Variables
GPIO_ATY.h File Reference
#include "stm32f1xx_hal.h"
Include dependency graph for GPIO_ATY.h:

Go to the source code of this file.

Macros

#define | HeartbeatLedPort GPIOE
You can define GPIO read&write function with your MCU type. More...
#define | HeartbeatLedPin GPIO_PIN_5
#define | KeyPort GPIOE
#define | KeyPin GPIO_PIN_4
#define | NONE_PRESS 0
#define | PRESS_ONCE 1
#define | PRESS_TWICE 2
#define | PRESS_LONG 3
#define | LONG_PRESS_TIME 60
#define | INTERVAL_TIME 100

Functions

void | KeyDetectOnce (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
Detect whether the key is pressed and how to press. More...
void | KeyDetectTwiceBlock (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
Detect press key twice in block way. More...
void | KeyDetectTwiceUnblock (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
Detect press key twice in block way. More...
uint32_t | KeyScan (void)
Scan key matrix value. More...
void | KeyDetectCombine (uint32_t keyValue)
8 byte size filter More...
void | KeyTest (uint8_t testMode)
Test key input. More...

Variables

uint8_t | pressType =NONE_PRESS
uint8_t | longPressCount =0
uint16_t | intervalCount =0
uint8_t | pressTimes =0

Detailed Description

Project
  • ATYSTMLIB_HAL
Author
  • ATY
Copyright
  • Copyright © 2020 MZ-ATY
  • This code follows:
    • MZ-ATY Various Contents Joint Statement - https://mengze.top/MZ-ATY_VCJS
    • CC 4.0 BY-NC-SA - https://creativecommons.org/licenses/by-nc-sa/4.0/
  • Your use will be deemed to have accepted the terms of this statement.
  • 您的使用行为将视为已接受本声明各项条款。
Descriptions
  • Familiar functions of CRC for all codes
Attention
  • If use KeyDetect function, the whole while delay should be as small as possible
Update
  • 1_01_200321 > ATY
    1. Preliminary version, first Release
  • 1_02_200401 > ATY
    1. Add KeyTest()
  • 1_03_200402 > ATY
    1. Add KeyScan() reserved function
    2. Refactor all function
    3. Add KeyDetectOnce()
    4. Add KeyDetectTwiceBlock()
    5. Add KeyDetectTwiceUnblock()

Definition in file GPIO_ATY.h.

Macro Definition Documentation

◆ HeartbeatLedPin

#define HeartbeatLedPin GPIO_PIN_5

Definition at line 54 of file GPIO_ATY.h.

◆ HeartbeatLedPort

#define HeartbeatLedPort GPIOE

You can define GPIO read&write function with your MCU type.

Definition at line 53 of file GPIO_ATY.h.

◆ INTERVAL_TIME

#define INTERVAL_TIME 100

Definition at line 101 of file GPIO_ATY.h.

◆ KeyPin

#define KeyPin GPIO_PIN_4

Definition at line 56 of file GPIO_ATY.h.

◆ KeyPort

#define KeyPort GPIOE

Definition at line 55 of file GPIO_ATY.h.

◆ LONG_PRESS_TIME

#define LONG_PRESS_TIME 60

Definition at line 67 of file GPIO_ATY.h.

◆ NONE_PRESS

#define NONE_PRESS 0

Definition at line 60 of file GPIO_ATY.h.

◆ PRESS_LONG

#define PRESS_LONG 3

Definition at line 63 of file GPIO_ATY.h.

◆ PRESS_ONCE

#define PRESS_ONCE 1

Definition at line 61 of file GPIO_ATY.h.

◆ PRESS_TWICE

#define PRESS_TWICE 2

Definition at line 62 of file GPIO_ATY.h.

Function Documentation

◆ KeyDetectCombine()

void KeyDetectCombine ( uint32_t keyValue )

8 byte size filter

Parameters
keyValue - Key value from KeyScan() return

Definition at line 181 of file GPIO_ATY.h.

◆ KeyDetectOnce()

void KeyDetectOnce | ( | GPIO_TypeDef * | GPIOx,
 |  | uint16_t | GPIO_Pin
 | ) |  |

Detect whether the key is pressed and how to press.

Parameters
GPIOx | - GPIO_Port
GPIO_Pin | - GPIO_Pin

Definition at line 73 of file GPIO_ATY.h.

Here is the caller graph for this function:

◆ KeyDetectTwiceBlock()

void KeyDetectTwiceBlock | ( | GPIO_TypeDef * | GPIOx,
 |  | uint16_t | GPIO_Pin
 | ) |  |

Detect press key twice in block way.

Parameters
GPIOx | - GPIO_Port
GPIO_Pin | - GPIO_Pin

Definition at line 107 of file GPIO_ATY.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ KeyDetectTwiceUnblock()

void KeyDetectTwiceUnblock | ( | GPIO_TypeDef * | GPIOx,
 |  | uint16_t | GPIO_Pin
 | ) |  |

Detect press key twice in block way.

Parameters
GPIOx | - GPIO_Port
GPIO_Pin | - GPIO_Pin

Definition at line 141 of file GPIO_ATY.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ KeyScan()

uint32_t KeyScan ( void )

Scan key matrix value.

Warning
If return value is 32bit, theoretical support 16*16 key matrix

Definition at line 172 of file GPIO_ATY.h.

Here is the caller graph for this function:

◆ KeyTest()

void KeyTest ( uint8_t testMode )

Test key input.

Parameters
testMode - Test key input

Definition at line 189 of file GPIO_ATY.h.

Here is the call graph for this function:

Variable Documentation

◆ intervalCount

uint16_t intervalCount =0

Definition at line 101 of file GPIO_ATY.h.

◆ longPressCount

uint8_t longPressCount =0

Definition at line 67 of file GPIO_ATY.h.

◆ pressTimes

uint8_t pressTimes =0

Definition at line 135 of file GPIO_ATY.h.

◆ pressType

uint8_t pressType =NONE_PRESS

Definition at line 65 of file GPIO_ATY.h.


ATYSTMLIB_HAL: I2C_ATY.h File Reference

Macros | Functions | Variables
I2C_ATY.h File Reference
#include "stm32f1xx_hal.h"
Include dependency graph for I2C_ATY.h:

Go to the source code of this file.

Macros

#define | HI2C_N hi2c1
#define | WRITE_LENGTH 5

Functions

void | I2C_Read (uint16_t addr, uint8_t *pData, uint16_t size)
Read I2C with HAL lib function. More...
void | I2C_Write (uint16_t addr, uint8_t *pData, uint16_t size)
Write I2C with HAL lib function. More...
void | I2C_Template (void)
A template to use I2C function for AT24C02. More...

Variables

I2C_HandleTypeDef HI2C_N

Detailed Description

Project
  • ATYSTMLIB_HAL
Author
  • ATY
Copyright
  • Copyright © 2020 MZ-ATY
  • This code follows:
    • MZ-ATY Various Contents Joint Statement - https://mengze.top/MZ-ATY_VCJS
    • CC 4.0 BY-NC-SA - https://creativecommons.org/licenses/by-nc-sa/4.0/
  • Your use will be deemed to have accepted the terms of this statement.
  • 您的使用行为将视为已接受本声明各项条款。
Descriptions
  • Familiar functions of CRC for all codes
Update
  • 1_01_200320 > ATY
    1. Preliminary version, first Release

Definition in file I2C_ATY.h.

Macro Definition Documentation

◆ HI2C_N

#define HI2C_N hi2c1

Definition at line 39 of file I2C_ATY.h.

◆ WRITE_LENGTH

#define WRITE_LENGTH 5

Definition at line 80 of file I2C_ATY.h.

Function Documentation

◆ I2C_Read()

void I2C_Read | ( | uint16_t | addr,
 |  | uint8_t * | pData,
 |  | uint16_t | size
 | ) |  |

Read I2C with HAL lib function.

Parameters
addr | - Start address
pData | - Data
size | - Size to write or read

Definition at line 49 of file I2C_ATY.h.

Here is the caller graph for this function:

◆ I2C_Template()

void I2C_Template ( void )

A template to use I2C function for AT24C02.

Definition at line 83 of file I2C_ATY.h.

Here is the call graph for this function:

◆ I2C_Write()

void I2C_Write | ( | uint16_t | addr,
 |  | uint8_t * | pData,
 |  | uint16_t | size
 | ) |  |

Write I2C with HAL lib function.

Parameters
addr | - Start address
pData | - Data
size | - Size to write or read

Definition at line 59 of file I2C_ATY.h.

Here is the caller graph for this function:

Variable Documentation

◆ HI2C_N

I2C_HandleTypeDef HI2C_N


ATYSTMLIB_HAL: INCLUDE_ATY.h File Reference

INCLUDE_ATY.h File Reference
#include "stdio.h"
Include dependency graph for INCLUDE_ATY.h:

Go to the source code of this file.


ATYSTMLIB_HAL: NXP74HC165_ATY.h File Reference

Functions
NXP74HC165_ATY.h File Reference
#include "stm32f1xx_hal.h"
Include dependency graph for NXP74HC165_ATY.h:

Go to the source code of this file.

Functions

uint32_t NXP74HC165_Get (uint32_t size, GPIO_TypeDef *NXP74HC165_CLK_Port, uint16_t NXP74HC165_CLK_Pin, GPIO_TypeDef *NXP74HC165_SH_Port, uint16_t NXP74HC165_SH_Pin, GPIO_TypeDef *NXP74HC165_DATA_Port, uint16_t NXP74HC165_DATA_Pin)
Get value of NXP74HC165. More...

Detailed Description

Project
  • ATYSTMLIB_HAL
Author
  • ATY
Copyright
  • Copyright © 2020 MZ-ATY
  • This code follows:
    • MZ-ATY Various Contents Joint Statement - https://mengze.top/MZ-ATY_VCJS
    • CC 4.0 BY-NC-SA - https://creativecommons.org/licenses/by-nc-sa/4.0/
  • Your use will be deemed to have accepted the terms of this statement.
  • 您的使用行为将视为已接受本声明各项条款。
Descriptions
  • Familiar functions of CRC for all codes
Update
  • 1_01_200525 > ATY
    1. Preliminary version, first Release
  • 1_02_200525 > ATY
    1. Add Conditional Compilation
    2. Add user port

Definition in file NXP74HC165_ATY.h.

Function Documentation

◆ NXP74HC165_Get()

uint32_t NXP74HC165_Get | ( | uint32_t | size,
 |  | GPIO_TypeDef * | NXP74HC165_CLK_Port,
 |  | uint16_t | NXP74HC165_CLK_Pin,
 |  | GPIO_TypeDef * | NXP74HC165_SH_Port,
 |  | uint16_t | NXP74HC165_SH_Pin,
 |  | GPIO_TypeDef * | NXP74HC165_DATA_Port,
 |  | uint16_t | NXP74HC165_DATA_Pin
 | ) |  |

Get value of NXP74HC165.

Parameters
size | - GPIO_Port
NXP74HC165_CLK_Port | - NXP74HC165_CLK_Port
NXP74HC165_CLK_Pin | - NXP74HC165_CLK_Pin
NXP74HC165_SH_Port | - NXP74HC165_SH_Port
NXP74HC165_SH_Pin | - NXP74HC165_SH_Pin
NXP74HC165_DATA_Port | - NXP74HC165_DATA_Port
NXP74HC165_DATA_Pin | - NXP74HC165_DATA_Pin
Returns
Value of NXP74HC165
Warning
NXP74HC165 reading data unstable at high temperature, so it's better to read at the begining only

Definition at line 57 of file NXP74HC165_ATY.h.


ATYSTMLIB_HAL: PID_ATY.h File Reference

Data Structures | Typedefs | Functions | Variables
PID_ATY.h File Reference
#include "stm32f1xx_hal.h"
#include "string.h"
Include dependency graph for PID_ATY.h:

Go to the source code of this file.

Data Structures

struct PID

Typedefs

typedef struct PID PID

Functions

double | PidCalc (PID *pidStruct, double nextPoint)
Calculate rOut. More...
void | PidInit (PID *pidStruct)
Init pid. More...
void | Actuator (double rDelta)
Calculate pidCurNum. More...
void | PidControl (void)
Pid control. More...

Variables

double | pidSetNum =0
double | pidCurNum =0

Detailed Description

Project
  • ATYSTMLIB_HAL
Author
  • ATY
Copyright
  • Copyright © 2020 MZ-ATY
  • This code follows:
    • MZ-ATY Various Contents Joint Statement - https://mengze.top/MZ-ATY_VCJS
    • CC 4.0 BY-NC-SA - https://creativecommons.org/licenses/by-nc-sa/4.0/
  • Your use will be deemed to have accepted the terms of this statement.
  • 您的使用行为将视为已接受本声明各项条款。
Descriptions
  • Familiar functions of CRC for all codes
Update
  • 1_01_200318 > ATY
    1. Preliminary version, first Release
  • 1_02_200318 > ATY
    1. Add Conditional Compilation
    2. Add user port

Definition in file PID_ATY.h.

Typedef Documentation

◆ PID

typedef struct PID PID

Function Documentation

◆ Actuator()

void Actuator ( double rDelta )

Calculate pidCurNum.

Parameters
rDelta - rDelta
Returns

Definition at line 90 of file PID_ATY.h.

Here is the caller graph for this function:

◆ PidCalc()

double PidCalc | ( | PID * | pidStruct,
 |  | double | nextPoint
 | ) |  |

Calculate rOut.

Parameters
pidStruct | - pidStruct
nextPoint | - nextPoint
Returns
pidStruct

Definition at line 63 of file PID_ATY.h.

Here is the caller graph for this function:

◆ PidControl()

void PidControl ( void )

Pid control.

Definition at line 98 of file PID_ATY.h.

Here is the call graph for this function:

◆ PidInit()

void PidInit ( PID * pidStruct )

Init pid.

Parameters
pidStruct - pidStruct

Definition at line 80 of file PID_ATY.h.

Here is the caller graph for this function:

Variable Documentation

◆ pidCurNum

double pidCurNum =0

Definition at line 45 of file PID_ATY.h.

◆ pidSetNum

double pidSetNum =0

Definition at line 45 of file PID_ATY.h.


ATYSTMLIB_HAL: RTC_ATY.h File Reference

Macros | Functions | Variables
RTC_ATY.h File Reference
#include "stm32f1xx_hal.h"
#include "time.h"
Include dependency graph for RTC_ATY.h:

Go to the source code of this file.

Macros

#define RTC_N hrtc

Functions

void | RTC_Init (void)
Init rtc date and time. More...
void | RTC_Set (uint8_t year, uint8_t month, uint8_t date, uint8_t hours, uint8_t minutes, uint8_t seconds)
Set rtc date and time. More...
uint8_t | IsLeapYear (uint16_t year)
Determine if it's a leap year. More...
uint32_t | RTC_FormatToUnix32 (uint8_t show)
Get rtc date time and convert to unix. More...
void | RTC_Unix32ToFormat (uint32_t unixTime, uint8_t show)
Detect whether the key is pressed and how to press. More...
void | RTC_GetShow (uint8_t show)
Get rtc date time and print to uart. More...
void | RTC_GetShowHex (uint8_t show)
Get rtc date time and print to uart in hexadecimal. More...
void | RTC_GetShowUnix32 (uint8_t show)

Variables

RTC_HandleTypeDef | RTC_N
RTC_DateTypeDef | rtcDateStructure
RTC_TimeTypeDef | rtcTimeStructure
uint8_t | dateTimeShow [6] ={0}

Detailed Description

Project
  • ATYSTMLIB_HAL
Author
  • ATY
Copyright
  • Copyright © 2020 MZ-ATY
  • This code follows:
    • MZ-ATY Various Contents Joint Statement - https://mengze.top/MZ-ATY_VCJS
    • CC 4.0 BY-NC-SA - https://creativecommons.org/licenses/by-nc-sa/4.0/
  • Your use will be deemed to have accepted the terms of this statement.
  • 您的使用行为将视为已接受本声明各项条款。
Descriptions
  • Familiar functions of CRC for all codes
Update
  • 1_01_200317 > ATY
    1. Preliminary version, first Release
  • 1_02_200318 > ATY
    1. Add RTC_Set and RTC_GetShowHex()
  • 1_03_200319 > ATY
    1. Add RTC_UartSet()
    2. Add RTC_FormatToUnix32()
    3. Add RTC_Unix32ToFormat()

Definition in file RTC_ATY.h.

Macro Definition Documentation

◆ RTC_N

#define RTC_N hrtc

Definition at line 46 of file RTC_ATY.h.

Function Documentation

◆ IsLeapYear()

uint8_t IsLeapYear ( uint16_t year )

Determine if it's a leap year.

Parameters
year - Year
Returns
Is leap year or not

Month 01 02 03 04 05 06 07 08 09 10 11 12 IsLeapYear 31 29 31 30 31 30 31 31 30 31 30 31 NotLeapYear 31 28 31 30 31 30 31 31 30 31 30 31

Definition at line 100 of file RTC_ATY.h.

◆ RTC_FormatToUnix32()

uint32_t RTC_FormatToUnix32 ( uint8_t show )

Get rtc date time and convert to unix.

Parameters
show - Chose to print or not
Returns
Time data in unix32
Warning
Must get time before get date

Definition at line 134 of file RTC_ATY.h.

Here is the caller graph for this function:

◆ RTC_GetShow()

void RTC_GetShow ( uint8_t show )

Get rtc date time and print to uart.

Parameters
show - Chose to print or not
Warning
Must get time before get date

Definition at line 191 of file RTC_ATY.h.

Here is the call graph for this function:

◆ RTC_GetShowHex()

void RTC_GetShowHex ( uint8_t show )

Get rtc date time and print to uart in hexadecimal.

Parameters
show - Chose to print or not
Warning
Must get time before get date

Definition at line 226 of file RTC_ATY.h.

◆ RTC_GetShowUnix32()

void RTC_GetShowUnix32 ( uint8_t show )

Definition at line 243 of file RTC_ATY.h.

◆ RTC_Init()

void RTC_Init ( void )

Init rtc date and time.

Definition at line 57 of file RTC_ATY.h.

◆ RTC_Set()

void RTC_Set | ( | uint8_t | year,
 |  | uint8_t | month,
 |  | uint8_t | date,
 |  | uint8_t | hours,
 |  | uint8_t | minutes,
 |  | uint8_t | seconds
 | ) |  |

Set rtc date and time.

Parameters
year | - Year
month | - Month
date | - Date
hours | - Hours
minutes | - Minutes
seconds | - Seconds

Definition at line 78 of file RTC_ATY.h.

◆ RTC_Unix32ToFormat()

void RTC_Unix32ToFormat | ( | uint32_t | unixTime,
 |  | uint8_t | show
 | ) |  |

Detect whether the key is pressed and how to press.

Parameters
unixTime | - Time data in unix32
show | - Chose to print or not

Definition at line 162 of file RTC_ATY.h.

Variable Documentation

◆ dateTimeShow

uint8_t dateTimeShow[6] ={0}

Definition at line 185 of file RTC_ATY.h.

◆ RTC_N

RTC_HandleTypeDef RTC_N

◆ rtcDateStructure

RTC_DateTypeDef rtcDateStructure

Definition at line 51 of file RTC_ATY.h.

◆ rtcTimeStructure

RTC_TimeTypeDef rtcTimeStructure

Definition at line 52 of file RTC_ATY.h.


ATYSTMLIB_HAL: TIMER_ATY.h File Reference

Macros | Functions | Variables
TIMER_ATY.h File Reference
#include "stm32f1xx_hal.h"
Include dependency graph for TIMER_ATY.h:

Go to the source code of this file.

Macros

#define | TIM_ATY
#define | HTIM_N htim2

Functions

void | delay_us (uint16_t us)
Delay n us with TimerN. More...
void | delay_ms (uint32_t ms)
Delay n ms with TimerN. More...
void | delay_s (uint32_t s)
Delay n s with TimerN. More...

Variables

TIM_HandleTypeDef HTIM_N

Detailed Description

Project
  • ATYSTMLIB_HAL
Author
  • ATY
Copyright
  • Copyright © 2020 MZ-ATY
  • This code follows:
    • MZ-ATY Various Contents Joint Statement - https://mengze.top/MZ-ATY_VCJS
    • CC 4.0 BY-NC-SA - https://creativecommons.org/licenses/by-nc-sa/4.0/
  • Your use will be deemed to have accepted the terms of this statement.
  • 您的使用行为将视为已接受本声明各项条款。
Descriptions
  • Familiar functions of CRC for all codes
Update
  • 1_01_200317 > ATY
    1. Preliminary version, first Release
  • 1_02_200318 > ATY
    1. Add Conditional Compilation
    2. Add user port
  • 1_03_200319 > ATY
    1. Add RTC delay_s()
  • 1_04_200401 > ATY
    1. Add delay_s() for other types
    2. Add delayTest()
    3. Fix Timer type function bug
  • 1_05_200423 > ATY
    1. Add TEST_ATY()

Definition in file TIMER_ATY.h.

Macro Definition Documentation

◆ HTIM_N

#define HTIM_N htim2

Definition at line 53 of file TIMER_ATY.h.

◆ TIM_ATY

#define TIM_ATY

Definition at line 52 of file TIMER_ATY.h.

Function Documentation

◆ delay_ms()

void delay_ms ( uint32_t ms )

Delay n ms with TimerN.

Parameters
ms - ms

Definition at line 183 of file TIMER_ATY.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ delay_s()

void delay_s ( uint32_t s )

Delay n s with TimerN.

Parameters
s - s

Definition at line 194 of file TIMER_ATY.h.

Here is the call graph for this function:

◆ delay_us()

void delay_us ( uint16_t us )

Delay n us with TimerN.

Parameters
us - us

Commonly used in RTOS microsecond delay; F1 -> 72Mhz -> Prescaler=71 -> 1us per count, Prescaler=719 -> 10us per count, Prescaler=7199 -> 100us per count, so Period init number need to be larger than max us, and Prescaler init must be 71 if use this type delay function

Warning
Be easily disturbed by other interrupt;

Definition at line 168 of file TIMER_ATY.h.

Here is the caller graph for this function:

Variable Documentation

◆ HTIM_N

TIM_HandleTypeDef HTIM_N


ATYSTMLIB_HAL: UART_ATY.h File Reference

Macros | Functions | Variables
UART_ATY.h File Reference
#include "stm32f1xx_hal.h"
#include "stdio.h"
#include "string.h"
Include dependency graph for UART_ATY.h:

Go to the source code of this file.

Macros

#define | UART1_NIT_ATY
#define | UART1_GET_SIZE 4
#define | UART1_SEND_SIZE 8
#define | UART2_NIT_ATY
#define | UART2_GET_SIZE 11
#define | UART2_SEND_SIZE 8
#define | UART3_NIT_ATY
#define | UART3_GET_SIZE 13
#define | UART3_SEND_SIZE 255

Functions

void | UartInit_ATY (void)
Rewrite "printf();". More...
void | Uart1Send (uint8_t *pData, uint16_t Size)
Send data from uart. More...
void | Uart1Recv (void)
Receive data from uart with IT. More...
void | Uart2Send (uint8_t *pData, uint16_t Size)
Send data from uart. More...
void | Uart2Recv (void)
Receive data from uart with IT. More...
void | Uart3Send (uint8_t *pData, uint16_t Size)
Send data from uart. More...
void | Uart3Recv (void)
Receive data from uart with IT. More...
void | HAL_UART_RxCpltCallback (UART_HandleTypeDef *huart)
Rewrite uart rx interrupt call-back function. More...

Variables

uint8_t | uart1GetByte =0
uint8_t | uart1GetCount =0
uint8_t | uart1GetStr [UART1_GET_SIZE]
uint8_t | uart1SendStr [UART1_SEND_SIZE]
uint8_t | uart2GetByte =0
uint8_t | uart2GetCount =0
uint8_t | uart2GetStr [UART2_GET_SIZE]
uint8_t | uart2SendStr [UART2_SEND_SIZE]
uint8_t | uart3GetByte =0
uint8_t | uart3GetCount =0
uint8_t | uart3GetStr [UART3_GET_SIZE]
uint8_t | uart3SendStr [UART3_SEND_SIZE]

Detailed Description

Project
  • ATYSTMLIB_HAL
Author
  • ATY
Copyright
  • Copyright © 2020 MZ-ATY
  • This code follows:
    • MZ-ATY Various Contents Joint Statement - https://mengze.top/MZ-ATY_VCJS
    • CC 4.0 BY-NC-SA - https://creativecommons.org/licenses/by-nc-sa/4.0/
  • Your use will be deemed to have accepted the terms of this statement.
  • 您的使用行为将视为已接受本声明各项条款。
Descriptions
  • Familiar functions of CRC for all codes
Attention
  • "UartInit_ATY();" need to be added at main()
Update
  • 1_01_200317 > ATY
    1. Preliminary version, first Release
  • 1_02_200318 > ATY
    1. Add Conditional Compilation
    2. Add user port
  • 1_03_200401 > ATY
    1. Fix UartControlTemplate()
    2. Change UartSend() to use string and size
    3. Test uart 1-5 in normal IT
    4. Change DMA all function
    5. Test uart 1-4 in DMA IT
    6. (Might be the last version)
  • 1_04_200423 > ATY
    1. Add TEST_ATY()
  • 1_05_200429 > ATY
    1. Change to uart1-5 independent function

Definition in file UART_ATY.h.

Macro Definition Documentation

◆ UART1_GET_SIZE

#define UART1_GET_SIZE 4

Definition at line 65 of file UART_ATY.h.

◆ UART1_NIT_ATY

#define UART1_NIT_ATY

Definition at line 63 of file UART_ATY.h.

◆ UART1_SEND_SIZE

#define UART1_SEND_SIZE 8

Definition at line 66 of file UART_ATY.h.

◆ UART2_GET_SIZE

#define UART2_GET_SIZE 11

Definition at line 70 of file UART_ATY.h.

◆ UART2_NIT_ATY

#define UART2_NIT_ATY

Definition at line 68 of file UART_ATY.h.

◆ UART2_SEND_SIZE

#define UART2_SEND_SIZE 8

Definition at line 71 of file UART_ATY.h.

◆ UART3_GET_SIZE

#define UART3_GET_SIZE 13

Definition at line 75 of file UART_ATY.h.

◆ UART3_NIT_ATY

#define UART3_NIT_ATY

Definition at line 73 of file UART_ATY.h.

◆ UART3_SEND_SIZE

#define UART3_SEND_SIZE 255

Definition at line 76 of file UART_ATY.h.

Function Documentation

◆ HAL_UART_RxCpltCallback()

void HAL_UART_RxCpltCallback ( UART_HandleTypeDef * huart )

Rewrite uart rx interrupt call-back function.

Parameters
huart - huart

Definition at line 398 of file UART_ATY.h.

Here is the call graph for this function:

◆ Uart1Recv()

void Uart1Recv ( void )

Receive data from uart with IT.

Definition at line 262 of file UART_ATY.h.

Here is the caller graph for this function:

◆ Uart1Send()

void Uart1Send | ( | uint8_t * | pData,
 |  | uint16_t | Size
 | ) |  |

Send data from uart.

Parameters
pData | - Data to send
Size | - Size of data

Definition at line 255 of file UART_ATY.h.

◆ Uart2Recv()

void Uart2Recv ( void )

Receive data from uart with IT.

Definition at line 290 of file UART_ATY.h.

Here is the caller graph for this function:

◆ Uart2Send()

void Uart2Send | ( | uint8_t * | pData,
 |  | uint16_t | Size
 | ) |  |

Send data from uart.

Parameters
pData | - Data to send
Size | - Size of data

Definition at line 283 of file UART_ATY.h.

◆ Uart3Recv()

void Uart3Recv ( void )

Receive data from uart with IT.

Definition at line 318 of file UART_ATY.h.

Here is the caller graph for this function:

◆ Uart3Send()

void Uart3Send | ( | uint8_t * | pData,
 |  | uint16_t | Size
 | ) |  |

Send data from uart.

Parameters
pData | - Data to send
Size | - Size of data

Definition at line 311 of file UART_ATY.h.

◆ UartInit_ATY()

void UartInit_ATY ( void )

Rewrite "printf();".

Init uart interrupt

Definition at line 199 of file UART_ATY.h.

Variable Documentation

◆ uart1GetByte

uint8_t uart1GetByte =0

Definition at line 90 of file UART_ATY.h.

◆ uart1GetCount

uint8_t uart1GetCount =0

Definition at line 91 of file UART_ATY.h.

◆ uart1GetStr

uint8_t uart1GetStr[UART1_GET_SIZE]

Definition at line 92 of file UART_ATY.h.

◆ uart1SendStr

uint8_t uart1SendStr[UART1_SEND_SIZE]

Definition at line 93 of file UART_ATY.h.

◆ uart2GetByte

uint8_t uart2GetByte =0

Definition at line 97 of file UART_ATY.h.

◆ uart2GetCount

uint8_t uart2GetCount =0

Definition at line 98 of file UART_ATY.h.

◆ uart2GetStr

uint8_t uart2GetStr[UART2_GET_SIZE]

Definition at line 99 of file UART_ATY.h.

◆ uart2SendStr

uint8_t uart2SendStr[UART2_SEND_SIZE]

Definition at line 100 of file UART_ATY.h.

◆ uart3GetByte

uint8_t uart3GetByte =0

Definition at line 104 of file UART_ATY.h.

◆ uart3GetCount

uint8_t uart3GetCount =0

Definition at line 105 of file UART_ATY.h.

◆ uart3GetStr

uint8_t uart3GetStr[UART3_GET_SIZE]

Definition at line 106 of file UART_ATY.h.

◆ uart3SendStr

uint8_t uart3SendStr[UART3_SEND_SIZE]

Definition at line 107 of file UART_ATY.h.


ATYSTMLIB_HAL: UARTIO_ATY.h File Reference

UARTIO_ATY.h File Reference
#include "stm32f1xx_hal.h"
#include "stdio.h"
#include "string.h"
Include dependency graph for UARTIO_ATY.h:

Go to the source code of this file.

Detailed Description

Project
  • ATYSTMLIB_HAL
Author
  • ATY
Copyright
  • Copyright © 2020 MZ-ATY
  • This code follows:
    • MZ-ATY Various Contents Joint Statement - https://mengze.top/MZ-ATY_VCJS
    • CC 4.0 BY-NC-SA - https://creativecommons.org/licenses/by-nc-sa/4.0/
  • Your use will be deemed to have accepted the terms of this statement.
  • 您的使用行为将视为已接受本声明各项条款。
Descriptions
  • Familiar functions of CRC for all codes
Update
  • 1_01_20722 > ATY
    1. Preliminary version, first Release

Definition in file UARTIO_ATY.h.


ATYSTMLIB_HAL: Globals

Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- a -

  • Actuator() : PID_ATY.h

- c -

  • CHECK_STATE : FILTER_ATY.h
  • CHECK_TIMES : FILTER_ATY.h
  • CheckCrc16Modbus() : CRC_ATY.h

- d -

  • dateTimeShow : RTC_ATY.h
  • delay_ms() : TIMER_ATY.h
  • delay_s() : TIMER_ATY.h
  • delay_us() : TIMER_ATY.h

- f -

  • FILTER_8 : FILTER_ATY.h
  • FilterA_8() : FILTER_ATY.h
  • filterState8 : FILTER_ATY.h

- g -

  • GenCrc16Modbus() : CRC_ATY.h
  • GenCrc16ModbusHL() : CRC_ATY.h

- h -

  • HAL_UART_RxCpltCallback() : UART_ATY.h
  • HeartbeatLedPin : GPIO_ATY.h
  • HeartbeatLedPort : GPIO_ATY.h
  • HI2C_N : I2C_ATY.h
  • HTIM_N : TIMER_ATY.h

- i -

  • I2C_Read() : I2C_ATY.h
  • I2C_Template() : I2C_ATY.h
  • I2C_Write() : I2C_ATY.h
  • INTERVAL_TIME : GPIO_ATY.h
  • intervalCount : GPIO_ATY.h
  • InvertUint16() : CRC_ATY.h
  • InvertUint8() : CRC_ATY.h
  • IsLeapYear() : RTC_ATY.h

- k -

  • KeyDetectCombine() : GPIO_ATY.h
  • KeyDetectOnce() : GPIO_ATY.h
  • KeyDetectTwiceBlock() : GPIO_ATY.h
  • KeyDetectTwiceUnblock() : GPIO_ATY.h
  • KeyPin : GPIO_ATY.h
  • KeyPort : GPIO_ATY.h
  • KeyScan() : GPIO_ATY.h
  • KeyTest() : GPIO_ATY.h

- l -

  • LONG_PRESS_TIME : GPIO_ATY.h
  • longPressCount : GPIO_ATY.h

- n -

  • NONE_PRESS : GPIO_ATY.h
  • NXP74HC165_Get() : NXP74HC165_ATY.h

- p -

  • PID : PID_ATY.h
  • PidCalc() : PID_ATY.h
  • PidControl() : PID_ATY.h
  • pidCurNum : PID_ATY.h
  • PidInit() : PID_ATY.h
  • pidSetNum : PID_ATY.h
  • PRESS_LONG : GPIO_ATY.h
  • PRESS_ONCE : GPIO_ATY.h
  • PRESS_TWICE : GPIO_ATY.h
  • pressTimes : GPIO_ATY.h
  • pressType : GPIO_ATY.h

- r -

  • RTC_FormatToUnix32() : RTC_ATY.h
  • RTC_GetShow() : RTC_ATY.h
  • RTC_GetShowHex() : RTC_ATY.h
  • RTC_GetShowUnix32() : RTC_ATY.h
  • RTC_Init() : RTC_ATY.h
  • RTC_N : RTC_ATY.h
  • RTC_Set() : RTC_ATY.h
  • RTC_Unix32ToFormat() : RTC_ATY.h
  • rtcDateStructure : RTC_ATY.h
  • rtcTimeStructure : RTC_ATY.h

- t -

  • TIM_ATY : TIMER_ATY.h

- u -

  • UART1_GET_SIZE : UART_ATY.h
  • UART1_NIT_ATY : UART_ATY.h
  • UART1_SEND_SIZE : UART_ATY.h
  • uart1GetByte : UART_ATY.h
  • uart1GetCount : UART_ATY.h
  • uart1GetStr : UART_ATY.h
  • Uart1Recv() : UART_ATY.h
  • Uart1Send() : UART_ATY.h
  • uart1SendStr : UART_ATY.h
  • UART2_GET_SIZE : UART_ATY.h
  • UART2_NIT_ATY : UART_ATY.h
  • UART2_SEND_SIZE : UART_ATY.h
  • uart2GetByte : UART_ATY.h
  • uart2GetCount : UART_ATY.h
  • uart2GetStr : UART_ATY.h
  • Uart2Recv() : UART_ATY.h
  • Uart2Send() : UART_ATY.h
  • uart2SendStr : UART_ATY.h
  • UART3_GET_SIZE : UART_ATY.h
  • UART3_NIT_ATY : UART_ATY.h
  • UART3_SEND_SIZE : UART_ATY.h
  • uart3GetByte : UART_ATY.h
  • uart3GetCount : UART_ATY.h
  • uart3GetStr : UART_ATY.h
  • Uart3Recv() : UART_ATY.h
  • Uart3Send() : UART_ATY.h
  • uart3SendStr : UART_ATY.h
  • UartInit_ATY() : UART_ATY.h
  • UseOfCrc16Modbus() : CRC_ATY.h

- w -

  • WRITE_LENGTH : I2C_ATY.h


ATYSTMLIB_HAL: Globals

- a -

  • Actuator() : PID_ATY.h

- c -

  • CheckCrc16Modbus() : CRC_ATY.h

- d -

  • delay_ms() : TIMER_ATY.h
  • delay_s() : TIMER_ATY.h
  • delay_us() : TIMER_ATY.h

- f -

  • FilterA_8() : FILTER_ATY.h

- g -

  • GenCrc16Modbus() : CRC_ATY.h
  • GenCrc16ModbusHL() : CRC_ATY.h

- h -

  • HAL_UART_RxCpltCallback() : UART_ATY.h

- i -

  • I2C_Read() : I2C_ATY.h
  • I2C_Template() : I2C_ATY.h
  • I2C_Write() : I2C_ATY.h
  • InvertUint16() : CRC_ATY.h
  • InvertUint8() : CRC_ATY.h
  • IsLeapYear() : RTC_ATY.h

- k -

  • KeyDetectCombine() : GPIO_ATY.h
  • KeyDetectOnce() : GPIO_ATY.h
  • KeyDetectTwiceBlock() : GPIO_ATY.h
  • KeyDetectTwiceUnblock() : GPIO_ATY.h
  • KeyScan() : GPIO_ATY.h
  • KeyTest() : GPIO_ATY.h

- n -

  • NXP74HC165_Get() : NXP74HC165_ATY.h

- p -

  • PidCalc() : PID_ATY.h
  • PidControl() : PID_ATY.h
  • PidInit() : PID_ATY.h

- r -

  • RTC_FormatToUnix32() : RTC_ATY.h
  • RTC_GetShow() : RTC_ATY.h
  • RTC_GetShowHex() : RTC_ATY.h
  • RTC_GetShowUnix32() : RTC_ATY.h
  • RTC_Init() : RTC_ATY.h
  • RTC_Set() : RTC_ATY.h
  • RTC_Unix32ToFormat() : RTC_ATY.h

- u -

  • Uart1Recv() : UART_ATY.h
  • Uart1Send() : UART_ATY.h
  • Uart2Recv() : UART_ATY.h
  • Uart2Send() : UART_ATY.h
  • Uart3Recv() : UART_ATY.h
  • Uart3Send() : UART_ATY.h
  • UartInit_ATY() : UART_ATY.h
  • UseOfCrc16Modbus() : CRC_ATY.h


ATYSTMLIB_HAL: Globals

  • dateTimeShow : RTC_ATY.h
  • filterState8 : FILTER_ATY.h
  • HI2C_N : I2C_ATY.h
  • HTIM_N : TIMER_ATY.h
  • intervalCount : GPIO_ATY.h
  • longPressCount : GPIO_ATY.h
  • pidCurNum : PID_ATY.h
  • pidSetNum : PID_ATY.h
  • pressTimes : GPIO_ATY.h
  • pressType : GPIO_ATY.h
  • RTC_N : RTC_ATY.h
  • rtcDateStructure : RTC_ATY.h
  • rtcTimeStructure : RTC_ATY.h
  • uart1GetByte : UART_ATY.h
  • uart1GetCount : UART_ATY.h
  • uart1GetStr : UART_ATY.h
  • uart1SendStr : UART_ATY.h
  • uart2GetByte : UART_ATY.h
  • uart2GetCount : UART_ATY.h
  • uart2GetStr : UART_ATY.h
  • uart2SendStr : UART_ATY.h
  • uart3GetByte : UART_ATY.h
  • uart3GetCount : UART_ATY.h
  • uart3GetStr : UART_ATY.h
  • uart3SendStr : UART_ATY.h


ATYSTMLIB_HAL: Globals

  • PID : PID_ATY.h


ATYSTMLIB_HAL: Globals

  • CHECK_STATE : FILTER_ATY.h
  • CHECK_TIMES : FILTER_ATY.h
  • FILTER_8 : FILTER_ATY.h
  • HeartbeatLedPin : GPIO_ATY.h
  • HeartbeatLedPort : GPIO_ATY.h
  • HI2C_N : I2C_ATY.h
  • HTIM_N : TIMER_ATY.h
  • INTERVAL_TIME : GPIO_ATY.h
  • KeyPin : GPIO_ATY.h
  • KeyPort : GPIO_ATY.h
  • LONG_PRESS_TIME : GPIO_ATY.h
  • NONE_PRESS : GPIO_ATY.h
  • PRESS_LONG : GPIO_ATY.h
  • PRESS_ONCE : GPIO_ATY.h
  • PRESS_TWICE : GPIO_ATY.h
  • RTC_N : RTC_ATY.h
  • TIM_ATY : TIMER_ATY.h
  • UART1_GET_SIZE : UART_ATY.h
  • UART1_NIT_ATY : UART_ATY.h
  • UART1_SEND_SIZE : UART_ATY.h
  • UART2_GET_SIZE : UART_ATY.h
  • UART2_NIT_ATY : UART_ATY.h
  • UART2_SEND_SIZE : UART_ATY.h
  • UART3_GET_SIZE : UART_ATY.h
  • UART3_NIT_ATY : UART_ATY.h
  • UART3_SEND_SIZE : UART_ATY.h
  • WRITE_LENGTH : I2C_ATY.h


ATYSTMLIB_HAL: CRC_ATY.h Source File

CRC_ATY.h
Go to the documentation of this file.
1
36 #ifndef __CRC_ATY_H
37 #define __CRC_ATY_H
38
39 #include "stm32f1xx_hal.h"
40
41
42 /******************************* For user *************************************/
43 /******************************************************************************/
44
45
51 void InvertUint8(uint8_t *genBuf, uint8_t *srcBuf)
52 {
53 uint8_t i;
54 uint8_t tempBuf=0;
55
56 for(i=0;i<8;i++)
57 {
58 if(srcBuf[0]&(1<<i))
59 tempBuf|=1<<(7-i);
60 }
61 genBuf[0]=tempBuf;
62 }
68 void InvertUint16(uint16_t *genBuf, uint16_t *srcBuf)
69 {
70 uint8_t i;
71 uint16_t tempBuf=0;
72
73 for(i=0;i<16;i++)
74 {
75 if(srcBuf[0]&(1<<i))
76 tempBuf|=1<<(15-i);
77 }
78 genBuf[0]=tempBuf;
79 }
87 uint16_t GenCrc16Modbus(uint8_t *buf, uint8_t size)
88 {
89 uint16_t crcXorResult=0xFFFF;
90 uint16_t crcXorMultinomial=0x8005;
91 uint8_t tempBuf=0;
92
93 while(size--)
94 {
95 tempBuf=*(buf++);
96 InvertUint8(&tempBuf, &tempBuf);
97 crcXorResult^=(tempBuf<<8);
98
99 for(int i=0;i<8;i++)
100 {
101 if(crcXorResult&0x8000)
102 crcXorResult=(crcXorResult<<1)^crcXorMultinomial;
103 else
104 crcXorResult=crcXorResult<<1;
105 }
106 }
107 InvertUint16(&crcXorResult, &crcXorResult);
108 return (crcXorResult);
109 }
118 uint8_t GenCrc16ModbusHL(uint8_t *buf, uint8_t size, uint8_t highLow)
119 {
120 uint16_t crcXorResult=0xFFFF;
121 uint16_t crcXorMultinomial=0x8005;
122 uint8_t tempBuf=0;
123
124 while(size--)
125 {
126 tempBuf=*(buf++);
127 InvertUint8(&tempBuf, &tempBuf);
128 crcXorResult^=(tempBuf<<8);
129
130 for(int i=0;i<8;i++)
131 {
132 if(crcXorResult&0x8000)
133 crcXorResult=(crcXorResult<<1)^crcXorMultinomial;
134 else
135 crcXorResult=crcXorResult<<1;
136 }
137 }
138 InvertUint16(&crcXorResult, &crcXorResult);
139 if(highLow)
140 return ((uint8_t)(crcXorResult & 0x00FF));
141 return ((uint8_t)((crcXorResult >> 8) & 0xFF));
142 }
151 uint8_t CheckCrc16Modbus(uint8_t *buf, uint8_t size)
152 {
153 uint8_t bufData[20];
154 for(int i=0;i<size-2;i++)
155 bufData[i]=buf[i];
156
157 uint16_t crcO=GenCrc16Modbus(bufData, size-2);
158 uint8_t CRC_L=(uint8_t)(crcO&0x00FF);
159 uint8_t CRC_H=(uint8_t)((crcO>>8)&0xFF);
160
161 if((buf[size-2]==CRC_L) && (buf[size-1]==CRC_H))
162 return 1;
163 return 0;
164 }
165
169 void UseOfCrc16Modbus(void)
170 {
171 volatile uint8_t checkResult=0;
172 uint8_t tempA[12]={0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0xB3,0xC3};
173 uint8_t tempB[12]={0x0A,0x09,0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01}; //B0E7
174 uint8_t tempC[12]={0x0A,0x09,0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01}; //B0E7
175
176 checkResult=CheckCrc16Modbus(tempA, 12);
177 tempB[10]=(uint8_t)(GenCrc16Modbus(tempB, 10) & 0x00FF);
178 tempB[11]=(uint8_t)((GenCrc16Modbus(tempB, 10) >> 8) & 0x00FF);
179 tempC[10]=GenCrc16ModbusHL(tempC, 10, 1);
180 tempC[11]=GenCrc16ModbusHL(tempC, 10, 0);
181 }
182
183
184 #endif /* __CRC_ATY_H */
185
186 /******************************** End Of File *********************************/
InvertUint8
void InvertUint8(uint8_t *genBuf, uint8_t *srcBuf)
Invert buf with uint8_t size.
Definition: CRC_ATY.h:51
UseOfCrc16Modbus
void UseOfCrc16Modbus(void)
Method of application.
Definition: CRC_ATY.h:169
GenCrc16ModbusHL
uint8_t GenCrc16ModbusHL(uint8_t *buf, uint8_t size, uint8_t highLow)
Generate CRC of Modbus 16 with high bit or low bit.
Definition: CRC_ATY.h:118
GenCrc16Modbus
uint16_t GenCrc16Modbus(uint8_t *buf, uint8_t size)
Generate CRC of Modbus 16.
Definition: CRC_ATY.h:87
CheckCrc16Modbus
uint8_t CheckCrc16Modbus(uint8_t *buf, uint8_t size)
Check CRC of Modbus 16.
Definition: CRC_ATY.h:151
InvertUint16
void InvertUint16(uint16_t *genBuf, uint16_t *srcBuf)
Invert buf with uint16_t size.
Definition: CRC_ATY.h:68


ATYSTMLIB_HAL: FILTER_ATY.h Source File

FILTER_ATY.h
Go to the documentation of this file.
1
34 #ifndef __FILTER_ATY_H
35 #define __FILTER_ATY_H
36
37 #include "stm32f1xx_hal.h"
38
39
40 /******************************* For user *************************************/
42 // #define FILTER_32
43 #define FILTER_8
44
45 #define CHECK_TIMES 0x06
46 #define CHECK_STATE 0x14
47 /******************************************************************************/
48
49
50 #ifdef FILTER_8
51 volatile uint8_t filterState8[CHECK_STATE][CHECK_TIMES]={0};
61 uint8_t FilterA_8(uint8_t name, uint8_t state, uint8_t checkTimes)
62 {
63 uint8_t FilterA_8_i=0;
64 for(FilterA_8_i=0; FilterA_8_i < (checkTimes-1); FilterA_8_i++)
65 filterState8[name][FilterA_8_i+1] = filterState8[name][(FilterA_8_i)];
66 filterState8[name][0]=state;
67 for(FilterA_8_i=0; FilterA_8_i < (checkTimes-1); FilterA_8_i++)
68 {
69 if(filterState8[name][FilterA_8_i] != filterState8[name][(FilterA_8_i+1)])
70 return 0xFF;
71 }
72 return filterState8[name][0];
73 }
74 #endif /* FILTER_8 */
75
76
77 #ifdef FILTER_32
78 volatile uint32_t filterState32[CHECK_STATE][CHECK_TIMES]={0};
88 uint32_t FilterA_32(uint32_t name, uint32_t state, uint32_t checkTimes)
89 {
90 uint32_t FilterA_32_i=0;
91 filterState32[name][CHECK_TIMES-1]=state;
92 for(FilterA_32_i=0; FilterA_32_i < (checkTimes-1); FilterA_32_i++)
93 filterState32[name][FilterA_32_i] = filterState32[name][(FilterA_32_i+1)];
94 for(FilterA_32_i=0; FilterA_32_i < (checkTimes-1); FilterA_32_i++)
95 {
96 if(filterState32[name][FilterA_32_i] != filterState32[name][(FilterA_32_i+1)])
97 return 0xFF;
98 }
99 return filterState32[name][0];
100 }
101 #endif /* FILTER_32 */
102
103
104 #endif /* __DEBOUNCE_ATY_H */
105
106 /******************************** End Of File *********************************/
filterState8
volatile uint8_t filterState8[CHECK_STATE][CHECK_TIMES]
Definition: FILTER_ATY.h:51
CHECK_STATE
#define CHECK_STATE
Definition: FILTER_ATY.h:46
FilterA_8
uint8_t FilterA_8(uint8_t name, uint8_t state, uint8_t checkTimes)
8 byte size filter
Definition: FILTER_ATY.h:61
CHECK_TIMES
#define CHECK_TIMES
Definition: FILTER_ATY.h:45


ATYSTMLIB_HAL: GPIO_ATY.h Source File

GPIO_ATY.h
Go to the documentation of this file.
1
43 #ifndef __GPIO_ATY_H
44 #define __GPIO_ATY_H
45
46 #include "stm32f1xx_hal.h"
47
48
49 /******************************* For user *************************************/
52 #define HeartbeatLedPort GPIOE
53 #define HeartbeatLedPin GPIO_PIN_5
54 #define KeyPort GPIOE
55 #define KeyPin GPIO_PIN_4
56 /******************************************************************************/
57
58
59 #define NONE_PRESS 0
60 #define PRESS_ONCE 1
61 #define PRESS_TWICE 2
62 #define PRESS_LONG 3
63
64
65 uint8_t pressType=NONE_PRESS;
66 #define LONG_PRESS_TIME 60
67 uint8_t longPressCount=0;
73 void KeyDetectOnce(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
74 {
75 if(HAL_GPIO_ReadPin(GPIOx, GPIO_Pin)==GPIO_PIN_RESET)
76 {
77 HAL_Delay(20);
78 if(HAL_GPIO_ReadPin(GPIOx, GPIO_Pin)==GPIO_PIN_RESET)
79 {
80 if(longPressCount>LONG_PRESS_TIME)
81 {
82 pressType=PRESS_LONG;
83 }
84 else
85 {
86 longPressCount++;
87 }
88 }
89 }
90 if(HAL_GPIO_ReadPin(GPIOx, GPIO_Pin)==GPIO_PIN_SET)
91 {
92 if(longPressCount>0 && longPressCount<=LONG_PRESS_TIME)
93 {
94 pressType=PRESS_ONCE;
95 }
96 longPressCount=0;
97 }
98 }
99
100 #define INTERVAL_TIME 100
101 uint16_t intervalCount=0;
107 void KeyDetectTwiceBlock(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
108 {
109 KeyDetectOnce(GPIOx, GPIO_Pin);
110 if(pressType==PRESS_ONCE)
111 {
112 intervalCount=0;
113 pressType=NONE_PRESS;
114 while(++intervalCount)
115 {
116 KeyDetectOnce(GPIOx, GPIO_Pin);
117 HAL_Delay(1);
118 if(pressType==PRESS_ONCE)
119 {
120 pressType=PRESS_TWICE;
121 break;
122 }
123 else
124 {
125 if(intervalCount>INTERVAL_TIME)
126 {
127 pressType=PRESS_ONCE;
128 break;
129 }
130 }
131 }
132 }
133 }
134
135 uint8_t pressTimes=0;
141 void KeyDetectTwiceUnblock(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
142 {
143 KeyDetectOnce(GPIOx, GPIO_Pin);
144 if(pressType==PRESS_ONCE)
145 {
146 intervalCount=0;
147 if(pressTimes==0)
148 {
149 pressType=NONE_PRESS;
150 pressTimes++;
151 }
152 else
153 {
154 pressType=PRESS_TWICE;
155 pressTimes=0;
156 intervalCount=0;
157 }
158 }
159 intervalCount++;
160 HAL_Delay(1);
161 if(intervalCount>INTERVAL_TIME && pressTimes!=0)
162 {
163 pressType=PRESS_ONCE;
164 pressTimes=0;
165 intervalCount=0;
166 }
167 }
172 uint32_t KeyScan(void)
173 {
174
175 return 0;
176 }
181 void KeyDetectCombine(uint32_t keyValue)
182 {
183
184 }
189 void KeyTest(uint8_t testMode)
190 {
191 switch(testMode)
192 {
193 case 1:
194 {
195 KeyDetectOnce(KeyPort, KeyPin);
196 if(pressType==PRESS_ONCE)
197 {
198 pressType=NONE_PRESS;
199 HAL_GPIO_TogglePin(HeartbeatLedPort, HeartbeatLedPin);
200 }
201 else if(pressType==PRESS_LONG)
202 {
203 pressType=NONE_PRESS;
204 HAL_GPIO_TogglePin(HeartbeatLedPort, HeartbeatLedPin);
205 HAL_Delay(20);
206 }
207 break;
208 }
209 case 2:
210 {
211 KeyDetectTwiceBlock(KeyPort, KeyPin);
212 if(pressType==PRESS_ONCE)
213 {
214 pressType=NONE_PRESS;
215 HAL_GPIO_TogglePin(HeartbeatLedPort, HeartbeatLedPin);
216 }
217 else if(pressType==PRESS_LONG)
218 {
219 pressType=NONE_PRESS;
220 HAL_GPIO_TogglePin(HeartbeatLedPort, HeartbeatLedPin);
221 HAL_Delay(20);
222 }
223 else if(pressType==PRESS_TWICE)
224 {
225 pressType=NONE_PRESS;
226 HAL_GPIO_TogglePin(HeartbeatLedPort, HeartbeatLedPin);
227 HAL_Delay(200);
228 HAL_GPIO_TogglePin(HeartbeatLedPort, HeartbeatLedPin);
229 HAL_Delay(200);
230 HAL_GPIO_TogglePin(HeartbeatLedPort, HeartbeatLedPin);
231 HAL_Delay(200);
232 HAL_GPIO_TogglePin(HeartbeatLedPort, HeartbeatLedPin);
233 HAL_Delay(200);
234
235 }
236 break;
237 }
238 case 3:
239 {
240 KeyDetectTwiceUnblock(KeyPort, KeyPin);
241 if(pressType==PRESS_ONCE)
242 {
243 pressType=NONE_PRESS;
244 HAL_GPIO_TogglePin(HeartbeatLedPort, HeartbeatLedPin);
245 }
246 else if(pressType==PRESS_LONG)
247 {
248 pressType=NONE_PRESS;
249 HAL_GPIO_TogglePin(HeartbeatLedPort, HeartbeatLedPin);
250 HAL_Delay(20);
251 }
252 else if(pressType==PRESS_TWICE)
253 {
254 pressType=NONE_PRESS;
255 HAL_GPIO_TogglePin(HeartbeatLedPort, HeartbeatLedPin);
256 HAL_Delay(200);
257 HAL_GPIO_TogglePin(HeartbeatLedPort, HeartbeatLedPin);
258 HAL_Delay(200);
259 HAL_GPIO_TogglePin(HeartbeatLedPort, HeartbeatLedPin);
260 HAL_Delay(200);
261 HAL_GPIO_TogglePin(HeartbeatLedPort, HeartbeatLedPin);
262 HAL_Delay(200);
263
264 }
265 break;
266 }
267 case 4:
268 {
269 KeyScan();
270 break;
271 }
272 }
273 }
274
275
276 #endif /* __GPIO_ATY_H */
277
278 /******************************** End Of File *********************************/
PRESS_LONG
#define PRESS_LONG
Definition: GPIO_ATY.h:62
KeyDetectCombine
void KeyDetectCombine(uint32_t keyValue)
8 byte size filter
Definition: GPIO_ATY.h:181
KeyPin
#define KeyPin
Definition: GPIO_ATY.h:55
PRESS_ONCE
#define PRESS_ONCE
Definition: GPIO_ATY.h:60
intervalCount
uint16_t intervalCount
Definition: GPIO_ATY.h:101
longPressCount
uint8_t longPressCount
Definition: GPIO_ATY.h:67
pressTimes
uint8_t pressTimes
Definition: GPIO_ATY.h:135
INTERVAL_TIME
#define INTERVAL_TIME
Definition: GPIO_ATY.h:100
NONE_PRESS
#define NONE_PRESS
Definition: GPIO_ATY.h:59
HeartbeatLedPin
#define HeartbeatLedPin
Definition: GPIO_ATY.h:53
KeyDetectTwiceBlock
void KeyDetectTwiceBlock(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
Detect press key twice in block way.
Definition: GPIO_ATY.h:107
pressType
uint8_t pressType
Definition: GPIO_ATY.h:65
KeyScan
uint32_t KeyScan(void)
Scan key matrix value.
Definition: GPIO_ATY.h:172
KeyDetectTwiceUnblock
void KeyDetectTwiceUnblock(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
Detect press key twice in block way.
Definition: GPIO_ATY.h:141
HeartbeatLedPort
#define HeartbeatLedPort
You can define GPIO read&write function with your MCU type.
Definition: GPIO_ATY.h:52
KeyDetectOnce
void KeyDetectOnce(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
Detect whether the key is pressed and how to press.
Definition: GPIO_ATY.h:73
LONG_PRESS_TIME
#define LONG_PRESS_TIME
Definition: GPIO_ATY.h:66
KeyPort
#define KeyPort
Definition: GPIO_ATY.h:54
PRESS_TWICE
#define PRESS_TWICE
Definition: GPIO_ATY.h:61
KeyTest
void KeyTest(uint8_t testMode)
Test key input.
Definition: GPIO_ATY.h:189


ATYSTMLIB_HAL: I2C_ATY.h Source File

I2C_ATY.h
Go to the documentation of this file.
1
31 #ifndef __I2C_ATY_H
32 #define __I2C_ATY_H
33
34 #include "stm32f1xx_hal.h"
35
36
37 /******************************* For user *************************************/
38 #define HI2C_N hi2c1
39 /******************************************************************************/
40
41
42 extern I2C_HandleTypeDef HI2C_N;
49 void I2C_Read(uint16_t addr, uint8_t *pData, uint16_t size)
50 {
51 HAL_I2C_Mem_Read(&HI2C_N, 0xA0, addr, I2C_MEMADD_SIZE_8BIT, pData, size, 100);
52 }
59 void I2C_Write(uint16_t addr, uint8_t *pData, uint16_t size)
60 {
61 uint16_t firstWrite=0,i=0;
62
63 HAL_I2C_Mem_Write(&HI2C_N, 0xA1, addr, I2C_MEMADD_SIZE_8BIT, pData, size, 100);
64 HAL_Delay(5);
65
66 firstWrite=8-(addr%8); //How long left of this page
67 if((addr/8) != ((addr+size)/8))
68 {
69 for(i=0; i<(((addr+size)/8)-(addr/8)); i++)
70 {
71 // HAL_IWDG_Refresh(&hiwdg);
72 HAL_I2C_Mem_Write(&HI2C_N, 0xA1, addr+firstWrite+(i*8), I2C_MEMADD_SIZE_8BIT,
73 pData+firstWrite+(i*8), size-firstWrite-(i*8), 100);
74 HAL_Delay(5);
75 }
76 }
77 }
78
79 #define WRITE_LENGTH 5
80
83 void I2C_Template(void)
84 {
85 uint8_t tmpWriteData[WRITE_LENGTH]={0};
86 uint8_t tmpAddr=0,tmpReadData=0;
87 uint16_t i=0;
88
89 I2C_Read(0, &tmpAddr, 1);
90 if(tmpAddr>=(256-WRITE_LENGTH))
91 {
92 tmpAddr=0;
93 }
94 tmpAddr+=WRITE_LENGTH;
95 I2C_Write(0, &tmpAddr, 1);
96
97 tmpWriteData[0]+=tmpAddr;
98 for(i=0;i<(WRITE_LENGTH-1);i++)
99 {
100 // HAL_IWDG_Refresh(&hiwdg);
101 tmpWriteData[i+1]=tmpWriteData[i]+1;
102 }
103 I2C_Write(tmpAddr, tmpWriteData, WRITE_LENGTH);
104
105 for(i=0;i<(tmpAddr+WRITE_LENGTH);i++)
106 {
107 // HAL_IWDG_Refresh(&hiwdg);
108 I2C_Read(i, &tmpReadData, 1);
109 printf("%d ", tmpReadData);
110 }
111 printf("\n\n");
112
113 // I2C_Read(tmpAddr, tmpBuf+2, WRITE_LENGTH); //tmpBuf can be a pointer like a aarry
114 }
115
116
121 //void HAL_I2C_MspInit(I2C_HandleTypeDef* hi2c)
122 //{
123 // GPIO_InitTypeDef GPIO_InitStruct = {0};
124 // if(hi2c->Instance==I2C1)
125 // {
126 // /* USER CODE BEGIN I2C1_MspInit 0 */
127 // __HAL_RCC_I2C1_CLK_ENABLE();
128 // /* USER CODE END I2C1_MspInit 0 */
129 //
130 // __HAL_RCC_GPIOB_CLK_ENABLE();
131 // /**I2C1 GPIO Configuration
132 // PB6 ------> I2C1_SCL
133 // PB7 ------> I2C1_SDA
134 // */
135 // GPIO_InitStruct.Pin = GPIO_PIN_6|GPIO_PIN_7;
136 // GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
137 // GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
138 // HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
139 //
140 // /* Peripheral clock enable */
141 // //__HAL_RCC_I2C1_CLK_ENABLE();
142 // /* USER CODE BEGIN I2C1_MspInit 1 */
143 //
144 // /* USER CODE END I2C1_MspInit 1 */
145 // }
146 //
147 //}
148
149
150 #endif /* __I2C_ATY_H */
151
152 /******************************** End Of File *********************************/
WRITE_LENGTH
#define WRITE_LENGTH
Definition: I2C_ATY.h:79
I2C_Read
void I2C_Read(uint16_t addr, uint8_t *pData, uint16_t size)
Read I2C with HAL lib function.
Definition: I2C_ATY.h:49
HI2C_N
#define HI2C_N
Definition: I2C_ATY.h:38
I2C_Write
void I2C_Write(uint16_t addr, uint8_t *pData, uint16_t size)
Write I2C with HAL lib function.
Definition: I2C_ATY.h:59
I2C_Template
void I2C_Template(void)
A template to use I2C function for AT24C02.
Definition: I2C_ATY.h:83


ATYSTMLIB_HAL: INCLUDE_ATY.h Source File

INCLUDE_ATY.h
Go to the documentation of this file.
1
26 #ifndef __INCLUDE_ATY_H
27 #define __INCLUDE_ATY_H
28
29
30 #include "stdio.h"
31 //#include "GPIO_ATY.h"
32 //#include "TIMER_ATY.h"
33 //#include "UART_ATY.h"
34 //#include "I2C_ATY.h"
35 //#include "RTC_ATY.h"
36 //#include "PID_ATY.h"
37 //#include "CRC_ATY.h"
38 //#include "FILTER_ATY.h"
39 //#include "NXP74HC165_ATY.h"
40
41
42 #endif /* __INCLUDE_ATY_H */
43
44 /******************************** End Of File *********************************/


ATYSTMLIB_HAL: NXP74HC165_ATY.h Source File

NXP74HC165_ATY.h
Go to the documentation of this file.
1
34 #ifndef __NXP74HC165_ATY_H
35 #define __NXP74HC165_ATY_H
36
37 #include "stm32f1xx_hal.h"
38
39 /******************************* For user *************************************/
40
41 /******************************************************************************/
42
43
57 uint32_t NXP74HC165_Get(uint32_t size,
58 GPIO_TypeDef *NXP74HC165_CLK_Port, uint16_t NXP74HC165_CLK_Pin,
59 GPIO_TypeDef *NXP74HC165_SH_Port, uint16_t NXP74HC165_SH_Pin,
60 GPIO_TypeDef *NXP74HC165_DATA_Port, uint16_t NXP74HC165_DATA_Pin)
61 {
62 uint32_t scanValue=0,i_NXP74HC165_Get=0;
63
64 HAL_GPIO_WritePin(NXP74HC165_CLK_Port, NXP74HC165_CLK_Pin, GPIO_PIN_SET);
65 HAL_GPIO_WritePin(NXP74HC165_SH_Port, NXP74HC165_SH_Pin, GPIO_PIN_RESET); //Start read
66 HAL_GPIO_WritePin(NXP74HC165_SH_Port, NXP74HC165_SH_Pin, GPIO_PIN_SET); //Stop read
67
68 for(i_NXP74HC165_Get=0; i_NXP74HC165_Get<size; i_NXP74HC165_Get++)
69 {
70 scanValue = scanValue << 1;
71 if(HAL_GPIO_ReadPin(NXP74HC165_DATA_Port, NXP74HC165_DATA_Pin) == GPIO_PIN_SET)
72 scanValue |= 0x01;
73 HAL_GPIO_WritePin(NXP74HC165_CLK_Port, NXP74HC165_CLK_Pin, GPIO_PIN_RESET);
74 __nop();
75 HAL_GPIO_WritePin(NXP74HC165_CLK_Port, NXP74HC165_CLK_Pin, GPIO_PIN_SET);
76 }
77 HAL_GPIO_WritePin(NXP74HC165_CLK_Port, NXP74HC165_CLK_Pin, GPIO_PIN_RESET);
78
79 return scanValue;
80 }
81
82 #endif /* __NXP74HC165_ATY_H */
83
84 /******************************** End Of File *********************************/
NXP74HC165_Get
uint32_t NXP74HC165_Get(uint32_t size, GPIO_TypeDef *NXP74HC165_CLK_Port, uint16_t NXP74HC165_CLK_Pin, GPIO_TypeDef *NXP74HC165_SH_Port, uint16_t NXP74HC165_SH_Pin, GPIO_TypeDef *NXP74HC165_DATA_Port, uint16_t NXP74HC165_DATA_Pin)
Get value of NXP74HC165.
Definition: NXP74HC165_ATY.h:57


ATYSTMLIB_HAL: PID_ATY.h Source File

PID_ATY.h
Go to the documentation of this file.
1
34 #ifndef __PID_ATY_H
35 #define __PID_ATY_H
36
37 #include "stm32f1xx_hal.h"
38 #include "string.h"
39
40
41 /******************************* For user *************************************/
42 /******************************************************************************/
43
44
45 double pidSetNum=0,pidCurNum=0;
46
47 typedef struct PID{
48 double SetPoint; //Set point desired value
49 double Proportion; //Proportional const
50 double Integral; //Integral const
51 double Derivative; //Derivative const
52 double LastError; //Error[-1]
53 double PrevError; //Error[-2]
54 double SumError; //Sums of errors
55 }PID;
56
63 double PidCalc(PID *pidStruct, double nextPoint)
64 {
65 double dError,Error;
66 Error=pidStruct->SetPoint-nextPoint; //Deviation
67 pidStruct->SumError+=Error; //Integral
68 dError=pidStruct->LastError-pidStruct->PrevError; //Current differential
69 pidStruct->PrevError=pidStruct->LastError;
70 pidStruct->LastError=Error;
71 return (pidStruct->Proportion *Error //Proportional
72 +pidStruct->Integral *pidStruct->SumError //Integral item
73 +pidStruct->Derivative *dError ); //Differential item
74 }
75
80 void PidInit (PID *pidStruct)
81 {
82 memset(pidStruct, 0, sizeof(PID));
83 }
84
90 void Actuator(double rDelta)
91 {
92 pidCurNum+=rDelta;
93 }
94
98 void PidControl(void)
99 {
100 PID sPID[2]; //PID Control Struct
101 double rOut[2]; //PID Response (Output)
102 double rIn[2]; //PID Feedback (Input)
103 uint8_t i=0;
104
105 PidInit(&sPID[0]); //Initialize Struct
106 sPID[0].Proportion=0.5; //Set PID Coefficients
107 sPID[0].Integral=0.5;
108 sPID[0].Derivative=0;
109 sPID[0].SetPoint=pidSetNum; //Set PID Setpoint (Goal)
110
111 while(1) //Better torite in timer interrupt call back function
112 { //Mock Up of PID processing
113 if(i>50)
114 {
115 i=0;
116 pidSetNum+=10;
117 if(pidSetNum>100)
118 pidSetNum=0;
119 }
120 i++;
121
122 sPID[0].SetPoint=pidSetNum;
123
124 rIn[0]=pidCurNum; //Reads the input variable function (Read Input )
125 rOut[0]=PidCalc(&sPID[0], rIn[0]); //PID calculation function (Perform PID Interation)
126 Actuator(rOut[0]); //Output variable control function (Effect Needed Changes)
127
128 // printf("In: %f\nOut: %f\nPidCur: %f\n\n", rIn[0], rOut[0], pidCurNum);
129 printf("%f\n", pidCurNum);
130
131 HAL_Delay(100);
132 }
133 }
134
135
136 #endif /* __PID_ATY_H */
137
138 /******************************** End Of File *********************************/
pidCurNum
double pidCurNum
Definition: PID_ATY.h:45
PID::Integral
double Integral
Definition: PID_ATY.h:50
PID::Derivative
double Derivative
Definition: PID_ATY.h:51
PidControl
void PidControl(void)
Pid control.
Definition: PID_ATY.h:98
PidCalc
double PidCalc(PID *pidStruct, double nextPoint)
Calculate rOut.
Definition: PID_ATY.h:63
Actuator
void Actuator(double rDelta)
Calculate pidCurNum.
Definition: PID_ATY.h:90
PID::SumError
double SumError
Definition: PID_ATY.h:54
pidSetNum
double pidSetNum
Definition: PID_ATY.h:45
PID
Definition: PID_ATY.h:47
PID::LastError
double LastError
Definition: PID_ATY.h:52
PID
struct PID PID
PID::PrevError
double PrevError
Definition: PID_ATY.h:53
PID::Proportion
double Proportion
Definition: PID_ATY.h:49
PID::SetPoint
double SetPoint
Definition: PID_ATY.h:48
PidInit
void PidInit(PID *pidStruct)
Init pid.
Definition: PID_ATY.h:80


ATYSTMLIB_HAL: RTC_ATY.h Source File

RTC_ATY.h
Go to the documentation of this file.
1
37 #ifndef __RTC_ATY_H
38 #define __RTC_ATY_H
39
40 #include "stm32f1xx_hal.h"
41 #include "time.h"
42
43
44 /******************************* For user *************************************/
45 #define RTC_N hrtc
46 // #define SET_IN_UART
47 /******************************************************************************/
48
49
50 extern RTC_HandleTypeDef RTC_N;
51 RTC_DateTypeDef rtcDateStructure;
52 RTC_TimeTypeDef rtcTimeStructure;
53
57 void RTC_Init(void)
58 {
59 rtcDateStructure.Year=20;
60 rtcDateStructure.Month=3;
61 rtcDateStructure.Date=16;
62 rtcTimeStructure.Hours=17;
63 rtcTimeStructure.Minutes=12;
64 rtcTimeStructure.Seconds=00;
65 HAL_RTC_SetDate(&RTC_N, &rtcDateStructure, RTC_FORMAT_BIN);
66 HAL_RTC_SetTime(&RTC_N, &rtcTimeStructure, RTC_FORMAT_BIN);
67 }
68
78 void RTC_Set(uint8_t year, uint8_t month, uint8_t date,
79 uint8_t hours, uint8_t minutes, uint8_t seconds)
80 {
81 rtcDateStructure.Year=year;
82 rtcDateStructure.Month=month;
83 rtcDateStructure.Date=date;
84 rtcTimeStructure.Hours=hours;
85 rtcTimeStructure.Minutes=minutes;
86 rtcTimeStructure.Seconds=seconds;
87 HAL_RTC_SetDate(&RTC_N, &rtcDateStructure, RTC_FORMAT_BIN);
88 HAL_RTC_SetTime(&RTC_N, &rtcTimeStructure, RTC_FORMAT_BIN);
89 }
90
100 uint8_t IsLeapYear(uint16_t year)
101 {
102 if(year%4==0)
103 {
104 if(year%100==0)
105 {
106 /*- It has to be divisible by 400 if the year end with 00 */
107 if(year%400==0)
108 {
109 return 1;
110 }
111 else
112 {
113 return 0;
114 }
115 }
116 else
117 {
118 return 1;
119 }
120 }
121 else
122 {
123 return 0;
124 }
125 }
126
127
134 uint32_t RTC_FormatToUnix32(uint8_t show)
135 {
136 uint32_t unixTime;
137 struct tm stmT;
138
139 HAL_RTC_GetTime(&hrtc, &rtcTimeStructure, RTC_FORMAT_BIN);
140 HAL_RTC_GetDate(&hrtc, &rtcDateStructure, RTC_FORMAT_BIN);
141
142 stmT.tm_year=rtcDateStructure.Year+100;
143 stmT.tm_mon=rtcDateStructure.Month-1;
144 stmT.tm_mday=rtcDateStructure.Date;
145 stmT.tm_hour=rtcTimeStructure.Hours-8;
146 stmT.tm_min=rtcTimeStructure.Minutes;
147 stmT.tm_sec=rtcTimeStructure.Seconds;
148
149 unixTime=mktime(&stmT);
150 if(show)
151 {
152 printf("UTC:%d\n",unixTime);
153 }
154 return unixTime;
155 }
156
162 void RTC_Unix32ToFormat(uint32_t unixTime, uint8_t show)
163 {
164 struct tm *stmU;
165
166 stmU=localtime(&unixTime);
167
168 rtcDateStructure.Year=stmU->tm_year-100;
169 rtcDateStructure.Month=stmU->tm_mon+1;
170 rtcDateStructure.Date=stmU->tm_mday;
171 rtcTimeStructure.Hours=stmU->tm_hour+8;
172 rtcTimeStructure.Minutes=stmU->tm_min;
173 rtcTimeStructure.Seconds=stmU->tm_sec;
174
175 HAL_RTC_SetDate(&hrtc, &rtcDateStructure, RTC_FORMAT_BIN);
176 HAL_RTC_SetTime(&hrtc, &rtcTimeStructure, RTC_FORMAT_BIN);
177
178 if(show)
179 {
180 printf("%02d/%02d/%02d\n", 2000+rtcDateStructure.Year, rtcDateStructure.Month, rtcDateStructure.Date);
181 printf("%02d:%02d:%02d\n\n", rtcTimeStructure.Hours, rtcTimeStructure.Minutes, rtcTimeStructure.Seconds);
182 }
183 }
184
185 uint8_t dateTimeShow[6]={0};
191 void RTC_GetShow(uint8_t show)
192 {
193 HAL_RTC_GetTime(&RTC_N, &rtcTimeStructure, RTC_FORMAT_BIN);
194 HAL_RTC_GetDate(&RTC_N, &rtcDateStructure, RTC_FORMAT_BIN);
195
196 if(show)
197 {
198 dateTimeShow[0]=RTC_FormatToUnix32(0)>>24;
199 dateTimeShow[1]=RTC_FormatToUnix32(0)>>16;
200 dateTimeShow[2]=RTC_FormatToUnix32(0)>>8;
201 dateTimeShow[3]=RTC_FormatToUnix32(0);
202 dateTimeShow[4]=0x00;
203 dateTimeShow[5]=0x00;
204 // dateTimeShow[0]=rtcDateStructure.Year;
205 // dateTimeShow[1]=rtcDateStructure.Month;
206 // dateTimeShow[2]=rtcDateStructure.Date;
207 // dateTimeShow[3]=rtcTimeStructure.Hours;
208 // dateTimeShow[4]=rtcTimeStructure.Minutes;
209 // dateTimeShow[5]=rtcTimeStructure.Seconds;
210 // /* Display date Format : yy-mm-dd */
211 printf("\n%02d-%02d-%02d\n",2000+rtcDateStructure.Year,
212 rtcDateStructure.Month,
213 rtcDateStructure.Date);
214 // /* Display time Format : hh:mm:ss */
215 printf("%02d:%02d:%02d\n",rtcTimeStructure.Hours,
216 rtcTimeStructure.Minutes,
217 rtcTimeStructure.Seconds);
218 }
219 }
220
226 void RTC_GetShowHex(uint8_t show)
227 {
228 uint32_t dateHex=0,timeHex=0;
229
230 HAL_RTC_GetTime(&RTC_N, &rtcTimeStructure, RTC_FORMAT_BIN);
231 HAL_RTC_GetDate(&RTC_N, &rtcDateStructure, RTC_FORMAT_BIN);
232
233 timeHex=(rtcTimeStructure.Hours<<16)+(rtcTimeStructure.Minutes<<8)+rtcTimeStructure.Seconds;
234 dateHex=(rtcDateStructure.Year<<16)+(rtcDateStructure.Month<<8)+rtcDateStructure.Date;
235
236 if(show)
237 {
238 printf("\n%08x\n",dateHex);
239 printf("%08x\n",timeHex);
240 }
241 }
242
243 void RTC_GetShowUnix32(uint8_t show)
244 {
245
246 }
247
248 #ifdef SET_IN_UART
249
253 void RTC_SetInUart(void)
254 {
255 if(uart1GetCount >0)
256 {
257 rtcDateStructure.Year=((uart1GetStr[0]-48)*10)+(uart1GetStr[1]-48);
258 rtcDateStructure.Month=((uart1GetStr[2]-48)*10)+(uart1GetStr[3]-48);
259 rtcDateStructure.Date=((uart1GetStr[4]-48)*10)+(uart1GetStr[5]-48);
260 rtcTimeStructure.Hours=((uart1GetStr[6]-48)*10)+(uart1GetStr[7]-48);
261 rtcTimeStructure.Minutes=((uart1GetStr[8]-48)*10)+(uart1GetStr[9]-48);
262 rtcTimeStructure.Seconds=((uart1GetStr[10]-48)*10)+(uart1GetStr[11]-48);
263 HAL_RTC_SetTime(&RTC_N, &rtcTimeStructure, RTC_FORMAT_BIN);
264 HAL_RTC_SetDate(&RTC_N, &rtcDateStructure, RTC_FORMAT_BIN);
265 memset(uart1GetStr, 0, sizeof(uart1GetStr));
266 uart1GetCount=0;
267 }
268 }
269 #endif /* SET_IN_UART */
270
271
272 #endif /* __RTC_ATY_H */
273
274 /******************************** End Of File *********************************/
uart1GetCount
uint8_t uart1GetCount
Definition: UART_ATY.h:91
IsLeapYear
uint8_t IsLeapYear(uint16_t year)
Determine if it's a leap year.
Definition: RTC_ATY.h:100
RTC_N
#define RTC_N
Definition: RTC_ATY.h:45
RTC_GetShow
void RTC_GetShow(uint8_t show)
Get rtc date time and print to uart.
Definition: RTC_ATY.h:191
RTC_FormatToUnix32
uint32_t RTC_FormatToUnix32(uint8_t show)
Get rtc date time and convert to unix.
Definition: RTC_ATY.h:134
RTC_Unix32ToFormat
void RTC_Unix32ToFormat(uint32_t unixTime, uint8_t show)
Detect whether the key is pressed and how to press.
Definition: RTC_ATY.h:162
rtcDateStructure
RTC_DateTypeDef rtcDateStructure
Definition: RTC_ATY.h:51
RTC_Init
void RTC_Init(void)
Init rtc date and time.
Definition: RTC_ATY.h:57
dateTimeShow
uint8_t dateTimeShow[6]
Definition: RTC_ATY.h:185
uart1GetStr
uint8_t uart1GetStr[UART1_GET_SIZE]
Definition: UART_ATY.h:92
RTC_Set
void RTC_Set(uint8_t year, uint8_t month, uint8_t date, uint8_t hours, uint8_t minutes, uint8_t seconds)
Set rtc date and time.
Definition: RTC_ATY.h:78
RTC_GetShowHex
void RTC_GetShowHex(uint8_t show)
Get rtc date time and print to uart in hexadecimal.
Definition: RTC_ATY.h:226
RTC_GetShowUnix32
void RTC_GetShowUnix32(uint8_t show)
Definition: RTC_ATY.h:243
rtcTimeStructure
RTC_TimeTypeDef rtcTimeStructure
Definition: RTC_ATY.h:52


ATYSTMLIB_HAL: TIMER_ATY.h Source File

TIMER_ATY.h
Go to the documentation of this file.
1
42 #ifndef __TIMER_ATY_H
43 #define __TIMER_ATY_H
44
45 #include "stm32f1xx_hal.h"
46
47
48 /******************************* For user *************************************/
49 //#define SYS_ATY
50 //#define HAL_ATY
51 #define TIM_ATY
52 #define HTIM_N htim2
53 //#define RTC_ATY
54 //#define HRTC_N hrtc
55
56 //#define TEST_ATY
57 /******************************************************************************/
58
59
60 /****************************** Use SysTick ***********************************/
61 #ifdef SYS_ATY
62 #define F0_BASE_NUM_SYS 6
63 #define F1_BASE_NUM_SYS 9
64 #define BASE_NUM_SYS F1_BASE_NUM_SYS
65
72 void delay_us(uint32_t us)
73 {
74 uint32_t temp;
75 SysTick->LOAD=BASE_NUM_SYS*us;
76 SysTick->VAL=0X00;
77 SysTick->CTRL=0X01;
78 do
79 {
80 temp=SysTick->CTRL;
81 }while((temp&0x01)&&(!(temp&(1<<16))));
82
83 SysTick->CTRL=0x00;
84 SysTick->VAL=0X00;
85 }
90 void delay_ms(uint16_t ms)
91 {
92 uint32_t temp;
93 SysTick->LOAD=BASE_NUM_SYS*1000*ms;
94 SysTick->VAL=0X00;
95 SysTick->CTRL=0X01;
96 do
97 {
98 temp=SysTick->CTRL;
99 }while((temp&0x01)&&(!(temp&(1<<16))));
100
101 SysTick->CTRL=0x00;
102 SysTick->VAL=0X00;
103 }
108 void delay_s(uint32_t s)
109 {
110 for(;s>0;s--)
111 {
112 delay_ms(1000);
113 }
114 }
115 #endif /* SYS_ATY */
116
117
118 /**************************** Change Hal_Delay() ******************************/
119 #ifdef HAL_ATY
120
124 void delay_us(uint32_t us)
125 {
126 HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000000);
127 HAL_Delay(us);
128 }
134 void delay_ms(uint16_t ms)
135 {
136 HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000);
137 HAL_Delay(ms);
138 }
143 void delay_s(uint32_t s)
144 {
145 for(;s>0;s--)
146 {
147 delay_ms(1000);
148 }
149 }
150
151 #endif /* HAL_ATY */
152
153
154 /********************************* Use Timer **********************************/
155 #ifdef TIM_ATY
156 extern TIM_HandleTypeDef HTIM_N;
168 void delay_us(uint16_t us)
169 {
170 uint16_t timerCounter=0xffff-us-5;
171 HAL_TIM_Base_Start(&HTIM_N);
172 __HAL_TIM_SET_COUNTER(&HTIM_N,timerCounter);
173 while(timerCounter<0xffff-5)
174 {
175 timerCounter=__HAL_TIM_GET_COUNTER(&HTIM_N);
176 }
177 HAL_TIM_Base_Stop(&HTIM_N);
178 }
183 void delay_ms(uint32_t ms)
184 {
185 for(;ms>0;ms--)
186 {
187 delay_us(1000);
188 }
189 }
194 void delay_s(uint32_t s)
195 {
196 for(;s>0;s--)
197 {
198 delay_ms(1000);
199 }
200 }
201 #endif /* TIM_ATY */
202
203
204 /********************************* Use RTC ************************************/
205 #ifdef RTC_ATY
206 extern RTC_HandleTypeDef HRTC_N;
211 uint32_t RTC_ReadTimeCounter(RTC_HandleTypeDef *hrtc)
212 {
213 uint16_t highFirst=0U,low=0U,highSecond=0U;
214 uint32_t timeCounter=0U;
215 highFirst=READ_REG(hrtc->Instance->CNTH & RTC_CNTH_RTC_CNT);
216 low=READ_REG(hrtc->Instance->CNTL & RTC_CNTL_RTC_CNT);
217 highSecond=READ_REG(hrtc->Instance->CNTH & RTC_CNTH_RTC_CNT);
218
219 if(highFirst!=highSecond)
220 {
221 /*- In this case the counter roll over during reading of CNTL and CNTH registers,
222 read again CNTL register then return the counter value */
223 timeCounter=(((uint32_t)highSecond<<16U) |
224 READ_REG(hrtc->Instance->CNTL & RTC_CNTL_RTC_CNT));
225 }
226 else
227 {
228 /*- No counter roll over during reading of CNTL and CNTH registers,
229 counter value is equal to first value of CNTL and CNTH */
230 timeCounter=(((uint32_t)highFirst<<16U) | low);
231 }
232
233 return timeCounter;
234 }
235
239 void delay_us(void){}
243 void delay_ms(void){}
244
252 void delay_s(uint32_t s)
253 {
254 s+=RTC_ReadTimeCounter(&HRTC_N);
255 while(s>RTC_ReadTimeCounter(&HRTC_N)){}
256 }
257 #endif /* RTC_ATY */
258
259 #ifdef TEST_ATY
260
264 void delayTest(void)
265 {
266 HAL_GPIO_TogglePin(HeartbeatLedPort, HeartbeatLedPin);
267 delay_ms(1000);
268 HAL_GPIO_TogglePin(HeartbeatLedPort, HeartbeatLedPin);
269 for(i_ATY=0;i_ATY<1000;i_ATY++)
270 delay_us(1000);
271 HAL_GPIO_TogglePin(HeartbeatLedPort, HeartbeatLedPin);
272 delay_s(5);
273
274 }
275 #endif /* TEST_ATY */
276
277 #endif /* __TIMER_ATY_H */
278
279 /******************************** End Of File *********************************/
delay_us
void delay_us(uint16_t us)
Delay n us with TimerN.
Definition: TIMER_ATY.h:168
HTIM_N
#define HTIM_N
Definition: TIMER_ATY.h:52
HeartbeatLedPin
#define HeartbeatLedPin
Definition: GPIO_ATY.h:53
delay_s
void delay_s(uint32_t s)
Delay n s with TimerN.
Definition: TIMER_ATY.h:194
delay_ms
void delay_ms(uint32_t ms)
Delay n ms with TimerN.
Definition: TIMER_ATY.h:183
HeartbeatLedPort
#define HeartbeatLedPort
You can define GPIO read&write function with your MCU type.
Definition: GPIO_ATY.h:52


ATYSTMLIB_HAL: UART_ATY.h Source File

UART_ATY.h
Go to the documentation of this file.
1
48 #ifndef __UART_ATY_H
49 #define __UART_ATY_H
50
51 #include "stm32f1xx_hal.h"
52 #include "stdio.h" //For "FILE"
53 #include "string.h" //For memset etc.
54
55
56 /******************************* For user *************************************/
57 // #define TEST_IT_ATY
58 // #define TEST_DMA_ATY
59
60 //#define HUART_N huart2 //For printf();
61
62 #define UART1_NIT_ATY
63 // #define UART1_DMA_ATY
64 #define UART1_GET_SIZE 4
65 #define UART1_SEND_SIZE 8
66
67 #define UART2_NIT_ATY
68 // #define UART2_DMA_ATY
69 #define UART2_GET_SIZE 11
70 #define UART2_SEND_SIZE 8
71
72 #define UART3_NIT_ATY
73 // #define UART3_DMA_ATY
74 #define UART3_GET_SIZE 13
75 #define UART3_SEND_SIZE 255
76
77 // #define UART4_NIT_ATY
78 // #define UART4_DMA_ATY
79 // #define UART4_GET_SIZE 8
80 // #define UART4_SEND_SIZE 8
81
82 // #define UART5_NIT_ATY
83 // #define UART5_DMA_ATY
84 // #define UART5_GET_SIZE 8
85 // #define UART5_SEND_SIZE 8
86 /******************************************************************************/
87
88
89 #ifdef UART1_NIT_ATY
90 uint8_t uart1GetByte=0;
91 uint8_t uart1GetCount=0;
92 uint8_t uart1GetStr[UART1_GET_SIZE];
93 uint8_t uart1SendStr[UART1_SEND_SIZE];
94 #endif /* UART1_NIT_ATY */
95
96 #ifdef UART2_NIT_ATY
97 uint8_t uart2GetByte=0;
98 uint8_t uart2GetCount=0;
99 uint8_t uart2GetStr[UART2_GET_SIZE];
100 uint8_t uart2SendStr[UART2_SEND_SIZE];
101 #endif /* UART2_NIT_ATY */
102
103 #ifdef UART3_NIT_ATY
104 uint8_t uart3GetByte=0;
105 uint8_t uart3GetCount=0;
106 uint8_t uart3GetStr[UART3_GET_SIZE];
107 uint8_t uart3SendStr[UART3_SEND_SIZE];
108 #endif /* UART3_NIT_ATY */
109
110 #ifdef UART4_NIT_ATY
111 uint8_t uart4GetByte=0;
112 uint8_t uart4GetCount=0;
113 uint8_t uart4GetStr[UART4_GET_SIZE];
114 uint8_t uart4SendStr[UART4_SEND_SIZE];
115 #endif /* UART4_NIT_ATY */
116
117 #ifdef UART5_NIT_ATY
118 uint8_t uart5GetByte=0;
119 uint8_t uart5GetCount=0;
120 uint8_t uart5GetStr[UART5_GET_SIZE];
121 uint8_t uart5SendStr[UART5_SEND_SIZE];
122 #endif /* UART5_NIT_ATY */
123
124
125 #ifdef UART1_DMA_ATY
126 uint8_t uart1GetByte=0;
127 uint8_t uart1GetCount=0;
128 uint8_t uart1GetStr[UART1_GET_SIZE];
129 uint8_t uart1SendStr[UART1_SEND_SIZE];
130 uint16_t uart1DmaSendFlag=0;
131 volatile uint8_t uart1RecvEndFlag=0;
132 static __IO ITStatus uart1Ready=RESET;
133 extern DMA_HandleTypeDef hdma_usart1_rx;
134 #endif /* UART1_DMA_ATY */
135
136
137 #ifdef UART2_DMA_ATY
138 uint8_t uart2GetByte=0;
139 uint8_t uart2GetCount=0;
140 uint8_t uart2GetStr[UART2_GET_SIZE];
141 uint8_t uart2SendStr[UART2_SEND_SIZE];
142 uint16_t uart2DmaSendFlag=0;
143 volatile uint8_t uart2RecvEndFlag=0;
144 static __IO ITStatus uart2Ready=RESET;
145 extern DMA_HandleTypeDef hdma_usart2_rx;
146 #endif /* UART2_DMA_ATY */
147
148
149 #ifdef UART3_DMA_ATY
150 uint8_t uart3GetByte=0;
151 uint8_t uart3GetCount=0;
152 uint8_t uart3GetStr[UART3_GET_SIZE];
153 uint8_t uart3SendStr[UART3_SEND_SIZE];
154 uint16_t uart3DmaSendFlag=0;
155 volatile uint8_t uart3RecvEndFlag=0;
156 static __IO ITStatus uart3Ready=RESET;
157 extern DMA_HandleTypeDef hdma_usart3_rx;
158 #endif /* UART3_DMA_ATY */
159
160
161 #ifdef UART4_DMA_ATY
162 uint8_t uart4GetByte=0;
163 uint8_t uart4GetCount=0;
164 uint8_t uart4GetStr[UART4_GET_SIZE];
165 uint8_t uart4SendStr[UART4_SEND_SIZE];
166 uint16_t uart4DmaSendFlag=0;
167 volatile uint8_t uart4RecvEndFlag=0;
168 static __IO ITStatus uart4Ready=RESET;
169 extern DMA_HandleTypeDef hdma_usart4_rx;
170 #endif /* UART4_DMA_ATY */
171
172
173 #ifdef UART5_DMA_ATY
174 uint8_t uart5GetByte=0;
175 uint8_t uart5GetCount=0;
176 uint8_t uart5GetStr[UART5_GET_SIZE];
177 uint8_t uart5SendStr[UART5_SEND_SIZE];
178 uint16_t uart5DmaSendFlag=0;
179 volatile uint8_t uart5RecvEndFlag=0;
180 static __IO ITStatus uart5Ready=RESET;
181 extern DMA_HandleTypeDef hdma_usart5_rx;
182 #endif /* UART5_DMA_ATY */
183
184
188 //extern UART_HandleTypeDef HUART_N;
189 //int fputc(int ch, FILE *f)
190 //{
191 // HAL_UART_Transmit(&HUART_N, (uint8_t*)&ch, 1, 1000);
192 // return ch;
193 //}
194
195
199 void UartInit_ATY(void)
200 {
201 #ifdef UART1_NIT_ATY
202 HAL_UART_Receive_IT(&huart1, &uart1GetByte, 1);
203 #endif /* UART1_NIT_ATY */
204
205 #ifdef UART2_NIT_ATY
206 HAL_UART_Receive_IT(&huart2, &uart2GetByte, 1);
207 #endif /* UART2_NIT_ATY */
208
209 #ifdef UART3_NIT_ATY
210 HAL_UART_Receive_IT(&huart3, &uart3GetByte, 1);
211 #endif /* UART3_NIT_ATY */
212
213 #ifdef UART4_NIT_ATY
214 HAL_UART_Receive_IT(&huart4, &uart4GetByte, 1);
215 #endif /* UART4_NIT_ATY */
216
217 #ifdef UART5_NIT_ATY
218 HAL_UART_Receive_IT(&huart5, &uart5GetByte, 1);
219 #endif /* UART5_NIT_ATY */
220
221
222 #ifdef UART1_DMA_ATY
223 __HAL_UART_ENABLE_IT(&huart1, UART_IT_IDLE);
224 HAL_UART_Receive_DMA(&huart1, uart1GetStr, UART1_GET_SIZE);
225 #endif /* UART1_DMA_ATY */
226
227 #ifdef UART2_DMA_ATY
228 __HAL_UART_ENABLE_IT(&huart2, UART_IT_IDLE);
229 HAL_UART_Receive_DMA(&huart2, uart2GetStr, UART2_GET_SIZE);
230 #endif /* UART2_DMA_ATY */
231
232 #ifdef UART3_DMA_ATY
233 __HAL_UART_ENABLE_IT(&huart3, UART_IT_IDLE);
234 HAL_UART_Receive_DMA(&huart3, uart3GetStr, UART3_GET_SIZE);
235 #endif /* UART3_DMA_ATY */
236
237 #ifdef UART4_DMA_ATY
238 __HAL_UART_ENABLE_IT(&huart4, UART_IT_IDLE);
239 HAL_UART_Receive_DMA(&huart4, uart4GetStr, UART4_GET_SIZE);
240 #endif /* UART4_DMA_ATY */
241
242 #ifdef UART5_DMA_ATY
243 __HAL_UART_ENABLE_IT(&huart5, UART_IT_IDLE);
244 HAL_UART_Receive_DMA(&huart5, uart5GetStr, UART5_GET_SIZE);
245 #endif /* UART5_DMA_ATY */
246 }
247
248 /******************************* Normal IT Type *******************************/
249 #ifdef UART1_NIT_ATY
250
255 void Uart1Send(uint8_t *pData, uint16_t Size)
256 {
257 HAL_UART_Transmit_IT(&huart1, (uint8_t*)pData, Size);
258 }
262 void Uart1Recv(void)
263 {
264 if(uart1GetCount<UART1_GET_SIZE)
265 {
266 uart1GetStr[uart1GetCount++]=uart1GetByte;
267 }
268 else
269 {
270 uart1GetCount=0;
271 }
272 while(HAL_UART_Receive_IT(&huart1, &uart1GetByte, 1)==HAL_OK);
273 }
274 #endif /* UART1_NIT_ATY */
275
276
277 #ifdef UART2_NIT_ATY
278
283 void Uart2Send(uint8_t *pData, uint16_t Size)
284 {
285 HAL_UART_Transmit_IT(&huart2, (uint8_t*)pData, Size);
286 }
290 void Uart2Recv(void)
291 {
292 if(uart2GetCount<UART2_GET_SIZE)
293 {
294 uart2GetStr[uart2GetCount++]=uart2GetByte;
295 }
296 else
297 {
298 uart2GetCount=0;
299 }
300 while(HAL_UART_Receive_IT(&huart2, &uart2GetByte, 1)==HAL_OK);
301 }
302 #endif /* UART2_NIT_ATY */
303
304
305 #ifdef UART3_NIT_ATY
306
311 void Uart3Send(uint8_t *pData, uint16_t Size)
312 {
313 HAL_UART_Transmit_IT(&huart3, (uint8_t*)pData, Size);
314 }
318 void Uart3Recv(void)
319 {
320 if(uart3GetCount<UART3_GET_SIZE)
321 {
322 uart3GetStr[uart3GetCount++]=uart3GetByte;
323 }
324 else
325 {
326 uart3GetCount=0;
327 }
328 while(HAL_UART_Receive_IT(&huart3, &uart3GetByte, 1)==HAL_OK);
329 }
330 #endif /* UART3_NIT_ATY */
331
332
333 #ifdef UART4_NIT_ATY
334
339 void Uart4Send(uint8_t *pData, uint16_t Size)
340 {
341 HAL_UART_Transmit_IT(&huart4, (uint8_t*)pData, Size);
342 }
346 void Uart4Recv(void)
347 {
348 if(uart4GetCount<UART4_GET_SIZE)
349 {
350 uart4GetStr[uart4GetCount++]=uart4GetByte;
351 }
352 else
353 {
354 uart4GetCount=0;
355 }
356 while(HAL_UART_Receive_IT(&huart4, &uart4GetByte, 1)==HAL_OK);
357 }
358 #endif /* UART4_NIT_ATY */
359
360
361 #ifdef UART5_NIT_ATY
362
367 void Uart5Send(uint8_t *pData, uint16_t Size)
368 {
369 HAL_UART_Transmit_IT(&huart5, (uint8_t*)pData, Size);
370 }
374 void Uart5Recv(void)
375 {
376 if(uart5GetCount<UART5_GET_SIZE)
377 {
378 uart5GetStr[uart5GetCount++]=uart5GetByte;
379 }
380 else
381 {
382 uart5GetCount=0;
383 }
384 while(HAL_UART_Receive_IT(&huart5, &uart5GetByte, 1)==HAL_OK);
385 }
386 #endif /* UART5_NIT_ATY */
387
388
389 #if defined(UART1_NIT_ATY) \
390 || defined(UART2_NIT_ATY) \
391 || defined(UART3_NIT_ATY) \
392 || defined(UART4_NIT_ATY) \
393 || defined(UART5_NIT_ATY)
394
398 void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
399 {
400 #ifdef UART1_NIT_ATY
401 if(huart==&huart1)
402 {
403 Uart1Recv();
404 }
405 #endif /* UART1_NIT_ATY */
406
407 #ifdef UART2_NIT_ATY
408 if(huart==&huart2)
409 {
410 Uart2Recv();
411 }
412 #endif /* UART2_NIT_ATY */
413
414 #ifdef UART3_NIT_ATY
415 if(huart==&huart3)
416 {
417 Uart3Recv();
418 }
419 #endif /* UART3_NIT_ATY */
420
421 #ifdef UART4_NIT_ATY
422 if(huart==&huart4)
423 {
424 Uart4Recv();
425 }
426 #endif /* UART4_NIT_ATY */
427
428 #ifdef UART5_NIT_ATY
429 if(huart==&huart5)
430 {
431 Uart5Recv();
432 }
433 #endif /* UART5_NIT_ATY */
434 }
435 #endif /* UART1-5_NIT_ATY */
436
437
438 #ifdef TEST_NIT_ATY
439
443 void UartControlTemplate(void)
444 {
445 HAL_UART_Receive_IT(&HUART_N, &uartByte, 1);
446 if(uartBufCount>0)
447 {
448 if(memcmp(uartBuf, "Hello STM32F1!", 14)==0)
449 {
450 printf("Getted! - printf\n");
451 UartSend("Getted! - send\n", 15);
452 uartBufCount=0;
453 memset(uartBuf, 0, sizeof(uartBuf));
454 }
455 }
456 }
457 #endif /* TEST_NIT_ATY */
458
459
460 /******************************** DMA IT Type *********************************/
461 #if defined(UART1_DMA_ATY) \
462 || defined(UART2_DMA_ATY) \
463 || defined(UART3_DMA_ATY) \
464 || defined(UART4_DMA_ATY) \
465 || defined(UART5_DMA_ATY)
466
470 void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart)
471 {
472 #ifdef UART1_DMA_ATY
473 if(huart==&huart1)
474 uart1Ready=SET;
475 #endif /* UART1_DMA_ATY */
476
477 #ifdef UART2_DMA_ATY
478 if(huart==&huart2)
479 uart2Ready=SET;
480 #endif /* UART2_DMA_ATY */
481
482 #ifdef UART3_DMA_ATY
483 if(huart==&huart3)
484 uart3Ready=SET;
485 #endif /* UART3_DMA_ATY */
486
487 #ifdef UART4_DMA_ATY
488 if(huart==&huart4)
489 uart4Ready=SET;
490 #endif /* UART4_DMA_ATY */
491
492 #ifdef UART5_DMA_ATY
493 if(huart==&huart5)
494 uart5Ready=SET;
495 #endif /* UART5_DMA_ATY */
496 }
501 void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
502 {
503 #ifdef UART1_DMA_ATY
504 if(huart==&huart1)
505 uart1Ready=SET;
506 #endif /* UART1_DMA_ATY */
507
508 #ifdef UART2_DMA_ATY
509 if(huart==&huart2)
510 uart2Ready=SET;
511 #endif /* UART2_DMA_ATY */
512
513 #ifdef UART3_DMA_ATY
514 if(huart==&huart3)
515 uart3Ready=SET;
516 #endif /* UART3_DMA_ATY */
517
518 #ifdef UART4_DMA_ATY
519 if(huart==&huart4)
520 uart4Ready=SET;
521 #endif /* UART4_DMA_ATY */
522
523 #ifdef UART5_DMA_ATY
524 if(huart==&huart5)
525 uart5Ready=SET;
526 #endif /* UART5_DMA_ATY */
527 }
528 #endif /* UART1-5_DMA_ATY */
529
530
531 #ifdef UART1_DMA_ATY
532
537 void Uart1SendDMA(uint8_t *pData, uint16_t Size)
538 {
539 if(HAL_UART_Transmit_DMA(&huart1, pData, Size)!=HAL_OK)
540 {
541 Error_Handler();
542 }
543 while(uart1Ready!=SET){}
544 uart1Ready=RESET;
545 uart1DmaSendFlag=0;
546 }
550 void USART1_IRQHandler(void) //\Src\stm32f1xx_it.c
551 {
552 uint32_t tmpFlag=0;
553 uint32_t temp;
554 tmpFlag=__HAL_UART_GET_FLAG(&huart1, UART_FLAG_IDLE);
555 if((tmpFlag!=RESET))
556 {
557 __HAL_UART_CLEAR_IDLEFLAG(&huart1);
558 temp=huart1.Instance->SR;
559 temp=huart1.Instance->DR;
560 HAL_UART_DMAStop(&huart1);
561 temp=hdma_usart1_rx.Instance->CNDTR;
562 uart1GetCount=UART1_GET_SIZE-temp;
563 uart1RecvEndFlag=1;
564 }
565 HAL_UART_IRQHandler(&huart1);
566 HAL_UART_Receive_DMA(&huart1, uart1GetStr, UART1_GET_SIZE);
567 }
568 #endif /* UART1_DMA_ATY */
569
570
571 #ifdef UART2_DMA_ATY
572
577 void Uart2SendDMA(uint8_t *pData, uint16_t Size)
578 {
579 if(HAL_UART_Transmit_DMA(&huart2, pData, Size)!=HAL_OK)
580 {
581 Error_Handler();
582 }
583 while(uart2Ready!=SET){}
584 uart2Ready=RESET;
585 uart2DmaSendFlag=0;
586 }
590 void USART2_IRQHandler(void) //\Src\stm32f1xx_it.c
591 {
592 uint32_t tmpFlag=0;
593 uint32_t temp;
594 tmpFlag=__HAL_UART_GET_FLAG(&huart2, UART_FLAG_IDLE);
595 if((tmpFlag!=RESET))
596 {
597 __HAL_UART_CLEAR_IDLEFLAG(&huart2);
598 temp=huart2.Instance->SR;
599 temp=huart2.Instance->DR;
600 HAL_UART_DMAStop(&huart2);
601 temp=hdma_usart2_rx.Instance->CNDTR;
602 uart2GetCount=UART2_GET_SIZE-temp;
603 uart2RecvEndFlag=1;
604 }
605 HAL_UART_IRQHandler(&huart2);
606 HAL_UART_Receive_DMA(&huart2, uart2GetStr, UART2_GET_SIZE);
607 }
608 #endif /* UART2_DMA_ATY */
609
610
611 #ifdef UART3_DMA_ATY
612
617 void Uart3SendDMA(uint8_t *pData, uint16_t Size)
618 {
619 if(HAL_UART_Transmit_DMA(&huart3, pData, Size)!=HAL_OK)
620 {
621 Error_Handler();
622 }
623 while(uart3Ready!=SET){}
624 uart3Ready=RESET;
625 uart3DmaSendFlag=0;
626 }
630 void USART3_IRQHandler(void) //\Src\stm32f1xx_it.c
631 {
632 uint32_t tmpFlag=0;
633 uint32_t temp;
634 tmpFlag=__HAL_UART_GET_FLAG(&huart3, UART_FLAG_IDLE);
635 if((tmpFlag!=RESET))
636 {
637 __HAL_UART_CLEAR_IDLEFLAG(&huart3);
638 temp=huart3.Instance->SR;
639 temp=huart3.Instance->DR;
640 HAL_UART_DMAStop(&huart3);
641 temp=hdma_usart3_rx.Instance->CNDTR;
642 uart3GetCount=UART3_GET_SIZE-temp;
643 uart3RecvEndFlag=1;
644 }
645 HAL_UART_IRQHandler(&huart3);
646 HAL_UART_Receive_DMA(&huart3, uart3GetStr, UART3_GET_SIZE);
647 }
648 #endif /* UART3_DMA_ATY */
649
650
651 #ifdef UART4_DMA_ATY
652
657 void Uart4SendDMA(uint8_t *pData, uint16_t Size)
658 {
659 if(HAL_UART_Transmit_DMA(&huart4, pData, Size)!=HAL_OK)
660 {
661 Error_Handler();
662 }
663 while(uart4Ready!=SET){}
664 uart4Ready=RESET;
665 uart4DmaSendFlag=0;
666 }
670 void USART4_IRQHandler(void) //\Src\stm32f1xx_it.c
671 {
672 uint32_t tmpFlag=0;
673 uint32_t temp;
674 tmpFlag=__HAL_UART_GET_FLAG(&huart4, UART_FLAG_IDLE);
675 if((tmpFlag!=RESET))
676 {
677 __HAL_UART_CLEAR_IDLEFLAG(&huart4);
678 temp=huart4.Instance->SR;
679 temp=huart4.Instance->DR;
680 HAL_UART_DMAStop(&huart4);
681 temp=hdma_usart4_rx.Instance->CNDTR;
682 uart4GetCount=UART4_GET_SIZE-temp;
683 uart4RecvEndFlag=1;
684 }
685 HAL_UART_IRQHandler(&huart4);
686 HAL_UART_Receive_DMA(&huart4, uart4GetStr, UART4_GET_SIZE);
687 }
688 #endif /* UART4_DMA_ATY */
689
690
691 #ifdef UART5_DMA_ATY
692
697 void Uart5SendDMA(uint8_t *pData, uint16_t Size)
698 {
699 if(HAL_UART_Transmit_DMA(&huart5, pData, Size)!=HAL_OK)
700 {
701 Error_Handler();
702 }
703 while(uart5Ready!=SET){}
704 uart5Ready=RESET;
705 uart5DmaSendFlag=0;
706 }
710 void USART5_IRQHandler(void) //\Src\stm32f1xx_it.c
711 {
712 uint32_t tmpFlag=0;
713 uint32_t temp;
714 tmpFlag=__HAL_UART_GET_FLAG(&huart5, UART_FLAG_IDLE);
715 if((tmpFlag!=RESET))
716 {
717 __HAL_UART_CLEAR_IDLEFLAG(&huart5);
718 temp=huart5.Instance->SR;
719 temp=huart5.Instance->DR;
720 HAL_UART_DMAStop(&huart5);
721 temp=hdma_usart5_rx.Instance->CNDTR;
722 uart5GetCount=UART5_GET_SIZE-temp;
723 uart5RecvEndFlag=1;
724 }
725 HAL_UART_IRQHandler(&huart5);
726 HAL_UART_Receive_DMA(&huart5, uart5GetStr, UART5_GET_SIZE);
727 }
728 #endif /* UART5_DMA_ATY */
729
730
731 #ifdef TEST_DMA_ATY
732
737 void UartControlTemplate(void)
738 {
739 if(uart1RecvEndFlag)
740 {
741 if(memcmp(uart1GetStr, "Hello STM32F1!", 14)==0)
742 {
743 printf("Getted! - printf\n");
744 Uart1SendDMA("Getted! - send\n", 15);
745 memset(uart1GetStr, 0, sizeof(uart1GetStr));
746 uart1GetCount=0;
747 }
748 uart1RecvEndFlag=0;
749 }
750 }
751 #endif /* TEST_DMA_ATY */
752
753
754 #endif /* __UART_ATY_H */
755
756 /******************************** End Of File *********************************/
uart2GetByte
uint8_t uart2GetByte
Definition: UART_ATY.h:97
uart1GetCount
uint8_t uart1GetCount
Definition: UART_ATY.h:91
uart2GetCount
uint8_t uart2GetCount
Definition: UART_ATY.h:98
uart1GetByte
uint8_t uart1GetByte
Definition: UART_ATY.h:90
Uart3Recv
void Uart3Recv(void)
Receive data from uart with IT.
Definition: UART_ATY.h:318
Uart3Send
void Uart3Send(uint8_t *pData, uint16_t Size)
Send data from uart.
Definition: UART_ATY.h:311
UART1_SEND_SIZE
#define UART1_SEND_SIZE
Definition: UART_ATY.h:65
UART3_SEND_SIZE
#define UART3_SEND_SIZE
Definition: UART_ATY.h:75
Uart2Recv
void Uart2Recv(void)
Receive data from uart with IT.
Definition: UART_ATY.h:290
UART2_SEND_SIZE
#define UART2_SEND_SIZE
Definition: UART_ATY.h:70
uart3GetByte
uint8_t uart3GetByte
Definition: UART_ATY.h:104
UART2_GET_SIZE
#define UART2_GET_SIZE
Definition: UART_ATY.h:69
uart2GetStr
uint8_t uart2GetStr[UART2_GET_SIZE]
Definition: UART_ATY.h:99
UART3_GET_SIZE
#define UART3_GET_SIZE
Definition: UART_ATY.h:74
uart3GetCount
uint8_t uart3GetCount
Definition: UART_ATY.h:105
uart1GetStr
uint8_t uart1GetStr[UART1_GET_SIZE]
Definition: UART_ATY.h:92
UART1_GET_SIZE
#define UART1_GET_SIZE
Definition: UART_ATY.h:64
Uart1Recv
void Uart1Recv(void)
Receive data from uart with IT.
Definition: UART_ATY.h:262
uart2SendStr
uint8_t uart2SendStr[UART2_SEND_SIZE]
Definition: UART_ATY.h:100
uart3GetStr
uint8_t uart3GetStr[UART3_GET_SIZE]
Definition: UART_ATY.h:106
Uart1Send
void Uart1Send(uint8_t *pData, uint16_t Size)
Send data from uart.
Definition: UART_ATY.h:255
HAL_UART_RxCpltCallback
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
Rewrite uart rx interrupt call-back function.
Definition: UART_ATY.h:398
uart3SendStr
uint8_t uart3SendStr[UART3_SEND_SIZE]
Definition: UART_ATY.h:107
UartInit_ATY
void UartInit_ATY(void)
Rewrite "printf();".
Definition: UART_ATY.h:199
Uart2Send
void Uart2Send(uint8_t *pData, uint16_t Size)
Send data from uart.
Definition: UART_ATY.h:283
uart1SendStr
uint8_t uart1SendStr[UART1_SEND_SIZE]
Definition: UART_ATY.h:93


ATYSTMLIB_HAL: UARTIO_ATY.h Source File

UARTIO_ATY.h
Go to the documentation of this file.
1
30 #ifndef __UART_ATY_H
31 #define __UART_ATY_H
32
33 #include "stm32f1xx_hal.h"
34 #include "stdio.h" //For "FILE"
35 #include "string.h" //For memset etc.
36
37
38 /******************************* For user *************************************/
39
40 /******************************************************************************/
41
42 #endif /* __UART_ATY_H */
43
44 /******************************** End Of File *********************************/


ATYSTMLIB_HAL: Graph Legend

Graph Legend

This page explains how to interpret the graphs that are generated by doxygen.

Consider the following example:

/*! Invisible class because of truncation */
class Invisible { };
/*! Truncated class, inheritance relation is hidden */
class Truncated : public Invisible { };
/* Class not documented with doxygen comments */
class Undocumented { };
/*! Class that is inherited using public inheritance */
class PublicBase : public Truncated { };
/*! A template class */
template<class T> class Templ { };
/*! Class that is inherited using protected inheritance */
class ProtectedBase { };
/*! Class that is inherited using private inheritance */
class PrivateBase { };
/*! Class that is used by the Inherited class */
class Used { };
/*! Super class that inherits a number of other classes */
class Inherited : public PublicBase,
protected ProtectedBase,
private PrivateBase,
public Undocumented,
public Templ<int>
{
private:
Used *m_usedClass;
};

This will result in the following graph:

The boxes in the above graph have the following meaning:

  • A filled gray box represents the struct or class for which the graph is generated.
  • A box with a black border denotes a documented struct or class.
  • A box with a gray border denotes an undocumented struct or class.
  • A box with a red border denotes a documented struct or class forwhich not all inheritance/containment relations are shown. A graph is truncated if it does not fit within the specified boundaries.

The arrows have the following meaning:

  • A dark blue arrow is used to visualize a public inheritance relation between two classes.
  • A dark green arrow is used for protected inheritance.
  • A dark red arrow is used for private inheritance.
  • A purple dashed arrow is used if a class is contained or used by another class. The arrow is labelled with the variable(s) through which the pointed class or struct is accessible.
  • A yellow dashed arrow denotes a relation between a template instance and the template class it was instantiated from. The arrow is labelled with the template parameters of the instance.


ATYSTMLIB_HAL: Related Pages

Related Pages
Here is a list of all related documentation pages:
Todo List