i think in this case a bool makes more sense than an int. if it fails it's only 1 byte that was going to be written so it's ok to just return if it was written ok or not. what we should check inside is if anything fails, both because 0 bytes were written or because the there was a serial error and in both cases return false.

so this:

return (bool)OF_SERIAL_ERROR; 

should actiually be

return false

in the case of writeBytes it makes sense to return an int since it indicates how many bytes could be written but in this one i think it's ok to just return true/false