From 7d99206f055a3527bf1aa92052f9923f6cb744a5 Mon Sep 17 00:00:00 2001 From: flabbergast Date: Sun, 8 May 2016 09:09:43 +0100 Subject: [KINETIS] PAL driver: implement PAL_LINE. --- os/hal/boards/FREESCALE_FREEDOM_K20D50M/board.h | 12 ++++++++ os/hal/boards/FREESCALE_FREEDOM_KL25Z/board.h | 16 ++++++++++- os/hal/boards/FREESCALE_FREEDOM_KL26Z/board.h | 38 ++++++++++++++++++------- os/hal/boards/MCHCK_K20/board.h | 2 ++ os/hal/boards/PJRC_TEENSY_3/board.h | 37 ++++++++++++++++++++++++ os/hal/boards/PJRC_TEENSY_3_1/board.h | 37 ++++++++++++++++++++++++ os/hal/boards/PJRC_TEENSY_LC/board.h | 28 ++++++++++++++++++ os/hal/ports/KINETIS/LLD/hal_pal_lld.h | 37 ++++++++++++++++++++++++ testhal/KINETIS/FRDM-KL25Z/PWM/main.c | 10 +++---- testhal/KINETIS/FRDM-KL26Z/PWM/main.c | 16 +++++------ testhal/KINETIS/MCHCK/PWM/main.c | 4 +-- testhal/KINETIS/TEENSY_LC/PWM/main.c | 4 +-- 12 files changed, 213 insertions(+), 28 deletions(-) diff --git a/os/hal/boards/FREESCALE_FREEDOM_K20D50M/board.h b/os/hal/boards/FREESCALE_FREEDOM_K20D50M/board.h index cf41495..8f8605c 100644 --- a/os/hal/boards/FREESCALE_FREEDOM_K20D50M/board.h +++ b/os/hal/boards/FREESCALE_FREEDOM_K20D50M/board.h @@ -45,6 +45,18 @@ #define GPIO_LED_BLUE IOPORT1 #define PIN_LED_BLUE 2 +/* Inertial sensor: MMA8451Q */ +/* Default I2C address 0x1D */ +#define I2C_GYRO I2C0 + +#define LINE_LED_RED PAL_LINE(GPIO_LED_RED, PIN_LED_RED) +#define LINE_LED_GREEN PAL_LINE(GPIO_LED_GREEN, PIN_LED_GREEN) +#define LINE_LED_BLUE PAL_LINE(GPIO_LED_BLUE, PIN_LED_BLUE) +#define LINE_GYRO_SCL PAL_LINE(GPIOB, 0U) +#define LINE_GYRO_SDA PAL_LINE(GPIOB, 1U) +#define LINE_GYRO_INT1 PAL_LINE(GPIOC, 11U) +#define LINE_GYRO_INT2 PAL_LINE(GPIOC, 6U) + #if !defined(_FROM_ASM_) #ifdef __cplusplus extern "C" { diff --git a/os/hal/boards/FREESCALE_FREEDOM_KL25Z/board.h b/os/hal/boards/FREESCALE_FREEDOM_KL25Z/board.h index 35d8e06..289ee91 100644 --- a/os/hal/boards/FREESCALE_FREEDOM_KL25Z/board.h +++ b/os/hal/boards/FREESCALE_FREEDOM_KL25Z/board.h @@ -45,7 +45,21 @@ #define GPIO_LED_BLUE IOPORT4 #define PIN_LED_BLUE 1 -#define I2C_INERIAL_SENSOR I2C0 +/* Inertial sensor: MMA8451Q */ +/* Default I2C address 0x1D */ +/* Note: the pins PTE24/25 are assigned to I2C0 by default; + * if I2C0 is wanted on other pins, these need to be + * assigned another function explicitly! + */ +#define I2C_GYRO I2C0 + +#define LINE_LED_RED PAL_LINE(GPIO_LED_RED, PIN_LED_RED) +#define LINE_LED_GREEN PAL_LINE(GPIO_LED_GREEN, PIN_LED_GREEN) +#define LINE_LED_BLUE PAL_LINE(GPIO_LED_BLUE, PIN_LED_BLUE) +#define LINE_GYRO_SCL PAL_LINE(GPIOE, 24U) +#define LINE_GYRO_SDA PAL_LINE(GPIOE, 25U) +#define LINE_GYRO_INT1 PAL_LINE(GPIOA, 14U) +#define LINE_GYRO_INT2 PAL_LINE(GPIOA, 15U) /* * Not configured: diff --git a/os/hal/boards/FREESCALE_FREEDOM_KL26Z/board.h b/os/hal/boards/FREESCALE_FREEDOM_KL26Z/board.h index 2ae42aa..1db7947 100644 --- a/os/hal/boards/FREESCALE_FREEDOM_KL26Z/board.h +++ b/os/hal/boards/FREESCALE_FREEDOM_KL26Z/board.h @@ -38,16 +38,34 @@ /* * Onboard features. */ -#define GPIO_LED_RED IOPORT5 -#define PIN_LED_RED 29 -#define GPIO_LED_GREEN IOPORT5 -#define PIN_LED_GREEN 31 -#define GPIO_LED_BLUE IOPORT4 -#define PIN_LED_BLUE 5 -#define GPIO_BUTTON IOPORT4 -#define PIN_BUTTON 0 -#define GPIO_LIGHTSNS IOPORT5 -#define PIN_LIGHTSNS 22 +#define GPIO_LED_RED IOPORT5 +#define PIN_LED_RED 29 +#define GPIO_LED_GREEN IOPORT5 +#define PIN_LED_GREEN 31 +#define GPIO_LED_BLUE IOPORT4 +#define PIN_LED_BLUE 5 +#define GPIO_BUTTON IOPORT4 +#define PIN_BUTTON 0 +#define GPIO_LIGHT_SENSOR IOPORT5 +#define PIN_LIGHT_SENSOR 22 + +/* Inertial sensor: FXOS8700CQ */ +/* Default I2C address 0x1D */ +/* Note: the pins PTE24/25 are assigned to I2C0 by default; + * if I2C0 is wanted on other pins, these need to be + * assigned another function explicitly! + */ +#define I2C_GYRO I2C0 + +#define LINE_LED_RED PAL_LINE(GPIO_LED_RED, PIN_LED_RED) +#define LINE_LED_GREEN PAL_LINE(GPIO_LED_GREEN, PIN_LED_GREEN) +#define LINE_LED_BLUE PAL_LINE(GPIO_LED_BLUE, PIN_LED_BLUE) +#define LINE_BUTTON PAL_LINE(GPIO_BUTTON, PIN_BUTTON) +#define LINE_LIGHT_SENSOR PAL_LINE(GPIO_LIGHT_SENSOR, PIN_LIGHT_SENSOR) +#define LINE_GYRO_SCL PAL_LINE(GPIOE, 24U) +#define LINE_GYRO_SDA PAL_LINE(GPIOE, 25U) +#define LINE_GYRO_INT1 PAL_LINE(GPIOD, 0U) +#define LINE_GYRO_INT2 PAL_LINE(GPIOD, 1U) /* * Not configured: diff --git a/os/hal/boards/MCHCK_K20/board.h b/os/hal/boards/MCHCK_K20/board.h index 504ab0e..aad3e27 100644 --- a/os/hal/boards/MCHCK_K20/board.h +++ b/os/hal/boards/MCHCK_K20/board.h @@ -34,6 +34,8 @@ #define GPIOB_LED 16 +#define LINE_LED PAL_LINE(GPIOB, GPIOB_LED) + #if !defined(_FROM_ASM_) #ifdef __cplusplus extern "C" { diff --git a/os/hal/boards/PJRC_TEENSY_3/board.h b/os/hal/boards/PJRC_TEENSY_3/board.h index ee9f514..f3e7383 100644 --- a/os/hal/boards/PJRC_TEENSY_3/board.h +++ b/os/hal/boards/PJRC_TEENSY_3/board.h @@ -245,6 +245,43 @@ #define TEENSY_PIN26_IOPORT IOPORT5 #define TEENSY_PIN31_IOPORT IOPORT5 +#define LINE_PIN1 PAL_LINE(TEENSY_PIN1_IOPORT, TEENSY_PIN1) +#define LINE_PIN2 PAL_LINE(TEENSY_PIN2_IOPORT, TEENSY_PIN2) +#define LINE_PIN3 PAL_LINE(TEENSY_PIN3_IOPORT, TEENSY_PIN3) +#define LINE_PIN4 PAL_LINE(TEENSY_PIN4_IOPORT, TEENSY_PIN4) +#define LINE_PIN5 PAL_LINE(TEENSY_PIN5_IOPORT, TEENSY_PIN5) +#define LINE_PIN6 PAL_LINE(TEENSY_PIN6_IOPORT, TEENSY_PIN6) +#define LINE_PIN7 PAL_LINE(TEENSY_PIN7_IOPORT, TEENSY_PIN7) +#define LINE_PIN8 PAL_LINE(TEENSY_PIN8_IOPORT, TEENSY_PIN8) +#define LINE_PIN9 PAL_LINE(TEENSY_PIN9_IOPORT, TEENSY_PIN9) +#define LINE_PIN10 PAL_LINE(TEENSY_PIN10_IOPORT, TEENSY_PIN10) +#define LINE_PIN11 PAL_LINE(TEENSY_PIN11_IOPORT, TEENSY_PIN11) +#define LINE_PIN12 PAL_LINE(TEENSY_PIN12_IOPORT, TEENSY_PIN12) +#define LINE_PIN13 PAL_LINE(TEENSY_PIN13_IOPORT, TEENSY_PIN13) +#define LINE_PIN14 PAL_LINE(TEENSY_PIN14_IOPORT, TEENSY_PIN14) +#define LINE_PIN15 PAL_LINE(TEENSY_PIN15_IOPORT, TEENSY_PIN15) +#define LINE_PIN16 PAL_LINE(TEENSY_PIN16_IOPORT, TEENSY_PIN16) +#define LINE_PIN17 PAL_LINE(TEENSY_PIN17_IOPORT, TEENSY_PIN17) +#define LINE_PIN18 PAL_LINE(TEENSY_PIN18_IOPORT, TEENSY_PIN18) +#define LINE_PIN19 PAL_LINE(TEENSY_PIN19_IOPORT, TEENSY_PIN19) +#define LINE_PIN20 PAL_LINE(TEENSY_PIN20_IOPORT, TEENSY_PIN20) +#define LINE_PIN21 PAL_LINE(TEENSY_PIN21_IOPORT, TEENSY_PIN21) +#define LINE_PIN22 PAL_LINE(TEENSY_PIN22_IOPORT, TEENSY_PIN22) +#define LINE_PIN23 PAL_LINE(TEENSY_PIN23_IOPORT, TEENSY_PIN23) +#define LINE_PIN24 PAL_LINE(TEENSY_PIN24_IOPORT, TEENSY_PIN24) +#define LINE_PIN25 PAL_LINE(TEENSY_PIN25_IOPORT, TEENSY_PIN25) +#define LINE_PIN25 PAL_LINE(TEENSY_PIN25_IOPORT, TEENSY_PIN25) +#define LINE_PIN26 PAL_LINE(TEENSY_PIN26_IOPORT, TEENSY_PIN26) +#define LINE_PIN27 PAL_LINE(TEENSY_PIN27_IOPORT, TEENSY_PIN27) +#define LINE_PIN28 PAL_LINE(TEENSY_PIN28_IOPORT, TEENSY_PIN28) +#define LINE_PIN29 PAL_LINE(TEENSY_PIN29_IOPORT, TEENSY_PIN29) +#define LINE_PIN30 PAL_LINE(TEENSY_PIN30_IOPORT, TEENSY_PIN30) +#define LINE_PIN31 PAL_LINE(TEENSY_PIN31_IOPORT, TEENSY_PIN31) +#define LINE_PIN32 PAL_LINE(TEENSY_PIN32_IOPORT, TEENSY_PIN32) +#define LINE_PIN33 PAL_LINE(TEENSY_PIN33_IOPORT, TEENSY_PIN33) + +#define LINE_LED LINE_PIN13 + #if !defined(_FROM_ASM_) #ifdef __cplusplus extern "C" { diff --git a/os/hal/boards/PJRC_TEENSY_3_1/board.h b/os/hal/boards/PJRC_TEENSY_3_1/board.h index 6e89c07..76a52b7 100644 --- a/os/hal/boards/PJRC_TEENSY_3_1/board.h +++ b/os/hal/boards/PJRC_TEENSY_3_1/board.h @@ -245,6 +245,43 @@ #define TEENSY_PIN26_IOPORT IOPORT5 #define TEENSY_PIN31_IOPORT IOPORT5 +#define LINE_PIN1 PAL_LINE(TEENSY_PIN1_IOPORT, TEENSY_PIN1) +#define LINE_PIN2 PAL_LINE(TEENSY_PIN2_IOPORT, TEENSY_PIN2) +#define LINE_PIN3 PAL_LINE(TEENSY_PIN3_IOPORT, TEENSY_PIN3) +#define LINE_PIN4 PAL_LINE(TEENSY_PIN4_IOPORT, TEENSY_PIN4) +#define LINE_PIN5 PAL_LINE(TEENSY_PIN5_IOPORT, TEENSY_PIN5) +#define LINE_PIN6 PAL_LINE(TEENSY_PIN6_IOPORT, TEENSY_PIN6) +#define LINE_PIN7 PAL_LINE(TEENSY_PIN7_IOPORT, TEENSY_PIN7) +#define LINE_PIN8 PAL_LINE(TEENSY_PIN8_IOPORT, TEENSY_PIN8) +#define LINE_PIN9 PAL_LINE(TEENSY_PIN9_IOPORT, TEENSY_PIN9) +#define LINE_PIN10 PAL_LINE(TEENSY_PIN10_IOPORT, TEENSY_PIN10) +#define LINE_PIN11 PAL_LINE(TEENSY_PIN11_IOPORT, TEENSY_PIN11) +#define LINE_PIN12 PAL_LINE(TEENSY_PIN12_IOPORT, TEENSY_PIN12) +#define LINE_PIN13 PAL_LINE(TEENSY_PIN13_IOPORT, TEENSY_PIN13) +#define LINE_PIN14 PAL_LINE(TEENSY_PIN14_IOPORT, TEENSY_PIN14) +#define LINE_PIN15 PAL_LINE(TEENSY_PIN15_IOPORT, TEENSY_PIN15) +#define LINE_PIN16 PAL_LINE(TEENSY_PIN16_IOPORT, TEENSY_PIN16) +#define LINE_PIN17 PAL_LINE(TEENSY_PIN17_IOPORT, TEENSY_PIN17) +#define LINE_PIN18 PAL_LINE(TEENSY_PIN18_IOPORT, TEENSY_PIN18) +#define LINE_PIN19 PAL_LINE(TEENSY_PIN19_IOPORT, TEENSY_PIN19) +#define LINE_PIN20 PAL_LINE(TEENSY_PIN20_IOPORT, TEENSY_PIN20) +#define LINE_PIN21 PAL_LINE(TEENSY_PIN21_IOPORT, TEENSY_PIN21) +#define LINE_PIN22 PAL_LINE(TEENSY_PIN22_IOPORT, TEENSY_PIN22) +#define LINE_PIN23 PAL_LINE(TEENSY_PIN23_IOPORT, TEENSY_PIN23) +#define LINE_PIN24 PAL_LINE(TEENSY_PIN24_IOPORT, TEENSY_PIN24) +#define LINE_PIN25 PAL_LINE(TEENSY_PIN25_IOPORT, TEENSY_PIN25) +#define LINE_PIN25 PAL_LINE(TEENSY_PIN25_IOPORT, TEENSY_PIN25) +#define LINE_PIN26 PAL_LINE(TEENSY_PIN26_IOPORT, TEENSY_PIN26) +#define LINE_PIN27 PAL_LINE(TEENSY_PIN27_IOPORT, TEENSY_PIN27) +#define LINE_PIN28 PAL_LINE(TEENSY_PIN28_IOPORT, TEENSY_PIN28) +#define LINE_PIN29 PAL_LINE(TEENSY_PIN29_IOPORT, TEENSY_PIN29) +#define LINE_PIN30 PAL_LINE(TEENSY_PIN30_IOPORT, TEENSY_PIN30) +#define LINE_PIN31 PAL_LINE(TEENSY_PIN31_IOPORT, TEENSY_PIN31) +#define LINE_PIN32 PAL_LINE(TEENSY_PIN32_IOPORT, TEENSY_PIN32) +#define LINE_PIN33 PAL_LINE(TEENSY_PIN33_IOPORT, TEENSY_PIN33) + +#define LINE_LED LINE_PIN13 + #if !defined(_FROM_ASM_) #ifdef __cplusplus extern "C" { diff --git a/os/hal/boards/PJRC_TEENSY_LC/board.h b/os/hal/boards/PJRC_TEENSY_LC/board.h index 3f181f8..ad75343 100644 --- a/os/hal/boards/PJRC_TEENSY_LC/board.h +++ b/os/hal/boards/PJRC_TEENSY_LC/board.h @@ -238,6 +238,34 @@ #define TEENSY_PIN25_IOPORT IOPORT5 #define TEENSY_PIN26_IOPORT IOPORT5 +#define LINE_PIN1 PAL_LINE(TEENSY_PIN1_IOPORT, TEENSY_PIN1) +#define LINE_PIN2 PAL_LINE(TEENSY_PIN2_IOPORT, TEENSY_PIN2) +#define LINE_PIN3 PAL_LINE(TEENSY_PIN3_IOPORT, TEENSY_PIN3) +#define LINE_PIN4 PAL_LINE(TEENSY_PIN4_IOPORT, TEENSY_PIN4) +#define LINE_PIN5 PAL_LINE(TEENSY_PIN5_IOPORT, TEENSY_PIN5) +#define LINE_PIN6 PAL_LINE(TEENSY_PIN6_IOPORT, TEENSY_PIN6) +#define LINE_PIN7 PAL_LINE(TEENSY_PIN7_IOPORT, TEENSY_PIN7) +#define LINE_PIN8 PAL_LINE(TEENSY_PIN8_IOPORT, TEENSY_PIN8) +#define LINE_PIN9 PAL_LINE(TEENSY_PIN9_IOPORT, TEENSY_PIN9) +#define LINE_PIN10 PAL_LINE(TEENSY_PIN10_IOPORT, TEENSY_PIN10) +#define LINE_PIN11 PAL_LINE(TEENSY_PIN11_IOPORT, TEENSY_PIN11) +#define LINE_PIN12 PAL_LINE(TEENSY_PIN12_IOPORT, TEENSY_PIN12) +#define LINE_PIN13 PAL_LINE(TEENSY_PIN13_IOPORT, TEENSY_PIN13) +#define LINE_PIN14 PAL_LINE(TEENSY_PIN14_IOPORT, TEENSY_PIN14) +#define LINE_PIN15 PAL_LINE(TEENSY_PIN15_IOPORT, TEENSY_PIN15) +#define LINE_PIN16 PAL_LINE(TEENSY_PIN16_IOPORT, TEENSY_PIN16) +#define LINE_PIN17 PAL_LINE(TEENSY_PIN17_IOPORT, TEENSY_PIN17) +#define LINE_PIN18 PAL_LINE(TEENSY_PIN18_IOPORT, TEENSY_PIN18) +#define LINE_PIN19 PAL_LINE(TEENSY_PIN19_IOPORT, TEENSY_PIN19) +#define LINE_PIN20 PAL_LINE(TEENSY_PIN20_IOPORT, TEENSY_PIN20) +#define LINE_PIN21 PAL_LINE(TEENSY_PIN21_IOPORT, TEENSY_PIN21) +#define LINE_PIN22 PAL_LINE(TEENSY_PIN22_IOPORT, TEENSY_PIN22) +#define LINE_PIN23 PAL_LINE(TEENSY_PIN23_IOPORT, TEENSY_PIN23) +#define LINE_PIN24 PAL_LINE(TEENSY_PIN24_IOPORT, TEENSY_PIN24) +#define LINE_PIN25 PAL_LINE(TEENSY_PIN25_IOPORT, TEENSY_PIN25) + +#define LINE_LED LINE_PIN13 + #if !defined(_FROM_ASM_) #ifdef __cplusplus extern "C" { diff --git a/os/hal/ports/KINETIS/LLD/hal_pal_lld.h b/os/hal/ports/KINETIS/LLD/hal_pal_lld.h index 05749d5..833d95e 100644 --- a/os/hal/ports/KINETIS/LLD/hal_pal_lld.h +++ b/os/hal/ports/KINETIS/LLD/hal_pal_lld.h @@ -69,6 +69,11 @@ typedef uint32_t ioportmask_t; */ typedef uint32_t iomode_t; +/** + * @brief Type of an I/O line. + */ +typedef uint32_t ioline_t; + /** * @brief Port Identifier. * @details This type can be a scalar or some kind of pointer, do not make @@ -129,6 +134,38 @@ typedef struct { */ #define IOPORT5 GPIOE +/** + * @name Line handling macros + * @{ + */ +/** + * @brief Forms a line identifier. + * @details A port/pad pair are encoded into an @p ioline_t type. The encoding + * of this type is platform-dependent. + * @note In this driver the pad number is encoded in the byte of the GPIO + * address that's zero on all Kinetis devices. + */ +#define PAL_LINE(port, pad) \ + ((ioline_t)((uint32_t)(port) | ((uint32_t)(pad)<<20))) + +/** + * @brief Decodes a port identifier from a line identifier. + */ +#define PAL_PORT(line) \ + ((GPIO_TypeDef *)(((uint32_t)(line)) & 0xF00FFFFFU)) + +/** + * @brief Decodes a pad identifier from a line identifier. + */ +#define PAL_PAD(line) \ + ((uint32_t)((uint32_t)(line) & 0x0FF00000U)>>20) + +/** + * @brief Value identifying an invalid line. + */ +#define PAL_NOLINE 0U +/** @} */ + /*===========================================================================*/ /* Implementation, some of the following macros could be implemented as */ /* functions, if so please put them in pal_lld.c. */ diff --git a/testhal/KINETIS/FRDM-KL25Z/PWM/main.c b/testhal/KINETIS/FRDM-KL25Z/PWM/main.c index b7e873c..32d8020 100644 --- a/testhal/KINETIS/FRDM-KL25Z/PWM/main.c +++ b/testhal/KINETIS/FRDM-KL25Z/PWM/main.c @@ -99,17 +99,17 @@ int main(void) { /* * Turn off the RGB LED. */ - palSetPad(GPIO_LED_RED, PIN_LED_RED); /* red */ - palSetPad(GPIO_LED_GREEN, PIN_LED_GREEN); /* green */ - palSetPad(GPIO_LED_BLUE, PIN_LED_BLUE); /* blue */ + palSetLine(LINE_LED_RED); /* red */ + palSetLine(LINE_LED_GREEN); /* green */ + palSetLine(LINE_LED_BLUE); /* blue */ /* * Start the PWM driver, route TPM2 output to PTB18, PTB19. * Enable channels now to avoid a blink later. */ pwmStart(&PWM_DRIVER, &pwmcfg); - palSetPadMode(GPIO_LED_RED, PIN_LED_RED, PAL_MODE_ALTERNATIVE_3); - palSetPadMode(GPIO_LED_GREEN, PIN_LED_GREEN, PAL_MODE_ALTERNATIVE_3); + palSetLineMode(LINE_LED_RED, PAL_MODE_ALTERNATIVE_3); + palSetLineMode(LINE_LED_GREEN, PAL_MODE_ALTERNATIVE_3); pwmEnableChannel(&PWM_DRIVER, 0, 0); pwmEnableChannel(&PWM_DRIVER, 1, 0); diff --git a/testhal/KINETIS/FRDM-KL26Z/PWM/main.c b/testhal/KINETIS/FRDM-KL26Z/PWM/main.c index 9e41bf6..740471a 100644 --- a/testhal/KINETIS/FRDM-KL26Z/PWM/main.c +++ b/testhal/KINETIS/FRDM-KL26Z/PWM/main.c @@ -104,9 +104,9 @@ static THD_FUNCTION(ButtonThread, arg) { uint8_t newstate, state = PAL_HIGH; while(true) { - if(palReadPad(GPIO_BUTTON, PIN_BUTTON) != state) { + if(palReadLine(LINE_BUTTON) != state) { chThdSleepMilliseconds(20); /* debounce */ - newstate = palReadPad(GPIO_BUTTON, PIN_BUTTON); + newstate = palReadLine(LINE_BUTTON); if(newstate != state) { state = newstate; if(newstate == PAL_LOW) { @@ -135,9 +135,9 @@ int main(void) { /* * Turn off the RGB LED. */ - palSetPad(GPIO_LED_RED, PIN_LED_RED); /* red */ - palSetPad(GPIO_LED_GREEN, PIN_LED_GREEN); /* green */ - palSetPad(GPIO_LED_BLUE, PIN_LED_BLUE); /* blue */ + palSetLine(LINE_LED_RED); /* red */ + palSetLine(LINE_LED_GREEN); /* green */ + palSetLine(LINE_LED_BLUE); /* blue */ /* * Create the button check thread. @@ -149,9 +149,9 @@ int main(void) { * Enable channels now to avoid a blink later. */ pwmStart(&PWM_DRIVER, &pwmcfg); - palSetPadMode(GPIO_LED_RED, PIN_LED_RED, PAL_MODE_ALTERNATIVE_3); - palSetPadMode(GPIO_LED_GREEN, PIN_LED_GREEN, PAL_MODE_ALTERNATIVE_3); - palSetPadMode(GPIO_LED_BLUE, PIN_LED_BLUE, PAL_MODE_ALTERNATIVE_4); + palSetLineMode(LINE_LED_RED, PAL_MODE_ALTERNATIVE_3); + palSetLineMode(LINE_LED_GREEN, PAL_MODE_ALTERNATIVE_3); + palSetLineMode(LINE_LED_BLUE, PAL_MODE_ALTERNATIVE_4); pwmEnableChannel(&PWM_DRIVER, 2, 0); pwmEnableChannel(&PWM_DRIVER, 4, 0); pwmEnableChannel(&PWM_DRIVER, 5, 0); diff --git a/testhal/KINETIS/MCHCK/PWM/main.c b/testhal/KINETIS/MCHCK/PWM/main.c index 9ac569f..f92512e 100644 --- a/testhal/KINETIS/MCHCK/PWM/main.c +++ b/testhal/KINETIS/MCHCK/PWM/main.c @@ -19,12 +19,12 @@ static void pwmpcb(PWMDriver *pwmp) { (void)pwmp; - palSetPad(GPIOB, GPIOB_LED); + palSetLine(LINE_LED); } static void pwmc0cb(PWMDriver *pwmp) { (void)pwmp; - palClearPad(GPIOB, GPIOB_LED); + palClearLine(LINE_LED); } static PWMConfig pwmcfg = { diff --git a/testhal/KINETIS/TEENSY_LC/PWM/main.c b/testhal/KINETIS/TEENSY_LC/PWM/main.c index b366e9e..f8e6ba2 100644 --- a/testhal/KINETIS/TEENSY_LC/PWM/main.c +++ b/testhal/KINETIS/TEENSY_LC/PWM/main.c @@ -19,12 +19,12 @@ static void pwmpcb(PWMDriver *pwmp) { (void)pwmp; - palSetPad(TEENSY_PIN13_IOPORT, TEENSY_PIN13); + palSetLine(LINE_LED); } static void pwmc0cb(PWMDriver *pwmp) { (void)pwmp; - palClearPad(TEENSY_PIN13_IOPORT, TEENSY_PIN13); + palClearLine(LINE_LED); } static PWMConfig pwmcfg = { -- cgit v1.2.3