Ejemplo n.º 1
0
int main(int argc, char** argv[]) {
    NLSystemContext ctx;
    bool inBounds;
    uint32 i;

    //Set default precision for GNU MP:
    mpf_set_default_prec(256);

    //Initialize our bigFloat arrays:
    initArray(state, in_systemVars, 39);
    initArray(minBounds, in_minBounds, 39);
    initArray(maxBounds, in_maxBounds, 39);

    //Initialize our NLSystemContext:
    initNLSystemContext(&ctx, state, minBounds, maxBounds, 39);

    //Run the main non-linear function:
    Jianmin(&ctx);

    //Check to make sure the system stayed within constraints:
    inBounds = checkBounds(&ctx, 39);

    if(inBounds == false) {
        printf("\nThe system strayed outside of its constraints! Please check your math.\n");
    }
    
    //free up the memory GNU MP allocated behind the scenes:
    clearArray(state, 39);
    clearArray(minBounds, 39);
    clearArray(maxBounds, 39);

    return 0;
}
Ejemplo n.º 2
0
int main( int argc, char *argv[] )
{
    int a[] = { 2,3,5,7,11 };
    int aLen = 5;

    int b[] = { 4,6,8, 12, 16 };
    int bLen=5;

    int c[10], d[7];



    printf("\nBefore swap:\n" );
    printArray( a, aLen ); /* we pass just the array's name. No []s */
    printArray( b, bLen ); /* we pass just the array's name. No []s */

    swapArrayVals( a, aLen, b, bLen ); /* Note we don't use & before the arrays - an array's name is a const pointer */

    printf("\nAfter swap:\n" );
    printArray( a, aLen ); /* we pass just the array's name. No []s */
    printArray( b, bLen ); /* we pass just the array's name. No []s */


    initArray( c, 10, 2 ); /* 10 elements. Each c[i] assigned  i*2 */
    initArray( d, 7, 5 );  /*  7 elements. Each d[i] assigned  i*7 */
    printArray( c, 10 );
    printArray( d, 7 );


    return 0;
}
Ejemplo n.º 3
0
void arrayInStruct(struct array * v0, struct array * * out)
{
  struct s_unsignedS32_arr_unsignedS32_UD e0 = { .member1 = 0, .member2 = NULL };
  uint32_t len1;
  struct s_unsignedS32_arr_unsignedS32_UD v2 = { .member1 = 0, .member2 = NULL };
  uint32_t v1;
  
  (e0).member1 = getLength(v0);
  (e0).member2 = initArray((e0).member2, sizeof(uint32_t), getLength(v0));
  copyArray((e0).member2, v0);
  (v2).member1 = (e0).member1;
  (v2).member2 = initArray((v2).member2, sizeof(uint32_t), getLength((e0).member2));
  copyArray((v2).member2, (e0).member2);
  v1 = ((e0).member1 > 0);
  while (v1)
  {
    (v2).member1 = ((e0).member1 - 1);
    len1 = getLength((e0).member2);
    (v2).member2 = initArray((v2).member2, sizeof(uint32_t), len1);
    for (uint32_t v3 = 0; v3 < len1; v3 += 1)
    {
      at(uint32_t,(v2).member2,v3) = (at(uint32_t,(e0).member2,v3) + 5);
    }
    (e0).member1 = (v2).member1;
    (e0).member2 = initArray((e0).member2, sizeof(uint32_t), getLength((v2).member2));
    copyArray((e0).member2, (v2).member2);
    v1 = ((e0).member1 > 0);
  }
  *out = initArray(*out, sizeof(uint32_t), getLength((e0).member2));
  copyArray(*out, (e0).member2);
}
Ejemplo n.º 4
0
int main (int argc, char *argv[])
{
	array* a = initArray (7, 5);
	array* b = initArray (7, 5);
	playGame (a, b);
	freeArray (a);
	freeArray (b);

	return 0;
}
void condenseFunctionValues()
/* combine function values for single snp */
{
char query[512];
struct sqlConnection *conn = hAllocConn();
struct sqlResult *sr;
char **row;
FILE *f;
char *currentSnpString = NULL;
int currentSnpNum = 0;
int functionIndex = 0;

f = hgCreateTabFile(".", "ContigLocusIdCondense");

safef(query, sizeof(query), "select snp_id, fxn_class from ContigLocusIdFilter");

initArray();
sr = sqlGetResult(conn, query);
while ((row = sqlNextRow(sr)) != NULL)
    {
    functionIndex = sqlUnsigned(row[1]);
    if (functionIndex == 8) continue;
    if (functionIndex > 8) 
        {
	verbose(1, "unexpected functionIndex %d\n", functionIndex);
	continue;
	}
    if (currentSnpString == NULL) 
        {
        currentSnpString = cloneString(row[0]);
	currentSnpNum = sqlUnsigned(row[0]);
	}
    if (!sameString(row[0], currentSnpString))
        {
	fprintf(f, "%s\t", currentSnpString);
	printArray(f);
	initArray();
	if (currentSnpNum > sqlUnsigned(row[0]))
	    errAbort("snps out of order: %d before %s\n", currentSnpNum, row[0]);
	currentSnpString = cloneString(row[0]);
	currentSnpNum = sqlUnsigned(row[0]);
	}
    functionFound[functionIndex] = TRUE;
    }
fprintf(f, "%s\t", currentSnpString);
printArray(f);
sqlFreeResult(&sr);
hFreeConn(&conn);
carefulClose(&f);
}
Ejemplo n.º 6
0
int Encryptor::setup() {
    if (m_cipher == NULL) { return STAT_PROJECT_ERROR; }
    int status = STAT_OK;
    status = initArray(m_ad, pCaesarSettings->adLength, pCaesarSettings->adType);
    if (status != STAT_OK) { return status; }
    status = initArray(m_key, pCaesarSettings->keyLength, pCaesarSettings->keyType);
    if (status != STAT_OK) { return status; }
    status = initArray(m_smn, pCaesarSettings->smnLength, pCaesarSettings->smnType);
    if (status != STAT_OK) { return status; }
    status = initArray(m_pmn, pCaesarSettings->pmnLength, pCaesarSettings->pmnType);
    if (status != STAT_OK) { return status; }
    status = initArray(m_plaintext, pCaesarSettings->plaintextLength, pCaesarSettings->plaintextType);
    if (status != STAT_OK) { return status; }
    m_setup = true;
    return status;
}
Ejemplo n.º 7
0
static float performAveraging(void (*f)(void)){
    initArray(arraySize, globalArray);
    printArray(arraySize, globalArray);

 
	uint64_t start, end;
	uint64_t tsc_per_ms = 0;
	sys_debug_get_tsc_per_ms(&tsc_per_ms);
	printf("TSC PER MS = %" PRIu64 "\n", tsc_per_ms);

	int repeats = 0;
	float elapsed = 0;

    if(loops < 1000000){repeats = 10;}

	for(int i = 0; i<=repeats; i++){
		start = rdtsc();
		(*f)();
		end = rdtsc();
		
		uint64_t diff = (end - start) / tsc_per_ms;
		float sample = (diff / 1000) + ((diff % 1000) / 1000.0);
		elapsed += (1.0/(1+i)) * (sample - elapsed); 
	}

        printArray(arraySize, globalArray);
        return elapsed;
}
Ejemplo n.º 8
0
ConsoleGraphics::ConsoleGraphics(int breite, int hoehe)
{
	this->lastStatusChar = 0,
	this->breite = breite;
	this->hoehe = hoehe;
	initArray();
}
Ejemplo n.º 9
0
int main() {
    initArray();
    printArray();
    
    int i, j;
    float x;
    
    do {
        updateValue();
        printArray();            
        printf("Entrer i : ");
        scanf("%d", &i);
        printf("Entrer j : ");
        scanf("%d", &j);
        printf("Entrer x : ");
        scanf("%f", &x);
        
        if(i >= 0 && i < MAX_LINES) {
            if(j >= 0 && j < MAX_LINES) {
                T[i - 1][j - 1] = x;
            }
        }
        
    } while(i >= 0);

    return 0;
}
void arrayInStructInStruct(struct s_2_unsignedS32_s_2_unsignedS32_arr_unsignedS32 * v0, struct s_2_unsignedS32_s_2_unsignedS32_arr_unsignedS32 * out)
{
  (*out).member1 = (*v0).member1;
  ((*out).member2).member1 = ((*v0).member2).member1;
  ((*out).member2).member2 = initArray(((*out).member2).member2, sizeof(uint32_t), getLength(((*v0).member2).member2));
  copyArray(((*out).member2).member2, ((*v0).member2).member2);
}
Ejemplo n.º 11
0
void ivar_get_array_nontask( struct array *var, struct ivar iv )
{
    struct ivar_internals *ivi = iv.internals;
    struct array *ptr;
    log_2("ivar_get_array_nontask %p %p - enter\n", var, &iv);
    pthread_mutex_lock( &(ivi->mutex) );
    if ( !ivi->full )
        log_2("ivar_get_array_nontask %p %p - waiting for data\n", var, &iv);
    while(!ivi->full)
    {
        int err = pthread_cond_wait( &(ivi->cond), &(ivi->mutex) );
        if (err) { exit(err); }
    }
    assert(ivi->full);
    pthread_mutex_unlock( &(ivi->mutex) );
    if (NULL == ivi->data)
    {
        log_2("ivar_get_array_nontask %p %p - data uninitialized\n", var, &iv);
    }
    else
    {
        ptr = (struct array*)ivi->data;
        initArray( var, ptr->elemSize, ptr->length );
        copyArray( var, ptr );
    }
    log_2("ivar_get_array_nontask %p %p - leave\n", var, &iv);
}
Ejemplo n.º 12
0
int main()
{
	srand(time(0));

	printf("#Alg\tN\tcost\titerations\n");

	for(int i = 20; i<1000; i+=2)
	{

		// the matrix that contains the compatatibilies
		int * D = (int*) malloc( sizeof(int)*i*i );
		// the array that contains a solution
		int * a = (int*) malloc( sizeof(int)*i );
		initArray(a, -1, i);

		//initialize the matrix
		genMatrix(D, i);

		// generate a solution
		genSolution(a, i);
		
		// calculate its cost
		//printf("Initial cost: %d\n", cost(D, a, i ) );
		
		// run the algorithms
		alg1(i, D, a);
		alg2(i, D, a);

		// free() the malloc()
		free(D);
		free(a);
	}

	return 0;
}
Ejemplo n.º 13
0
// Algorithm start
int main(int argc, char **argv)
{
    long int startPoint = 600851475143; // Starting point from project euler, you can change it
    Array primeFactors; // Our beautiful new Array for prime factors
    int maxPrimeFactor = 0; // Max, if founded.
    initArray(&primeFactors, 1); // Initialize empty array with size of one

    // Start the iteration
    while( startPoint > 1 )
    {
        for( int i = 2; i <= startPoint; i++)
        {
            if( startPoint % i == 0) // If startPoint is divisible by i
            {
                startPoint = (startPoint / i); // Actually divide the starting Point
                insertArray(&primeFactors, i); // Inser the value inside our Array
                if( primeFactors.array[i] > maxPrimeFactor) // check if is the Max around here
                {
                    maxPrimeFactor = primeFactors.array[i]; // If max, save it.
                }
            }
        }
    }
    freeArray(&primeFactors); // Release the ... memory
    return 0; // End of the algorithm
}
Ejemplo n.º 14
0
int main(int argc, char const *argv[])
{
	initArray();
	//printf("error\n");
	printArray();
	return 0;
}
Ejemplo n.º 15
0
/**
	busca un rectángulo dentro del R-Tree.
*/
Dynamic_array* buscar(Nodo nodo, Rectangulo rect) {
	int i, j;
	
	Dynamic_array *rects; // arreglo dinámico de rectangulos
	initArray(rects, 1);
    
	// recorremos los MBR's del nodo
	for(i=0;i<=nodo.ultimo;i++) {
		// si el rectangulo se intersecta con un MBR
		if (interseccion(nodo.mbr[i].rect, rect)){
			// si es una hoja. retornar rectangulo;
			if (nodo.mbr[i].nodo_hijo == -1) {
				insertArray(rects, nodo.mbr[i].rect);
			// seguir en profundidad
			} else {
				// buscar en los hijos
				Nodo nodo_hijo = leer_nodo_en_disco(nodo.mbr[i].nodo_hijo);
				Dynamic_array *rects_hijos = buscar(nodo_hijo, rect);
				
				// se insertan en el grupo general
				for(j=0;j<rects_hijos->used;j++) {
					insertArray(rects, rects_hijos->array[j]);
				}
				
				// se libera la memoria.
				freeArray(rects_hijos);
			}	
		}
	}
	
	return rects;
}
/* Iniit function */
void SpectralFeatures::init (int numBins, int fs) {
    binSize = numBins;
    sampleRate = fs;
    prevFlux = 0.0;
    prevCentroid = 0.0;
    prevFlatness = 0.0;
    fifo = new float[binSize];
    initArray(fifo, binSize);
    fifoFilled = false;
    
    
    t_threshTime = Clock::now();
    
    // Initialize Features to zero
    flux = 0;
    prevFlux = 0;
    crest = 0;
    flatness = 0;
    rolloff = 0;
    centroid = 0;
    prevCentroid = 0;
    rms = 0;
    
    minThresh = 1e-20;
    minBin = 0;
    maxBin = binSize;
    
    power = 0.0;
    spectrum_sq = new float[binSize];
    spectrum_sum = 0.0;
    spectrum_abs_sum = 0.0;
    log_spectrum_sum = 0.0;
    halfwave = 0.0;
}
Ejemplo n.º 17
0
int main( int argc, char* argv[] ) {
  // verify arguments
  if ( argc != 2 ) {
    cerr << "usage: quicksort size" << endl;
    return -1;
  }

  // verify an array size
  int size = atoi( argv[1] );
  if ( size <= 0 ) {
    cerr << "array size must be positive" << endl;
    return -1;
  }

  // array generation
  srand( 1 );
  vector<int> items( size );
  initArray( items, size );
  cout << "initial:" << endl;
  printArray( items, "items" );

  // quicksort
  quicksort( items );
  cout << "sorted:" << endl;
  printArray( items, "items" );

  return 0;
}
Ejemplo n.º 18
0
int main (int argc, char** argv) {

	struct arrayBagStack *a = (struct arrayBagStack *)malloc(sizeof(struct arrayBagStack));
	initArray(a);

	printf("Is stack array empty? %i\n", isEmptyArray(a));
	printf("Add 3, 2, 7, 14 & 9 to the stack, using bag.\n");
	addArray(a, 3);
	addArray(a, 2);
	addArray(a, 7);
	addArray(a, 14);
	addArray(a, 9);

	printf("the number at the top of the array is: %i\n", topArray(a));
	printf("How many numbers are now in the array? %i\n", sizeArray(a));

	printf("Remove last 2 values from the array, using stack implementation.\n");
	popArray(a);
	popArray(a);

	printf("How many numbers are now in the array? %i\n", sizeArray(a));
	printf("The number at the top of the array is now: %i", topArray(a));
	printf("\n");



	return 0;
}
Ejemplo n.º 19
0
// the coordinator of the application
void coordinator(void)
{
	// we need to establish what power is used in the hypercube this
	// tells us how many communication directions we have
	int power = hypercubePower(world_size);
	std::cout << power << std::endl;
	// an array that will house the various offsets that we need to 
	// connect with the appropriate nodes in each direction
	int comms_offsets[16];
	initArray(comms_offsets, 0, 16);
	
	// we need to determine our communication directions based on the 
	// bits in our rank
	computeDirections(comms_offsets, world_rank, power);
	for(unsigned int i = 0; i < power; i++)
	std::cout << "rank " << world_rank << " offset " << i << ": " <<
		comms_offsets[i] << std::endl;
		
	// to start the computation we need to distribute a message for
	// starting the computation in this case we will send a single
	// integer that will represent the dimension that we need to
	// communicate on. this will state which channel we need to send on
	int message = 0;
	for (unsigned int i = 0; i < power; i++)
	{
		MPI_Send(&i, 1, MPI_INT, world_rank + comms_offsets[i], 0, MPI_COMM_WORLD);
		std::cout << "rank " << world_rank << "send message to rank " << world_rank +
			comms_offsets[i] << std::endl;
	}
	
	//calculate the average of 100 random numbers
	srand(world_rank);
	int sum = randomSum();
	float average = sum / 100.f;
	std::cout << "rank " << world_rank << " average is: " << average << std::endl;
	
	// send a message to all the other nodes to tell them to sum up their averages
	for( unsigned int i = 0; i < power; i++)
	{
		MPI_Send(&i, 1, MPI_INT, world_rank + comms_offsets[i], 0, MPI_COMM_WORLD);
		std::cout << "rank " << world_rank << "send total message to rank " <<
			world_rank + comms_offsets[i] << std::endl;
	}
	
	// we need to get the averages from each direction
	float total_average = average;
	for(int message = power - 1; message >= 0; message--)
	{
		MPI_Recv(&average, 1, MPI_FLOAT, world_rank + comms_offsets[message],
			0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
		std::cout << "rank " << world_rank << " received total from " <<
			world_rank + comms_offsets[message] << std::endl;
		total_average += average;
	}
	
	// print out the overall average
	std::cout << "rank " << world_rank << " total and average: " <<
		total_average << " " << total_average / world_size << std::endl;
}
Ejemplo n.º 20
0
int main(int argc, char** argv){

    char* path = NULL;
    char buffer[MAXSIZE] = {0};

    int fullOffset = 0;
    int lineNumber = 0;

    char str1[MAXSEQUENCE] = {0};
    char str2[MAXSEQUENCE] = {0};

    struct NWArray myarray;

    if(argc > 2){
        printf("Error too many arguments\n");
        return 1;
    }else if(argc == 2){
        path = argv[1];
        printf("Text file is : %s \n", path);
        printf("\n");
    }else if(argc < 2){
        printf("Error not enough arguments, path of text file is missing\n");
        return 1;
    }

    int sizeRead = 0;
    do{

// Acquisition of one line of "path" file in a buffer
        if((sizeRead = readLine(path, fullOffset, buffer, MAXSIZE) ) < 1){
            printf("This is the end of our program\n");
            break;
        }
        printf("Iteration : %d\nAcquired line is : %s\n", ++lineNumber, buffer);

// Separation of this buffer (according to " | ") in two strings
        parseLine(buffer, sizeRead, str1, str2, MAXSEQUENCE);

        fullOffset += sizeRead;

        printf("\t str1= %s", str1);
        printf("\t str2= %s\n", str2);


// Needleman Wunsh algorithm
        initArray(&myarray, strlen(str1)+1, strlen(str2)+1);
        NWAlgo(&myarray, str1, str2);
        printNW(&myarray);
        printf("The maximum combinaison that can be obtained is : ");
        printf("%d\n", cell_value(getCellXY(&myarray, strlen(str1), strlen(str2))));
        printf("\n");
        printf("-----------------------------------------------------------\n");
        printf("\n");
        destroyArray(&myarray);

    }while(sizeRead != 0);

    return 0;
}
Ejemplo n.º 21
0
Input* CreateInputNode()
{
    Input* node = malloc( sizeof( Input ));

    node->argc = 0;
    node->next = NULL;

    node->isRoot     = FALSE;
    node->isCMD      = FALSE;
    node->parseError = FALSE;

    initArray( node->command,    retLen( node->command ),    NULL );
    initArray( node->tokenType,  retLen( node->tokenType ),  NULL );
    initArray( node->tokenValue, retLen( node->tokenValue ), NULL );

    return node;
}
Ejemplo n.º 22
0
int main(int argc, const char * argv[]) {
    int m,n;
    printf("请输入数组行数和列数,用逗号分隔:\n");
    scanf("%d,%d",&m,&n);
    int arr[m][n];
    initArray(m, n, arr);
    printArray(m, n, arr);
    return 0;
}
Ejemplo n.º 23
0
int main()
{
	int a[N];
	initArray(a, 0, N-1, 100);
	printArray(a, 0, N-1);
	printf("\n");
	quickSort(a, 0, N-1);
	printArray(a, 0, N-1);
	printf("\n");
}
Ejemplo n.º 24
0
int main(int argc, const char *argv[])
{
    int a[20];
    initArray(a, 20);
    printArray(a, 20);
    checkArray(a, 20);
    printArray(a, 20);
    
    return 0;
}
Ejemplo n.º 25
0
void listClasses(struct parseNode *root)
{
    initArray(&classes);
    struct parseNode *p=root;
    while(p!=NULL)
    {
        struct classType *ct=malloc(sizeof(struct classType));
        ct->name=p->dat.n->dat.n->dat.s;
        ct->node=p->dat.n;
        ct->base=NULL;
        ct->visited=0;
        initArray(&ct->derives);
        initArray(&ct->vars);
        initArray(&ct->constructors);
        initArray(&ct->methods);

        addItem(&classes,ct);
        p=p->next;
    }
    int i;
    for(i=0;i<classes.length;i++)
    {
        struct classType *p=classes.data[i];
        struct parseNode *q=p->node;
        while(q!=NULL)
        {
            if(q->type==5) // var
            {

            }
            else if(q->type==7) // method
            {

            }
            else if(q->type==9) // constructor
            {

            }
            q=q->next;
        }
    }
}
Ejemplo n.º 26
0
void NewLDAModel(LDAMODEL** m)
{
  (*m) = xmalloc(sizeof(LDAMODEL));
  initUIVector(&((*m)->classid));
  initMatrix(&((*m)->evect));
  initArray(&((*m)->mnpdf));
  initArray(&((*m)->features));
  initMatrix(&((*m)->inv_cov));
  initMatrix(&((*m)->mu));
  initMatrix(&((*m)->fsdev));
  initMatrix(&((*m)->fmean));
  initDVector(&((*m)->eval));
  initDVector(&((*m)->pprob));
  initDVector(&((*m)->sens));
  initDVector(&((*m)->spec));
  initDVector(&((*m)->ppv)); /* o precision */
  initDVector(&((*m)->npv));
  initDVector(&((*m)->acc));
  (*m)->nclass = (*m)->class_start = 0;
}
void main()
{
	init(GrafoVisitados);
	initArray(visitado);
	insereAresta(0, 1, 1);
	insereAresta(1, 2, 1);
	insereAresta(2, 0, 1);
	listarGrafo();
	verificarCircuito(Grafo, 0, visitado);
	system("pause");
}
Ejemplo n.º 28
0
void ivar_get_array( struct array *var, struct ivar iv )
{
    struct array *ptr;
    log_2("ivar_get_array %p %p - enter\n", var, &iv);
    ivar_get_helper(iv.internals);
    ptr = (struct array*)iv.internals->data;
    assert(ptr);
    initArray( var, ptr->elemSize, ptr->length );
    copyArray( var, ptr );
    log_2("ivar_get_array %p %p - leave\n", var, &iv);
}
Ejemplo n.º 29
0
void concatV(struct array * v0, struct array * * out)
{
  struct array * v64 = NULL;
  uint32_t len65;
  struct array * v3 = NULL;
  struct array * v63 = NULL;
  uint32_t v55;
  uint32_t v56;
  struct array * e66 = NULL;
  uint32_t v58;
  
  len65 = getLength(v0);
  v64 = initArray(v64, sizeof(int32_t), 0);
  for (uint32_t v2 = 0; v2 < len65; v2 += 1)
  {
    v63 = at(struct array *,v0,v2);
    v55 = getLength(v64);
    v56 = getLength(v63);
    v3 = initArray(v3, sizeof(int32_t), (v55 + v56));
    for (uint32_t v5 = 0; v5 < v55; v5 += 1)
    {
      at(int32_t,v3,v5) = at(int32_t,v64,v5);
    }
    for (uint32_t v8 = 0; v8 < v56; v8 += 1)
    {
      at(int32_t,v3,(v8 + v55)) = at(int32_t,v63,v8);
    }
    e66 = v64;
    v64 = v3;
    v3 = e66;
  }
  v58 = getLength(v64);
  *out = initArray(*out, sizeof(int32_t), v58);
  for (uint32_t v22 = 0; v22 < v58; v22 += 1)
  {
    at(int32_t,*out,v22) = at(int32_t,v64,v22);
  }
  freeArray(v64);
  freeArray(v3);
  freeArray(v63);
}
Ejemplo n.º 30
0
int main(void) {
    initArray(&uartData, 5);

    // Enable 80Mhz clock.
    PLLInitialize(4);

    // Use 1ms gradation for 80 Mhz clock.
    SysTickInitialize(80000UL);

    UARTInitialize(UART1Module, 115200, 80);

    // Activate GPIO port B (Chip Select).
    System_CTRL_RCGCGPIO_R |= System_CTRL_RCGCGPIO_GPIOB_MASK;

    chipSelectPort->AFSEL &= ~chipSelectPin;
    chipSelectPort->AMSEL &= ~chipSelectPin;
    chipSelectPort->PCTL &= ~chipSelectPin;
    chipSelectPort->DIR |= chipSelectPin;
    chipSelectPort->DEN |= chipSelectPin;

    Nokia5110_Init();
    Nokia5110_Clear();
    Nokia5110_WriteString("GPS");

    toggleSensor();

    // On the current hardware we receive to messages:
    // 1. A0A20001470047B0B3 - SiRF IV: Hardware Configuration Request, MID_HW_CONFIG_REQ, unused.
    // 2. A0A2000212000012B0B3 - OkToSend SiRF binary message.

    while (1) {
        if (uartData.used == 0) {
            Nokia5110_Clear();
            Nokia5110_WriteString("No data!");
        } else {
            char symbol[4];
            for (uint32_t i = 0; i < uartData.used; i++) {
                if (i % 17 == 0) {
                    SysTickDelay(5000);
                    Nokia5110_Clear();
                }

                sprintf(symbol, "_%02x_", uartData.array[i]);

                Nokia5110_WriteString(symbol);
            }

            SysTickDelay(5000);
            Nokia5110_Clear();
            Nokia5110_WriteString("End of data!");
        }
    }
}