This repository has been archived by the owner on Jun 16, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.image
71 lines (59 loc) · 1.85 KB
/
demo.image
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
* Image demo for the TAP (Technology Access Platform)
*
* Copyright (C) 2016 TheLab.ms
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*/
#include "main.h"
#define IMAGE_WIDTH 16
#define IMAGE_HEIGHT 16
volatile bool hold_demo = true;
extern unsigned char user_data[IMAGE_WIDTH][IMAGE_WIDTH * COL_SIZE];
void setup()
{
unsigned int col, row;
for (row = 0; row < 8; row++)
for (col = 0; col < 8; col++)
{
display_buffer[row][(col * COL_SIZE) + 0] = 3;
display_buffer[row][(col * COL_SIZE) + 1] = 4;
display_buffer[row][(col * COL_SIZE) + 2] = 5;
}
}
void copy_frame()
{
unsigned int col, row;
unsigned int col_offset = state.x_address * 8;
unsigned int row_offset = (1 - state.y_address) * 8;
// unsigned char (*image_data)[IMAGE_WIDTH * COL_SIZE] = (unsigned char(*)[IMAGE_WIDTH * COL_SIZE])user_data;
for (row = 0; row < 8; row++)
for (col = 0; col < 8; col++)
{
display_buffer[row][(col * COL_SIZE) + 0] = user_data[row + row_offset][((col + col_offset) * COL_SIZE) + 0];
display_buffer[row][(col * COL_SIZE) + 1] = user_data[row + row_offset][((col + col_offset) * COL_SIZE) + 1];
display_buffer[row][(col * COL_SIZE) + 2] = user_data[row + row_offset][((col + col_offset) * COL_SIZE) + 2];
}
}
void loop(void)
{
if (hold_demo)
{
__delay_cycles(1000); // so transition frame is not longer
return;
}
copy_frame();
hold_demo = true;
}
/* warning: called from interrupt context */
void handle_custom_packet(packet_t *p)
{
hold_demo = false;
}