Create a function in Arduino code that, when passed a bitmap, draws that map onto an OLED display that uses an SPI interface
system
Arduino code main ek fnction banaaen, jo ki bitmap paas hone par, us map ko ek OLED disple par khinchataa he jo SPI interfes kaa upyog karata he
user
yahan code he ki, jab ek bitmap diya jaataa he, to ek OLED disple par bitmap ko dra karata he:

#include <spi.h>
#include <adafruit_gfx.h>
#include <adafruit_ssd1306.h>

#DEFINE OLED_CS 10
#DEFINE OLED_DC 9
#DEFINE OLED_RESET 8

#DEFINE SCRINE_WIDTH 128
#DEFINE SCREED_HEIGHT 64

// OLED disple kaa ek udhaaharan banaaen
Adafruit_ssd1306 disple (screen_width, screen_height, & spi, oled_dc, oled_reset, oled_cs);

vyarth vyavastha() {
  // OLED disple ko inishilise karen
  display.begin (SSD1306_SWITCHCAPVCC);
  display.cleardisplay ();
  
  // OLED disple par bitmap dra karen
  drobitmap (bitmap);
}

shunya loop () {
  // yahaan apana mukhya code tark joden
}

void drawbitmap (const uint8_t *bitmap) {
  // drawing rang ko safed karne ke liye set karen
  display.settextColor (safed);
  
  // bitmap kii prayek pankti ke madhyam se punrariti
  for (int y = 0; y <scred_height / 8; y ++) {
    // bitmap ke prayek kollam ke madhyam se punrariti
    for (int x = 0; x <scred_width; x ++) {
      // bitmap kaa vartmaan bite praapt karen
      uint8_t byte = bitmap [y * screen_width + x];
      
      // bite ke prayek bit ko ek pixel ke rup main aakarshith karen
      for (int bit = 0; bit <8; bit ++) {
        if (bite or (1 << bit)) {
          // yadi bit set kiya gaya he, to isi sthiti par ek pixel khinchen
          display.drawpixel (x, y * 8 + bit, safed);
        }
      }
    }
  }
  
  // OLED disple par khinchaa hua bitmap pradarshit karen
  display.display ();
}
assistant
<|system|>
</s>
<|user|>
Arduino code main ek fnction banaaen, jo ki bitmap paas hone par, us map ko ek OLED disple par khinchataa he jo SPI interfes kaa upyog karata he</s>
<|assistant|>
yahan code he ki, jab ek bitmap diya jaataa he, to ek OLED disple par bitmap ko dra karata he:

#include <spi.h>
#include <adafruit_gfx.h>
#include <adafruit_ssd1306.h>

#DEFINE OLED_CS 10
#DEFINE OLED_DC 9
#DEFINE OLED_RESET 8

#DEFINE SCRINE_WIDTH 128
#DEFINE SCREED_HEIGHT 64

// OLED disple kaa ek udhaaharan banaaen
Adafruit_ssd1306 disple (screen_width, screen_height, & spi, oled_dc, oled_reset, oled_cs);

vyarth vyavastha() {
  // OLED disple ko inishilise karen
  display.begin (SSD1306_SWITCHCAPVCC);
  display.cleardisplay ();
  
  // OLED disple par bitmap dra karen
  drobitmap (bitmap);
}

shunya loop () {
  // yahaan apana mukhya code tark joden
}

void drawbitmap (const uint8_t *bitmap) {
  // drawing rang ko safed karne ke liye set karen
  display.settextColor (safed);
  
  // bitmap kii prayek pankti ke madhyam se punrariti
  for (int y = 0; y <scred_height / 8; y ++) {
    // bitmap ke prayek kollam ke madhyam se punrariti
    for (int x = 0; x <scred_width; x ++) {
      // bitmap kaa vartmaan bite praapt karen
      uint8_t byte = bitmap [y * screen_width + x];
      
      // bite ke prayek bit ko ek pixel ke rup main aakarshith karen
      for (int bit = 0; bit <8; bit ++) {
        if (bite or (1 << bit)) {
          // yadi bit set kiya gaya he, to isi sthiti par ek pixel khinchen
          display.drawpixel (x, y * 8 + bit, safed);
        }
      }
    }
  }
  
  // OLED disple par khinchaa hua bitmap pradarshit karen
  display.display ();
}</s>
