mirror of https://github.com/ARMmbed/mbed-os.git
mbed common - trailing white spaces removal
parent
97199bb372
commit
9017b27778
|
@ -13,19 +13,19 @@ namespace mbed {
|
|||
* @code
|
||||
* #include "InterruptManager.h"
|
||||
* #include "mbed.h"
|
||||
*
|
||||
*
|
||||
* Ticker flipper;
|
||||
* DigitalOut led1(LED1);
|
||||
* DigitalOut led2(LED2);
|
||||
*
|
||||
*
|
||||
* void flip(void) {
|
||||
* led1 = !led1;
|
||||
* }
|
||||
*
|
||||
*
|
||||
* void handler(void) {
|
||||
* led2 = !led1;
|
||||
* }
|
||||
*
|
||||
*
|
||||
* int main() {
|
||||
* led1 = led2 = 0;
|
||||
* flipper.attach(&flip, 1.0);
|
||||
|
@ -42,7 +42,7 @@ public:
|
|||
/** Destroy the current instance of the interrupt manager
|
||||
*/
|
||||
static void destroy();
|
||||
|
||||
|
||||
/** Add a handler for an interrupt at the end of the handler list
|
||||
*
|
||||
* @param function the handler to add
|
||||
|
|
|
@ -58,7 +58,7 @@ pFunctionPointer_t InterruptManager::add_common(void (*function)(void), IRQn_Typ
|
|||
|
||||
bool InterruptManager::remove_handler(pFunctionPointer_t handler, IRQn_Type irq) {
|
||||
int irq_pos = get_irq_index(irq);
|
||||
|
||||
|
||||
if (NULL == _chains[irq_pos])
|
||||
return false;
|
||||
if (!_chains[irq_pos]->remove(handler))
|
||||
|
|
|
@ -30,7 +30,7 @@ WEAK void mbed_die(void) {
|
|||
gpio_t led_3; gpio_init_out(&led_3, LED3);
|
||||
gpio_t led_4; gpio_init_out(&led_4, LED4);
|
||||
#endif
|
||||
|
||||
|
||||
while (1) {
|
||||
#if (DEVICE_ERROR_RED == 1)
|
||||
gpio_write(&led_red, 1);
|
||||
|
@ -41,7 +41,7 @@ WEAK void mbed_die(void) {
|
|||
gpio_write(&led_3, 0);
|
||||
gpio_write(&led_4, 1);
|
||||
#endif
|
||||
|
||||
|
||||
wait_ms(150);
|
||||
|
||||
#if (DEVICE_ERROR_RED == 1)
|
||||
|
@ -53,7 +53,7 @@ WEAK void mbed_die(void) {
|
|||
gpio_write(&led_3, 1);
|
||||
gpio_write(&led_4, 0);
|
||||
#endif
|
||||
|
||||
|
||||
wait_ms(150);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,13 +17,13 @@
|
|||
|
||||
static inline void _gpio_init_in(gpio_t* gpio, PinName pin, PinMode mode)
|
||||
{
|
||||
gpio_init(gpio, pin);
|
||||
if (pin != NC) {
|
||||
gpio_init(gpio, pin);
|
||||
if (pin != NC) {
|
||||
gpio_dir(gpio, PIN_INPUT);
|
||||
gpio_mode(gpio, mode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static inline void _gpio_init_out(gpio_t* gpio, PinName pin, PinMode mode, int value)
|
||||
{
|
||||
gpio_init(gpio, pin);
|
||||
|
|
|
@ -88,7 +88,7 @@ WEAK void mbed_mac_address(char *mac) {
|
|||
#if DEVICE_SEMIHOST
|
||||
char uid[DEVICE_ID_LENGTH + 1];
|
||||
int i;
|
||||
|
||||
|
||||
// if we have a UID, extract the MAC
|
||||
if (mbed_interface_uid(uid) == 0) {
|
||||
char *p = uid;
|
||||
|
|
|
@ -22,7 +22,7 @@ void pinmap_pinout(PinName pin, const PinMap *map) {
|
|||
while (map->pin != NC) {
|
||||
if (map->pin == pin) {
|
||||
pin_function(pin, map->function);
|
||||
|
||||
|
||||
pin_mode(pin, PullNone);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -126,7 +126,7 @@ extern "C" FILEHANDLE PREFIX(_open)(const char* name, int openmode) {
|
|||
// This is the workaround that the microlib author suggested us
|
||||
static int n = 0;
|
||||
if (!std::strcmp(name, ":tt")) return n++;
|
||||
|
||||
|
||||
#else
|
||||
/* Use the posix convention that stdin,out,err are filehandles 0,1,2.
|
||||
*/
|
||||
|
@ -141,7 +141,7 @@ extern "C" FILEHANDLE PREFIX(_open)(const char* name, int openmode) {
|
|||
return 2;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// find the first empty slot in filehandles
|
||||
unsigned int fh_i;
|
||||
for (fh_i = 0; fh_i < sizeof(filehandles)/sizeof(*filehandles); fh_i++) {
|
||||
|
@ -466,7 +466,7 @@ extern "C" caddr_t _sbrk(int incr) {
|
|||
errno = ENOMEM;
|
||||
return (caddr_t)-1;
|
||||
}
|
||||
|
||||
|
||||
heap = new_heap;
|
||||
return (caddr_t) prev_heap;
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
#if defined (__ICCARM__)
|
||||
time_t __time32(time_t *timer)
|
||||
#else
|
||||
|
@ -60,4 +60,4 @@ clock_t clock() {
|
|||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -22,13 +22,13 @@ static ticker_event_t *head = NULL;
|
|||
|
||||
void us_ticker_set_handler(ticker_event_handler handler) {
|
||||
us_ticker_init();
|
||||
|
||||
|
||||
event_handler = handler;
|
||||
}
|
||||
|
||||
void us_ticker_irq_handler(void) {
|
||||
us_ticker_clear_interrupt();
|
||||
|
||||
|
||||
/* Go through all the pending TimerEvents */
|
||||
while (1) {
|
||||
if (head == NULL) {
|
||||
|
@ -36,7 +36,7 @@ void us_ticker_irq_handler(void) {
|
|||
us_ticker_disable_interrupt();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if ((int)(head->timestamp - us_ticker_read()) <= 0) {
|
||||
// This event was in the past:
|
||||
// point to the following one and execute its handler
|
||||
|
@ -57,11 +57,11 @@ void us_ticker_irq_handler(void) {
|
|||
void us_ticker_insert_event(ticker_event_t *obj, unsigned int timestamp, uint32_t id) {
|
||||
/* disable interrupts for the duration of the function */
|
||||
__disable_irq();
|
||||
|
||||
|
||||
// initialise our data
|
||||
obj->timestamp = timestamp;
|
||||
obj->id = id;
|
||||
|
||||
|
||||
/* Go through the list until we either reach the end, or find
|
||||
an element this should come before (which is possibly the
|
||||
head). */
|
||||
|
@ -84,13 +84,13 @@ void us_ticker_insert_event(ticker_event_t *obj, unsigned int timestamp, uint32_
|
|||
}
|
||||
/* if we're at the end p will be NULL, which is correct */
|
||||
obj->next = p;
|
||||
|
||||
|
||||
__enable_irq();
|
||||
}
|
||||
|
||||
void us_ticker_remove_event(ticker_event_t *obj) {
|
||||
__disable_irq();
|
||||
|
||||
|
||||
// remove this object from the list
|
||||
if (head == obj) {
|
||||
// first in the list, so just drop me
|
||||
|
@ -109,6 +109,6 @@ void us_ticker_remove_event(ticker_event_t *obj) {
|
|||
p = p->next;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
__enable_irq();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue