Browse Source

LPC1768 HAL formatting/comments

Scott Lahteine 7 years ago
parent
commit
799e3b2b40

+ 5
- 6
Marlin/src/HAL/HAL_LPC1768/HAL.h View File

21
  */
21
  */
22
 
22
 
23
 /**
23
 /**
24
- * Description: HAL for Arduino Due and compatible (SAM3X8E)
25
- *
26
- * For ARDUINO_ARCH_SAM
24
+ * HAL_LPC1768/HAL.h
25
+ * Hardware Abstraction Layer for NXP LPC1768
27
  */
26
  */
28
 
27
 
29
-#ifndef _HAL_LPC1768_H
30
-#define _HAL_LPC1768_H
28
+#ifndef _HAL_LPC1768_H_
29
+#define _HAL_LPC1768_H_
31
 
30
 
32
 // --------------------------------------------------------------------------
31
 // --------------------------------------------------------------------------
33
 // Includes
32
 // Includes
141
 void HAL_adc_start_conversion(const uint8_t adc_pin);
140
 void HAL_adc_start_conversion(const uint8_t adc_pin);
142
 uint16_t HAL_adc_get_result(void);
141
 uint16_t HAL_adc_get_result(void);
143
 
142
 
144
-#endif // _HAL_LPC1768_H
143
+#endif // _HAL_LPC1768_H_

+ 5
- 9
Marlin/src/HAL/HAL_LPC1768/HAL_LCD_I2C_routines.h View File

20
  *
20
  *
21
  */
21
  */
22
 
22
 
23
-#ifdef TARGET_LPC1768
24
-
25
-  void u8g_i2c_init(uint8_t options);
26
-  uint8_t u8g_i2c_wait(uint8_t mask, uint8_t pos);
27
-  uint8_t u8g_i2c_start(uint8_t sla);
28
-  uint8_t u8g_i2c_send_byte(uint8_t data);
29
-  void u8g_i2c_stop(void);
30
-
31
-#endif
23
+void u8g_i2c_init(uint8_t options);
24
+uint8_t u8g_i2c_wait(uint8_t mask, uint8_t pos);
25
+uint8_t u8g_i2c_start(uint8_t sla);
26
+uint8_t u8g_i2c_send_byte(uint8_t data);
27
+void u8g_i2c_stop(void);

+ 1
- 5
Marlin/src/HAL/HAL_LPC1768/HAL_LCD_delay.h View File

29
  * one microsecond delay being about 4uS.
29
  * one microsecond delay being about 4uS.
30
  */
30
  */
31
 
31
 
32
-
33
-
34
 #ifdef __cplusplus
32
 #ifdef __cplusplus
35
   extern "C" {
33
   extern "C" {
36
 #endif
34
 #endif
37
 
35
 
38
 void U8g_delay(int msec);
36
 void U8g_delay(int msec);
39
-
40
 void u8g_MicroDelay(void);
37
 void u8g_MicroDelay(void);
41
-
42
 void u8g_10MicroDelay(void);
38
 void u8g_10MicroDelay(void);
43
 
39
 
44
 #ifdef __cplusplus
40
 #ifdef __cplusplus
45
   }
41
   }
46
-#endif
42
+#endif

+ 0
- 11
Marlin/src/HAL/HAL_LPC1768/HAL_LCD_pin_routines.h View File

30
  * resulted in using about about 25% of the CPU's time.
30
  * resulted in using about about 25% of the CPU's time.
31
  */
31
  */
32
 
32
 
33
-
34
-
35
-
36
-
37
 void u8g_SetPinOutput(uint8_t internal_pin_number);
33
 void u8g_SetPinOutput(uint8_t internal_pin_number);
38
-
39
 void u8g_SetPinInput(uint8_t internal_pin_number);
34
 void u8g_SetPinInput(uint8_t internal_pin_number);
40
-
41
 void u8g_SetPinLevel(uint8_t  pin, uint8_t  pin_status);
35
 void u8g_SetPinLevel(uint8_t  pin, uint8_t  pin_status);
42
-
43
 uint8_t u8g_GetPinLevel(uint8_t pin);
36
 uint8_t u8g_GetPinLevel(uint8_t pin);
44
-
45
-
46
-
47
-

+ 28
- 32
Marlin/src/HAL/HAL_LPC1768/HAL_LPC1768_LCD_defines.h View File

24
  * LPC1768 LCD-specific defines
24
  * LPC1768 LCD-specific defines
25
  */
25
  */
26
 
26
 
27
-#ifdef TARGET_LPC1768
28
-
29
-  // pointers to low level routines - must always supply these
30
-  //#define U8G_HAL_LINKS
31
-  #define HAL_LCD_pin_routines "HAL_LPC1768/HAL_LCD_pin_routines.h"
32
-  #define HAL_LCD_I2C_routines  "HAL_LPC1768/HAL_LCD_I2C_routines.h"
33
-  #define HAL_LCD_delay "HAL_LPC1768/HAL_LCD_delay.h"
34
-
35
-  // The following are optional depending on the platform.
36
-
37
-  // definitions of HAL specific com and device drivers.
38
-  uint8_t u8g_com_HAL_LPC1768_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
39
-  uint8_t u8g_com_HAL_LPC1768_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
40
-  uint8_t u8g_com_HAL_LPC1768_ST7920_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
41
-  uint8_t u8g_com_HAL_LPC1768_ST7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
42
-  uint8_t u8g_com_HAL_LPC1768_ssd_hw_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
43
-
44
-
45
-  // connect U8g com generic com names to the desired driver
46
-  #define U8G_COM_HW_SPI u8g_com_HAL_LPC1768_hw_spi_fn  // use LPC1768 specific hardware SPI routine
47
-  #define U8G_COM_SW_SPI u8g_com_HAL_LPC1768_sw_spi_fn  // use LPC1768 specific software SPI routine
48
-  #define U8G_COM_ST7920_HW_SPI u8g_com_HAL_LPC1768_ST7920_hw_spi_fn
49
-  #define U8G_COM_ST7920_SW_SPI u8g_com_HAL_LPC1768_ST7920_sw_spi_fn
50
-  #define U8G_COM_SSD_I2C u8g_com_HAL_LPC1768_ssd_hw_i2c_fn
51
-
52
-  // let these default for now
53
-  #define U8G_COM_PARALLEL u8g_com_null_fn
54
-  #define U8G_COM_T6963 u8g_com_null_fn
55
-  #define U8G_COM_FAST_PARALLEL u8g_com_null_fn
56
-  #define U8G_COM_UC_I2C u8g_com_null_fn
57
-
58
-#endif
27
+// pointers to low level routines - must always supply these
28
+//#define U8G_HAL_LINKS
29
+#define HAL_LCD_pin_routines "HAL_LPC1768/HAL_LCD_pin_routines.h"
30
+#define HAL_LCD_I2C_routines  "HAL_LPC1768/HAL_LCD_I2C_routines.h"
31
+#define HAL_LCD_delay "HAL_LPC1768/HAL_LCD_delay.h"
32
+
33
+// The following are optional depending on the platform.
34
+
35
+// definitions of HAL specific com and device drivers.
36
+uint8_t u8g_com_HAL_LPC1768_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
37
+uint8_t u8g_com_HAL_LPC1768_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
38
+uint8_t u8g_com_HAL_LPC1768_ST7920_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
39
+uint8_t u8g_com_HAL_LPC1768_ST7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
40
+uint8_t u8g_com_HAL_LPC1768_ssd_hw_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
41
+
42
+
43
+// connect U8g com generic com names to the desired driver
44
+#define U8G_COM_HW_SPI u8g_com_HAL_LPC1768_hw_spi_fn  // use LPC1768 specific hardware SPI routine
45
+#define U8G_COM_SW_SPI u8g_com_HAL_LPC1768_sw_spi_fn  // use LPC1768 specific software SPI routine
46
+#define U8G_COM_ST7920_HW_SPI u8g_com_HAL_LPC1768_ST7920_hw_spi_fn
47
+#define U8G_COM_ST7920_SW_SPI u8g_com_HAL_LPC1768_ST7920_sw_spi_fn
48
+#define U8G_COM_SSD_I2C u8g_com_HAL_LPC1768_ssd_hw_i2c_fn
49
+
50
+// let these default for now
51
+#define U8G_COM_PARALLEL u8g_com_null_fn
52
+#define U8G_COM_T6963 u8g_com_null_fn
53
+#define U8G_COM_FAST_PARALLEL u8g_com_null_fn
54
+#define U8G_COM_UC_I2C u8g_com_null_fn

+ 1
- 0
Marlin/src/HAL/HAL_LPC1768/LPC_SPI.h View File

19
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
  *
20
  *
21
  */
21
  */
22
+
22
 #pragma once
23
 #pragma once
23
 #ifdef TARGET_LPC1768
24
 #ifdef TARGET_LPC1768
24
 #include <stdint.h>
25
 #include <stdint.h>

+ 1
- 3
Marlin/src/HAL/HAL_LPC1768/main.cpp View File

116
   LPC1768_PWM_init();
116
   LPC1768_PWM_init();
117
 
117
 
118
   setup();
118
   setup();
119
-  while (true) {
120
-    loop();
121
-  }
119
+  for (;;) loop();
122
 }
120
 }
123
 
121
 
124
 #endif // TARGET_LPC1768
122
 #endif // TARGET_LPC1768

+ 3
- 3
Marlin/src/HAL/HAL_LPC1768/u8g_com_HAL_LPC1768_hw_spi.cpp View File

59
 
59
 
60
 #ifdef TARGET_LPC1768
60
 #ifdef TARGET_LPC1768
61
 
61
 
62
-//  #include <inttypes.h>
62
+  //#include <inttypes.h>
63
 
63
 
64
-//  #include "src/core/macros.h"
65
-//  #include "Configuration.h"
64
+  //#include "src/core/macros.h"
65
+  //#include "Configuration.h"
66
 
66
 
67
   #include <U8glib.h>
67
   #include <U8glib.h>
68
 
68
 

Loading…
Cancel
Save