aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorPerry Hung <iperry@alum.mit.edu>2010-03-31 21:29:29 -0400
committerPerry Hung <iperry@alum.mit.edu>2010-03-31 21:29:29 -0400
commit25c7ba0ed78aea0a368bc178dd720a845dd515ac (patch)
tree86be2502247dc0dd831191ae219a62875daad97c /core
parent4e51e057bb5a8d6b3475d2202af8a2a2caf9ba7b (diff)
downloadlibrambutan-25c7ba0ed78aea0a368bc178dd720a845dd515ac.tar.gz
librambutan-25c7ba0ed78aea0a368bc178dd720a845dd515ac.zip
Removed inttypes.h
Removed inttypes.h from libmaple. Will have another pass through to use the standard libmaple types, but will come in another commit.
Diffstat (limited to 'core')
-rw-r--r--core/Print.cpp12
-rw-r--r--core/Print.h13
-rw-r--r--core/comm/HardwareSerial.cpp6
-rw-r--r--core/comm/HardwareSerial.h6
-rw-r--r--core/comm/HardwareUsb.cpp8
-rw-r--r--core/comm/HardwareUsb.h8
-rw-r--r--core/ext_interrupts.c10
-rw-r--r--core/ext_interrupts.h5
-rw-r--r--core/io.h9
-rw-r--r--core/pwm.c2
-rw-r--r--core/pwm.h2
-rw-r--r--core/time.c10
-rw-r--r--core/time.h6
-rw-r--r--core/wiring.h4
-rw-r--r--core/wiring_analog.c2
-rw-r--r--core/wiring_digital.c6
-rw-r--r--core/wiring_shift.c2
17 files changed, 54 insertions, 57 deletions
diff --git a/core/Print.cpp b/core/Print.cpp
index efe3eef..da461ae 100644
--- a/core/Print.cpp
+++ b/core/Print.cpp
@@ -36,13 +36,13 @@ void Print::write(const char *str)
}
/* default implementation: may be overridden */
-void Print::write(const uint8_t *buffer, size_t size)
+void Print::write(const uint8 *buffer, uint32 size)
{
while (size--)
write(*buffer++);
}
-void Print::print(uint8_t b)
+void Print::print(uint8 b)
{
this->write(b);
}
@@ -114,7 +114,7 @@ void Print::println(const char c[])
println();
}
-void Print::println(uint8_t b)
+void Print::println(uint8 b)
{
print(b);
println();
@@ -158,7 +158,7 @@ void Print::println(double n)
// Private Methods /////////////////////////////////////////////////////////////
-void Print::printNumber(unsigned long n, uint8_t base)
+void Print::printNumber(unsigned long n, uint8 base)
{
unsigned char buf[8 * sizeof(long)]; // Assumes 8-bit chars.
unsigned long i = 0;
@@ -179,7 +179,7 @@ void Print::printNumber(unsigned long n, uint8_t base)
'A' + buf[i - 1] - 10));
}
-void Print::printFloat(double number, uint8_t digits)
+void Print::printFloat(double number, uint8 digits)
{
// Handle negative numbers
if (number < 0.0)
@@ -190,7 +190,7 @@ void Print::printFloat(double number, uint8_t digits)
// Round correctly so that print(1.999, 2) prints as "2.00"
double rounding = 0.5;
- for (uint8_t i=0; i<digits; ++i)
+ for (uint8 i=0; i<digits; ++i)
rounding /= 10.0;
number += rounding;
diff --git a/core/Print.h b/core/Print.h
index a69e85d..b2f8647 100644
--- a/core/Print.h
+++ b/core/Print.h
@@ -20,7 +20,6 @@
#ifndef Print_h
#define Print_h
-#include <inttypes.h>
#include <stdio.h> // for size_t
#define DEC 10
@@ -32,15 +31,15 @@
class Print
{
private:
- void printNumber(unsigned long, uint8_t);
- void printFloat(double, uint8_t);
+ void printNumber(unsigned long, uint8);
+ void printFloat(double, uint8);
public:
- virtual void write(uint8_t) = 0;
+ virtual void write(uint8) = 0;
virtual void write(const char *str);
- virtual void write(const uint8_t *buffer, size_t size);
+ virtual void write(const uint8 *buffer, uint32 size);
void print(char);
void print(const char[]);
- void print(uint8_t);
+ void print(uint8);
void print(int);
void print(unsigned int);
void print(long);
@@ -50,7 +49,7 @@ class Print
void println(void);
void println(char);
void println(const char[]);
- void println(uint8_t);
+ void println(uint8);
void println(int);
void println(unsigned int);
void println(long);
diff --git a/core/comm/HardwareSerial.cpp b/core/comm/HardwareSerial.cpp
index 04d8d18..7a8fed9 100644
--- a/core/comm/HardwareSerial.cpp
+++ b/core/comm/HardwareSerial.cpp
@@ -44,14 +44,14 @@
#define USART3_RX_PORT GPIOB_BASE
#define USART3_RX_PIN 11
-HardwareSerial::HardwareSerial(uint8_t usartNum) {
+HardwareSerial::HardwareSerial(uint8 usartNum) {
ASSERT(usartNum == 1 ||
usartNum == 2 ||
usartNum == 3);
this->usartNum = usartNum;
}
-uint8_t HardwareSerial::read(void) {
+uint8 HardwareSerial::read(void) {
return usart_getc(usartNum);
}
@@ -64,7 +64,7 @@ void HardwareSerial::write(unsigned char ch) {
usart_putc(usartNum, ch);
}
-void HardwareSerial::begin(uint32_t baud) {
+void HardwareSerial::begin(uint32 baud) {
ASSERT(!(baud > USART_MAX_BAUD));
/* Set appropriate pin modes */
diff --git a/core/comm/HardwareSerial.h b/core/comm/HardwareSerial.h
index a3913f9..2c9c6b8 100644
--- a/core/comm/HardwareSerial.h
+++ b/core/comm/HardwareSerial.h
@@ -32,10 +32,10 @@ class HardwareSerial : public Print {
private:
uint8 usartNum;
public:
- HardwareSerial(uint8_t);
- void begin(uint32_t);
+ HardwareSerial(uint8);
+ void begin(uint32);
uint32 available(void);
- uint8_t read(void);
+ uint8 read(void);
void flush(void);
virtual void write(unsigned char);
using Print::write;
diff --git a/core/comm/HardwareUsb.cpp b/core/comm/HardwareUsb.cpp
index 269a68f..43438f1 100644
--- a/core/comm/HardwareUsb.cpp
+++ b/core/comm/HardwareUsb.cpp
@@ -34,8 +34,8 @@ HardwareUsb::HardwareUsb(void) {
rx_buffer_offset_out = 0;
}
-uint8_t HardwareUsb::read(void) {
- uint8_t outVal = rx_buffer[rx_buffer_offset_out++];
+uint8 HardwareUsb::read(void) {
+ uint8 outVal = rx_buffer[rx_buffer_offset_out++];
#if 1
if (rx_buffer_offset_out == rx_buffer_offset_in) {
@@ -46,7 +46,7 @@ uint8_t HardwareUsb::read(void) {
return outVal;
}
-uint8_t HardwareUsb::available(void) {
+uint8 HardwareUsb::available(void) {
ASSERT(rx_buffer_offset_out >= 0);
// return rx_buffer_offset+1;
// return usb_serialGetRecvLen();
@@ -70,7 +70,7 @@ void HardwareUsb::usb_rx_cb(void) {
BootVectTable *vectTable = (BootVectTable*)(BOOTLOADER_VECT_TABLE);
HardwareUsb *thisPtr = (HardwareUsb*) vectTable->usb_local_obj_ptr;
- uint8_t numBytes = usb_serialGetRecvLen();
+ uint8 numBytes = usb_serialGetRecvLen();
#if 0
/* ONE-SHOT-TO-READ Version (buffer cleared on next recv interrupt */
diff --git a/core/comm/HardwareUsb.h b/core/comm/HardwareUsb.h
index b8733c1..a5ff191 100644
--- a/core/comm/HardwareUsb.h
+++ b/core/comm/HardwareUsb.h
@@ -33,13 +33,13 @@ class HardwareUsb : public Print {
static void usb_rx_cb(void);
static void usb_tx_cb(void);
unsigned char rx_buffer[USB_SERIAL_BUF_SIZE];
- int8_t rx_buffer_offset_out;
- int8_t rx_buffer_offset_in;
+ int8 rx_buffer_offset_out;
+ int8 rx_buffer_offset_in;
public:
HardwareUsb(void);
void begin();
- uint8_t available(void);
- uint8_t read(void);
+ uint8 available(void);
+ uint8 read(void);
void flush(void);
virtual void write(unsigned char);
using Print::write;
diff --git a/core/ext_interrupts.c b/core/ext_interrupts.c
index 20ec11f..e5919f4 100644
--- a/core/ext_interrupts.c
+++ b/core/ext_interrupts.c
@@ -28,8 +28,8 @@
#include "ext_interrupts.h"
typedef struct ExtiInfo {
- uint8_t channel;
- uint8_t port;
+ uint8 channel;
+ uint8 port;
} ExtiInfo;
static ExtiInfo PIN_TO_EXTI_CHANNEL[NR_MAPLE_PINS] = {
@@ -60,8 +60,8 @@ static ExtiInfo PIN_TO_EXTI_CHANNEL[NR_MAPLE_PINS] = {
*
* @sideeffect Registers a handler
*/
-int attachInterrupt(uint8_t pin, voidFuncPtr handler, ExtInterruptTriggerMode mode) {
- uint8_t outMode;
+int attachInterrupt(uint8 pin, voidFuncPtr handler, ExtInterruptTriggerMode mode) {
+ uint8 outMode;
/* Parameter checking */
if (pin >= NR_MAPLE_PINS) {
return EXT_INTERRUPT_INVALID_PIN;
@@ -94,7 +94,7 @@ int attachInterrupt(uint8_t pin, voidFuncPtr handler, ExtInterruptTriggerMode mo
return 0;
}
-int detachInterrupt(uint8_t pin) {
+int detachInterrupt(uint8 pin) {
if (!(pin < NR_MAPLE_PINS)) {
return EXT_INTERRUPT_INVALID_PIN;
}
diff --git a/core/ext_interrupts.h b/core/ext_interrupts.h
index d0e6365..d9e773e 100644
--- a/core/ext_interrupts.h
+++ b/core/ext_interrupts.h
@@ -37,15 +37,14 @@ enum ExtInterruptError {
EXT_INTERRUPT_INVALID_PIN = (-1),
EXT_INTERRUPT_INVALID_FUNCTION = (-2),
EXT_INTERRUPT_INVALID_MODE = (-3),
-
};
#ifdef __cplusplus
extern "C"{
#endif
-int attachInterrupt(uint8_t pin, voidFuncPtr, ExtInterruptTriggerMode mode);
-int detachInterrupt(uint8_t pin);
+int attachInterrupt(uint8 pin, voidFuncPtr, ExtInterruptTriggerMode mode);
+int detachInterrupt(uint8 pin);
#ifdef __cplusplus
}
diff --git a/core/io.h b/core/io.h
index 9f6aa4a..8de7ed3 100644
--- a/core/io.h
+++ b/core/io.h
@@ -26,7 +26,6 @@
#ifndef _IO_H
#define _IO_H
-#include <inttypes.h>
#include "gpio.h"
#include "adc.h"
@@ -110,7 +109,7 @@ typedef struct PinMapping {
* OUTPUT_OPEN_DRAIN
* }
*/
-void pinMode(uint8_t, uint8_t);
+void pinMode(uint8, uint8);
/*
* Writes VALUE to digital pin[0-38]
@@ -118,21 +117,21 @@ void pinMode(uint8_t, uint8_t);
* pin -> {0-38, D0-D39, A0-16}
* value -> LOW, HIGH;
*/
-void digitalWrite(uint8_t, uint8_t);
+void digitalWrite(uint8, uint8);
/* Read a digital value from pin, the pin mode must be set to
* {INPUT, INPUT_PULLUP, INPUT_PULLDOWN}
* digitalRead(pin)
* pin -> {0-38, D0-D39, A0-16}
*/
-uint32_t digitalRead(uint8_t);
+uint32 digitalRead(uint8);
/* Read an analog value from pin, the pin mode must be set
* to INPUT_ANALOG
* analogRead(pin)
* pin -> {A0-A16}
* */
-uint32_t analogRead(uint8_t);
+uint32 analogRead(uint8);
#ifdef __cplusplus
} // extern "C"
diff --git a/core/pwm.c b/core/pwm.c
index 2cc815c..95caff4 100644
--- a/core/pwm.c
+++ b/core/pwm.c
@@ -30,7 +30,7 @@
extern const PinMapping PIN_MAP[NR_MAPLE_PINS];
-void pwmWrite(uint8_t pin, uint16_t duty_cycle) {
+void pwmWrite(uint8 pin, uint16 duty_cycle) {
TimerCCR ccr;
if (pin >= NR_MAPLE_PINS) {
diff --git a/core/pwm.h b/core/pwm.h
index 60d805d..9d3f03a 100644
--- a/core/pwm.h
+++ b/core/pwm.h
@@ -30,7 +30,7 @@
extern "C"{
#endif
-void pwmWrite(uint8_t, uint16_t);
+void pwmWrite(uint8, uint16);
#ifdef __cplusplus
}
diff --git a/core/time.c b/core/time.c
index 164d978..4e20908 100644
--- a/core/time.c
+++ b/core/time.c
@@ -30,9 +30,9 @@
#define CYCLES_PER_MICROSECOND 72
#define FUDGE 42
-extern volatile uint32_t systick_timer_millis;
+extern volatile uint32 systick_timer_millis;
-unsigned long millis() {
+uint32 millis() {
unsigned long m;
m = systick_timer_millis;
return m;
@@ -49,9 +49,9 @@ void delay(unsigned long ms)
#if 1
-void delayMicroseconds(uint32_t us) {
- uint32_t target;
- uint32_t last, cur, count;
+void delayMicroseconds(uint32 us) {
+ uint32 target;
+ uint32 last, cur, count;
/* fudge factor hacky hack hack for function overhead */
target = us * CYCLES_PER_MICROSECOND - FUDGE;
diff --git a/core/time.h b/core/time.h
index 68b3901..377762c 100644
--- a/core/time.h
+++ b/core/time.h
@@ -30,16 +30,16 @@
extern "C"{
#endif
/* Returns time since boot in milliseconds */
-uint32_t millis(void);
+uint32 millis(void);
/* Time in microseconds since boot */
-uint32_t micros(void);
+uint32 micros(void);
/* Delay for ms milliseconds */
void delay(unsigned long ms);
/* Delay for us microseconds */
-void delayMicroseconds(uint32_t us);
+void delayMicroseconds(uint32 us);
#if 0
static inline void delay_us(uint32 us) {
diff --git a/core/wiring.h b/core/wiring.h
index bcf6eda..82ff41a 100644
--- a/core/wiring.h
+++ b/core/wiring.h
@@ -45,8 +45,8 @@ typedef uint8 boolean;
typedef uint8 byte;
void init(void);
-unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout);
-void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, byte val);
+unsigned long pulseIn(uint8 pin, uint8 state, unsigned long timeout);
+void shiftOut(uint8 dataPin, uint8 clockPin, uint8 bitOrder, byte val);
#ifdef __cplusplus
diff --git a/core/wiring_analog.c b/core/wiring_analog.c
index d7d7150..af042a7 100644
--- a/core/wiring_analog.c
+++ b/core/wiring_analog.c
@@ -31,7 +31,7 @@ extern const PinMapping PIN_MAP[NR_MAPLE_PINS];
/* Assumes that the ADC has been initialized and
* that the pin is set to ANALOG_INPUT */
-uint32_t analogRead(uint8_t pin) {
+uint32 analogRead(uint8 pin) {
if (pin >= NR_ANALOG_PINS)
return 0;
diff --git a/core/wiring_digital.c b/core/wiring_digital.c
index 71dae57..d05ac4a 100644
--- a/core/wiring_digital.c
+++ b/core/wiring_digital.c
@@ -88,7 +88,7 @@ const PinMapping PIN_MAP[NR_MAPLE_PINS] = {
{GPIOC_BASE, 9, ADC_INVALID, TIMER_INVALID} // D38/PC9
};
-void pinMode(uint8_t pin, WiringPinMode mode) {
+void pinMode(uint8 pin, WiringPinMode mode) {
uint8 outputMode;
if (pin >= NR_MAPLE_PINS)
@@ -125,14 +125,14 @@ void pinMode(uint8_t pin, WiringPinMode mode) {
}
-uint32_t digitalRead(uint8_t pin) {
+uint32 digitalRead(uint8 pin) {
if (pin >= NR_MAPLE_PINS)
return 0;
return (PIN_MAP[pin].port->IDR & BIT(PIN_MAP[pin].pin)) ? 1 : 0;
}
-void digitalWrite(uint8_t pin, uint8_t val) {
+void digitalWrite(uint8 pin, uint8 val) {
if (pin >= NR_MAPLE_PINS)
return;
diff --git a/core/wiring_shift.c b/core/wiring_shift.c
index 28c6dfc..a2487e7 100644
--- a/core/wiring_shift.c
+++ b/core/wiring_shift.c
@@ -24,7 +24,7 @@
#include "wiring.h"
-void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, byte val)
+void shiftOut(uint8 dataPin, uint8 clockPin, uint8 bitOrder, uint8 val)
{
int i;