GPIO.h对比
STM32-GPIO函数 | GD32-GPIO函数 |
---|
void GPIO_DeInit(GPIO_TypeDef* GPIOx); | void gpio_deinit(uint32_t gpio_periph); | void GPIO_AFIODeInit(void); | void gpio_afio_deinit(void); | void GPIO_Init(GPIO_TypeDef* GPIOx, GPIO_InitTypeDef* GPIO_InitStruct); | void gpio_init(uint32_t gpio_periph, uint32_t mode, uint32_t speed, uint32_t pin); | void GPIO_StructInit(GPIO_InitTypeDef* GPIO_InitStruct); | | uint8_t GPIO_ReadInputDataBit(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin); | FlagStatus gpio_input_bit_get(uint32_t gpio_periph, uint32_t pin); | uint16_t GPIO_ReadInputData(GPIO_TypeDef* GPIOx); | uint16_t gpio_input_port_get(uint32_t gpio_periph); | uint8_t GPIO_ReadOutputDataBit(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin); | FlagStatus gpio_output_bit_get(uint32_t gpio_periph, uint32_t pin); | uint16_t GPIO_ReadOutputData(GPIO_TypeDef* GPIOx); | uint16_t gpio_output_port_get(uint32_t gpio_periph); | void GPIO_SetBits(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin); | void gpio_bit_set(uint32_t gpio_periph, uint32_t pin); | void GPIO_ResetBits(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin); | void gpio_bit_reset(uint32_t gpio_periph, uint32_t pin); | void GPIO_WriteBit(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin, BitAction BitVal); | void gpio_bit_write(uint32_t gpio_periph, uint32_t pin, bit_status bit_value); | void GPIO_Write(GPIO_TypeDef* GPIOx, uint16_t PortVal); | void gpio_port_write(uint32_t gpio_periph, uint16_t data); | void GPIO_PinLockConfig(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin); | void gpio_pin_lock(uint32_t gpio_periph, uint32_t pin); | void GPIO_EventOutputConfig(uint8_t GPIO_PortSource, uint8_t GPIO_PinSource); | void gpio_event_output_config(uint8_t output_port, uint8_t output_pin); | void GPIO_EventOutputCmd(FunctionalState NewState); | void gpio_event_output_enable(void); | void GPIO_PinRemapConfig(uint32_t GPIO_Remap, FunctionalState NewState); | void gpio_pin_remap_config(uint32_t remap, ControlStatus newvalue); | void GPIO_EXTILineConfig(uint8_t GPIO_PortSource, uint8_t GPIO_PinSource); | | void GPIO_ETH_MediaInterfaceConfig(uint32_t GPIO_ETH_MediaInterface); | |
EXTI.h
STM32-exti函数 | GD32-exti函数 |
---|
void EXTI_DeInit(void); | void exti_deinit(void); | void EXTI_Init(EXTI_InitTypeDef* EXTI_InitStruct);void EXTI_StructInit(EXTI_InitTypeDef* EXTI_InitStruct); | void exti_init(exti_line_enum linex, exti_mode_enum mode, exti_trig_type_enum trig_type); | void EXTI_GenerateSWInterrupt(uint32_t EXTI_Line); | void exti_interrupt_enable(exti_line_enum linex); | | void exti_event_enable(exti_line_enum linex); | | void exti_interrupt_disable(exti_line_enum linex); | | void exti_event_disable(exti_line_enum linex); | FlagStatus EXTI_GetFlagStatus(uint32_t EXTI_Line); | FlagStatus exti_flag_get(exti_line_enum linex); | void EXTI_ClearFlag(uint32_t EXTI_Line); | void exti_flag_clear(exti_line_enum linex); | ITStatus EXTI_GetITStatus(uint32_t EXTI_Line); | FlagStatus exti_interrupt_flag_get(exti_line_enum linex); | void EXTI_ClearITPendingBit(uint32_t EXTI_Line); | void exti_interrupt_flag_clear(exti_line_enum linex); | | void exti_software_interrupt_enable(exti_line_enum linex); | | void exti_software_interrupt_disable(exti_line_enum linex); |
ADC.h
stm32
void ADC_DeInit(ADC_TypeDef* ADCx);
void ADC_Init(ADC_TypeDef* ADCx, ADC_InitTypeDef* ADC_InitStruct);
void ADC_StructInit(ADC_InitTypeDef* ADC_InitStruct);
void ADC_Cmd(ADC_TypeDef* ADCx, FunctionalState NewState);
void ADC_DMACmd(ADC_TypeDef* ADCx, FunctionalState NewState);
void ADC_ITConfig(ADC_TypeDef* ADCx, uint16_t ADC_IT, FunctionalState NewState);
void ADC_ResetCalibration(ADC_TypeDef* ADCx);
FlagStatus ADC_GetResetCalibrationStatus(ADC_TypeDef* ADCx);
void ADC_StartCalibration(ADC_TypeDef* ADCx);
FlagStatus ADC_GetCalibrationStatus(ADC_TypeDef* ADCx);
void ADC_SoftwareStartConvCmd(ADC_TypeDef* ADCx, FunctionalState NewState);
FlagStatus ADC_GetSoftwareStartConvStatus(ADC_TypeDef* ADCx);
void ADC_DiscModeChannelCountConfig(ADC_TypeDef* ADCx, uint8_t Number);
void ADC_DiscModeCmd(ADC_TypeDef* ADCx, FunctionalState NewState);
void ADC_RegularChannelConfig(ADC_TypeDef* ADCx, uint8_t ADC_Channel, uint8_t Rank, uint8_t ADC_SampleTime);
void ADC_ExternalTrigConvCmd(ADC_TypeDef* ADCx, FunctionalState NewState);
uint16_t ADC_GetConversionValue(ADC_TypeDef* ADCx);
uint32_t ADC_GetDualModeConversionValue(void);
void ADC_AutoInjectedConvCmd(ADC_TypeDef* ADCx, FunctionalState NewState);
void ADC_InjectedDiscModeCmd(ADC_TypeDef* ADCx, FunctionalState NewState);
void ADC_ExternalTrigInjectedConvConfig(ADC_TypeDef* ADCx, uint32_t ADC_ExternalTrigInjecConv);
void ADC_ExternalTrigInjectedConvCmd(ADC_TypeDef* ADCx, FunctionalState NewState);
void ADC_SoftwareStartInjectedConvCmd(ADC_TypeDef* ADCx, FunctionalState NewState);
FlagStatus ADC_GetSoftwareStartInjectedConvCmdStatus(ADC_TypeDef* ADCx);
void ADC_InjectedChannelConfig(ADC_TypeDef* ADCx, uint8_t ADC_Channel, uint8_t Rank, uint8_t ADC_SampleTime);
void ADC_InjectedSequencerLengthConfig(ADC_TypeDef* ADCx, uint8_t Length);
void ADC_SetInjectedOffset(ADC_TypeDef* ADCx, uint8_t ADC_InjectedChannel, uint16_t Offset);
uint16_t ADC_GetInjectedConversionValue(ADC_TypeDef* ADCx, uint8_t ADC_InjectedChannel);
void ADC_AnalogWatchdogCmd(ADC_TypeDef* ADCx, uint32_t ADC_AnalogWatchdog);
void ADC_AnalogWatchdogThresholdsConfig(ADC_TypeDef* ADCx, uint16_t HighThreshold, uint16_t LowThreshold);
void ADC_AnalogWatchdogSingleChannelConfig(ADC_TypeDef* ADCx, uint8_t ADC_Channel);
void ADC_TempSensorVrefintCmd(FunctionalState NewState);
FlagStatus ADC_GetFlagStatus(ADC_TypeDef* ADCx, uint8_t ADC_FLAG);
void ADC_ClearFlag(ADC_TypeDef* ADCx, uint8_t ADC_FLAG);
ITStatus ADC_GetITStatus(ADC_TypeDef* ADCx, uint16_t ADC_IT);
void ADC_ClearITPendingBit(ADC_TypeDef* ADCx, uint16_t ADC_IT);
GD32
void adc_deinit(uint32_t adc_periph);
void adc_enable(uint32_t adc_periph);
void adc_disable(uint32_t adc_periph);
void adc_calibration_enable(uint32_t adc_periph);
void adc_dma_mode_enable(uint32_t adc_periph);
void adc_dma_mode_disable(uint32_t adc_periph);
void adc_tempsensor_vrefint_enable(void);
void adc_tempsensor_vrefint_disable(void);
void adc_resolution_config(uint32_t adc_periph , uint32_t resolution);
void adc_discontinuous_mode_config(uint32_t adc_periph , uint8_t adc_channel_group , uint8_t length);
void adc_mode_config(uint32_t mode);
void adc_special_function_config(uint32_t adc_periph , uint32_t function , ControlStatus newvalue);
void adc_data_alignment_config(uint32_t adc_periph , uint32_t data_alignment);
void adc_channel_length_config(uint32_t adc_periph , uint8_t adc_channel_group , uint32_t length);
void adc_regular_channel_config(uint32_t adc_periph , uint8_t rank , uint8_t adc_channel , uint32_t sample_time);
void adc_inserted_channel_config(uint32_t adc_periph , uint8_t rank , uint8_t adc_channel , uint32_t sample_time);
void adc_inserted_channel_offset_config(uint32_t adc_periph , uint8_t inserted_channel , uint16_t offset);
void adc_external_trigger_config(uint32_t adc_periph, uint8_t adc_channel_group, ControlStatus newvalue);
void adc_external_trigger_source_config(uint32_t adc_periph, uint8_t adc_channel_group, uint32_t external_trigger_source);
void adc_software_trigger_enable(uint32_t adc_periph , uint8_t adc_channel_group);
uint16_t adc_regular_data_read(uint32_t adc_periph);
uint16_t adc_inserted_data_read(uint32_t adc_periph , uint8_t inserted_channel);
uint32_t adc_sync_mode_convert_value_read(void);
FlagStatus adc_flag_get(uint32_t adc_periph , uint32_t adc_flag);
void adc_flag_clear(uint32_t adc_periph , uint32_t adc_flag);
FlagStatus adc_interrupt_flag_get(uint32_t adc_periph , uint32_t adc_interrupt);
void adc_interrupt_flag_clear(uint32_t adc_periph , uint32_t adc_interrupt);
void adc_interrupt_enable(uint32_t adc_periph , uint32_t adc_interrupt);
void adc_interrupt_disable(uint32_t adc_periph , uint32_t adc_interrupt);
void adc_watchdog_single_channel_enable(uint32_t adc_periph, uint8_t adc_channel);
void adc_watchdog_group_channel_enable(uint32_t adc_periph, uint8_t adc_channel_group);
void adc_watchdog_disable(uint32_t adc_periph);
void adc_watchdog_threshold_config(uint32_t adc_periph , uint16_t low_threshold , uint16_t high_threshold);
void adc_oversample_mode_config(uint32_t adc_periph , uint32_t mode , uint16_t shift , uint8_t ratio);
void adc_oversample_mode_enable(uint32_t adc_periph);
void adc_oversample_mode_disable(uint32_t adc_periph);
比较到adc时发现,大多数还是名字修改与功能拆分与封装的重构,若想像stm32一样去使用,只能慢慢去熟悉,好在有stm32的基础,他们的功能相同,配置相同,配置过程用的函数名称不同,原理相同,那是不是就是可以想象成是一样的,嗯,可以
|