📄 joystick_hw.h
字号:
#ifndef __JOYSTICK_HW_H__
#define __JOYSTICK_HW_H__
#ifdef AVR
#include <avr/io.h>
# ifndef JOYSTICK_PORT
// Default to PORTC, lines PC0 - PC4
# define JOYSTICK_PORT PORTC
# define JOYSTICK_PORT_IN PINC
# define JOYSTICK_DDR DDRC
# define JOYSTICK_PORT_MASK 0x1f
# define JOYSTICK_UP _BV(PC0)
# define JOYSTICK_DOWN _BV(PC1)
# define JOYSTICK_LEFT _BV(PC2)
# define JOYSTICK_RIGHT _BV(PC3)
# define JOYSTICK_BUTTON _BV(PC4)
# endif // #ifndef JOYSTICK_PORT
// Set up joystick lines as input with pullup resistors
# define joystick_hw_init() (JOYSTICK_DDR &= ~JOYSTICK_PORT_MASK, \
JOYSTICK_PORT |= JOYSTICK_PORT_MASK)
// Change result so lines active low are returned as "1"
# define joystick_hw_read() ((JOYSTICK_PORT_IN & JOYSTICK_PORT_MASK) \
^ JOYSTICK_PORT_MASK)
#endif // #ifdef AVR
#endif //#ifndef __JOYSTICK_HW_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -