mirror of https://github.com/ARMmbed/mbed-os.git
added '\n' to error("") calls for all freescale targets and common source
parent
52d2d49900
commit
e20949093c
|
@ -37,7 +37,7 @@
|
||||||
* To generate a fatal run-time error, you can use the mbed error() function.
|
* To generate a fatal run-time error, you can use the mbed error() function.
|
||||||
*
|
*
|
||||||
* @code
|
* @code
|
||||||
* error("That shouldn't have happened!");
|
* error("That shouldn't have happened!\n");
|
||||||
* @endcode
|
* @endcode
|
||||||
*
|
*
|
||||||
* If the mbed running the program executes this function, it will print the
|
* If the mbed running the program executes this function, it will print the
|
||||||
|
@ -48,7 +48,7 @@
|
||||||
*
|
*
|
||||||
* @code
|
* @code
|
||||||
* if(x >= 5) {
|
* if(x >= 5) {
|
||||||
* error("expected x to be less than 5, but got %d", x);
|
* error("expected x to be less than 5, but got %d\n", x);
|
||||||
* }
|
* }
|
||||||
* #endcode
|
* #endcode
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -28,7 +28,7 @@ void pinmap_pinout(PinName pin, const PinMap *map) {
|
||||||
}
|
}
|
||||||
map++;
|
map++;
|
||||||
}
|
}
|
||||||
error("could not pinout");
|
error("could not pinout\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t pinmap_merge(uint32_t a, uint32_t b) {
|
uint32_t pinmap_merge(uint32_t a, uint32_t b) {
|
||||||
|
@ -40,7 +40,7 @@ uint32_t pinmap_merge(uint32_t a, uint32_t b) {
|
||||||
if (b == (uint32_t)NC) return a;
|
if (b == (uint32_t)NC) return a;
|
||||||
|
|
||||||
// mis-match error case
|
// mis-match error case
|
||||||
error("pinmap mis-match");
|
error("pinmap mis-match\n");
|
||||||
return (uint32_t)NC;
|
return (uint32_t)NC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,6 +60,6 @@ uint32_t pinmap_peripheral(PinName pin, const PinMap* map) {
|
||||||
return (uint32_t)NC;
|
return (uint32_t)NC;
|
||||||
peripheral = pinmap_find_peripheral(pin, map);
|
peripheral = pinmap_find_peripheral(pin, map);
|
||||||
if ((uint32_t)NC == peripheral) // no mapping available
|
if ((uint32_t)NC == peripheral) // no mapping available
|
||||||
error("pinmap not found for peripheral");
|
error("pinmap not found for peripheral\n");
|
||||||
return peripheral;
|
return peripheral;
|
||||||
}
|
}
|
||||||
|
|
|
@ -386,7 +386,7 @@ extern "C" int mkdir(const char *path, mode_t mode) {
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
namespace __gnu_cxx {
|
namespace __gnu_cxx {
|
||||||
void __verbose_terminate_handler() {
|
void __verbose_terminate_handler() {
|
||||||
error("Exception");
|
error("Exception\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
extern "C" WEAK void __cxa_pure_virtual(void);
|
extern "C" WEAK void __cxa_pure_virtual(void);
|
||||||
|
|
|
@ -39,7 +39,7 @@ static const PinMap PinMap_ADC[] = {
|
||||||
void analogin_init(analogin_t *obj, PinName pin) {
|
void analogin_init(analogin_t *obj, PinName pin) {
|
||||||
obj->adc = (ADCName)pinmap_peripheral(pin, PinMap_ADC);
|
obj->adc = (ADCName)pinmap_peripheral(pin, PinMap_ADC);
|
||||||
if (obj->adc == (ADCName)NC)
|
if (obj->adc == (ADCName)NC)
|
||||||
error("ADC pin mapping failed");
|
error("ADC pin mapping failed\n");
|
||||||
|
|
||||||
SIM->SCGC6 |= SIM_SCGC6_ADC0_MASK;
|
SIM->SCGC6 |= SIM_SCGC6_ADC0_MASK;
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ void i2c_init(i2c_t *obj, PinName sda, PinName scl) {
|
||||||
I2CName i2c_scl = (I2CName)pinmap_peripheral(scl, PinMap_I2C_SCL);
|
I2CName i2c_scl = (I2CName)pinmap_peripheral(scl, PinMap_I2C_SCL);
|
||||||
obj->i2c = (I2C_Type*)pinmap_merge(i2c_sda, i2c_scl);
|
obj->i2c = (I2C_Type*)pinmap_merge(i2c_sda, i2c_scl);
|
||||||
if ((int)obj->i2c == NC)
|
if ((int)obj->i2c == NC)
|
||||||
error("I2C pin mapping failed");
|
error("I2C pin mapping failed\n");
|
||||||
|
|
||||||
SIM->SCGC4 |= SIM_SCGC4_I2C0_MASK;
|
SIM->SCGC4 |= SIM_SCGC4_I2C0_MASK;
|
||||||
SIM->SCGC5 |= SIM_SCGC5_PORTB_MASK;
|
SIM->SCGC5 |= SIM_SCGC5_PORTB_MASK;
|
||||||
|
|
|
@ -54,7 +54,7 @@ void pwmout_init(pwmout_t* obj, PinName pin) {
|
||||||
// determine the channel
|
// determine the channel
|
||||||
PWMName pwm = (PWMName)pinmap_peripheral(pin, PinMap_PWM);
|
PWMName pwm = (PWMName)pinmap_peripheral(pin, PinMap_PWM);
|
||||||
if (pwm == (PWMName)NC)
|
if (pwm == (PWMName)NC)
|
||||||
error("PwmOut pin mapping failed");
|
error("PwmOut pin mapping failed\n");
|
||||||
|
|
||||||
uint32_t clkdiv = 0;
|
uint32_t clkdiv = 0;
|
||||||
float clkval = SystemCoreClock / 1000000.0f;
|
float clkval = SystemCoreClock / 1000000.0f;
|
||||||
|
|
|
@ -48,7 +48,7 @@ void serial_init(serial_t *obj, PinName tx, PinName rx) {
|
||||||
UARTName uart_rx = (UARTName)pinmap_peripheral(rx, PinMap_UART_RX);
|
UARTName uart_rx = (UARTName)pinmap_peripheral(rx, PinMap_UART_RX);
|
||||||
UARTName uart = (UARTName)pinmap_merge(uart_tx, uart_rx);
|
UARTName uart = (UARTName)pinmap_merge(uart_tx, uart_rx);
|
||||||
if ((int)uart == NC)
|
if ((int)uart == NC)
|
||||||
error("Serial pinout mapping failed");
|
error("Serial pinout mapping failed\n");
|
||||||
|
|
||||||
obj->uart = (UART_Type *)uart;
|
obj->uart = (UART_Type *)uart;
|
||||||
// enable clk
|
// enable clk
|
||||||
|
@ -126,7 +126,7 @@ void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_b
|
||||||
|
|
||||||
// 8 data bits = 0 ... 9 data bits = 1
|
// 8 data bits = 0 ... 9 data bits = 1
|
||||||
if ((data_bits < 8) || (data_bits > 9))
|
if ((data_bits < 8) || (data_bits > 9))
|
||||||
error("Invalid number of bits (%d) in serial format, should be 8..9\r\n", data_bits);
|
error("Invalid number of bits (%d) in serial format, should be 8..9\n", data_bits);
|
||||||
|
|
||||||
data_bits -= 8;
|
data_bits -= 8;
|
||||||
|
|
||||||
|
@ -136,13 +136,13 @@ void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_b
|
||||||
case ParityOdd : parity_enable = 1; parity_select = 1; data_bits++; break;
|
case ParityOdd : parity_enable = 1; parity_select = 1; data_bits++; break;
|
||||||
case ParityEven: parity_enable = 1; parity_select = 0; data_bits++; break;
|
case ParityEven: parity_enable = 1; parity_select = 0; data_bits++; break;
|
||||||
default:
|
default:
|
||||||
error("Invalid serial parity setting\r\n");
|
error("Invalid serial parity setting\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1 stop bits = 0, 2 stop bits = 1
|
// 1 stop bits = 0, 2 stop bits = 1
|
||||||
if ((stop_bits != 1) && (stop_bits != 2))
|
if ((stop_bits != 1) && (stop_bits != 2))
|
||||||
error("Invalid stop bits specified\r\n");
|
error("Invalid stop bits specified\n");
|
||||||
stop_bits -= 1;
|
stop_bits -= 1;
|
||||||
|
|
||||||
uint32_t m10 = 0;
|
uint32_t m10 = 0;
|
||||||
|
@ -151,7 +151,7 @@ void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_b
|
||||||
if (data_bits == 2) {
|
if (data_bits == 2) {
|
||||||
// only uart0 supports 10 bit communication
|
// only uart0 supports 10 bit communication
|
||||||
if (obj->index != 0)
|
if (obj->index != 0)
|
||||||
error("Invalid number of bits (9) to be used with parity\r\n");
|
error("Invalid number of bits (9) to be used with parity\n");
|
||||||
data_bits = 0;
|
data_bits = 0;
|
||||||
m10 = 1;
|
m10 = 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ void spi_init(spi_t *obj, PinName mosi, PinName miso, PinName sclk, PinName ssel
|
||||||
|
|
||||||
obj->spi = (SPI_Type*)pinmap_merge(spi_data, spi_cntl);
|
obj->spi = (SPI_Type*)pinmap_merge(spi_data, spi_cntl);
|
||||||
if ((int)obj->spi == NC) {
|
if ((int)obj->spi == NC) {
|
||||||
error("SPI pinout mapping failed");
|
error("SPI pinout mapping failed\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
SIM->SCGC5 |= SIM_SCGC5_PORTC_MASK | SIM_SCGC5_PORTD_MASK;
|
SIM->SCGC5 |= SIM_SCGC5_PORTC_MASK | SIM_SCGC5_PORTD_MASK;
|
||||||
|
@ -94,11 +94,11 @@ void spi_free(spi_t *obj) {
|
||||||
}
|
}
|
||||||
void spi_format(spi_t *obj, int bits, int mode, int slave) {
|
void spi_format(spi_t *obj, int bits, int mode, int slave) {
|
||||||
if ((bits != 8) && (bits != 16)) {
|
if ((bits != 8) && (bits != 16)) {
|
||||||
error("Only 8/16 bits SPI supported");
|
error("Only 8/16 bits SPI supported\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((mode < 0) || (mode > 3)) {
|
if ((mode < 0) || (mode > 3)) {
|
||||||
error("SPI mode unsupported");
|
error("SPI mode unsupported\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t polarity = (mode & 0x2) ? 1 : 0;
|
uint32_t polarity = (mode & 0x2) ? 1 : 0;
|
||||||
|
|
|
@ -52,7 +52,7 @@ void spi_init(spi_t *obj, PinName mosi, PinName miso, PinName sclk, PinName ssel
|
||||||
|
|
||||||
obj->spi = (SPI_Type*)pinmap_merge(spi_data, spi_cntl);
|
obj->spi = (SPI_Type*)pinmap_merge(spi_data, spi_cntl);
|
||||||
if ((int)obj->spi == NC) {
|
if ((int)obj->spi == NC) {
|
||||||
error("SPI pinout mapping failed");
|
error("SPI pinout mapping failed\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// enable power and clocking
|
// enable power and clocking
|
||||||
|
@ -88,11 +88,11 @@ void spi_free(spi_t *obj) {
|
||||||
}
|
}
|
||||||
void spi_format(spi_t *obj, int bits, int mode, int slave) {
|
void spi_format(spi_t *obj, int bits, int mode, int slave) {
|
||||||
if (bits != 8) {
|
if (bits != 8) {
|
||||||
error("Only 8bits SPI supported");
|
error("Only 8bits SPI supported\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((mode < 0) || (mode > 3)) {
|
if ((mode < 0) || (mode > 3)) {
|
||||||
error("SPI mode unsupported");
|
error("SPI mode unsupported\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t polarity = (mode & 0x2) ? 1 : 0;
|
uint8_t polarity = (mode & 0x2) ? 1 : 0;
|
||||||
|
|
|
@ -34,7 +34,7 @@ void spi_init(spi_t *obj, PinName mosi, PinName miso, PinName sclk, PinName ssel
|
||||||
|
|
||||||
obj->spi = (SPI_Type*)pinmap_merge(spi_data, spi_cntl);
|
obj->spi = (SPI_Type*)pinmap_merge(spi_data, spi_cntl);
|
||||||
if ((int)obj->spi == NC) {
|
if ((int)obj->spi == NC) {
|
||||||
error("SPI pinout mapping failed");
|
error("SPI pinout mapping failed\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// enable power and clocking
|
// enable power and clocking
|
||||||
|
@ -68,11 +68,11 @@ void spi_free(spi_t *obj) {
|
||||||
}
|
}
|
||||||
void spi_format(spi_t *obj, int bits, int mode, int slave) {
|
void spi_format(spi_t *obj, int bits, int mode, int slave) {
|
||||||
if (bits != 8) {
|
if (bits != 8) {
|
||||||
error("Only 8bits SPI supported");
|
error("Only 8bits SPI supported\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((mode < 0) || (mode > 3)) {
|
if ((mode < 0) || (mode > 3)) {
|
||||||
error("SPI mode unsupported");
|
error("SPI mode unsupported\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t polarity = (mode & 0x2) ? 1 : 0;
|
uint8_t polarity = (mode & 0x2) ? 1 : 0;
|
||||||
|
|
|
@ -91,7 +91,7 @@ void spi_init(spi_t *obj, PinName mosi, PinName miso, PinName sclk, PinName ssel
|
||||||
|
|
||||||
obj->spi = (SPI_Type*)pinmap_merge(spi_data, spi_cntl);
|
obj->spi = (SPI_Type*)pinmap_merge(spi_data, spi_cntl);
|
||||||
if ((int)obj->spi == NC) {
|
if ((int)obj->spi == NC) {
|
||||||
error("SPI pinout mapping failed");
|
error("SPI pinout mapping failed\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// enable power and clocking
|
// enable power and clocking
|
||||||
|
@ -126,11 +126,11 @@ void spi_free(spi_t *obj) {
|
||||||
}
|
}
|
||||||
void spi_format(spi_t *obj, int bits, int mode, int slave) {
|
void spi_format(spi_t *obj, int bits, int mode, int slave) {
|
||||||
if ((bits != 8) && (bits != 16)) {
|
if ((bits != 8) && (bits != 16)) {
|
||||||
error("Only 8/16 bits SPI supported");
|
error("Only 8/16 bits SPI supported\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((mode < 0) || (mode > 3)) {
|
if ((mode < 0) || (mode > 3)) {
|
||||||
error("SPI mode unsupported");
|
error("SPI mode unsupported\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t polarity = (mode & 0x2) ? 1 : 0;
|
uint8_t polarity = (mode & 0x2) ? 1 : 0;
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
void analogin_init(analogin_t *obj, PinName pin) {
|
void analogin_init(analogin_t *obj, PinName pin) {
|
||||||
obj->adc = (ADCName)pinmap_peripheral(pin, PinMap_ADC);
|
obj->adc = (ADCName)pinmap_peripheral(pin, PinMap_ADC);
|
||||||
if (obj->adc == (ADCName)NC) {
|
if (obj->adc == (ADCName)NC) {
|
||||||
error("ADC pin mapping failed");
|
error("ADC pin mapping failed\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
SIM->SCGC6 |= SIM_SCGC6_ADC0_MASK;
|
SIM->SCGC6 |= SIM_SCGC6_ADC0_MASK;
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
void analogout_init(dac_t *obj, PinName pin) {
|
void analogout_init(dac_t *obj, PinName pin) {
|
||||||
obj->dac = (DACName)pinmap_peripheral(pin, PinMap_DAC);
|
obj->dac = (DACName)pinmap_peripheral(pin, PinMap_DAC);
|
||||||
if (obj->dac == (DACName)NC) {
|
if (obj->dac == (DACName)NC) {
|
||||||
error("DAC pin mapping failed");
|
error("DAC pin mapping failed\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
SIM->SCGC6 |= SIM_SCGC6_DAC0_MASK;
|
SIM->SCGC6 |= SIM_SCGC6_DAC0_MASK;
|
||||||
|
|
|
@ -46,7 +46,7 @@ void i2c_init(i2c_t *obj, PinName sda, PinName scl) {
|
||||||
I2CName i2c_scl = (I2CName)pinmap_peripheral(scl, PinMap_I2C_SCL);
|
I2CName i2c_scl = (I2CName)pinmap_peripheral(scl, PinMap_I2C_SCL);
|
||||||
obj->i2c = (I2C_Type*)pinmap_merge(i2c_sda, i2c_scl);
|
obj->i2c = (I2C_Type*)pinmap_merge(i2c_sda, i2c_scl);
|
||||||
if ((int)obj->i2c == NC) {
|
if ((int)obj->i2c == NC) {
|
||||||
error("I2C pin mapping failed");
|
error("I2C pin mapping failed\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// enable power
|
// enable power
|
||||||
|
|
|
@ -27,7 +27,7 @@ void pwmout_init(pwmout_t* obj, PinName pin) {
|
||||||
// determine the channel
|
// determine the channel
|
||||||
PWMName pwm = (PWMName)pinmap_peripheral(pin, PinMap_PWM);
|
PWMName pwm = (PWMName)pinmap_peripheral(pin, PinMap_PWM);
|
||||||
if (pwm == (PWMName)NC)
|
if (pwm == (PWMName)NC)
|
||||||
error("PwmOut pin mapping failed");
|
error("PwmOut pin mapping failed\n");
|
||||||
|
|
||||||
uint32_t clkdiv = 0;
|
uint32_t clkdiv = 0;
|
||||||
float clkval;
|
float clkval;
|
||||||
|
|
|
@ -62,7 +62,7 @@ void serial_init(serial_t *obj, PinName tx, PinName rx) {
|
||||||
UARTName uart_rx = (UARTName)pinmap_peripheral(rx, PinMap_UART_RX);
|
UARTName uart_rx = (UARTName)pinmap_peripheral(rx, PinMap_UART_RX);
|
||||||
UARTName uart = (UARTName)pinmap_merge(uart_tx, uart_rx);
|
UARTName uart = (UARTName)pinmap_merge(uart_tx, uart_rx);
|
||||||
if ((int)uart == NC) {
|
if ((int)uart == NC) {
|
||||||
error("Serial pinout mapping failed");
|
error("Serial pinout mapping failed\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
obj->uart = (UARTLP_Type *)uart;
|
obj->uart = (UARTLP_Type *)uart;
|
||||||
|
@ -159,7 +159,7 @@ void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_b
|
||||||
|
|
||||||
// TODO: Support other number of data bits (also in the write method!)
|
// TODO: Support other number of data bits (also in the write method!)
|
||||||
if ((data_bits < 8) || (data_bits > 8)) {
|
if ((data_bits < 8) || (data_bits > 8)) {
|
||||||
error("Invalid number of bits (%d) in serial format, should be 8\r\n", data_bits);
|
error("Invalid number of bits (%d) in serial format, should be 8\n", data_bits);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t parity_enable, parity_select;
|
uint8_t parity_enable, parity_select;
|
||||||
|
@ -168,13 +168,13 @@ void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_b
|
||||||
case ParityOdd : parity_enable = 1; parity_select = 1; data_bits++; break;
|
case ParityOdd : parity_enable = 1; parity_select = 1; data_bits++; break;
|
||||||
case ParityEven: parity_enable = 1; parity_select = 0; data_bits++; break;
|
case ParityEven: parity_enable = 1; parity_select = 0; data_bits++; break;
|
||||||
default:
|
default:
|
||||||
error("Invalid serial parity setting\r\n");
|
error("Invalid serial parity setting\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1 stop bits = 0, 2 stop bits = 1
|
// 1 stop bits = 0, 2 stop bits = 1
|
||||||
if ((stop_bits != 1) && (stop_bits != 2)) {
|
if ((stop_bits != 1) && (stop_bits != 2)) {
|
||||||
error("Invalid stop bits specified\r\n");
|
error("Invalid stop bits specified\n");
|
||||||
}
|
}
|
||||||
stop_bits -= 1;
|
stop_bits -= 1;
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ static const PinMap PinMap_ADC[] = {
|
||||||
void analogin_init(analogin_t *obj, PinName pin) {
|
void analogin_init(analogin_t *obj, PinName pin) {
|
||||||
obj->adc = (ADCName)pinmap_peripheral(pin, PinMap_ADC);
|
obj->adc = (ADCName)pinmap_peripheral(pin, PinMap_ADC);
|
||||||
if (obj->adc == (ADCName)NC) {
|
if (obj->adc == (ADCName)NC) {
|
||||||
error("ADC pin mapping failed");
|
error("ADC pin mapping failed\n");
|
||||||
}
|
}
|
||||||
uint32_t instance = obj->adc >> ADC_INSTANCE_SHIFT;
|
uint32_t instance = obj->adc >> ADC_INSTANCE_SHIFT;
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ const PinMap PinMap_DAC[] = {
|
||||||
void analogout_init(dac_t *obj, PinName pin) {
|
void analogout_init(dac_t *obj, PinName pin) {
|
||||||
obj->dac = (DACName)pinmap_peripheral(pin, PinMap_DAC);
|
obj->dac = (DACName)pinmap_peripheral(pin, PinMap_DAC);
|
||||||
if (obj->dac == (DACName)NC) {
|
if (obj->dac == (DACName)NC) {
|
||||||
error("DAC pin mapping failed");
|
error("DAC pin mapping failed\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
SIM->SCGC2 |= SIM_SCGC2_DAC0_MASK;
|
SIM->SCGC2 |= SIM_SCGC2_DAC0_MASK;
|
||||||
|
|
|
@ -51,7 +51,7 @@ void i2c_init(i2c_t *obj, PinName sda, PinName scl) {
|
||||||
uint32_t i2c_scl = pinmap_peripheral(scl, PinMap_I2C_SCL);
|
uint32_t i2c_scl = pinmap_peripheral(scl, PinMap_I2C_SCL);
|
||||||
obj->instance = pinmap_merge(i2c_sda, i2c_scl);
|
obj->instance = pinmap_merge(i2c_sda, i2c_scl);
|
||||||
if ((int)obj->instance == NC) {
|
if ((int)obj->instance == NC) {
|
||||||
error("I2C pin mapping failed");
|
error("I2C pin mapping failed\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
clock_manager_set_gate(kClockModuleI2C, obj->instance, true);
|
clock_manager_set_gate(kClockModuleI2C, obj->instance, true);
|
||||||
|
|
|
@ -74,7 +74,7 @@ static float pwm_clock_mhz;
|
||||||
void pwmout_init(pwmout_t* obj, PinName pin) {
|
void pwmout_init(pwmout_t* obj, PinName pin) {
|
||||||
PWMName pwm = (PWMName)pinmap_peripheral(pin, PinMap_PWM);
|
PWMName pwm = (PWMName)pinmap_peripheral(pin, PinMap_PWM);
|
||||||
if (pwm == (PWMName)NC) {
|
if (pwm == (PWMName)NC) {
|
||||||
error("PwmOut pin mapping failed");
|
error("PwmOut pin mapping failed\n");
|
||||||
}
|
}
|
||||||
obj->pwm_name = pwm;
|
obj->pwm_name = pwm;
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ void serial_init(serial_t *obj, PinName tx, PinName rx) {
|
||||||
uint32_t uart_rx = pinmap_peripheral(rx, PinMap_UART_RX);
|
uint32_t uart_rx = pinmap_peripheral(rx, PinMap_UART_RX);
|
||||||
obj->index = (UARTName)pinmap_merge(uart_tx, uart_rx);
|
obj->index = (UARTName)pinmap_merge(uart_tx, uart_rx);
|
||||||
if ((int)obj->index == NC) {
|
if ((int)obj->index == NC) {
|
||||||
error("Serial pinout mapping failed");
|
error("Serial pinout mapping failed\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
uart_config_t uart_config;
|
uart_config_t uart_config;
|
||||||
|
|
|
@ -42,7 +42,6 @@ static const PinMap PinMap_SPI_MOSI[] = {
|
||||||
{PTB16, SPI_1, 2},
|
{PTB16, SPI_1, 2},
|
||||||
{PTB22, SPI_2, 2},
|
{PTB22, SPI_2, 2},
|
||||||
{PTC6 , SPI_0, 2},
|
{PTC6 , SPI_0, 2},
|
||||||
{PTD2 , SPI_0, 2},
|
|
||||||
{PTD6 , SPI_1, 7},
|
{PTD6 , SPI_1, 7},
|
||||||
{NC , NC , 0}
|
{NC , NC , 0}
|
||||||
};
|
};
|
||||||
|
@ -55,7 +54,6 @@ static const PinMap PinMap_SPI_MISO[] = {
|
||||||
{PTB17, SPI_1, 2},
|
{PTB17, SPI_1, 2},
|
||||||
{PTB23, SPI_2, 2},
|
{PTB23, SPI_2, 2},
|
||||||
{PTC7 , SPI_0, 2},
|
{PTC7 , SPI_0, 2},
|
||||||
{PTD3 , SPI_0, 2},
|
|
||||||
{PTD7 , SPI_1, 7},
|
{PTD7 , SPI_1, 7},
|
||||||
{NC , NC , 0}
|
{NC , NC , 0}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue