-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathplatforms.h
More file actions
52 lines (45 loc) · 1.3 KB
/
platforms.h
File metadata and controls
52 lines (45 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#pragma once
#define F_CPU 16000000
#include <stdint.h>
#include <avr/io.h>
#ifdef PLATFORM_alpha
#define DATAFLASH_PAGE_SIZE 528
#define DATAFLASH_CS_SET() PORTB &= ~_BV(PB0)
#define DATAFLASH_CS_CLEAR() PORTB |= _BV(PB0)
#define DATAFLASH_SI_HIGH() PORTB |= _BV(PB2)
#define DATAFLASH_SI_LOW() PORTB &= ~_BV(PB2)
#define DATAFLASH_CLK_HIGH() PORTB |= _BV(PB1)
#define DATAFLASH_CLK_LOW() PORTB &= ~_BV(PB1)
#define DATAFLASH_SO_STATE() ((PINB >> PB3) & 0x01)
#define HC595_BUFEN_SET() PORTC &= ~_BV(PC6)
#define HC595_BUFEN_CLEAR() PORTC |= ~_BV(PC6)
#define HC595_SER_HIGH() PORTB |= _BV(PB2)
#define HC595_SER_LOW() PORTB &= ~_BV(PB2)
#define HC595_CLK_HIGH() PORTB |= _BV(PB1)
#define HC595_CLK_LOW() PORTB &= ~_BV(PB1)
#define HC595_LATCH_HIGH() PORTC |= _BV(PC7)
#define HC595_LATCH_LOW() PORTC &= ~_BV(PC7)
#endif
#ifdef PLATFORM_alpha
#define NUM_IO 19
#define NUM_LEDS 0
#elif defined(PLATFORM_gh60)
#define NUM_IO 20
#define NUM_LEDS 2
#elif defined(PLATFORM_ghpad)
#define NUM_IO 10
#define NUM_LEDS 2
#elif defined(PLATFORM_techkeys)
#define NUM_IO 7
#define NUM_LEDS 4
#else
#define NUM_IO 1
#define NUM_LEDS 0
#endif
struct pin_config {
volatile uint8_t *portx;
volatile uint8_t *pinx;
volatile uint8_t *ddrx;
uint8_t mask;
};
struct pin_config PINS[NUM_IO];