v0.9.3 - Ongoing
================
+- Added drawCornerFilled() to drawing.c and LCD CLI
+- Fixed a nasty bug with 'gpioInterruptEvent' in the
+ gpioSetInterrupt function (core/gpio/gpio.c)
- Add drawTriangle() and drawTriangleFilled() to
- drawing.c
+ drawing.c and LCD CLI
- Added cpuReset() to reset the board via AIRCR
- Removed text input dialogue from LCD CLI ('T') to
save a few KB. Command file still exists, just no
OBJS += cmd_chibi_addr.o cmd_chibi_tx.o
OBJS += cmd_i2ceeprom_read.o cmd_i2ceeprom_write.o cmd_lm75b_gettemp.o
OBJS += cmd_reset.o cmd_sd_dir.o cmd_sysinfo.o cmd_uart.o
+OBJS += cmd_roundedcorner.o
VPATH += project/commands/drawing
OBJS += cmd_backlight.o cmd_bmp.o cmd_button.o cmd_calibrate.o
OBJS += cmd_circle.o cmd_clear.o cmd_line.o cmd_orientation.o
OBJS += cmd_pixel.o cmd_progress.o cmd_rectangle.o cmd_text.o
-OBJS += cmd_textw.o cmd_tsthreshhold.o cmd_tswait.o
+OBJS += cmd_textw.o cmd_tsthreshhold.o cmd_tswait.o cmd_triangle.o
##########################################################################
# Optional driver files
<?xml version="1.0" encoding="utf-8"?>
<Session Name="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\build\codelite\LPC1343 Workspace.workspace">
- <int Value="1" Name="m_selectedTab"/>
+ <int Value="2" Name="m_selectedTab"/>
<wxString Value="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\build\codelite\LPC1343 Workspace.workspace" Name="m_workspaceName"/>
<TabInfoArray Name="TabInfoArray">
<TabInfo>
- <wxString Value="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\Makefile" Name="FileName"/>
- <int Value="33" Name="FirstVisibleLine"/>
- <int Value="53" Name="CurrentLine"/>
+ <wxString Value="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\main.c" Name="FileName"/>
+ <int Value="2" Name="FirstVisibleLine"/>
+ <int Value="19" Name="CurrentLine"/>
<wxArrayString Name="Bookmarks"/>
</TabInfo>
<TabInfo>
- <wxString Value="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\project\commands\drawing\cmd_text.c" Name="FileName"/>
- <int Value="73" Name="FirstVisibleLine"/>
- <int Value="86" Name="CurrentLine"/>
+ <wxString Value="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\core\usbcdc\usbcore.c" Name="FileName"/>
+ <int Value="159" Name="FirstVisibleLine"/>
+ <int Value="178" Name="CurrentLine"/>
+ <wxArrayString Name="Bookmarks"/>
+ </TabInfo>
+ <TabInfo>
+ <wxString Value="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\Makefile" Name="FileName"/>
+ <int Value="18" Name="FirstVisibleLine"/>
+ <int Value="29" Name="CurrentLine"/>
<wxArrayString Name="Bookmarks"/>
</TabInfo>
</TabInfoArray>
<File Name="../../project/commands/drawing/cmd_rectangle.c"/>
<File Name="../../project/commands/drawing/cmd_tsthreshhold.c"/>
<File Name="../../project/commands/drawing/cmd_backlight.c"/>
+ <File Name="../../project/commands/drawing/cmd_triangle.c"/>
+ <File Name="../../project/commands/drawing/cmd_roundedcorner.c"/>
</VirtualDirectory>
<File Name="../../project/commands/cmd_uart.c"/>
</VirtualDirectory>
<!DOCTYPE CrossStudio_Project_File>
-<solution Name="LPC1343_CodeBase" version="2">
+<solution Name="LPC1343_CodeBase" target="8" version="2">
<project Name="LPC1343_CodeBase">
<configuration Name="Common" Target="LPC1343" arm_architecture="v7M" arm_core_type="Cortex-M3" arm_linker_heap_size="512" arm_linker_process_stack_size="0" arm_linker_stack_size="1024" arm_simulator_memory_simulation_filename="$(TargetsDir)/LPC1000/LPC1000SimulatorMemory.dll" arm_simulator_memory_simulation_parameter="LPC13;0x8000;0x2000;0x0" arm_target_debug_interface_type="ADIv5" arm_target_loader_parameter="12000000" c_additional_options="" c_preprocessor_definitions="USE_PROCESS_STACK" c_user_include_directories="$(TargetsDir)/LPC1000/include;" link_include_standard_libraries="No" link_include_startup_code="No" linker_additional_files="$(TargetsDir)/LPC1000/lib/liblpc1000$(LibExt)$(LIB);$(TargetsDir)/LPC1000/lib/cmsis$(LibExt)$(LIB)" linker_memory_map_file="$(TargetsDir)/LPC1000/LPC1343_MemoryMap.xml" linker_output_format="bin" oscillator_frequency="12MHz" project_directory="" project_type="Executable" property_groups_file_path="$(TargetsDir)/LPC1000/propertyGroups13xx.xml"/>
<configuration Name="Flash" Placement="Flash" arm_target_flash_loader_file_path="$(TargetsDir)/LPC1000/Release/Loader_lpc1300.elf" arm_target_flash_loader_type="LIBMEM RPC Loader" linker_patch_build_command="$(StudioDir)/bin/crossscript "load(\"$(TargetsDir)/LPC1000/LPC1000_LinkPatch.js\");patch(\"$(TargetPath)\");"" linker_section_placement_file="$(StudioDir)/targets/Cortex_M/flash_placement.xml" target_reset_script="FLASHReset()"/>
</file>
<file file_name="../../core/usbcdc/usbcore.c">
<configuration Name="THUMB Flash Debug" build_exclude_from_build="No"/>
+ <configuration Name="THUMB Flash Release" build_exclude_from_build="No"/>
</file>
<file file_name="../../core/usbcdc/usbdesc.c">
<configuration Name="THUMB Flash Debug" build_exclude_from_build="No"/>
+ <configuration Name="THUMB Flash Release" build_exclude_from_build="No"/>
</file>
<file file_name="../../core/usbcdc/usbhw.c">
<configuration Name="THUMB Flash Debug" build_exclude_from_build="No"/>
+ <configuration Name="THUMB Flash Release" build_exclude_from_build="No"/>
</file>
<file file_name="../../core/usbcdc/usbuser.c">
<configuration Name="THUMB Flash Debug" build_exclude_from_build="No"/>
+ <configuration Name="THUMB Flash Release" build_exclude_from_build="No"/>
+ </file>
+ <file file_name="../../core/usbcdc/cdc_buf.c">
+ <configuration Name="THUMB Flash Release" build_exclude_from_build="No"/>
+ <configuration Name="THUMB Flash Debug" build_exclude_from_build="No"/>
</file>
- <file file_name="../../core/usbcdc/cdc_buf.c"/>
</folder>
<folder Name="pwm">
<file file_name="../../core/pwm/pwm.c"/>
<folder Name="libc">
<file file_name="../../core/libc/stdio.c">
<configuration Name="THUMB Flash Debug" build_exclude_from_build="No"/>
+ <configuration Name="THUMB Flash Release" build_exclude_from_build="No"/>
</file>
<file file_name="../../core/libc/string.c">
<configuration Name="THUMB Flash Debug" build_exclude_from_build="No"/>
+ <configuration Name="THUMB Flash Release" build_exclude_from_build="No"/>
+ </file>
+ <file file_name="../../core/libc/ctype.c">
+ <configuration Name="THUMB Flash Release" build_exclude_from_build="No"/>
</file>
- <file file_name="../../core/libc/ctype.c"/>
</folder>
</folder>
<file file_name="../../lpc134x.h"/>
<file file_name="../../project/commands/drawing/cmd_rectangle.c"/>
<file file_name="../../project/commands/drawing/cmd_tsthreshhold.c"/>
<file file_name="../../project/commands/drawing/cmd_backlight.c"/>
+ <file file_name="../../project/commands/drawing/cmd_triangle.c"/>
+ <file file_name="../../project/commands/drawing/cmd_roundedcorner.c"/>
</folder>
<file file_name="../../project/commands/cmd_uart.c"/>
<file file_name="../../project/commands/cmd_reset.c"/>
</folder>
<file file_name="../../project/cmd_tbl.h"/>
</folder>
- <file file_name="../../main.c"/>
+ <file file_name="../../main.c">
+ <configuration Name="THUMB Flash Release" build_exclude_from_build="No"/>
+ <configuration Name="THUMB Flash Debug" build_exclude_from_build="No"/>
+ </file>
</folder>
<folder Name="System Files">
<file file_name="$(TargetsDir)/LPC1000/include/CMSIS/system_LPC13xx.c"/>
<!DOCTYPE CrossStudio_for_ARM_Session_File>
<session>
<Bookmarks/>
- <Breakpoints/>
+ <Breakpoints>
+ <BreakpointListItem group="CM Exceptions" type="Exception" state="2" counter="0" expression="BusFault" />
+ <BreakpointListItem group="CM Exceptions" type="Exception" state="2" counter="0" expression="ExceptionEntryReturnFault" />
+ <BreakpointListItem group="CM Exceptions" type="Exception" state="2" counter="0" expression="HardFault" />
+ <BreakpointListItem group="CM Exceptions" type="Exception" state="2" counter="0" expression="MemManage" />
+ <BreakpointListItem group="CM Exceptions" type="Exception" state="3" counter="0" expression="Reset" />
+ <BreakpointListItem group="CM Exceptions" type="Exception" state="2" counter="0" expression="UsageFault_CheckingError" />
+ <BreakpointListItem group="CM Exceptions" type="Exception" state="2" counter="0" expression="UsageFault_Coprocessor" />
+ <BreakpointListItem group="CM Exceptions" type="Exception" state="2" counter="0" expression="UsageFault_StateError" />
+ </Breakpoints>
<ExecutionCountWindow/>
<Memory1>
<MemoryWindow autoEvaluate="0" addressText="&header" numColumns="8" sizeText="sizeof(header)" dataSize="1" radix="16" addressSpace="" />
<ProjectSessionItem path="LPC1343_CodeBase" name="unnamed" />
<ProjectSessionItem path="LPC1343_CodeBase;LPC1343_CodeBase" name="unnamed" />
<ProjectSessionItem path="LPC1343_CodeBase;LPC1343_CodeBase;Source Files" name="unnamed" />
- <ProjectSessionItem path="LPC1343_CodeBase;LPC1343_CodeBase;Source Files;drivers" name="unnamed" />
- <ProjectSessionItem path="LPC1343_CodeBase;LPC1343_CodeBase;Source Files;drivers;lcd" name="unnamed" />
- <ProjectSessionItem path="LPC1343_CodeBase;LPC1343_CodeBase;Source Files;drivers;lcd;tft" name="unnamed" />
</Project>
<Register1>
- <RegisterWindow openNodes="GPIO2;SSP0/SSP0CR0;SSP0/SSP0CR1;SSP0/SSP0CPSR;SYSCON" binaryNodes="GPIO1/GPIO1DATA;GPIO2/GPIO2DATA;GPIO2/GPIO2DIR;GPIO3/GPIO3DATA" hiddenNodes="" unsignedNodes="" visibleGroups="GPIO2;SSP0;GPIO1;CPU;GPIO3;SCB;SYSCON" decimalNodes="" octalNodes="" asciiNodes="" />
+ <RegisterWindow openNodes="USB;USB/USBDevIntSt;USB/USBDevIntEn;USB/USBRxPLen;USB/USBTxPLen;USB/USBCtrl" binaryNodes="" hiddenNodes="" unsignedNodes="" visibleGroups="CPU;USB" decimalNodes="" octalNodes="" asciiNodes="" />
</Register1>
<Register2>
<RegisterWindow openNodes="" binaryNodes="" hiddenNodes="" unsignedNodes="" visibleGroups="" decimalNodes="" octalNodes="" asciiNodes="" />
</TraceWindow>
<Watch1>
<Watches active="1" update="Each Second" >
- <Watchpoint linenumber="155" radix="16" name="Tick" expression="Tick" filename="c:/documents and settings/kevin/my documents/my dropbox/microbuilder/code/lpc1343/lpc1343_codebase/freertos/tasks.c" />
- <Watchpoint linenumber="155" radix="-1" name="xTickCount" expression="xTickCount" filename="c:/documents and settings/kevin/my documents/my dropbox/microbuilder/code/lpc1343/lpc1343_codebase/freertos/tasks.c" />
- <Watchpoint linenumber="138" radix="16" name="timer32_0_counter" expression="timer32_0_counter" filename="c:/documents and settings/kevin/my documents/my dropbox/microbuilder/code/lpc1343/lpc1343_codebase/core/timer32/timer32.c" />
<Watchpoint linenumber="66" radix="10" name="msTicks" expression="msTicks" filename="c:/documents and settings/kevin/my documents/my dropbox/microbuilder/code/lpc1343/lpc1343_codebase/core/systick/systick.c" />
+ <Watchpoint linenumber="138" radix="16" name="timer32_0_counter" expression="timer32_0_counter" filename="c:/documents and settings/kevin/my documents/my dropbox/microbuilder/code/lpc1343/lpc1343_codebase/core/timer32/timer32.c" />
+ <Watchpoint linenumber="155" radix="-1" name="xTickCount" expression="xTickCount" filename="c:/documents and settings/kevin/my documents/my dropbox/microbuilder/code/lpc1343/lpc1343_codebase/freertos/tasks.c" />
+ <Watchpoint linenumber="155" radix="16" name="Tick" expression="Tick" filename="c:/documents and settings/kevin/my documents/my dropbox/microbuilder/code/lpc1343/lpc1343_codebase/freertos/tasks.c" />
</Watches>
</Watch1>
<Watch2>
<Watch4>
<Watches active="0" update="Never" />
</Watch4>
- <Files/>
- <ARMCrossStudioWindow activeProject="LPC1343_CodeBase" autoConnectTarget="Segger J-Link" debugSearchFileMap="" fileDialogInitialDirectory="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\project\commands" fileDialogDefaultFilter="*.c" autoConnectCapabilities="388991" debugSearchPath="" buildConfiguration="THUMB Flash Release" />
+ <Files>
+ <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\main.c" y="18" path="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\main.c" left="0" selected="1" name="unnamed" top="0" />
+ <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\projectconfig.h" y="50" path="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\projectconfig.h" left="0" selected="0" name="unnamed" top="21" />
+ </Files>
+ <ARMCrossStudioWindow activeProject="LPC1343_CodeBase" autoConnectTarget="Segger J-Link" debugSearchFileMap="" fileDialogInitialDirectory="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\project\commands\drawing" fileDialogDefaultFilter="*.c" autoConnectCapabilities="388991" debugSearchPath="" buildConfiguration="THUMB Flash Release" />
</session>
volatile uint32_t chibi_counter = 0;
#endif
+#ifdef CFG_ALTRESET
+#include "core/cpu/cpu.h"
+#endif
+
static bool _gpioInitialised = false;
/**************************************************************************/
{
uint32_t regVal;
+#if defined CFG_ALTRESET && CFG_ALTRESET_PORT == 1
+ regVal = gpioIntStatus(CFG_ALTRESET_PORT, CFG_ALTRESET_PIN);
+ if (regVal)
+ {
+ // Cause a reset and wait
+ cpuReset();
+ }
+#endif
+
#ifdef CFG_CHIBI
// Check for interrupt on 1.8
regVal = gpioIntStatus(1, 8);
if (!_gpioInitialised) gpioInit();
// Get the appropriate register (handled this way to optimise code size)
- REG32 *gpiois = &GPIO_GPIO0IS;
- REG32 *gpioibe = &GPIO_GPIO0IBE;
- REG32 *gpioiev = &GPIO_GPIO0IEV;
+ REG32 *gpiois = &GPIO_GPIO0IS; // Interrupt sense (edge or level sensitive)
+ REG32 *gpioibe = &GPIO_GPIO0IBE; // Interrupt both edges (0 = int controlled by GPIOIEV, 1 = both edges trigger interrupt)
+ REG32 *gpioiev = &GPIO_GPIO0IEV; // 0 = falling edge or low, 1 = rising edge or high (depending on GPIOIS)
switch (portNum)
{
case 0:
break;
}
- if (gpioInterruptSense_Edge)
+
+ if (sense == gpioInterruptSense_Edge)
{
*gpiois &= ~(0x1<<bitPos);
- /* single or double only applies when sense is 0(edge trigger). */
- gpioInterruptEdge_Single ? (*gpioibe &= ~(0x1<<bitPos)) : (*gpioibe |= (0x1<<bitPos));
+ edge == gpioInterruptEdge_Single ? (*gpioibe &= ~(0x1<<bitPos)) : (*gpioibe |= (0x1<<bitPos));
}
else
{
*gpiois |= (0x1<<bitPos);
}
- gpioInterruptEvent_ActiveHigh ? (*gpioiev &= ~(0x1<<bitPos)) : (*gpioiev |= (0x1<<bitPos));
+ event == gpioInterruptEvent_ActiveHigh ? (*gpioiev &= ~(0x1<<bitPos)) : (*gpioiev |= (0x1<<bitPos));
return;
}
/**************************************************************************/
/*!
- Indicates whether the interrupt should be triggered in the rising
- or falling edge. ActiveHigh means that a HIGH level on the pin will
+ ActiveHigh means that a HIGH level on the pin will
trigger an interrupt, ActiveLow means that a LOW level on the pin
will trigger an interrupt.
*/
#include "cdcuser.h"
#include "cdc_buf.h"
-// unsigned char BulkBufIn [64]; // Buffer to store USB IN packet
+unsigned char BulkBufIn [64]; // Buffer to store USB IN packet
unsigned char BulkBufOut [64]; // Buffer to store USB OUT packet
unsigned char NotificationBuf [10];
unsigned short CDC_DepInEmpty = 1; // Data IN EP is empty
/*----------------------------------------------------------------------------
- We need a buffer for incoming data on USB port because USB receives
+ We need a buffer for incomming data on USB port because USB receives
much faster than UART transmits
*---------------------------------------------------------------------------*/
/* Buffer masks */
-#define CDC_BUF_SIZE (64) // Output buffer in bytes (power 2)
+#define CDC_BUF_SIZE (64) // Output buffer in bytes (power 2)
// large enough for file transfer
#define CDC_BUF_MASK (CDC_BUF_SIZE-1ul)
// CDC output buffer
-typedef struct __CDC_BUF_T
-{
+typedef struct __CDC_BUF_T {
unsigned char data[CDC_BUF_SIZE];
volatile unsigned int wrIdx;
volatile unsigned int rdIdx;
/*----------------------------------------------------------------------------
read data from CDC_OutBuf
*---------------------------------------------------------------------------*/
-int CDC_RdOutBuf (char *buffer, const int *length)
-{
+int CDC_RdOutBuf (char *buffer, const int *length) {
int bytesToRead, bytesRead;
/* Read *length bytes, block if *bytes are not avaialable */
/*----------------------------------------------------------------------------
write data to CDC_OutBuf
*---------------------------------------------------------------------------*/
-int CDC_WrOutBuf (const char *buffer, int *length)
-{
+int CDC_WrOutBuf (const char *buffer, int *length) {
int bytesToWrite, bytesWritten;
// Write *length bytes
/*----------------------------------------------------------------------------
check if character(s) are available at CDC_OutBuf
*---------------------------------------------------------------------------*/
-int CDC_OutBufAvailChar (int *availChar)
-{
+int CDC_OutBufAvailChar (int *availChar) {
+
*availChar = CDC_BUF_COUNT(CDC_OutBuf);
return (0);
Parameters: None
Return Value: None
*---------------------------------------------------------------------------*/
-void CDC_Init (void)
-{
+void CDC_Init (void) {
+
+// ser_OpenPort ();
+// ser_InitPort (CDC_LineCoding.dwDTERate,
+// CDC_LineCoding.bDataBits,
+// CDC_LineCoding.bParityType,
+// CDC_LineCoding.bCharFormat);
+
CDC_DepInEmpty = 1;
CDC_SerialState = CDC_GetSerialState();
Parameters: None (global SetupPacket and EP0Buf)
Return Value: TRUE - Success, FALSE - Error
*---------------------------------------------------------------------------*/
-uint32_t CDC_SendEncapsulatedCommand (void)
-{
+uint32_t CDC_SendEncapsulatedCommand (void) {
+
return (TRUE);
}
Parameters: None (global SetupPacket and EP0Buf)
Return Value: TRUE - Success, FALSE - Error
*---------------------------------------------------------------------------*/
-uint32_t CDC_GetEncapsulatedResponse (void)
-{
+uint32_t CDC_GetEncapsulatedResponse (void) {
+
/* ... add code to handle request */
return (TRUE);
}
Parameters: FeatureSelector
Return Value: TRUE - Success, FALSE - Error
*---------------------------------------------------------------------------*/
-uint32_t CDC_SetCommFeature (unsigned short wFeatureSelector)
-{
+uint32_t CDC_SetCommFeature (unsigned short wFeatureSelector) {
+
/* ... add code to handle request */
return (TRUE);
}
Parameters: FeatureSelector
Return Value: TRUE - Success, FALSE - Error
*---------------------------------------------------------------------------*/
-uint32_t CDC_GetCommFeature (unsigned short wFeatureSelector)
-{
+uint32_t CDC_GetCommFeature (unsigned short wFeatureSelector) {
+
/* ... add code to handle request */
return (TRUE);
}
Parameters: FeatureSelector
Return Value: TRUE - Success, FALSE - Error
*---------------------------------------------------------------------------*/
-uint32_t CDC_ClearCommFeature (unsigned short wFeatureSelector)
-{
+uint32_t CDC_ClearCommFeature (unsigned short wFeatureSelector) {
+
/* ... add code to handle request */
return (TRUE);
}
Parameters: none (global SetupPacket and EP0Buf)
Return Value: TRUE - Success, FALSE - Error
*---------------------------------------------------------------------------*/
-uint32_t CDC_SetLineCoding (void)
-{
+uint32_t CDC_SetLineCoding (void) {
+
CDC_LineCoding.dwDTERate = (EP0Buf[0] << 0)
| (EP0Buf[1] << 8)
| (EP0Buf[2] << 16)
CDC_LineCoding.bParityType = EP0Buf[5];
CDC_LineCoding.bDataBits = EP0Buf[6];
+// ser_ClosePort();
+// ser_OpenPort ();
+// ser_InitPort (CDC_LineCoding.dwDTERate,
+// CDC_LineCoding.bDataBits,
+// CDC_LineCoding.bParityType,
+// CDC_LineCoding.bCharFormat);
return (TRUE);
}
Parameters: None (global SetupPacket and EP0Buf)
Return Value: TRUE - Success, FALSE - Error
*---------------------------------------------------------------------------*/
-uint32_t CDC_GetLineCoding (void)
-{
+uint32_t CDC_GetLineCoding (void) {
+
EP0Buf[0] = (CDC_LineCoding.dwDTERate >> 0) & 0xFF;
EP0Buf[1] = (CDC_LineCoding.dwDTERate >> 8) & 0xFF;
EP0Buf[2] = (CDC_LineCoding.dwDTERate >> 16) & 0xFF;
Parameters: none
Return Value: none
*---------------------------------------------------------------------------*/
-void CDC_BulkIn(void)
-{
-// int numBytesRead, numBytesAvail;
-//
-// // ToDo: Modify BulkIn to send incoming data to USB
-//
+void CDC_BulkIn(void) {
+ //int numBytesRead, numBytesAvail;
+
+// uint8_t frame[64];
+// uint32_t bytesRead = 0;
+// if (cdcBufferDataPending())
+// {
+// // Read up to 64 bytes
+// bytesRead = cdcBufferReadLen(frame, 64);
+// if (bytesRead > 0)
+// {
+// USB_WriteEP (CDC_DEP_IN, frame, bytesRead);
+// }
+// }
+
+
// ser_AvailChar (&numBytesAvail);
//
// // ... add code to check for overwrite
// else {
// CDC_DepInEmpty = 1;
// }
-//
-//
}
Parameters: none
Return Value: none
*---------------------------------------------------------------------------*/
-void CDC_BulkOut(void)
-{
+void CDC_BulkOut(void) {
int numBytesRead;
// get data from USB into intermediate buffer
// store data in a buffer to transmit it over serial interface
CDC_WrOutBuf ((char *)&BulkBufOut[0], &numBytesRead);
+
}
Parameters: none
Return Value: SerialState as defined in usbcdc11.pdf
*---------------------------------------------------------------------------*/
-unsigned short CDC_GetSerialState (void)
-{
+unsigned short CDC_GetSerialState (void) {
+// unsigned short temp;
+
CDC_SerialState = 0;
+// ser_LineState (&temp);
+//
+// if (temp & 0x8000) CDC_SerialState |= CDC_SERIAL_STATE_RX_CARRIER;
+// if (temp & 0x2000) CDC_SerialState |= CDC_SERIAL_STATE_TX_CARRIER;
+// if (temp & 0x0010) CDC_SerialState |= CDC_SERIAL_STATE_BREAK;
+// if (temp & 0x4000) CDC_SerialState |= CDC_SERIAL_STATE_RING;
+// if (temp & 0x0008) CDC_SerialState |= CDC_SERIAL_STATE_FRAMING;
+// if (temp & 0x0004) CDC_SerialState |= CDC_SERIAL_STATE_PARITY;
+// if (temp & 0x0002) CDC_SerialState |= CDC_SERIAL_STATE_OVERRUN;
return (CDC_SerialState);
}
/*----------------------------------------------------------------------------
Send the SERIAL_STATE notification as defined in usbcdc11.pdf, 6.3.5.
*---------------------------------------------------------------------------*/
-void CDC_NotificationIn (void)
-{
+void CDC_NotificationIn (void) {
+
NotificationBuf[0] = 0xA1; // bmRequestType
NotificationBuf[1] = CDC_NOTIFICATION_SERIAL_STATE; // bNotification (SERIAL_STATE)
NotificationBuf[2] = 0x00; // wValue
/* CDC Notification Callback Function */
extern void CDC_NotificationIn (void);
-/* CDC Initialization Function */
+/* CDC Initializtion Function */
extern void CDC_Init (void);
/* CDC prepare the SERAIAL_STATE */
#define USB_SUSPEND_EVENT 1
#define USB_RESUME_EVENT 1
#define USB_WAKEUP_EVENT 0
-#define USB_SOF_EVENT 1
+#define USB_SOF_EVENT 0
#define USB_ERROR_EVENT 0
#define USB_EP_EVENT 0x000B
#define USB_CONFIGURE_EVENT 1
#define USB_ADC_CIF_NUM 0
#define USB_ADC_SIF1_NUM 1
#define USB_ADC_SIF2_NUM 2
-#define USB_CDC 1
+#define USB_CDC 1
#define USB_CDC_CIF_NUM 0
#define USB_CDC_DIF_NUM 1
#define USB_CDC_BUFSIZE CFG_USBCDC_BUFSIZE
static inline uint32_t USB_ReqGetStatus (void) {
uint32_t n, m;
- uint16_t* ep0 = (uint16_t __attribute__((packed)) *)EP0Buf;
switch (SetupPacket.bmRequestType.BM.Recipient) {
case REQUEST_TO_DEVICE:
break;
case REQUEST_TO_INTERFACE:
if ((USB_Configuration != 0) && (SetupPacket.wIndex.WB.L < USB_NumInterfaces)) {
- *ep0 = 0;
+ *((uint16_t __attribute__((packed)) *)EP0Buf) = 0;
EP0Data.pData = EP0Buf;
} else {
return (FALSE);
n = SetupPacket.wIndex.WB.L & 0x8F;
m = (n & 0x80) ? ((1 << 16) << (n & 0x0F)) : (1 << n);
if (((USB_Configuration != 0) || ((n & 0x0F) == 0)) && (USB_EndPointMask & m)) {
- *ep0 = (USB_EndPointHalt & m) ? 1 : 0;
+ *((uint16_t __attribute__((packed)) *)EP0Buf) = (USB_EndPointHalt & m) ? 1 : 0;
EP0Data.pData = EP0Buf;
} else {
return (FALSE);
return (TRUE);
}
+
/*
* Get Configuration USB Request
* Parameters: None (global SetupPacket)
case REQUEST_TO_DEVICE:
// Added cast to avoid warnings due to USB_Configuration being volatile (KTownsend)
EP0Data.pData = (uint8_t *)&USB_Configuration;
+ //EP0Data.pData = &USB_Configuration;
break;
default:
return (FALSE);
return (set);
}
+
/*
* USB Endpoint 0 Event Callback
* Parameters: event
extern uint32_t USB_EndPointStall;
extern uint8_t USB_AltSetting[USB_IF_NUM];
-
/* USB Endpoint 0 Buffer */
extern uint8_t EP0Buf[USB_MAX_PACKET0];
}
-
-
-
-
-
#endif /* __USBCORE_H__ */
* V1.00 Initial Version
*---------------------------------------------------------------------------*/
#include "projectconfig.h"
+
#include "usb.h"
#include "cdc.h"
#include "usbcfg.h"
/* Index 0x01: Manufacturer */
(13*2 + 2), /* bLength (13 Char + Type + lenght) */
USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
+ 'N',0,
+ 'X',0,
+ 'P',0,
+ ' ',0,
+ 'S',0,
+ 'E',0,
'M',0,
'I',0,
'C',0,
- 'R',0,
'O',0,
- 'B',0,
- 'U',0,
- 'I',0,
- 'L',0,
+ 'N',0,
'D',0,
- 'E',0,
- 'R',0,
' ',0,
/* Index 0x02: Product */
(17*2 + 2), /* bLength ( 17 Char + Type + lenght) */
USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
+ 'N',0,
+ 'X',0,
+ 'P',0,
+ ' ',0,
'L',0,
'P',0,
'C',0,
'1',0,
'3',0,
- '4',0,
- '3',0,
+ 'x',0,
+ 'x',0,
' ',0,
+ 'V',0,
'C',0,
'O',0,
'M',0,
' ',0,
- 'P',0,
- 'O',0,
- 'R',0,
- 'T',0,
- ' ',0,
/* Index 0x03: Serial Number */
(12*2 + 2), /* bLength (12 Char + Type + lenght) */
USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
* V1.20 Added USB_ClearEPBuf
* V1.00 Initial Version
*----------------------------------------------------------------------------*/
-#include "projectconfig.h" /* LPC13xx definitions */
+#include "projectconfig.h"
#include "usb.h"
#include "usbcfg.h"
#include "usbreg.h"
* Return Value: None
*/
-void delay (uint32_t length )
-{
+void delay (uint32_t length ) {
uint32_t i;
for ( i = 0; i < length; i++ )
{
- __asm("nop");
+ __asm volatile("nop");
}
return;
}
* Return Value: Endpoint Physical Address
*/
-uint32_t EPAdr (uint32_t EPNum)
-{
+uint32_t EPAdr (uint32_t EPNum) {
uint32_t val;
val = (EPNum & 0x0F) << 1;
* Return Value: None
*/
-void WrCmd (uint32_t cmd)
-{
+void WrCmd (uint32_t cmd) {
+
USB_DEVINTCLR = CCEMTY_INT;
USB_CMDCODE = cmd;
while ((USB_DEVINTST & (CCEMTY_INT | DEV_STAT_INT)) == 0);
* Return Value: None
*/
-void WrCmdDat (uint32_t cmd, uint32_t val)
-{
+void WrCmdDat (uint32_t cmd, uint32_t val) {
+
WrCmd(cmd);
WrCmd(val);
}
* Return Value: None
*/
-void WrCmdEP (uint32_t EPNum, uint32_t cmd)
-{
+void WrCmdEP (uint32_t EPNum, uint32_t cmd){
+
WrCmd(CMD_SEL_EP(EPAdr(EPNum)));
WrCmd(cmd);
}
* Return Value: Data Value
*/
-uint32_t RdCmdDat (uint32_t cmd)
-{
+uint32_t RdCmdDat (uint32_t cmd) {
+
USB_DEVINTCLR = CCEMTY_INT | CDFULL_INT;
USB_CMDCODE = cmd;
while ((USB_DEVINTST & (CDFULL_INT | DEV_STAT_INT)) == 0);
* Return Value: None
*/
-void USB_Init (void)
-{
+void USB_Init (void) {
+
// Setup USB clock and pins
USBIOClkConfig();
* Return Value: None
*/
-void USB_Connect (uint32_t con)
-{
+void USB_Connect (uint32_t con) {
WrCmdDat(CMD_SET_DEV_STAT, DAT_WR_BYTE(con ? DEV_CON : 0));
}
* Return Value: None
*/
-void USB_Reset (void)
-{
+void USB_Reset (void) {
+
USB_DEVINTCLR = 0x000FFFFF;
/* Enable all eight(8) EPs, note: EP won't be ready until it's
configured/enabled when device sending SetEPStatus command
* Return Value: None
*/
-void USB_Suspend (void)
-{
+void USB_Suspend (void) {
/* Performed by Hardware */
}
* Return Value: None
*/
-void USB_Resume (void)
-{
+void USB_Resume (void) {
/* Performed by Hardware */
}
* Return Value: None
*/
-void USB_WakeUp (void)
-{
- if (USB_DeviceStatus & USB_GETSTATUS_REMOTE_WAKEUP)
- {
+void USB_WakeUp (void) {
+
+ if (USB_DeviceStatus & USB_GETSTATUS_REMOTE_WAKEUP) {
WrCmdDat(CMD_SET_DEV_STAT, DAT_WR_BYTE(DEV_CON));
}
}
* Return Value: None
*/
-void USB_WakeUpCfg (uint32_t cfg)
-{
+void USB_WakeUpCfg (uint32_t cfg) {
cfg = cfg; /* Not needed */
}
* Return Value: None
*/
-void USB_SetAddress (uint32_t adr)
-{
+void USB_SetAddress (uint32_t adr) {
WrCmdDat(CMD_SET_ADDR, DAT_WR_BYTE(DEV_EN | adr)); /* Don't wait for next */
WrCmdDat(CMD_SET_ADDR, DAT_WR_BYTE(DEV_EN | adr)); /* Setup Status Phase */
}
* Return Value: None
*/
-void USB_Configure (uint32_t cfg)
-{
+void USB_Configure (uint32_t cfg) {
+
WrCmdDat(CMD_CFG_DEV, DAT_WR_BYTE(cfg ? CONF_DVICE : 0));
return;
}
* Return Value: None
*/
-void USB_ConfigEP (USB_ENDPOINT_DESCRIPTOR *pEPD)
-{
+void USB_ConfigEP (USB_ENDPOINT_DESCRIPTOR *pEPD) {
return;
}
* Return Value: None
*/
-void USB_DirCtrlEP (uint32_t dir)
-{
+void USB_DirCtrlEP (uint32_t dir) {
dir = dir; /* Not needed */
}
* Return Value: None
*/
-void USB_EnableEP (uint32_t EPNum)
-{
+void USB_EnableEP (uint32_t EPNum) {
WrCmdDat(CMD_SET_EP_STAT(EPAdr(EPNum)), DAT_WR_BYTE(0));
}
* Return Value: None
*/
-void USB_DisableEP (uint32_t EPNum)
-{
+void USB_DisableEP (uint32_t EPNum) {
WrCmdDat(CMD_SET_EP_STAT(EPAdr(EPNum)), DAT_WR_BYTE(EP_STAT_DA));
}
* Return Value: None
*/
-void USB_ResetEP (uint32_t EPNum)
-{
+void USB_ResetEP (uint32_t EPNum) {
WrCmdDat(CMD_SET_EP_STAT(EPAdr(EPNum)), DAT_WR_BYTE(0));
}
* Return Value: None
*/
-void USB_SetStallEP (uint32_t EPNum)
-{
+void USB_SetStallEP (uint32_t EPNum) {
WrCmdDat(CMD_SET_EP_STAT(EPAdr(EPNum)), DAT_WR_BYTE(EP_STAT_ST));
}
* Return Value: None
*/
-void USB_ClrStallEP (uint32_t EPNum)
-{
+void USB_ClrStallEP (uint32_t EPNum) {
WrCmdDat(CMD_SET_EP_STAT(EPAdr(EPNum)), DAT_WR_BYTE(0));
}
* Return Value: None
*/
-void USB_ClearEPBuf (uint32_t EPNum)
-{
+void USB_ClearEPBuf (uint32_t EPNum) {
WrCmdEP(EPNum, CMD_CLR_BUF);
}
* Return Value: Number of bytes read
*/
-uint32_t USB_ReadEP (uint32_t EPNum, uint8_t *pData)
-{
+uint32_t USB_ReadEP (uint32_t EPNum, uint8_t *pData) {
uint32_t cnt, n;
USB_CTRL = ((EPNum & 0x0F) << 2) | CTRL_RD_EN;
/* 3 clock cycles to fetch the packet length from RAM. */
delay( 5 );
- do
- {
+ do {
cnt = USB_RXPLEN;
} while ((cnt & PKT_DV) == 0);
cnt &= PKT_LNGTH_MASK;
- for (n = 0; n < (cnt + 3) / 4; n++)
- {
+ for (n = 0; n < (cnt + 3) / 4; n++) {
*((uint32_t __attribute__((packed)) *)pData) = USB_RXDATA;
pData += 4;
}
USB_CTRL = 0;
- if ((EPNum & 0x80) != 0x04)
- { /* Non-Isochronous Endpoint */
+ if ((EPNum & 0x80) != 0x04) { /* Non-Isochronous Endpoint */
WrCmdEP(EPNum, CMD_CLR_BUF);
}
* Return Value: Number of bytes written
*/
-uint32_t USB_WriteEP (uint32_t EPNum, uint8_t *pData, uint32_t cnt)
-{
+uint32_t USB_WriteEP (uint32_t EPNum, uint8_t *pData, uint32_t cnt) {
uint32_t n;
USB_CTRL = ((EPNum & 0x0F) << 2) | CTRL_WR_EN;
delay( 5 );
USB_TXPLEN = cnt;
- for (n = 0; n < (cnt + 3) / 4; n++)
- {
+ for (n = 0; n < (cnt + 3) / 4; n++) {
USB_TXDATA = *((uint32_t __attribute__((packed)) *)pData);
pData += 4;
}
* Return Value: Frame Number
*/
-uint32_t USB_GetFrame (void)
-{
+uint32_t USB_GetFrame (void) {
uint32_t val;
WrCmd(CMD_RD_FRAME);
USB_DEVINTCLR = disr;
/* Device Status Interrupt (Reset, Connect change, Suspend/Resume) */
- if (disr & DEV_STAT_INT)
- {
+ if (disr & DEV_STAT_INT) {
WrCmd(CMD_GET_DEV_STAT);
val = RdCmdDat(DAT_GET_DEV_STAT); /* Device Status */
if (val & DEV_RST) { /* Reset */
#if USB_SOF_EVENT
/* Start of Frame Interrupt */
- if (disr & FRAME_INT)
- {
+ if (disr & FRAME_INT) {
USB_DEVINTCLR = FRAME_INT;
USB_SOF_Event();
- // SOFIRQCount++;
+ SOFIRQCount++;
}
#endif
/* NO error interrupt anymore, below code can be used
as example to get error status from command engine. */
/* Error Interrupt */
- if (disr & ERR_INT)
- {
+ if (disr & ERR_INT) {
WrCmd(CMD_RD_ERR_STAT);
val = RdCmdDat(DAT_RD_ERR_STAT);
USB_Error_Event(val);
isr_end:
return;
}
-
#endif
* Parameter: event
*/
-void USB_EndPoint2 (uint32_t event)
-{
+void USB_EndPoint2 (uint32_t event) {
event = event;
}
CHB_EINTPIN,
gpioInterruptSense_Edge, // Edge-sensitive
gpioInterruptEdge_Single, // Single edge
- gpioInterruptEvent_ActiveHigh); // High triggers interrupt
+ gpioInterruptEvent_ActiveLow); // High triggers interrupt
// enable interrupt
gpioIntEnable (CHB_EINTPORT,
extern volatile uint8_t I2CSlaveBuffer[I2C_BUFSIZE];
extern volatile uint32_t I2CReadLength, I2CWriteLength;
-uint32_t i, timeout;
-
static bool _mcp24aaInitialised = false;
/**************************************************************************/
// ToDo: Check if I2C is ready
// Clear buffers
+ uint32_t i;
for ( i = 0; i < I2C_BUFSIZE; i++ )
{
I2CMasterBuffer[i] = 0x00;
// ToDo: Check if I2C is ready
// Clear write buffer
+ uint32_t i;
for ( i = 0; i < I2C_BUFSIZE; i++ )
{
I2CMasterBuffer[i] = 0x00;
} while (0);
#define DELAY(mS) do { systickDelay( mS / CFG_SYSTICK_DELAY_IN_MS ); } while(0);
-uint8_t buffer[SSD1306_LCDWIDTH * SSD1306_LCDHEIGHT / 8];
+uint8_t _ssd1306buffer[SSD1306_LCDWIDTH * SSD1306_LCDHEIGHT / 8];
/**************************************************************************/
/* Private Methods */
if ((x >= SSD1306_LCDWIDTH) || (y >= SSD1306_LCDHEIGHT))
return;
- buffer[x+ (y/8)*SSD1306_LCDWIDTH] |= (1 << y%8);
+ _ssd1306buffer[x+ (y/8)*SSD1306_LCDWIDTH] |= (1 << y%8);
}
/**************************************************************************/
if ((x >= SSD1306_LCDWIDTH) || (y >= SSD1306_LCDHEIGHT))
return;
- buffer[x+ (y/8)*SSD1306_LCDWIDTH] &= ~(1 << y%8);
+ _ssd1306buffer[x+ (y/8)*SSD1306_LCDWIDTH] &= ~(1 << y%8);
}
/**************************************************************************/
uint8_t ssd1306GetPixel(uint8_t x, uint8_t y)
{
if ((x >= SSD1306_LCDWIDTH) || (y >=SSD1306_LCDHEIGHT)) return 0;
- return buffer[x+ (y/8)*SSD1306_LCDWIDTH] & (1 << y%8) ? 1 : 0;
+ return _ssd1306buffer[x+ (y/8)*SSD1306_LCDWIDTH] & (1 << y%8) ? 1 : 0;
}
/**************************************************************************/
/**************************************************************************/
void ssd1306ClearScreen()
{
- memset(buffer, 0, 1024);
+ memset(_ssd1306buffer, 0, 1024);
}
/**************************************************************************/
uint16_t i;
for (i=0; i<1024; i++)
{
- DATA(buffer[i]);
+ DATA(_ssd1306buffer[i]);
}
}
#define DATA(d) do { gpioSetValue( ST7565_A0_PORT, ST7565_A0_PIN, 1 ); sendByte( d ); } while (0);
#define DELAY(mS) do { systickDelay( mS / CFG_SYSTICK_DELAY_IN_MS ); } while(0);
-uint8_t buffer[128*64/8];
+uint8_t _st7565buffer[128*64/8];
/**************************************************************************/
/* Private Methods */
/**************************************************************************/
void st7565ClearScreen(void)
{
- memset(&buffer, 0x00, 128*64/8);
+ memset(&_st7565buffer, 0x00, 128*64/8);
}
/**************************************************************************/
/**************************************************************************/
void st7565Refresh(void)
{
- writeBuffer(buffer);
+ writeBuffer(_st7565buffer);
}
/**************************************************************************/
return;
// x is which column
- buffer[x+ (y/8)*128] |= (1 << (7-(y%8)));
+ _st7565buffer[x+ (y/8)*128] |= (1 << (7-(y%8)));
}
/**************************************************************************/
return;
// x is which column
- buffer[x+ (y/8)*128] &= ~(1 << (7-(y%8)));
+ _st7565buffer[x+ (y/8)*128] &= ~(1 << (7-(y%8)));
}
/**************************************************************************/
uint8_t st7565GetPixel(uint8_t x, uint8_t y)
{
if ((x >= 128) || (y >= 64)) return 0;
- return buffer[x+ (y/8)*128] & (1 << (7-(y%8)));
+ return _st7565buffer[x+ (y/8)*128] & (1 << (7-(y%8)));
}
/**************************************************************************/
}
}
+/**************************************************************************/
+/*!
+ @brief Draws a filled rounded corner
+
+ @param[in] xCenter
+ The horizontal center of the circle
+ @param[in] yCenter
+ The vertical center of the circle
+ @param[in] radius
+ The circle's radius in pixels
+ @param[in] position
+ The position of the corner, which affects how it will
+ be rendered
+ @param[in] color
+ Color used when drawing
+*/
+/**************************************************************************/
+void drawCornerFilled (uint16_t xCenter, uint16_t yCenter, uint16_t radius, drawCornerPosition_t position, uint16_t color)
+{
+ int16_t f = 1 - radius;
+ int16_t ddF_x = 1;
+ int16_t ddF_y = -2 * radius;
+ int16_t x = 0;
+ int16_t y = radius;
+ int16_t xc_px, yc_my, xc_mx, xc_py, yc_mx, xc_my;
+ int16_t lcdWidth = lcdGetWidth();
+
+ switch (position)
+ {
+ case DRAW_CORNERPOSITION_TOPRIGHT:
+ case DRAW_CORNERPOSITION_TOPLEFT:
+ if (xCenter < lcdWidth) drawLine(xCenter, yCenter-radius < 0 ? 0 : yCenter-radius, xCenter, yCenter, color);
+ break;
+ case DRAW_CORNERPOSITION_BOTTOMRIGHT:
+ case DRAW_CORNERPOSITION_BOTTOMLEFT:
+ if (xCenter < lcdWidth) drawLine(xCenter, yCenter-radius < 0 ? 0 : yCenter, xCenter, (yCenter-radius) + (2*radius), color);
+ break;
+ }
+
+ while (x<y)
+ {
+ if (f >= 0)
+ {
+ y--;
+ ddF_y += 2;
+ f += ddF_y;
+ }
+ x++;
+ ddF_x += 2;
+ f += ddF_x;
+
+ xc_px = xCenter+x;
+ xc_mx = xCenter-x;
+ xc_py = xCenter+y;
+ xc_my = xCenter-y;
+ yc_mx = yCenter-x;
+ yc_my = yCenter-y;
+
+ switch (position)
+ {
+ case DRAW_CORNERPOSITION_TOPRIGHT:
+ if ((xc_px < lcdWidth) && (xc_px >= 0)) drawLine(xc_px, yc_my, xc_px, yCenter, color);
+ if ((xc_py < lcdWidth) && (xc_py >= 0)) drawLine(xc_py, yc_mx, xc_py, yCenter, color);
+ break;
+ case DRAW_CORNERPOSITION_BOTTOMRIGHT:
+ if ((xc_px < lcdWidth) && (xc_px >= 0)) drawLine(xc_px, yCenter, xc_px, yc_my + 2*y, color);
+ if ((xc_py < lcdWidth) && (xc_py >= 0)) drawLine(xc_py, yCenter, xc_py, yc_mx + 2*x, color);
+ break;
+ case DRAW_CORNERPOSITION_TOPLEFT:
+ if ((xc_mx < lcdWidth) && (xc_mx >= 0)) drawLine(xc_mx, yc_my, xc_mx, yCenter, color);
+ if ((xc_my < lcdWidth) && (xc_my >= 0)) drawLine(xc_my, yc_mx, xc_my, yCenter, color);
+ break;
+ case DRAW_CORNERPOSITION_BOTTOMLEFT:
+ if ((xc_mx < lcdWidth) && (xc_mx >= 0)) drawLine(xc_mx, yCenter, xc_mx, yc_my + 2*y, color);
+ if ((xc_my < lcdWidth) && (xc_my >= 0)) drawLine(xc_my, yCenter, xc_my, yc_mx + 2*x, color);
+ break;
+ }
+ }
+}
+
/**************************************************************************/
/*!
@brief Draws a simple arrow of the specified width
DRAW_ROUNDEDCORNERS_RIGHT = 5
} drawRoundedCorners_t;
+typedef enum
+{
+ DRAW_CORNERPOSITION_TOPLEFT = 0,
+ DRAW_CORNERPOSITION_TOPRIGHT = 1,
+ DRAW_CORNERPOSITION_BOTTOMLEFT = 2,
+ DRAW_CORNERPOSITION_BOTTOMRIGHT = 3
+} drawCornerPosition_t;
+
typedef enum
{
DRAW_DIRECTION_LEFT,
void drawLineDotted ( uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t space, uint16_t solid, uint16_t color );
void drawCircle ( uint16_t xCenter, uint16_t yCenter, uint16_t radius, uint16_t color );
void drawCircleFilled ( uint16_t xCenter, uint16_t yCenter, uint16_t radius, uint16_t color );
+void drawCornerFilled (uint16_t xCenter, uint16_t yCenter, uint16_t radius, drawCornerPosition_t position, uint16_t color);
void drawArrow ( uint16_t x, uint16_t y, uint16_t size, drawDirection_t, uint16_t color );
void drawRectangle ( uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t color );
void drawRectangleFilled ( uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t color );
extern volatile uint8_t I2CSlaveBuffer[I2C_BUFSIZE];
extern volatile uint32_t I2CReadLength, I2CWriteLength;
-uint32_t i;
uint8_t monthday[12]={31,28,31,30,31,30,31,31,30,31,30,31};
static bool _isl12022mInitialised = false;
isl12022mError_t isl12022mWrite8 (uint8_t address, uint8_t reg, uint32_t value)
{
// Clear write buffers
+ uint32_t i;
for ( i = 0; i < I2C_BUFSIZE; i++ )
{
I2CMasterBuffer[i] = 0x00;
return ISL12022M_ERROR_I2C_BUFFEROVERFLOW;
// Clear write buffers
+ uint32_t i;
for ( i = 0; i < I2C_BUFSIZE; i++ )
{
I2CMasterBuffer[i] = 0x00;
extern volatile uint8_t I2CSlaveBuffer[I2C_BUFSIZE];
extern volatile uint32_t I2CReadLength, I2CWriteLength;
-uint32_t i;
-
static bool _lm75bInitialised = false;
/**************************************************************************/
lm75bError_e lm75bWrite8 (uint8_t reg, uint32_t value)
{
// Clear write buffers
+ uint32_t i;
for ( i = 0; i < I2C_BUFSIZE; i++ )
{
I2CMasterBuffer[i] = 0x00;
lm75bError_e lm75bRead16(uint8_t reg, int32_t *value)
{
// Clear write buffers
+ uint32_t i;
for ( i = 0; i < I2C_BUFSIZE; i++ )
{
I2CMasterBuffer[i] = 0x00;
extern volatile uint8_t I2CSlaveBuffer[I2C_BUFSIZE];
extern volatile uint32_t I2CReadLength, I2CWriteLength;
-uint32_t i;
-
static bool _tcs3414Initialised = false;
/**************************************************************************/
tcs3414Error_e tcs3414WriteCmd (uint8_t cmd)
{
// Clear write buffers
+ uint32_t i;
for ( i = 0; i < I2C_BUFSIZE; i++ )
{
I2CMasterBuffer[i] = 0x00;
tcs3414Error_e tcs3414Write8 (uint8_t reg, uint32_t value)
{
// Clear write buffers
+ uint32_t i;
for ( i = 0; i < I2C_BUFSIZE; i++ )
{
I2CMasterBuffer[i] = 0x00;
tcs3414Error_e tcs3414Read16(uint8_t reg, uint16_t *value)
{
// Clear write buffers
+ uint32_t i;
for ( i = 0; i < I2C_BUFSIZE; i++ )
{
I2CMasterBuffer[i] = 0x00;
extern volatile uint8_t I2CSlaveBuffer[I2C_BUFSIZE];
extern volatile uint32_t I2CReadLength, I2CWriteLength;
-uint32_t i;
-
static bool _tsl2561Initialised = false;
static tsl2561IntegrationTime_t _tsl2561IntegrationTime = TSL2561_INTEGRATIONTIME_402MS;
static tsl2561Gain_t _tsl2561Gain = TSL2561_GAIN_0X;
tsl2561Error_t tsl2561WriteCmd (uint8_t cmd)
{
// Clear write buffers
+ uint32_t i;
for ( i = 0; i < I2C_BUFSIZE; i++ )
{
I2CMasterBuffer[i] = 0x00;
tsl2561Error_t tsl2561Write8 (uint8_t reg, uint32_t value)
{
// Clear write buffers
+ uint32_t i;
for ( i = 0; i < I2C_BUFSIZE; i++ )
{
I2CMasterBuffer[i] = 0x00;
tsl2561Error_t tsl2561Read16(uint8_t reg, uint16_t *value)
{
// Clear write buffers
+ uint32_t i;
for ( i = 0; i < I2C_BUFSIZE; i++ )
{
I2CMasterBuffer[i] = 0x00;
#define USB_DEVINTST_EP6 ((unsigned int) 0x00000080) // USB core interrupt for EP6
#define USB_DEVINTST_EP7_MASK ((unsigned int) 0x00000100)
#define USB_DEVINTST_EP7 ((unsigned int) 0x00000100) // USB core interrupt for EP7
-#define USB_DEVINTST_DEV_START_MASK ((unsigned int) 0x00000200)
-#define USB_DEVINTST_DEV_START ((unsigned int) 0x00000200)
+#define USB_DEVINTST_DEV_STAT_MASK ((unsigned int) 0x00000200)
+#define USB_DEVINTST_DEV_STAT ((unsigned int) 0x00000200)
#define USB_DEVINTST_CC_EMPTY_MASK ((unsigned int) 0x00000400)
#define USB_DEVINTST_CC_EMPTY ((unsigned int) 0x00000400)
#define USB_DEVINTST_CD_FULL_MASK ((unsigned int) 0x00000800)
#define USB_DEVINTEN_EP6 ((unsigned int) 0x00000080)
#define USB_DEVINTEN_EP7_MASK ((unsigned int) 0x00000100)
#define USB_DEVINTEN_EP7 ((unsigned int) 0x00000100)
-#define USB_DEVINTEN_DEV_START_MASK ((unsigned int) 0x00000200)
-#define USB_DEVINTEN_DEV_START ((unsigned int) 0x00000200)
+#define USB_DEVINTEN_DEV_STAT_MASK ((unsigned int) 0x00000200)
+#define USB_DEVINTEN_DEV_STAT ((unsigned int) 0x00000200)
#define USB_DEVINTEN_CC_EMPTY_MASK ((unsigned int) 0x00000400)
#define USB_DEVINTEN_CC_EMPTY ((unsigned int) 0x00000400)
#define USB_DEVINTEN_CD_FULL_MASK ((unsigned int) 0x00000800)
#define USB_DEVINTCLR_EP6 ((unsigned int) 0x00000080)
#define USB_DEVINTCLR_EP7_MASK ((unsigned int) 0x00000100)
#define USB_DEVINTCLR_EP7 ((unsigned int) 0x00000100)
-#define USB_DEVINTCLR_DEV_START_MASK ((unsigned int) 0x00000200)
-#define USB_DEVINTCLR_DEV_START ((unsigned int) 0x00000200)
+#define USB_DEVINTCLR_DEV_STAT_MASK ((unsigned int) 0x00000200)
+#define USB_DEVINTCLR_DEV_STAT ((unsigned int) 0x00000200)
#define USB_DEVINTCLR_CC_EMPTY_MASK ((unsigned int) 0x00000400)
#define USB_DEVINTCLR_CC_EMPTY ((unsigned int) 0x00000400)
#define USB_DEVINTCLR_CD_FULL_MASK ((unsigned int) 0x00000800)
#define USB_DEVINTSET_EP6 ((unsigned int) 0x00000080)
#define USB_DEVINTSET_EP7_MASK ((unsigned int) 0x00000100)
#define USB_DEVINTSET_EP7 ((unsigned int) 0x00000100)
-#define USB_DEVINTSET_DEV_START_MASK ((unsigned int) 0x00000200)
-#define USB_DEVINTSET_DEV_START ((unsigned int) 0x00000200)
+#define USB_DEVINTSET_DEV_STAT_MASK ((unsigned int) 0x00000200)
+#define USB_DEVINTSET_DEV_STAT ((unsigned int) 0x00000200)
#define USB_DEVINTSET_CC_EMPTY_MASK ((unsigned int) 0x00000400)
#define USB_DEVINTSET_CC_EMPTY ((unsigned int) 0x00000400)
#define USB_DEVINTSET_CD_FULL_MASK ((unsigned int) 0x00000800)
#include "core/cmd/cmd.h"
#endif
-/**************************************************************************/
-/*!
- Approximates a 1 millisecond delay using "nop". This is less
- accurate than a dedicated timer, but is useful in certain situations.
-
- The number of ticks to delay depends on the optimisation level set
- when compiling (-O). Depending on the compiler settings, one of the
- two defined values for 'delay' should be used.
-*/
-/**************************************************************************/
-void delayms(uint32_t ms)
-{
- uint32_t delay = ms * ((CFG_CPU_CCLK / 100) / 45); // Release Mode (-Os)
- // uint32_t delay = ms * ((CFG_CPU_CCLK / 100) / 120); // Debug Mode (No optimisations)
-
- while (delay > 0)
- {
- __asm volatile ("nop");
- delay--;
- }
-}
-
/**************************************************************************/
/*!
Main program entry point. After reset, normal code execution will
void cmd_getpixel(uint8_t argc, char **argv);
void cmd_calibrate(uint8_t argc, char **argv);
void cmd_orientation(uint8_t argc, char **argv);
+void cmd_roundedcorner(uint8_t argc, char **argv);
void cmd_text(uint8_t argc, char **argv);
void cmd_textw(uint8_t argc, char **argv);
+void cmd_triangle(uint8_t argc, char **argv);
void cmd_tsthreshhold(uint8_t argc, char **argv);
void cmd_tswait(uint8_t argc, char **argv);
#ifdef CFG_SDCARD
{ "g", 2, 2, 0, cmd_getpixel , "Get Pixel" , "'g <x> <y>'" },
{ "l", 5, 7, 0, cmd_line , "Line" , "'l <x1> <y1> <x2> <y2> <color> [<empty> <solid>]'" },
{ "L", 1, 1, 0, cmd_backlight , "Backlight" , "'L <0|1>'" },
+ { "n", 5, 5, 0, cmd_roundedcorner , "Rounded Corner" , "'n <x> <y> <radius> <corner> <color>'" },
{ "o", 0, 1, 0, cmd_orientation , "LCD Orientation" , "'o [<0|1>]'" },
{ "p", 3, 3, 0, cmd_pixel , "Draw Pixel" , "'p <x> <y> <color>'" },
{ "P", 9, 9, 0, cmd_progress , "Progress Bar" , "'P <x> <y> <w> <h> <%> <bclr> <bfillclr> <pbrdclr> <pfillclr>'" },
{ "R", 7, 7, 0, cmd_rectangleround , "Rounded Rectangle" , "'R <x1> <y1> <x2> <y2> <color> <radius> <corners>'" },
{ "s", 2, 99, 0, cmd_textw , "Text Width" , "'s <font#> <msg>'" },
{ "t", 5, 99, 0, cmd_text , "Text" , "'t <x> <y> <color> <font#> <msg>'" },
+ { "v", 7, 8, 0, cmd_triangle , "Triangle" , "'v <x1> <y1> <x2> <y2> <x3> <y3> <color> [<filled[0|1]>]'" },
{ "W", 0, 1, 0, cmd_tswait , "Wait for Touch" , "'W [<ms>]'" },
{ "x", 0, 1, 0, cmd_tsthreshhold , "Touch Threshold" , "'x [<0..254>]'" },
#endif
--- /dev/null
+/**************************************************************************/
+/*!
+ @file cmd_reset.c
+ @author K. Townsend (microBuilder.eu)
+
+ @brief Code to execute for cmd_reset in the 'core/cmd'
+ command-line interpretter.
+
+ @section LICENSE
+
+ Software License Agreement (BSD License)
+
+ Copyright (c) 2010, microBuilder SARL
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ 3. Neither the name of the copyright holders nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
+ EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+/**************************************************************************/
+#include <stdio.h>
+
+#include "projectconfig.h"
+#include "core/cmd/cmd.h"
+#include "core/cpu/cpu.h"
+#include "project/commands.h" // Generic helper functions
+
+#ifdef CFG_I2CEEPROM
+ #include "drivers/eeprom/eeprom.h"
+ #include "core/uart/uart.h"
+
+/**************************************************************************/
+/*!
+ Resets the board using the AIRCR register
+*/
+/**************************************************************************/
+void cmd_reset(uint8_t argc, char **argv)
+{
+ cpuReset();
+}
+
+#endif
--- /dev/null
+/**************************************************************************/
+/*!
+ @file cmd_backlight.c
+ @author K. Townsend (microBuilder.eu)
+
+ @brief Code to execute for cmd_backlight in the 'core/cmd'
+ command-line interpretter.
+
+ @section LICENSE
+
+ Software License Agreement (BSD License)
+
+ Copyright (c) 2010, microBuilder SARL
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ 3. Neither the name of the copyright holders nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
+ EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+/**************************************************************************/
+#include <stdio.h>
+
+#include "projectconfig.h"
+#include "core/cmd/cmd.h"
+#include "project/commands.h" // Generic helper functions
+
+#ifdef CFG_TFTLCD
+ #include "drivers/lcd/tft/lcd.h"
+ #include "drivers/lcd/tft/drawing.h"
+
+/**************************************************************************/
+/*!
+ Sets the LCD backlight state
+*/
+/**************************************************************************/
+void cmd_backlight(uint8_t argc, char **argv)
+{
+ int32_t input;
+ bool state;
+ getNumber (argv[0], &input);
+
+ // Set backlight
+ state = input < 1 ? false : true;
+ lcdBacklight(state);
+}
+
+#endif
--- /dev/null
+/**************************************************************************/
+/*!
+ @file cmd_roundedcorner.c
+ @author K. Townsend (microBuilder.eu)
+
+ @brief Code to execute for cmd_roundedcorner in the 'core/cmd'
+ command-line interpretter.
+
+ @section LICENSE
+
+ Software License Agreement (BSD License)
+
+ Copyright (c) 2010, microBuilder SARL
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ 3. Neither the name of the copyright holders nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
+ EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+/**************************************************************************/
+#include <stdio.h>
+
+#include "projectconfig.h"
+#include "core/cmd/cmd.h"
+#include "project/commands.h" // Generic helper functions
+
+#ifdef CFG_TFTLCD
+ #include "drivers/lcd/tft/lcd.h"
+ #include "drivers/lcd/tft/drawing.h"
+
+/**************************************************************************/
+/*!
+ Displays a rounded corner on the LCD.
+*/
+/**************************************************************************/
+void cmd_roundedcorner(uint8_t argc, char **argv)
+{
+ int32_t x, y, r, corner, color;
+
+ // Convert supplied parameters
+ getNumber (argv[0], &x);
+ getNumber (argv[1], &y);
+ getNumber (argv[2], &r);
+ getNumber (argv[3], &corner);
+ getNumber (argv[4], &color);
+
+ // Validate data
+ if (corner < 0 || corner > 3)
+ {
+ printf("Invalid Corner%s", CFG_PRINTF_NEWLINE);
+ return;
+ }
+ if (color < 0 || color > 0xFFFF)
+ {
+ printf("Invalid Color%s", CFG_PRINTF_NEWLINE);
+ return;
+ }
+ if (r < 1)
+ {
+ printf("Invalid Radius%s", CFG_PRINTF_NEWLINE);
+ return;
+ }
+
+ drawCornerFilled (x, y, r, corner, color);
+}
+
+#endif
--- /dev/null
+/**************************************************************************/
+/*!
+ @file cmd_triangle.c
+ @author K. Townsend (microBuilder.eu)
+
+ @brief Code to execute for cmd_triangle in the 'core/cmd'
+ command-line interpretter.
+
+ @section LICENSE
+
+ Software License Agreement (BSD License)
+
+ Copyright (c) 2010, microBuilder SARL
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ 3. Neither the name of the copyright holders nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
+ EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+/**************************************************************************/
+#include <stdio.h>
+
+#include "projectconfig.h"
+#include "core/cmd/cmd.h"
+#include "project/commands.h" // Generic helper functions
+
+#ifdef CFG_TFTLCD
+ #include "drivers/lcd/tft/lcd.h"
+ #include "drivers/lcd/tft/drawing.h"
+
+/**************************************************************************/
+/*!
+ Displays a triangle on the LCD.
+*/
+/**************************************************************************/
+void cmd_triangle(uint8_t argc, char **argv)
+{
+ int32_t x1, y1, x2, y2, x3, y3, c, filled;
+ filled = 0;
+
+ // Convert supplied parameters
+ getNumber (argv[0], &x1);
+ getNumber (argv[1], &y1);
+ getNumber (argv[2], &x2);
+ getNumber (argv[3], &y2);
+ getNumber (argv[4], &x3);
+ getNumber (argv[5], &y3);
+ getNumber (argv[6], &c);
+ if (argc == 8)
+ {
+ getNumber (argv[7], &filled);
+ }
+
+ // ToDo: Validate data!
+ if (c < 0 || c > 0xFFFF)
+ {
+ printf("Invalid Color%s", CFG_PRINTF_NEWLINE);
+ return;
+ }
+
+ if (filled)
+ drawTriangleFilled(x1, y1, x2, y2, x3, y3, (uint16_t)c);
+ else
+ drawTriangle(x1, y1, x2, y2, x3, y3, (uint16_t)c);
+}
+
+#endif
are using by enabling one of the following definitions. The code base
will then try to configure itself accordingly for that board.
-----------------------------------------------------------------------*/
- // #define CFG_BRD_LPC1343_REFDESIGN
- #define CFG_BRD_LPC1343_TFTLCDSTANDALONE_USB
+ #define CFG_BRD_LPC1343_REFDESIGN
+ // #define CFG_BRD_LPC1343_TFTLCDSTANDALONE_USB
// #define CFG_BRD_LPC1343_TFTLCDSTANDALONE_UART
// #define CFG_BRD_LPC1343_802154USBSTICK
/*=========================================================================*/
/*=========================================================================*/
+/*=========================================================================
+ ALTERNATE RESET PIN
+ -----------------------------------------------------------------------
+
+ CFG_ALTRESET If defined, indicates that a GPIO pin should be
+ configured as an alternate reset pin in addition
+ to the dedicated reset pin.
+ CFG_ALTRESET_PORT The GPIO port where the alt reset pin is located
+ CFG_ALTRESET_PIN The GPIO pin where the alt reset pin is located
+
+ -----------------------------------------------------------------------*/
+ #ifdef CFG_BRD_LPC1343_TFTLCDSTANDALONE_UART
+ #define CFG_ALTRESET
+ #define CFG_ALTRESET_PORT (1)
+ #define CFG_ALTRESET_PIN (5) // P1.5 = RTS
+ #endif
+/*=========================================================================*/
+
+
/*=========================================================================
UART
-----------------------------------------------------------------------
#ifdef CFG_BRD_LPC1343_TFTLCDSTANDALONE_USB
#define CFG_INTERFACE
#define CFG_INTERFACE_MAXMSGSIZE (256)
- #define CFG_INTERFACE_PROMPT "LCD >> "
+ #define CFG_INTERFACE_PROMPT "CMD >> "
#define CFG_INTERFACE_SILENTMODE (0)
#define CFG_INTERFACE_DROPCR (0)
#define CFG_INTERFACE_ENABLEIRQ (0)
#ifdef CFG_BRD_LPC1343_TFTLCDSTANDALONE_UART
#define CFG_INTERFACE
#define CFG_INTERFACE_MAXMSGSIZE (256)
- #define CFG_INTERFACE_PROMPT "LCD >> "
+ #define CFG_INTERFACE_PROMPT ">>"
#define CFG_INTERFACE_SILENTMODE (1)
#define CFG_INTERFACE_DROPCR (1)
#define CFG_INTERFACE_ENABLEIRQ (1)
// Stay compatible with ugly "windows" style
#define BOOL bool
+
+#ifndef TRUE
#define TRUE true
+#endif
+#ifndef FALSE
#define FALSE false
+#endif
typedef volatile uint8_t REG8;
typedef volatile uint16_t REG16;
gpioSetDir(CFG_LED_PORT, CFG_LED_PIN, 1);
gpioSetValue(CFG_LED_PORT, CFG_LED_PIN, CFG_LED_OFF);
+ // Config alt reset pin if requested (really only relevant to LPC1343 LCD Board)
+ #ifdef CFG_ALTRESET
+ gpioSetDir (CFG_ALTRESET_PORT, CFG_ALTRESET_PIN, gpioDirection_Input);
+ gpioSetInterrupt (CFG_ALTRESET_PORT, CFG_ALTRESET_PIN, gpioInterruptSense_Level, gpioInterruptEdge_Single, gpioInterruptEvent_ActiveHigh);
+ gpioIntEnable (CFG_ALTRESET_PORT, CFG_ALTRESET_PIN);
+ #endif
+
// Initialise EEPROM
#ifdef CFG_I2CEEPROM
mcp24aaInit();