shortened RB_

This commit is contained in:
kiu 2011-05-21 00:31:58 +02:00
parent 86b2d28ff3
commit 53c678cef5
2 changed files with 86 additions and 123 deletions

View File

@ -8,53 +8,53 @@ void rbInit() {
// prepare power // prepare power
// TODO FIXME more power init needed ? chrg + volt input ? // TODO FIXME more power init needed ? chrg + volt input ?
// enable external vcc // enable external vcc
gpioSetDir(RB_PWR_GOOD_PORT, RB_PWR_GOOD_PIN, gpioDirection_Output); gpioSetDir(RB_PWR_GOOD, gpioDirection_Output);
gpioSetValue (RB_PWR_GOOD_PORT, RB_PWR_GOOD_PIN, 0); gpioSetValue (RB_PWR_GOOD, 0);
// prepare buttons // prepare buttons
gpioSetDir(RB_BTN0_PORT, RB_BTN0_PIN, gpioDirection_Input); gpioSetDir(RB_BTN0, gpioDirection_Input);
gpioSetPullup (&RB_BTN0_IO, gpioPullupMode_PullUp); gpioSetPullup (&RB_BTN0_IO, gpioPullupMode_PullUp);
gpioSetDir(RB_BTN1_PORT, RB_BTN1_PIN, gpioDirection_Input); gpioSetDir(RB_BTN1, gpioDirection_Input);
gpioSetPullup (&RB_BTN1_IO, gpioPullupMode_PullUp); gpioSetPullup (&RB_BTN1_IO, gpioPullupMode_PullUp);
gpioSetDir(RB_BTN2_PORT, RB_BTN2_PIN, gpioDirection_Input); gpioSetDir(RB_BTN2, gpioDirection_Input);
gpioSetPullup (&RB_BTN2_IO, gpioPullupMode_PullUp); gpioSetPullup (&RB_BTN2_IO, gpioPullupMode_PullUp);
gpioSetDir(RB_BTN3_PORT, RB_BTN3_PIN, gpioDirection_Input); gpioSetDir(RB_BTN3, gpioDirection_Input);
gpioSetPullup (&RB_BTN3_IO, gpioPullupMode_PullUp); gpioSetPullup (&RB_BTN3_IO, gpioPullupMode_PullUp);
gpioSetDir(RB_BTN4_PORT, RB_BTN4_PIN, gpioDirection_Input); gpioSetDir(RB_BTN4, gpioDirection_Input);
gpioSetPullup (&RB_BTN4_IO, gpioPullupMode_PullUp); gpioSetPullup (&RB_BTN4_IO, gpioPullupMode_PullUp);
// prepare LEDs // prepare LEDs
gpioSetDir(RB_LED0_PORT, RB_LED0_PIN, gpioDirection_Output); gpioSetDir(RB_LED0, gpioDirection_Output);
gpioSetValue (RB_LED0_PORT, RB_LED0_PIN, 1); gpioSetValue (RB_LED0, 1);
gpioSetDir(RB_LED1_PORT, RB_BTN1_PIN, gpioDirection_Output); gpioSetDir(RB_LED1, gpioDirection_Output);
gpioSetValue (RB_LED1_PORT, RB_LED1_PIN, 1); gpioSetValue (RB_LED1, 1);
gpioSetDir(RB_LED2_PORT, RB_BTN2_PIN, gpioDirection_Output); gpioSetDir(RB_LED2, gpioDirection_Output);
gpioSetValue (RB_LED2_PORT, RB_LED2_PIN, 1); gpioSetValue (RB_LED2, 1);
gpioSetDir(RB_LED3_PORT, RB_LED3_PIN, gpioDirection_Output); gpioSetDir(RB_LED3, gpioDirection_Output);
gpioSetValue (RB_LED3_PORT, RB_LED3_PIN, 1); gpioSetValue (RB_LED3, 1);
// prepare IR // prepare IR
gpioSetDir(RB_IROUT_PORT, RB_IROUT_PIN, gpioDirection_Output); gpioSetDir(RB_IROUT, gpioDirection_Output);
gpioSetValue (RB_IROUT_PORT, RB_IROUT_PIN, 1); gpioSetValue (RB_IROUT, 1);
gpioSetDir(RB_IRIN_PORT, RB_IRIN_PIN, gpioDirection_Input); gpioSetDir(RB_IRIN, gpioDirection_Input);
gpioSetPullup (&RB_IRIN_IO, gpioPullupMode_PullUp); gpioSetPullup (&RB_IRIN_IO, gpioPullupMode_PullUp);
// prepare lcd // prepare lcd
// TODO FIXME more init needed ? // TODO FIXME more init needed ?
gpioSetDir(RB_LCD_BL_PORT, RB_LCD_BL_PIN, gpioDirection_Output); gpioSetDir(RB_LCD_BL, gpioDirection_Output);
gpioSetValue (RB_LCD_BL_PORT, RB_LCD_BL_PIN, 1); gpioSetValue (RB_LCD_BL, 1);
// prepare I2C // prepare I2C
@ -65,56 +65,56 @@ void rbInit() {
// prepare SPI/SS // prepare SPI/SS
// TODO FIXME init miso/mosi/sck somehow ? // TODO FIXME init miso/mosi/sck somehow ?
gpioSetDir(RB_SPI_SS0_PORT, RB_SPI_SS0_PIN, gpioDirection_Output); gpioSetDir(RB_SPI_SS0, gpioDirection_Output);
gpioSetValue (RB_SPI_SS0_PORT, RB_SPI_SS0_PIN, 1); gpioSetValue (RB_SPI_SS0, 1);
gpioSetDir(RB_SPI_SS1_PORT, RB_SPI_SS1_PIN, gpioDirection_Output); gpioSetDir(RB_SPI_SS1, gpioDirection_Output);
gpioSetValue (RB_SPI_SS1_PORT, RB_SPI_SS1_PIN, 1); gpioSetValue (RB_SPI_SS1, 1);
gpioSetDir(RB_SPI_SS2_PORT, RB_SPI_SS2_PIN, gpioDirection_Output); gpioSetDir(RB_SPI_SS2, gpioDirection_Output);
gpioSetValue (RB_SPI_SS2_PORT, RB_SPI_SS2_PIN, 1); gpioSetValue (RB_SPI_SS2, 1);
gpioSetDir(RB_SPI_SS3_PORT, RB_SPI_SS3_PIN, gpioDirection_Output); gpioSetDir(RB_SPI_SS3, gpioDirection_Output);
gpioSetValue (RB_SPI_SS3_PORT, RB_SPI_SS3_PIN, 1); gpioSetValue (RB_SPI_SS3, 1);
gpioSetDir(RB_SPI_SS4_PORT, RB_SPI_SS4_PIN, gpioDirection_Output); gpioSetDir(RB_SPI_SS4, gpioDirection_Output);
gpioSetValue (RB_SPI_SS4_PORT, RB_SPI_SS4_PIN, 1); gpioSetValue (RB_SPI_SS4, 1);
gpioSetDir(RB_SPI_SS5_PORT, RB_SPI_SS5_PIN, gpioDirection_Output); gpioSetDir(RB_SPI_SS5, gpioDirection_Output);
gpioSetValue (RB_SPI_SS5_PORT, RB_SPI_SS5_PIN, 1); gpioSetValue (RB_SPI_SS5, 1);
// prepare hackerbus // prepare hackerbus
gpioSetDir(RB_HB0_PORT, RB_HB0_PIN, gpioDirection_Output); gpioSetDir(RB_HB0, gpioDirection_Output);
gpioSetValue (RB_HB0_PORT, RB_HB0_PIN, 1); gpioSetValue (RB_HB0, 1);
gpioSetDir(RB_HB1_PORT, RB_HB1_PIN, gpioDirection_Output); gpioSetDir(RB_HB1, gpioDirection_Output);
gpioSetValue (RB_HB1_PORT, RB_HB1_PIN, 1); gpioSetValue (RB_HB1, 1);
gpioSetDir(RB_HB2_PORT, RB_HB2_PIN, gpioDirection_Output); gpioSetDir(RB_HB2, gpioDirection_Output);
gpioSetValue (RB_HB2_PORT, RB_HB2_PIN, 1); gpioSetValue (RB_HB2, 1);
gpioSetDir(RB_HB3_PORT, RB_HB3_PIN, gpioDirection_Output); gpioSetDir(RB_HB3, gpioDirection_Output);
gpioSetValue (RB_HB3_PORT, RB_HB3_PIN, 1); gpioSetValue (RB_HB3, 1);
gpioSetDir(RB_HB4_PORT, RB_HB4_PIN, gpioDirection_Output); gpioSetDir(RB_HB4, gpioDirection_Output);
gpioSetValue (RB_HB4_PORT, RB_HB4_PIN, 1); gpioSetValue (RB_HB4, 1);
gpioSetDir(RB_HB5_PORT, RB_HB5_PIN, gpioDirection_Output); gpioSetDir(RB_HB5, gpioDirection_Output);
gpioSetValue (RB_HB5_PORT, RB_HB5_PIN, 1); gpioSetValue (RB_HB5, 1);
// prepare BUSINT interrupt // prepare BUSINT interrupt
gpioSetDir(RB_BUSINT_PORT, RB_BUSINT_PIN, gpioDirection_Input); gpioSetDir(RB_BUSINT, gpioDirection_Input);
gpioSetPullup (&RB_BUSINT_IO, gpioPullupMode_PullUp); gpioSetPullup (&RB_BUSINT_IO, gpioPullupMode_PullUp);
gpioSetInterrupt(RB_BUSINT_PORT, RB_BUSINT_PIN, gpioInterruptSense_Edge, gpioInterruptEdge_Single, gpioInterruptEvent_ActiveLow); gpioSetInterrupt(RB_BUSINT, gpioInterruptSense_Edge, gpioInterruptEdge_Single, gpioInterruptEvent_ActiveLow);
gpioIntEnable(RB_BUSINT_PORT, RB_BUSINT_PIN); gpioIntEnable(RB_BUSINT);
//add this to catch interrupt: //add this to catch interrupt:
/* /*
void PIOINT3_IRQHandler(void) { void PIOINT3_IRQHandler(void) {
if (gpioIntStatus(RB_BUSINT_PORT, RB_BUSINT_PIN)) { if (gpioIntStatus(RB_BUSINT)) {
// do something // do something
gpioIntClear(RB_BUSINT_PORT, RB_BUSINT_PIN); gpioIntClear(RB_BUSINT);
} }
} }
*/ */

View File

@ -5,145 +5,108 @@
#include "core/adc/adc.h" #include "core/adc/adc.h"
// LED // LED
#define RB_LED0_PORT 0 #define RB_LED0 0,11
#define RB_LED0_PIN 11
#define RB_LED1_PORT 1 #define RB_LED1 1,7
#define RB_LED1_PIN 7
#define RB_LED2_PORT 1 #define RB_LED2 1,6
#define RB_LED2_PIN 6
#define RB_LED3_PORT 1 #define RB_LED3 1,11
#define RB_LED3_PIN 11
// Infrared // Infrared
#define RB_IROUT_PORT 1 #define RB_IROUT 1,5
#define RB_IROUT_PIN 5
#define RB_IRIN_PORT 1 #define RB_IRIN 1,8
#define RB_IRIN_PIN 8
#define RB_IRIN_IO IOCON_PIO1_8 #define RB_IRIN_IO IOCON_PIO1_8
// Buttons // Buttons
#define RB_BTN0_PORT 0 #define RB_BTN0 0,1
#define RB_BTN0_PIN 1
#define RB_BTN0_IO IOCON_PIO0_1 #define RB_BTN0_IO IOCON_PIO0_1
#define RB_BTN1_PORT 2 #define RB_BTN1 2,9
#define RB_BTN1_PIN 9
#define RB_BTN1_IO IOCON_PIO2_9 #define RB_BTN1_IO IOCON_PIO2_9
#define RB_BTN2_PORT 2 #define RB_BTN2 2,6
#define RB_BTN2_PIN 6
#define RB_BTN2_IO IOCON_PIO2_6 #define RB_BTN2_IO IOCON_PIO2_6
#define RB_BTN3_PORT 3 #define RB_BTN3 3,3
#define RB_BTN3_PIN 3
#define RB_BTN3_IO IOCON_PIO3_3 #define RB_BTN3_IO IOCON_PIO3_3
#define RB_BTN4_PORT 1 #define RB_BTN4 1,4
#define RB_BTN4_PIN 4
#define RB_BTN4_IO IOCON_PIO1_4 #define RB_BTN4_IO IOCON_PIO1_4
// LCD // LCD
#define RB_LCD_BL_PORT 1 #define RB_LCD_BL 1,10
#define RB_LCD_BL_PIN 10
#define RB_LCD_A0_PORT 2 #define RB_LCD_A0 2,0
#define RB_LCD_A0_PIN 0
#define RB_LCD_CS_PORT 2 #define RB_LCD_CS 2,1
#define RB_LCD_CS_PIN 1
#define RB_LCD_RST_PORT 2 #define RB_LCD_RST 2,2
#define RB_LCD_RST_PIN 2
// I2C // I2C
#define RB_I2C_SCL_PORT 0 #define RB_I2C_SCL 0,4
#define RB_I2C_SCL_PIN 4
#define RB_I2C_SCA_PORT 0 #define RB_I2C_SCA 0,5
#define RB_I2C_SCA_PIN 5
// SPI // SPI
#define RB_SPI_MISO_PORT 0 #define RB_SPI_MISO 0,8
#define RB_SPI_MISO_PIN 8
#define RB_SPI_MOSI_PORT 0 #define RB_SPI_MOSI 0,9
#define RB_SPI_MOSI_PIN 9
#define RB_SPI_SCK_PORT 0 #define RB_SPI_SCK 0,10
#define RB_SPI_SCK_PIN 10
#define RB_SPI_SS0_PORT 2 #define RB_SPI_SS0 2,5
#define RB_SPI_SS0_PIN 5
#define RB_SPI_SS1_PORT 2 #define RB_SPI_SS1 2,4
#define RB_SPI_SS1_PIN 4
#define RB_SPI_SS2_PORT 2 #define RB_SPI_SS2 2,8
#define RB_SPI_SS2_PIN 8
#define RB_SPI_SS3_PORT 3 #define RB_SPI_SS3 3,2
#define RB_SPI_SS3_PIN 2
#define RB_SPI_SS4_PORT 3 #define RB_SPI_SS4 3,1
#define RB_SPI_SS4_PIN 1
#define RB_SPI_SS5_PORT 2 #define RB_SPI_SS5 2,11
#define RB_SPI_SS5_PIN 11
// Power // Power
#define RB_PWR_VOLT_PORT 1 #define RB_PWR_VOLT 1,0
#define RB_PWR_VOLT_PIN 0
#define RB_PWR_GOOD_PORT 1 #define RB_PWR_GOOD 1,9
#define RB_PWR_GOOD_PIN 9
#define RB_PWR_CHRG_PORT 2 #define RB_PWR_CHRG 2,3
#define RB_PWR_CHRG_PIN 3
// Hackerbus // Hackerbus
#define RB_HB0_PORT 1 #define RB_HB0 1,3
#define RB_HB0_PIN 3
#define RB_HB0_IO IOCON_PIO1_3 #define RB_HB0_IO IOCON_PIO1_3
#define RB_HB1_PORT 1 #define RB_HB1 1,2
#define RB_HB1_PIN 2
#define RB_HB1_IO IOCON_PIO1_2 #define RB_HB1_IO IOCON_PIO1_2
#define RB_HB2_PORT 1 #define RB_HB2 1,1
#define RB_HB2_PIN 1
#define RB_HB2_IO IOCON_PIO1_1 #define RB_HB2_IO IOCON_PIO1_1
#define RB_HB3_PORT 0 #define RB_HB3 0,2
#define RB_HB3_PIN 2
#define RB_HB3_IO IOCON_PIO0_2 #define RB_HB3_IO IOCON_PIO0_2
#define RB_HB4_PORT 2 #define RB_HB4 2,7
#define RB_HB4_PIN 7
#define RB_HB4_IO IOCON_PIO2_7 #define RB_HB4_IO IOCON_PIO2_7
#define RB_HB5_PORT 0 #define RB_HB5 0,6
#define RB_HB5_PIN 6
#define RB_HB5_IO IOCON_PIO0_6 #define RB_HB5_IO IOCON_PIO0_6
// Misc // Misc
#define RB_BUSINT_PORT 3 #define RB_BUSINT 3,0
#define RB_BUSINT_PIN 0
#define RB_BUSINT_IO IOCON_PIO3_0 #define RB_BUSINT_IO IOCON_PIO3_0
#define RB_USB_VBUS_PORT 0 #define RB_USB_VBUS 0,3
#define RB_USB_VBUS_PIN 3
#define RB_EEPROM_ADDR 0xA0 #define RB_EEPROM_ADDR 0xA0