← Back to context

Comment by f1shy

3 days ago

      >> unsigned char ascii2dec( unsigned char data) // expecting a hexedecimal num 0..F anything else returns 0
  {
  if(data=='0') return 0;
  if(data=='1') return 1;
  if(data=='2') return 2;
  if(data=='3') return 3;
  if(data=='4') return 4;
  if(data=='5') return 5;
  if(data=='6') return 6;
  if(data=='7') return 7;
  if(data=='8') return 8;
  if(data=='9') return 9;
  if(data=='A') return 10;
  if(data=='B') return 11;
  if(data=='C') return 12;
  if(data=='D') return 13;
  if(data=='E') return 14;
  if(data=='F') return 15;
  if(data=='a') return 10;
  if(data=='b') return 11;
  if(data=='c') return 12;
  if(data=='d') return 13;
  if(data=='e') return 14;
  if(data=='f') return 15;
  return 0; // default/error

}

I could probably think about a little bit shorter function for that ;)

Boz here and guilty on all charges. There are plenty of errors if you look hard when sober. There's professional grade coding, then there is coding for hobby projects which blink LED's, when you're drinking beers and listening to rock music in a big shed with a mate.

On another note, somebody asked me to make 30 panels using an RP2040 which I will put up on my site when ready, price will actually be less due to qty. as a side note he did want me to use the RP2350 but nobody has any in stock yet.

  • I said that tongue in cheek. I’m unable to pull the project you did. A brain fart happens to anybody.