Convert some AVR GPIO operations to macros (#23424)
This commit is contained in:
parent
7220715dd1
commit
61c7c1f74c
@ -25,16 +25,14 @@ bool led_update_kb(led_t led_state)
|
||||
if (res) {
|
||||
if (led_state.caps_lock) {
|
||||
// output low
|
||||
DDRB |= (1<<0);
|
||||
PORTB &= ~(1<<0);
|
||||
DDRD |= (1<<5);
|
||||
PORTD &= ~(1<<5);
|
||||
gpio_set_pin_output(B0);
|
||||
gpio_write_pin_low(B0);
|
||||
gpio_set_pin_output(D5);
|
||||
gpio_write_pin_low(D5);
|
||||
} else {
|
||||
// Hi-Z
|
||||
DDRB &= ~(1<<0);
|
||||
PORTB &= ~(1<<0);
|
||||
DDRD &= ~(1<<5);
|
||||
PORTD &= ~(1<<5);
|
||||
gpio_set_pin_input(B0);
|
||||
gpio_set_pin_input(D5);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
@ -126,14 +126,18 @@ void matrix_print(void)
|
||||
static void init_cols(void)
|
||||
{
|
||||
// Input with pull-up(DDR:0, PORT:1)
|
||||
DDRF &= ~(1<<4 | 1<<5 | 1<<6 | 1<<7);
|
||||
PORTF |= (1<<4 | 1<<5 | 1<<6 | 1<<7);
|
||||
DDRE &= ~(1<<6);
|
||||
PORTE |= (1<<6);
|
||||
DDRD &= ~(1<<7);
|
||||
PORTD |= (1<<7);
|
||||
DDRB &= ~(1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<5 | 1<<6);
|
||||
PORTB |= (1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<5 | 1<<6);
|
||||
gpio_set_pin_input_high(F4);
|
||||
gpio_set_pin_input_high(F5);
|
||||
gpio_set_pin_input_high(F6);
|
||||
gpio_set_pin_input_high(F7);
|
||||
gpio_set_pin_input_high(E6);
|
||||
gpio_set_pin_input_high(D7);
|
||||
gpio_set_pin_input_high(B1);
|
||||
gpio_set_pin_input_high(B2);
|
||||
gpio_set_pin_input_high(B3);
|
||||
gpio_set_pin_input_high(B4);
|
||||
gpio_set_pin_input_high(B5);
|
||||
gpio_set_pin_input_high(B6);
|
||||
}
|
||||
|
||||
static matrix_row_t read_cols(void)
|
||||
@ -160,10 +164,10 @@ static matrix_row_t read_cols(void)
|
||||
static void unselect_rows(void)
|
||||
{
|
||||
// Hi-Z(DDR:0, PORT:0) to unselect
|
||||
DDRD &= ~0b00010011;
|
||||
PORTD &= ~0b00010011;
|
||||
DDRC &= ~0b01000000;
|
||||
PORTC &= ~0b01000000;
|
||||
gpio_set_pin_input(C6);
|
||||
gpio_set_pin_input(D0);
|
||||
gpio_set_pin_input(D1);
|
||||
gpio_set_pin_input(D4);
|
||||
}
|
||||
|
||||
static void select_row(uint8_t row)
|
||||
@ -171,20 +175,20 @@ static void select_row(uint8_t row)
|
||||
// Output low(DDR:1, PORT:0) to select
|
||||
switch (row) {
|
||||
case 0:
|
||||
DDRD |= (1<<1);
|
||||
PORTD &= ~(1<<1);
|
||||
gpio_set_pin_output(D1);
|
||||
gpio_write_pin_low(D1);
|
||||
break;
|
||||
case 1:
|
||||
DDRD |= (1<<0);
|
||||
PORTD &= ~(1<<0);
|
||||
gpio_set_pin_output(D0);
|
||||
gpio_write_pin_low(D0);
|
||||
break;
|
||||
case 2:
|
||||
DDRD |= (1<<4);
|
||||
PORTD &= ~(1<<4);
|
||||
gpio_set_pin_output(D4);
|
||||
gpio_write_pin_low(D4);
|
||||
break;
|
||||
case 3:
|
||||
DDRC |= (1<<6);
|
||||
PORTC &= ~(1<<6);
|
||||
gpio_set_pin_output(C6);
|
||||
gpio_write_pin_low(C6);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -65,8 +65,8 @@ void matrix_init(void)
|
||||
#endif
|
||||
|
||||
// 85 REST
|
||||
DDRD |= _BV(PD7);
|
||||
PORTD |= _BV(PD7);
|
||||
gpio_set_pin_output(D7);
|
||||
gpio_write_pin_high(D7);
|
||||
|
||||
// initialize row and col
|
||||
init_rows();
|
||||
@ -143,36 +143,35 @@ static void init_cols(void)
|
||||
DDRD &= 0b00011100;
|
||||
PORTD |= 0b11100011;
|
||||
|
||||
DDRB &= ~(_BV(PB6) | _BV(PB7)| _BV(PB0));
|
||||
PORTB |= (_BV(PB6) | _BV(PB7)| _BV(PB0));
|
||||
gpio_set_pin_input_high(B0);
|
||||
gpio_set_pin_input_high(B6);
|
||||
gpio_set_pin_input_high(B7);
|
||||
|
||||
DDRE &= ~_BV(PE6);
|
||||
PORTE |= _BV(PE6);
|
||||
gpio_set_pin_input_high(E6);
|
||||
|
||||
DDRC &= ~_BV(PC7);
|
||||
PORTC |= _BV(PC7);
|
||||
gpio_set_pin_input_high(C7);
|
||||
|
||||
}
|
||||
|
||||
static matrix_row_t read_cols(void)
|
||||
{
|
||||
|
||||
return (PINF&_BV(PF7) ? 0 : (1<<0)) |
|
||||
(PINF&_BV(PF6) ? 0 : (1<<1)) |
|
||||
(PINF&_BV(PF5) ? 0 : (1<<2)) |
|
||||
(PINF&_BV(PF4) ? 0 : (1<<3)) |
|
||||
(PINF&_BV(PF1) ? 0 : (1<<4)) |
|
||||
(PINF&_BV(PF0) ? 0 : (1<<5)) |
|
||||
(PINE&_BV(PE6) ? 0 : (1<<6)) |
|
||||
(PIND&_BV(PD7) ? 0 : (1<<7)) |
|
||||
(PIND&_BV(PD6) ? 0 : (1<<8)) |
|
||||
(PIND&_BV(PD5) ? 0 : (1<<9)) |
|
||||
(PIND&_BV(PD1) ? 0 : (1<<10)) |
|
||||
(PIND&_BV(PD0) ? 0 : (1<<11)) |
|
||||
(PINB&_BV(PB7) ? 0 : (1<<12)) |
|
||||
(PINB&_BV(PB6) ? 0 : (1<<13)) |
|
||||
(PINB&_BV(PB0) ? 0 : (1<<14)) |
|
||||
(PINC&_BV(PC7) ? 0 : (1<<15));
|
||||
return (gpio_read_pin(F7) ? 0 : (1<<0)) |
|
||||
(gpio_read_pin(F6) ? 0 : (1<<1)) |
|
||||
(gpio_read_pin(F5) ? 0 : (1<<2)) |
|
||||
(gpio_read_pin(F4) ? 0 : (1<<3)) |
|
||||
(gpio_read_pin(F1) ? 0 : (1<<4)) |
|
||||
(gpio_read_pin(F0) ? 0 : (1<<5)) |
|
||||
(gpio_read_pin(E6) ? 0 : (1<<6)) |
|
||||
(gpio_read_pin(D7) ? 0 : (1<<7)) |
|
||||
(gpio_read_pin(D6) ? 0 : (1<<8)) |
|
||||
(gpio_read_pin(D5) ? 0 : (1<<9)) |
|
||||
(gpio_read_pin(D1) ? 0 : (1<<10)) |
|
||||
(gpio_read_pin(D0) ? 0 : (1<<11)) |
|
||||
(gpio_read_pin(B7) ? 0 : (1<<12)) |
|
||||
(gpio_read_pin(B6) ? 0 : (1<<13)) |
|
||||
(gpio_read_pin(B0) ? 0 : (1<<14)) |
|
||||
(gpio_read_pin(C7) ? 0 : (1<<15));
|
||||
}
|
||||
|
||||
/* Row pin configuration
|
||||
@ -184,21 +183,23 @@ static matrix_row_t read_cols(void)
|
||||
|
||||
static void init_rows(void)
|
||||
{
|
||||
DDRB |= (1<<PB1 | 1<<PB2 | 1<<PB3);
|
||||
gpio_set_pin_input(B1);
|
||||
gpio_set_pin_input(B2);
|
||||
gpio_set_pin_input(B3);
|
||||
}
|
||||
|
||||
static void unselect_rows(void)
|
||||
{
|
||||
// Hi-Z(DDR:0, PORT:0) to unselect
|
||||
PORTB |= (1<<PB1);
|
||||
PORTB |= (1<<PB2);
|
||||
PORTB |= (1<<PB3);
|
||||
gpio_write_pin_high(B1);
|
||||
gpio_write_pin_high(B2);
|
||||
gpio_write_pin_high(B3);
|
||||
}
|
||||
|
||||
static void select_row(uint8_t row)
|
||||
{
|
||||
// Output low(DDR:1, PORT:0) to select
|
||||
(row & (1<<0)) ? (PORTB |= (1<<PB3)) : (PORTB &= ~(1<<PB3));
|
||||
(row & (1<<1)) ? (PORTB |= (1<<PB2)) : (PORTB &= ~(1<<PB2));
|
||||
(row & (1<<2)) ? (PORTB |= (1<<PB1)) : (PORTB &= ~(1<<PB1));
|
||||
gpio_write_pin(B3, row & (1<<0));
|
||||
gpio_write_pin(B2, row & (1<<1));
|
||||
gpio_write_pin(B1, row & (1<<2));
|
||||
}
|
||||
|
@ -54,15 +54,13 @@ void matrix_init_kb(void) {
|
||||
TCCR1B = 0b00001001; // set and configure fast PWM
|
||||
|
||||
// (tied to Vcc for hardware convenience)
|
||||
DDRB &= ~(1<<4); // set B(4) as input
|
||||
PORTB &= ~(1<<4); // set B(4) internal pull-up disabled
|
||||
gpio_set_pin_input(B4); // set B(4) as input, internal pull-up disabled
|
||||
|
||||
// unused pins - D4, D5, E6
|
||||
// set as input with internal pull-up enabled
|
||||
DDRD &= ~(1<<5 | 1<<4);
|
||||
DDRE &= ~(1<<6);
|
||||
PORTD |= (1<<5 | 1<<4);
|
||||
PORTE |= (1<<6);
|
||||
gpio_set_pin_input_high(D4);
|
||||
gpio_set_pin_input_high(D5);
|
||||
gpio_set_pin_input_high(E6);
|
||||
|
||||
keyboard_config.raw = eeconfig_read_kb();
|
||||
bajjak_led_all_set((uint8_t)keyboard_config.led_level * 255 / 4 );
|
||||
|
@ -2,19 +2,56 @@
|
||||
|
||||
#include "quantum.h"
|
||||
|
||||
inline void sixshooter_led_0_on(void) { DDRB |= (1<<6); PORTB |= (1<<6); }
|
||||
inline void sixshooter_led_1_on(void) { DDRC |= (1<<7); PORTC |= (1<<7); }
|
||||
inline void sixshooter_led_2_on(void) { DDRD |= (1<<0); PORTD |= (1<<0); }
|
||||
inline void sixshooter_led_3_on(void) { DDRB |= (1<<5); PORTB |= (1<<5); }
|
||||
inline void sixshooter_led_4_on(void) { DDRD |= (1<<7); PORTD |= (1<<7); }
|
||||
inline void sixshooter_led_5_on(void) { DDRB |= (1<<7); PORTB |= (1<<7); }
|
||||
#define SIXSHOOTER_LED_0_PIN B6
|
||||
#define SIXSHOOTER_LED_1_PIN C7
|
||||
#define SIXSHOOTER_LED_2_PIN D0
|
||||
#define SIXSHOOTER_LED_3_PIN B5
|
||||
#define SIXSHOOTER_LED_4_PIN D7
|
||||
#define SIXSHOOTER_LED_5_PIN B7
|
||||
|
||||
inline void sixshooter_led_0_off(void) { DDRB &= ~(1<<6); PORTB &= ~(1<<6); }
|
||||
inline void sixshooter_led_1_off(void) { DDRC &= ~(1<<7); PORTC &= ~(1<<7); }
|
||||
inline void sixshooter_led_2_off(void) { DDRD &= ~(1<<0); PORTD &= ~(1<<0); }
|
||||
inline void sixshooter_led_3_off(void) { DDRB &= ~(1<<5); PORTB &= ~(1<<5); }
|
||||
inline void sixshooter_led_4_off(void) { DDRD &= ~(1<<7); PORTD &= ~(1<<7); }
|
||||
inline void sixshooter_led_5_off(void) { DDRB &= ~(1<<7); PORTB &= ~(1<<7); }
|
||||
inline void sixshooter_led_0_on(void) {
|
||||
gpio_set_pin_output(SIXSHOOTER_LED_0_PIN);
|
||||
gpio_write_pin_high(SIXSHOOTER_LED_0_PIN);
|
||||
}
|
||||
inline void sixshooter_led_1_on(void) {
|
||||
gpio_set_pin_output(SIXSHOOTER_LED_1_PIN);
|
||||
gpio_write_pin_high(SIXSHOOTER_LED_1_PIN);
|
||||
}
|
||||
inline void sixshooter_led_2_on(void) {
|
||||
gpio_set_pin_output(SIXSHOOTER_LED_2_PIN);
|
||||
gpio_write_pin_high(SIXSHOOTER_LED_2_PIN);
|
||||
}
|
||||
inline void sixshooter_led_3_on(void) {
|
||||
gpio_set_pin_output(SIXSHOOTER_LED_3_PIN);
|
||||
gpio_write_pin_high(SIXSHOOTER_LED_3_PIN);
|
||||
}
|
||||
inline void sixshooter_led_4_on(void) {
|
||||
gpio_set_pin_output(SIXSHOOTER_LED_4_PIN);
|
||||
gpio_write_pin_high(SIXSHOOTER_LED_4_PIN);
|
||||
}
|
||||
inline void sixshooter_led_5_on(void) {
|
||||
gpio_set_pin_output(SIXSHOOTER_LED_5_PIN);
|
||||
gpio_write_pin_high(SIXSHOOTER_LED_5_PIN);
|
||||
}
|
||||
|
||||
inline void sixshooter_led_0_off(void) {
|
||||
gpio_set_pin_input(SIXSHOOTER_LED_0_PIN);
|
||||
}
|
||||
inline void sixshooter_led_1_off(void) {
|
||||
gpio_set_pin_input(SIXSHOOTER_LED_1_PIN);
|
||||
}
|
||||
inline void sixshooter_led_2_off(void) {
|
||||
gpio_set_pin_input(SIXSHOOTER_LED_2_PIN);
|
||||
}
|
||||
inline void sixshooter_led_3_off(void) {
|
||||
gpio_set_pin_input(SIXSHOOTER_LED_3_PIN);
|
||||
}
|
||||
inline void sixshooter_led_4_off(void) {
|
||||
gpio_set_pin_input(SIXSHOOTER_LED_4_PIN);
|
||||
}
|
||||
inline void sixshooter_led_5_off(void) {
|
||||
gpio_set_pin_input(SIXSHOOTER_LED_5_PIN);
|
||||
}
|
||||
|
||||
inline void sixshooter_led_all_on(void) {
|
||||
sixshooter_led_0_on();
|
||||
|
@ -4,8 +4,8 @@ void matrix_init_kb(void) {
|
||||
// put your keyboard start-up code here
|
||||
// runs once when the firmware starts up
|
||||
// Turn status LED on
|
||||
DDRD |= (1<<6);
|
||||
PORTD |= (1<<6);
|
||||
gpio_set_pin_output(D6);
|
||||
gpio_write_pin_high(D6);
|
||||
|
||||
matrix_init_user();
|
||||
}
|
||||
|
@ -4,26 +4,26 @@
|
||||
void backlight_init_ports(void) {
|
||||
print("init_backlight_pin()\n");
|
||||
// Set our LED pins as output
|
||||
DDRD |= (1<<6); // Esc
|
||||
DDRB |= (1<<7); // Page Up
|
||||
DDRD |= (1<<4); // Arrows
|
||||
gpio_set_pin_output(D6); // Esc
|
||||
gpio_set_pin_output(B7); // Page Up
|
||||
gpio_set_pin_output(D4); // Arrows
|
||||
|
||||
// Set our LED pins low
|
||||
PORTD &= ~(1<<6); // Esc
|
||||
PORTB &= ~(1<<7); // Page Up
|
||||
PORTD &= ~(1<<4); // Arrows
|
||||
gpio_write_pin_low(D6); // Esc
|
||||
gpio_write_pin_low(B7); // Page Up
|
||||
gpio_write_pin_low(D4); // Arrows
|
||||
}
|
||||
|
||||
void backlight_set(uint8_t level) {
|
||||
if ( level == 0 ) {
|
||||
// Turn off light
|
||||
PORTD |= (1<<6); // Esc
|
||||
PORTB |= (1<<7); // Page Up
|
||||
PORTD |= (1<<4); // Arrows
|
||||
gpio_write_pin_high(D6); // Esc
|
||||
gpio_write_pin_high(B7); // Page Up
|
||||
gpio_write_pin_high(D4); // Arrows
|
||||
} else {
|
||||
// Turn on light
|
||||
PORTD &= ~(1<<6); // Esc
|
||||
PORTB &= ~(1<<7); // Page Up
|
||||
PORTD &= ~(1<<4); // Arrows
|
||||
gpio_write_pin_low(D6); // Esc
|
||||
gpio_write_pin_low(B7); // Page Up
|
||||
gpio_write_pin_low(D4); // Arrows
|
||||
}
|
||||
}
|
||||
|
@ -4,26 +4,26 @@
|
||||
void backlight_init_ports(void) {
|
||||
print("init_backlight_pin()\n");
|
||||
// Set our LED pins as output
|
||||
DDRD |= (1<<6); // Esc
|
||||
DDRB |= (1<<7); // Page Up
|
||||
DDRD |= (1<<4); // Arrows
|
||||
gpio_set_pin_output(D6); // Esc
|
||||
gpio_set_pin_output(B7); // Page Up
|
||||
gpio_set_pin_output(D4); // Arrows
|
||||
|
||||
// Set our LED pins low
|
||||
PORTD &= ~(1<<6); // Esc
|
||||
PORTB &= ~(1<<7); // Page Up
|
||||
PORTD &= ~(1<<4); // Arrows
|
||||
gpio_write_pin_low(D6); // Esc
|
||||
gpio_write_pin_low(B7); // Page Up
|
||||
gpio_write_pin_low(D4); // Arrows
|
||||
}
|
||||
|
||||
void backlight_set(uint8_t level) {
|
||||
if ( level == 0 ) {
|
||||
// Turn off light
|
||||
PORTD |= (1<<6); // Esc
|
||||
PORTB |= (1<<7); // Page Up
|
||||
PORTD |= (1<<4); // Arrows
|
||||
gpio_write_pin_high(D6); // Esc
|
||||
gpio_write_pin_high(B7); // Page Up
|
||||
gpio_write_pin_high(D4); // Arrows
|
||||
} else {
|
||||
// Turn on light
|
||||
PORTD &= ~(1<<6); // Esc
|
||||
PORTB &= ~(1<<7); // Page Up
|
||||
PORTD &= ~(1<<4); // Arrows
|
||||
gpio_write_pin_low(D6); // Esc
|
||||
gpio_write_pin_low(B7); // Page Up
|
||||
gpio_write_pin_low(D4); // Arrows
|
||||
}
|
||||
}
|
||||
|
@ -4,26 +4,26 @@
|
||||
void backlight_init_ports(void) {
|
||||
print("init_backlight_pin()\n");
|
||||
// Set our LED pins as output
|
||||
DDRD |= (1<<0); // Esc
|
||||
DDRD |= (1<<4); // Page Up
|
||||
DDRD |= (1<<1); // Arrows
|
||||
gpio_set_pin_output(D0); // Esc
|
||||
gpio_set_pin_output(D4); // Page Up
|
||||
gpio_set_pin_output(D1); // Arrows
|
||||
|
||||
// Set our LED pins low
|
||||
PORTD &= ~(1<<0); // Esc
|
||||
PORTD &= ~(1<<4); // Page Up
|
||||
PORTD &= ~(1<<1); // Arrows
|
||||
gpio_write_pin_low(D0); // Esc
|
||||
gpio_write_pin_low(D4); // Page Up
|
||||
gpio_write_pin_low(D1); // Arrows
|
||||
}
|
||||
|
||||
void backlight_set(uint8_t level) {
|
||||
if ( level == 0 ) {
|
||||
// Turn off light
|
||||
PORTD |= (1<<0); // Esc
|
||||
PORTD |= (1<<4); // Page Up
|
||||
PORTD |= (1<<1); // Arrows
|
||||
gpio_write_pin_high(D0); // Esc
|
||||
gpio_write_pin_high(D4); // Page Up
|
||||
gpio_write_pin_high(D1); // Arrows
|
||||
} else {
|
||||
// Turn on light
|
||||
PORTD &= ~(1<<0); // Esc
|
||||
PORTD &= ~(1<<4); // Page Up
|
||||
PORTD &= ~(1<<1); // Arrows
|
||||
gpio_write_pin_low(D0); // Esc
|
||||
gpio_write_pin_low(D4); // Page Up
|
||||
gpio_write_pin_low(D1); // Arrows
|
||||
}
|
||||
}
|
||||
|
@ -82,17 +82,17 @@ void matrix_scan_user(void) {
|
||||
// switch, and then into the diode, then into one of the columns into the
|
||||
// matrix. the reset pin can be used to reset the entire counter.
|
||||
|
||||
#define RESET _BV(PB0)
|
||||
#define SCLK _BV(PB1)
|
||||
#define SDATA _BV(PB3)
|
||||
#define LED _BV(PD6)
|
||||
#define HP_46010A_RESET_PIN B0
|
||||
#define HP_46010A_SCLK_PIN B1
|
||||
#define HP_46010A_SDATA_PIN B3
|
||||
#define HP_46010A_LED_PIN D6
|
||||
|
||||
inline
|
||||
static
|
||||
void SCLK_increment(void) {
|
||||
PORTB &= ~SCLK ;
|
||||
gpio_write_pin_low(HP_46010A_SCLK_PIN);
|
||||
_delay_us( 4 ) ; // make sure the line is stable
|
||||
PORTB |= SCLK ;
|
||||
gpio_write_pin_high(HP_46010A_SCLK_PIN);
|
||||
_delay_us( 4 ) ;
|
||||
|
||||
return ;
|
||||
@ -101,9 +101,9 @@ void SCLK_increment(void) {
|
||||
inline
|
||||
static
|
||||
void Matrix_Reset(void) {
|
||||
PORTB |= RESET ;
|
||||
gpio_write_pin_high(HP_46010A_RESET_PIN);
|
||||
_delay_us( 4 ) ; // make sure the line is stable
|
||||
PORTB &= ~RESET ;
|
||||
gpio_write_pin_low(HP_46010A_RESET_PIN);
|
||||
|
||||
return ;
|
||||
}
|
||||
@ -116,7 +116,7 @@ uint8_t Matrix_ReceiveByte (void) {
|
||||
for ( uint8_t bit = 0; bit < MATRIX_COLS; ++bit ) {
|
||||
// toggle the clock
|
||||
SCLK_increment();
|
||||
temp = (PINB & SDATA) << 4 ;
|
||||
temp = gpio_read_pin(HP_46010A_SDATA_PIN) << 4 ;
|
||||
received |= temp >> bit ;
|
||||
}
|
||||
|
||||
@ -138,18 +138,19 @@ void Matrix_ThrowByte(void) {
|
||||
void matrix_init (void) {
|
||||
// debug_matrix = 1;
|
||||
// PB0 (SS) and PB1 (SCLK) set to outputs
|
||||
DDRB |= RESET | SCLK ;
|
||||
gpio_set_pin_output(HP_46010A_RESET_PIN);
|
||||
gpio_set_pin_output(HP_46010A_SCLK_PIN);
|
||||
// PB2, is unused, and PB3 is our serial input
|
||||
DDRB &= ~SDATA ;
|
||||
gpio_set_pin_input(HP_46010A_SDATA_PIN);
|
||||
|
||||
// SS is reset for this board, and is active High
|
||||
// SCLK is the serial clock and is active High
|
||||
PORTB &= ~RESET ;
|
||||
PORTB |= SCLK ;
|
||||
gpio_write_pin_low(HP_46010A_RESET_PIN);
|
||||
gpio_write_pin_high(HP_46010A_SCLK_PIN);
|
||||
|
||||
// led pin
|
||||
DDRD |= LED ;
|
||||
PORTD &= ~LED ;
|
||||
gpio_set_pin_output(HP_46010A_LED_PIN);
|
||||
gpio_write_pin_low(HP_46010A_LED_PIN);
|
||||
|
||||
matrix_init_kb();
|
||||
|
||||
|
@ -74,8 +74,8 @@ uint8_t matrix_cols(void)
|
||||
|
||||
void matrix_init(void)
|
||||
{
|
||||
/* DDRD |= (1<<6); */
|
||||
/* PORTD |= (1<<6); */
|
||||
/* gpio_set_pin_output(D6); */
|
||||
/* gpio_write_pin_high(D6); */
|
||||
debug_enable = true;
|
||||
|
||||
uart_init(1200);
|
||||
@ -99,7 +99,7 @@ void matrix_init(void)
|
||||
/* } */
|
||||
/* print(" Done\n"); */
|
||||
|
||||
/* PORTD &= ~(1<<6); */
|
||||
/* gpio_write_pin_low(D6) */
|
||||
|
||||
matrix_init_kb();
|
||||
return;
|
||||
|
@ -40,32 +40,16 @@ void set_led(int idx, bool enable) {
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
switch (keycode) {
|
||||
case BL1:
|
||||
if (record->event.pressed) {
|
||||
PORTB |= (1 << 4);
|
||||
} else {
|
||||
PORTB &= ~(1 << 4);
|
||||
}
|
||||
gpio_write_pin(B4, record->event.pressed);
|
||||
return false;
|
||||
case BL2:
|
||||
if (record->event.pressed) {
|
||||
PORTB |= (1 << 5);
|
||||
} else {
|
||||
PORTB &= ~(1 << 5);
|
||||
}
|
||||
gpio_write_pin(B5, record->event.pressed);
|
||||
return false;
|
||||
case BL3:
|
||||
if (record->event.pressed) {
|
||||
PORTB |= (1 << 6);
|
||||
} else {
|
||||
PORTB &= ~(1 << 6);
|
||||
}
|
||||
gpio_write_pin(B6, record->event.pressed);
|
||||
return false;
|
||||
case BL4:
|
||||
if (record->event.pressed) {
|
||||
PORTB |= (1 << 7);
|
||||
} else {
|
||||
PORTB &= ~(1 << 7);
|
||||
}
|
||||
gpio_write_pin(B7, record->event.pressed);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -73,6 +57,13 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
|
||||
void matrix_init_user(void) {
|
||||
/* set LED row pins to output and low */
|
||||
DDRB |= (1 << 4) | (1 << 5) | (1 << 6) | (1 << 7);
|
||||
PORTB &= ~(1 << 4) & ~(1 << 5) & ~(1 << 6) & ~(1 << 7);
|
||||
gpio_set_pin_output(B4);
|
||||
gpio_set_pin_output(B5);
|
||||
gpio_set_pin_output(B6);
|
||||
gpio_set_pin_output(B7);
|
||||
|
||||
gpio_write_pin_low(B4);
|
||||
gpio_write_pin_low(B5);
|
||||
gpio_write_pin_low(B6);
|
||||
gpio_write_pin_low(B7);
|
||||
}
|
||||
|
@ -2,6 +2,9 @@
|
||||
|
||||
#include "quantum.h"
|
||||
|
||||
#define DO60_CAPS_LOCK_LED_PIN B2
|
||||
#define DO60_BACKLIGHT_PIN F4
|
||||
|
||||
/* DO60 LEDs
|
||||
* GPIO pads
|
||||
* 0 F7 not connected
|
||||
@ -13,11 +16,21 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
inline void do60_caps_led_on(void) { DDRB |= (1<<2); PORTB &= ~(1<<2); }
|
||||
inline void do60_bl_led_on(void) { DDRF |= (1<<4); PORTF &= ~(1<<4); }
|
||||
inline void do60_caps_led_on(void) {
|
||||
gpio_set_pin_output(DO60_CAPS_LOCK_LED_PIN);
|
||||
gpio_write_pin_low(DO60_CAPS_LOCK_LED_PIN);
|
||||
}
|
||||
inline void do60_bl_led_on(void) {
|
||||
gpio_set_pin_output(DO60_BACKLIGHT_PIN);
|
||||
gpio_write_pin_low(DO60_BACKLIGHT_PIN);
|
||||
}
|
||||
|
||||
inline void do60_caps_led_off(void) { DDRB &= ~(1<<2); PORTB &= ~(1<<2); }
|
||||
inline void do60_bl_led_off(void) { DDRF &= ~(1<<4); PORTF &= ~(1<<4); }
|
||||
inline void do60_caps_led_off(void) {
|
||||
gpio_set_pin_input(DO60_CAPS_LOCK_LED_PIN);
|
||||
}
|
||||
inline void do60_bl_led_off(void) {
|
||||
gpio_set_pin_input(DO60_BACKLIGHT_PIN);
|
||||
}
|
||||
*/
|
||||
|
||||
inline void setdefaultrgb(void){ rgblight_sethsv(100,100,100); }
|
||||
|
@ -24,13 +24,11 @@ extern inline void ergodox_board_led_on(void);
|
||||
extern inline void ergodox_right_led_1_on(void);
|
||||
extern inline void ergodox_right_led_2_on(void);
|
||||
extern inline void ergodox_right_led_3_on(void);
|
||||
extern inline void ergodox_right_led_on(uint8_t led);
|
||||
|
||||
extern inline void ergodox_board_led_off(void);
|
||||
extern inline void ergodox_right_led_1_off(void);
|
||||
extern inline void ergodox_right_led_2_off(void);
|
||||
extern inline void ergodox_right_led_3_off(void);
|
||||
extern inline void ergodox_right_led_off(uint8_t led);
|
||||
|
||||
extern inline void ergodox_led_all_on(void);
|
||||
extern inline void ergodox_led_all_off(void);
|
||||
@ -53,17 +51,14 @@ void matrix_init_kb(void) {
|
||||
TCCR1B = 0b00001001; // set and configure fast PWM
|
||||
|
||||
// (tied to Vcc for hardware convenience)
|
||||
DDRB &= ~(1 << 4); // set B(4) as input
|
||||
PORTB &= ~(1 << 4); // set B(4) internal pull-up disabled
|
||||
gpio_set_pin_input(B4); // set B(4) as input, internal pull-up disabled
|
||||
|
||||
// unused pins - C7, D4, D5, D7, E6
|
||||
// unused pins - C7, D4, D5, E6
|
||||
// set as input with internal pull-up enabled
|
||||
DDRC &= ~(1 << 7);
|
||||
DDRD &= ~(1 << 5 | 1 << 4);
|
||||
DDRE &= ~(1 << 6);
|
||||
PORTC |= (1 << 7);
|
||||
PORTD |= (1 << 5 | 1 << 4);
|
||||
PORTE |= (1 << 6);
|
||||
gpio_set_pin_input_high(C7);
|
||||
gpio_set_pin_input_high(D4);
|
||||
gpio_set_pin_input_high(D5);
|
||||
gpio_set_pin_input_high(E6);
|
||||
|
||||
keyboard_config.raw = eeconfig_read_kb();
|
||||
ergodox_led_all_set((uint8_t)keyboard_config.led_level * 255 / 4);
|
||||
|
@ -51,18 +51,40 @@ uint8_t ergodox_left_leds_update(void);
|
||||
#define LED_BRIGHTNESS_HI 255
|
||||
#endif
|
||||
|
||||
#define ERGODOX_EZ_BOARD_LED_PIN D6
|
||||
#define ERGODOX_EZ_RIGHT_LED_1_PIN B5
|
||||
#define ERGODOX_EZ_RIGHT_LED_2_PIN B6
|
||||
#define ERGODOX_EZ_RIGHT_LED_3_PIN B7
|
||||
|
||||
inline void ergodox_board_led_on(void) { DDRD |= (1<<6); PORTD |= (1<<6); }
|
||||
inline void ergodox_right_led_1_on(void) { DDRB |= (1<<5); PORTB |= (1<<5); }
|
||||
inline void ergodox_right_led_2_on(void) { DDRB |= (1<<6); PORTB |= (1<<6); }
|
||||
inline void ergodox_right_led_3_on(void) { DDRB |= (1<<7); PORTB |= (1<<7); }
|
||||
inline void ergodox_right_led_on(uint8_t led) { DDRB |= (1<<(led+4)); PORTB |= (1<<(led+4)); }
|
||||
inline void ergodox_board_led_on(void) {
|
||||
gpio_set_pin_output(ERGODOX_EZ_BOARD_LED_PIN);
|
||||
gpio_write_pin_high(ERGODOX_EZ_BOARD_LED_PIN);
|
||||
}
|
||||
inline void ergodox_right_led_1_on(void) {
|
||||
gpio_set_pin_output(ERGODOX_EZ_RIGHT_LED_1_PIN);
|
||||
gpio_write_pin_high(ERGODOX_EZ_RIGHT_LED_1_PIN);
|
||||
}
|
||||
inline void ergodox_right_led_2_on(void) {
|
||||
gpio_set_pin_output(ERGODOX_EZ_RIGHT_LED_2_PIN);
|
||||
gpio_write_pin_high(ERGODOX_EZ_RIGHT_LED_2_PIN);
|
||||
}
|
||||
inline void ergodox_right_led_3_on(void) {
|
||||
gpio_set_pin_output(ERGODOX_EZ_RIGHT_LED_3_PIN);
|
||||
gpio_write_pin_high(ERGODOX_EZ_RIGHT_LED_3_PIN);
|
||||
}
|
||||
|
||||
inline void ergodox_board_led_off(void) { DDRD &= ~(1<<6); PORTD &= ~(1<<6); }
|
||||
inline void ergodox_right_led_1_off(void) { DDRB &= ~(1<<5); PORTB &= ~(1<<5); }
|
||||
inline void ergodox_right_led_2_off(void) { DDRB &= ~(1<<6); PORTB &= ~(1<<6); }
|
||||
inline void ergodox_right_led_3_off(void) { DDRB &= ~(1<<7); PORTB &= ~(1<<7); }
|
||||
inline void ergodox_right_led_off(uint8_t led) { DDRB &= ~(1<<(led+4)); PORTB &= ~(1<<(led+4)); }
|
||||
inline void ergodox_board_led_off(void) {
|
||||
gpio_set_pin_input(ERGODOX_EZ_BOARD_LED_PIN);
|
||||
}
|
||||
inline void ergodox_right_led_1_off(void) {
|
||||
gpio_set_pin_input(ERGODOX_EZ_RIGHT_LED_1_PIN);
|
||||
}
|
||||
inline void ergodox_right_led_2_off(void) {
|
||||
gpio_set_pin_input(ERGODOX_EZ_RIGHT_LED_2_PIN);
|
||||
}
|
||||
inline void ergodox_right_led_3_off(void) {
|
||||
gpio_set_pin_input(ERGODOX_EZ_RIGHT_LED_3_PIN);
|
||||
}
|
||||
|
||||
#ifdef LEFT_LEDS
|
||||
bool ergodox_left_led_1;
|
||||
|
@ -5,25 +5,30 @@ i2c_status_t mcp23018_status = 0x20;
|
||||
|
||||
void matrix_init_kb(void) {
|
||||
// (tied to Vcc for hardware convenience)
|
||||
//DDRB &= ~(1<<4); // set B(4) as input
|
||||
//PORTB &= ~(1<<4); // set B(4) internal pull-up disabled
|
||||
//gpio_set_pin_input(B4); // set B(4) as input, internal pull-up disabled
|
||||
|
||||
// unused pins
|
||||
// set as input with internal pull-up enabled
|
||||
DDRB &= ~(1<<4 | 1<<5 | 1<<6 | 1<<7);
|
||||
PORTB |= (1<<4 | 1<<5 | 1<<6 | 1<<7);
|
||||
gpio_set_pin_input_high(B4);
|
||||
gpio_set_pin_input_high(B5);
|
||||
gpio_set_pin_input_high(B6);
|
||||
gpio_set_pin_input_high(B7);
|
||||
|
||||
DDRC &= ~(1<<7 | 1<<6);
|
||||
PORTC |= (1<<7 | 1<<6);
|
||||
gpio_set_pin_input_high(C6);
|
||||
gpio_set_pin_input_high(C7);
|
||||
|
||||
DDRD &= ~(1<<4 | 1<<5 | 1<<6 | 1<<7);
|
||||
PORTD |= (1<<4 | 1<<5 | 1<<6 | 1<<7);
|
||||
gpio_set_pin_input_high(D4);
|
||||
gpio_set_pin_input_high(D5);
|
||||
gpio_set_pin_input_high(D6);
|
||||
gpio_set_pin_input_high(D7);
|
||||
|
||||
DDRE &= ~(1<<6);
|
||||
PORTE |= (1<<6);
|
||||
gpio_set_pin_input_high(E6);
|
||||
|
||||
DDRF &= ~(1<<0 | 1<<1 | 1<<4 | 1<<6 | 1<<7);
|
||||
PORTF |= (1<<0 | 1<<1 | 1<<4 | 1<<6 | 1<<7);
|
||||
gpio_set_pin_input_high(D0);
|
||||
gpio_set_pin_input_high(D1);
|
||||
gpio_set_pin_input_high(D4);
|
||||
gpio_set_pin_input_high(D6);
|
||||
gpio_set_pin_input_high(D7);
|
||||
|
||||
matrix_init_user();
|
||||
}
|
||||
|
@ -7,17 +7,16 @@ void matrix_init_kb(void) {
|
||||
steno_set_mode(STENO_MODE_GEMINI); // or STENO_MODE_BOLT
|
||||
|
||||
// (tied to Vcc for hardware convenience)
|
||||
//DDRB &= ~(1<<4); // set B(4) as input
|
||||
//PORTB &= ~(1<<4); // set B(4) internal pull-up disabled
|
||||
//gpio_set_pin_input(B4); // set B(4) as input, internal pull-up disabled
|
||||
|
||||
// unused pins - C7, D4, D5, D7, E6
|
||||
// unused pins - C7, D4, D5, D6, D7, E6
|
||||
// set as input with internal pull-up enabled
|
||||
DDRC &= ~(1<<7);
|
||||
DDRD &= ~(1<<5 | 1<<4 | 1<<6 | 1<<7);
|
||||
DDRE &= ~(1<<6);
|
||||
PORTC |= (1<<7);
|
||||
PORTD |= (1<<5 | 1<<4 | 1<<6 | 1<<7);
|
||||
PORTE |= (1<<6);
|
||||
gpio_set_pin_input_high(C7);
|
||||
gpio_set_pin_input_high(D4);
|
||||
gpio_set_pin_input_high(D5);
|
||||
gpio_set_pin_input_high(D6);
|
||||
gpio_set_pin_input_high(D7);
|
||||
gpio_set_pin_input_high(E6);
|
||||
|
||||
matrix_init_user();
|
||||
}
|
||||
|
@ -5,17 +5,16 @@ i2c_status_t mcp23018_status = 0x20;
|
||||
|
||||
void matrix_init_kb(void) {
|
||||
// (tied to Vcc for hardware convenience)
|
||||
//DDRB &= ~(1<<4); // set B(4) as input
|
||||
//PORTB &= ~(1<<4); // set B(4) internal pull-up disabled
|
||||
//gpio_set_pin_input(B4); // set B(4) as input, internal pull-up disabled
|
||||
|
||||
// unused pins - C7, D4, D5, D7, E6
|
||||
// unused pins - C7, D4, D5, D6, D7, E6
|
||||
// set as input with internal pull-up enabled
|
||||
DDRC &= ~(1<<7);
|
||||
DDRD &= ~(1<<5 | 1<<4 | 1<<6 | 1<<7);
|
||||
DDRE &= ~(1<<6);
|
||||
PORTC |= (1<<7);
|
||||
PORTD |= (1<<5 | 1<<4 | 1<<6 | 1<<7);
|
||||
PORTE |= (1<<6);
|
||||
gpio_set_pin_input_high(C7);
|
||||
gpio_set_pin_input_high(D4);
|
||||
gpio_set_pin_input_high(D5);
|
||||
gpio_set_pin_input_high(D6);
|
||||
gpio_set_pin_input_high(D7);
|
||||
gpio_set_pin_input_high(E6);
|
||||
|
||||
matrix_init_user();
|
||||
}
|
||||
|
@ -11,4 +11,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
KC_LCTL, KC_LALT, KC_SPC, KC_RALT, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT
|
||||
)
|
||||
};
|
||||
|
||||
|
@ -11,4 +11,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_SPC, KC_SPC, KC_RALT, KC_RGUI, KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PCMM, KC_PDOT, KC_PENT
|
||||
)
|
||||
};
|
||||
|
||||
|
@ -11,4 +11,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_SPC, KC_SPC, KC_RALT, KC_RGUI, KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PCMM, KC_PDOT, KC_PENT
|
||||
)
|
||||
};
|
||||
|
||||
|
@ -11,4 +11,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI, KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT
|
||||
)
|
||||
};
|
||||
|
||||
|
@ -11,4 +11,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
KC_LCTL, KC_LALT, KC_SPC, KC_RALT, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT
|
||||
)
|
||||
};
|
||||
|
||||
|
@ -1,10 +1,12 @@
|
||||
#include "chimera_ergo.h"
|
||||
|
||||
void led_init(void) {
|
||||
DDRD |= (1<<1);
|
||||
PORTD |= (1<<1);
|
||||
DDRF |= (1<<4) | (1<<5);
|
||||
PORTF |= (1<<4) | (1<<5);
|
||||
gpio_set_pin_output(CHIMERA_ERGO_GREEN_LED_PIN);
|
||||
gpio_write_pin_high(CHIMERA_ERGO_GREEN_LED_PIN);
|
||||
gpio_set_pin_output(CHIMERA_ERGO_BLUE_LED_PIN);
|
||||
gpio_write_pin_high(CHIMERA_ERGO_BLUE_LED_PIN);
|
||||
gpio_set_pin_output(CHIMERA_ERGO_RED_LED_PIN);
|
||||
gpio_write_pin_high(CHIMERA_ERGO_RED_LED_PIN);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2,12 +2,16 @@
|
||||
|
||||
#include "quantum.h"
|
||||
|
||||
#define red_led_off PORTF |= (1<<5)
|
||||
#define red_led_on PORTF &= ~(1<<5)
|
||||
#define blu_led_off PORTF |= (1<<4)
|
||||
#define blu_led_on PORTF &= ~(1<<4)
|
||||
#define grn_led_off PORTD |= (1<<1)
|
||||
#define grn_led_on PORTD &= ~(1<<1)
|
||||
#define CHIMERA_ERGO_RED_LED_PIN F5
|
||||
#define CHIMERA_ERGO_GREEN_LED_PIN D1
|
||||
#define CHIMERA_ERGO_BLUE_LED_PIN F4
|
||||
|
||||
#define red_led_off gpio_write_pin_high(CHIMERA_ERGO_RED_LED_PIN)
|
||||
#define red_led_on gpio_write_pin_low(CHIMERA_ERGO_RED_LED_PIN)
|
||||
#define blu_led_off gpio_write_pin_high(CHIMERA_ERGO_BLUE_LED_PIN)
|
||||
#define blu_led_on gpio_write_pin_low(CHIMERA_ERGO_BLUE_LED_PIN)
|
||||
#define grn_led_off gpio_write_pin_high(CHIMERA_ERGO_GREEN_LED_PIN)
|
||||
#define grn_led_on gpio_write_pin_low(CHIMERA_ERGO_GREEN_LED_PIN)
|
||||
|
||||
#define set_led_off red_led_off; grn_led_off; blu_led_off
|
||||
#define set_led_red red_led_on; grn_led_off; blu_led_off
|
||||
@ -17,27 +21,3 @@
|
||||
#define set_led_magenta red_led_on; grn_led_off; blu_led_on
|
||||
#define set_led_cyan red_led_off; grn_led_on; blu_led_on
|
||||
#define set_led_white red_led_on; grn_led_on; blu_led_on
|
||||
|
||||
/*
|
||||
#define LED_B 5
|
||||
#define LED_R 6
|
||||
#define LED_G 7
|
||||
|
||||
#define all_leds_off PORTF &= ~(1<<LED_B) & ~(1<<LED_R) & ~(1<<LED_G)
|
||||
|
||||
#define red_led_on PORTF |= (1<<LED_R)
|
||||
#define red_led_off PORTF &= ~(1<<LED_R)
|
||||
#define grn_led_on PORTF |= (1<<LED_G)
|
||||
#define grn_led_off PORTF &= ~(1<<LED_G)
|
||||
#define blu_led_on PORTF |= (1<<LED_B)
|
||||
#define blu_led_off PORTF &= ~(1<<LED_B)
|
||||
|
||||
#define set_led_off PORTF &= ~(1<<LED_B) & ~(1<<LED_R) & ~(1<<LED_G)
|
||||
#define set_led_red PORTF = PORTF & ~(1<<LED_B) & ~(1<<LED_G) | (1<<LED_R)
|
||||
#define set_led_blue PORTF = PORTF & ~(1<<LED_G) & ~(1<<LED_R) | (1<<LED_B)
|
||||
#define set_led_green PORTF = PORTF & ~(1<<LED_B) & ~(1<<LED_R) | (1<<LED_G)
|
||||
#define set_led_yellow PORTF = PORTF & ~(1<<LED_B) | (1<<LED_R) | (1<<LED_G)
|
||||
#define set_led_magenta PORTF = PORTF & ~(1<<LED_G) | (1<<LED_R) | (1<<LED_B)
|
||||
#define set_led_cyan PORTF = PORTF & ~(1<<LED_R) | (1<<LED_B) | (1<<LED_G)
|
||||
#define set_led_white PORTF |= (1<<LED_B) | (1<<LED_R) | (1<<LED_G)
|
||||
*/
|
||||
|
@ -1,10 +1,12 @@
|
||||
#include "chimera_ls.h"
|
||||
|
||||
void led_init(void) {
|
||||
DDRD |= (1<<1);
|
||||
PORTD |= (1<<1);
|
||||
DDRF |= (1<<4) | (1<<5);
|
||||
PORTF |= (1<<4) | (1<<5);
|
||||
gpio_set_pin_output(CHIMERA_LS_GREEN_LED_PIN);
|
||||
gpio_write_pin_high(CHIMERA_LS_GREEN_LED_PIN);
|
||||
gpio_set_pin_output(CHIMERA_LS_BLUE_LED_PIN);
|
||||
gpio_write_pin_high(CHIMERA_LS_BLUE_LED_PIN);
|
||||
gpio_set_pin_output(CHIMERA_LS_RED_LED_PIN);
|
||||
gpio_write_pin_high(CHIMERA_LS_RED_LED_PIN);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2,12 +2,16 @@
|
||||
|
||||
#include "quantum.h"
|
||||
|
||||
#define red_led_off PORTF |= (1<<5)
|
||||
#define red_led_on PORTF &= ~(1<<5)
|
||||
#define blu_led_off PORTF |= (1<<4)
|
||||
#define blu_led_on PORTF &= ~(1<<4)
|
||||
#define grn_led_off PORTD |= (1<<1)
|
||||
#define grn_led_on PORTD &= ~(1<<1)
|
||||
#define CHIMERA_LS_RED_LED_PIN F5
|
||||
#define CHIMERA_LS_GREEN_LED_PIN D1
|
||||
#define CHIMERA_LS_BLUE_LED_PIN F4
|
||||
|
||||
#define red_led_off gpio_write_pin_high(CHIMERA_LS_RED_LED_PIN)
|
||||
#define red_led_on gpio_write_pin_low(CHIMERA_LS_RED_LED_PIN)
|
||||
#define blu_led_off gpio_write_pin_high(CHIMERA_LS_BLUE_LED_PIN)
|
||||
#define blu_led_on gpio_write_pin_low(CHIMERA_LS_BLUE_LED_PIN)
|
||||
#define grn_led_off gpio_write_pin_high(CHIMERA_LS_GREEN_LED_PIN)
|
||||
#define grn_led_on gpio_write_pin_low(CHIMERA_LS_GREEN_LED_PIN)
|
||||
|
||||
#define set_led_off red_led_off; grn_led_off; blu_led_off
|
||||
#define set_led_red red_led_on; grn_led_off; blu_led_off
|
||||
@ -17,27 +21,3 @@
|
||||
#define set_led_magenta red_led_on; grn_led_off; blu_led_on
|
||||
#define set_led_cyan red_led_off; grn_led_on; blu_led_on
|
||||
#define set_led_white red_led_on; grn_led_on; blu_led_on
|
||||
|
||||
/*
|
||||
#define LED_B 5
|
||||
#define LED_R 6
|
||||
#define LED_G 7
|
||||
|
||||
#define all_leds_off PORTF &= ~(1<<LED_B) & ~(1<<LED_R) & ~(1<<LED_G)
|
||||
|
||||
#define red_led_on PORTF |= (1<<LED_R)
|
||||
#define red_led_off PORTF &= ~(1<<LED_R)
|
||||
#define grn_led_on PORTF |= (1<<LED_G)
|
||||
#define grn_led_off PORTF &= ~(1<<LED_G)
|
||||
#define blu_led_on PORTF |= (1<<LED_B)
|
||||
#define blu_led_off PORTF &= ~(1<<LED_B)
|
||||
|
||||
#define set_led_off PORTF &= ~(1<<LED_B) & ~(1<<LED_R) & ~(1<<LED_G)
|
||||
#define set_led_red PORTF = PORTF & ~(1<<LED_B) & ~(1<<LED_G) | (1<<LED_R)
|
||||
#define set_led_blue PORTF = PORTF & ~(1<<LED_G) & ~(1<<LED_R) | (1<<LED_B)
|
||||
#define set_led_green PORTF = PORTF & ~(1<<LED_B) & ~(1<<LED_R) | (1<<LED_G)
|
||||
#define set_led_yellow PORTF = PORTF & ~(1<<LED_B) | (1<<LED_R) | (1<<LED_G)
|
||||
#define set_led_magenta PORTF = PORTF & ~(1<<LED_G) | (1<<LED_R) | (1<<LED_B)
|
||||
#define set_led_cyan PORTF = PORTF & ~(1<<LED_R) | (1<<LED_B) | (1<<LED_G)
|
||||
#define set_led_white PORTF |= (1<<LED_B) | (1<<LED_R) | (1<<LED_G)
|
||||
*/
|
||||
|
@ -1,10 +1,12 @@
|
||||
#include "chimera_ortho.h"
|
||||
|
||||
void led_init(void) {
|
||||
DDRD |= (1<<1);
|
||||
PORTD |= (1<<1);
|
||||
DDRF |= (1<<4) | (1<<5);
|
||||
PORTF |= (1<<4) | (1<<5);
|
||||
gpio_set_pin_output(CHIMERA_ORTHO_GREEN_LED_PIN);
|
||||
gpio_write_pin_high(CHIMERA_ORTHO_GREEN_LED_PIN);
|
||||
gpio_set_pin_output(CHIMERA_ORTHO_BLUE_LED_PIN);
|
||||
gpio_write_pin_high(CHIMERA_ORTHO_BLUE_LED_PIN);
|
||||
gpio_set_pin_output(CHIMERA_ORTHO_RED_LED_PIN);
|
||||
gpio_write_pin_high(CHIMERA_ORTHO_RED_LED_PIN);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2,12 +2,16 @@
|
||||
|
||||
#include "quantum.h"
|
||||
|
||||
#define red_led_off PORTF |= (1<<5)
|
||||
#define red_led_on PORTF &= ~(1<<5)
|
||||
#define blu_led_off PORTF |= (1<<4)
|
||||
#define blu_led_on PORTF &= ~(1<<4)
|
||||
#define grn_led_off PORTD |= (1<<1)
|
||||
#define grn_led_on PORTD &= ~(1<<1)
|
||||
#define CHIMERA_ORTHO_RED_LED_PIN F5
|
||||
#define CHIMERA_ORTHO_GREEN_LED_PIN D1
|
||||
#define CHIMERA_ORTHO_BLUE_LED_PIN F4
|
||||
|
||||
#define red_led_off gpio_write_pin_high(CHIMERA_ORTHO_RED_LED_PIN)
|
||||
#define red_led_on gpio_write_pin_low(CHIMERA_ORTHO_RED_LED_PIN)
|
||||
#define blu_led_off gpio_write_pin_high(CHIMERA_ORTHO_BLUE_LED_PIN)
|
||||
#define blu_led_on gpio_write_pin_low(CHIMERA_ORTHO_BLUE_LED_PIN)
|
||||
#define grn_led_off gpio_write_pin_high(CHIMERA_ORTHO_GREEN_LED_PIN)
|
||||
#define grn_led_on gpio_write_pin_low(CHIMERA_ORTHO_GREEN_LED_PIN)
|
||||
|
||||
#define set_led_off red_led_off; grn_led_off; blu_led_off
|
||||
#define set_led_red red_led_on; grn_led_off; blu_led_off
|
||||
@ -17,27 +21,3 @@
|
||||
#define set_led_magenta red_led_on; grn_led_off; blu_led_on
|
||||
#define set_led_cyan red_led_off; grn_led_on; blu_led_on
|
||||
#define set_led_white red_led_on; grn_led_on; blu_led_on
|
||||
|
||||
/*
|
||||
#define LED_B 5
|
||||
#define LED_R 6
|
||||
#define LED_G 7
|
||||
|
||||
#define all_leds_off PORTF &= ~(1<<LED_B) & ~(1<<LED_R) & ~(1<<LED_G)
|
||||
|
||||
#define red_led_on PORTF |= (1<<LED_R)
|
||||
#define red_led_off PORTF &= ~(1<<LED_R)
|
||||
#define grn_led_on PORTF |= (1<<LED_G)
|
||||
#define grn_led_off PORTF &= ~(1<<LED_G)
|
||||
#define blu_led_on PORTF |= (1<<LED_B)
|
||||
#define blu_led_off PORTF &= ~(1<<LED_B)
|
||||
|
||||
#define set_led_off PORTF &= ~(1<<LED_B) & ~(1<<LED_R) & ~(1<<LED_G)
|
||||
#define set_led_red PORTF = PORTF & ~(1<<LED_B) & ~(1<<LED_G) | (1<<LED_R)
|
||||
#define set_led_blue PORTF = PORTF & ~(1<<LED_G) & ~(1<<LED_R) | (1<<LED_B)
|
||||
#define set_led_green PORTF = PORTF & ~(1<<LED_B) & ~(1<<LED_R) | (1<<LED_G)
|
||||
#define set_led_yellow PORTF = PORTF & ~(1<<LED_B) | (1<<LED_R) | (1<<LED_G)
|
||||
#define set_led_magenta PORTF = PORTF & ~(1<<LED_G) | (1<<LED_R) | (1<<LED_B)
|
||||
#define set_led_cyan PORTF = PORTF & ~(1<<LED_R) | (1<<LED_B) | (1<<LED_G)
|
||||
#define set_led_white PORTF |= (1<<LED_B) | (1<<LED_R) | (1<<LED_G)
|
||||
*/
|
||||
|
@ -1,12 +1,12 @@
|
||||
#include "chimera_ortho_plus.h"
|
||||
|
||||
void led_init(void) {
|
||||
setPinOutput(D1);
|
||||
setPinOutput(F4);
|
||||
setPinOutput(F5);
|
||||
writePinHigh(D1);
|
||||
writePinHigh(F4);
|
||||
writePinHigh(F5);
|
||||
gpio_set_pin_output(CHIMERA_ORTHO_PLUS_GREEN_LED_PIN);
|
||||
gpio_set_pin_output(CHIMERA_ORTHO_PLUS_BLUE_LED_PIN);
|
||||
gpio_set_pin_output(CHIMERA_ORTHO_PLUS_RED_LED_PIN);
|
||||
gpio_write_pin_high(CHIMERA_ORTHO_PLUS_GREEN_LED_PIN);
|
||||
gpio_write_pin_high(CHIMERA_ORTHO_PLUS_BLUE_LED_PIN);
|
||||
gpio_write_pin_high(CHIMERA_ORTHO_PLUS_RED_LED_PIN);
|
||||
}
|
||||
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user