This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to change c++ code into NORDIC nRF52832

Hi,

I want to write or change the code in to nRF52832

I have some code this code i should write for nRF52832

kindly give any suggestion

here is the my code

uint8_t HT1632_LedMatrix::putChar(int x, int y, char c) {
  // fonts defined for ascii 32 and beyond (index 0 in font array is ascii 32);
  // CGRAM characters are in range 0 to 15 with 8-15 being repeat of 0-7
  // note we force y to be modulo 8 - we do not support writing character to partial y values.
 
  uint8_t charIndex;
  uint8_t colData;
  uint8_t numCols;
  uint8_t chipno;
  uint8_t addr;
  uint8_t colsLeft = 0;        // cols that didn't fit
 
  if( c > 15 ) {
    // Regular characters
    // replace undisplayable characters with blank;
    if (c < 32 || c > 126) {
            charIndex = 0;
    } else {
            charIndex = c - 32;
    }
 
    // move character definition, pixel by pixel, onto the display;
    // fonts are defined as one byte per col;
    numCols=smallFont[charIndex][6];   // get the number of columns this character uses
    for (uint8_t col=0; col<numCols; col++) {
            colData = smallFont[charIndex][col];
        chipno = chip_number(x,y);
        addr = chip_byte_address(x,y); // compute which memory byte this is in
        if (x <= xMax && y <= yMax) {
            shadowram[(addr>>1)+32*chipno] = colData;
            sendcol(chipno,addr,colData);
            x++;
        } else {
            colsLeft++;
        }
    }
  } else {
    // CGRAM Characters
    charIndex = c & 0x07;       // Only low 3 bits count
    numCols=cgram[charIndex][0];    // get the number of columns this character uses
    // fonts are defined as one byte per col;
        for (uint8_t col=1; col<=numCols; col++) {
            colData = cgram[charIndex][col];
        chipno = chip_number(x,y);
        addr = chip_byte_address(x,y); // compute which memory byte this is in
        if (x <= xMax && y <= yMax) {
            shadowram[(addr>>1)+32*chipno] = colData;
            sendcol(chipno,addr,colData);
            x++;
        } else {
            colsLeft++;
        }
    }
  }
 
  cursorX = x;
  cursorY = y;
 
  return colsLeft;
}
Parents Reply Children
No Data
Related