Lots of work on the RX200 demo. Blinky and Full/Debug build configurations are now tested, after adding the BussonAndLCD.c/h files. Full/Optimised is yet to be built or tested.

This commit is contained in:
Richard Barry 2011-09-17 16:41:46 +00:00
parent 025abf6f6a
commit 83f0af8764
15 changed files with 798 additions and 774 deletions

View file

@ -30,39 +30,6 @@ User Includes
#include "rskrx210def.h"
#include "lcd.h"
/* Kernel includes. */
#include "FreeRTOS.h"
#include "task.h"
#include "semphr.h"
/**********************************************************************************
Global variables
***********************************************************************************/
xQueueHandle SwitchQueue;
xSemaphoreHandle LCD_Mutex;
char datastring[]=
"........Rx210 Highlights....1.56 DMips/MHz....DSP functions....1.62V-5.5V operation....200 uA/MHz....Up to 512 kBytes Flash....up to 64 kbytes SRAM....EE Dataflash with 100k w/e....1.3 uA in Real Time Clock Mode....Powerful Motor control timer....4 x 16-bit timers....4 x 8-bit timers....Full Real Time Clock calendar with calibration and alarm functions....Up to 16 channels 1 uS 12-bit ADC, with Dual group programmable SCAN, 3 sample and holds, sample accumulate function....DMA controller....Data Transfer Controller....Up to 9 serial Channels....Up to 6 USARTs ( with Simple I2C / SPI )....USART ( with unique Frame based protocol support )....Multimaster IIC....RSPI....Temperature Sensor....Event Link Controller....Comparators....Safety features include CRC....March X....Dual watchdog Timers with window and independent oscillator....ADC self test....I/O Pin Test....Supported with E1 on chip debugger and RSK210 evaluation system....Rx210 Highlights........";
struct _LCD_Params Line1 =
{
LCD_LINE1, 215, datastring
};
struct _LCD_Params Line2 =
{
LCD_LINE2, 350, datastring
};
/**********************************************************************************
User Program Code
***********************************************************************************/
/*****************************************************************************
Name: InitDisplay
Parameters: none
@ -250,143 +217,3 @@ End of function DisplayDelay
***********************************************************************************/
void prvLCDTaskLine1( void *pvParameters )
{
#define RIGHT_TO_LEFT 0
#define LEFT_TO_RIGHT 1
struct _LCD_Params *Local_Params = (struct _LCD_Params*)pvParameters;
char str_lcd[9];
unsigned short pos = 0;
unsigned char Direction = RIGHT_TO_LEFT;
for(;;)
{
vTaskDelay( Local_Params->Speed / portTICK_RATE_MS );
strncpy(str_lcd, &Local_Params->ptr_str[pos], 8);
xSemaphoreTake( LCD_Mutex, portMAX_DELAY );
DisplayString(Local_Params->Line, str_lcd);
xSemaphoreGive( LCD_Mutex );
if(Direction == RIGHT_TO_LEFT)
{
pos++;
if( pos == strlen(datastring) - 7)
{
Direction = LEFT_TO_RIGHT;
pos--;
}
}
else
{
pos--;
if( pos == 0 )
{
Direction = RIGHT_TO_LEFT;
}
}
}
}
void prvLCDTaskLine2( void *pvParameters )
{
#define RIGHT_TO_LEFT 0
#define LEFT_TO_RIGHT 1
#define RUNNING 0
#define STOPPED 1
struct _LCD_Params *Local_Params = (struct _LCD_Params*)pvParameters;
char str_lcd[9];
unsigned short pos = 0;
unsigned char Direction = RIGHT_TO_LEFT;
unsigned char Status = RUNNING;
unsigned char QueueData;
portTickType Delay = ( Local_Params->Speed / portTICK_RATE_MS );
for(;;)
{
// vTaskDelay( Local_Params->Speed / portTICK_RATE_MS );
if( xQueueReceive (SwitchQueue, &QueueData, Delay) != pdPASS )
{
strncpy(str_lcd, &Local_Params->ptr_str[pos], 8);
xSemaphoreTake( LCD_Mutex, portMAX_DELAY );
DisplayString(Local_Params->Line, str_lcd);
xSemaphoreGive( LCD_Mutex );
if(Direction == RIGHT_TO_LEFT)
{
pos++;
if( pos == strlen(datastring) - 7)
{
Direction = LEFT_TO_RIGHT;
pos--;
}
}
else
{
pos--;
if( pos == 0 )
{
Direction = RIGHT_TO_LEFT;
}
}
}
else
{
if(QueueData == 0x02) // stop/start
{
if(Delay != portMAX_DELAY)
{
Delay = portMAX_DELAY;
Status = STOPPED;
}
else
{
Delay = ( Local_Params->Speed / portTICK_RATE_MS );
Status = RUNNING;
}
}
if(QueueData == 0x01) // RIGHT or shift back
{
if(Status == STOPPED)
{
if(pos != 0)
{
pos--;
strncpy(str_lcd, &Local_Params->ptr_str[pos], 8);
xSemaphoreTake( LCD_Mutex, portMAX_DELAY );
DisplayString(Local_Params->Line, str_lcd);
xSemaphoreGive( LCD_Mutex );
}
}
}
if(QueueData == 0x03) // LEFT or shift forward
{
if(Status == STOPPED)
{
if(pos != strlen(datastring) - 7)
{
pos++;
strncpy(str_lcd, &Local_Params->ptr_str[pos], 8);
xSemaphoreTake( LCD_Mutex, portMAX_DELAY );
DisplayString(Local_Params->Line, str_lcd);
xSemaphoreGive( LCD_Mutex );
}
}
}
}
}
}