qmk_firmware/keyboards/clueboard/17/17.c
skullydazed d1f735b6d2
Clueboard refresh (#4902)
* Cluecard: refactor

- renamed layout macro KEYMAP to LAYOUT
- reformatted layout macro to more closely resemble physical device layout
- keymaps now use #include QMK_KEYBOARD_H
- config.h files updated to use #pragma once method
- deleted outdated QUANTUM_DIR code blocks from rules.mk files
- white space changes on rules.mk files (alignment/readability)

* Cluecard: Configurator support

* Cluecard: readme update

- added image
- updated Docs links

* Clueboard 66% HotSwap: corrected matrix and Configurator data

- removed k31 and k84 from LAYOUT
  - both appear to be unsupported for this PCB according to images on clueboard.co
  - updated block comment mock-ups to match changes
- rebuilt info.json file
- delete removed keys from default keymap.c

* Clueboard 66% HotSwap: readme update

- fix make example
- updated Docs links

* Clueboard 66% HotSwap: 66_ansi keymap update

Updated to use #include QMK_KEYBOARD_H

* Clueboard 60% refactor

- renamed layout macro KEYMAP to LAYOUT_all
- renamed layout macro KEYMAP_AEK to LAYOUT_aek
- removed redundant KC_TRNS definitions from keymaps
- all keymaps now use #include QMK_KEYBOARD_H

* Clueboard 17%: refactor

* Clueboard 17%: Configurator support

* Clueboard 17%: update Docs links in readme

* Cleanup the 2x1800 files

* Update Clueboard 60% to standard matrix

* Update the clueboard default keymaps

* Refresh and update clueboard 17

* Add the 66% hotswap to Clueboard's readme

* Clarify the 66% hotswap's readme

* change the image to imgur

* Update the clueboard 66 to follow modern standards

* update clueboard 66_hotswap to follow modern practices

* Move the logo to imgur

* update clueboard/card to follow modern practices

* remove clueboard/66 as a valid make target

* Address comments in #4902

* fix user keymaps after the changes
2019-01-23 09:25:32 -08:00

58 lines
1.1 KiB
C

#include "17.h"
int pwm_level;
void matrix_init_kb(void) {
// put your keyboard start-up code here
// runs once when the firmware starts up
matrix_init_user();
// JTAG disable for PORT F. write JTD bit twice within four cycles.
MCUCR |= (1<<JTD);
MCUCR |= (1<<JTD);
};
void led_set_kb(uint8_t usb_led) {
print("led_set\n");
}
void backlight_init_ports(void) {
// Set C7 to output
DDRC |= (1<<7);
// Initialize the timer
TC4H = 0x03;
OCR4C = 0xFF;
TCCR4A = 0b10000010;
TCCR4B = 0b00000001;
}
void backlight_set(uint8_t level) {
// Determine the PWM level
switch (level)
{
case 0:
// 33%
pwm_level = 0x54;
break;
case 1:
// 66%
pwm_level = 0xA8;
break;
case 2:
// 100%
pwm_level = 0xFF;
break;
case 3:
// 0%
pwm_level = 0x00;
break;
default:
xprintf("Unknown level: %d\n", level);
}
// Write the PWM level to the timer
TC4H = pwm_level >> 8;
OCR4A = 0xFF & pwm_level;
}