Updated according to new ADC driver API Updated Comments Updated according to new...
authorNathael Pajani <nathael.pajani@ed3l.fr>
Tue, 27 Sep 2016 21:47:09 +0000 (23:47 +0200)
committerNathael Pajani <nathael.pajani@ed3l.fr>
Mon, 6 Feb 2023 01:06:47 +0000 (02:06 +0100)
transparent_bridge/main.c

index 7bec21d..5525bba 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- *   main.c
+ *   transparent_bridge/main.c
  *
  * KNX support example
  *
  *************************************************************************** */
 
 
-#include <stdint.h>
-#include "core/lpc_regs_12xx.h"
-#include "core/lpc_core_cm0.h"
-#include "core/pio.h"
 #include "core/system.h"
 #include "core/systick.h"
+#include "core/pio.h"
 #include "lib/stdio.h"
 #include "drivers/serial.h"
 #include "drivers/gpio.h"
@@ -96,8 +93,8 @@ const struct pio knx_save = LPC_GPIO_0_7;
 const struct pio status_led_green = LPC_GPIO_0_28;
 const struct pio status_led_red = LPC_GPIO_0_29;
 
-#define ADC_EXT1  LPC_ADC_NUM(1)
-#define ADC_EXT2  LPC_ADC_NUM(2)
+#define ADC_EXT1  LPC_ADC(1)
+#define ADC_EXT2  LPC_ADC(2)
 
 
 
@@ -106,10 +103,7 @@ void system_init()
 {
        /* Stop the watchdog */
        startup_watchdog_disable(); /* Do it right now, before it gets a chance to break in */
-
-       /* Note: Brown-Out detection must be powered to operate the ADC. adc_on() will power
-        *  it back on if called after system_init() */
-       system_brown_out_detection_config(0);
+       system_brown_out_detection_config(0); /* No ADC used */
        system_set_default_power_state();
        clock_config(SELECTED_FREQ);
        set_pins(common_pins);
@@ -128,10 +122,7 @@ void system_init()
  */
 void fault_info(const char* name, uint32_t len)
 {
-       serial_write(0, name, len);
-       /* Wait for end of Tx */
-       serial_flush(0);
-       /* FIXME : Perform soft reset of the micro-controller ! */
+       uprintf(UART0, name);
        while (1);
 }
 
@@ -150,10 +141,11 @@ void got_echo(uint8_t c)
 
 
 /***************************************************************************** */
-int main(void) {
+int main(void)
+{
        system_init();
-       uart_on(0, 115200, send_for_echo);
-       uart_on(1, 38400, got_echo);
+       uart_on(UART0, 115200, send_for_echo);
+       uart_on(UART1, 38400, got_echo);
 
 
        while (1) {