Advertisement
trenthor

emb1

Mar 12th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.63 KB | None | 0 0
  1. #include "mcu_regs.h"
  2. #include "type.h"
  3. #include "uart.h"
  4. #include "stdio.h"
  5. #include "timer32.h"
  6. #include "i2c.h"
  7. #include "gpio.h"
  8. #include "ssp.h"
  9. #include "adc.h"
  10. #include "light.h"
  11. #include "oled.h"
  12. #include "rgb.h"
  13. #include "temp.h"
  14. #include "acc.h"
  15. #include "led7seg.h"
  16. #include "pca9532.h"
  17. #include "joystick.h"
  18.  
  19. #define figura 0x00001034
  20.  
  21. extern const char * test_bin_symbol;
  22. int matriz[4][4] = {{1,2,3,4},{5,6,7,8},{9,10,11,12},{13,14,15,16}};
  23.  
  24. extern int f_asm(void);
  25.  
  26. void updateOLED(int op){
  27.   uint8_t *p = (uint8_t *) figura;
  28.   //oled_clearScreen(OLED_COLOR_WHITE);
  29.   if (op==1){
  30.     for (uint8_t y=0;y<64;y++){
  31.       for (uint8_t x=0;x<96;x++){
  32.         if (*p>128){
  33.             oled_putPixel(x, y, OLED_COLOR_WHITE);
  34.            
  35.         }
  36.         else
  37.           oled_putPixel(x, y, OLED_COLOR_BLACK);
  38.         //printf("%u\n", *p);
  39.         p+=3;
  40.       }
  41.     }
  42.   }
  43.   else{
  44.     for (uint8_t y=0;y<64;y++){
  45.       for (uint8_t x=0;x<96;x++){
  46.         if (*p<128){
  47.             oled_putPixel(x, y, OLED_COLOR_WHITE);
  48.            
  49.         }
  50.         else
  51.           oled_putPixel(x, y, OLED_COLOR_BLACK);
  52.         //printf("%u\n", *p);
  53.         p+=3;
  54.       }
  55.     }
  56.   }
  57.  
  58.  
  59. }
  60. int main()
  61. {
  62.   int i;  
  63.  
  64.  
  65.   i = f_asm( );
  66.  
  67.  
  68.   SystemCoreClockUpdate();
  69.  
  70.   GPIOInit();
  71.   init_timer32(0, 10);
  72.    
  73.   UARTInit(115200);
  74.   UARTSendString((uint8_t*)"OLED - Peripherals\r\n");
  75.  
  76.    SSPInit();
  77.  
  78.    oled_init();
  79.    joystick_init();
  80.    while(1){
  81.      updateOLED(joystick_read());
  82.    }
  83.  
  84.  // return test_bin_symbol[0];
  85.   //light_enable();
  86.   //light_setRange(LIGHT_RANGE_4000);
  87.      
  88.  
  89. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement