Mercurial > louis > kiibohd-controller
comparison Scan/ISSILed/led_scan.c @ 341:66eccdd9ced5
Code cleanup
- Changing header file ifndef define to pragma once's
- Removed duplicate output_com.h's
author | Jacob Alexander <haata@kiibohd.com> |
---|---|
date | Sun, 14 Jun 2015 13:56:56 -0700 |
parents | 9e31d92caf12 |
children | 58d2c5bf95eb |
comparison
equal
deleted
inserted
replaced
340:e8841d3c6db5 | 341:66eccdd9ced5 |
---|---|
21 | 21 |
22 // Project Includes | 22 // Project Includes |
23 #include <cli.h> | 23 #include <cli.h> |
24 #include <led.h> | 24 #include <led.h> |
25 #include <print.h> | 25 #include <print.h> |
26 #include <led_conf.h> // Located with scan_loop.c | |
26 | 27 |
27 // Local Includes | 28 // Local Includes |
28 #include "led_scan.h" | 29 #include "led_scan.h" |
29 | 30 |
30 | 31 |
137 0xCF, 0xCF, // C7-1 -> C7-16 | 138 0xCF, 0xCF, // C7-1 -> C7-16 |
138 0xC7, 0xC7, // C8-1 -> C8-16 | 139 0xC7, 0xC7, // C8-1 -> C8-16 |
139 0x43, 0x43, // C9-1 -> C9-16 | 140 0x43, 0x43, // C9-1 -> C9-16 |
140 }; | 141 }; |
141 */ | 142 */ |
143 | |
144 /* | |
142 const uint8_t LED_ledEnableMask[] = { | 145 const uint8_t LED_ledEnableMask[] = { |
143 0xE8, // I2C address | 146 0xE8, // I2C address |
144 0x00, // Starting register address | 147 0x00, // Starting register address |
145 0x00, 0x00, // C1-1 -> C1-16 | 148 0x00, 0x00, // C1-1 -> C1-16 |
146 //0xEC, 0xEC, // C1-1 -> C1-16 | 149 //0xEC, 0xEC, // C1-1 -> C1-16 |
151 0x00, 0x00, // C6-1 -> C6-16 | 154 0x00, 0x00, // C6-1 -> C6-16 |
152 0x08, 0x08, // C7-1 -> C7-16 | 155 0x08, 0x08, // C7-1 -> C7-16 |
153 0x00, 0x00, // C8-1 -> C8-16 | 156 0x00, 0x00, // C8-1 -> C8-16 |
154 0x00, 0x00, // C9-1 -> C9-16 | 157 0x00, 0x00, // C9-1 -> C9-16 |
155 }; | 158 }; |
156 | 159 */ |
157 | 160 |
161 | |
162 /* | |
158 // XXX Pre-fill example of buffers | 163 // XXX Pre-fill example of buffers |
159 const uint8_t examplePage[] = { | 164 const uint8_t examplePage[] = { |
160 0xE8, // I2C address | 165 0xE8, // I2C address |
161 0x24, // Starting register address | 166 0x24, // Starting register address |
162 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // C1-1 -> C1-16 | 167 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // C1-1 -> C1-16 |
167 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // C6-1 -> C6-16 | 172 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // C6-1 -> C6-16 |
168 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // C7-1 -> C7-16 | 173 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // C7-1 -> C7-16 |
169 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // C8-1 -> C8-16 | 174 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // C8-1 -> C8-16 |
170 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // C9-1 -> C9-16 | 175 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // C9-1 -> C9-16 |
171 }; | 176 }; |
172 | 177 */ |
173 /* | 178 |
174 // XXX Pre-fill example of buffers | 179 // XXX Pre-fill example of buffers |
175 const uint8_t examplePage[] = { | 180 const uint8_t examplePage[] = { |
176 0xE8, // I2C address | 181 0xE8, // I2C address |
177 0x24, // Starting register address | 182 0x24, // Starting register address |
178 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, // C1-1 -> C1-16 | 183 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, // C1-1 -> C1-16 |
183 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, // C6-1 -> C6-16 | 188 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, // C6-1 -> C6-16 |
184 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, // C7-1 -> C7-16 | 189 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, // C7-1 -> C7-16 |
185 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F, // C8-1 -> C8-16 | 190 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F, // C8-1 -> C8-16 |
186 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, // C9-1 -> C9-16 | 191 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, // C9-1 -> C9-16 |
187 }; | 192 }; |
188 */ | |
189 | 193 |
190 | 194 |
191 | 195 |
192 // ----- Interrupt Functions ----- | 196 // ----- Interrupt Functions ----- |
193 | 197 |
427 CLI_registerDictionary( ledCLIDict, ledCLIDictName ); | 431 CLI_registerDictionary( ledCLIDict, ledCLIDictName ); |
428 | 432 |
429 // Initialize I2C | 433 // Initialize I2C |
430 I2C_setup(); | 434 I2C_setup(); |
431 | 435 |
432 /* TODO Make work | |
433 // Zero out Frame Registers | 436 // Zero out Frame Registers |
434 // This needs to be done before disabling the hardware shutdown (or the leds will do undefined things) | 437 // This needs to be done before disabling the hardware shutdown (or the leds will do undefined things) |
435 LED_zeroPages( 0x0B, 1, 0x00, 0x0C ); // Control Registers | 438 LED_zeroPages( 0x0B, 1, 0x00, 0x0C ); // Control Registers |
436 | 439 |
437 // Disable Hardware shutdown of ISSI chip (pull high) | 440 // Disable Hardware shutdown of ISSI chip (pull high) |
438 GPIOD_PDDR |= (1<<1); | 441 GPIOB_PDDR |= (1<<16); |
439 PORTD_PCR1 = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1); | 442 PORTB_PCR16 = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1); |
440 GPIOD_PSOR |= (1<<1); | 443 GPIOB_PSOR |= (1<<16); |
441 | 444 |
442 // Clear LED Pages | 445 // Clear LED Pages |
443 LED_zeroPages( 0x00, 8, 0x00, 0xB4 ); // LED Registers | 446 LED_zeroPages( 0x00, 8, 0x00, 0xB4 ); // LED Registers |
444 | 447 |
445 // Enable LEDs based upon mask | 448 // Enable LEDs based upon mask |
446 LED_sendPage( (uint8_t*)LED_ledEnableMask, sizeof( LED_ledEnableMask ), 0 ); | 449 LED_sendPage( (uint8_t*)LED_ledEnableMask, sizeof( LED_ledEnableMask ), 0 ); |
447 | 450 |
448 // Disable Software shutdown of ISSI chip | 451 // Disable Software shutdown of ISSI chip |
449 LED_writeReg( 0x0A, 0x01, 0x0B ); | 452 LED_writeReg( 0x0A, 0x01, 0x0B ); |
450 */ | |
451 } | 453 } |
452 | 454 |
453 | 455 |
454 inline uint8_t I2C_BufferCopy( uint8_t *data, uint8_t sendLen, uint8_t recvLen, I2C_Buffer *buffer ) | 456 inline uint8_t I2C_BufferCopy( uint8_t *data, uint8_t sendLen, uint8_t recvLen, I2C_Buffer *buffer ) |
455 { | 457 { |