Categories
Development Programming & Design

Programming e-ink display on atmega32 without arduino

i’ve bought eink 1,54 display module from waveshare, i want to program atmega32 and design a gui with keys on this eink. I wrote a simple code using spi in eclipse:

  #include <avr/io.h>
  #include <util/delay.h>

  void Inicjacja_spi()
  {
      DDRB = ( 1 << PB5 ) | ( 1 << PB7 ) | ( 1 << PB4 );                                      

      SPCR = ( 1 << SPE ) | ( 1 << MSTR ) | (1<<SPI2X) |( 1 << SPR1 ) | ( 1 << SPR0 );   
  }                            


  void Wyslij_spi(unsigned char bajt)
  {
      SPDR = bajt;                        

      while( ! bit_is_set( SPSR, SPIF ) );
  }


  int main()
  {
      unsigned char bajt[] = {0x04,0x20,0x21,0x22,0x25,0x26,0x27};

      Inicjacja_spi();

      for(int i=0; i<8; i++)
          Wyslij_spi(bajt[i]);

       while(1)
       {
       }
   }

I have read about how to send commands through spi to this eink but it didnt work. Do i have to write complicated libraries to send some data into display? I guess it should work using simple commands, but maybe i’am doing somethin wrong. If someone can tell me how can i write simple commands into this thing because i dont understand those documentations. Simple working example should help me.

Leave a Reply

Your email address will not be published. Required fields are marked *