ВходНаше всё Теги codebook 无线电组件 Поиск Опросы Закон Четверг
25 апреля
640250 Топик полностью
Звероящер (21.12.2015 22:27, просмотров: 121) ответил =L.A.= на Настройки GPIOx семейства STM32F0xx
эээ  /************************************************************************* ** ** File: mcu_cfg.h ** Summary: MCU configuration (crystal frequency, types of ports and ** so on). ** Version: ** Date: ** ************************************************************************** ** ** Compiler: ** Remarks: ** **************************************************************************/ #ifndef _MCU_CFG_H #define _MCU_CFG_H /*************************************************************************/ #include <iotiny85.h> #include <inavr.h> #include <avr_macros.h> /*************************************************************************/ #define OSC_FREQ 8000000L // 8MHz (internal oscillator) #define LED_PIN PINB0 // blinking LED #define MOTOR_PIN PINB1 // use hardware PWM. It drives n-MOSFET #define OFF_PIN PINB2 // ADC1. Define motor pause in sec. Adjust pin by resistor #define RPM_PIN PINB3 // ADC3 input. RPM motor adjust pin by resistor #define ON_PIN PINB4 // ADC2 input. Define motor runing in sec. Adjust pin by resistor #define PORTB_CFG (1 << LED_PIN) | (0 << MOTOR_PIN) #define DDRB_CFG (1 << LED_PIN) | (1 << MOTOR_PIN) #define ADC_PORT PORTB #define PWM_PORT PORTB #define ADC_DIR DDRB #define PWM_DIR DDRB #endif #include "adc.h" #include "timer.h" #include <types.h> void main() { DDRB = DDRB_CFG; PORTB = PORTB_CFG; ... // бла-бла-бла ... }