bluefruit, pjrc: Update protocols for new API
This commit is contained in:
		
							parent
							
								
									22d99f26af
								
							
						
					
					
						commit
						06527bde4f
					
				
					 6 changed files with 7 additions and 35 deletions
				
			
		| 
						 | 
					@ -83,21 +83,6 @@ COMMAND_ENABLE = yes    # Commands for debug and configuration
 | 
				
			||||||
PS2_USE_INT = yes	# uses external interrupt for falling edge of PS/2 clock pin
 | 
					PS2_USE_INT = yes	# uses external interrupt for falling edge of PS/2 clock pin
 | 
				
			||||||
#PS2_USE_BUSYWAIT = yes	# uses primitive reference code
 | 
					#PS2_USE_BUSYWAIT = yes	# uses primitive reference code
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ifdef PS2_USE_USART
 | 
					 | 
				
			||||||
    SRC += protocol/ps2_usart.c
 | 
					 | 
				
			||||||
    OPT_DEFS += -DPS2_USE_USART
 | 
					 | 
				
			||||||
endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
ifdef PS2_USE_INT
 | 
					 | 
				
			||||||
    SRC += protocol/ps2.c
 | 
					 | 
				
			||||||
    OPT_DEFS += -DPS2_USE_INT
 | 
					 | 
				
			||||||
endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
ifdef PS2_USE_BUSYWAIT
 | 
					 | 
				
			||||||
    SRC += protocol/ps2.c
 | 
					 | 
				
			||||||
    OPT_DEFS += -DPS2_USE_BUSYWAIT
 | 
					 | 
				
			||||||
endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#---------------- Programming Options --------------------------
 | 
					#---------------- Programming Options --------------------------
 | 
				
			||||||
PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex
 | 
					PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -107,6 +92,7 @@ VPATH += $(TARGET_DIR)
 | 
				
			||||||
VPATH += $(TOP_DIR)
 | 
					VPATH += $(TOP_DIR)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					include $(TOP_DIR)/protocol.mk
 | 
				
			||||||
include $(TOP_DIR)/protocol/bluefruit.mk
 | 
					include $(TOP_DIR)/protocol/bluefruit.mk
 | 
				
			||||||
include $(TOP_DIR)/protocol.mk
 | 
					include $(TOP_DIR)/protocol.mk
 | 
				
			||||||
include $(TOP_DIR)/common.mk
 | 
					include $(TOP_DIR)/common.mk
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -82,21 +82,6 @@ PS2_USE_USART = yes	# uses hardware USART engine for PS/2 signal receive(recomen
 | 
				
			||||||
#PS2_USE_INT = yes	# uses external interrupt for falling edge of PS/2 clock pin
 | 
					#PS2_USE_INT = yes	# uses external interrupt for falling edge of PS/2 clock pin
 | 
				
			||||||
#PS2_USE_BUSYWAIT = yes	# uses primitive reference code
 | 
					#PS2_USE_BUSYWAIT = yes	# uses primitive reference code
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ifdef PS2_USE_USART
 | 
					 | 
				
			||||||
    SRC += protocol/ps2_usart.c
 | 
					 | 
				
			||||||
    OPT_DEFS += -DPS2_USE_USART
 | 
					 | 
				
			||||||
endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
ifdef PS2_USE_INT
 | 
					 | 
				
			||||||
    SRC += protocol/ps2.c
 | 
					 | 
				
			||||||
    OPT_DEFS += -DPS2_USE_INT
 | 
					 | 
				
			||||||
endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
ifdef PS2_USE_BUSYWAIT
 | 
					 | 
				
			||||||
    SRC += protocol/ps2.c
 | 
					 | 
				
			||||||
    OPT_DEFS += -DPS2_USE_BUSYWAIT
 | 
					 | 
				
			||||||
endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#---------------- Programming Options --------------------------
 | 
					#---------------- Programming Options --------------------------
 | 
				
			||||||
PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex
 | 
					PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -36,7 +36,7 @@ static void bluefruit_serial_send(uint8_t);
 | 
				
			||||||
void bluefruit_keyboard_print_report(report_keyboard_t *report)
 | 
					void bluefruit_keyboard_print_report(report_keyboard_t *report)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if (!debug_keyboard) return;
 | 
					    if (!debug_keyboard) return;
 | 
				
			||||||
    dprintf("keys: "); for (int i = 0; i < REPORT_KEYS; i++) { debug_hex8(report->keys[i]); dprintf(" "); }
 | 
					    dprintf("keys: "); for (int i = 0; i < KEYBOARD_REPORT_KEYS; i++) { debug_hex8(report->keys[i]); dprintf(" "); }
 | 
				
			||||||
    dprintf(" mods: "); debug_hex8(report->mods);
 | 
					    dprintf(" mods: "); debug_hex8(report->mods);
 | 
				
			||||||
    dprintf(" reserved: "); debug_hex8(report->reserved); 
 | 
					    dprintf(" reserved: "); debug_hex8(report->reserved); 
 | 
				
			||||||
    dprintf("\n");
 | 
					    dprintf("\n");
 | 
				
			||||||
| 
						 | 
					@ -99,7 +99,7 @@ static void send_keyboard(report_keyboard_t *report)
 | 
				
			||||||
    bluefruit_trace_header();
 | 
					    bluefruit_trace_header();
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
    bluefruit_serial_send(0xFD);
 | 
					    bluefruit_serial_send(0xFD);
 | 
				
			||||||
    for (uint8_t i = 0; i < REPORT_SIZE; i++) {
 | 
					    for (uint8_t i = 0; i < KEYBOARD_REPORT_SIZE; i++) {
 | 
				
			||||||
        bluefruit_serial_send(report->raw[i]);
 | 
					        bluefruit_serial_send(report->raw[i]);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
#ifdef BLUEFRUIT_TRACE_SERIAL   
 | 
					#ifdef BLUEFRUIT_TRACE_SERIAL   
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -104,7 +104,7 @@ int main(void)
 | 
				
			||||||
        dprintf("Starting main loop");
 | 
					        dprintf("Starting main loop");
 | 
				
			||||||
        while (1) {
 | 
					        while (1) {
 | 
				
			||||||
            while (suspend) {
 | 
					            while (suspend) {
 | 
				
			||||||
                suspend_power_down();
 | 
					                suspend_power_down(WDTO_120MS);
 | 
				
			||||||
                if (remote_wakeup && suspend_wakeup_condition()) {
 | 
					                if (remote_wakeup && suspend_wakeup_condition()) {
 | 
				
			||||||
                    usb_remote_wakeup();
 | 
					                    usb_remote_wakeup();
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -24,6 +24,7 @@
 | 
				
			||||||
#include <stdbool.h>
 | 
					#include <stdbool.h>
 | 
				
			||||||
#include <avr/io.h>
 | 
					#include <avr/io.h>
 | 
				
			||||||
#include <avr/interrupt.h>
 | 
					#include <avr/interrupt.h>
 | 
				
			||||||
 | 
					#include <avr/wdt.h>
 | 
				
			||||||
#include <util/delay.h>
 | 
					#include <util/delay.h>
 | 
				
			||||||
#include "keyboard.h"
 | 
					#include "keyboard.h"
 | 
				
			||||||
#include "usb.h"
 | 
					#include "usb.h"
 | 
				
			||||||
| 
						 | 
					@ -60,7 +61,7 @@ int main(void)
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
    while (1) {
 | 
					    while (1) {
 | 
				
			||||||
        while (suspend) {
 | 
					        while (suspend) {
 | 
				
			||||||
            suspend_power_down();
 | 
					            suspend_power_down(WDTO_120MS);
 | 
				
			||||||
            if (remote_wakeup && suspend_wakeup_condition()) {
 | 
					            if (remote_wakeup && suspend_wakeup_condition()) {
 | 
				
			||||||
                usb_remote_wakeup();
 | 
					                usb_remote_wakeup();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -74,7 +74,7 @@ void usb_keyboard_print_report(report_keyboard_t *report)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if (!debug_keyboard) return;
 | 
					    if (!debug_keyboard) return;
 | 
				
			||||||
    print("keys: ");
 | 
					    print("keys: ");
 | 
				
			||||||
    for (int i = 0; i < REPORT_KEYS; i++) { phex(report->keys[i]); print(" "); }
 | 
					    for (int i = 0; i < KEYBOARD_REPORT_KEYS; i++) { phex(report->keys[i]); print(" "); }
 | 
				
			||||||
    print(" mods: "); phex(report->mods); print("\n");
 | 
					    print(" mods: "); phex(report->mods); print("\n");
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue