void weak_function sam_spidev_initialize(void) { /* The I/O module containing the SD connector may or may not be installed. And, if * it is installed, it may be in connector EXT1 or EXT2. */ #ifdef CONFIG_SAML21_XPLAINED_IOMODULE /* TODO: enable interrupt on card detect */ sam_configport(PORT_SD_CD); /* Card detect input */ sam_configport(PORT_SD_CS); /* Chip select output */ #endif #ifdef CONFIG_SAML21_XPLAINED_OLED1MODULE sam_configport(PORT_OLED_DATA); /* Command/data */ sam_configport(PORT_OLED_CS); /* Card detect input */ #endif }
FAR struct lcd_dev_s *board_graphics_setup(unsigned int devno) { FAR struct spi_dev_s *spi; FAR struct lcd_dev_s *dev; /* Configure the OLED PORTs. This initial configuration is RESET low, * putting the OLED into reset state. */ (void)sam_configport(PORT_OLED_RST); /* Wait a bit then release the OLED from the reset state */ up_mdelay(20); sam_portwrite(PORT_OLED_RST, true); /* Get the SPI1 port interface */ spi = sam_spibus_initialize(OLED_CSNO); if (!spi) { lcderr("ERROR: Failed to initialize SPI port 1\n"); } else { /* Bind the SPI port to the OLED */ dev = ssd1306_initialize(spi, devno); if (!dev) { lcderr("ERROR: Failed to bind SPI port 1 to OLED %d: %d\n", devno); } else { lcdinfo("Bound SPI port 1 to OLED %d\n", devno); /* And turn the OLED on */ (void)dev->setpower(dev, CONFIG_LCD_MAXPOWER); return dev; } } return NULL; }
void board_led_initialize(void) { (void)sam_configport(PORT_STATUS_LED); }
void board_button_initialize(void) { (void)sam_configport(PORT_SW0); }