int _start(void) { int i = 0; int j = 0; unsigned int col = 0xff; //unsigned int (*p)[800] = (void*)nFBaddr; //initLcd(nFBaddr); unsigned int (*p)[800] = (void*)FBAddr; initLcd(FBAddr); #if 0 while(1) { for (i = 0; i < 480; i++) { for (j = 0; j < 800; j++) { p[i][j] = col; } } col = col << 8; if (col == 0xff000000) col = 0xff; } #endif return 0; }
void setup() { initLeds(); initLcd(); initSensors(); enableDigitalSensors(); enableAnalogSensors(); }
/****************************************************************************** * @fn initFlash * * @brief * Initializes components for use with the Flash application example. * * Parameters: * * @param void * * @return void * ******************************************************************************/ void initFlash(void) { initLcd(); INIT_BUTTON(); INIT_GLED(); INIT_YLED(); }
/****************************************************************************** * @fn initDma * * @brief * Initializes components for the DMA transfer application example. * * Parameters: * * @param void * * @return void * ******************************************************************************/ void initDma(void) { initLcd(); SET_MAIN_CLOCK_SOURCE(CRYSTAL); INIT_BUTTON(); INIT_GLED(); INIT_YLED(); }
/****************************************************************************** * @fn initAdc * * @brief * Initializes components for use with the ADC application example (e.g. * LEDs, PotMeter, Joystick). * * Parameters: * * @param void * * @return void * ******************************************************************************/ void initAdc(void) { initLcd(); SET_MAIN_CLOCK_SOURCE(CRYSTAL); //init LEDs INIT_GLED(); INIT_YLED(); INIT_POT(); INIT_JOYSTICK(); }
int main() { int column; char str[24]; /* Test #1: Initialize LCD screen */ initLcd(); _delay_ms(DELAY_COUNT); /* Test #2: Write letter in each cell on screen */ for(column = 0; column < 16; column ++) { lcdCursor(1, column+1); snprintf(str, sizeof(str), "%X", column); lcdString(str); _delay_ms(DELAY_COUNT/6); } for(column = 0; column < 16; column ++) { lcdCursor(2, column+1); snprintf(str, sizeof(str), "%x", column); lcdString(str); _delay_ms(DELAY_COUNT/6); } /* Test #3: Clear screen */ lcdClear(); _delay_ms(DELAY_COUNT); /* Test #4: Write first line */ lcdCursor(1, 1); snprintf(str, sizeof(str), "----++++----++++0000"); lcdString(str); _delay_ms(DELAY_COUNT); /* Test #5: Write second line */ lcdCursor(2, 1); snprintf(str, sizeof(str), "AAAABBBBAAAABBBB===="); lcdString(str); _delay_ms(DELAY_COUNT); return 0; }
void initAllPeripherals() { /*init analog*/ initAdcPortA(); /*init stepper motors*/ initStepper(); /*init dc motors*/ initDcMotorControl(); /*init Uart*/ initSerialPortC(); /*init Lcd*/ initLcd(LCD_DISP_ON); gotoLcd(4); putsLcd("WELCOME!"); gotoLcd(65); putsLcd("Init Completed!"); }
void CmdLcdTest(int mode) { char *tempCmdArgStr; uint32_t pos = 0; if(mode != CMD_INTERACTIVE) return; fetch_string_arg((char**)&tempCmdArgStr); fetch_uint32_arg((uint32_t*)&pos); /*if(!lcdInitDone) { initLcd(LCD_DISP_ON_BLINK); //lcdInitDone = 1; }*/ initLcd(LCD_DISP_ON); printf("sending string %s at %d\n", tempCmdArgStr, (int)pos); setLcdBlBrightness(500); clearLcd(); gotoLcd(pos); putsLcd(tempCmdArgStr); }
int main() { STATUS ret; char msg[256]; ret = initLcd(); ASSERT(ret == STATUS_OK); //ret = initAdc(); //ASSERT(ret == STATUS_OK); ret = initMotor(); ASSERT(ret == STATUS_OK); ret = initZigbee(); ASSERT(ret == STATUS_OK); ret = initFileSystem(); ASSERT(ret == STATUS_OK); while (!feof(MAP_FILE)){ fscanf(MAP_FILE, "%s", msg); printf("%s", msg); } while(1); return 0; }
int main() { MotorDirection dirs[] = {FORWARD, BACKWARD, RIGHT, LEFT, SOFT_RIGHT, SOFT_LEFT, SOFT_RIGHT2, SOFT_LEFT2, STOP}; char strDirs[9][16] = {"FORWARD", "BACKWARD", "RIGHT", "LEFT", "SOFT_RIGHT", "SOFT_LEFT", "SOFT_RIGHT2", "SOFT_LEFT2", "STOP"}; int idx; initMotor(); initLcd(); #if 0 /* Test #1: Check direction */ motorVelocitySet(255, 255); for(idx = 0; idx < (sizeof(dirs)/sizeof(dirs[0])); idx ++) { lcdClear(); lcdCursor(1,1); lcdString(strDirs[idx]); _delay_ms(DELAY_COUNT*2); motorDirectionSet(dirs[idx]); /* Delay for some time */ _delay_ms(DELAY_COUNT); motorDirectionSet(STOP); } /* Test #2: Check speed */ lcdClear(); lcdCursor(1,1); lcdString("Speed : "); lcdCursor(2,1); lcdString("L 100, R 100"); _delay_ms(DELAY_COUNT*2); motorVelocitySet(100, 100); motorDirectionSet(FORWARD); /* Delay for some time */ _delay_ms(DELAY_COUNT); motorDirectionSet(STOP); /* Test #3: Check individual wheel speed (L < R) */ lcdClear(); lcdCursor(1,1); lcdString("Speed : "); lcdCursor(2,1); lcdString("L 100, R 255"); _delay_ms(DELAY_COUNT*2); motorVelocitySet(100, 255); /* Left turn expected */ motorDirectionSet(FORWARD); /* Delay for some time */ _delay_ms(DELAY_COUNT); motorDirectionSet(STOP); /* Test #4: Check individual wheel speed (L > R) */ lcdClear(); lcdCursor(1,1); lcdString("Speed : "); lcdCursor(2,1); lcdString("L 255, R 100"); _delay_ms(DELAY_COUNT*2); motorVelocitySet(255, 100); /* Right turn expected */ motorDirectionSet(FORWARD); /* Delay for some time */ _delay_ms(DELAY_COUNT); motorDirectionSet(STOP); /* Test #5: Check left position encoder */ motorLeftPositionEncoderInit(leftPosEncoderIsr); lPosCount = 100; motorVelocitySet(255, 255); motorDirectionSet(FORWARD); #endif /* Test #6: Check orientation */ motorLeftPositionEncoderInit(leftPosEncoderIsr); lPosCount = 23; motorVelocitySet(150, 150); motorDirectionSet(LEFT); while(1); return 0; }
int main() { AdcChannel channel[] = { ADC_BATTERY_VOLTAGE, ADC_WHITE_LINE1, ADC_WHITE_LINE2, ADC_WHITE_LINE3, ADC_IR_PROXIMITY1, ADC_IR_PROXIMITY2, ADC_IR_PROXIMITY3, ADC_IR_PROXIMITY4, ADC_IR_PROXIMITY5, ADC_IR_RANGE1, ADC_IR_RANGE2, ADC_IR_RANGE3, ADC_IR_RANGE4, ADC_IR_RANGE5, ADC_SERVO_POD1, ADC_SERVO_POD1, ADC_LAST }; char strChannel[17][20] = { "ADC_BATTERY_VOLTAGE", "ADC_WHITE_LINE1", "ADC_WHITE_LINE2", "ADC_WHITE_LINE3", "ADC_IR_PROXIMITY1", "ADC_IR_PROXIMITY2", "ADC_IR_PROXIMITY3", "ADC_IR_PROXIMITY4", "ADC_IR_PROXIMITY5", "ADC_IR_RANGE1", "ADC_IR_RANGE2", "ADC_IR_RANGE3", "ADC_IR_RANGE4", "ADC_IR_RANGE5", "ADC_SERVO_POD1", "ADC_SERVO_POD2", "ADC_LAST" }; char buf[17]; UINT value, idx; initAdc(); initLcd(); for(idx = 0; idx < (sizeof(channel)/sizeof(channel[0])); idx ++) { lcdClear(); lcdCursor(1,1); lcdString(strChannel[idx]); lcdCursor(2,1); if(getAdcValue(channel[idx], &value) == STATUS_OK) { snprintf(buf, sizeof(buf), "%d", value); lcdString(buf); } else { lcdString("Error"); } _delay_ms(DELAY_COUNT); } return 0; }
int main() { long int savedfreq = 0; int s, c; unsigned char sw=0; // PORTB output for LCD DDRB = 0xff; PORTB = 0xff; #ifdef BOARD2 // PORTC PC0-4 output, PC5 input DDRC = 0x1f; PORTC = 0x00; sbi(PORTC, MUTE); #endif #ifdef BOARD1 // PORTC PC0,2-5 output, PC1 input DDRC = 0x3d; PORTC = 0x00; sbi(PORTC, MUTE); #endif // PORTD is input with pullup DDRD = 0x00; PORTD = 0xff; initLcd(); initADC(); // set reference freq fref = eeprom_read_word((unsigned int *)0x00); if (fref < 2000 || (fref % 100) != 0) { fref = 12000; eeprom_write_word((unsigned int *)0x00, fref); } // read squelch level from eeprom muteval = eeprom_read_word((unsigned int *)0x0c); if (muteval < 0 || muteval > 100) { muteval = 0; eeprom_write_word((unsigned int *)0x0c, muteval); } // read last frequency from eeprom freq = eeprom_read_dword((unsigned long int *)0x10); if (freq < 1240000UL || freq > 1300000UL) { freq = 1298375UL; eeprom_write_dword((unsigned long int *)0x10, freq); } // read shift from eeprom shift = eeprom_read_word((unsigned int *)0x18); if (shift < 60000UL || shift > 60000UL) { shift = -28000UL; eeprom_write_word((unsigned int *)0x18, shift); } // read tone (*10) from eeprom tone = eeprom_read_word((unsigned int *)0x1c); if (tone < 650 || tone > 1500) { tone = 650; eeprom_write_word((unsigned int *)0x1c, tone); } initInterrupts(); initPLL(freq - IF); update(); sprintf(str, "JPD 23cm v%s", version); lcdCmd(0x80); lcdStr(str); _delay_ms(500); for (;;) { lcdCmd(0x80); lcdStr("VFO "); lcdCmd(0xc0); lcdStr(" "); update(); for (;;) { // read switches on PORTD sw = PIND; // switch from tx to rx?? if (tx && (sw & (1<<PTT) )) { cbi(PORTC, TXON); // switch TX off tx = FALSE; // TCCR2A &= ~(1<<COM2A1); update(); } // switch from rx to tx? else if (!tx && !(sw & (1<<PTT) )) { tx = TRUE; displaySmeter(0); // switch TX on sbi(PORTC, TXON); sbi(PORTC, MUTE); // if (tone > 650) { // TCCR2A |= (1<<COM2A1); // } update(); } if (!tx) { s = readSmeter(); displaySmeter(s); if (s > muteval) cbi(PORTC, MUTE); else sbi(PORTC, MUTE); } // switch shift off if ( (shiftSwitch == TRUE) && (sw & (1<<SHIFTKEY) )) { shiftSwitch = FALSE; update(); } // switch shift on else if ( (shiftSwitch == FALSE) && !(sw & (1<<SHIFTKEY) )) { shiftSwitch = TRUE; update(); } // save vfo frequency in eeprom after ~2 secs inactivity if (tick > 200) { if (freq != savedfreq) { eeprom_write_dword((unsigned long int *)0x10, freq); savedfreq = freq; } } // handle encoder pulses c = handleRotary(); if (c!=0) { if (c>0) { freq += step; } else { freq -= step; } tick = 0; update(); } if (rotaryPushed()) { doMenu(); break; } } } }