Sprites
[hackover2013-badge-firmware.git] / lcd / display.c
index 4849753..cb91904 100644 (file)
@@ -8,7 +8,20 @@
 
 #include <r0ketports.h>
 
+#ifdef CFG_USBMSC
+#include <core/usbhid-rom/usbmsc.h>
+
+static uint32_t usbintstatus;
+#endif
+
 static void lcd_select() {
+#ifdef CFG_USBMSC
+  if(usbMSCenabled) {
+    usbintstatus = USB_DEVINTEN;
+    USB_DEVINTEN = 0;
+  }
+#endif
+
     /* the LCD requires 9-Bit frames */
   uint32_t configReg = ( SSP_SSP0CR0_DSS_9BIT     // Data size = 9-bit
                          | SSP_SSP0CR0_FRF_SPI    // Frame format = SPI
@@ -24,6 +37,12 @@ static void lcd_deselect() {
                          | SSP_SSP0CR0_FRF_SPI    // Frame format = SPI
                          | SSP_SSP0CR0_SCR_8);    // Serial clock rate = 8
   SSP_SSP0CR0 = configReg;
+
+#ifdef CFG_USBMSC
+  if(usbMSCenabled) {
+    USB_DEVINTEN = usbintstatus;
+  }
+#endif
 }
 
 static inline void lcd_write(uint16_t frame) {
@@ -85,12 +104,12 @@ void badge_display_init(void) {
    * 10: set x address (upper bits): X[6-4] = 0
    */
   static uint8_t const initseq[]= { 0xE2, 0xAF, // Display ON
-                                   //      0xA1,       // Mirror-X
-                                   0xc8, // mirror-y
-                                   0xa7, // invert (1 = black)
-                                   0xA4, 0x2F,
-                                   0xB0, 0x10,
-                                   0x9f, 0x24 };
+                                    //      0xA1,       // Mirror-X
+                                    0xc8, // mirror-y
+                                    0xa7, // invert (1 = black)
+                                    0xA4, 0x2F,
+                                    0xB0, 0x10,
+                                    0x9f, 0x24 };
   for(uint8_t i = 0; i < sizeof(initseq); ++i){
     lcd_write_command(initseq[i]);
     systickDelay(5);
@@ -106,7 +125,7 @@ void badge_framebuffer_flush(badge_framebuffer const *fb) {
   lcd_write_command(0x10);
   lcd_write_command(0x00);
 
-  
+
   for(int i = 0; i < 9 * 96; ++i) {
     lcd_write_data(fb->data[0][i]);
   }
This page took 0.02492 seconds and 4 git commands to generate.