diff options
author | Marti Bolivar <mbolivar@mit.edu> | 2010-10-22 21:13:02 -0400 |
---|---|---|
committer | Marti Bolivar <mbolivar@mit.edu> | 2010-10-22 21:13:02 -0400 |
commit | 6c956a383834b66c29591294f0926ced22f3e3b7 (patch) | |
tree | 00214f59655cf96d747228d9ffb8f6059b63b31c /libmaple | |
parent | dd7e6ecdafcb8938e23dfd18a36d70628fbc74bd (diff) | |
download | librambutan-6c956a383834b66c29591294f0926ced22f3e3b7.tar.gz librambutan-6c956a383834b66c29591294f0926ced22f3e3b7.zip |
maple mini runs blinky now.
still need usb descriptors to improve, and also nothing else is tested.
Diffstat (limited to 'libmaple')
-rw-r--r-- | libmaple/adc.h | 11 | ||||
-rw-r--r-- | libmaple/exti.h | 8 | ||||
-rw-r--r-- | libmaple/libmaple.h | 6 | ||||
-rw-r--r-- | libmaple/timers.c | 2 | ||||
-rw-r--r-- | libmaple/timers.h | 18 |
5 files changed, 32 insertions, 13 deletions
diff --git a/libmaple/adc.h b/libmaple/adc.h index 9b61821..ce67116 100644 --- a/libmaple/adc.h +++ b/libmaple/adc.h @@ -43,7 +43,8 @@ extern "C"{ * * Need to up the sample time if otherwise... see datasheet */ -/* TODO: We'll only use ADC1 for now... */ +/* TODO: We'll only use ADC1 for now. See page 41 of the manual for + ADC2 and ADC3's real addresses. */ #define ADC1_BASE 0x40012400 #define ADC2_BASE 0x40012400 #define ADC3_BASE 0x40012400 @@ -73,17 +74,17 @@ extern "C"{ void adc_init(void); void adc_disable(void); -/* Perform a single conversion on ADC[0-16], +/* Perform a single conversion on ADC[0-15], * PRECONDITIONS: * adc initialized */ static inline int adc_read(int channel) { - /* Set channel */ + /* Set channel */ ADC_SQR3 = channel; - /* Start the conversion */ + /* Start the conversion */ CR2_SWSTART_BIT = 1; - /* Wait for it to finish */ + /* Wait for it to finish */ while(SR_EOC_BIT == 0) ; diff --git a/libmaple/exti.h b/libmaple/exti.h index 89cd986..cab2963 100644 --- a/libmaple/exti.h +++ b/libmaple/exti.h @@ -141,10 +141,10 @@ #define EXTI14 14 #define EXTI15 15 -#define EXTI_CONFIG_PORTA 0 -#define EXTI_CONFIG_PORTB 1 -#define EXTI_CONFIG_PORTC 2 -#define EXTI_CONFIG_PORTD 3 +#define EXTI_CONFIG_PORTA 0 // Maple, Maple Native, Maple Mini +#define EXTI_CONFIG_PORTB 1 // Maple, Maple Native, Maple Mini +#define EXTI_CONFIG_PORTC 2 // Maple, Maple Native, Maple Mini +#define EXTI_CONFIG_PORTD 3 // Maple and Maple Native only #define EXTI_CONFIG_PORTE 4 // Native only #define EXTI_CONFIG_PORTF 5 // Native only #define EXTI_CONFIG_PORTG 6 // Native only diff --git a/libmaple/libmaple.h b/libmaple/libmaple.h index 0b0494f..74488ab 100644 --- a/libmaple/libmaple.h +++ b/libmaple/libmaple.h @@ -168,6 +168,12 @@ #ifndef RAMSIZE # define RAMSIZE (caddr_t)0x50000 #endif + + /* Bitbanded Memory sections */ + #define BITBAND_SRAM_REF 0x20000000 + #define BITBAND_SRAM_BASE 0x22000000 + #define BITBAND_PERI_REF 0x40000000 + #define BITBAND_PERI_BASE 0x42000000 #endif /* Make sure MCU-specific settings were defined */ diff --git a/libmaple/timers.c b/libmaple/timers.c index 334ec0b..c369d1f 100644 --- a/libmaple/timers.c +++ b/libmaple/timers.c @@ -211,7 +211,7 @@ void timer_disable_all(void) { } /* Sets the mode of individual timer channels, including a DISABLE mode */ -void timer_set_mode(uint8 timer_num, uint8 channel, uint8 mode) { +void timer_set_mode(uint8 timer_num, uint8 channel, TimerMode mode) { timer_port *timer = timer_dev_table[timer_num].base; ASSERT(channel >= 1); diff --git a/libmaple/timers.h b/libmaple/timers.h index ba8245c..d180bab 100644 --- a/libmaple/timers.h +++ b/libmaple/timers.h @@ -132,9 +132,21 @@ typedef volatile uint32* TimerCCR; #define TIMER8_CH3_CCR TIMER8_BASE + 0x3C #define TIMER8_CH4_CCR TIMER8_BASE + 0x40 -#define TIMER_DISABLED 0 -#define TIMER_PWM 1 -#define TIMER_OUTPUTCOMPARE 2 +/** + * Used to configure the behavior of a timer. + */ +typedef enum TimerMode { + TIMER_DISABLED, /**< In this mode, the timer stops counting, + interrupts are not called, and no state changes + are output. */ + TIMER_PWM, /**< This is the default mode for pins after + initialization. */ + TIMER_OUTPUTCOMPARE, /**< In this mode, the timer counts from 0 to + the overflow value repeatedly; every time + the counter value reaches one of the + channel compare values, the corresponding + interrupt is fired. */ +} TimerMode; typedef struct { volatile uint16 CR1; |