* Add PIN_EN1V8 (1V8 work fine 1V8 LED is set to ON), and PIN_BOOT0, 1, 2 & 3(read only).
* Fixed wait() by using volatile else the loop was removed by GCC. Tested it with SPIFI work fine: SPIFI tested with LPCXpresso+NXP LPC Link (from LPCXpresso Board LPC1769 Debugger) -> Program Flash with Flash Driver LPC1850A_4350A_SPIFI.cfx -> Select file: firmware\blinky\blinky.bin -> Base address 0x14000000 & option Erase only required pages
This commit is contained in:
@ -23,15 +23,26 @@
|
|||||||
|
|
||||||
void wait(uint8_t duration)
|
void wait(uint8_t duration)
|
||||||
{
|
{
|
||||||
uint32_t i;
|
volatile uint32_t i;
|
||||||
for (i = 0; i < duration * 1000000; i++);
|
for (i = 0; i < duration * 1000000; i++);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t boot0, boot1, boot2, boot3;
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
|
||||||
gpio_init();
|
gpio_init();
|
||||||
|
|
||||||
|
EN1V8_SET;
|
||||||
|
EN1V8_CLR;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
|
boot0 = BOOT0;
|
||||||
|
boot1 = BOOT1;
|
||||||
|
boot2 = BOOT2;
|
||||||
|
boot3 = BOOT3;
|
||||||
|
|
||||||
LED1_SET;
|
LED1_SET;
|
||||||
LED2_SET;
|
LED2_SET;
|
||||||
LED3_SET;
|
LED3_SET;
|
||||||
@ -41,4 +52,6 @@ int main()
|
|||||||
LED3_CLR;
|
LED3_CLR;
|
||||||
wait(1);
|
wait(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0 ;
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,9 @@ void gpio_init()
|
|||||||
|
|
||||||
/* set certain pins as outputs, all others inputs */
|
/* set certain pins as outputs, all others inputs */
|
||||||
GPIO_DIR2 = (PIN_LED1 | PIN_LED2 | PIN_LED3);
|
GPIO_DIR2 = (PIN_LED1 | PIN_LED2 | PIN_LED3);
|
||||||
|
|
||||||
|
/* set certain pins as outputs, all others inputs */
|
||||||
|
GPIO_DIR3 = (PIN_EN1V8);
|
||||||
}
|
}
|
||||||
|
|
||||||
void all_pins_off(void)
|
void all_pins_off(void)
|
||||||
|
@ -33,9 +33,16 @@
|
|||||||
|
|
||||||
/* GPIO pins */
|
/* GPIO pins */
|
||||||
//#ifdef JELLYBEAN
|
//#ifdef JELLYBEAN
|
||||||
#define PIN_LED1 (1 << 1) /* GPIO2[1] on P4_1 */
|
#define PIN_LED1 (1 << 1) /* GPIO2[1] on P4_1 */
|
||||||
#define PIN_LED2 (1 << 2) /* GPIO2[2] on P4_2 */
|
#define PIN_LED2 (1 << 2) /* GPIO2[2] on P4_2 */
|
||||||
#define PIN_LED3 (1 << 8) /* GPIO2[8] on P6_12 */
|
#define PIN_LED3 (1 << 8) /* GPIO2[8] on P6_12 */
|
||||||
|
|
||||||
|
#define PIN_EN1V8 (1 << 6) /* GPIO3[6] on P6_10 */
|
||||||
|
|
||||||
|
#define PIN_BOOT0 (1 << 8) /* GPIO0[8] on P1_1 */
|
||||||
|
#define PIN_BOOT1 (1 << 9) /* GPIO0[9] on P1_2 */
|
||||||
|
#define PIN_BOOT2 (1 << 7) /* GPIO5[7] on P2_8 */
|
||||||
|
#define PIN_BOOT3 (1 << 10) /* GPIO1[10] on P2_9 */
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
/* indicator LED control */
|
/* indicator LED control */
|
||||||
@ -49,6 +56,17 @@
|
|||||||
#define LED3 (GPIO_PIN2 & PIN_LED3)
|
#define LED3 (GPIO_PIN2 & PIN_LED3)
|
||||||
#define LED3_SET (GPIO_SET2 = PIN_LED3)
|
#define LED3_SET (GPIO_SET2 = PIN_LED3)
|
||||||
#define LED3_CLR (GPIO_CLR2 = PIN_LED3)
|
#define LED3_CLR (GPIO_CLR2 = PIN_LED3)
|
||||||
|
|
||||||
|
#define EN1V8 (GPIO_PIN3 & PIN_EN1V8)
|
||||||
|
#define EN1V8_SET (GPIO_SET3 = PIN_EN1V8)
|
||||||
|
#define EN1V8_CLR (GPIO_CLR3 = PIN_EN1V8)
|
||||||
|
|
||||||
|
/* Input GPIO BOOT0 to 3 */
|
||||||
|
#define BOOT0 (GPIO_PIN0 & PIN_BOOT0)
|
||||||
|
#define BOOT1 (GPIO_PIN0 & PIN_BOOT1)
|
||||||
|
#define BOOT2 (GPIO_PIN5 & PIN_BOOT2)
|
||||||
|
#define BOOT3 (GPIO_PIN1 & PIN_BOOT3)
|
||||||
|
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
void gpio_init(void);
|
void gpio_init(void);
|
||||||
|
Reference in New Issue
Block a user