mirror of https://github.com/ARMmbed/mbed-os.git
				
				
				
			hal: astyle update
							parent
							
								
									d10e821272
								
							
						
					
					
						commit
						483427a285
					
				| 
						 | 
				
			
			@ -34,27 +34,33 @@ static inline void _gpio_init_out(gpio_t* gpio, PinName pin, PinMode mode, int v
 | 
			
		|||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void gpio_init_in(gpio_t* gpio, PinName pin) {
 | 
			
		||||
void gpio_init_in(gpio_t *gpio, PinName pin)
 | 
			
		||||
{
 | 
			
		||||
    gpio_init_in_ex(gpio, pin, PullDefault);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void gpio_init_in_ex(gpio_t* gpio, PinName pin, PinMode mode) {
 | 
			
		||||
void gpio_init_in_ex(gpio_t *gpio, PinName pin, PinMode mode)
 | 
			
		||||
{
 | 
			
		||||
    _gpio_init_in(gpio, pin, mode);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void gpio_init_out(gpio_t* gpio, PinName pin) {
 | 
			
		||||
void gpio_init_out(gpio_t *gpio, PinName pin)
 | 
			
		||||
{
 | 
			
		||||
    gpio_init_out_ex(gpio, pin, 0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void gpio_init_out_ex(gpio_t* gpio, PinName pin, int value) {
 | 
			
		||||
void gpio_init_out_ex(gpio_t *gpio, PinName pin, int value)
 | 
			
		||||
{
 | 
			
		||||
    _gpio_init_out(gpio, pin, PullNone, value);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void gpio_init_inout(gpio_t* gpio, PinName pin, PinDirection direction, PinMode mode, int value) {
 | 
			
		||||
void gpio_init_inout(gpio_t *gpio, PinName pin, PinDirection direction, PinMode mode, int value)
 | 
			
		||||
{
 | 
			
		||||
    if (direction == PIN_INPUT) {
 | 
			
		||||
        _gpio_init_in(gpio, pin, mode);
 | 
			
		||||
        if (pin != NC)
 | 
			
		||||
        if (pin != NC) {
 | 
			
		||||
            gpio_write(gpio, value);    // we prepare the value in case it is switched later
 | 
			
		||||
        }
 | 
			
		||||
    } else {
 | 
			
		||||
        _gpio_init_out(gpio, pin, mode, value);
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -70,8 +70,7 @@ uint32_t mbed_itm_send(uint32_t port, uint32_t data)
 | 
			
		|||
{
 | 
			
		||||
    /* Check if ITM and port is enabled */
 | 
			
		||||
    if (((ITM->TCR & ITM_TCR_ITMENA_Msk) != 0UL) &&      /* ITM enabled */
 | 
			
		||||
        ((ITM->TER & (1UL << port)     ) != 0UL)   )     /* ITM Port enabled */
 | 
			
		||||
    {
 | 
			
		||||
            ((ITM->TER & (1UL << port)) != 0UL)) {           /* ITM Port enabled */
 | 
			
		||||
        /* write data to port */
 | 
			
		||||
        ITM->PORT[port].u32 = data;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,9 +16,11 @@
 | 
			
		|||
#include "hal/pinmap.h"
 | 
			
		||||
#include "platform/mbed_error.h"
 | 
			
		||||
 | 
			
		||||
void pinmap_pinout(PinName pin, const PinMap *map) {
 | 
			
		||||
    if (pin == NC)
 | 
			
		||||
void pinmap_pinout(PinName pin, const PinMap *map)
 | 
			
		||||
{
 | 
			
		||||
    if (pin == NC) {
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    while (map->pin != NC) {
 | 
			
		||||
        if (map->pin == pin) {
 | 
			
		||||
| 
						 | 
				
			
			@ -32,58 +34,72 @@ void pinmap_pinout(PinName pin, const PinMap *map) {
 | 
			
		|||
    MBED_ERROR1(MBED_MAKE_ERROR(MBED_MODULE_PLATFORM, MBED_ERROR_CODE_PINMAP_INVALID), "could not pinout", pin);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint32_t pinmap_merge(uint32_t a, uint32_t b) {
 | 
			
		||||
uint32_t pinmap_merge(uint32_t a, uint32_t b)
 | 
			
		||||
{
 | 
			
		||||
    // both are the same (inc both NC)
 | 
			
		||||
    if (a == b)
 | 
			
		||||
    if (a == b) {
 | 
			
		||||
        return a;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // one (or both) is not connected
 | 
			
		||||
    if (a == (uint32_t)NC)
 | 
			
		||||
    if (a == (uint32_t)NC) {
 | 
			
		||||
        return b;
 | 
			
		||||
    if (b == (uint32_t)NC)
 | 
			
		||||
    }
 | 
			
		||||
    if (b == (uint32_t)NC) {
 | 
			
		||||
        return a;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // mis-match error case
 | 
			
		||||
    MBED_ERROR1(MBED_MAKE_ERROR(MBED_MODULE_PLATFORM, MBED_ERROR_CODE_PINMAP_INVALID), "pinmap mis-match", a);
 | 
			
		||||
    return (uint32_t)NC;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint32_t pinmap_find_peripheral(PinName pin, const PinMap* map) {
 | 
			
		||||
uint32_t pinmap_find_peripheral(PinName pin, const PinMap *map)
 | 
			
		||||
{
 | 
			
		||||
    while (map->pin != NC) {
 | 
			
		||||
        if (map->pin == pin)
 | 
			
		||||
        if (map->pin == pin) {
 | 
			
		||||
            return map->peripheral;
 | 
			
		||||
        }
 | 
			
		||||
        map++;
 | 
			
		||||
    }
 | 
			
		||||
    return (uint32_t)NC;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint32_t pinmap_peripheral(PinName pin, const PinMap* map) {
 | 
			
		||||
uint32_t pinmap_peripheral(PinName pin, const PinMap *map)
 | 
			
		||||
{
 | 
			
		||||
    uint32_t peripheral = (uint32_t)NC;
 | 
			
		||||
 | 
			
		||||
    if (pin == (PinName)NC)
 | 
			
		||||
    if (pin == (PinName)NC) {
 | 
			
		||||
        return (uint32_t)NC;
 | 
			
		||||
    }
 | 
			
		||||
    peripheral = pinmap_find_peripheral(pin, map);
 | 
			
		||||
    if ((uint32_t)NC == peripheral) // no mapping available
 | 
			
		||||
    if ((uint32_t)NC == peripheral) { // no mapping available
 | 
			
		||||
        MBED_ERROR1(MBED_MAKE_ERROR(MBED_MODULE_PLATFORM, MBED_ERROR_CODE_PINMAP_INVALID), "pinmap not found for peripheral", peripheral);
 | 
			
		||||
    }
 | 
			
		||||
    return peripheral;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint32_t pinmap_find_function(PinName pin, const PinMap* map) {
 | 
			
		||||
uint32_t pinmap_find_function(PinName pin, const PinMap *map)
 | 
			
		||||
{
 | 
			
		||||
    while (map->pin != NC) {
 | 
			
		||||
        if (map->pin == pin)
 | 
			
		||||
        if (map->pin == pin) {
 | 
			
		||||
            return map->function;
 | 
			
		||||
        }
 | 
			
		||||
        map++;
 | 
			
		||||
    }
 | 
			
		||||
    return (uint32_t)NC;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint32_t pinmap_function(PinName pin, const PinMap* map) {
 | 
			
		||||
uint32_t pinmap_function(PinName pin, const PinMap *map)
 | 
			
		||||
{
 | 
			
		||||
    uint32_t function = (uint32_t)NC;
 | 
			
		||||
 | 
			
		||||
    if (pin == (PinName)NC)
 | 
			
		||||
    if (pin == (PinName)NC) {
 | 
			
		||||
        return (uint32_t)NC;
 | 
			
		||||
    }
 | 
			
		||||
    function = pinmap_find_function(pin, map);
 | 
			
		||||
    if ((uint32_t)NC == function) // no mapping available
 | 
			
		||||
    if ((uint32_t)NC == function) { // no mapping available
 | 
			
		||||
        MBED_ERROR1(MBED_MAKE_ERROR(MBED_MODULE_PLATFORM, MBED_ERROR_CODE_PINMAP_INVALID), "pinmap not found for function", function);
 | 
			
		||||
    }
 | 
			
		||||
    return function;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue