HPM APP
HPMicro Application solution
gpio_led.h File Reference
#include "board.h"
#include "hpm_gpio_drv.h"
#include "math.h"

Go to the source code of this file.

Macros

#define LED_STATUS_ENABLE   1
 Status indicator light switch, 1: enabled, 0: disabled ;状态指示灯开关,1:使能,0:禁用 More...
 
#define LED_STATUS_CTRL   HPM_GPIO0
 GPIO group used for status indicator lights ;状态指示灯使用的GPIO组 More...
 
#define LED_STATUS_INDEX   GPIO_DO_GPIOA
 
#define LED_RED_ERROR_PIN   31
 GPIO pins used for status indicator lights ;状态指示灯使用的GPIO引脚 More...
 
#define LED_GREEN_OK_PIN   30
 
#define LED_BLUE_WORK_PIN   29
 
#define LED_ON   0
 Status indicator light on and off control, LED_ON: light on, LED_OFF: light off ;状态指示灯亮灭控制,LED_ON:亮,LED_OFF:灭 More...
 
#define LED_OFF   1
 
#define LED_DIG_ENABLE   1
 LED display tube control, LED_DIG_ENABLE: The display tube is on, LED_DIG_DISABLE: Display tube out ;LED显示管控制,LED_DIG_ENABLE:显示管亮,LED_DIG_DISABLE:显示管灭 More...
 
#define LED_DIG_DISABLE   0
 
#define LED_DIG0_PIN   15
 LED display tube control pins, a total of 5 display tubes ;LED显示管控制引脚,共5个显示管 More...
 
#define LED_DIG1_PIN   12
 
#define LED_DIG2_PIN   10
 
#define LED_DIG3_PIN   14
 
#define LED_DIG4_PIN   13
 
#define LED_NUMBER   5
 LED display tube control pins, a total of 5 display tubes ;LED显示管控制引脚,共5个显示管 More...
 
#define DECIMAL_NUMBER   2
 LED displays the number of decimal places, 1 or 2 digits ;LED显示小数位的个数,1位或2位 More...
 
#define MULTI_COFFI   pow(10,DECIMAL_NUMBER)
 Multiplier coefficient ;乘数系数 More...
 
#define DISPLAY_DELAY_MS   5
 The duration of each LED display ;每个LED显示的持续时间 More...
 
#define DISPLAY_COUNT   10
 LED displays the number of cycles per display ;LED每次显示循环次数 More...
 
#define LED_POWER_CTRL   HPM_GPIO0
 LED display tube power supply control pin group ;LED显示管供电控制引脚组 More...
 
#define LED_POWER_INDEX   GPIO_DO_GPIOA
 
#define LED_DISPLAY_CTRL   HPM_GPIO0
 LED display control pin group ;LED显示控制引脚组 More...
 
#define LED_DISPLAY_INDEX   GPIO_DO_GPIOY
 
#define LED_DISPLAY_A_PIN   0
 LED display control pins, 8 pins control the display of each number ;LED显示控制引脚,8个引脚控制每一个数字的显示 More...
 
#define LED_DISPLAY_F_PIN   1
 
#define LED_DISPLAY_B_PIN   2
 
#define LED_DISPLAY_E_PIN   3
 
#define LED_DISPLAY_D_PIN   4
 
#define LED_DISPLAY_DP_PIN   5
 
#define LED_DISPLAY_C_PIN   6
 
#define LED_DISPLAY_G_PIN   7
 

Enumerations

enum  LED_DIG_CTRL {
  LED_DIG_0 = 15 , LED_DIG_1 = 12 , LED_DIG_2 = 10 , LED_DIG_3 = 14 ,
  LED_DIG_4 = 13
}
 LED display tube control pins, a total of 5 display tubes ;LED显示管控制引脚,共5个显示管 More...
 

Functions

void init_led_pins (void)
 Initialize the control pins of the LED light ;初始化LED灯的控制引脚 More...
 
void led_red_error (void)
 The red LED light is on, indicating that the current status is error ;红色LED灯亮,表示当前状态为error. More...
 
void led_green_ok (void)
 The green LED light is on, indicating that the current status is OK ;绿色LED灯亮,表示当前状态为ok. More...
 
void led_blue_work (void)
 The blue LED light is on, indicating that the current status is work ;蓝色LED灯亮,表示当前状态为work. More...
 
void init_led_diplay_pins (void)
 Initialize LED display control pins ;初始化LED显示控制引脚 More...
 
void init_led_dig_pins (void)
 Initialize LED display tube power supply control pins ;初始化LED显示管供电控制引脚 More...
 
void led_dig_enable (uint8_t index)
 LED display tube enable, 5 LED display tubes in total from 0 to 4 ;LED显示管使能,0~4共5个LED显示管 More...
 
void led_dig_disable (uint8_t index)
 LED display tube disable, 5 LED display tubes in total from 0 to 4 ;LED显示管禁用,0~4共5个LED显示管 More...
 
void led_dig_disable_all (void)
 Disable all LED display tubes ;禁用所有的LED显示管
More...
 
void led_display_number (uint8_t number)
 LED digital tube displays numbers ;LED数码管显示数字 More...
 
void led_display_speed (float speed)
 LED digital display speed ;LED数码管显示速度 More...
 
void led_display_float (float number)
 LED digital tube displays floating-point numbers ;LED数码管显示浮点数 More...
 
void led_diplay_point (void)
 LED digital tube displays decimal point ;LED数码管显示小数点
More...
 
void init_led_display (void)
 Initialize LED digital display function ;初始化LED数码管显示功能
More...
 

Macro Definition Documentation

◆ DECIMAL_NUMBER

#define DECIMAL_NUMBER   2

LED displays the number of decimal places, 1 or 2 digits ;LED显示小数位的个数,1位或2位

◆ DISPLAY_COUNT

#define DISPLAY_COUNT   10

LED displays the number of cycles per display ;LED每次显示循环次数

◆ DISPLAY_DELAY_MS

#define DISPLAY_DELAY_MS   5

The duration of each LED display ;每个LED显示的持续时间

◆ LED_BLUE_WORK_PIN

#define LED_BLUE_WORK_PIN   29

◆ LED_DIG0_PIN

#define LED_DIG0_PIN   15

LED display tube control pins, a total of 5 display tubes ;LED显示管控制引脚,共5个显示管

◆ LED_DIG1_PIN

#define LED_DIG1_PIN   12

◆ LED_DIG2_PIN

#define LED_DIG2_PIN   10

◆ LED_DIG3_PIN

#define LED_DIG3_PIN   14

◆ LED_DIG4_PIN

#define LED_DIG4_PIN   13

◆ LED_DIG_DISABLE

#define LED_DIG_DISABLE   0

◆ LED_DIG_ENABLE

#define LED_DIG_ENABLE   1

LED display tube control, LED_DIG_ENABLE: The display tube is on, LED_DIG_DISABLE: Display tube out ;LED显示管控制,LED_DIG_ENABLE:显示管亮,LED_DIG_DISABLE:显示管灭

◆ LED_DISPLAY_A_PIN

#define LED_DISPLAY_A_PIN   0

LED display control pins, 8 pins control the display of each number ;LED显示控制引脚,8个引脚控制每一个数字的显示

◆ LED_DISPLAY_B_PIN

#define LED_DISPLAY_B_PIN   2

◆ LED_DISPLAY_C_PIN

#define LED_DISPLAY_C_PIN   6

◆ LED_DISPLAY_CTRL

#define LED_DISPLAY_CTRL   HPM_GPIO0

LED display control pin group ;LED显示控制引脚组

◆ LED_DISPLAY_D_PIN

#define LED_DISPLAY_D_PIN   4

◆ LED_DISPLAY_DP_PIN

#define LED_DISPLAY_DP_PIN   5

◆ LED_DISPLAY_E_PIN

#define LED_DISPLAY_E_PIN   3

◆ LED_DISPLAY_F_PIN

#define LED_DISPLAY_F_PIN   1

◆ LED_DISPLAY_G_PIN

#define LED_DISPLAY_G_PIN   7

◆ LED_DISPLAY_INDEX

#define LED_DISPLAY_INDEX   GPIO_DO_GPIOY

◆ LED_GREEN_OK_PIN

#define LED_GREEN_OK_PIN   30

◆ LED_NUMBER

#define LED_NUMBER   5

LED display tube control pins, a total of 5 display tubes ;LED显示管控制引脚,共5个显示管

◆ LED_OFF

#define LED_OFF   1

◆ LED_ON

#define LED_ON   0

Status indicator light on and off control, LED_ON: light on, LED_OFF: light off ;状态指示灯亮灭控制,LED_ON:亮,LED_OFF:灭

◆ LED_POWER_CTRL

#define LED_POWER_CTRL   HPM_GPIO0

LED display tube power supply control pin group ;LED显示管供电控制引脚组

◆ LED_POWER_INDEX

#define LED_POWER_INDEX   GPIO_DO_GPIOA

◆ LED_RED_ERROR_PIN

#define LED_RED_ERROR_PIN   31

GPIO pins used for status indicator lights ;状态指示灯使用的GPIO引脚

◆ LED_STATUS_CTRL

#define LED_STATUS_CTRL   HPM_GPIO0

GPIO group used for status indicator lights ;状态指示灯使用的GPIO组

◆ LED_STATUS_ENABLE

#define LED_STATUS_ENABLE   1

Status indicator light switch, 1: enabled, 0: disabled ;状态指示灯开关,1:使能,0:禁用

◆ LED_STATUS_INDEX

#define LED_STATUS_INDEX   GPIO_DO_GPIOA

◆ MULTI_COFFI

#define MULTI_COFFI   pow(10,DECIMAL_NUMBER)

Multiplier coefficient ;乘数系数

Enumeration Type Documentation

◆ LED_DIG_CTRL

LED display tube control pins, a total of 5 display tubes ;LED显示管控制引脚,共5个显示管

Enumerator
LED_DIG_0 
LED_DIG_1 
LED_DIG_2 
LED_DIG_3 
LED_DIG_4 

Function Documentation

◆ init_led_dig_pins()

void init_led_dig_pins ( void  )

Initialize LED display tube power supply control pins ;初始化LED显示管供电控制引脚

◆ init_led_diplay_pins()

void init_led_diplay_pins ( void  )

Initialize LED display control pins ;初始化LED显示控制引脚

◆ init_led_display()

void init_led_display ( void  )

Initialize LED digital display function ;初始化LED数码管显示功能

◆ init_led_pins()

void init_led_pins ( void  )

Initialize the control pins of the LED light ;初始化LED灯的控制引脚

◆ led_blue_work()

void led_blue_work ( void  )

The blue LED light is on, indicating that the current status is work ;蓝色LED灯亮,表示当前状态为work.

◆ led_dig_disable()

void led_dig_disable ( uint8_t  index)

LED display tube disable, 5 LED display tubes in total from 0 to 4 ;LED显示管禁用,0~4共5个LED显示管

Parameters
[in]index0~4 respectively represent the 5 LED display tubes from the lowest position to the highest position;0~4分别表示最低位到最高位的5个LED显示管

◆ led_dig_disable_all()

void led_dig_disable_all ( void  )

Disable all LED display tubes ;禁用所有的LED显示管

◆ led_dig_enable()

void led_dig_enable ( uint8_t  index)

LED display tube enable, 5 LED display tubes in total from 0 to 4 ;LED显示管使能,0~4共5个LED显示管

Parameters
[in]index0~4 respectively represent the 5 LED display tubes from the lowest position to the highest position;0~4分别表示最低位到最高位的5个LED显示管

◆ led_diplay_point()

void led_diplay_point ( void  )

LED digital tube displays decimal point ;LED数码管显示小数点

◆ led_display_float()

void led_display_float ( float  number)

LED digital tube displays floating-point numbers ;LED数码管显示浮点数

Parameters
[in]numberFloating point data, supporting up to 5 positive floating-point numbers ;浮点数据,最多支持5位的正浮点数

◆ led_display_number()

void led_display_number ( uint8_t  number)

LED digital tube displays numbers ;LED数码管显示数字

Parameters
[in]number数字0~9;Numbers 0~9

◆ led_display_speed()

void led_display_speed ( float  speed)

LED digital display speed ;LED数码管显示速度

Parameters
[in]speedSpeed value, supports up to 5 positive floating-point numbers ;速度值,最多支持5位的正浮点数

◆ led_green_ok()

void led_green_ok ( void  )

The green LED light is on, indicating that the current status is OK ;绿色LED灯亮,表示当前状态为ok.

◆ led_red_error()

void led_red_error ( void  )

The red LED light is on, indicating that the current status is error ;红色LED灯亮,表示当前状态为error.