MCPcopy Create free account
hub / github.com/kiibohd/controller / Scan_setup

Function Scan_setup

Scan/PS2/scan_loop.c:115–139  ·  view source on GitHub ↗

Setup

Source from the content-addressed store, hash-verified

113
114// Setup
115inline void Scan_setup() {
116 // Register Scan CLI dictionary
117 CLI_registerDictionary(scanCLIDict, scanCLIDictName);
118
119#if defined(_teensy_3_)
120 // Enable interrupts for port B.
121 NVIC_ENABLE_IRQ(IRQ_PORTB);
122
123 // Set pins to input:
124 PS2_PORT_PDDR &= ~(1 << PS2_CLOCK_PIN);
125 PS2_PORT_PDDR &= ~(1 << PS2_DATA_PIN);
126 PS2_CLOCK_PCR = PORT_PCR_MUX(1);
127 PS2_DATA_PCR = PORT_PCR_MUX(1);
128
129 // Register pin PS2_CLOCK to trigger interrupt on port B:
130 // falling mask is 0x0A, see pins_teensy.c
131 // 16 is location in register, not pin
132 uint32_t mask = (0x0A << 16) | 0x01000000;
133 __disable_irq();
134 PS2_CLOCK_PCR |= mask;
135 __enable_irq();
136#else
137#warning "Not implemented"
138#endif
139}
140
141
142// Main Detection Loop

Callers 2

mainFunction · 0.50
Host_initFunction · 0.50

Calls 3

CLI_registerDictionaryFunction · 0.85
__disable_irqFunction · 0.85
__enable_irqFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…