1.1 --- a/bitmap.c Sun Nov 24 19:01:08 2013 +0000
1.2 +++ b/bitmap.c Sun Nov 24 19:28:06 2013 +0000
1.3 @@ -26,6 +26,12 @@
1.4 exit(1);
1.5 }
1.6
1.7 +void lcd_shutdown(int signum)
1.8 +{
1.9 + LCD_off();
1.10 + shutdown(signum);
1.11 +}
1.12 +
1.13 void bitmap(uint8_t image)
1.14 {
1.15 LCD_image(0, 0, image_data[image], IMAGE_WIDTH, IMAGE_HEIGHT);
1.16 @@ -53,6 +59,9 @@
1.17
1.18 spi_init();
1.19 LCD_init();
1.20 +
1.21 + signal(SIGINT, lcd_shutdown);
1.22 +
1.23 bitmap(current_image);
1.24
1.25 while (times--)
1.26 @@ -68,6 +77,8 @@
1.27 current_image = (current_image + 1) % NUMBER_OF_IMAGES;
1.28 }
1.29
1.30 + LCD_off();
1.31 +
1.32 printf("Closing...\n");
1.33 ubb_close(0);
1.34 return 0;
2.1 --- a/pcf8833.c Sun Nov 24 19:01:08 2013 +0000
2.2 +++ b/pcf8833.c Sun Nov 24 19:28:06 2013 +0000
2.3 @@ -38,6 +38,9 @@
2.4 OUT(LCD_CLK);
2.5 OUT(LCD_SEND);
2.6 OUT(LCD_BACKLIGHT);
2.7 +
2.8 + CLR(LCD_RESET);
2.9 + CLR(LCD_BACKLIGHT);
2.10 }
2.11
2.12 void spi_begin()
2.13 @@ -101,7 +104,7 @@
2.14 #endif
2.15 }
2.16
2.17 -void LCD_init(void)
2.18 +void LCD_init()
2.19 {
2.20 /* Perform a hardware reset on the LCD. */
2.21 /* CS=1, CLK=0, D/C=0 apparently superfluous */
2.22 @@ -141,6 +144,13 @@
2.23 SET(LCD_BACKLIGHT);
2.24 }
2.25
2.26 +void LCD_off()
2.27 +{
2.28 + /* Switch the backlight off. */
2.29 +
2.30 + CLR(LCD_BACKLIGHT);
2.31 +}
2.32 +
2.33 void LCD_window(uint8_t xmin, uint8_t ymin, uint8_t xmax, uint8_t ymax)
2.34 {
2.35 LCD_send(LCD_COMMAND, LCD_CASET);
2.36 @@ -224,7 +234,7 @@
2.37 LCD_send(LCD_COMMAND, LCD_NOP);
2.38 }
2.39
2.40 -void LCD_normal(void)
2.41 +void LCD_normal()
2.42 {
2.43 LCD_send(LCD_COMMAND, LCD_NORON);
2.44 }
3.1 --- a/pcf8833.h Sun Nov 24 19:01:08 2013 +0000
3.2 +++ b/pcf8833.h Sun Nov 24 19:28:06 2013 +0000
3.3 @@ -22,21 +22,21 @@
3.4 *
3.5 * Sniffer UBB Shifters Shield
3.6 * ------- ---- ---------- ------
3.7 - * DAT2 DAT2
3.8 + * DAT2 DAT2 A1 (#2) B1 8 (BACKLIGHT)
3.9 * CD DAT3 A2 (#1) B2 10 (SS/CS)
3.10 * CMD CMD A1 (#1) B1 9 (RESET)
3.11 * VCC VDD LV HV VIN
3.12 * CLK CLK A4 (#1) B4 13 (SCLK/CLK)
3.13 * GND GND GND GND GND
3.14 * DAT0 DAT0 A3 (#1) B3 11 (MOSI/SEND)
3.15 - * DAT1 DAT1 A1 (#2) B1 8 (BACKLIGHT)
3.16 + * DAT1 DAT1
3.17 */
3.18
3.19 +#define LCD_BACKLIGHT UBB_DAT2
3.20 #define LCD_CS UBB_DAT3
3.21 #define LCD_RESET UBB_CMD
3.22 #define LCD_CLK UBB_CLK
3.23 #define LCD_SEND UBB_DAT0
3.24 -#define LCD_BACKLIGHT UBB_DAT1
3.25
3.26 typedef enum {
3.27 LCD_COMMAND = 0,
3.28 @@ -84,13 +84,14 @@
3.29 void LCD_send(lcd_sendmode mode, uint8_t data);
3.30 void LCD_send_more_data(uint8_t data);
3.31 void LCD_send_raw(uint8_t data);
3.32 -void LCD_init(void);
3.33 +void LCD_init();
3.34 +void LCD_off();
3.35 void LCD_window(uint8_t xmin, uint8_t ymin, uint8_t xmax, uint8_t ymax);
3.36 void LCD_blit_int(uint16_t colour);
3.37 void LCD_area(uint8_t xmin, uint8_t ymin, uint8_t xmax, uint8_t ymax, uint16_t colour);
3.38 void LCD_image(int x, int y, const uint16_t image[], uint8_t width, uint8_t height);
3.39 void LCD_image_region(int x, int y, const uint16_t image[], uint8_t width, uint8_t height, uint8_t from_x, uint8_t span_x, uint8_t from_y, uint8_t span_y);
3.40 -void LCD_normal(void);
3.41 +void LCD_normal();
3.42 void LCD_scroll_area(uint8_t top_fixed, uint8_t scrolling, uint8_t bottom_fixed);
3.43 void LCD_scroll_start(uint8_t address);
3.44