123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
-
-
- #include <stddef.h>
- #include "u8g.h"
-
- void u8g_state_dummy_cb(uint8_t msg)
- {
-
- }
-
- void u8g_SetHardwareBackup(u8g_t *u8g, u8g_state_cb backup_cb)
- {
- u8g->state_cb = backup_cb;
-
-
- backup_cb(U8G_STATE_MSG_BACKUP_U8G);
- }
-
-
-
-
-
- #if defined(__AVR__)
- #define U8G_ATMEGA_HW_SPI
-
-
- #if __AVR_ARCH__ == 2
- #undef U8G_ATMEGA_HW_SPI
- #endif
- #if __AVR_ARCH__ == 25
- #undef U8G_ATMEGA_HW_SPI
- #endif
- #endif
-
- #if defined(U8G_ATMEGA_HW_SPI)
- #include <avr/interrupt.h>
- static uint8_t u8g_state_avr_spi_memory[2];
-
- void u8g_backup_avr_spi(uint8_t msg)
- {
- if ( U8G_STATE_MSG_IS_BACKUP(msg) )
- {
- u8g_state_avr_spi_memory[U8G_STATE_MSG_GET_IDX(msg)] = SPCR;
- }
- else
- {
- uint8_t tmp = SREG;
- cli();
- SPCR = 0;
- SPCR = u8g_state_avr_spi_memory[U8G_STATE_MSG_GET_IDX(msg)];
- SREG = tmp;
- }
- }
-
- #endif
|