Untitled
unknown
plain_text
2 years ago
1.7 kB
5
Indexable
// Le timer utilisé pour les communications SPI. static Timer spi_timer_priv = { .address = 0x84000000, .evt_mask = EVT_MASK(3), .intc = intc }; Timer *const spi_timer = &spi_timer_priv; // Le contrôleur SPI. static SPIMaster spi_master_priv = { // L'adresse de base des registres du contrôleur SPI. .address = 0x85000000, // Le masque des événements de fin de trame. .evt_mask = EVT_MASK(4), // Le contrôleur d'interruption qui gère les événements du contrôleur SPI. .intc = intc }; SPIMaster *const spi_master = &spi_master_priv; static SPIDevice jstk_priv = { // Le contrôleur SPI utilisé pour communiquer avec le joystick. .spi = spi_master, // Le timer utilisé pour mesurer les temps d'attente. .timer = spi_timer, // La polarité de l'horloge SPI. .polarity = 0, // La phase de l'horloge SPI. .phase = 0, // La vitesse de communication, en périodes d'horloge par bit. .cycles_per_bit = CLK_FREQUENCY_HZ / 1000000, // 1 Mbit/sec // Le temps d'attente, en périodes d'horloge. .cycles_per_gap = CLK_FREQUENCY_HZ / 25000 // 40us (> 25 us) }; SPIDevice *const jstk = &jstk_priv; static SPIDevice spi_dev_priv = { .spi = spi_master, .timer = spi_timer, .polarity = 1, .phase = 1, .cycles_per_bit = CLK_FREQUENCY_HZ / 5000000, // 5 Mbit/sec .cycles_per_gap = CLK_FREQUENCY_HZ / 5000000 // 200 ns }; SPIDevice *const spi_dev = &spi_dev_priv; static OLED oled_priv = { .spi = spi_dev, .address = 0x80000002, .cycles_1ms = CLK_FREQUENCY_HZ / 1000 }; OLED *const oled = &oled_priv;
Editor is loading...