Skip to content

Commit

Permalink
Updated library.
Browse files Browse the repository at this point in the history
  • Loading branch information
coreylakey committed Jul 20, 2016
1 parent 43809f6 commit 0274d74
Show file tree
Hide file tree
Showing 163 changed files with 150,315 additions and 2,087 deletions.
19 changes: 5 additions & 14 deletions README.md
Expand Up @@ -13,7 +13,7 @@

### General Description

Matrix RGB click is a mikroBUS add-on board powered by a 32-bit FT900 MCU designed specifically for powering 16x32 RGB LED matrices. The board has a 16 wire IDC connector for connecting to a single 16x32 LED panel. However, the firmware inside the FT900x chip can drive more than one panel. Multiple panels can be connected to each other into a daisy-chain configuration (see the video). Matrix RGB click communicates with the target MCU through the SPI interface. It uses a 3.3V power supply only.
Matrix RGB click is a mikroBUS add-on board powered by a 32-bit FT900 MCU designed specifically for powering 16x32 or 32x32 RGB LED matrices. The board has a 16 wire IDC connector for connecting to a single 16x32 or 32x32 LED panel. However, the firmware inside the FT900x chip can drive more than one panel. Multiple panels can be connected to each other into a daisy-chain configuration (see the video). Matrix RGB click communicates with the target MCU through the SPI interface. The click uses a 3.3V power supply only.


---
Expand All @@ -39,15 +39,13 @@ sbit MATRIXRGB_CS at GPIOD_ODR.B13;
sbit MATRIXRGB_READY at GPIOD_IDR.B10;
sbit MATRIXRGB_RST at GPIOC_ODR.B2;
void system_setup( uint8_t width, uint8_t height );
void system_setup( uint8_t width, uint8_t height, panel_size_t panel_size );
void main()
{
uint16_t count = 0;
uint8_t i = 0;
color_t my_color;
system_setup( 2, 2 );
system_setup( 1, 1, BIG_PANEL );
matrixrgb_scroll_img_left( MikroE_Sign_bmp, 32, 32, 25 );
matrixrgb_scroll_off_scrn_down( 25 );
Expand All @@ -73,13 +71,6 @@ void main()
while(1)
{
/* matrixrgb_refresh();
count++;
if( count >= 200 )
{
count = 0;
matrixrgb_shift_down();
} */
matrixrgb_set_color( &my_color, 1, 1, 1 );
matrixrgb_scroll_text_left( "Matrix", my_color, 10, 10 );
matrixrgb_set_color( &my_color, 1, 0, 0 );
Expand All @@ -91,7 +82,7 @@ void main()
}
}
void system_setup( uint8_t width, uint8_t height )
void system_setup( uint8_t width, uint8_t height, panel_size )
{
GPIO_Digital_Output( &GPIOD_BASE, _GPIO_PINMASK_13); // Set Chip Select pin as output
Expand All @@ -109,7 +100,7 @@ void system_setup( uint8_t width, uint8_t height )
MATRIXRGB_RST = 1;
Delay_ms(200);
matrixrgb_init( width, height );
matrixrgb_init( width, height, panel_size );
Delay_ms(200);
}
Expand Down
67 changes: 67 additions & 0 deletions example/ARM_Example/MatrixRGB_Firmware_Merge.c
@@ -0,0 +1,67 @@
#include "matrixrgb_hw.h"
#include "resources.h"

sbit MATRIXRGB_CS at GPIOD_ODR.B13;
sbit MATRIXRGB_READY at GPIOD_IDR.B10;
sbit MATRIXRGB_RST at GPIOC_ODR.B2;

void system_setup( uint8_t width, uint8_t height, panel_size_t panel_size );

void main()
{
color_t my_color;
panel_size_t panel_size;

panel_size = SMALL_PANEL;

system_setup( 1, 2, panel_size );

matrixrgb_set_color( &my_color, 1, 0, 0 );
matrixrgb_scroll_img_left( MikroE_Sign_bmp, 32, 32, 35 );
matrixrgb_scroll_off_scrn_down( 35 );
matrixrgb_set_color( &my_color, 1, 1, 1 );
matrixrgb_scroll_text_right( "Matrix ", my_color, 10, 10 );
matrixrgb_set_color( &my_color, 1, 0, 0 );
matrixrgb_scroll_text_left( "R", my_color, 10, 1 );
matrixrgb_set_color( &my_color, 0, 1, 0 );
matrixrgb_scroll_text_left( "G", my_color, 10, 1 );
matrixrgb_set_color( &my_color, 0, 0, 1 );
matrixrgb_scroll_text_left( "B ", my_color, 10, 1 );
matrixrgb_set_color( &my_color, 1, 1, 1 );
matrixrgb_scroll_off_scrn_up( 10 );

while(1)
{
matrixrgb_set_color( &my_color, 1, 1, 1 );
matrixrgb_scroll_text_left( "Matrix", my_color, 20, 10 );
matrixrgb_set_color( &my_color, 1, 0, 0 );
matrixrgb_scroll_text_left( "R", my_color, 20, 1 );
matrixrgb_set_color( &my_color, 0, 1, 0 );
matrixrgb_scroll_text_left( "G", my_color, 20, 1 );
matrixrgb_set_color( &my_color, 0, 0, 1 );
matrixrgb_scroll_text_left( "B", my_color, 20, 1 );
// matrixrgb_refresh();
}
}

void system_setup( uint8_t width, uint8_t height, panel_size_t panel_size )
{
GPIO_Digital_Output( &GPIOD_BASE, _GPIO_PINMASK_13); // Set Chip Select pin as output
GPIO_Digital_Output( &GPIOC_BASE, _GPIO_PINMASK_2 ); // Set Reset pin to output
GPIO_Digital_Input( &GPIOD_BASE, _GPIO_PINMASK_10); // Set Ready to input

// Initialize SPI
SPI3_Init_Advanced(_SPI_FPCLK_DIV2, _SPI_MASTER | _SPI_8_BIT |
_SPI_CLK_IDLE_LOW | _SPI_FIRST_CLK_EDGE_TRANSITION |
_SPI_MSB_FIRST | _SPI_SS_DISABLE | _SPI_SSM_DISABLE | _SPI_SSI_1,
&_GPIO_MODULE_SPI3_PC10_11_12);

MATRIXRGB_RST = 0; //Reset slave ( toggle )
Delay_ms(20);
MATRIXRGB_RST = 1;
Delay_ms(200);

matrixrgb_init( width, height, panel_size );
Delay_ms(200);

}
76 changes: 76 additions & 0 deletions example/ARM_Example/MatrixRGB_Firmware_Merge.mcpar
@@ -0,0 +1,76 @@
[DEVICE]
Name=STM32F107VC
Clock=72000000
[MEMORY_MODEL]
Value=0
[BUILD_TYPE]
Value=0
[ACTIVE_TAB]
Value=MatrixRGB_Firmware_Merge.c
[USE_EEPROM]
Value=0
[USE_HEAP]
Value=0
[HEAP_SIZE]
Value=2000
[EEPROM_DEFINITION]
Value=
[FILES]
Count=4
File0=MatrixRGB_Firmware_Merge.c
File1=\\VBOXSVR\corey\Projects\ClickLibraries\MatrixRGB_Click\library\Application\Application_Library\resources\resources.c
[BINARIES]
Count=0
[IMAGES]
Count=0
ActiveImageIndex=-1
[OPENED_FILES]
Count=7
File0=MatrixRGB_Firmware_Merge.c
File1=\\VBOXSVR\corey\Projects\ClickLibraries\MatrixRGB_Click\library\Application\Application_Library\resources\resources.c
File2=\\VBOXSVR\corey\Projects\ClickLibraries\MatrixRGB_Click\library\Application\Application_Library\resources\resources.h
File5=..\libraries\Application_Library\src\matrixrgb_hal.c
File6=..\libraries\Application_Library\include\matrixrgb_hal.h
[EEPROM]
Count=0
[ACTIVE_COMMENTS_FILES]
Count=0
[OTHER_FILES]
Count=0
[SEARCH_PATH]
Count=9
Path0=C:\Users\Public\Documents\Mikroelektronika\mikroC PRO for ARM\Defs\
Path1=C:\Users\Public\Documents\Mikroelektronika\mikroC PRO for ARM\Uses\
Path2=C:\Users\Corey\Documents\Projects\MatrixRGB\Firmware_Merge_Attempt\ARM_Done\
Path3=C:\Users\Public\Documents\Mikroelektronika\mikroC PRO for ARM\Uses\ST M3\
Path4=C:\Users\Corey\Documents\Projects\MatrixRGB\Firmware_Merge_Attempt\
Path5=\\VBOXSVR\corey\Projects\ClickLibraries\MatrixRGB_Click\library\Application\Application_Library\resources\
Path6=C:\Users\Corey\Documents\Projects\MatrixRGB\Firmware_Merge_Attempt\libraries\Application_Library\src\
[HEADER_PATH]
Count=5
Path0=\\VBOXSVR\corey\Projects\ClickLibraries\MatrixRGB_Click\library\Application\Application_Library\resources\
Path1=C:\Users\Corey\Documents\Projects\MatrixRGB\Firmware_Merge_Attempt\libraries\Application_Library\include\
[HEADERS]
Count=3
File0=\\VBOXSVR\corey\Projects\ClickLibraries\MatrixRGB_Click\library\Application\Application_Library\resources\resources.h
[PLDS]
Count=0
[Useses]
Count=3
File0=Conversions
File1=C_String
File2=SPI
[EXPANDED_NODES]
Node0=Sources
Node1=Header Files
Count=2
[PROGRAMMER_OPTIONS]
Value=SWD
[PROGRAMMER_TYPE]
Value=mE
[DEBUGGER_TYPE]
Value=default
[AT_DEBUG_STARTUP]
LOAD_BIN_TO_RAM=0
START_EXEC_FROM_ADDR=0
START_ADDR=-1
23 changes: 11 additions & 12 deletions example/ARM_Game_Example/MatrixRGB_Demo_Project.c
Expand Up @@ -4,14 +4,14 @@

#define AUTOPLAY /**< For debugging purposes */
#define BONUSLEVEL /**< For Bonus Level after completing HARD mode */
#define CHEATING /**< While paused btn held, can move the paddle */
//#define CHEATING /**< While paused btn held, can move the paddle */
//#define TIME_DISPLAY /**< Used to display time since start of game */

sbit MATRIXRGB_CS at GPIOD_ODR.B13;
sbit MATRIXRGB_READY at GPIOD_IDR.B10;
sbit MATRIXRGB_RST at GPIOC_ODR.B2;

void system_setup( char brightness, uint8_t width, uint8_t height ); /**< Sets up GPIO / SPI / MatrixRGB */
void system_setup( uint8_t width, uint8_t height, panel_size_t panel_size ); /**< Sets up GPIO / SPI / MatrixRGB */
void InitTimer2( void ); /**< Timer2 Initialization */
void setup_gameboard( void ); /**< Sets up normal level */
void setup_player( void ); /**< Sets up player on bottom of screen */
Expand Down Expand Up @@ -89,7 +89,7 @@ vert_direction_t ball_dir_vert = UP; /**< Global Vertical Ball Directi
horiz_direction_t ball_dir_horiz = LEFT; /**< Global Horizontal Ball Direction */
position_t ball_curr_pos; /**< Global Current Ball Position */
position_t player_curr_pos; /**< Global Current Player Position */
uint8_t move_flag = 0; /**< Flag for when to refresh movement of character ( flag set every 200 us ) */
uint8_t move_flag = 0; /**< Flag for when to refresh movement of character ( flag set every 200 us ) */
uint16_t ball_count_flag = 0; /**< Flag for when to move the Ball, ( depends on g_ball_speed ) */
unsigned long adc_pos; /**< Global ADC Position value */
bool safe = true; /**< Global "Safe" flag for when player loses */
Expand All @@ -100,21 +100,20 @@ player_surface_t player_surface; /**< Global indication of what si
uint16_t g_ball_speed = 50; /**< Smaller # = faster speed */
uint16_t ball_speed; /**< Used for when vector is increased, to slow down ball (normalization) */
bool playing = true; /**< Used to check if win */
uint16_t rand_num = 0; /**< Used for Random Number Generation */
uint32_t time = 0;
uint8_t time_s = 0;
uint8_t offset = 32; /**< Used when shifting display for game around to other screens */
uint16_t rand_num = 0; /**< Used for Random Number Generation */
uint32_t time = 0;
uint8_t time_s = 0;
uint8_t offset = 0; /**< Used when shifting display for game around to other screens */


void main()
{
color_t my_color; /**< Color for Text */
uint8_t bonus_level = 0; /**< Flag used for Bonus Level after winning on Hard */


/**< System Setup */
matrixrgb_set_color( &my_color, 1, 0, 0 ); /**< Color for text */
system_setup( 100, 2, 2); /**< Sets up ADC, SPI, MatrixRGB, Timer */
system_setup( 1, 1, BIG_PANEL ); /**< Sets up ADC, SPI, MatrixRGB, Timer */
/**< Game Setup */
ball_speed = g_ball_speed; /**< Setup initial ball speed */
wait_for_choice(); /**< Wait for choice from Main Menu */
Expand Down Expand Up @@ -424,7 +423,7 @@ void set_vector( uint8_t *amount )

void erase_brick( uint8_t number )
{
uint8_t i;
uint16_t i;

for ( i = 0; i < 4; i++ ) /**< Erases block with index "number" */
{
Expand Down Expand Up @@ -831,7 +830,7 @@ void setup_player( void )
player_surface = MIDDLE_SURFACE; /**< Start with default vector */
}

void system_setup( char brightness, uint8_t width, uint8_t height )
void system_setup( uint8_t width, uint8_t height, panel_size_t panel_size )
{

GPIO_Digital_Output( &GPIOD_BASE, _GPIO_PINMASK_13); /**< Set Chip Select pin as output */
Expand All @@ -852,7 +851,7 @@ void system_setup( char brightness, uint8_t width, uint8_t height )
MATRIXRGB_RST = 1;
Delay_ms(200);

matrixrgb_init( brightness, width, height ); /**< Initialize MatrixRGB Click, with brightness of 100, and width of 1 panel by height of 2 panels */
matrixrgb_init( width, height, panel_size ); /**< Initialize MatrixRGB Click, with brightness of 100, and width of 1 panel by height of 2 panels */
Delay_ms(200);

InitTimer2(); /**< Initialize Timer 2 at 10 us */
Expand Down
45 changes: 24 additions & 21 deletions example/ARM_Game_Example/MatrixRGB_Demo_Project.mcpar
Expand Up @@ -18,9 +18,9 @@ Value=
[FILES]
Count=4
File0=MatrixRGB_Demo_Project.c
File1=..\Application_Library\src\matrixrgb_hal.c
File2=..\Application_Library\src\matrixrgb_hw.c
File3=..\Application_Library\resources\resources.c
File1=..\Application_Library\resources\resources.c
File2=..\..\Firmware_Merge_Attempt\libraries\Application_Library\src\matrixrgb_hal.c
File3=..\..\Firmware_Merge_Attempt\libraries\Application_Library\src\matrixrgb_hw.c
[BINARIES]
Count=0
[IMAGES]
Expand All @@ -29,36 +29,39 @@ ActiveImageIndex=-1
[OPENED_FILES]
Count=7
File0=MatrixRGB_Demo_Project.c
File1=..\Application_Library\src\matrixrgb_hal.c
File2=..\Application_Library\src\matrixrgb_hw.c
File3=..\Application_Library\resources\resources.c
File4=..\Application_Library\include\matrixrgb_hal.h
File5=..\Application_Library\include\matrixrgb_hw.h
File6=..\Application_Library\resources\resources.h
File1=..\Application_Library\resources\resources.c
File2=..\Application_Library\resources\resources.h
File3=..\..\Firmware_Merge_Attempt\libraries\Application_Library\src\matrixrgb_hal.c
File4=..\..\Firmware_Merge_Attempt\libraries\Application_Library\src\matrixrgb_hw.c
File5=..\..\Firmware_Merge_Attempt\libraries\Application_Library\include\matrixrgb_hal.h
File6=..\..\Firmware_Merge_Attempt\libraries\Application_Library\include\matrixrgb_hw.h
[EEPROM]
Count=0
[ACTIVE_COMMENTS_FILES]
Count=0
[OTHER_FILES]
Count=0
[SEARCH_PATH]
Count=7
Path0=C:\Users\Corey\Documents\Mikroelektronika\mikroC PRO for ARM\Defs\
Path1=C:\Users\Corey\Documents\Mikroelektronika\mikroC PRO for ARM\Uses\
Count=10
Path0=C:\Users\Public\Documents\Mikroelektronika\mikroC PRO for ARM\Defs\
Path1=C:\Users\Public\Documents\Mikroelektronika\mikroC PRO for ARM\Uses\ST M3\
Path2=C:\Users\Corey\Documents\Projects\MatrixRGB\Application\Demo_Project\
Path3=C:\Users\Corey\Documents\Mikroelektronika\mikroC PRO for ARM\Uses\ST M3\
Path4=C:\Users\Corey\Documents\Projects\MatrixRGB\Application\Application_Library\src\
Path5=C:\Users\Corey\Documents\Projects\MatrixRGB\Application\Application_Library\resources\
Path6=C:\Users\Corey\Documents\Projects\MatrixRGB\Application\Application_Library\include\
Path3=C:\Users\Corey\Documents\Projects\MatrixRGB\Application\Application_Library\resources\
Path4=C:\Users\Corey\Documents\Projects\MatrixRGB\Firmware_Merge_Attempt\libraries\Application_Library\resources\
Path5=C:\Users\Corey\Documents\Projects\MatrixRGB\Firmware_Merge_Attempt\libraries\Application_Library\src\
Path6=C:\Users\Corey\Documents\Projects\MatrixRGB\Firmware_Merge_Attempt\libraries\Application_Library\src\
Path7=C:\Users\Corey\Documents\Projects\MatrixRGB\Firmware_Merge_Attempt\libraries\Application_Library\src\
Path8=C:\Users\Corey\Documents\Projects\MatrixRGB\Firmware_Merge_Attempt\libraries\Application_Library\src\
Path9=C:\Users\Corey\Documents\Projects\MatrixRGB\Firmware_Merge_Attempt\libraries\Application_Library\src\
[HEADER_PATH]
Count=2
Path0=C:\Users\Corey\Documents\Projects\MatrixRGB\Application\Application_Library\include\
Path1=C:\Users\Corey\Documents\Projects\MatrixRGB\Application\Application_Library\resources\
Path0=C:\Users\Corey\Documents\Projects\MatrixRGB\Firmware_Merge_Attempt\libraries\Application_Library\include\
Path1=C:\Users\Corey\Documents\Projects\MatrixRGB\Firmware_Merge_Attempt\libraries\Application_Library\resources\
[HEADERS]
Count=3
File0=..\Application_Library\include\matrixrgb_hal.h
File1=..\Application_Library\include\matrixrgb_hw.h
File2=..\Application_Library\resources\resources.h
File0=..\Application_Library\resources\resources.h
File1=..\..\Firmware_Merge_Attempt\libraries\Application_Library\include\matrixrgb_hal.h
File2=..\..\Firmware_Merge_Attempt\libraries\Application_Library\include\matrixrgb_hw.h
[PLDS]
Count=0
[Useses]
Expand Down

0 comments on commit 0274d74

Please sign in to comment.