Commit 27ed0a407d5bcc1856837787dd12e48c8cbfef83
1 parent
a09e50e8
Ajout d'une fonction chenillard (qui ne fonctionne pas en // des fonctions USB)
le code est un peu crade dans LUFA/Drives/Board/AVR8/PINGUI/LEDs.h
Showing
2 changed files
with
41 additions
and
12 deletions
Show diff stats
src/lufa-LUFA-170418/LUFA/Drivers/Board/AVR8/PINGUI/LEDs.h
@@ -86,7 +86,7 @@ | @@ -86,7 +86,7 @@ | ||
86 | #define LEDS_LED4 (1 << 7) | 86 | #define LEDS_LED4 (1 << 7) |
87 | 87 | ||
88 | /** LED mask for all the LEDs on the board. */ | 88 | /** LED mask for all the LEDs on the board. */ |
89 | - #define LEDS_ALL_LEDS (LEDS_LED1 | LEDS_LED2 | LEDS_LED3 | LEDS_LED4) | 89 | + #define LEDS_ALL_LEDS 0b00011111 |
90 | 90 | ||
91 | /** LED mask for none of the board LEDs. */ | 91 | /** LED mask for none of the board LEDs. */ |
92 | #define LEDS_NO_LEDS 0 | 92 | #define LEDS_NO_LEDS 0 |
@@ -95,29 +95,36 @@ | @@ -95,29 +95,36 @@ | ||
95 | #if !defined(__DOXYGEN__) | 95 | #if !defined(__DOXYGEN__) |
96 | static inline void LEDs_Init(void) | 96 | static inline void LEDs_Init(void) |
97 | { | 97 | { |
98 | - DDRB |= LEDS_ALL_LEDS; | ||
99 | - PORTB &= ~LEDS_ALL_LEDS; | 98 | + //DDRB |= 0b01010000; |
99 | + //DDRC |= 0b10000000; | ||
100 | + DDRD |= 0b10011111; | ||
101 | + //DDRE |= ; | ||
102 | + | ||
103 | + PORTD &= ~LEDS_ALL_LEDS; | ||
100 | } | 104 | } |
101 | 105 | ||
102 | static inline void LEDs_Disable(void) | 106 | static inline void LEDs_Disable(void) |
103 | { | 107 | { |
104 | - DDRB &= ~LEDS_ALL_LEDS; | ||
105 | - PORTB &= ~LEDS_ALL_LEDS; | 108 | + //axel : unused |
109 | + DDRD &= ~LEDS_ALL_LEDS; | ||
110 | + PORTD &= ~LEDS_ALL_LEDS; | ||
106 | } | 111 | } |
107 | 112 | ||
108 | static inline void LEDs_TurnOnLEDs(const uint8_t LedMask) | 113 | static inline void LEDs_TurnOnLEDs(const uint8_t LedMask) |
109 | { | 114 | { |
110 | - PORTB |= LedMask; | 115 | + PORTD |= LedMask; |
111 | } | 116 | } |
112 | 117 | ||
113 | static inline void LEDs_TurnOffLEDs(const uint8_t LedMask) | 118 | static inline void LEDs_TurnOffLEDs(const uint8_t LedMask) |
114 | { | 119 | { |
115 | - PORTB &= ~LedMask; | 120 | + PORTD &= ~LedMask; |
116 | } | 121 | } |
117 | 122 | ||
118 | static inline void LEDs_SetAllLEDs(const uint8_t LedMask) | 123 | static inline void LEDs_SetAllLEDs(const uint8_t LedMask) |
119 | { | 124 | { |
120 | - PORTB = ((PORTB & ~LEDS_ALL_LEDS) | LedMask); | 125 | + //unused |
126 | + //PORTB etc | ||
127 | + PORTD = ((PORTD & ~LEDS_ALL_LEDS) | LedMask & LEDS_ALL_LEDS); | ||
121 | } | 128 | } |
122 | 129 | ||
123 | static inline void LEDs_ChangeLEDs(const uint8_t LedMask, | 130 | static inline void LEDs_ChangeLEDs(const uint8_t LedMask, |
src/lufa-LUFA-170418/PolytechLille/Manette/Manette.c
@@ -65,19 +65,35 @@ USB_ClassInfo_HID_Device_t Joystick_HID_Interface = | @@ -65,19 +65,35 @@ USB_ClassInfo_HID_Device_t Joystick_HID_Interface = | ||
65 | */ | 65 | */ |
66 | 66 | ||
67 | 67 | ||
68 | - | ||
69 | - | 68 | +//Only DBG |
69 | +void POC_LEDS(){ | ||
70 | + for(;;){ | ||
71 | + LEDs_SetAllLEDs(0b00000001); | ||
72 | + _delay_ms(250); | ||
73 | + LEDs_SetAllLEDs(0b00000010); | ||
74 | + _delay_ms(250); | ||
75 | + LEDs_SetAllLEDs(0b00000100); | ||
76 | + _delay_ms(250); | ||
77 | + LEDs_SetAllLEDs(0b00001000); | ||
78 | + _delay_ms(250); | ||
79 | + LEDs_SetAllLEDs(0b00000000); | ||
80 | + _delay_ms(250); | ||
81 | + } | ||
82 | +} | ||
70 | 83 | ||
71 | 84 | ||
72 | int main(void) | 85 | int main(void) |
73 | { | 86 | { |
74 | SetupHardware(); | 87 | SetupHardware(); |
75 | 88 | ||
76 | - LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); | 89 | + LEDs_SetAllLEDs(0); |
90 | + //uncomment to see LEDS Proof of working | ||
91 | + //POC_LEDS(); | ||
77 | GlobalInterruptEnable(); | 92 | GlobalInterruptEnable(); |
78 | 93 | ||
79 | for (;;) | 94 | for (;;) |
80 | { | 95 | { |
96 | + LEDs_SetAllLEDs(0xFF); | ||
81 | HID_Device_USBTask(&Joystick_HID_Interface); | 97 | HID_Device_USBTask(&Joystick_HID_Interface); |
82 | USB_USBTask(); | 98 | USB_USBTask(); |
83 | } | 99 | } |
@@ -190,7 +206,13 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn | @@ -190,7 +206,13 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn | ||
190 | if (ButtonStatus_LCL_BAS & BUTTONS_BAS) | 206 | if (ButtonStatus_LCL_BAS & BUTTONS_BAS) |
191 | { JoystickReport->Button |= ( 1<<2);} | 207 | { JoystickReport->Button |= ( 1<<2);} |
192 | if (ButtonStatus_LCL_DROITE & BUTTONS_DROITE) | 208 | if (ButtonStatus_LCL_DROITE & BUTTONS_DROITE) |
193 | - { JoystickReport->Button |= ( 1<<3);} | 209 | + { JoystickReport->Button |= ( 1<<3); |
210 | + LEDs_SetAllLEDs(0b00011111); | ||
211 | + | ||
212 | + }else{ | ||
213 | + LEDs_SetAllLEDs(0b00000000); | ||
214 | + | ||
215 | +} | ||
194 | // if (ButtonStatus_LCL_STOP & BUTTONS_STOP) | 216 | // if (ButtonStatus_LCL_STOP & BUTTONS_STOP) |
195 | // { JoystickReport->Button |= ( 1<<4);} | 217 | // { JoystickReport->Button |= ( 1<<4);} |
196 | 218 |