Merge branch 'master' of https://github.com/smasher816/controller into smasher816-master
This commit is contained in:
commit
96e785b571
46 changed files with 3255 additions and 3255 deletions
|
|
@ -57,7 +57,7 @@ void analog_init(void)
|
|||
uint32_t num;
|
||||
|
||||
VREF_TRM = 0x60;
|
||||
VREF_SC = 0xE1; // enable 1.2 volt ref
|
||||
VREF_SC = 0xE1; // enable 1.2 volt ref
|
||||
|
||||
if (analog_config_bits == 8) {
|
||||
ADC0_CFG1 = ADC_CFG1_24MHZ + ADC_CFG1_MODE(0);
|
||||
|
|
|
|||
|
|
@ -69,11 +69,11 @@ char scanCLIDictName[] = "ADC Test Module Commands";
|
|||
const CLIDictItem scanCLIDict[] = {
|
||||
#if defined(_mk20dx128_) || defined(_mk20dx256_) || defined(_mk20dx256vlh7_) // ARM
|
||||
{ "adc", "Read the specified number of values from the ADC at the given pin: <pin> [# of reads]"
|
||||
NL "\t\t See \033[35mLib/pin_map.teensy3\033[0m for ADC0 channel number.", cliFunc_adc },
|
||||
NL "\t\t See \033[35mLib/pin_map.teensy3\033[0m for ADC0 channel number.", cliFunc_adc },
|
||||
{ "adcInit", "Intialize/calibrate ADC: <ADC Resolution> <Vref> <Hardware averaging samples>"
|
||||
NL "\t\tADC Resolution -> 8, 10, 12, 16 (bit)"
|
||||
NL "\t\t Vref -> 0 (1.2 V), 1 (External)"
|
||||
NL "\t\tHw Avg Samples -> 0 (disabled), 4, 8, 16, 32", cliFunc_adcInit },
|
||||
NL "\t\tADC Resolution -> 8, 10, 12, 16 (bit)"
|
||||
NL "\t\t Vref -> 0 (1.2 V), 1 (External)"
|
||||
NL "\t\tHw Avg Samples -> 0 (disabled), 4, 8, 16, 32", cliFunc_adcInit },
|
||||
#endif
|
||||
#if defined(_mk20dx256_) || defined(_mk20dx256vlh7_) // DAC is only supported on Teensy 3.1
|
||||
{ "dac", "Set DAC output value, from 0 to 4095 (1/4096 Vref to Vref).", cliFunc_dac },
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
/* Copyright (C) 2011 by Jacob Alexander
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
|
|
@ -50,7 +50,7 @@ static const uint8_t matrix_pinout[][MAX_ROW_SIZE + 1] = {
|
|||
// Just layout the matrix by rows and columns
|
||||
// Usually you'll want to set the scanMode above to scanDual or scanCol_powrRow/scanRow_powrCol
|
||||
// The mode allows for optimization in the kind of scanning algorithms that are done
|
||||
//
|
||||
//
|
||||
// The key numbers are used to translate into the keymap table (array) (and always start from 1, not 0).
|
||||
// Thus if a row doesn't use all the key positions, you can denote it as 0, which will be ignored/skipped on each scan
|
||||
// See the keymap.h file for the various preconfigured arrays.
|
||||
|
|
|
|||
|
|
@ -609,7 +609,7 @@ void recovery( uint8_t on )
|
|||
PORTD &= ~D_MASK;
|
||||
PORTE &= ~E_MASK;
|
||||
|
||||
DDRB |= (1 << RECOVERY_SINK); // SINK pull
|
||||
DDRB |= (1 << RECOVERY_SINK); // SINK pull
|
||||
PORTB |= (1 << RECOVERY_CONTROL);
|
||||
PORTB |= (1 << RECOVERY_SOURCE); // SOURCE high
|
||||
DDRB |= (1 << RECOVERY_SOURCE);
|
||||
|
|
@ -619,7 +619,7 @@ void recovery( uint8_t on )
|
|||
PORTB &= ~(1 << RECOVERY_CONTROL);
|
||||
DDRB &= ~(1 << RECOVERY_SOURCE);
|
||||
PORTB &= ~(1 << RECOVERY_SOURCE); // SOURCE low
|
||||
DDRB &= ~(1 << RECOVERY_SINK); // SINK high-imp
|
||||
DDRB &= ~(1 << RECOVERY_SINK); // SINK high-imp
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ inline void Scan_setup()
|
|||
|
||||
|
||||
// Setup the the USART interface for keyboard data input
|
||||
|
||||
|
||||
// Setup baud rate
|
||||
// 16 MHz / ( 16 * Baud ) = UBRR
|
||||
// Baud <- 1200 as per the spec (see datasheet archives), rounding to 1200.1 (as that's as accurate as the timer can be)
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ ISR(USART1_RX_vect)
|
|||
inline void Scan_setup()
|
||||
{
|
||||
// Setup the the USART interface for keyboard data input
|
||||
|
||||
|
||||
// Setup baud rate
|
||||
// 16 MHz / ( 16 * Baud ) = UBRR
|
||||
// Baud: 4817 -> 16 MHz / ( 16 * 4817 ) = 207.5981
|
||||
|
|
@ -200,7 +200,7 @@ void removeKeyValue( uint8_t keyValue )
|
|||
}
|
||||
}
|
||||
|
||||
// Send data
|
||||
// Send data
|
||||
uint8_t Scan_sendData( uint8_t dataPayload )
|
||||
{
|
||||
// Debug
|
||||
|
|
|
|||
|
|
@ -239,7 +239,7 @@ inline uint8_t Scan_loop()
|
|||
return 0;
|
||||
}
|
||||
|
||||
// Send data
|
||||
// Send data
|
||||
uint8_t Scan_sendData( uint8_t dataPayload )
|
||||
{
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
/* Copyright (C) 2011 by Jacob Alexander
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
/* Copyright (C) 2012 by Jacob Alexander
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@ ISR(USART1_RX_vect)
|
|||
sei(); // Re-enable Interrupts
|
||||
}
|
||||
|
||||
// Send data
|
||||
// Send data
|
||||
//
|
||||
// Keyboard Input Guide for Micro Switch 8304
|
||||
// 0xBX is for LED F1,F2,Over Type,Lock
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ inline void Scan_setup()
|
|||
// Configured as a Pull-up Input - This pin "can" be read as well, it will go to GND when the "Power On" switch is pressed, and will read ~5V otherwise
|
||||
// XXX Currently not used by the controller
|
||||
POWR_DDR &= ~(1 << POWR_POS);
|
||||
POWR_PORT |= (1 << POWR_POS);
|
||||
POWR_PORT |= (1 << POWR_POS);
|
||||
|
||||
// Reset the keyboard before scanning, we might be in a wierd state
|
||||
scan_resetKeyboard();
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
// ----- Macros -----
|
||||
|
||||
// -- pinSetup Macros --
|
||||
#define REG_SET(reg) reg |= (1 << ( matrix[row*(MAX_ROW_SIZE+1)+col] % 10 ) ) // Modulo 10 for the define offset for each pin set 12 or 32 -> shift of 2
|
||||
#define REG_SET(reg) reg |= (1 << ( matrix[row*(MAX_ROW_SIZE+1)+col] % 10 ) ) // Modulo 10 for the define offset for each pin set 12 or 32 -> shift of 2
|
||||
#define REG_UNSET(reg) reg &= ~(1 << ( matrix[row*(MAX_ROW_SIZE+1)+col] % 10 ) )
|
||||
|
||||
#define PIN_SET(pin,scan,direction) \
|
||||
|
|
@ -57,7 +57,7 @@
|
|||
case scanDual: \
|
||||
REG_SET(port##pin); break; \
|
||||
case scanCol_powrRow: REG_UNSET(ddr##pin); REG_UNSET(DDR##pin); \
|
||||
REG_SET(port##pin); REG_SET(PORT##pin); break; \
|
||||
REG_SET(port##pin); REG_SET(PORT##pin); break; \
|
||||
case powrRow: break; \
|
||||
case powrCol: REG_SET(ddr##pin); REG_SET(DDR##pin); \
|
||||
REG_SET(port##pin); REG_SET(PORT##pin); break; \
|
||||
|
|
@ -72,9 +72,9 @@
|
|||
case scanDual: \
|
||||
REG_SET(port##pin); break; \
|
||||
case scanCol_powrRow: REG_SET(ddr##pin); REG_SET(DDR##pin); \
|
||||
REG_UNSET(port##pin); REG_UNSET(PORT##pin); break; \
|
||||
REG_UNSET(port##pin); REG_UNSET(PORT##pin); break; \
|
||||
case powrRow: REG_SET(ddr##pin); REG_SET(DDR##pin); \
|
||||
REG_SET(port##pin); REG_SET(PORT##pin); break; \
|
||||
REG_SET(port##pin); REG_SET(PORT##pin); break; \
|
||||
case powrCol: break; \
|
||||
} \
|
||||
break
|
||||
|
|
@ -261,7 +261,7 @@ void matrix_pinSetup( uint8_t *matrix, uint8_t scanType )
|
|||
if ( showDebug == 0 ) // Only show once
|
||||
{
|
||||
matrix_debugPins();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Scans the given matrix determined by the scanMode method
|
||||
|
|
@ -380,7 +380,7 @@ inline void matrix_scan( uint8_t *matrix, uint8_t *detectArray )
|
|||
_delay_us( 1 );
|
||||
col = 1;
|
||||
row = 1;
|
||||
for ( ; col < (MAX_ROW_SIZE+1); col++ ) for ( ; row < (MAX_COL_SIZE+1); row++ )
|
||||
for ( ; col < (MAX_ROW_SIZE+1); col++ ) for ( ; row < (MAX_COL_SIZE+1); row++ )
|
||||
{
|
||||
// Scan over the pins for each of the rows, and using the pin alias to determine which pin to set
|
||||
// (e.g. / 10 is for the pin name (A,B,C,etc.) and % 10 is for the position of the pin (A1,A2,etc.))
|
||||
|
|
@ -404,4 +404,4 @@ inline void matrix_scan( uint8_t *matrix, uint8_t *detectArray )
|
|||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@
|
|||
// NOTE: Highest Bit: Valid keypress (0x80 is valid keypress)
|
||||
// Other Bits: Pressed state sample counter
|
||||
extern uint8_t KeyIndex_Array [KEYBOARD_KEYS + 1];
|
||||
static const uint8_t KeyIndex_Size = KEYBOARD_KEYS;
|
||||
static const uint8_t KeyIndex_Size = KEYBOARD_KEYS;
|
||||
|
||||
extern volatile uint8_t KeyIndex_Buffer[KEYBOARD_BUFFER];
|
||||
extern volatile uint8_t KeyIndex_BufferUsed;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue