mirror of https://github.com/ARMmbed/mbed-os.git
Typo corrections
parent
ae20d141c5
commit
4ad143ae95
|
@ -42,15 +42,13 @@ uint32_t gpio_set(PinName pin) {
|
|||
}
|
||||
|
||||
void gpio_init(gpio_t *obj, PinName pin, PinDirection direction) {
|
||||
GPIO_TypeDef *gpio;
|
||||
|
||||
if (pin == NC) return;
|
||||
|
||||
uint32_t port_index = STM_PORT(pin);
|
||||
|
||||
// Enable GPIO clock
|
||||
uint32_t gpio_add = Set_GPIO_Clock(port_index);
|
||||
gpio = (GPIO_TypeDef *)gpio_add;
|
||||
GPIO_TypeDef *gpio = (GPIO_TypeDef *)gpio_add;
|
||||
|
||||
// Fill GPIO object structure for future use
|
||||
obj->pin = pin;
|
||||
|
|
|
@ -48,7 +48,6 @@ static uint32_t channel_pin[CHANNEL_NUM] = {0, 0, 0};
|
|||
static gpio_irq_handler irq_handler;
|
||||
|
||||
static void handle_interrupt_in(uint32_t irq_index) {
|
||||
|
||||
// Retrieve the gpio and pin that generate the irq
|
||||
GPIO_TypeDef *gpio = (GPIO_TypeDef *)(channel_gpio[irq_index]);
|
||||
uint32_t pin = (uint32_t)(1 << channel_pin[irq_index]);
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include "pinmap.h"
|
||||
#include "error.h"
|
||||
|
||||
// Not an API function
|
||||
// Enable GPIO clock and return GPIO base address
|
||||
uint32_t Set_GPIO_Clock(uint32_t port_idx) {
|
||||
uint32_t gpio_add = 0;
|
||||
|
@ -66,9 +65,6 @@ uint32_t Set_GPIO_Clock(uint32_t port_idx) {
|
|||
* Configure pin (mode, speed, output type and pull-up/pull-down)
|
||||
*/
|
||||
void pin_function(PinName pin, int data) {
|
||||
GPIO_TypeDef *gpio;
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
|
||||
if (pin == NC) return;
|
||||
|
||||
// Get the pin informations
|
||||
|
@ -82,7 +78,7 @@ void pin_function(PinName pin, int data) {
|
|||
|
||||
// Enable GPIO clock
|
||||
uint32_t gpio_add = Set_GPIO_Clock(port_index);
|
||||
gpio = (GPIO_TypeDef *)gpio_add;
|
||||
GPIO_TypeDef *gpio = (GPIO_TypeDef *)gpio_add;
|
||||
|
||||
// Configure Alternate Function
|
||||
// Warning: Must be done before the GPIO is initialized
|
||||
|
@ -91,6 +87,7 @@ void pin_function(PinName pin, int data) {
|
|||
}
|
||||
|
||||
// Configure GPIO
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
GPIO_InitStructure.GPIO_Pin = (uint16_t)(1 << pin_index);
|
||||
GPIO_InitStructure.GPIO_Mode = (GPIOMode_TypeDef)mode;
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_Level_3;
|
||||
|
@ -113,8 +110,6 @@ void pin_function(PinName pin, int data) {
|
|||
* Configure pin pull-up/pull-down
|
||||
*/
|
||||
void pin_mode(PinName pin, PinMode mode) {
|
||||
GPIO_TypeDef *gpio;
|
||||
|
||||
if (pin == NC) return;
|
||||
|
||||
uint32_t port_index = STM_PORT(pin);
|
||||
|
@ -122,7 +117,7 @@ void pin_mode(PinName pin, PinMode mode) {
|
|||
|
||||
// Enable GPIO clock
|
||||
uint32_t gpio_add = Set_GPIO_Clock(port_index);
|
||||
gpio = (GPIO_TypeDef *)gpio_add;
|
||||
GPIO_TypeDef *gpio = (GPIO_TypeDef *)gpio_add;
|
||||
|
||||
// Configure pull-up/pull-down resistors
|
||||
uint32_t pupd = (uint32_t)mode;
|
||||
|
|
|
@ -43,13 +43,11 @@ PinName port_pin(PortName port, int pin_n) {
|
|||
}
|
||||
|
||||
void port_init(port_t *obj, PortName port, int mask, PinDirection dir) {
|
||||
GPIO_TypeDef *gpio;
|
||||
|
||||
uint32_t port_index = (uint32_t)port; // (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, ...)
|
||||
uint32_t port_index = (uint32_t)port;
|
||||
|
||||
// Enable GPIO clock
|
||||
uint32_t gpio_add = Set_GPIO_Clock(port_index);
|
||||
gpio = (GPIO_TypeDef *)gpio_add;
|
||||
GPIO_TypeDef *gpio = (GPIO_TypeDef *)gpio_add;
|
||||
|
||||
// Fill PORT object structure for future use
|
||||
obj->port = port;
|
||||
|
|
|
@ -38,7 +38,7 @@ void sleep(void)
|
|||
SCB->SCR = 0; // Normal sleep mode for ARM core
|
||||
__WFI();
|
||||
|
||||
// Re-ensable us_ticker update interrupt
|
||||
// Re-enable us_ticker update interrupt
|
||||
TIM_ITConfig(TIM1, TIM_IT_Update, ENABLE);
|
||||
}
|
||||
|
||||
|
|
|
@ -42,22 +42,20 @@ uint32_t gpio_set(PinName pin) {
|
|||
}
|
||||
|
||||
void gpio_init(gpio_t *obj, PinName pin, PinDirection direction) {
|
||||
GPIO_TypeDef *gpio;
|
||||
|
||||
if (pin == NC) return;
|
||||
|
||||
uint32_t port_index = STM_PORT(pin);
|
||||
|
||||
// Enable GPIO clock
|
||||
uint32_t gpio_add = Set_GPIO_Clock(port_index);
|
||||
gpio = (GPIO_TypeDef *)gpio_add;
|
||||
GPIO_TypeDef *gpio = (GPIO_TypeDef *)gpio_add;
|
||||
|
||||
// Fill GPIO object structure for future use
|
||||
obj->pin = pin;
|
||||
obj->mask = gpio_set(pin);
|
||||
obj->reg_in = &gpio->IDR;
|
||||
obj->reg_set = &gpio->BSRR;
|
||||
obj->reg_clr = &gpio->BRR;
|
||||
obj->reg_clr = &gpio->BRR;
|
||||
|
||||
// Configure GPIO
|
||||
if (direction == PIN_OUTPUT) {
|
||||
|
|
|
@ -48,7 +48,6 @@ static uint32_t channel_pin[CHANNEL_NUM] = {0, 0, 0, 0};
|
|||
static gpio_irq_handler irq_handler;
|
||||
|
||||
static void handle_interrupt_in(uint32_t irq_index) {
|
||||
|
||||
// Retrieve the gpio and pin that generate the irq
|
||||
GPIO_TypeDef *gpio = (GPIO_TypeDef *)(channel_gpio[irq_index]);
|
||||
uint32_t pin = (uint32_t)(1 << channel_pin[irq_index]);
|
||||
|
|
|
@ -43,7 +43,6 @@ static const uint32_t AF_mapping[] = {
|
|||
GPIO_Remap_I2C1 // 8
|
||||
};
|
||||
|
||||
// Not an API function
|
||||
// Enable GPIO clock and return GPIO base address
|
||||
uint32_t Set_GPIO_Clock(uint32_t port_idx) {
|
||||
uint32_t gpio_add = 0;
|
||||
|
@ -75,9 +74,6 @@ uint32_t Set_GPIO_Clock(uint32_t port_idx) {
|
|||
* Configure pin (input, output, alternate function or analog) + output speed + AF
|
||||
*/
|
||||
void pin_function(PinName pin, int data) {
|
||||
GPIO_TypeDef *gpio;
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
|
||||
if (pin == NC) return;
|
||||
|
||||
// Get the pin informations
|
||||
|
@ -89,7 +85,7 @@ void pin_function(PinName pin, int data) {
|
|||
|
||||
// Enable GPIO clock
|
||||
uint32_t gpio_add = Set_GPIO_Clock(port_index);
|
||||
gpio = (GPIO_TypeDef *)gpio_add;
|
||||
GPIO_TypeDef *gpio = (GPIO_TypeDef *)gpio_add;
|
||||
|
||||
// Enable AFIO clock
|
||||
RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE);
|
||||
|
@ -101,6 +97,7 @@ void pin_function(PinName pin, int data) {
|
|||
}
|
||||
|
||||
// Configure GPIO
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
GPIO_InitStructure.GPIO_Pin = (uint16_t)(1 << pin_index);
|
||||
GPIO_InitStructure.GPIO_Mode = (GPIOMode_TypeDef)mode;
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
|
||||
|
@ -120,9 +117,8 @@ void pin_function(PinName pin, int data) {
|
|||
* Configure pin pull-up/pull-down
|
||||
*/
|
||||
void pin_mode(PinName pin, PinMode mode) {
|
||||
GPIO_TypeDef *gpio;
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
|
||||
|
||||
if (pin == NC) return;
|
||||
|
||||
uint32_t port_index = STM_PORT(pin);
|
||||
|
@ -130,7 +126,7 @@ void pin_mode(PinName pin, PinMode mode) {
|
|||
|
||||
// Enable GPIO clock
|
||||
uint32_t gpio_add = Set_GPIO_Clock(port_index);
|
||||
gpio = (GPIO_TypeDef *)gpio_add;
|
||||
GPIO_TypeDef *gpio = (GPIO_TypeDef *)gpio_add;
|
||||
|
||||
// Configure open-drain and pull-up/down
|
||||
switch (mode) {
|
||||
|
|
|
@ -43,13 +43,11 @@ PinName port_pin(PortName port, int pin_n) {
|
|||
}
|
||||
|
||||
void port_init(port_t *obj, PortName port, int mask, PinDirection dir) {
|
||||
GPIO_TypeDef *gpio;
|
||||
|
||||
uint32_t port_index = (uint32_t)port; // (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, ...)
|
||||
uint32_t port_index = (uint32_t)port;
|
||||
|
||||
// Enable GPIO clock
|
||||
uint32_t gpio_add = Set_GPIO_Clock(port_index);
|
||||
gpio = (GPIO_TypeDef *)gpio_add;
|
||||
GPIO_TypeDef *gpio = (GPIO_TypeDef *)gpio_add;
|
||||
|
||||
// Fill PORT object structure for future use
|
||||
obj->port = port;
|
||||
|
|
|
@ -38,7 +38,7 @@ void sleep(void)
|
|||
SCB->SCR = 0; // Normal sleep mode for ARM core
|
||||
__WFI();
|
||||
|
||||
// Re-ensable us_ticker update interrupt
|
||||
// Re-enable us_ticker update interrupt
|
||||
TIM_ITConfig(TIM1, TIM_IT_Update, ENABLE);
|
||||
}
|
||||
|
||||
|
@ -53,6 +53,6 @@ void deepsleep(void)
|
|||
// Request to enter STOP mode with regulator in low power mode
|
||||
PWR_EnterSTOPMode(PWR_Regulator_LowPower, PWR_STOPEntry_WFI);
|
||||
|
||||
// Re-ensable us_ticker update interrupt
|
||||
// Re-enable us_ticker update interrupt
|
||||
TIM_ITConfig(TIM1, TIM_IT_Update, ENABLE);
|
||||
}
|
||||
|
|
|
@ -42,15 +42,13 @@ uint32_t gpio_set(PinName pin) {
|
|||
}
|
||||
|
||||
void gpio_init(gpio_t *obj, PinName pin, PinDirection direction) {
|
||||
GPIO_TypeDef *gpio;
|
||||
|
||||
if (pin == NC) return;
|
||||
|
||||
uint32_t port_index = STM_PORT(pin);
|
||||
|
||||
// Enable GPIO clock
|
||||
uint32_t gpio_add = Set_GPIO_Clock(port_index);
|
||||
gpio = (GPIO_TypeDef *)gpio_add;
|
||||
GPIO_TypeDef *gpio = (GPIO_TypeDef *)gpio_add;
|
||||
|
||||
// Fill GPIO object structure for future use
|
||||
obj->pin = pin;
|
||||
|
|
|
@ -48,7 +48,6 @@ static uint32_t channel_pin[CHANNEL_NUM] = {0, 0, 0, 0};
|
|||
static gpio_irq_handler irq_handler;
|
||||
|
||||
static void handle_interrupt_in(uint32_t irq_index) {
|
||||
|
||||
// Retrieve the gpio and pin that generate the irq
|
||||
GPIO_TypeDef *gpio = (GPIO_TypeDef *)(channel_gpio[irq_index]);
|
||||
uint32_t pin = (uint32_t)(1 << channel_pin[irq_index]);
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include "pinmap.h"
|
||||
#include "error.h"
|
||||
|
||||
// Not an API function
|
||||
// Enable GPIO clock and return GPIO base address
|
||||
uint32_t Set_GPIO_Clock(uint32_t port_idx) {
|
||||
uint32_t gpio_add = 0;
|
||||
|
@ -66,9 +65,6 @@ uint32_t Set_GPIO_Clock(uint32_t port_idx) {
|
|||
* Configure pin (mode, speed, output type and pull-up/pull-down)
|
||||
*/
|
||||
void pin_function(PinName pin, int data) {
|
||||
GPIO_TypeDef *gpio;
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
|
||||
if (pin == NC) return;
|
||||
|
||||
// Get the pin informations
|
||||
|
@ -82,7 +78,7 @@ void pin_function(PinName pin, int data) {
|
|||
|
||||
// Enable GPIO clock
|
||||
uint32_t gpio_add = Set_GPIO_Clock(port_index);
|
||||
gpio = (GPIO_TypeDef *)gpio_add;
|
||||
GPIO_TypeDef *gpio = (GPIO_TypeDef *)gpio_add;
|
||||
|
||||
// Configure Alternate Function
|
||||
// Warning: Must be done before the GPIO is initialized
|
||||
|
@ -91,6 +87,7 @@ void pin_function(PinName pin, int data) {
|
|||
}
|
||||
|
||||
// Configure GPIO
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
GPIO_InitStructure.GPIO_Pin = (uint16_t)(1 << pin_index);
|
||||
GPIO_InitStructure.GPIO_Mode = (GPIOMode_TypeDef)mode;
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_40MHz;
|
||||
|
@ -113,8 +110,6 @@ void pin_function(PinName pin, int data) {
|
|||
* Configure pin pull-up/pull-down
|
||||
*/
|
||||
void pin_mode(PinName pin, PinMode mode) {
|
||||
GPIO_TypeDef *gpio;
|
||||
|
||||
if (pin == NC) return;
|
||||
|
||||
uint32_t port_index = STM_PORT(pin);
|
||||
|
@ -122,7 +117,7 @@ void pin_mode(PinName pin, PinMode mode) {
|
|||
|
||||
// Enable GPIO clock
|
||||
uint32_t gpio_add = Set_GPIO_Clock(port_index);
|
||||
gpio = (GPIO_TypeDef *)gpio_add;
|
||||
GPIO_TypeDef *gpio = (GPIO_TypeDef *)gpio_add;
|
||||
|
||||
// Configure pull-up/pull-down resistors
|
||||
uint32_t pupd = (uint32_t)mode;
|
||||
|
|
|
@ -43,13 +43,11 @@ PinName port_pin(PortName port, int pin_n) {
|
|||
}
|
||||
|
||||
void port_init(port_t *obj, PortName port, int mask, PinDirection dir) {
|
||||
GPIO_TypeDef *gpio;
|
||||
|
||||
uint32_t port_index = (uint32_t)port; // (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, ...)
|
||||
uint32_t port_index = (uint32_t)port;
|
||||
|
||||
// Enable GPIO clock
|
||||
uint32_t gpio_add = Set_GPIO_Clock(port_index);
|
||||
gpio = (GPIO_TypeDef *)gpio_add;
|
||||
GPIO_TypeDef *gpio = (GPIO_TypeDef *)gpio_add;
|
||||
|
||||
// Fill PORT object structure for future use
|
||||
obj->port = port;
|
||||
|
|
|
@ -111,7 +111,7 @@ void sleep(void)
|
|||
// Request to enter SLEEP mode with regulator ON
|
||||
PWR_EnterSleepMode(PWR_Regulator_ON, PWR_SLEEPEntry_WFI);
|
||||
|
||||
// Re-ensable us_ticker update interrupt
|
||||
// Re-enable us_ticker update interrupt
|
||||
TIM_ITConfig(TIM9, TIM_IT_Update, ENABLE);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue